Skip to content

Commit 4782c2b

Browse files
tomasnorrejrfnl
andauthored
ci: Fix strict types sniff (#857)
Co-authored-by: jrfnl <[email protected]>
1 parent 9562ac8 commit 4782c2b

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "exercism/php",
33
"autoload": {
4-
"Exercism\\": "src",
4+
"Exercism\\Sniffs\\": "src/Exercism/Sniffs",
55
"Exercism\\Exercises\\": "exercises"
66
},
77
"config": {
@@ -13,7 +13,7 @@
1313
"php": "^8.1",
1414
"phpunit/phpunit": "^10.5",
1515
"slevomat/coding-standard": "^8.14.1",
16-
"squizlabs/php_codesniffer": "^3.9"
16+
"squizlabs/php_codesniffer": "^3.11.1"
1717
},
1818
"scripts": {
1919
"post-install-cmd": [

phpcs.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<exclude-pattern>*/concept/city-office/*</exclude-pattern>
3535
<exclude-pattern>*/concept/windowing-system/*</exclude-pattern>
3636
</rule>
37-
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TypeHints/DeclareStrictTypesSniff.php">
37+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
3838
<exclude-pattern>*/.meta/*\.php</exclude-pattern>
3939
<exclude-pattern>*/concept/*</exclude-pattern>
4040
<exclude-pattern>*/hello-world/*</exclude-pattern>
@@ -44,7 +44,7 @@
4444
<property name="spacesCountAroundEqualsSign" value="0" />
4545
</properties>
4646
</rule>
47-
<rule ref="src/Sniffs/ExplainStrictTypesSniff.php">
47+
<rule ref="src/Exercism/Sniffs/StrictTypes/ExplainStrictTypesSniff.php">
4848
<exclude-pattern>*/*Test\.php</exclude-pattern>
4949
<exclude-pattern>*/.meta/*\.php</exclude-pattern>
5050
<exclude-pattern>src/*</exclude-pattern>

src/Sniffs/ExplainStrictTypesSniff.php renamed to src/Exercism/Sniffs/StrictTypes/ExplainStrictTypesSniff.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Exercism\Sniffs;
5+
namespace Exercism\Sniffs\StrictTypes;
66

77
use PHP_CodeSniffer\Files\File;
88
use PHP_CodeSniffer\Fixer;
@@ -48,16 +48,16 @@ public function register(): array
4848
];
4949
}
5050

51-
public function process(File $file, $stackPtr)
51+
public function process(File $phpcsFile, $stackPtr): void
5252
{
53-
$this->fixer = $file->fixer;
53+
$this->fixer = $phpcsFile->fixer;
5454
$this->position = $stackPtr;
5555

56-
if (!$file->findPrevious($this->tokens, $stackPtr)) {
57-
$file->addFixableError(
56+
if (!$phpcsFile->findPrevious($this->tokens, $stackPtr)) {
57+
$phpcsFile->addFixableError(
5858
'Missing explanation of declaration of strict types.',
5959
$stackPtr - 1,
60-
self::class
60+
'Missing'
6161
);
6262
$this->fix();
6363
}

0 commit comments

Comments
 (0)