Skip to content
Snippets Groups Projects
Unverified Commit eb31ae91 authored by Mitch Portier's avatar Mitch Portier Committed by GitHub
Browse files

feat(DeclareStrictTypes): Add Slevomat sniff for declare strict_types (#3407995)

parent 0f95abc3
No related branches found
No related tags found
No related merge requests found
......@@ -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. -->
......@@ -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>
......@@ -69,12 +69,13 @@ class BadUnitTest extends CoderSniffUnitTest
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 [
......@@ -404,7 +405,7 @@ class BadUnitTest extends CoderSniffUnitTest
{
switch ($testFile) {
case 'bad.module':
return [7 => 1];
return [9 => 1];
case 'bad.php':
return [
14 => 1,
......
......@@ -4,6 +4,8 @@
* Bad examples of install hooks in a module file.
*/
declare(strict_types = 1);
define('UNPREFIXED_CONSTANT', 'invalid');
/**
......
......@@ -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% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment