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
2 changes: 1 addition & 1 deletion PSR2R/Sniffs/Commenting/DocBlockParamSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private function getMethodSignature(File $phpCsFile, int $stackPtr): array {
while ($nextVariableIndex = $phpCsFile->findNext(T_VARIABLE, $i + 1, $endIndex)) {
$typehint = $default = null;
$possibleTypeHint =
$phpCsFile->findPrevious([T_ARRAY_HINT, T_CALLABLE], $nextVariableIndex - 1, $nextVariableIndex - 3);
$phpCsFile->findPrevious([T_ARRAY, T_CALLABLE], $nextVariableIndex - 1, $nextVariableIndex - 3);
if ($possibleTypeHint) {
$typehint = $possibleTypeHint;
}
Expand Down
2 changes: 1 addition & 1 deletion PSR2R/Sniffs/Methods/MethodDeclarationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScop
$tokens = $phpcsFile->getTokens();

$methodName = $phpcsFile->getDeclarationName($stackPtr);
if ($methodName === null) {
if (!$methodName) {
// Ignore closures.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ protected function checkUseForReturnTypeHint(File $phpcsFile, int $stackPtr): vo
$extractedUseStatement = '';
$lastSeparatorIndex = null;
while (true) {
if (!$this->isGivenKind([T_NS_SEPARATOR, T_STRING, T_RETURN_TYPE], $tokens[$j])) {
if (!$this->isGivenKind([T_NS_SEPARATOR, T_STRING], $tokens[$j])) {
break;
}

Expand Down
2 changes: 1 addition & 1 deletion PSR2R/Tools/Traits/SignatureTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getMethodSignature(File $phpCsFile, int $stackPtr): array {
$i = $startIndex;
while ($nextVariableIndex = $phpCsFile->findNext(T_VARIABLE, $i + 1, $endIndex)) {
$typehintIndex = $defaultIndex = $default = null;
$possibleTypeHint = $phpCsFile->findPrevious([T_ARRAY_HINT, T_CALLABLE], $nextVariableIndex - 1, $nextVariableIndex - 3);
$possibleTypeHint = $phpCsFile->findPrevious([T_ARRAY, T_CALLABLE], $nextVariableIndex - 1, $nextVariableIndex - 3);
if ($possibleTypeHint) {
$typehintIndex = $possibleTypeHint;
}
Expand Down
1 change: 1 addition & 0 deletions PSR2R/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<exclude-pattern>\.json</exclude-pattern>

<config name="installed_paths" value="../../slevomat/coding-standard,../../php-collective/code-sniffer,../../phpcsstandards/phpcsextra"/>
<config name="php_version" value="80100"/>

<arg name="tab-width" value="4"/>

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
],
"require": {
"php": ">=8.1",
"php-collective/code-sniffer": "^0.3.0",
"slevomat/coding-standard": "^8.16.0",
"squizlabs/php_codesniffer": "^3.7.0"
"php-collective/code-sniffer": "^0.4",
"squizlabs/php_codesniffer": "^4.0.0"
},
"require-dev": {
"phpunit/phpunit": "^10.3 || ^11.5 || ^12.0",
"phpstan/phpstan": "^2.1.0"
"phpstan/phpstan": "^2.1.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 0 additions & 2 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0"?>
<ruleset name="code-sniffer">
<config name="installed_paths" value="../../fig-r/psr2r-sniffer"/>

<arg value="nps"/>

<file>PSR2R/</file>
Expand Down