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
6 changes: 3 additions & 3 deletions AntipinCS/Sniffs/Classes/PropertyTypeDeclarationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class PropertyTypeDeclarationSniff extends AbstractVariableSniff
{
protected function processMemberVar(File $phpcsFile, $stackPtr): void
protected function processMemberVar(File $phpcsFile, int $stackPtr): void
{
$tokens = $phpcsFile->getTokens();

Expand Down Expand Up @@ -66,7 +66,7 @@ protected function processMemberVar(File $phpcsFile, $stackPtr): void
*
* @return void
*/
protected function processVariable(File $phpcsFile, $stackPtr): void
protected function processVariable(File $phpcsFile, int $stackPtr): void
{
/*
We don't care about normal variables.
Expand All @@ -81,7 +81,7 @@ protected function processVariable(File $phpcsFile, $stackPtr): void
*
* @return void
*/
protected function processVariableInString(File $phpcsFile, $stackPtr): void
protected function processVariableInString(File $phpcsFile, int $stackPtr): void
{
/*
We don't care about normal variables.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function register(): array
];
}

public function process(File $phpcsFile, $stackPtr): void
public function process(File $phpcsFile, int $stackPtr): void
{
$tokens = $phpcsFile->getTokens();
$token = $tokens[$stackPtr];
Expand Down
5 changes: 3 additions & 2 deletions AntipinCS/Sniffs/Functions/ReturnTypeDeclarationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function register(): array
];
}

public function process(File $phpcsFile, $stackPtr): void
public function process(File $phpcsFile, int $stackPtr): void
{
$tokens = $phpcsFile->getTokens();
$token = $tokens[$stackPtr];
Expand All @@ -36,9 +36,10 @@ public function process(File $phpcsFile, $stackPtr): void
);
return;
}
static $skipTypes = ['T_CLOSURE' => true, 'T_FN' => true];
static $skipMethods = ['__construct' => true, '__destruct' => true];
if (
$token['code'] !== 311
!isset($skipTypes[$token['type']])
&& ($methodName = $phpcsFile->getDeclarationName($stackPtr)) !== null
&& isset($skipMethods[$methodName])
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class ParameterTypeDeclarationUnitTest extends AbstractSniffUnitTest
*
* @return string[]
*/
protected function getTestFiles($testFileBase): array
protected function getTestFiles(string $testFileBase): array
{
return array_map(static fn (int $i): string => $testFileBase . $i . '.inc', range(1, 4));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ReturnTypeDeclarationUnitTest extends AbstractSniffUnitTest
*
* @return string[]
*/
protected function getTestFiles($testFileBase): array
protected function getTestFiles(string $testFileBase): array
{
return array_map(static fn (int $i): string => $testFileBase . $i . '.inc', range(1, 2));
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"license": "Unlicense",
"require": {
"php": ">=8.4",
"squizlabs/php_codesniffer": "^3.13",
"squizlabs/php_codesniffer": "^4",
"dealerdirect/phpcodesniffer-composer-installer": "^1.2"
},
"require-dev": {
Expand Down
Loading