Skip to content

Commit c78c030

Browse files
committed
Coding standards improvements.
1 parent c164697 commit c78c030

File tree

15 files changed

+28
-31
lines changed

15 files changed

+28
-31
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,3 @@ please search for an issue about it at http://drupal.org/project/issues/examples
7777
If there isn't already an issue for it, please create a new one.
7878

7979
Thanks.
80-

config_entity_example/src/Controller/RobotListBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function buildHeader() {
4646
/**
4747
* Builds a row for an entity in the entity listing.
4848
*
49-
* @param EntityInterface $entity
49+
* @param \Drupal\Core\Entity\EntityInterface $entity
5050
* The entity for which to build the row.
5151
*
5252
* @return array

config_entity_example/src/Form/RobotFormBase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
120120
* The entity ID.
121121
* @param array $element
122122
* The form element.
123-
* @param FormStateInterface $form_state
123+
* @param \Drupal\Core\Form\FormStateInterface $form_state
124124
* The form state.
125125
*
126126
* @return bool

email_example/email_example.info.yml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Email Example
22
type: module
33
description: Demonstrates how to send and alter Drupal-generated email messages.
44
package: Example modules
5-
version: 8.x-1.x
65
core: 8.x
76
dependencies:
87
- examples:examples
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
events_example.description:
22
title: 'Events Example'
33
description: 'Example of dispatching and subscribing to events.'
4-
route_name: events_example.description
4+
route_name: events_example.description

events_example/events_example.routing.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ events_example.description:
55
_form: '\Drupal\events_example\Form\EventsExampleForm'
66
_title: 'Events Example'
77
requirements:
8-
_permission: 'access content'
8+
_permission: 'access content'

events_example/events_example.services.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ services:
1313
# \Symfony\Component\EventDispatcher\EventSubscriberInterface
1414
class: Drupal\events_example\EventSubscriber\EventsExampleSubscriber
1515
tags:
16-
- {name: event_subscriber}
16+
- {name: event_subscriber}

fapi_example/src/Form/DemoBase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abstract class DemoBase extends FormBase {
2121
*
2222
* @param array $form
2323
* The render array of the currently built form.
24-
* @param FormStateInterface $form_state
24+
* @param \Drupal\Core\Form\FormStateInterface $form_state
2525
* Object describing the current state of the form.
2626
*/
2727
public function submitForm(array &$form, FormStateInterface $form_state) {

fapi_example/src/Form/SimpleForm.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SimpleForm extends FormBase {
2424
*
2525
* @param array $form
2626
* Default form array structure.
27-
* @param FormStateInterface $form_state
27+
* @param \Drupal\Core\Form\FormStateInterface $form_state
2828
* Object containing current form state.
2929
*
3030
* @return array
@@ -77,7 +77,7 @@ public function getFormId() {
7777
*
7878
* @param array $form
7979
* The render array of the currently built form.
80-
* @param FormStateInterface $form_state
80+
* @param \Drupal\Core\Form\FormStateInterface $form_state
8181
* Object describing the current state of the form.
8282
*/
8383
public function validateForm(array &$form, FormStateInterface $form_state) {
@@ -95,7 +95,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
9595
*
9696
* @param array $form
9797
* The render array of the currently built form.
98-
* @param FormStateInterface $form_state
98+
* @param \Drupal\Core\Form\FormStateInterface $form_state
9999
* Object describing the current state of the form.
100100
*/
101101
public function submitForm(array &$form, FormStateInterface $form_state) {

field_permission_example/field_permission_example.info.yml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Field Permission Example
22
type: module
33
description: Demonstrates how to create a field and implement access control over it.
44
package: Example modules
5-
version: 8.x-1.x
65
core: 8.x
76
dependencies:
87
- drupal:node

file_example/src/Form/FileExampleReadWriteForm.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,28 @@ class FileExampleReadWriteForm extends FormBase {
2626
/**
2727
* Interface of the "state" service for site-specific data.
2828
*
29-
* @var StateInterface
29+
* @var \Drupal\Core\State\StateInterface
3030
*/
3131
protected $state;
3232

3333
/**
3434
* Object used to get request data, such as the session.
3535
*
36-
* @var RequestStack
36+
* @var \Symfony\Component\HttpFoundation\RequestStack
3737
*/
3838
protected $requestStack;
3939

4040
/**
4141
* Service for manipulating a file system.
4242
*
43-
* @var FileSystemInterface
43+
* @var \Drupal\Core\File\FileSystemInterface
4444
*/
4545
protected $fileSystem;
4646

4747
/**
4848
* Service for fetching a stream wrapper for a file or directory.
4949
*
50-
* @var StreamWrapperManagerInterface
50+
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
5151
*/
5252
protected $streamWrapperManager;
5353

@@ -61,24 +61,24 @@ class FileExampleReadWriteForm extends FormBase {
6161
/**
6262
* Service for invoking hooks and other module operations.
6363
*
64-
* @var ModuleHandlerInterface
64+
* @var \Drupal\Core\Extension\ModuleHandlerInterface
6565
*/
6666
protected $moduleHandler;
6767

6868
/**
6969
* Constructs a new FileExampleReadWriteForm page.
7070
*
71-
* @param StateInterface $state
71+
* @param \Drupal\Core\State\StateInterface $state
7272
* Storage interface for state data.
73-
* @param FileSystemInterface $file_system
73+
* @param \Drupal\Core\File\FileSystemInterface $file_system
7474
* Interface for common file system operations.
75-
* @param StreamWrapperManagerInterface $stream_wrapper_manager
75+
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
7676
* Interface to obtain stream wrappers used to manipulate a given file
7777
* scheme.
78-
* @param ModuleHandlerInterface $module_handler
78+
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
7979
* Interface to get information about the status of modules and other
8080
* extensions.
81-
* @param RequestStack $request_stack
81+
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
8282
* Access to the current request, including to session objects.
8383
*/
8484
public function __construct(
@@ -194,7 +194,7 @@ protected function setDefaultDirectory($uri) {
194194
* @param string $uri
195195
* The URI of the file, like public://test.txt.
196196
*
197-
* @return FileInterface|bool
197+
* @return \Drupal\file\Entity\FileInterface|bool
198198
* A file object that matches the URI, or FALSE if not a managed file.
199199
*
200200
* @todo This should still work. An entity query could be used instead.
@@ -772,7 +772,7 @@ public function handleDirectoryDelete(array &$form, FormStateInterface $form_sta
772772
*
773773
* @param array $form
774774
* FormAPI form.
775-
* @param FormStateInterface $form_state
775+
* @param \Drupal\Core\Form\FormStateInterface $form_state
776776
* FormAPI form state.
777777
*/
778778
public function handleDirectoryExists(array &$form, FormStateInterface $form_state) {
@@ -810,7 +810,7 @@ public function handleShowSession(array &$form, FormStateInterface $form_state)
810810
*
811811
* @param array $form
812812
* FormAPI form.
813-
* @param FormStateInterface $form_state
813+
* @param \Drupal\Core\Form\FormStateInterface $form_state
814814
* FormAPI form state.
815815
*
816816
* @todo Note this does NOT clear any managed file references in Drupal's DB.

phpcs.xml.dist

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ruleset name="drupal_examples">
88
<description>Default PHP CodeSniffer configuration for Examples for Developers.</description>
99
<file>.</file>
10-
<arg name="extensions" value="css,inc,install,module,php,profile,test,theme"/>
10+
<arg name="extensions" value="css,inc,install,module,php,profile,test,theme,yml"/>
1111
<rule ref="Drupal.Array.Array.CommaLastItem"/>
1212
<rule ref="Drupal.CSS"/>
1313
<rule ref="Drupal.Classes"/>
@@ -16,9 +16,10 @@
1616
<exclude name="Drupal.Commenting.DocComment.MissingShort"/>
1717
<exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
1818
</rule>
19-
<rule ref="Drupal.Commenting.InlineComment"/>
19+
<rule ref="Drupal.Commenting.DataTypeNamespace"/>
2020
<rule ref="Drupal.Commenting.FileComment.NamespaceNoFileDoc"/>
2121
<rule ref="Drupal.Commenting.FunctionComment"/>
22+
<rule ref="Drupal.Commenting.InlineComment"/>
2223
<rule ref="Drupal.ControlStructures"/>
2324
<rule ref="Drupal.Files"/>
2425
<rule ref="Drupal.Formatting"/>

stream_wrapper_example/src/StreamWrapper/MockSessionTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait MockSessionTrait {
2222
/**
2323
* A representation of the HTTP request.
2424
*
25-
* @var RequestStack|ProphecyInterface
25+
* @var \Symfony\Component\HttpFoundation\RequestStack|\Prophecy\Prophecy\ProphecyInterface
2626
*/
2727
protected $requestStack;
2828

stream_wrapper_example/src/StreamWrapper/SessionWrapper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SessionWrapper {
1717
/**
1818
* Representation of the current HTTP request.
1919
*
20-
* @var RequestStack
20+
* @var \Symfony\Component\HttpFoundation\RequestStack
2121
*/
2222
protected $requestStack;
2323

@@ -31,7 +31,7 @@ class SessionWrapper {
3131
/**
3232
* Construct our helper object.
3333
*
34-
* @param RequestStack $request_stack
34+
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
3535
* An object used to read data from the current HTTP request.
3636
*/
3737
public function __construct(RequestStack $request_stack) {

tests/modules/examples_description_test/examples_description_test.info.yml

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ package: Testing
55
core: 8.x
66
dependencies:
77
- examples
8-

0 commit comments

Comments
 (0)