Skip to content

Commit

Permalink
First commit from PR 217
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan1055 committed Dec 13, 2023
1 parent ba6e623 commit db2c5e0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
10 changes: 9 additions & 1 deletion coder_sniffer/Drupal/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" />
<rule ref="SlevomatCodingStandard.PHP.ShortList" />
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing"/>
<properties>
<property name="linesCountBeforeDeclare" value="1"/>
<property name="linesCountAfterDeclare" value="1"/>
<property name="spacesCountAroundEqualsSign" value="0"/>
</properties>
</rule>

<rule ref="Squiz.Arrays.ArrayDeclaration" />
<!-- Disable some error messages that we do not want. -->
Expand Down Expand Up @@ -298,7 +306,7 @@
<exclude-pattern>*/\.svn/*</exclude-pattern>
<exclude-pattern>*/\.hg/*</exclude-pattern>
<exclude-pattern>*/\.bzr/*</exclude-pattern>

<!-- Ignore minified CSS files.-->
<exclude-pattern>*\.min\.css$</exclude-pattern>
</ruleset>
15 changes: 8 additions & 7 deletions tests/Drupal/bad/BadUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ protected function getErrorList(string $testFile): array
case 'bad.module':
return [
1 => 1,
12 => 1,
19 => 1,
26 => 1,
33 => 1,
44 => 1,
45 => 1,
7 => 1,
14 => 1,
21 => 1,
28 => 1,
35 => 1,
46 => 1,
47 => 1,
];
case 'bad.php':
return [
Expand Down Expand Up @@ -404,7 +405,7 @@ protected function getWarningList(string $testFile): array
{
switch ($testFile) {
case 'bad.module':
return [7 => 1];
return [9 => 1];
case 'bad.php':
return [
14 => 1,
Expand Down
2 changes: 2 additions & 0 deletions tests/Drupal/bad/bad.module
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Bad examples of install hooks in a module file.
*/

declare(strict_types = 1);

define('UNPREFIXED_CONSTANT', 'invalid');

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Drupal/good/good.module
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
* It is used to check sniffs that run on .module files but skip .php files.
*/

declare(strict_types=1);

define('GOOD_FOO_BAR', 5);

0 comments on commit db2c5e0

Please sign in to comment.