Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix strict types sniff #857

Merged
merged 7 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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 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\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