Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "exercism/php",
"autoload": {
"Exercism\\": "src",
"Exercism\\Sniffs\\": "src/Exercism/Sniffs",
"Exercism\\Exercises\\": "exercises"
},
"config": {
Expand All @@ -13,7 +13,7 @@
"php": "^8.1",
"phpunit/phpunit": "^10.5",
"slevomat/coding-standard": "^8.14.1",
"squizlabs/php_codesniffer": "^3.9"
"squizlabs/php_codesniffer": "^3.11.1"
},
"scripts": {
"post-install-cmd": [
Expand Down
4 changes: 2 additions & 2 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<exclude-pattern>*/concept/city-office/*</exclude-pattern>
<exclude-pattern>*/concept/windowing-system/*</exclude-pattern>
</rule>
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TypeHints/DeclareStrictTypesSniff.php">
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<exclude-pattern>*/.meta/*\.php</exclude-pattern>
<exclude-pattern>*/concept/*</exclude-pattern>
<exclude-pattern>*/hello-world/*</exclude-pattern>
Expand All @@ -44,7 +44,7 @@
<property name="spacesCountAroundEqualsSign" value="0" />
</properties>
</rule>
<rule ref="src/Sniffs/ExplainStrictTypesSniff.php">
<rule ref="src/Exercism/Sniffs/StrictTypes/ExplainStrictTypesSniff.php">
<exclude-pattern>*/*Test\.php</exclude-pattern>
<exclude-pattern>*/.meta/*\.php</exclude-pattern>
<exclude-pattern>src/*</exclude-pattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Exercism\Sniffs;
namespace Exercism\Sniffs\StrictTypes;

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Fixer;
Expand Down Expand Up @@ -48,16 +48,16 @@ public function register(): array
];
}

public function process(File $file, $stackPtr)
public function process(File $phpcsFile, $stackPtr): void
{
$this->fixer = $file->fixer;
$this->fixer = $phpcsFile->fixer;
$this->position = $stackPtr;

if (!$file->findPrevious($this->tokens, $stackPtr)) {
$file->addFixableError(
if (!$phpcsFile->findPrevious($this->tokens, $stackPtr)) {
$phpcsFile->addFixableError(
'Missing explanation of declaration of strict types.',
$stackPtr - 1,
self::class
'Missing'
);
$this->fix();
}
Expand Down