Skip to content

Commit f1ae71d

Browse files
committedJul 19, 2018
CS updates adding rules with properties to phpcs.xml.dist.
1 parent 5f392cb commit f1ae71d

File tree

19 files changed

+71
-34
lines changed

19 files changed

+71
-34
lines changed
 

‎block_example/src/Controller/BlockExampleController.php

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Drupal\block_example\Controller;
44

55
use Drupal\examples\Utility\DescriptionTemplateTrait;
6+
67
/**
78
* Controller routines for block example routes.
89
*/

‎cache_example/src/Form/CacheExampleForm.php

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Symfony\Component\DependencyInjection\ContainerInterface;
1212
use Symfony\Component\HttpFoundation\RequestStack;
1313

14-
1514
/**
1615
* Form with examples on how to use cache.
1716
*/

‎content_entity_example/src/Form/ContactSettingsForm.php

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* @ingroup content_entity_example
1212
*/
1313
class ContactSettingsForm extends FormBase {
14+
1415
/**
1516
* Returns a unique string identifying the form.
1617
*

‎email_example/tests/src/Functional/EmailExampleTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Drupal\Core\Test\AssertMailTrait;
66
use Drupal\Tests\examples\Functional\ExamplesBrowserTestBase;
77

8-
98
/**
109
* Tests for the email_example module.
1110
*

‎field_example/src/Plugin/Field/FieldType/RgbItem.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* )
2020
*/
2121
class RgbItem extends FieldItemBase {
22+
2223
/**
2324
* {@inheritdoc}
2425
*/

‎field_example/tests/src/Functional/FieldExampleMenuTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Drupal\Tests\field_example\Functional;
44

5-
65
/**
76
* Test the user-facing menus in Field Example.
87
*

‎field_permission_example/css/field_permission_example.css

+14-14
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
* CSS for Field Example.
44
*/
55
.stickynote {
6-
background: #fefabc;
7-
padding: 0.8em;
8-
font-family: cursive;
9-
font-size: 1.1em;
10-
color: #def9ff;
11-
width: 15em;
12-
-moz-transform: rotate(2deg);
13-
-webkit-transform: rotate(2deg);
14-
-o-transform: rotate(2deg);
15-
-ms-transform: rotate(2deg);
16-
transform: rotate(2deg);
17-
-moz-box-shadow: 0 4px 6px #333;
18-
-webkit-box-shadow: 0 4px 6px #333;
19-
box-shadow: 0 4px 6px #333;
6+
background: #fefabc;
7+
padding: 0.8em;
8+
font-family: cursive;
9+
font-size: 1.1em;
10+
color: #def9ff;
11+
width: 15em;
12+
-moz-transform: rotate(2deg);
13+
-webkit-transform: rotate(2deg);
14+
-o-transform: rotate(2deg);
15+
-ms-transform: rotate(2deg);
16+
transform: rotate(2deg);
17+
-moz-box-shadow: 0 4px 6px #333;
18+
-webkit-box-shadow: 0 4px 6px #333;
19+
box-shadow: 0 4px 6px #333;
2020
}

‎field_permission_example/field_permission_example.module

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ function field_permission_example_entity_field_access($operation, FieldDefinitio
153153
return AccessResult::forbidden();
154154
}
155155

156-
157156
/**
158157
* Implements hook_ENTITY_TYPE_access().
159158
*
@@ -176,6 +175,7 @@ function field_permission_example_entity_test_access(EntityInterface $entity, $o
176175
}
177176
return AccessResult::neutral();
178177
}
178+
179179
/**
180180
* @} End of "defgroup field_permission_example".
181181
*/

‎field_permission_example/src/Controller/FieldPermissionExampleController.php

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Drupal\Core\Controller\ControllerBase;
66
use Drupal\Core\Link;
7+
78
/**
89
* Controller routines for field permission example routes.
910
*/

‎field_permission_example/src/Plugin/Field/FieldType/FieldNote.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* )
2020
*/
2121
class FieldNote extends FieldItemBase {
22+
2223
/**
2324
* {@inheritdoc}
2425
*/

‎js_example/css/jsweights.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.js-weights div {
2-
font-size: 20px;
3-
font-weight: bold;
2+
font-size: 20px;
3+
font-weight: bold;
44
}

‎js_example/tests/src/Functional/JsExampleTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
namespace Drupal\Tests\js_example\Functional;
4+
45
use Drupal\Tests\examples\Functional\ExamplesBrowserTestBase;
56

67
/**

‎menu_example/src/Routing/MenuExampleDynamicRoutes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function routes() {
3333
];
3434

3535
foreach ($tabs as $path => $title) {
36-
$machine_name = 'examples.menu_example.'. str_replace('/', '_', $path);
36+
$machine_name = 'examples.menu_example.' . str_replace('/', '_', $path);
3737
$routes[$machine_name] = new Route(
3838
// Path to attach this route to:
3939
'/examples/menu-example/' . $path,

‎node_type_example/tests/src/Functional/NodeTypeExampleTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ public function testNodeCreation() {
154154
$this->assertText($body);
155155
}
156156

157-
158157
/**
159158
* Verify that user can uninstall and then reinstall node_type_example.
160159
*/

‎phpcs.xml.dist

+46-9
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
<rule ref="Drupal.CSS"/>
1313
<rule ref="Drupal.Classes"/>
1414
<rule ref="Drupal.Commenting">
15-
<exclude name="Drupal.Commenting.DocComment.MissingShort"/>
16-
<!-- TagsNotGrouped has false positives for @code/@endcode. See
17-
https://www.drupal.org/node/2502837 -->
18-
<exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
19-
<!-- We have to document hooks in a non-standard way in order to be
15+
<exclude name="Drupal.Commenting.DocComment.MissingShort"/>
16+
<!-- TagsNotGrouped has false positives for @code/@endcode. See
17+
https://www.drupal.org/node/2502837 -->
18+
<exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
19+
<!-- We have to document hooks in a non-standard way in order to be
2020
informative -->
21-
<exclude name="Drupal.Commenting.HookComment.HookParamDoc"/>
22-
<exclude name="Drupal.Commenting.HookComment.HookReturnDoc"/>
21+
<exclude name="Drupal.Commenting.HookComment.HookParamDoc"/>
22+
<exclude name="Drupal.Commenting.HookComment.HookReturnDoc"/>
2323
</rule>
2424
<rule ref="Drupal.ControlStructures"/>
2525
<rule ref="Drupal.Files"/>
@@ -30,11 +30,25 @@
3030
<rule ref="Drupal.Semantics"/>
3131
<rule ref="Drupal.Strings"/>
3232
<rule ref="Drupal.WhiteSpace"/>
33+
<rule ref="Drupal.Files.TxtFileLineLength.TooLong"/>
3334

34-
<rule ref="Generic.Files.LineEndings"/>
35+
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod">
36+
<!-- We exclude this rule so that we can demonstrate where to add your own
37+
validation code to a form. -->
38+
<exclude name="Generic.CodeAnalysis.UselessOverridingMethod.Found"/>
39+
</rule>
40+
<rule ref="Generic.Files.LineEndings">
41+
<properties>
42+
<property name="eolChar" value="\n"/>
43+
</properties>
44+
</rule>
3545
<rule ref="Generic.Formatting.SpaceAfterCast"/>
3646
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
37-
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
47+
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
48+
<properties>
49+
<property name="checkClosures" value="true"/>
50+
</properties>
51+
</rule>
3852
<rule ref="Generic.PHP.DeprecatedFunctions"/>
3953
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
4054
<rule ref="Generic.PHP.LowerCaseKeyword"/>
@@ -44,21 +58,44 @@
4458
<rule ref="MySource.Debug.DebugCode"/>
4559

4660
<rule ref="PSR2.Classes.PropertyDeclaration"/>
61+
<rule ref="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/>
62+
<rule ref="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
4763

4864
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
4965
<rule ref="Squiz.CSS.ClassDefinitionOpeningBraceSpace"/>
5066
<rule ref="Squiz.CSS.ColonSpacing"/>
5167
<rule ref="Squiz.CSS.DisallowMultipleStyleDefinitions"/>
5268
<rule ref="Squiz.CSS.EmptyClassDefinition"/>
5369
<rule ref="Squiz.CSS.EmptyStyleDefinition"/>
70+
<rule ref="Squiz.CSS.Indentation">
71+
<properties>
72+
<property name="indent" value="2"/>
73+
</properties>
74+
</rule>
5475
<rule ref="Squiz.CSS.MissingColon"/>
5576
<rule ref="Squiz.CSS.SemicolonSpacing"/>
5677
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
5778
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
5879
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
80+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
81+
<properties>
82+
<property name="equalsSpacing" value="1"/>
83+
</properties>
84+
</rule>
5985
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
6086
<rule ref="Squiz.PHP.NonExecutableCode"/>
6187
<rule ref="Squiz.Scope.MethodScope"/>
88+
<rule ref="Squiz.Strings.ConcatenationSpacing">
89+
<properties>
90+
<property name="spacing" value="1"/>
91+
<property name="ignoreNewlines" value="true"/>
92+
</properties>
93+
</rule>
94+
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
95+
<properties>
96+
<property name="spacing" value="1"/>
97+
</properties>
98+
</rule>
6299
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
63100

64101
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>

‎phpunit_example/src/DisplayManager.php

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Drupal\phpunit_example;
44

5-
65
/**
76
* An example class to demonstrate unit testing.
87
*

‎phpunit_example/src/ProtectedPrivates.php

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Drupal\phpunit_example;
44

5-
65
/**
76
* A class with features to show how to do unit testing.
87
*

‎render_example/src/Form/RenderExampleDemoForm.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Drupal\Core\Config\ConfigFactoryInterface;
99
use Symfony\Component\DependencyInjection\ContainerInterface;
1010

11-
1211
/**
1312
* Provides the form for toggling module features on and off.
1413
*

‎testing_example/tests/src/Functional/SkeletonTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
namespace Drupal\Tests\testing_example\Functional;
4+
45
/**
56
* How the namespace works.
67
*

0 commit comments

Comments
 (0)
Please sign in to comment.