Skip to content

Commit a747422

Browse files
authored
Merge pull request #427 from cakephp/fix-void-null-type-order-conflict
Fix conflict between TypeHintSniff and Slevomat null position sniffs
1 parent 1950643 commit a747422

4 files changed

Lines changed: 19 additions & 2 deletions

File tree

CakePHP/Tests/Commenting/TypeHintUnitTest.1.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,12 @@ function test()
4545
function intersection($param)
4646
{
4747
}
48+
49+
/**
50+
* Void must be last, after null.
51+
*
52+
* @return int|void|null
53+
*/
54+
function voidAfterNull()
55+
{
56+
}

CakePHP/Tests/Commenting/TypeHintUnitTest.1.inc.fixed

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,12 @@ function test()
4545
function intersection($param)
4646
{
4747
}
48+
49+
/**
50+
* Void must be last, after null.
51+
*
52+
* @return int|null|void
53+
*/
54+
function voidAfterNull()
55+
{
56+
}

CakePHP/Tests/Commenting/TypeHintUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function getWarningList($testFile = '')
3232
27 => 1,
3333
37 => 1,
3434
42 => 1,
35+
52 => 1,
3536
];
3637

3738
default:

CakePHP/ruleset.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@
233233
<property name="withSpacesAroundOperators" value="no"/>
234234
<property name="withSpacesInsideParentheses" value="no"/>
235235
<property name="shortNullable" value="yes"/>
236-
<property name="nullPosition" value="last"/>
237236
</properties>
238237
<exclude-pattern>*/tests/*</exclude-pattern>
239238
</rule>
@@ -258,7 +257,6 @@
258257
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/>
259258
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullSafeObjectOperator"/>
260259
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference"/>
261-
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
262260

263261
<!-- phpcs Zend sniffs -->
264262
<rule ref="Zend.NamingConventions.ValidVariableName">

0 commit comments

Comments
 (0)