diff --git a/composer.json b/composer.json index ee007c67..e7aba8f0 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "exercism/php", "autoload": { - "Exercism\\": "src", + "Exercism\\Sniffs\\": "src/Exercism/Sniffs", "Exercism\\Exercises\\": "exercises" }, "config": { @@ -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": [ diff --git a/phpcs.xml b/phpcs.xml index b31d1cf6..c88f737e 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -34,7 +34,7 @@ */concept/city-office/* */concept/windowing-system/* - + */.meta/*\.php */concept/* */hello-world/* @@ -44,7 +44,7 @@ - + */*Test\.php */.meta/*\.php src/* diff --git a/src/Sniffs/ExplainStrictTypesSniff.php b/src/Exercism/Sniffs/StrictTypes/ExplainStrictTypesSniff.php similarity index 85% rename from src/Sniffs/ExplainStrictTypesSniff.php rename to src/Exercism/Sniffs/StrictTypes/ExplainStrictTypesSniff.php index 5b9a4d31..f232391a 100644 --- a/src/Sniffs/ExplainStrictTypesSniff.php +++ b/src/Exercism/Sniffs/StrictTypes/ExplainStrictTypesSniff.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Exercism\Sniffs; +namespace Exercism\Sniffs\StrictTypes; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Fixer; @@ -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(); }