diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a98bd5..46a44f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,11 @@ on: jobs: testsuite: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: - php-version: ['8.1', '8.2', '8.3'] + php-version: ['8.1', '8.2', '8.3', '8.4'] dependencies: ['highest'] include: - php-version: '8.1' @@ -40,10 +40,10 @@ jobs: cs-stan: name: Coding Standard & Static Analysis - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/CakePHP/Sniffs/Classes/ReturnTypeHintSniff.php b/CakePHP/Sniffs/Classes/ReturnTypeHintSniff.php index 52ea811..0df7c40 100644 --- a/CakePHP/Sniffs/Classes/ReturnTypeHintSniff.php +++ b/CakePHP/Sniffs/Classes/ReturnTypeHintSniff.php @@ -67,7 +67,7 @@ public function process(File $phpcsFile, $stackPtr) $phpcsFile->addError( 'Chaining methods (@return $this) should not have any return-type-hint.', $startIndex, - 'InvalidSelf' + 'InvalidSelf', ); return; @@ -76,7 +76,7 @@ public function process(File $phpcsFile, $stackPtr) $fix = $phpcsFile->addFixableError( 'Chaining methods (@return $this) should not have any return-type-hint (Remove "self").', $startIndex, - 'InvalidSelf' + 'InvalidSelf', ); if (!$fix) { return; @@ -175,7 +175,7 @@ protected function assertNotThisOrStatic(File $phpCsFile, int $stackPointer): vo $phpCsFile->addError( 'Class name repeated, expected `self` or `$this`.', $classNameIndex, - 'InvalidClass' + 'InvalidClass', ); } } @@ -230,7 +230,7 @@ protected function getClassNameWithNamespace(File $phpCsFile): ?string return ClassHelper::getFullyQualifiedName( $phpCsFile, - $phpCsFile->findPrevious(TokenHelper::$typeKeywordTokenCodes, $lastToken) + $phpCsFile->findPrevious(TokenHelper::$typeKeywordTokenCodes, $lastToken), ); } } diff --git a/CakePHP/Sniffs/Commenting/DocBlockAlignmentSniff.php b/CakePHP/Sniffs/Commenting/DocBlockAlignmentSniff.php index 41e90c1..c04c154 100644 --- a/CakePHP/Sniffs/Commenting/DocBlockAlignmentSniff.php +++ b/CakePHP/Sniffs/Commenting/DocBlockAlignmentSniff.php @@ -61,7 +61,7 @@ public function process(File $phpcsFile, $stackPtr) $commentBorder = $phpcsFile->findNext( [T_DOC_COMMENT_STAR, T_DOC_COMMENT_CLOSE_TAG], $searchToken, - $commentClose + 1 + $commentClose + 1, ); if ($commentBorder !== false) { $tokensToIndent[$commentBorder] = $codeIndentation + 1; diff --git a/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php b/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php index 236d344..ae85a7a 100644 --- a/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php +++ b/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php @@ -59,14 +59,14 @@ public function process(File $phpcsFile, $stackPtr) $docCommentEnd = $phpcsFile->findPrevious( [T_DOC_COMMENT_CLOSE_TAG, T_SEMICOLON, T_CLOSE_CURLY_BRACKET, T_OPEN_CURLY_BRACKET], $stackPtr - 1, - null + null, ); if ($docCommentEnd === false || $tokens[$docCommentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG) { $phpcsFile->addError( 'Missing doc comment for function %s()', $stackPtr, 'Missing', - [$phpcsFile->getDeclarationName($stackPtr)] + [$phpcsFile->getDeclarationName($stackPtr)], ); return; @@ -77,14 +77,14 @@ public function process(File $phpcsFile, $stackPtr) $attribute = $phpcsFile->findNext( [T_ATTRIBUTE], $lastEndToken + 1, - $stackPtr + $stackPtr, ); if ($attribute !== false) { if ($tokens[$lastEndToken]['line'] !== $tokens[$attribute]['line'] - 1) { $phpcsFile->addError( 'There must be no blank lines after the function comment or attribute', $lastEndToken, - 'SpacingAfter' + 'SpacingAfter', ); return; @@ -98,7 +98,7 @@ public function process(File $phpcsFile, $stackPtr) $phpcsFile->addError( 'There must be no blank lines after the function comment or attribute', $lastEndToken, - 'SpacingAfter' + 'SpacingAfter', ); } diff --git a/CakePHP/Sniffs/Commenting/TypeHintSniff.php b/CakePHP/Sniffs/Commenting/TypeHintSniff.php index 9e522a1..3e08854 100644 --- a/CakePHP/Sniffs/Commenting/TypeHintSniff.php +++ b/CakePHP/Sniffs/Commenting/TypeHintSniff.php @@ -123,7 +123,7 @@ public function process(File $phpcsFile, $stackPtr) '%s type hint is not formatted properly, expected "%s"', $tag, 'IncorrectFormat', - [$tokens[$tag]['content'], $sortedTypeHint] + [$tokens[$tag]['content'], $sortedTypeHint], ); if (!$fix) { continue; @@ -135,7 +135,7 @@ public function process(File $phpcsFile, $stackPtr) '%s %s %s', $sortedTypeHint, $valueNode->variableName, - $valueNode->description + $valueNode->description, )); if ($tagComment[-1] === ' ') { // tags above variables in code have a trailing space @@ -147,13 +147,13 @@ public function process(File $phpcsFile, $stackPtr) $sortedTypeHint, $valueNode->isVariadic ? '...' : '', $valueNode->parameterName, - $valueNode->description + $valueNode->description, )); } elseif ($valueNode instanceof ReturnTagValueNode) { $newComment = trim(sprintf( '%s %s', $sortedTypeHint, - $valueNode->description + $valueNode->description, )); } @@ -276,7 +276,7 @@ protected function renderUnionTypes(array $typeNodes): string return preg_replace( ['/ ([\|&]) /', '/<\(/', '/\)>/', '/\), /', '/, \(/'], ['${1}', '<', '>', ', ', ', '], - implode('|', $typeNodes) + implode('|', $typeNodes), ); } diff --git a/CakePHP/Sniffs/Formatting/BlankLineBeforeReturnSniff.php b/CakePHP/Sniffs/Formatting/BlankLineBeforeReturnSniff.php index 7aa7bfd..916da55 100644 --- a/CakePHP/Sniffs/Formatting/BlankLineBeforeReturnSniff.php +++ b/CakePHP/Sniffs/Formatting/BlankLineBeforeReturnSniff.php @@ -72,7 +72,7 @@ public function process(File $phpcsFile, $stackPtr) $fix = $phpcsFile->addFixableError( 'Missing blank line before return statement', $stackPtr, - 'BlankLineBeforeReturn' + 'BlankLineBeforeReturn', ); if ($fix === true) { $phpcsFile->fixer->beginChangeset(); diff --git a/CakePHP/Sniffs/PHP/SingleQuoteSniff.php b/CakePHP/Sniffs/PHP/SingleQuoteSniff.php index de97077..a07660b 100644 --- a/CakePHP/Sniffs/PHP/SingleQuoteSniff.php +++ b/CakePHP/Sniffs/PHP/SingleQuoteSniff.php @@ -56,7 +56,7 @@ public function process(File $phpcsFile, $stackPtr) $fix = $phpcsFile->addFixableError( 'Use single instead of double quotes for simple strings.', $stackPtr, - 'UseSingleQuote' + 'UseSingleQuote', ); if ($fix) { $content = substr($content, 1, -1); diff --git a/CakePHP/Sniffs/WhiteSpace/FunctionSpacingSniff.php b/CakePHP/Sniffs/WhiteSpace/FunctionSpacingSniff.php index c488f28..1228f20 100644 --- a/CakePHP/Sniffs/WhiteSpace/FunctionSpacingSniff.php +++ b/CakePHP/Sniffs/WhiteSpace/FunctionSpacingSniff.php @@ -65,7 +65,7 @@ public function process(File $phpCsFile, $stackPointer) $fix = $phpCsFile->addFixableError( 'Every function/method needs a newline afterwards', $closingParenthesisIndex, - 'Abstract' + 'Abstract', ); if ($fix) { $phpCsFile->fixer->addNewline($semicolonIndex); @@ -108,7 +108,7 @@ protected function assertNewLineAtTheEnd(File $phpCsFile, int $closingBraceIndex $fix = $phpCsFile->addFixableError( 'Every function/method needs a newline afterwards', $closingBraceIndex, - 'Concrete' + 'Concrete', ); if ($fix) { $phpCsFile->fixer->addNewline($closingBraceIndex); @@ -160,7 +160,7 @@ protected function assertNewLineAtTheBeginning(File $phpCsFile, int $stackPointe $fix = $phpCsFile->addFixableError( 'Every function/method needs a newline before', $firstTokenInLineIndex, - 'Concrete' + 'Concrete', ); if ($fix) { $phpCsFile->fixer->addNewline($prevContentIndex); diff --git a/CakePHP/ruleset.xml b/CakePHP/ruleset.xml index c5eaf3d..95de8a9 100644 --- a/CakePHP/ruleset.xml +++ b/CakePHP/ruleset.xml @@ -219,6 +219,7 @@ + diff --git a/docs/README.md b/docs/README.md index ade369b..b42dfc2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,6 @@ # CakePHP ruleset -The CakePHP standard contains 144 sniffs +The CakePHP standard contains 147 sniffs CakePHP (20 sniffs) ------------------- @@ -95,9 +95,11 @@ PSR12 (17 sniffs) - PSR12.Properties.ConstantVisibility - PSR12.Traits.UseDeclaration -SlevomatCodingStandard (40 sniffs) +SlevomatCodingStandard (43 sniffs) ---------------------------------- - SlevomatCodingStandard.Arrays.TrailingArrayComma +- SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing +- SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment - SlevomatCodingStandard.Classes.ClassConstantVisibility - SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces - SlevomatCodingStandard.Classes.ModernClassNameReference @@ -114,6 +116,7 @@ SlevomatCodingStandard (40 sniffs) - SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator - SlevomatCodingStandard.Exceptions.DeadCatch - SlevomatCodingStandard.Functions.ArrowFunctionDeclaration +- SlevomatCodingStandard.Functions.RequireTrailingCommaInCall - SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses - SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation - SlevomatCodingStandard.Namespaces.NamespaceDeclaration