From 48d0c0b7c1c98e0b35594d27d80a9f5846e35c7c Mon Sep 17 00:00:00 2001 From: Albert Borsos Date: Tue, 21 Jun 2022 09:04:50 +0200 Subject: [PATCH 01/46] update to latest code sniffer --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9c04d04..9423082 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ ], "require": { "php": ">=5.4.0", - "squizlabs/php_codesniffer": "~2.7" + "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { "phpunit/phpunit": "^5.3", From 0ead1d24df06c71f47ced269a6efaed37965d25a Mon Sep 17 00:00:00 2001 From: Albert Borsos Date: Tue, 21 Jun 2022 09:45:26 +0200 Subject: [PATCH 02/46] update to new classes --- .gitignore | 1 + .../Sniffs/Arrays/ArrayDeclarationSniff.php | 41 ++++++++++--------- .../Sniffs/Classes/PropertyOrderSniff.php | 13 +++--- .../Sniffs/Classes/StaticSelfSniff.php | 36 +++++++++++----- .../ControlSignatureSniff.php | 13 +++--- .../ControlStructureSpacingSniff.php | 9 ++-- ...AlternativeControlStructureSyntaxSniff.php | 15 ++++--- .../MultiLineControlStructureSniff.php | 25 ++++++----- .../Sniffs/Operators/NewParenthesisSniff.php | 15 ++++--- .../Sniffs/PHP/ForbiddenFunctionsSniff.php | 11 +++-- Application/Sniffs/PHP/IsNullSniff.php | 13 +++--- .../PrivatePropertiesUnderscoreSniff.php | 15 ++++--- .../LanguageConstructSpacingSniff.php | 9 ++-- .../WhiteSpace/OperatorSpacingSniff.php | 25 ++++++----- Application/ruleset.xml | 2 +- ...AlternativeControlStructureSyntaxSniff.php | 17 ++++---- ViewsAlternate/ruleset.xml | 2 +- tests/AbstractSniffUnitTest.php | 4 +- tests/AllSniffs.php | 2 +- 19 files changed, 161 insertions(+), 107 deletions(-) diff --git a/.gitignore b/.gitignore index 69659ae..17f3172 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea vendor composer.phar +composer.lock /_coverage diff --git a/Application/Sniffs/Arrays/ArrayDeclarationSniff.php b/Application/Sniffs/Arrays/ArrayDeclarationSniff.php index ec818c4..198964a 100644 --- a/Application/Sniffs/Arrays/ArrayDeclarationSniff.php +++ b/Application/Sniffs/Arrays/ArrayDeclarationSniff.php @@ -1,6 +1,9 @@ getTokens(); @@ -171,7 +174,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) } else if ($tokens[$i]['code'] === T_ARRAY) { $openingLine = $tokens[$i]['line']; $i = $tokens[$tokens[$i]['parenthesis_opener']]['parenthesis_closer']; - } else if (isset(PHP_CodeSniffer_Tokens::$stringTokens[$tokens[$i]['code']]) === true) { + } else if (isset(\PHP_CodeSniffer\Util\Tokens::$stringTokens[$tokens[$i]['code']]) === true) { // Skip to the end of multi-line strings. $openingLine = $tokens[$i]['line']; $i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true); @@ -203,7 +206,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) /** * Processes a single-line array definition. * - * @param PHP_CodeSniffer_File $phpcsFile The current file being checked. + * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked. * @param int $stackPtr The position of the current token * in the stack passed in $tokens. * @param int $arrayStart The token that starts the array definition. @@ -211,7 +214,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) * * @return void */ - public function processSingleLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $arrayStart, $arrayEnd) + public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr, $arrayStart, $arrayEnd) { $tokens = $phpcsFile->getTokens(); @@ -232,7 +235,7 @@ public function processSingleLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPt } // Skip to the end of multi-line strings. - if (isset(PHP_CodeSniffer_Tokens::$stringTokens[$tokens[$i]['code']]) === true) { + if (isset(\PHP_CodeSniffer\Util\Tokens::$stringTokens[$tokens[$i]['code']]) === true) { $i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true); $i--; continue; @@ -422,7 +425,7 @@ public function processSingleLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPt /** * Processes a multi-line array definition. * - * @param PHP_CodeSniffer_File $phpcsFile The current file being checked. + * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked. * @param int $stackPtr The position of the current token * in the stack passed in $tokens. * @param int $arrayStart The token that starts the array definition. @@ -430,7 +433,7 @@ public function processSingleLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPt * * @return void */ - public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $arrayStart, $arrayEnd) + public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr, $arrayStart, $arrayEnd) { $tokens = $phpcsFile->getTokens(); $keywordStart = $tokens[$stackPtr]['column']; @@ -613,7 +616,7 @@ public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr if ($tokens[$lastToken]['code'] !== T_DOUBLE_ARROW) { $valueContent = $phpcsFile->findNext( - PHP_CodeSniffer_Tokens::$emptyTokens, + \PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($lastToken + 1), $nextToken, true @@ -666,7 +669,7 @@ public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr // Find the value of this index. $nextContent = $phpcsFile->findNext( - PHP_CodeSniffer_Tokens::$emptyTokens, + \PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($nextToken + 1), $arrayEnd, true @@ -686,7 +689,7 @@ public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr $singleValue = true; } else if (count($indices) === 1 && $tokens[$lastToken]['code'] === T_COMMA) { // There may be another array value without a comma. - $exclude = PHP_CodeSniffer_Tokens::$emptyTokens; + $exclude = \PHP_CodeSniffer\Util\Tokens::$emptyTokens; $exclude[] = T_COMMA; $nextContent = $phpcsFile->findNext($exclude, ($indices[0]['value'] + 1), $arrayEnd, true); if ($nextContent === false) { @@ -743,7 +746,7 @@ public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr $lastComma = $indices[($count - 1)]['comma']; $trailingContent = $phpcsFile->findNext( - PHP_CodeSniffer_Tokens::$emptyTokens, + \PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($lastComma + 1), $arrayEnd, true @@ -757,7 +760,7 @@ public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr $lastIndex = $arrayStart; $trailingContent = $phpcsFile->findNext( - PHP_CodeSniffer_Tokens::$emptyTokens, + \PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($arrayStart + 1), $arrayEnd, true @@ -775,7 +778,7 @@ public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr $lastIndex = $indices[($count - 1)]['value']; $trailingContent = $phpcsFile->findPrevious( - PHP_CodeSniffer_Tokens::$emptyTokens, + \PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($arrayEnd - 1), $lastIndex, true @@ -831,7 +834,7 @@ public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr } // Skip to the end of multi-line strings. - if (isset(PHP_CodeSniffer_Tokens::$stringTokens[$tokens[$i]['code']]) === true) { + if (isset(\PHP_CodeSniffer\Util\Tokens::$stringTokens[$tokens[$i]['code']]) === true) { $i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true); $i--; $valueLine = $tokens[$i]['line']; @@ -875,7 +878,7 @@ public function processMultiLineArray(PHP_CodeSniffer_File $phpcsFile, $stackPtr // Check that there is no space before the comma. if ($nextComma !== false && $tokens[($nextComma - 1)]['code'] === T_WHITESPACE) { $prevLastContent = $phpcsFile->findPrevious( - PHP_CodeSniffer_Tokens::$emptyTokens, + \PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($nextComma - 1), null, true diff --git a/Application/Sniffs/Classes/PropertyOrderSniff.php b/Application/Sniffs/Classes/PropertyOrderSniff.php index 2fae0d2..7d31c78 100644 --- a/Application/Sniffs/Classes/PropertyOrderSniff.php +++ b/Application/Sniffs/Classes/PropertyOrderSniff.php @@ -1,6 +1,9 @@ getTokens(); $scopes = array( diff --git a/Application/Sniffs/Classes/StaticSelfSniff.php b/Application/Sniffs/Classes/StaticSelfSniff.php index a3aac0a..fa7c636 100644 --- a/Application/Sniffs/Classes/StaticSelfSniff.php +++ b/Application/Sniffs/Classes/StaticSelfSniff.php @@ -1,6 +1,11 @@ getTokens(); @@ -315,13 +315,13 @@ protected function getDeclarationNameWithNamespace(array $tokens, $stackPtr) /** * Returns the namespace declaration of a file. * - * @param PHP_CodeSniffer_File $phpcsFile The file where this token was found. + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found. * @param int $stackPtr The position where the search for the * namespace declaration will start. * * @return string */ - protected function getNamespaceOfScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + protected function getNamespaceOfScope(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) { $namespace = ''; $namespaceDeclaration = $phpcsFile->findPrevious(T_NAMESPACE, $stackPtr); @@ -338,5 +338,19 @@ protected function getNamespaceOfScope(PHP_CodeSniffer_File $phpcsFile, $stackPt }//end getNamespaceOfScope() + /** + * Processes the tokens outside the scope. + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being processed. + * @param int $stackPtr The position where this token was + * found. + * + * @return void + */ + protected function processTokenOutsideScope(File $phpcsFile, $stackPtr) + { + + }//end processTokenOutsideScope() + }//end class diff --git a/Application/Sniffs/ControlStructures/ControlSignatureSniff.php b/Application/Sniffs/ControlStructures/ControlSignatureSniff.php index 22bb21c..3dde6b3 100644 --- a/Application/Sniffs/ControlStructures/ControlSignatureSniff.php +++ b/Application/Sniffs/ControlStructures/ControlSignatureSniff.php @@ -1,4 +1,7 @@ getTokens(); @@ -198,7 +201,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) // Skip all empty tokens on the same line as the opener. if ($tokens[$next]['line'] === $tokens[$opener]['line'] - && (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$code]) === true + && (isset(\PHP_CodeSniffer\Util\Tokens::$emptyTokens[$code]) === true || $code === T_CLOSE_TAG) ) { continue; @@ -260,7 +263,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) || $tokens[$stackPtr]['code'] === T_ELSEIF || $tokens[$stackPtr]['code'] === T_CATCH ) { - $closer = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true); + $closer = $phpcsFile->findPrevious(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($stackPtr - 1), null, true); if ($closer === false || $tokens[$closer]['code'] !== T_CLOSE_CURLY_BRACKET) { return; } diff --git a/Application/Sniffs/ControlStructures/ControlStructureSpacingSniff.php b/Application/Sniffs/ControlStructures/ControlStructureSpacingSniff.php index 56b3607..14827aa 100644 --- a/Application/Sniffs/ControlStructures/ControlStructureSpacingSniff.php +++ b/Application/Sniffs/ControlStructures/ControlStructureSpacingSniff.php @@ -1,4 +1,7 @@ requiredSpacesAfterOpen = (int) $this->requiredSpacesAfterOpen; $this->requiredSpacesBeforeClose = (int) $this->requiredSpacesBeforeClose; diff --git a/Application/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php b/Application/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php index bc6c8f7..ef6a815 100644 --- a/Application/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php +++ b/Application/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php @@ -1,6 +1,9 @@ getTokens(); if (isset($tokens[$stackPtr]['scope_opener']) !== true) { @@ -103,7 +106,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) return; } - $comma = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($closer + 1), null, true); + $comma = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($closer + 1), null, true); if ($tokens[$comma]['code'] !== T_SEMICOLON) { $comma = null; } diff --git a/Application/Sniffs/ControlStructures/MultiLineControlStructureSniff.php b/Application/Sniffs/ControlStructures/MultiLineControlStructureSniff.php index 406c914..879154e 100644 --- a/Application/Sniffs/ControlStructures/MultiLineControlStructureSniff.php +++ b/Application/Sniffs/ControlStructures/MultiLineControlStructureSniff.php @@ -1,6 +1,9 @@ addFixableError($error, $closeBracket, 'CloseBracketNewLine'); @@ -89,7 +92,7 @@ private function _closingBracketError(PHP_CodeSniffer_File $phpcsFile, $tokens, if ($tokens[$next]['code'] !== T_COMMENT) { $phpcsFile->fixer->addNewlineBefore($closeBracket); } else { - $next = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($next + 1), null, true); + $next = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($next + 1), null, true); $phpcsFile->fixer->beginChangeset(); $phpcsFile->fixer->replaceToken($closeBracket, ''); $phpcsFile->fixer->addContentBefore($next, ')'); @@ -103,13 +106,13 @@ private function _closingBracketError(PHP_CodeSniffer_File $phpcsFile, $tokens, /** * Processes this test, when one of its tokens is encountered. * - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. * @param int $stackPtr The position of the current token * in the stack passed in $tokens. * * @return void */ - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]['parenthesis_opener']) === false) { @@ -122,7 +125,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) for ($i = ($openBracket + 1); $i < $closeBracket; $i++) { // Skip bracketed statements, like function calls and arrays. // These don't count as multiple lines even if they are multiline. - if (in_array($tokens[$i]['code'], PHP_CodeSniffer_Tokens::$functionNameTokens) === true || $tokens[$i]['code'] === T_ARRAY) { + if (in_array($tokens[$i]['code'], \PHP_CodeSniffer\Util\Tokens::$functionNameTokens) === true || $tokens[$i]['code'] === T_ARRAY) { $next = $phpcsFile->findNext(T_WHITESPACE, ($i + 1), null, true); if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS) { // This is a function call. @@ -164,7 +167,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) $statementIndent = strlen($tokens[$i]['content']); } - $next = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($openBracket + 1), null, true); + $next = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($openBracket + 1), null, true); if ($tokens[$next]['line'] === $tokens[$openBracket]['line']) { $error = 'Opening parenthesis of a multi-line control structure must be the last content on the line'; $fix = $phpcsFile->addFixableError($error, $next, 'ContentAfterOpenBracket'); @@ -227,7 +230,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) $lastLine = $tokens[$i]['line']; }//end if $jumped = false; - if (in_array($tokens[$i]['code'], PHP_CodeSniffer_Tokens::$functionNameTokens) === true || $tokens[$i]['code'] === T_ARRAY) { + if (in_array($tokens[$i]['code'], \PHP_CodeSniffer\Util\Tokens::$functionNameTokens) === true || $tokens[$i]['code'] === T_ARRAY) { $next = $phpcsFile->findNext(T_WHITESPACE, ($i + 1), null, true); if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS) { // This is a function call or array, so skip to the end as they diff --git a/Application/Sniffs/Operators/NewParenthesisSniff.php b/Application/Sniffs/Operators/NewParenthesisSniff.php index 49a135f..16da5c1 100644 --- a/Application/Sniffs/Operators/NewParenthesisSniff.php +++ b/Application/Sniffs/Operators/NewParenthesisSniff.php @@ -1,6 +1,9 @@ getTokens(); @@ -83,7 +86,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) T_CLOSE_TAG, ); if (in_array($tokens[$insertAfter]['code'], $endTokens) === true) { - $insertAfter = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($insertAfter - 1), null, true); + $insertAfter = $phpcsFile->findPrevious(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($insertAfter - 1), null, true); } }//end if diff --git a/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php b/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php index 07e87cd..8a58571 100644 --- a/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php +++ b/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php @@ -1,6 +1,9 @@ getTokens(); diff --git a/Application/Sniffs/Properties/PrivatePropertiesUnderscoreSniff.php b/Application/Sniffs/Properties/PrivatePropertiesUnderscoreSniff.php index 2071850..0127864 100644 --- a/Application/Sniffs/Properties/PrivatePropertiesUnderscoreSniff.php +++ b/Application/Sniffs/Properties/PrivatePropertiesUnderscoreSniff.php @@ -1,6 +1,9 @@ getTokens(); if ($tokens[$pointer]['content'] === 'private' @@ -58,7 +61,7 @@ public function process(PHP_CodeSniffer_File $file, $pointer) && $tokens[($pointer + 2)]['type'] === 'T_VARIABLE' && strpos($tokens[($pointer + 2)]['content'], '$_') !== 0 ) { - $file->addError('Private property name must be prefixed with underscore.', $pointer); + $file->addError('Private property name must be prefixed with underscore.', $pointer, 'PrivatePropertiesUnderscore'); } }//end process() diff --git a/Application/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php b/Application/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php index 71f1a82..bf52654 100644 --- a/Application/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php +++ b/Application/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php @@ -1,4 +1,7 @@ getTokens(); diff --git a/Application/Sniffs/WhiteSpace/OperatorSpacingSniff.php b/Application/Sniffs/WhiteSpace/OperatorSpacingSniff.php index 6177a02..7525772 100644 --- a/Application/Sniffs/WhiteSpace/OperatorSpacingSniff.php +++ b/Application/Sniffs/WhiteSpace/OperatorSpacingSniff.php @@ -1,4 +1,7 @@ getTokens(); // Skip default values in function declarations. @@ -189,22 +192,22 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) return; } - if (isset(PHP_CodeSniffer_Tokens::$operators[$tokens[$prev]['code']]) === true) { + if (isset(\PHP_CodeSniffer\Util\Tokens::$operators[$tokens[$prev]['code']]) === true) { // Just trying to operate on a negative value; eg. ($var * -1). return; } - if (isset(PHP_CodeSniffer_Tokens::$comparisonTokens[$tokens[$prev]['code']]) === true) { + if (isset(\PHP_CodeSniffer\Util\Tokens::$comparisonTokens[$tokens[$prev]['code']]) === true) { // Just trying to compare a negative value; eg. ($var === -1). return; } - if (isset(PHP_CodeSniffer_Tokens::$booleanOperators[$tokens[$prev]['code']]) === true) { + if (isset(\PHP_CodeSniffer\Util\Tokens::$booleanOperators[$tokens[$prev]['code']]) === true) { // Just trying to compare a negative value; eg. ($var || -1 === $b). return; } - if (isset(PHP_CodeSniffer_Tokens::$assignmentTokens[$tokens[$prev]['code']]) === true) { + if (isset(\PHP_CodeSniffer\Util\Tokens::$assignmentTokens[$tokens[$prev]['code']]) === true) { // Just trying to assign a negative value; eg. ($var = -1). return; } @@ -237,7 +240,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) } $phpcsFile->recordMetric($stackPtr, 'Space before operator', 0); - } else if (isset(PHP_CodeSniffer_Tokens::$assignmentTokens[$tokens[$stackPtr]['code']]) === false) { + } else if (isset(\PHP_CodeSniffer\Util\Tokens::$assignmentTokens[$tokens[$stackPtr]['code']]) === false) { // Don't throw an error for assignments, because other standards allow // multiple spaces there to align multiple assignments. if ($tokens[($stackPtr - 2)]['line'] !== $tokens[$stackPtr]['line']) { diff --git a/Application/ruleset.xml b/Application/ruleset.xml index 38bf0ac..77b7444 100644 --- a/Application/ruleset.xml +++ b/Application/ruleset.xml @@ -1,5 +1,5 @@ - + Mito Yii 2 Web Application Coding Standard diff --git a/ViewsAlternate/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php b/ViewsAlternate/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php index a0ce2ae..b3a2362 100644 --- a/ViewsAlternate/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php +++ b/ViewsAlternate/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php @@ -1,6 +1,9 @@ getTokens(); if (isset($tokens[$stackPtr]['scope_opener']) !== true) { @@ -88,7 +91,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) $closeText = $mapping[$tokens[$stackPtr]['code']]; while (true) { - $else = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($closer + 1), null, true); + $else = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($closer + 1), null, true); if ($else === false) { break; } @@ -114,7 +117,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) return; } - $comma = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($closer + 1), null, true); + $comma = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($closer + 1), null, true); if ($tokens[$comma]['code'] !== T_SEMICOLON) { $comma = null; } diff --git a/ViewsAlternate/ruleset.xml b/ViewsAlternate/ruleset.xml index 871c938..31a4d32 100644 --- a/ViewsAlternate/ruleset.xml +++ b/ViewsAlternate/ruleset.xml @@ -1,5 +1,5 @@ - + Mito Yii 2 Web Application Coding Standard (view files with alternate syntax) diff --git a/tests/AbstractSniffUnitTest.php b/tests/AbstractSniffUnitTest.php index e6b2f7b..a93dbbd 100644 --- a/tests/AbstractSniffUnitTest.php +++ b/tests/AbstractSniffUnitTest.php @@ -196,12 +196,12 @@ public final function testSniff() /** * Generate a list of test failures for a given sniffed file. * - * @param PHP_CodeSniffer_File $file The file being tested. + * @param \PHP_CodeSniffer\Files\File $file The file being tested. * * @return array * @throws PHP_CodeSniffer_Exception */ - public function generateFailureMessages(PHP_CodeSniffer_File $file) + public function generateFailureMessages(\PHP_CodeSniffer\Files\File $file) { $testFile = $file->getFilename(); diff --git a/tests/AllSniffs.php b/tests/AllSniffs.php index a449690..a7d4070 100644 --- a/tests/AllSniffs.php +++ b/tests/AllSniffs.php @@ -77,7 +77,7 @@ public static function suite() ]; $path = dirname(__DIR__); - PHP_CodeSniffer::setConfigData('installed_paths', $path, true); + \PHP_CodeSniffer\Config::setConfigData('installed_paths', $path, true); foreach ($standards as $standard) { From ab92a9e4e06f14650c3c26586332d5985991ecd8 Mon Sep 17 00:00:00 2001 From: Albert Borsos Date: Tue, 21 Jun 2022 09:48:42 +0200 Subject: [PATCH 03/46] use github actions instead of travis --- .github/workflows/build.yml | 53 + .travis.yml | 31 - README.md | 1 - composer.lock | 2019 ------------------------------- phpunit.xml.dist | 2 +- tests/AbstractSniffUnitTest.php | 2 +- tests/AllSniffs.php | 2 + 7 files changed, 57 insertions(+), 2053 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml delete mode 100644 composer.lock diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4dadbef --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +on: + - pull_request + - push + +name: build + +jobs: + tests: + name: PHP ${{ matrix.php }}-coding-standards + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + + php: + - "5.6" + - "7.0" + - "7.1" + - "7.2" + - "7.3" + - "7.4" + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl, intl, redis + ini-values: date.timezone='UTC' + tools: composer:v2, pecl + + - name: Get Composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + uses: actions/cache@v2.1.4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies with Composer + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader + + - name: Run tests with PhpUnit + run: vendor/bin/phpunit $PHPUNIT_FLAGS diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0c9a0ba..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: php - -php: -# - 5.5 - - 5.6 - - 7.0 - - hhvm - -# faster builds on new travis setup not using sudo -sudo: false - -# cache vendor dirs -cache: - directories: - - $HOME/.composer/cache - -install: - - travis_retry composer self-update && composer --version - - export PATH="$HOME/.composer/vendor/bin:$PATH" - - travis_retry composer install --prefer-source --no-interaction - -before_script: - - | - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then - PHPUNIT_FLAGS="--coverage-clover=_coverage/coverage.xml" - fi -script: - - php ./vendor/bin/phpunit $PHPUNIT_FLAGS - -after_success: - - php ./vendor/bin/coveralls -v --exclude-no-stmt -c .coveralls.yml diff --git a/README.md b/README.md index f1994ac..8546432 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ Mito Yii 2 Coding Standards This repository contains [Mito](https://mito.hu/)'s coding standards for Yii 2 based applications. -[![Build Status](https://travis-ci.org/hellowearemito/yii2-coding-standards.svg?branch=master)](https://travis-ci.org/hellowearemito/yii2-coding-standards) [![Coverage Status](https://coveralls.io/repos/github/hellowearemito/yii2-coding-standards/badge.svg?branch=master)](https://coveralls.io/github/hellowearemito/yii2-coding-standards?branch=master) Getting the code diff --git a/composer.lock b/composer.lock deleted file mode 100644 index ed72a73..0000000 --- a/composer.lock +++ /dev/null @@ -1,2019 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "1b838ef97fe34b80ff769a2cdb8a16ea", - "packages": [ - { - "name": "squizlabs/php_codesniffer", - "version": "2.9.1", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "bin": [ - "scripts/phpcs", - "scripts/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2017-05-22T02:43:20+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "guzzle/guzzle", - "version": "v3.9.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle3.git", - "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", - "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.3.3", - "symfony/event-dispatcher": "~2.1" - }, - "replace": { - "guzzle/batch": "self.version", - "guzzle/cache": "self.version", - "guzzle/common": "self.version", - "guzzle/http": "self.version", - "guzzle/inflection": "self.version", - "guzzle/iterator": "self.version", - "guzzle/log": "self.version", - "guzzle/parser": "self.version", - "guzzle/plugin": "self.version", - "guzzle/plugin-async": "self.version", - "guzzle/plugin-backoff": "self.version", - "guzzle/plugin-cache": "self.version", - "guzzle/plugin-cookie": "self.version", - "guzzle/plugin-curlauth": "self.version", - "guzzle/plugin-error-response": "self.version", - "guzzle/plugin-history": "self.version", - "guzzle/plugin-log": "self.version", - "guzzle/plugin-md5": "self.version", - "guzzle/plugin-mock": "self.version", - "guzzle/plugin-oauth": "self.version", - "guzzle/service": "self.version", - "guzzle/stream": "self.version" - }, - "require-dev": { - "doctrine/cache": "~1.3", - "monolog/monolog": "~1.0", - "phpunit/phpunit": "3.7.*", - "psr/log": "~1.0", - "symfony/class-loader": "~2.1", - "zendframework/zend-cache": "2.*,<2.3", - "zendframework/zend-log": "2.*,<2.3" - }, - "suggest": { - "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.9-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle": "src/", - "Guzzle\\Tests": "tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Guzzle Community", - "homepage": "https://github.com/guzzle/guzzle/contributors" - } - ], - "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "abandoned": "guzzlehttp/guzzle", - "time": "2015-03-18T18:23:50+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2017-10-19T19:58:43+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2017-09-11T18:02:19+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.2.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", - "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.3.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-08T06:39:58+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", - "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2017-06-03T08:32:36+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.7.2", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2017-09-04T11:05:03+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "4.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" - }, - "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" - }, - "suggest": { - "ext-xdebug": "^2.5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2017-04-02T07:44:40+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2016-10-03T07:40:28+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.11", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-02-27T10:12:30+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "5.7.23", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "78532d5269d984660080d8e0f4c99c5c2ea65ffe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/78532d5269d984660080d8e0f4c99c5c2ea65ffe", - "reference": "78532d5269d984660080d8e0f4c99c5c2ea65ffe", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0.3|~2.0", - "symfony/yaml": "~2.1|~3.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.7.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-10-15T06:13:55+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2017-06-30T09:13:00+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "satooshi/php-coveralls", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/satooshi/php-coveralls.git", - "reference": "da51d304fe8622bf9a6da39a8446e7afd432115c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/da51d304fe8622bf9a6da39a8446e7afd432115c", - "reference": "da51d304fe8622bf9a6da39a8446e7afd432115c", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-simplexml": "*", - "guzzle/guzzle": "^2.8|^3.0", - "php": ">=5.3.3", - "psr/log": "^1.0", - "symfony/config": "^2.1|^3.0", - "symfony/console": "^2.1|^3.0", - "symfony/stopwatch": "^2.0|^3.0", - "symfony/yaml": "^2.0|^3.0" - }, - "suggest": { - "symfony/http-kernel": "Allows Symfony integration" - }, - "bin": [ - "bin/coveralls" - ], - "type": "library", - "autoload": { - "psr-4": { - "Satooshi\\": "src/Satooshi/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kitamura Satoshi", - "email": "with.no.parachute@gmail.com", - "homepage": "https://www.facebook.com/satooshi.jp" - } - ], - "description": "PHP client library for Coveralls API", - "homepage": "https://github.com/satooshi/php-coveralls", - "keywords": [ - "ci", - "coverage", - "github", - "test" - ], - "time": "2016-01-20T17:35:46+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-05-22T07:24:03+00:00" - }, - { - "name": "sebastian/environment", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-11-26T07:53:53+00:00" - }, - { - "name": "sebastian/exporter", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-11-19T08:54:04+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", - "shasum": "" - }, - "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/config", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "4ab62407bff9cd97c410a7feaef04c375aaa5cfd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4ab62407bff9cd97c410a7feaef04c375aaa5cfd", - "reference": "4ab62407bff9cd97c410a7feaef04c375aaa5cfd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3", - "symfony/finder": "~3.3", - "symfony/yaml": "~3.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2017-10-04T18:56:58+00:00" - }, - { - "name": "symfony/console", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "116bc56e45a8e5572e51eb43ab58c769a352366c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/116bc56e45a8e5572e51eb43ab58c769a352366c", - "reference": "116bc56e45a8e5572e51eb43ab58c769a352366c", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/filesystem": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" - }, - { - "name": "symfony/debug", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.8.28", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fe089232554357efb8d4af65ce209fc6e5a2186", - "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-10-01T21:00:16+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "90bc45abf02ae6b7deb43895c1052cb0038506f1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/90bc45abf02ae6b7deb43895c1052cb0038506f1", - "reference": "90bc45abf02ae6b7deb43895c1052cb0038506f1", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2017-10-03T13:33:10+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "170edf8b3247d7b6779eb6fa7428f342702ca184" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/170edf8b3247d7b6779eb6fa7428f342702ca184", - "reference": "170edf8b3247d7b6779eb6fa7428f342702ca184", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46", - "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-10-05T14:43:42+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23T20:04:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.4.0" - }, - "platform-dev": [] -} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9e1d4f0..80b1792 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,5 @@ - + tests/AllTests.php diff --git a/tests/AbstractSniffUnitTest.php b/tests/AbstractSniffUnitTest.php index a93dbbd..2a7e544 100644 --- a/tests/AbstractSniffUnitTest.php +++ b/tests/AbstractSniffUnitTest.php @@ -64,7 +64,7 @@ abstract class AbstractSniffUnitTest extends PHPUnit_Framework_TestCase protected function setUp() { if (self::$phpcs === null) { - self::$phpcs = new PHP_CodeSniffer(); + self::$phpcs = new \PHP_CodeSniffer\Runner(); } $class = get_class($this); diff --git a/tests/AllSniffs.php b/tests/AllSniffs.php index a7d4070..2438d6f 100644 --- a/tests/AllSniffs.php +++ b/tests/AllSniffs.php @@ -15,6 +15,8 @@ // Require this here so that the unit tests don't have to try and find the // abstract class once it is installed into the PEAR tests directory. +require_once dirname(__FILE__).'/vendor/squizlabs/php_codesniffer/src/Config.php'; +require_once dirname(__FILE__).'/vendor/squizlabs/php_codesniffer/src/Runner.php'; require_once dirname(__FILE__).'/AbstractSniffUnitTest.php'; /** From 5854fcb8916a087bf03877103f472d0d6fca1901 Mon Sep 17 00:00:00 2001 From: Albert Borsos Date: Tue, 21 Jun 2022 14:56:05 +0200 Subject: [PATCH 04/46] fix to run unit tests --- .../Tests/Arrays/ArrayDeclarationUnitTest.php | 5 +- .../Tests/Classes/PropertyOrderUnitTest.php | 5 +- .../Tests/Classes/StaticSelfUnitTest.php | 5 +- .../ControlSignatureUnitTest.php | 5 +- .../ControlStructureSpacingUnitTest.php | 5 +- ...ernativeControlStructureSyntaxUnitTest.php | 5 +- .../MultiLineControlStructureUnitTest.php | 5 +- .../Operators/NewParenthesisUnitTest.php | 5 +- .../Tests/PHP/ForbiddenFunctionsUnitTest.php | 5 +- Application/Tests/PHP/IsNullUnitTest.php | 5 +- .../LanguageConstructSpacingUnitTest.php | 5 +- .../WhiteSpace/OperatorSpacingUnitTest.php | 5 +- ...ernativeControlStructureSyntaxUnitTest.php | 5 +- bootstrap.php | 92 ++++ composer.json | 2 +- phpunit.xml.dist | 2 +- tests/AbstractSniffUnitTest.php | 433 ------------------ tests/AllSniffs.php | 71 +-- tests/AllTests.php | 87 ++-- tests/TestSuite.php | 55 +-- 20 files changed, 215 insertions(+), 592 deletions(-) create mode 100644 bootstrap.php delete mode 100644 tests/AbstractSniffUnitTest.php diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.php b/Application/Tests/Arrays/ArrayDeclarationUnitTest.php index e2f254e..ad868f4 100644 --- a/Application/Tests/Arrays/ArrayDeclarationUnitTest.php +++ b/Application/Tests/Arrays/ArrayDeclarationUnitTest.php @@ -1,4 +1,7 @@ + * @copyright 2006-2017 Squiz Pty Ltd (ABN 77 084 670 600) + * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + */ + +if (defined('PHP_CODESNIFFER_IN_TESTS') === false) { + define('PHP_CODESNIFFER_IN_TESTS', true); +} + +if (defined('PHP_CODESNIFFER_CBF') === false) { + define('PHP_CODESNIFFER_CBF', false); +} + +if (defined('PHP_CODESNIFFER_VERBOSITY') === false) { + define('PHP_CODESNIFFER_VERBOSITY', 0); +} + +if (is_file(__DIR__.'/vendor/autoload.php') === true) { + include_once __DIR__.'/vendor/autoload.php'; + include_once __DIR__ . '/vendor/squizlabs/php_codesniffer/autoload.php'; +} else { + include_once __DIR__ . '/vendor/squizlabs/php_codesniffer/autoload.php'; +} + +$tokens = new \PHP_CodeSniffer\Util\Tokens(); + +// Compatibility for PHPUnit < 6 and PHPUnit 6+. +if (class_exists('PHPUnit_Framework_TestSuite') === true && class_exists('PHPUnit\Framework\TestSuite') === false) { + class_alias('PHPUnit_Framework_TestSuite', 'PHPUnit'.'\Framework\TestSuite'); +} + +if (class_exists('PHPUnit_Framework_TestCase') === true && class_exists('PHPUnit\Framework\TestCase') === false) { + class_alias('PHPUnit_Framework_TestCase', 'PHPUnit'.'\Framework\TestCase'); +} + +if (class_exists('PHPUnit_TextUI_TestRunner') === true && class_exists('PHPUnit\TextUI\TestRunner') === false) { + class_alias('PHPUnit_TextUI_TestRunner', 'PHPUnit'.'\TextUI\TestRunner'); +} + +if (class_exists('PHPUnit_Framework_TestResult') === true && class_exists('PHPUnit\Framework\TestResult') === false) { + class_alias('PHPUnit_Framework_TestResult', 'PHPUnit'.'\Framework\TestResult'); +} + +// Determine whether this is a PEAR install or not. +$GLOBALS['PHP_CODESNIFFER_PEAR'] = false; + +if (is_file(__DIR__.'/../autoload.php') === false) { + $GLOBALS['PHP_CODESNIFFER_PEAR'] = true; +} + + +/** + * A global util function to help print unit test fixing data. + * + * @return void + */ +function printPHPCodeSnifferTestOutput() +{ + echo PHP_EOL.PHP_EOL; + + $output = 'The test files'; + $data = []; + + $codeCount = count($GLOBALS['PHP_CODESNIFFER_SNIFF_CODES']); + if (empty($GLOBALS['PHP_CODESNIFFER_SNIFF_CASE_FILES']) === false) { + $files = call_user_func_array('array_merge', $GLOBALS['PHP_CODESNIFFER_SNIFF_CASE_FILES']); + $files = array_unique($files); + $fileCount = count($files); + + $output = '%d sniff test files'; + $data[] = $fileCount; + } + + $output .= ' generated %d unique error codes'; + $data[] = $codeCount; + + if ($codeCount > 0) { + $fixes = count($GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES']); + $percent = round(($fixes / $codeCount * 100), 2); + + $output .= '; %d were fixable (%d%%)'; + $data[] = $fixes; + $data[] = $percent; + } + + vprintf($output, $data); + +}//end printPHPCodeSnifferTestOutput() diff --git a/composer.json b/composer.json index 9423082..d45e8d0 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { - "phpunit/phpunit": "^5.3", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", "satooshi/php-coveralls": "^1.0" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 80b1792..5e5b277 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,5 @@ - + tests/AllTests.php diff --git a/tests/AbstractSniffUnitTest.php b/tests/AbstractSniffUnitTest.php deleted file mode 100644 index 2a7e544..0000000 --- a/tests/AbstractSniffUnitTest.php +++ /dev/null @@ -1,433 +0,0 @@ - - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -/** - * An abstract class that all sniff unit tests must extend. - * - * A sniff unit test checks a .inc file for expected violations of a single - * coding standard. Expected errors and warnings that are not found, or - * warnings and errors that are not expected, are considered test failures. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -abstract class AbstractSniffUnitTest extends PHPUnit_Framework_TestCase -{ - - /** - * Enable or disable the backup and restoration of the $GLOBALS array. - * Overwrite this attribute in a child class of TestCase. - * Setting this attribute in setUp() has no effect! - * - * @var boolean - */ - protected $backupGlobals = false; - - /** - * The PHP_CodeSniffer object used for testing. - * - * @var PHP_CodeSniffer - */ - protected static $phpcs = null; - - /** - * The path to the directory under which the sniff's standard lives. - * - * @var string - */ - public $standardsDir = null; - - - /** - * Sets up this unit test. - * - * @return void - */ - protected function setUp() - { - if (self::$phpcs === null) { - self::$phpcs = new \PHP_CodeSniffer\Runner(); - } - - $class = get_class($this); - $this->standardsDir = $GLOBALS['PHP_CODESNIFFER_STANDARD_DIRS'][$class]; - - }//end setUp() - - - /** - * Get a list of all test files to check. - * - * These will have the same base as the sniff name but different extensions. - * We ignore the .php file as it is the class. - * - * @param string $testFileBase The base path that the unit tests files will have. - * - * @return string[] - */ - protected function getTestFiles($testFileBase) - { - $testFiles = array(); - - $dir = substr($testFileBase, 0, strrpos($testFileBase, DIRECTORY_SEPARATOR)); - $di = new DirectoryIterator($dir); - - foreach ($di as $file) { - $path = $file->getPathname(); - if (substr($path, 0, strlen($testFileBase)) === $testFileBase) { - if ($path !== $testFileBase.'php' && substr($path, -5) !== 'fixed') { - $testFiles[] = $path; - } - } - } - - // Put them in order. - sort($testFiles); - - return $testFiles; - - }//end getTestFiles() - - - /** - * Should this test be skipped for some reason. - * - * @return void - */ - protected function shouldSkipTest() - { - return false; - - }//end shouldSkipTest() - - - /** - * Tests the extending classes Sniff class. - * - * @return void - * @throws PHPUnit_Framework_Error - */ - public final function testSniff() - { - // Skip this test if we can't run in this environment. - if ($this->shouldSkipTest() === true) { - $this->markTestSkipped(); - } - - // The basis for determining file locations. - $basename = substr(get_class($this), 0, -8); - - // The name of the coding standard we are testing. - $standardName = substr($basename, 0, strpos($basename, '_')); - - // The code of the sniff we are testing. - $parts = explode('_', $basename); - $sniffCode = $parts[0].'.'.$parts[2].'.'.$parts[3]; - - $testFileBase = $this->standardsDir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $basename).'UnitTest.'; - - // Get a list of all test files to check. - $testFiles = $this->getTestFiles($testFileBase); - - self::$phpcs->initStandard($standardName, array($sniffCode)); - self::$phpcs->setIgnorePatterns(array()); - - $failureMessages = array(); - foreach ($testFiles as $testFile) { - $filename = basename($testFile); - - try { - $cliValues = $this->getCliValues($filename); - self::$phpcs->cli->setCommandLineValues($cliValues); - $phpcsFile = self::$phpcs->processFile($testFile); - } catch (Exception $e) { - $this->fail('An unexpected exception has been caught: '.$e->getMessage()); - } - - $failures = $this->generateFailureMessages($phpcsFile); - $failureMessages = array_merge($failureMessages, $failures); - - if ($phpcsFile->getFixableCount() > 0) { - // Attempt to fix the errors. - $phpcsFile->fixer->fixFile(); - $fixable = $phpcsFile->getFixableCount(); - if ($fixable > 0) { - $failureMessages[] = "Failed to fix $fixable fixable violations in $filename"; - } - - // Check for a .fixed file to check for accuracy of fixes. - $fixedFile = $testFile.'.fixed'; - if (file_exists($fixedFile) === true) { - $diff = $phpcsFile->fixer->generateDiff($fixedFile); - if (trim($diff) !== '') { - $filename = basename($testFile); - $fixedFilename = basename($fixedFile); - $failureMessages[] = "Fixed version of $filename does not match expected version in $fixedFilename; the diff is\n$diff"; - } - } - } - }//end foreach - - if (empty($failureMessages) === false) { - $this->fail(implode(PHP_EOL, $failureMessages)); - } - - }//end runTest() - - - /** - * Generate a list of test failures for a given sniffed file. - * - * @param \PHP_CodeSniffer\Files\File $file The file being tested. - * - * @return array - * @throws PHP_CodeSniffer_Exception - */ - public function generateFailureMessages(\PHP_CodeSniffer\Files\File $file) - { - $testFile = $file->getFilename(); - - $foundErrors = $file->getErrors(); - $foundWarnings = $file->getWarnings(); - $expectedErrors = $this->getErrorList(basename($testFile)); - $expectedWarnings = $this->getWarningList(basename($testFile)); - - if (is_array($expectedErrors) === false) { - throw new PHP_CodeSniffer_Exception('getErrorList() must return an array'); - } - - if (is_array($expectedWarnings) === false) { - throw new PHP_CodeSniffer_Exception('getWarningList() must return an array'); - } - - /* - We merge errors and warnings together to make it easier - to iterate over them and produce the errors string. In this way, - we can report on errors and warnings in the same line even though - it's not really structured to allow that. - */ - - $allProblems = array(); - $failureMessages = array(); - - foreach ($foundErrors as $line => $lineErrors) { - foreach ($lineErrors as $column => $errors) { - if (isset($allProblems[$line]) === false) { - $allProblems[$line] = array( - 'expected_errors' => 0, - 'expected_warnings' => 0, - 'found_errors' => array(), - 'found_warnings' => array(), - ); - } - - $foundErrorsTemp = array(); - foreach ($allProblems[$line]['found_errors'] as $foundError) { - $foundErrorsTemp[] = $foundError; - } - - $errorsTemp = array(); - foreach ($errors as $foundError) { - $errorsTemp[] = $foundError['message'].' ('.$foundError['source'].')'; - - $source = $foundError['source']; - if (in_array($source, $GLOBALS['PHP_CODESNIFFER_SNIFF_CODES']) === false) { - $GLOBALS['PHP_CODESNIFFER_SNIFF_CODES'][] = $source; - } - - if ($foundError['fixable'] === true - && in_array($source, $GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES']) === false - ) { - $GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES'][] = $source; - } - } - - $allProblems[$line]['found_errors'] = array_merge($foundErrorsTemp, $errorsTemp); - }//end foreach - - if (isset($expectedErrors[$line]) === true) { - $allProblems[$line]['expected_errors'] = $expectedErrors[$line]; - } else { - $allProblems[$line]['expected_errors'] = 0; - } - - unset($expectedErrors[$line]); - }//end foreach - - foreach ($expectedErrors as $line => $numErrors) { - if (isset($allProblems[$line]) === false) { - $allProblems[$line] = array( - 'expected_errors' => 0, - 'expected_warnings' => 0, - 'found_errors' => array(), - 'found_warnings' => array(), - ); - } - - $allProblems[$line]['expected_errors'] = $numErrors; - } - - foreach ($foundWarnings as $line => $lineWarnings) { - foreach ($lineWarnings as $column => $warnings) { - if (isset($allProblems[$line]) === false) { - $allProblems[$line] = array( - 'expected_errors' => 0, - 'expected_warnings' => 0, - 'found_errors' => array(), - 'found_warnings' => array(), - ); - } - - $foundWarningsTemp = array(); - foreach ($allProblems[$line]['found_warnings'] as $foundWarning) { - $foundWarningsTemp[] = $foundWarning; - } - - $warningsTemp = array(); - foreach ($warnings as $warning) { - $warningsTemp[] = $warning['message'].' ('.$warning['source'].')'; - } - - $allProblems[$line]['found_warnings'] = array_merge($foundWarningsTemp, $warningsTemp); - }//end foreach - - if (isset($expectedWarnings[$line]) === true) { - $allProblems[$line]['expected_warnings'] = $expectedWarnings[$line]; - } else { - $allProblems[$line]['expected_warnings'] = 0; - } - - unset($expectedWarnings[$line]); - }//end foreach - - foreach ($expectedWarnings as $line => $numWarnings) { - if (isset($allProblems[$line]) === false) { - $allProblems[$line] = array( - 'expected_errors' => 0, - 'expected_warnings' => 0, - 'found_errors' => array(), - 'found_warnings' => array(), - ); - } - - $allProblems[$line]['expected_warnings'] = $numWarnings; - } - - // Order the messages by line number. - ksort($allProblems); - - foreach ($allProblems as $line => $problems) { - $numErrors = count($problems['found_errors']); - $numWarnings = count($problems['found_warnings']); - $expectedErrors = $problems['expected_errors']; - $expectedWarnings = $problems['expected_warnings']; - - $errors = ''; - $foundString = ''; - - if ($expectedErrors !== $numErrors || $expectedWarnings !== $numWarnings) { - $lineMessage = "[LINE $line]"; - $expectedMessage = 'Expected '; - $foundMessage = 'in '.basename($testFile).' but found '; - - if ($expectedErrors !== $numErrors) { - $expectedMessage .= "$expectedErrors error(s)"; - $foundMessage .= "$numErrors error(s)"; - if ($numErrors !== 0) { - $foundString .= 'error(s)'; - $errors .= implode(PHP_EOL.' -> ', $problems['found_errors']); - } - - if ($expectedWarnings !== $numWarnings) { - $expectedMessage .= ' and '; - $foundMessage .= ' and '; - if ($numWarnings !== 0) { - if ($foundString !== '') { - $foundString .= ' and '; - } - } - } - } - - if ($expectedWarnings !== $numWarnings) { - $expectedMessage .= "$expectedWarnings warning(s)"; - $foundMessage .= "$numWarnings warning(s)"; - if ($numWarnings !== 0) { - $foundString .= 'warning(s)'; - if (empty($errors) === false) { - $errors .= PHP_EOL.' -> '; - } - - $errors .= implode(PHP_EOL.' -> ', $problems['found_warnings']); - } - } - - $fullMessage = "$lineMessage $expectedMessage $foundMessage."; - if ($errors !== '') { - $fullMessage .= " The $foundString found were:".PHP_EOL." -> $errors"; - } - - $failureMessages[] = $fullMessage; - }//end if - }//end foreach - - return $failureMessages; - - }//end generateFailureMessages() - - - /** - * Get a list of CLI values to set before the file is tested. - * - * @param string $filename The name of the file being tested. - * - * @return array - */ - public function getCliValues($filename) - { - return array(); - - }//end getCliValues() - - - /** - * Returns the lines where errors should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @return array(int => int) - */ - protected abstract function getErrorList(); - - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array(int => int) - */ - protected abstract function getWarningList(); - - -}//end class diff --git a/tests/AllSniffs.php b/tests/AllSniffs.php index 2438d6f..9668ebd 100644 --- a/tests/AllSniffs.php +++ b/tests/AllSniffs.php @@ -1,41 +1,11 @@ - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -// Require this here so that the unit tests don't have to try and find the -// abstract class once it is installed into the PEAR tests directory. -require_once dirname(__FILE__).'/vendor/squizlabs/php_codesniffer/src/Config.php'; -require_once dirname(__FILE__).'/vendor/squizlabs/php_codesniffer/src/Runner.php'; -require_once dirname(__FILE__).'/AbstractSniffUnitTest.php'; - -/** - * A test class for testing all sniffs for installed standards. - * - * Usage: phpunit AllSniffs.php - * - * This test class loads all unit tests for all installed standards into a - * single test suite and runs them. Errors are reported on the command line. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ + +namespace PHP_CodeSniffer\Tests; + +use PHP_CodeSniffer\Autoload; + +include_once __DIR__ . '/../vendor/squizlabs/php_codesniffer/autoload.php'; + class AllSniffs { @@ -54,7 +24,7 @@ class AllSniffs */ public static function main() { - PHPUnit_TextUI_TestRunner::run(self::suite()); + \PHPUnit\TextUI\TestRunner::run(self::suite()); }//end main() @@ -65,11 +35,11 @@ public static function main() * Sniff unit tests are found by recursing through the 'Tests' directory * of each installed coding standard. * - * @return PHPUnit_Framework_TestSuite + * @return \PHPUnit\Framework\TestSuite */ public static function suite() { - $suite = new PHPUnit_Framework_TestSuite('Mito Coding Standards Sniffs'); + $suite = new \PHPUnit\Framework\TestSuite('Mito Coding Standards Sniffs'); $standards = [ 'Application', @@ -79,7 +49,10 @@ public static function suite() ]; $path = dirname(__DIR__); - \PHP_CodeSniffer\Config::setConfigData('installed_paths', $path, true); + Autoload::addSearchPath($path); + + $GLOBALS['PHP_CODESNIFFER_SNIFF_CODES'] = []; + $GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES'] = []; foreach ($standards as $standard) { @@ -90,7 +63,7 @@ public static function suite() continue; } - $di = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testsDir)); + $di = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($testsDir)); foreach ($di as $file) { // Skip hidden files. @@ -108,18 +81,18 @@ public static function suite() $filePath = $file->getPathname(); $className = str_replace($path.DIRECTORY_SEPARATOR, '', $filePath); $className = substr($className, 0, -4); - $className = str_replace(DIRECTORY_SEPARATOR, '_', $className); + $className = '/Mito/'. $className; // Include the sniff here so tests can use it in their setup() methods. - $parts = explode('_', $className); - if (isset($parts[0],$parts[2],$parts[3]) === true) { - $sniffPath = $path.DIRECTORY_SEPARATOR.$parts[0].DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR.$parts[2].DIRECTORY_SEPARATOR.$parts[3]; + $parts = explode('/', $className); + if (isset($parts[2],$parts[4],$parts[5]) === true) { + $sniffPath = $path.DIRECTORY_SEPARATOR.$parts[2].DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR.$parts[4].DIRECTORY_SEPARATOR.$parts[5]; $sniffPath = substr($sniffPath, 0, -8).'Sniff.php'; if (file_exists($sniffPath) === true) { - include_once $sniffPath; - include_once $filePath; - $GLOBALS['PHP_CODESNIFFER_STANDARD_DIRS'][$className] = $path; + $className = Autoload::loadFile($filePath); + $GLOBALS['PHP_CODESNIFFER_STANDARD_DIRS'][$className] = $path.DIRECTORY_SEPARATOR.$parts[2]; + $GLOBALS['PHP_CODESNIFFER_TEST_DIRS'][$className] = $testsDir; $suite->addTestSuite($className); } else { self::$orphanedTests[] = $filePath; diff --git a/tests/AllTests.php b/tests/AllTests.php index 2dfb721..e0bda15 100644 --- a/tests/AllTests.php +++ b/tests/AllTests.php @@ -2,87 +2,62 @@ /** * A test class for running all PHP_CodeSniffer unit tests. * - * PHP version 5 - * - * @category PHP - * @package PHP_CodeSniffer * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) + * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer */ -if (defined('PHP_CODESNIFFER_IN_TESTS') === false) { - define('PHP_CODESNIFFER_IN_TESTS', true); -} +namespace PHP_CodeSniffer\Tests; -require_once 'TestSuite.php'; -include_once 'AllSniffs.php'; -$composerAutoload = [ - __DIR__ . '/../vendor/autoload.php', // in repo - __DIR__ . '/../../../autoload.php', // installed -]; -$vendorPath = null; -foreach ($composerAutoload as $autoload) { - if (file_exists($autoload)) { - require($autoload); - $vendorPath = dirname($autoload); - break; - } +if (!isset($GLOBALS['PHP_CODESNIFFER_PEAR']) || $GLOBALS['PHP_CODESNIFFER_PEAR'] === false) { + include_once __DIR__ . '/../vendor/squizlabs/php_codesniffer/tests/Core/AllTests.php'; + include_once __DIR__ . '/../vendor/squizlabs/php_codesniffer/tests/Standards/AllSniffs.php'; +} else { + include_once __DIR__ . '/../vendor/squizlabs/php_codesniffer/tests/Core/AllTests.php'; + include_once __DIR__ . '/../vendor/squizlabs/php_codesniffer/tests/Standards/AllSniffs.php'; + include_once __DIR__ . '/../vendor/squizlabs/php_codesniffer/tests/FileList.php'; } -/** - * A test class for running all PHP_CodeSniffer unit tests. - * - * Usage: phpunit AllTests.php - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class AllTests -{ +// PHPUnit 7 made the TestSuite run() method incompatible with +// older PHPUnit versions due to return type hints, so maintain +// two different suite objects. +$phpunit7 = false; +if (class_exists('\PHPUnit\Runner\Version') === true) { + $version = \PHPUnit\Runner\Version::id(); + if ($version[0] === '7') { + $phpunit7 = true; + } +} +if ($phpunit7 === true) { + include_once __DIR__ . '/../vendor/squizlabs/php_codesniffer/tests/TestSuite7.php'; +} else { + include_once __DIR__ . '/../vendor/squizlabs/php_codesniffer/tests/TestSuite.php'; +} - /** - * Prepare the test runner. - * - * @return void - */ - public static function main() - { - PHPUnit_TextUI_TestRunner::run(self::suite()); +include_once __DIR__ . '/AllSniffs.php'; - }//end main() +class AllTests +{ /** * Add all PHP_CodeSniffer test suites into a single test suite. * - * @return PHPUnit_Framework_TestSuite + * @return \PHPUnit\Framework\TestSuite */ public static function suite() { - $GLOBALS['PHP_CODESNIFFER_STANDARD_DIRS'] = array(); + $GLOBALS['PHP_CODESNIFFER_STANDARD_DIRS'] = []; + $GLOBALS['PHP_CODESNIFFER_TEST_DIRS'] = []; // Use a special PHP_CodeSniffer test suite so that we can // unset our autoload function after the run. - $suite = new PHP_CodeSniffer_TestSuite('Mito Coding Standards'); + $suite = new TestSuite('Mito Coding Standards'); $suite->addTest(AllSniffs::suite()); - // Unregister this here because the PEAR tester loads - // all package suites before running then, so our autoloader - // will cause problems for the packages included after us. - spl_autoload_unregister(array('PHP_CodeSniffer', 'autoload')); - return $suite; }//end suite() diff --git a/tests/TestSuite.php b/tests/TestSuite.php index 8423f90..7a02730 100644 --- a/tests/TestSuite.php +++ b/tests/TestSuite.php @@ -2,55 +2,32 @@ /** * A PHP_CodeSniffer specific test suite for PHPUnit. * - * PHP version 5 - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -/** - * A PHP_CodeSniffer specific test suite for PHPUnit. - * - * Unregisters the PHP_CodeSniffer autoload function after the run. - * - * @category PHP - * @package PHP_CodeSniffer * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) + * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer */ -class PHP_CodeSniffer_TestSuite extends PHPUnit_Framework_TestSuite + +namespace PHP_CodeSniffer\Tests; + +use PHPUnit\Framework\TestSuite as PHPUnit_TestSuite; +use PHPUnit\Framework\TestResult; + +class TestSuite extends PHPUnit_TestSuite { /** * Runs the tests and collects their result in a TestResult. * - * @param PHPUnit_Framework_TestResult $result A test result. - * @param mixed $filter The filter passed to each test. + * @param \PHPUnit\Framework\TestResult $result A test result. * - * @return PHPUnit_Framework_TestResult + * @return \PHPUnit\Framework\TestResult */ - public function run(PHPUnit_Framework_TestResult $result=null, $filter=false) + public function run(TestResult $result=null) { - $GLOBALS['PHP_CODESNIFFER_SNIFF_CODES'] = array(); - $GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES'] = array(); - spl_autoload_register(array('PHP_CodeSniffer', 'autoload')); - $result = parent::run($result, $filter); - spl_autoload_unregister(array('PHP_CodeSniffer', 'autoload')); - $codes = count($GLOBALS['PHP_CODESNIFFER_SNIFF_CODES']); - echo PHP_EOL.PHP_EOL; - echo "Tests generated $codes unique error codes"; - if ($codes > 0) { - $fixes = count($GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES']); - $percent = round(($fixes / $codes * 100), 2); - echo "; $fixes were fixable ($percent%)"; - } + $result = parent::run($result); + printPHPCodeSnifferTestOutput(); return $result; + }//end run() + + }//end class From 425781393360f63ce7a2899d1d3c94abe013c018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Tue, 21 Jun 2022 22:02:52 +0200 Subject: [PATCH 05/46] dockerize project --- docker-compose.yml | 8 ++++++++ docker/Dockerfile | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2f23471 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.9' +services: + php: + build: + context: ./docker + dockerfile: Dockerfile + volumes: + - .:/usr/src/app diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..288f5b5 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,14 @@ +FROM php:7.4.30-cli-buster +WORKDIR /usr/src/app + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + git \ + unzip + +RUN php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php \ + && php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ + && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \ + && php -r "unlink('composer-setup.php');" + +ENTRYPOINT ["tail", "-f", "/dev/null"] From 6cc8b2430884dfbcfcc0dad1db496d293d67675c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 22 Jun 2022 14:53:05 +0200 Subject: [PATCH 06/46] add editorconfig --- .editorconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..779f99a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false From 6b1b422b8b81e68435d0eb7a0961f4bd3473c132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 22 Jun 2022 15:00:13 +0200 Subject: [PATCH 07/46] add extended, psr-12 based ruleset --- Application/ruleset.xml | 162 +++++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 75 deletions(-) diff --git a/Application/ruleset.xml b/Application/ruleset.xml index 77b7444..b7f3019 100644 --- a/Application/ruleset.xml +++ b/Application/ruleset.xml @@ -1,78 +1,90 @@ - Mito Yii 2 Web Application Coding Standard - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - */i18n/data/* - */views/errorHandler/* - */requirements/* - - ProfileTarget.php + Mito Yii 2 Web Application Coding Standard + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + */i18n/data/* + */views/errorHandler/* + */requirements/* + + ProfileTarget.php From 1754fa487404d6085e029379cbf72d101e088bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 22 Jun 2022 15:01:18 +0200 Subject: [PATCH 08/46] remove unnecessary rules --- .../ControlStructureSpacingSniff.php | 142 --------- .../MultiLineControlStructureSniff.php | 265 ----------------- .../Sniffs/Operators/NewParenthesisSniff.php | 106 ------- .../PrivatePropertiesUnderscoreSniff.php | 70 ----- .../LanguageConstructSpacingSniff.php | 99 ------- .../ControlStructureSpacingUnitTest.inc | 47 --- .../ControlStructureSpacingUnitTest.inc.fixed | 47 --- .../ControlStructureSpacingUnitTest.php | 77 ----- .../MultiLineControlStructureUnitTest.inc | 253 ---------------- ...ultiLineControlStructureUnitTest.inc.fixed | 269 ------------------ .../MultiLineControlStructureUnitTest.js | 163 ----------- ...MultiLineControlStructureUnitTest.js.fixed | 171 ----------- .../MultiLineControlStructureUnitTest.php | 101 ------- .../Operators/NewParenthesisUnitTest.inc | 47 --- .../NewParenthesisUnitTest.inc.fixed | 47 --- .../Operators/NewParenthesisUnitTest.php | 80 ------ .../LanguageConstructSpacingUnitTest.inc | 32 --- .../LanguageConstructSpacingUnitTest.php | 86 ------ 18 files changed, 2102 deletions(-) delete mode 100644 Application/Sniffs/ControlStructures/ControlStructureSpacingSniff.php delete mode 100644 Application/Sniffs/ControlStructures/MultiLineControlStructureSniff.php delete mode 100644 Application/Sniffs/Operators/NewParenthesisSniff.php delete mode 100644 Application/Sniffs/Properties/PrivatePropertiesUnderscoreSniff.php delete mode 100644 Application/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php delete mode 100644 Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.inc delete mode 100644 Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.inc.fixed delete mode 100644 Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.php delete mode 100644 Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.inc delete mode 100644 Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.inc.fixed delete mode 100644 Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.js delete mode 100644 Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.js.fixed delete mode 100644 Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.php delete mode 100644 Application/Tests/Operators/NewParenthesisUnitTest.inc delete mode 100644 Application/Tests/Operators/NewParenthesisUnitTest.inc.fixed delete mode 100644 Application/Tests/Operators/NewParenthesisUnitTest.php delete mode 100644 Application/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc delete mode 100644 Application/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.php diff --git a/Application/Sniffs/ControlStructures/ControlStructureSpacingSniff.php b/Application/Sniffs/ControlStructures/ControlStructureSpacingSniff.php deleted file mode 100644 index 14827aa..0000000 --- a/Application/Sniffs/ControlStructures/ControlStructureSpacingSniff.php +++ /dev/null @@ -1,142 +0,0 @@ - - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -/** - * PSR2_Sniffs_WhiteSpace_ControlStructureSpacingSniff. - * - * Checks that control structures have the correct spacing around brackets. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class ControlStructureSpacingSniff implements \PHP_CodeSniffer\Sniffs\Sniff -{ - /** - * How many spaces should follow the opening bracket. - * - * @var int - */ - public $requiredSpacesAfterOpen = 0; - /** - * How many spaces should precede the closing bracket. - * - * @var int - */ - public $requiredSpacesBeforeClose = 0; - - - /** - * Returns an array of tokens this test wants to listen for. - * - * @return array - */ - public function register() - { - return array( - T_IF, - T_WHILE, - T_FOREACH, - T_FOR, - T_SWITCH, - T_DO, - T_ELSE, - T_ELSEIF, - T_TRY, - T_CATCH, - ); - - }//end register() - - - /** - * Processes this test, when one of its tokens is encountered. - * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. - * @param int $stackPtr The position of the current token - * in the stack passed in $tokens. - * - * @return void - */ - public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) - { - $this->requiredSpacesAfterOpen = (int) $this->requiredSpacesAfterOpen; - $this->requiredSpacesBeforeClose = (int) $this->requiredSpacesBeforeClose; - $tokens = $phpcsFile->getTokens(); - if (isset($tokens[$stackPtr]['parenthesis_opener']) === false - || isset($tokens[$stackPtr]['parenthesis_closer']) === false - ) { - return; - } - - $parenOpener = $tokens[$stackPtr]['parenthesis_opener']; - $parenCloser = $tokens[$stackPtr]['parenthesis_closer']; - $spaceAfterOpen = 0; - if ($tokens[($parenOpener + 1)]['code'] === T_WHITESPACE) { - $spaceAfterOpen = strlen(rtrim($tokens[($parenOpener + 1)]['content'], $phpcsFile->eolChar)); - } - - $phpcsFile->recordMetric($stackPtr, 'Spaces after control structure open parenthesis', $spaceAfterOpen); - if ($spaceAfterOpen !== $this->requiredSpacesAfterOpen) { - $error = 'Expected %s spaces after opening bracket; %s found'; - $data = array( - $this->requiredSpacesAfterOpen, - $spaceAfterOpen, - ); - $fix = $phpcsFile->addFixableError($error, ($parenOpener + 1), 'SpacingAfterOpenBrace', $data); - if ($fix === true) { - $padding = str_repeat(' ', $this->requiredSpacesAfterOpen); - if ($spaceAfterOpen === 0) { - $phpcsFile->fixer->addContent($parenOpener, $padding); - } else { - $phpcsFile->fixer->replaceToken(($parenOpener + 1), $padding); - } - } - } - - if ($tokens[$parenOpener]['line'] === $tokens[$parenCloser]['line']) { - $spaceBeforeClose = 0; - if ($tokens[($parenCloser - 1)]['code'] === T_WHITESPACE) { - $spaceBeforeClose = strlen(ltrim($tokens[($parenCloser - 1)]['content'], $phpcsFile->eolChar)); - } - - $phpcsFile->recordMetric($stackPtr, 'Spaces before control structure close parenthesis', $spaceBeforeClose); - if ($spaceBeforeClose !== $this->requiredSpacesBeforeClose) { - $error = 'Expected %s spaces before closing bracket; %s found'; - $data = array( - $this->requiredSpacesBeforeClose, - $spaceBeforeClose, - ); - $fix = $phpcsFile->addFixableError($error, ($parenCloser - 1), 'SpaceBeforeCloseBrace', $data); - if ($fix === true) { - $padding = str_repeat(' ', $this->requiredSpacesBeforeClose); - if ($spaceBeforeClose === 0) { - $phpcsFile->fixer->addContentBefore($parenCloser, $padding); - } else { - $phpcsFile->fixer->replaceToken(($parenCloser - 1), $padding); - } - } - } - }//end if - - }//end process() - - -}//end class diff --git a/Application/Sniffs/ControlStructures/MultiLineControlStructureSniff.php b/Application/Sniffs/ControlStructures/MultiLineControlStructureSniff.php deleted file mode 100644 index 879154e..0000000 --- a/Application/Sniffs/ControlStructures/MultiLineControlStructureSniff.php +++ /dev/null @@ -1,265 +0,0 @@ - - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -/** - * MultiLineControlStructureSniff. - * - * Verifies that multiline control structures are correctly formatted. - * - * @category ControlStructures - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class MultiLineControlStructureSniff implements \PHP_CodeSniffer\Sniffs\Sniff -{ - /** - * A list of tokenizers this sniff supports. - * - * @var array - */ - public $supportedTokenizers = array( - 'PHP', - 'JS', - ); - - /** - * The number of spaces code should be indented. - * - * @var int - */ - public $indent = 4; - - - /** - * Returns an array of tokens this test wants to listen for. - * - * @return array - */ - public function register() - { - return array( - T_IF, - T_WHILE, - T_FOREACH, - T_FOR, - T_SWITCH, - T_DO, - T_ELSE, - T_ELSEIF, - T_TRY, - T_CATCH, - ); - - }//end register() - - - /** - * Emits error for and fixes closing bracket on same line as condition. - * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. - * @param array $tokens Token stack of the file. - * @param int $closeBracket The position of the closing bracket in the stack passed in $tokens. - * in the stack passed in $tokens. - * - * @return void - */ - private function _closingBracketError(\PHP_CodeSniffer\Files\File $phpcsFile, $tokens, $closeBracket) - { - $error = 'Closing parenthesis of a multi-line control structure must be on a new line'; - $fix = $phpcsFile->addFixableError($error, $closeBracket, 'CloseBracketNewLine'); - if ($fix === true) { - // Account for a comment at the end of the line. - $next = $phpcsFile->findNext(T_WHITESPACE, ($closeBracket + 1), null, true); - if ($tokens[$next]['code'] !== T_COMMENT) { - $phpcsFile->fixer->addNewlineBefore($closeBracket); - } else { - $next = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($next + 1), null, true); - $phpcsFile->fixer->beginChangeset(); - $phpcsFile->fixer->replaceToken($closeBracket, ''); - $phpcsFile->fixer->addContentBefore($next, ')'); - $phpcsFile->fixer->endChangeset(); - } - } - - }//end _closingBracketError() - - - /** - * Processes this test, when one of its tokens is encountered. - * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. - * @param int $stackPtr The position of the current token - * in the stack passed in $tokens. - * - * @return void - */ - public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) - { - $tokens = $phpcsFile->getTokens(); - if (isset($tokens[$stackPtr]['parenthesis_opener']) === false) { - return; - } - - $openBracket = $tokens[$stackPtr]['parenthesis_opener']; - $closeBracket = $tokens[$stackPtr]['parenthesis_closer']; - $targetLine = $tokens[$openBracket]['line']; - for ($i = ($openBracket + 1); $i < $closeBracket; $i++) { - // Skip bracketed statements, like function calls and arrays. - // These don't count as multiple lines even if they are multiline. - if (in_array($tokens[$i]['code'], \PHP_CodeSniffer\Util\Tokens::$functionNameTokens) === true || $tokens[$i]['code'] === T_ARRAY) { - $next = $phpcsFile->findNext(T_WHITESPACE, ($i + 1), null, true); - if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS) { - // This is a function call. - $openingLine = $tokens[$i]['line']; - $i = $tokens[$next]['parenthesis_closer']; - if ($openingLine === $targetLine) { - $targetLine = $tokens[$i]['line']; - } - - continue; - } - } else if ($tokens[$i]['code'] === T_OPEN_SHORT_ARRAY) { - // This is a short array. - $openingLine = $tokens[$i]['line']; - $i = $tokens[$i]['bracket_closer']; - if ($openingLine === $targetLine) { - $targetLine = $tokens[$i]['line']; - } - - continue; - }//end if - }//end for - - if ($targetLine === $tokens[$closeBracket]['line']) { - return; - } - - // We need to work out how far indented the statement - // itself is, so we can work out how far to indent conditions. - $statementIndent = 0; - for ($i = ($stackPtr - 1); $i >= 0; $i--) { - if ($tokens[$i]['line'] !== $tokens[$stackPtr]['line']) { - $i++; - break; - } - } - - if ($i >= 0 && $tokens[$i]['code'] === T_WHITESPACE) { - $statementIndent = strlen($tokens[$i]['content']); - } - - $next = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($openBracket + 1), null, true); - if ($tokens[$next]['line'] === $tokens[$openBracket]['line']) { - $error = 'Opening parenthesis of a multi-line control structure must be the last content on the line'; - $fix = $phpcsFile->addFixableError($error, $next, 'ContentAfterOpenBracket'); - if ($fix === true) { - $phpcsFile->fixer->addContent( - $openBracket, - $phpcsFile->eolChar.str_repeat(' ', ($statementIndent + $this->indent)) - ); - } - } - - // Each line between the parenthesis should be indented 4 spaces - // and start with an operator, unless the line is inside a - // function call, in which case it is ignored. - $lastLine = $tokens[$openBracket]['line']; - for ($i = ($openBracket + 1); $i <= $closeBracket; $i++) { - if ($tokens[$i]['line'] !== $lastLine) { - if ($tokens[$i]['line'] === $tokens[$closeBracket]['line']) { - $next = $phpcsFile->findNext(T_WHITESPACE, $i, null, true); - if ($next !== $closeBracket) { - $this->_closingBracketError($phpcsFile, $tokens, $closeBracket); - $expectedIndent = ($statementIndent + $this->indent); - } else { - // Closing brace needs to be indented to the same level - // as the statement. - $expectedIndent = $statementIndent; - }//end if - } else { - $expectedIndent = ($statementIndent + $this->indent); - }//end if - if ($tokens[$i]['code'] === T_COMMENT) { - $lastLine = $tokens[$i]['line']; - continue; - } - - // We changed lines, so this should be a whitespace indent token. - if ($tokens[$i]['code'] !== T_WHITESPACE) { - $foundIndent = 0; - } else { - $foundIndent = strlen($tokens[$i]['content']); - } - - if ($expectedIndent !== $foundIndent) { - $error = 'Multi-line control structure not indented correctly; expected %s spaces but found %s'; - $data = array( - $expectedIndent, - $foundIndent, - ); - $fix = $phpcsFile->addFixableError($error, $i, 'Alignment', $data); - if ($fix === true) { - $spaces = str_repeat(' ', $expectedIndent); - if ($foundIndent === 0) { - $phpcsFile->fixer->addContentBefore($i, $spaces); - } else { - $phpcsFile->fixer->replaceToken($i, $spaces); - } - } - } - - $lastLine = $tokens[$i]['line']; - }//end if - $jumped = false; - if (in_array($tokens[$i]['code'], \PHP_CodeSniffer\Util\Tokens::$functionNameTokens) === true || $tokens[$i]['code'] === T_ARRAY) { - $next = $phpcsFile->findNext(T_WHITESPACE, ($i + 1), null, true); - if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS) { - // This is a function call or array, so skip to the end as they - // have their own indentation rules. - $i = $tokens[$next]['parenthesis_closer']; - if ($lastLine !== $tokens[$i]['line']) { - $jumped = true; - } - - $lastLine = $tokens[$i]['line']; - } - } else if ($tokens[$i]['code'] === T_OPEN_SHORT_ARRAY) { - // This is a short array, so skip to the end as they - // have their own indentation rules. - $i = $tokens[$i]['bracket_closer']; - if ($lastLine !== $tokens[$i]['line']) { - $jumped = true; - } - - $lastLine = $tokens[$i]['line']; - }//end if - - // If we jumped over a multiline function or array, we need to check if the closing bracket is on the same line. - if ($jumped === true && $lastLine === $tokens[$closeBracket]['line']) { - $this->_closingBracketError($phpcsFile, $tokens, $closeBracket); - } - }//end for - - }//end process() - - -}//end class diff --git a/Application/Sniffs/Operators/NewParenthesisSniff.php b/Application/Sniffs/Operators/NewParenthesisSniff.php deleted file mode 100644 index 16da5c1..0000000 --- a/Application/Sniffs/Operators/NewParenthesisSniff.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -/** - * NewParenthesisSniff - * - * Verifies that parenthesis is used with the new operator. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Nikola Kovacs - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class NewParenthesisSniff implements \PHP_CodeSniffer\Sniffs\Sniff -{ - /** - * A list of tokenizers this sniff supports. - * - * @var array - */ - public $supportedTokenizers = array('PHP'); - - - /** - * Returns an array of tokens this test wants to listen for. - * - * @return array - */ - public function register() - { - return array(T_NEW); - - }//end register() - - - /** - * Processes this test, when one of its tokens is encountered. - * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. - * @param int $stackPtr The position of the current token - * in the stack passed in $tokens. - * - * @return void - */ - public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) - { - $tokens = $phpcsFile->getTokens(); - - // Check for php 7 anonymous classes. - $class = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); - if ($tokens[$class]['code'] === T_ANON_CLASS) { - $open = $phpcsFile->findNext(T_WHITESPACE, ($class + 1), null, true); - $insertAfter = $class; - } else { - $open = $phpcsFile->findNext(T_OPEN_PARENTHESIS, ($stackPtr + 1), null, false, null, true); - $insertAfter = $phpcsFile->findEndOfStatement($stackPtr); - - // If the last token is an end token, find the last non-empty token. - $endTokens = array( - T_COLON, - T_COMMA, - T_DOUBLE_ARROW, - T_SEMICOLON, - T_CLOSE_PARENTHESIS, - T_CLOSE_SQUARE_BRACKET, - T_CLOSE_CURLY_BRACKET, - T_CLOSE_SHORT_ARRAY, - T_OPEN_TAG, - T_CLOSE_TAG, - ); - if (in_array($tokens[$insertAfter]['code'], $endTokens) === true) { - $insertAfter = $phpcsFile->findPrevious(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, ($insertAfter - 1), null, true); - } - }//end if - - if ($open !== false && $tokens[$open]['code'] === T_OPEN_PARENTHESIS) { - return; - } - - $error = 'Use parentheses when instantiating classes with new.'; - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoParenthesis'); - if ($fix === true) { - $phpcsFile->fixer->addContent($insertAfter, '()'); - } - - }//end process() - - -}//end class diff --git a/Application/Sniffs/Properties/PrivatePropertiesUnderscoreSniff.php b/Application/Sniffs/Properties/PrivatePropertiesUnderscoreSniff.php deleted file mode 100644 index 0127864..0000000 --- a/Application/Sniffs/Properties/PrivatePropertiesUnderscoreSniff.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -/** - * PrivatePropertiesUnderscoreSniff - * - * Verifies that private property names are prefixed with an underscore. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Nikola Kovacs - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class PrivatePropertiesUnderscoreSniff implements \PHP_CodeSniffer\Sniffs\Sniff -{ - - - /** - * Returns an array of tokens this test wants to listen for. - * - * @return array - */ - public function register() - { - return array(T_PRIVATE); - - }//end register() - - - /** - * Processes this sniff, when one of its tokens is encountered. - * - * @param \PHP_CodeSniffer\Files\File $file The current file being checked. - * @param int $pointer The position of the current token in - * the stack passed in $tokens. - * - * @return void - */ - public function process(\PHP_CodeSniffer\Files\File $file, $pointer) - { - $tokens = $file->getTokens(); - if ($tokens[$pointer]['content'] === 'private' - && $tokens[($pointer + 1)]['type'] === 'T_WHITESPACE' - && $tokens[($pointer + 2)]['type'] === 'T_VARIABLE' - && strpos($tokens[($pointer + 2)]['content'], '$_') !== 0 - ) { - $file->addError('Private property name must be prefixed with underscore.', $pointer, 'PrivatePropertiesUnderscore'); - } - - }//end process() - - -}//end class diff --git a/Application/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php b/Application/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php deleted file mode 100644 index bf52654..0000000 --- a/Application/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php +++ /dev/null @@ -1,99 +0,0 @@ - - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -/** - * Squiz_Sniffs_WhiteSpace_LanguageConstructSpacingSniff. - * - * Ensures all language constructs (without brackets) contain a - * single space between themselves and their content. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class LanguageConstructSpacingSniff implements \PHP_CodeSniffer\Sniffs\Sniff -{ - - - /** - * Returns an array of tokens this test wants to listen for. - * - * @return array - */ - public function register() - { - return array( - T_ECHO, - T_PRINT, - T_RETURN, - T_NEW, - ); - - }//end register() - - - /** - * Processes this test, when one of its tokens is encountered. - * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. - * @param int $stackPtr The position of the current token in - * the stack passed in $tokens. - * - * @return void - */ - public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) - { - $tokens = $phpcsFile->getTokens(); - - if ($tokens[($stackPtr + 1)]['code'] === T_SEMICOLON) { - // No content for this language construct. - return; - } - - if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) { - $content = $tokens[($stackPtr + 1)]['content']; - $contentLength = strlen($content); - if ($contentLength !== 1) { - $error = 'Language constructs must be followed by a single space; expected 1 space but found %s'; - $data = array($contentLength); - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'IncorrectSingle', $data); - if ($fix === true) { - $phpcsFile->fixer->replaceToken(($stackPtr + 1), ' '); - } - } - } else { - $error = 'Language constructs must be followed by a single space; expected "%s" but found "%s"'; - $data = array( - $tokens[$stackPtr]['content'].' '.$tokens[($stackPtr + 1)]['content'], - $tokens[$stackPtr]['content'].$tokens[($stackPtr + 1)]['content'], - ); - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data); - if ($fix === true) { - $phpcsFile->fixer->addContent($stackPtr, ' '); - } - }//end if - - }//end process() - - -}//end class diff --git a/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.inc b/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.inc deleted file mode 100644 index 3976b03..0000000 --- a/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.inc +++ /dev/null @@ -1,47 +0,0 @@ - $that) {} -foreach ( $something as $blah => $that ) {} -foreach ( $something as $blah => $that ) {} -// @codingStandardsChangeSetting Application.ControlStructures.ControlStructureSpacing requiredSpacesAfterOpen 0 -// @codingStandardsChangeSetting Application.ControlStructures.ControlStructureSpacing requiredSpacesBeforeClose 0 - -$binary = b"binary string"; diff --git a/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.inc.fixed b/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.inc.fixed deleted file mode 100644 index 3d96bf1..0000000 --- a/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.inc.fixed +++ /dev/null @@ -1,47 +0,0 @@ - $that ) {} -foreach ( $something as $blah => $that ) {} -foreach ( $something as $blah => $that ) {} -// @codingStandardsChangeSetting Application.ControlStructures.ControlStructureSpacing requiredSpacesAfterOpen 0 -// @codingStandardsChangeSetting Application.ControlStructures.ControlStructureSpacing requiredSpacesBeforeClose 0 - -$binary = b"binary string"; diff --git a/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.php b/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.php deleted file mode 100644 index 50a9903..0000000 --- a/Application/Tests/ControlStructures/ControlStructureSpacingUnitTest.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -/** - * Unit test class for the FunctionSpacing sniff. - * - * A sniff unit test checks a .inc file for expected violations of a single - * coding standard. Expected errors and warnings are stored in this class. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class ControlStructureSpacingUnitTest extends \PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest -{ - - - /** - * Returns the lines where errors should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @return array - */ - public function getErrorList() - { - return array( - 4 => 1, - 14 => 2, - 26 => 2, - 27 => 2, - 41 => 2, - 43 => 2, - ); - - }//end getErrorList() - - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array - */ - public function getWarningList() - { - return array(); - - }//end getWarningList() - - -}//end class - -?> diff --git a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.inc b/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.inc deleted file mode 100644 index 0130570..0000000 --- a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.inc +++ /dev/null @@ -1,253 +0,0 @@ - -

some text

-errorCode() == 401 || // comment - $IPP->errorCode() == 3200) /* long comment - here - */ -{ - return false; -} - -if ( - $IPP->errorCode() == 401 || // comment - $IPP->errorCode() == 3200) // long comment here -{ - return false; -} - -if ( - $IPP->errorCode() == 401 - // Comment explaining the next condition here. - || $IPP->errorCode() == 3200 -) { - return false; -} - -?> - - - - - - - 1, - 'b' => 2, -])) { - return false; -} - -if ($arr === [ - 'a' => 1, - 'b' => 2, -]) { - return false; -} - -if ($arr === array( - 'a' => 1, - 'b' => 2, -)) { - return false; -} - -if ($arr === [ - 'a' => 1, - 'b' => 2, -] && array_key_exists($key, [ - 'a' => 1, - 'b' => 2, -])) { - return false; -} - -// But these should not -if (( - ($condition1 || $condition2) && - $condition3 -)) { -} - -if ((($condition1 || $condition2) && - $condition3)) { -} - -if ($arr === [ - 'a' => 1, - 'b' => 2, -] -&& array_key_exists($key, [ - 'a' => 1, - 'b' => 2, -])) { - return false; -} - -// test indentation - if ((($condition1 || $condition2) && - $condition3)) { - echo 'true'; - } - -// This should also be considered single line - if (isset( - static::$foo['a'], - static::$foo['a']['b'], - static::$foo['a']['b']['c'] - )) { - return static::$foo['a']['b']['c']; - } diff --git a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.inc.fixed b/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.inc.fixed deleted file mode 100644 index f0cffb4..0000000 --- a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.inc.fixed +++ /dev/null @@ -1,269 +0,0 @@ - -

some text

-errorCode() == 401 || // comment - $IPP->errorCode() == 3200 /* long comment - here - */ -){ - return false; -} - -if ( - $IPP->errorCode() == 401 || // comment - $IPP->errorCode() == 3200 // long comment here -){ - return false; -} - -if ( - $IPP->errorCode() == 401 - // Comment explaining the next condition here. - || $IPP->errorCode() == 3200 -) { - return false; -} - -?> - - - - - - - 1, - 'b' => 2, -])) { - return false; -} - -if ($arr === [ - 'a' => 1, - 'b' => 2, -]) { - return false; -} - -if ($arr === array( - 'a' => 1, - 'b' => 2, -)) { - return false; -} - -if ($arr === [ - 'a' => 1, - 'b' => 2, -] && array_key_exists($key, [ - 'a' => 1, - 'b' => 2, -])) { - return false; -} - -// But these should not -if ( - ( - ($condition1 || $condition2) && - $condition3 - ) -) { -} - -if ( - (($condition1 || $condition2) && - $condition3) -) { -} - -if ( - $arr === [ - 'a' => 1, - 'b' => 2, -] - && array_key_exists($key, [ - 'a' => 1, - 'b' => 2, -]) -) { - return false; -} - -// test indentation - if ( - (($condition1 || $condition2) && - $condition3) - ) { - echo 'true'; - } - -// This should also be considered single line - if (isset( - static::$foo['a'], - static::$foo['a']['b'], - static::$foo['a']['b']['c'] - )) { - return static::$foo['a']['b']['c']; - } diff --git a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.js b/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.js deleted file mode 100644 index 6e1fc38..0000000 --- a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.js +++ /dev/null @@ -1,163 +0,0 @@ -if (blah(param)) { - -} - -if ( - (condition1 || - condition2) && - condition3 && - condition4 && - condition5 -) { -} - -if ((condition1 || condition2) && condition3 && condition4 && condition5) { -} - -if ( - (condition1 || condition2) && - condition3 -) { -} - -if ((condition1 || condition2) - && condition3 -) { -} - -if ( - (condition1 - || condition2) -) { -} - -if ( - (condition1 - || condition2) - && condition3 && - condition4 -) { -} - -if ( - (condition1 - || condition2) - && condition3 - && condition4 - && condition5 -) { -} - -if ( - (condition1 - || condition2) - ) { -} - -if ( - ( - condition1 - || condition2 - ) - && condition3 -) { -} - - -if ( condition1 - || condition2 - || condition3 -) { -} - -if (condition1 - || condition2 - || condition3 -) { -} else if (condition1 - || condition2 - || condition3 -) { -} - -if (condition1 - || condition2 - || condition3 -) { -} else if ( - condition1 - || condition2 && - condition3 -) { -} - -if (condition1 - || condition2 -|| condition3) { -} - -if ( - condition1 - || condition2 || condition3 -){ -} - -if (condition1) - console.info('bar'); - -if ( - condition1 - || condition2 -|| condition3) - console.info('bar'); - - -if ( - condition1 - || condition2 || condition3 -) - console.info('bar'); - -if ( - !a(post) - && (!a(context.header) - ^ a(context.header, 'Content-Type')) -) { -// ... -} - -if (foo) -{ - console.info('bar'); -} - -// Should be no errors even though lines are -// not exactly aligned together. Multi-line function -// call takes precedence. -if ( - array_key_exists(key, value) - && foo.bar.baz( - key, value2 - ) -) { -} - -if (true) { - foo = true; -}; - -if ( - foo == 401 || // comment - bar == 3200) /* long comment - here - */ -{ - return false; -} - -if ( - foo == 401 || // comment - bar == 3200) // long comment here -{ - return false; -} diff --git a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.js.fixed b/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.js.fixed deleted file mode 100644 index f84d0d7..0000000 --- a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.js.fixed +++ /dev/null @@ -1,171 +0,0 @@ -if (blah(param)) { - -} - -if ( - (condition1 || - condition2) && - condition3 && - condition4 && - condition5 -) { -} - -if ((condition1 || condition2) && condition3 && condition4 && condition5) { -} - -if ( - (condition1 || condition2) && - condition3 -) { -} - -if ( - (condition1 || condition2) - && condition3 -) { -} - -if ( - (condition1 - || condition2) -) { -} - -if ( - (condition1 - || condition2) - && condition3 && - condition4 -) { -} - -if ( - (condition1 - || condition2) - && condition3 - && condition4 - && condition5 -) { -} - -if ( - (condition1 - || condition2) -) { -} - -if ( - ( - condition1 - || condition2 - ) - && condition3 -) { -} - - -if ( - condition1 - || condition2 - || condition3 -) { -} - -if ( - condition1 - || condition2 - || condition3 -) { -} else if ( - condition1 - || condition2 - || condition3 -) { -} - -if ( - condition1 - || condition2 - || condition3 -) { -} else if ( - condition1 - || condition2 && - condition3 -) { -} - -if ( - condition1 - || condition2 - || condition3 -) { -} - -if ( - condition1 - || condition2 || condition3 -){ -} - -if (condition1) - console.info('bar'); - -if ( - condition1 - || condition2 - || condition3 -) - console.info('bar'); - - -if ( - condition1 - || condition2 || condition3 -) - console.info('bar'); - -if ( - !a(post) - && (!a(context.header) - ^ a(context.header, 'Content-Type')) -) { -// ... -} - -if (foo) -{ - console.info('bar'); -} - -// Should be no errors even though lines are -// not exactly aligned together. Multi-line function -// call takes precedence. -if ( - array_key_exists(key, value) - && foo.bar.baz( - key, value2 - ) -) { -} - -if (true) { - foo = true; -}; - -if ( - foo == 401 || // comment - bar == 3200 /* long comment - here - */ -){ - return false; -} - -if ( - foo == 401 || // comment - bar == 3200 // long comment here -){ - return false; -} diff --git a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.php b/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.php deleted file mode 100644 index 8465f81..0000000 --- a/Application/Tests/ControlStructures/MultiLineControlStructureUnitTest.php +++ /dev/null @@ -1,101 +0,0 @@ - - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -/** - * Unit test class for the MultiLineCondition sniff. - * - * A sniff unit test checks a .inc file for expected violations of a single - * coding standard. Expected errors and warnings are stored in this class. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class MultiLineControlStructureUnitTest extends \PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest -{ - - - /** - * Returns the lines where errors should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @param string $testFile The name of the file being tested. - * - * @return array - */ - public function getErrorList($testFile='MultiLineControlStructureUnitTest.inc') - { - $errors = array( - 23 => 1, - 44 => 1, - 45 => 1, - 46 => 1, - 47 => 1, - 54 => 1, - 67 => 1, - 73 => 1, - 77 => 1, - 83 => 1, - 89 => 1, - 94 => 1, - 96 => 2, - 111 => 2, - 151 => 1, - 160 => 1, - ); - - if ($testFile === 'MultiLineControlStructureUnitTest.inc') { - $errors[219] = 1; - $errors[222] = 2; - $errors[225] = 1; - $errors[226] = 1; - $errors[229] = 1; - $errors[233] = 1; - $errors[236] = 1; - $errors[241] = 1; - $errors[242] = 1; - } - - return $errors; - - }//end getErrorList() - - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array - */ - public function getWarningList() - { - return array(); - - }//end getWarningList() - - -}//end class diff --git a/Application/Tests/Operators/NewParenthesisUnitTest.inc b/Application/Tests/Operators/NewParenthesisUnitTest.inc deleted file mode 100644 index 03a8b3b..0000000 --- a/Application/Tests/Operators/NewParenthesisUnitTest.inc +++ /dev/null @@ -1,47 +0,0 @@ - - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -/** - * Unit test class for the NewParenthesis sniff. - * - * A sniff unit test checks a .inc file for expected violations of a single - * coding standard. Expected errors and warnings are stored in this class. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class NewParenthesisUnitTest extends \PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest -{ - - - /** - * Returns the lines where errors should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @param string $testFile The name of the file being tested. - * - * @return array - */ - public function getErrorList($testFile='NewParenthesisUnitTest.inc') - { - $errors = array( - 3 => 1, - 7 => 1, - 11 => 1, - 27 => 1, - 43 => 1, - 45 => 1, - 47 => 1, - ); - - return $errors; - - }//end getErrorList() - - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array - */ - public function getWarningList() - { - return array(); - - }//end getWarningList() - - -}//end class diff --git a/Application/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc b/Application/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc deleted file mode 100644 index e70acdc..0000000 --- a/Application/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.inc +++ /dev/null @@ -1,32 +0,0 @@ - - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - -/** - * Unit test class for the LanguageConstructSpacing sniff. - * - * A sniff unit test checks a .inc file for expected violations of a single - * coding standard. Expected errors and warnings are stored in this class. - * - * @category PHP - * @package PHP_CodeSniffer - * @author Greg Sherwood - * @author Marc McIntyre - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer - */ -class LanguageConstructSpacingUnitTest extends \PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest -{ - - - /** - * Returns the lines where errors should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of errors that should occur on that line. - * - * @return array - */ - public function getErrorList() - { - return array( - 3 => 1, - 4 => 1, - 7 => 1, - 8 => 1, - // 11 => 1, - // 12 => 1, - // 15 => 1, - // 16 => 1, - // 19 => 1, - // 20 => 1, - // 23 => 1, - // 24 => 1, - 27 => 1, - 31 => 1, - 32 => 1, - ); - - }//end getErrorList() - - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array - */ - public function getWarningList() - { - return array(); - - }//end getWarningList() - - -}//end class - -?> From afdd876603c2400e2b5952eb36612c1a83f0e24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 22 Jun 2022 15:07:05 +0200 Subject: [PATCH 09/46] add phpunit to composer scripts --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index d45e8d0..07aece3 100644 --- a/composer.json +++ b/composer.json @@ -51,5 +51,10 @@ "require-dev": { "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", "satooshi/php-coveralls": "^1.0" + }, + "scripts": { + "phpunit": [ + "./vendor/bin/phpunit" + ] } } From 03c540f3fddffa6b00033236a90468231879045f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 22 Jun 2022 15:22:52 +0200 Subject: [PATCH 10/46] add custom, psr-12 based ruleset to other files and fix ident style --- Others/ruleset.xml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Others/ruleset.xml b/Others/ruleset.xml index 3426b8f..febebd1 100644 --- a/Others/ruleset.xml +++ b/Others/ruleset.xml @@ -1,10 +1,11 @@ - Mito Yii 2 Web Application Coding Standard (other files) + Mito Yii 2 Web Application Coding Standard (other files) - - - - - + + + + + + From 6cec0d4cbbb00b8061c5ac128771b890388b5717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 22 Jun 2022 15:37:19 +0200 Subject: [PATCH 11/46] add extended psr-12 ruleset and fix ident style --- Views/ruleset.xml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Views/ruleset.xml b/Views/ruleset.xml index 8445bdf..bb508e0 100644 --- a/Views/ruleset.xml +++ b/Views/ruleset.xml @@ -1,15 +1,16 @@ - Mito Yii 2 Web Application Coding Standard (view files with braces) + Mito Yii 2 Web Application Coding Standard (view files with braces) - - - + + + + - - + + - - - + + + From 749c10eb1510ee7c05f7768bd5d43e31031c085d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 22 Jun 2022 15:38:05 +0200 Subject: [PATCH 12/46] fix ident style --- ViewsAlternate/ruleset.xml | 8 ++++---- ViewsMixed/ruleset.xml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ViewsAlternate/ruleset.xml b/ViewsAlternate/ruleset.xml index 31a4d32..e1daa89 100644 --- a/ViewsAlternate/ruleset.xml +++ b/ViewsAlternate/ruleset.xml @@ -1,8 +1,8 @@ - Mito Yii 2 Web Application Coding Standard (view files with alternate syntax) + Mito Yii 2 Web Application Coding Standard (view files with alternate syntax) - - - + + + diff --git a/ViewsMixed/ruleset.xml b/ViewsMixed/ruleset.xml index 062e075..22e343a 100644 --- a/ViewsMixed/ruleset.xml +++ b/ViewsMixed/ruleset.xml @@ -1,8 +1,8 @@ - Mito Yii 2 Web Application Coding Standard (view files) + Mito Yii 2 Web Application Coding Standard (view files) - - - + + + From cffce892cab196602654657837d3d8caa26d4b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 22 Jun 2022 15:48:24 +0200 Subject: [PATCH 13/46] remove yii2 related rules --- Application/ruleset.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Application/ruleset.xml b/Application/ruleset.xml index b7f3019..262c85c 100644 --- a/Application/ruleset.xml +++ b/Application/ruleset.xml @@ -81,10 +81,4 @@ - - */i18n/data/* - */views/errorHandler/* - */requirements/* - - ProfileTarget.php
From 78d634e799d0ae9226bfd25880a0dceea5a6155e Mon Sep 17 00:00:00 2001 From: Albert Borsos Date: Thu, 23 Jun 2022 11:03:56 +0200 Subject: [PATCH 14/46] fix to configure custom OperatorSpacing sniff --- Application/ruleset.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/ruleset.xml b/Application/ruleset.xml index 262c85c..649e275 100644 --- a/Application/ruleset.xml +++ b/Application/ruleset.xml @@ -43,7 +43,7 @@ Good way: $a > $b; Bad way: $a>$b; --> - + From bfbc9e4dc6f4bce9d3fddcf680452987e00a7e03 Mon Sep 17 00:00:00 2001 From: Albert Borsos Date: Thu, 23 Jun 2022 18:03:56 +0200 Subject: [PATCH 15/46] do not validate native codeception method in Cest files --- Application/ruleset.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Application/ruleset.xml b/Application/ruleset.xml index 649e275..0317e8a 100644 --- a/Application/ruleset.xml +++ b/Application/ruleset.xml @@ -81,4 +81,9 @@ + + + + tests/*/*Cest\.php$ +
From f43d6aee4bf7bc6f18060ba71f61b8390742665e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 24 Jun 2022 00:44:33 +0200 Subject: [PATCH 16/46] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8546432..807bc3b 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This repository contains five phpcs standards: * `ViewsMixed`: for view files, allows both curly braces and alternate syntax. * `Others`: for other files, such as configuration files and migration classes. -These standards are based on PSR2 and Yii 2's coding standard, with some additions and improvements. +These standards are based on PSR-12, with some additions and improvements. The `Views` standards disable some rules that cause problems when mixing php with html, and therefore cannot fully check view files and cannot fix all problems in them, From f7d837c8ab1d870ce9f94429440c85af51ecc194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 24 Jun 2022 00:46:15 +0200 Subject: [PATCH 17/46] remove rules that can find in PSR-12 or not necessary --- docs/rules.md | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index 407873a..dfbb11b 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -13,9 +13,6 @@ interpreted as described in [RFC 2119][]. Rules ----- -* Property and method names MUST start with an initial underscore if they are private. - * Reason: Consistency with [Yii 2][Yii2]. Used by Yii's [property feature](http://www.yiiframework.com/doc-2.0/yii-base-object.html) to avoid name clashes. - * Public and protected properties MUST be declared before methods. Private properties SHOULD be declared before methods, but MAY be declared directly before the method that uses them. Properties MUST be declared in visibility order: public before protected before private. @@ -216,30 +213,6 @@ Rules * The backtick operator MUST NOT be used. * Reason: `shell_exec` is identical and clearer. There should not be two ways to do the same thing. -* There MUST always be an opening and closing parenthesis in a `new` expression, even if there are no arguments. - * Reason: Consistency with the case when there are arguments. There should not be two ways to do the same thing. - ```php - // bad - $a = new Foo; - - // bad - $c = new class { - public function __construct() - { - } - }; - - // good - $a = new Foo(); - - // good - $c = new class() { - public function __construct() - { - } - }; - ``` - * `is_null` MUST NOT be used. `=== null` or `!== null` SHOULD be used instead. * Reason: `is_null` and `=== null` have the same result. There should not be two ways to do the same thing. From ca73ef056b0cbcd91904205a43588b3bace2d2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 24 Jun 2022 00:48:15 +0200 Subject: [PATCH 18/46] update reasons for extended rules --- docs/rules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index dfbb11b..009754b 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -16,7 +16,7 @@ Rules * Public and protected properties MUST be declared before methods. Private properties SHOULD be declared before methods, but MAY be declared directly before the method that uses them. Properties MUST be declared in visibility order: public before protected before private. - * Reason: Consistency with [Yii 2][Yii2]. More readable code. + * Reason: More readable code. * Public and protected static methods and properties MUST be accessed using `static`, except in the case of recursion: `self` MAY be used to to call the current implementation again instead of the child class's implementation. @@ -77,7 +77,7 @@ Rules * Arrays MUST use the short array syntax (`[]`). - * Reason: Consistency with [Yii 2][Yii2]. Easier to read and write. There should not be two ways to do the same thing. + * Reason: Easier to read and write. There should not be two ways to do the same thing. * Multi-line arrays MUST be declared with a single item on each line, indented once, and with a comma after every item. There MUST be at least one space before and exactly one space after the `=>` symbol. @@ -148,7 +148,7 @@ Rules * There MUST NOT be a space after the opening square bracket and before the closing square bracket. There MUST NOT be a space before the opening square bracket. - * Reason: Consistency with [Yii 2][Yii2] array declaration syntax. Space before opening square bracket is confusing. + * Reason: Space before opening square bracket is confusing. ```php // bad From ed4b7a1dd45b0e1da77c61ce66a0065d5cbc7e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 24 Jun 2022 00:49:29 +0200 Subject: [PATCH 19/46] remove condition formatting rule that is defined in PSR-12 --- docs/rules.md | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index 009754b..7e03790 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -37,45 +37,6 @@ Rules * Reason: There should not be two ways to do the same thing. * You may choose a ruleset that requires or forbids alternative syntax for view files. -* Control structures MAY be split into multiple lines. - When doing so, there MUST be a newline after the opening parenthesis, each line MUST be indented once, - and the closing parenthesis must be on the start of a new line, indented to the same depth as the control structure itself. - * Reason: Putting the closing parenthesis on its own line with the opening brace makes it easier to see where the body begins. - Putting the conditions into their own, indented block is similar to multi-line function calls in [PSR2][PSR2]. - PSR2 does not specify how multi-line control structures should look. - - ```php - // bad - if ( - ($condition1 || $condition2) && - $condition3) { - // if body - } - - // bad - if ( - ($condition1 || $condition2) && - $condition3 - ) { - // if body - } - - // bad - if (($condition1 || $condition2) && - $condition3) { - // if body - } - - // good - if ( - ($condition1 || $condition2) && - $condition3 - ) { - // if body - } - ``` - - * Arrays MUST use the short array syntax (`[]`). * Reason: Easier to read and write. There should not be two ways to do the same thing. From 95107f348343a43c1c8fea8cd2c8ebfde6eef733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 24 Jun 2022 00:53:22 +0200 Subject: [PATCH 20/46] update basic project informations --- composer.json | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/composer.json b/composer.json index 07aece3..1592130 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mito/yii2-coding-standards", - "description": "Mito Yii 2 coding standards", - "keywords": ["yii", "framework", "codesniffer"], + "description": "Mito coding standards", + "keywords": ["codesniffer", "phpcs", "coding standards"], "homepage": "https://mito.hu/", "license": "BSD-3-Clause", "authors": [ @@ -10,38 +10,12 @@ "email": "nikola.kovacs@gmail.com" }, { - "name": "Qiang Xue", - "email": "qiang.xue@gmail.com", - "homepage": "http://www.yiiframework.com/", - "role": "Founder and project lead" + "name": "Albert Borsos", + "email": "a.borsos@mito.hu" }, { - "name": "Alexander Makarov", - "email": "sam@rmcreative.ru", - "homepage": "http://rmcreative.ru/", - "role": "Core framework development" - }, - { - "name": "Maurizio Domba", - "homepage": "http://mdomba.info/", - "role": "Core framework development" - }, - { - "name": "Carsten Brandt", - "email": "mail@cebe.cc", - "homepage": "http://cebe.cc/", - "role": "Core framework development" - }, - { - "name": "Timur Ruziev", - "email": "resurtm@gmail.com", - "homepage": "http://resurtm.com/", - "role": "Core framework development" - }, - { - "name": "Paul Klimov", - "email": "klimov.paul@gmail.com", - "role": "Core framework development" + "name": "Peter Simon", + "email": "p.simon@mito.hu" } ], "require": { From 7c8fdb168fa8dc3929a573a267fb7ab155c0b2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Mon, 4 Jul 2022 17:36:36 +0200 Subject: [PATCH 21/46] do not allow space before and afer object operator --- Application/ruleset.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Application/ruleset.xml b/Application/ruleset.xml index 0317e8a..b927b83 100644 --- a/Application/ruleset.xml +++ b/Application/ruleset.xml @@ -86,4 +86,10 @@ tests/*/*Cest\.php$
+ + + + + +
From c920c20614388125be9012066e32b5a2041d8a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 8 Jul 2022 14:49:04 +0200 Subject: [PATCH 22/46] clean up, update and remove unnecessary rule properties from array declaration sniff --- .../Sniffs/Arrays/ArrayDeclarationSniff.php | 374 ++++++------------ 1 file changed, 128 insertions(+), 246 deletions(-) diff --git a/Application/Sniffs/Arrays/ArrayDeclarationSniff.php b/Application/Sniffs/Arrays/ArrayDeclarationSniff.php index 198964a..f5e517c 100644 --- a/Application/Sniffs/Arrays/ArrayDeclarationSniff.php +++ b/Application/Sniffs/Arrays/ArrayDeclarationSniff.php @@ -1,20 +1,5 @@ - * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) - * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer - */ - /** * ArrayDeclarationSniff * @@ -28,44 +13,28 @@ * @version Release: @package_version@ * @link http://pear.php.net/package/PHP_CodeSniffer */ -class ArrayDeclarationSniff implements \PHP_CodeSniffer\Sniffs\Sniff -{ - /** - * The number of spaces multi-line array elements should be indented. - * - * @var int - */ - public $indent = 4; - /** - * Whether to align multi-line arrays. - * - * @var bool - */ - public $alignMultiLine = false; +namespace Mito\Application\Sniffs\Arrays; - /** - * Whether to allow aligning multi-line arrays. - * Ignored if alignMultiLine is true. - * - * @var bool|null - */ - public $allowAlignedMultiLine = true; +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +class ArrayDeclarationSniff implements Sniff +{ /** - * Whether to allow multi-line arrays with a single value. + * The number of spaces multi-line array elements should be indented. * - * @var bool + * @var int */ - public $allowSingleMultiLine = true; + private $indent = 4; /** * The number of spaces required after opening bracket and before closing bracket in single-line arrays. * * @var int */ - public $singleLineBracketSpacing = 0; - + private $singleLineBracketSpacing = 0; /** * Returns an array of tokens this test wants to listen for. @@ -74,24 +43,23 @@ class ArrayDeclarationSniff implements \PHP_CodeSniffer\Sniffs\Sniff */ public function register() { - return array( - T_ARRAY, - T_OPEN_SHORT_ARRAY, - ); + return [ + T_ARRAY, + T_OPEN_SHORT_ARRAY, + ]; }//end register() - /** * Processes this sniff, when one of its tokens is encountered. * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked. - * @param int $stackPtr The position of the current token in - * the stack passed in $tokens. + * @param File $phpcsFile The current file being checked. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. * * @return void */ - public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) + public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); @@ -107,7 +75,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) } $error = 'Array keyword should be lower case; expected "array" but found "%s"'; - $data = array($tokens[$stackPtr]['content']); + $data = [$tokens[$stackPtr]['content']]; $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotLowerCase', $data); if ($fix === true) { $phpcsFile->fixer->replaceToken($stackPtr, 'array'); @@ -125,15 +93,21 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) if ($arrayStart !== ($stackPtr + 1)) { $error = 'There must be no space between the "array" keyword and the opening parenthesis'; - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceAfterKeyword'); - if ($fix === true) { - $phpcsFile->fixer->beginChangeset(); - for ($i = ($stackPtr + 1); $i < $arrayStart; $i++) { - $phpcsFile->fixer->replaceToken($i, ''); - } + $next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), $arrayStart, true); + if (isset(Tokens::$commentTokens[$tokens[$next]['code']]) === true) { + // We don't have anywhere to put the comment, so don't attempt to fix it. + $phpcsFile->addError($error, $stackPtr, 'SpaceAfterKeyword'); + } else { + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceAfterKeyword'); + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + for ($i = ($stackPtr + 1); $i < $arrayStart; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } - $phpcsFile->fixer->endChangeset(); + $phpcsFile->fixer->endChangeset(); + } } } } else { @@ -174,7 +148,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) } else if ($tokens[$i]['code'] === T_ARRAY) { $openingLine = $tokens[$i]['line']; $i = $tokens[$tokens[$i]['parenthesis_opener']]['parenthesis_closer']; - } else if (isset(\PHP_CodeSniffer\Util\Tokens::$stringTokens[$tokens[$i]['code']]) === true) { + } else if (isset(Tokens::$stringTokens[$tokens[$i]['code']]) === true) { // Skip to the end of multi-line strings. $openingLine = $tokens[$i]['line']; $i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true); @@ -192,7 +166,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) if ($openingLine === $targetLine) { $targetLine = $tokens[$i]['line']; } - }//end for + } if ($targetLine === $tokens[$arrayEnd]['line']) { $this->processSingleLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd); @@ -202,26 +176,25 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) }//end process() - /** * Processes a single-line array definition. * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked. - * @param int $stackPtr The position of the current token - * in the stack passed in $tokens. - * @param int $arrayStart The token that starts the array definition. - * @param int $arrayEnd The token that ends the array definition. + * @param File $phpcsFile The current file being checked. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * @param int $arrayStart The token that starts the array definition. + * @param int $arrayEnd The token that ends the array definition. * * @return void */ - public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr, $arrayStart, $arrayEnd) + public function processSingleLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd) { $tokens = $phpcsFile->getTokens(); // Check if there are multiple values. If so, then it has to be multiple lines // unless it is contained inside a function call or condition. $valueCount = 0; - $commas = array(); + $commas = []; for ($i = ($arrayStart + 1); $i < $arrayEnd; $i++) { // Skip bracketed statements, like function calls. if ($tokens[$i]['code'] === T_OPEN_PARENTHESIS) { @@ -235,7 +208,7 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ } // Skip to the end of multi-line strings. - if (isset(\PHP_CodeSniffer\Util\Tokens::$stringTokens[$tokens[$i]['code']]) === true) { + if (isset(Tokens::$stringTokens[$tokens[$i]['code']]) === true) { $i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true); $i--; continue; @@ -275,7 +248,7 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ if ($tokens[($nextArrow - 1)]['code'] !== T_WHITESPACE) { $content = $tokens[($nextArrow - 1)]['content']; $error = 'Expected 1 space between "%s" and double arrow; 0 found'; - $data = array($content); + $data = [$content]; $fix = $phpcsFile->addFixableError($error, $nextArrow, 'NoSpaceBeforeDoubleArrow', $data); if ($fix === true) { $phpcsFile->fixer->addContentBefore($nextArrow, ' '); @@ -285,10 +258,10 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ if ($spaceLength !== 1) { $content = $tokens[($nextArrow - 2)]['content']; $error = 'Expected 1 space between "%s" and double arrow; %s found'; - $data = array( - $content, - $spaceLength, - ); + $data = [ + $content, + $spaceLength, + ]; $fix = $phpcsFile->addFixableError($error, $nextArrow, 'SpaceBeforeDoubleArrow', $data); if ($fix === true) { @@ -300,7 +273,7 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ if ($tokens[($nextArrow + 1)]['code'] !== T_WHITESPACE) { $content = $tokens[($nextArrow + 1)]['content']; $error = 'Expected 1 space between double arrow and "%s"; 0 found'; - $data = array($content); + $data = [$content]; $fix = $phpcsFile->addFixableError($error, $nextArrow, 'NoSpaceAfterDoubleArrow', $data); if ($fix === true) { $phpcsFile->fixer->addContent($nextArrow, ' '); @@ -310,10 +283,10 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ if ($spaceLength !== 1) { $content = $tokens[($nextArrow + 2)]['content']; $error = 'Expected 1 space between double arrow and "%s"; %s found'; - $data = array( - $content, - $spaceLength, - ); + $data = [ + $content, + $spaceLength, + ]; $fix = $phpcsFile->addFixableError($error, $nextArrow, 'SpaceAfterDoubleArrow', $data); if ($fix === true) { @@ -331,14 +304,14 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ $spaceLength = $tokens[($arrayStart + 1)]['length']; $content = $tokens[($arrayStart + 2)]['content']; }//end if - $expectedSpacing = (int) $this->singleLineBracketSpacing; + $expectedSpacing = $this->singleLineBracketSpacing; if ($spaceLength !== $expectedSpacing) { $error = 'Expected %s space(s) between opening bracket and "%s"; %s found'; - $data = array( - $expectedSpacing, - $content, - $spaceLength, - ); + $data = [ + $expectedSpacing, + $content, + $spaceLength, + ]; $fix = $phpcsFile->addFixableError($error, ($arrayStart + 1), 'SpaceAfterOpeningBracket', $data); if ($fix === true) { if ($spaceLength > 0) { @@ -358,11 +331,11 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ }//end if if ($spaceLength !== $expectedSpacing) { $error = 'Expected %s space(s) between "%s" and closing bracket; %s found'; - $data = array( - $expectedSpacing, - $content, - $spaceLength, - ); + $data = [ + $expectedSpacing, + $content, + $spaceLength, + ]; $fix = $phpcsFile->addFixableError($error, ($arrayEnd - 1), 'SpaceBeforeClosingBracket', $data); if ($fix === true) { if ($spaceLength > 0) { @@ -380,7 +353,7 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ if ($tokens[($comma + 1)]['code'] !== T_WHITESPACE) { $content = $tokens[($comma + 1)]['content']; $error = 'Expected 1 space between comma and "%s"; 0 found'; - $data = array($content); + $data = [$content]; $fix = $phpcsFile->addFixableError($error, $comma, 'NoSpaceAfterComma', $data); if ($fix === true) { $phpcsFile->fixer->addContent($comma, ' '); @@ -390,10 +363,10 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ if ($spaceLength !== 1) { $content = $tokens[($comma + 2)]['content']; $error = 'Expected 1 space between comma and "%s"; %s found'; - $data = array( - $content, - $spaceLength, - ); + $data = [ + $content, + $spaceLength, + ]; $fix = $phpcsFile->addFixableError($error, $comma, 'SpaceAfterComma', $data); if ($fix === true) { @@ -406,10 +379,10 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ $content = $tokens[($comma - 2)]['content']; $spaceLength = $tokens[($comma - 1)]['length']; $error = 'Expected 0 spaces between "%s" and comma; %s found'; - $data = array( - $content, - $spaceLength, - ); + $data = [ + $content, + $spaceLength, + ]; $fix = $phpcsFile->addFixableError($error, $comma, 'SpaceBeforeComma', $data); if ($fix === true) { @@ -421,27 +394,24 @@ public function processSingleLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $ }//end processSingleLineArray() - /** * Processes a multi-line array definition. * - * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked. - * @param int $stackPtr The position of the current token - * in the stack passed in $tokens. - * @param int $arrayStart The token that starts the array definition. - * @param int $arrayEnd The token that ends the array definition. + * @param File $phpcsFile The current file being checked. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * @param int $arrayStart The token that starts the array definition. + * @param int $arrayEnd The token that ends the array definition. * * @return void */ - public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr, $arrayStart, $arrayEnd) + public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd) { $tokens = $phpcsFile->getTokens(); - $keywordStart = $tokens[$stackPtr]['column']; // We need to work out how far indented the array // itself is, so we can work out how far to // indent the elements. - $start = $phpcsFile->findStartOfStatement($stackPtr); foreach (array('stackPtr', 'start') as $checkToken) { $x = $$checkToken; for ($i = ($x - 1); $i >= 0; $i--) { @@ -484,14 +454,14 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s $phpcsFile->fixer->addNewlineBefore($arrayEnd); } } else if ($tokens[$arrayEnd]['column'] !== ($arrayIndent + 1)) { - // Check the closing bracket is not indented. + // Check the closing bracket is lined up under the "a" in array. $expected = $arrayIndent; $found = ($tokens[$arrayEnd]['column'] - 1); - $error = 'Closing parenthesis not indented correctly; expected %s space(s) but found %s'; - $data = array( - $expected, - $found, - ); + $error = 'Closing parenthesis not aligned correctly; expected %s space(s) but found %s'; + $data = [ + $expected, + $found, + ]; $fix = $phpcsFile->addFixableError($error, $arrayEnd, 'CloseBraceNotAligned', $data); if ($fix === true) { @@ -503,14 +473,9 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s } }//end if - $nextToken = $stackPtr; - // $keyUsed = false; - // $singleUsed = false; $indices = array(); $maxLength = 0; $maxArrowDistance = 0; - // $key = false; - $currentEntry = array(); if ($tokens[$stackPtr]['code'] === T_ARRAY) { $lastToken = $tokens[$stackPtr]['parenthesis_opener']; @@ -518,62 +483,38 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s $lastToken = $stackPtr; } - $lastElementToken = $lastToken; - // Find all the double arrows that reside in this scope. for ($nextToken = ($stackPtr + 1); $nextToken < $arrayEnd; $nextToken++) { // Skip bracketed statements, like function calls. if ($tokens[$nextToken]['code'] === T_OPEN_PARENTHESIS && (isset($tokens[$nextToken]['parenthesis_owner']) === false - || $tokens[$nextToken]['parenthesis_owner'] !== $stackPtr) + || $tokens[$nextToken]['parenthesis_owner'] !== $stackPtr) ) { $nextToken = $tokens[$nextToken]['parenthesis_closer']; continue; } - if ($tokens[$nextToken]['code'] === T_ARRAY) { - // Let subsequent calls of this test handle nested arrays. - if ($tokens[$lastToken]['code'] !== T_DOUBLE_ARROW) { - $indices[] = array('value' => $nextToken); - $lastToken = $nextToken; - } - - $nextToken = $tokens[$tokens[$nextToken]['parenthesis_opener']]['parenthesis_closer']; - $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($nextToken + 1), null, true); - if ($tokens[$nextToken]['code'] !== T_COMMA) { - $nextToken--; - } else { - $lastToken = $nextToken; - } - - continue; - } - - if ($tokens[$nextToken]['code'] === T_OPEN_SHORT_ARRAY) { + if ($tokens[$nextToken]['code'] === T_ARRAY + || $tokens[$nextToken]['code'] === T_OPEN_SHORT_ARRAY + || $tokens[$nextToken]['code'] === T_CLOSURE + || $tokens[$nextToken]['code'] === T_FN + || $tokens[$nextToken]['code'] === T_MATCH + ) { // Let subsequent calls of this test handle nested arrays. if ($tokens[$lastToken]['code'] !== T_DOUBLE_ARROW) { - $indices[] = array('value' => $nextToken); + $indices[] = ['value' => $nextToken]; $lastToken = $nextToken; } - $nextToken = $tokens[$nextToken]['bracket_closer']; - $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($nextToken + 1), null, true); - if ($tokens[$nextToken]['code'] !== T_COMMA) { - $nextToken--; + if ($tokens[$nextToken]['code'] === T_ARRAY) { + $nextToken = $tokens[$tokens[$nextToken]['parenthesis_opener']]['parenthesis_closer']; + } else if ($tokens[$nextToken]['code'] === T_OPEN_SHORT_ARRAY) { + $nextToken = $tokens[$nextToken]['bracket_closer']; } else { - $lastToken = $nextToken; + // T_CLOSURE. + $nextToken = $tokens[$nextToken]['scope_closer']; } - continue; - } - - if ($tokens[$nextToken]['code'] === T_CLOSURE) { - if ($tokens[$lastToken]['code'] !== T_DOUBLE_ARROW) { - $indices[] = array('value' => $nextToken); - $lastToken = $nextToken; - } - - $nextToken = $tokens[$nextToken]['scope_closer']; $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($nextToken + 1), null, true); if ($tokens[$nextToken]['code'] !== T_COMMA) { $nextToken--; @@ -582,11 +523,9 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s } continue; - } + }//end if - if ($tokens[$nextToken]['code'] !== T_DOUBLE_ARROW - && $tokens[$nextToken]['code'] !== T_COMMA - ) { + if ($tokens[$nextToken]['code'] !== T_DOUBLE_ARROW && $tokens[$nextToken]['code'] !== T_COMMA) { continue; } @@ -616,7 +555,7 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s if ($tokens[$lastToken]['code'] !== T_DOUBLE_ARROW) { $valueContent = $phpcsFile->findNext( - \PHP_CodeSniffer\Util\Tokens::$emptyTokens, + Tokens::$emptyTokens, ($lastToken + 1), $nextToken, true @@ -629,7 +568,6 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s }//end if $lastToken = $nextToken; - $lastElementToken = $nextToken; continue; }//end if @@ -641,6 +579,7 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s } $currentEntry['arrow'] = $nextToken; + // Find the start of index that uses this double arrow. $indexEnd = $phpcsFile->findPrevious(T_WHITESPACE, ($nextToken - 1), $arrayStart, true); $indexStart = $phpcsFile->findStartOfStatement($indexEnd); @@ -669,84 +608,35 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s // Find the value of this index. $nextContent = $phpcsFile->findNext( - \PHP_CodeSniffer\Util\Tokens::$emptyTokens, + Tokens::$emptyTokens, ($nextToken + 1), $arrayEnd, true ); $currentEntry['value'] = $nextContent; - $indices[] = $currentEntry; $lastToken = $nextToken; }//end if }//end for - // Check for multi-line arrays that should be single-line. - $singleValue = false; - - if (empty($indices) === true) { - $singleValue = true; - } else if (count($indices) === 1 && $tokens[$lastToken]['code'] === T_COMMA) { - // There may be another array value without a comma. - $exclude = \PHP_CodeSniffer\Util\Tokens::$emptyTokens; - $exclude[] = T_COMMA; - $nextContent = $phpcsFile->findNext($exclude, ($indices[0]['value'] + 1), $arrayEnd, true); - if ($nextContent === false) { - $singleValue = true; - } - } - - if ($singleValue === true && $this->allowSingleMultiLine === false) { - // Array cannot be empty, so this is a multi-line array with - // a single value. It should be defined on single line. - $error = 'Multi-line array contains a single value; use single-line array instead'; - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'MultiLineNotAllowed'); - - if ($fix === true) { - $phpcsFile->fixer->beginChangeset(); - for ($i = ($arrayStart + 1); $i < $arrayEnd; $i++) { - if ($tokens[$i]['code'] !== T_WHITESPACE) { - break; - } - - $phpcsFile->fixer->replaceToken($i, ''); - } - - for ($i = ($arrayEnd - 1); $i > $arrayStart; $i--) { - if ($tokens[$i]['code'] !== T_WHITESPACE) { - break; - } - - $phpcsFile->fixer->replaceToken($i, ''); - } - - $phpcsFile->fixer->endChangeset(); - } - - return; - }//end if - - if ($this->alignMultiLine === true) { + // If the array is already not aligned, don't force it to be. + if ($maxArrowDistance > 1) { $arrayShouldBeAligned = true; } else { - // If the array is already not aligned, don't force it to be. - if ($this->allowAlignedMultiLine === true && $maxArrowDistance > 1) { - $arrayShouldBeAligned = true; - } else { - $arrayShouldBeAligned = false; - } + $arrayShouldBeAligned = false; } if (empty($indices) === false) { $count = count($indices); + // Only add trailing content if last element was added because we found a comma. // If it was added because we found a double arrow, then the trailing content is already in indices. if (isset($indices[($count - 1)]['comma']) !== false) { $lastComma = $indices[($count - 1)]['comma']; $trailingContent = $phpcsFile->findNext( - \PHP_CodeSniffer\Util\Tokens::$emptyTokens, + Tokens::$emptyTokens, ($lastComma + 1), $arrayEnd, true @@ -757,10 +647,8 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s } } } else { - $lastIndex = $arrayStart; - $trailingContent = $phpcsFile->findNext( - \PHP_CodeSniffer\Util\Tokens::$emptyTokens, + Tokens::$emptyTokens, ($arrayStart + 1), $arrayEnd, true @@ -778,7 +666,7 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s $lastIndex = $indices[($count - 1)]['value']; $trailingContent = $phpcsFile->findPrevious( - \PHP_CodeSniffer\Util\Tokens::$emptyTokens, + Tokens::$emptyTokens, ($arrayEnd - 1), $lastIndex, true @@ -799,11 +687,8 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s } }//end if - $numValues = count($indices); - $elementLine = $tokens[$stackPtr]['line']; $elementEndLine = $elementLine; - $lastElementLine = null; foreach ($indices as $idx => $index) { if (isset($index['index']) === false) { // Array value only. @@ -817,7 +702,6 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s // Check each line ends in a comma. $valueLine = $tokens[$index['value']]['line']; - $valueStartLine = $valueLine; $nextComma = false; for ($i = $index['value']; $i < $arrayEnd; $i++) { // Skip bracketed statements, like function calls. @@ -834,7 +718,7 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s } // Skip to the end of multi-line strings. - if (isset(\PHP_CodeSniffer\Util\Tokens::$stringTokens[$tokens[$i]['code']]) === true) { + if (isset(Tokens::$stringTokens[$tokens[$i]['code']]) === true) { $i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true); $i--; $valueLine = $tokens[$i]['line']; @@ -878,7 +762,7 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s // Check that there is no space before the comma. if ($nextComma !== false && $tokens[($nextComma - 1)]['code'] === T_WHITESPACE) { $prevLastContent = $phpcsFile->findPrevious( - \PHP_CodeSniffer\Util\Tokens::$emptyTokens, + Tokens::$emptyTokens, ($nextComma - 1), null, true @@ -891,9 +775,9 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s $found = ($tokens[$nextComma]['column'] - 1); $error = 'Comma not indented correctly; expected %s spaces but found %s'; $data = array( - $expected, - $found, - ); + $expected, + $found, + ); $fix = $phpcsFile->addFixableError($error, $nextComma, 'CommaNotAligned', $data); if ($fix === true) { @@ -914,9 +798,9 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s $error = 'Expected 0 spaces between "%s" and comma; %s found'; $data = array( - $content, - $spaceLength, - ); + $content, + $spaceLength, + ); $fix = $phpcsFile->addFixableError($error, $nextComma, 'SpaceBeforeComma', $data); if ($fix === true) { @@ -969,9 +853,9 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s $found = ($tokens[$index['index']]['column'] - 1); $error = 'Array key not indented correctly; expected %s spaces but found %s'; $data = array( - $expected, - $found, - ); + $expected, + $found, + ); $fix = $phpcsFile->addFixableError($error, $index['index'], 'KeyNotAligned', $data); if ($fix === true) { @@ -1021,9 +905,9 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s $found = ($tokens[$index['arrow']]['column'] - (strlen($index['index_content']) + $tokens[$index['index']]['column'])); $error = 'Array double arrow not aligned correctly; expected %s space(s) but found %s'; $data = array( - $expected, - $found, - ); + $expected, + $found, + ); $fix = $phpcsFile->addFixableError($error, $index['arrow'], 'DoubleArrowNotAligned', $data); if ($fix === true) { @@ -1060,10 +944,10 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s } $error = "Array value not $verb correctly; expected %s space(s) but found %s"; - $data = array( - $expected, - $found, - ); + $data = [ + $expected, + $found, + ]; $fix = $phpcsFile->addFixableError($error, $errorToken, 'ValueNotAligned', $data); if ($fix === true) { @@ -1086,6 +970,4 @@ public function processMultiLineArray(\PHP_CodeSniffer\Files\File $phpcsFile, $s }//end foreach }//end processMultiLineArray() - - }//end class From 691c54dffce7be03e385944330e52faf9e3759e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 8 Jul 2022 14:56:29 +0200 Subject: [PATCH 23/46] remove singleLineBracketSpacing options from tests --- .../Arrays/ArrayDeclarationUnitTest.1.inc | 11 - .../ArrayDeclarationUnitTest.1.inc.fixed | 11 - .../Arrays/ArrayDeclarationUnitTest.2.inc | 13 +- .../ArrayDeclarationUnitTest.2.inc.fixed | 13 +- .../Tests/Arrays/ArrayDeclarationUnitTest.php | 268 +++++++++--------- 5 files changed, 132 insertions(+), 184 deletions(-) diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc b/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc index 72c0a9d..c575111 100644 --- a/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc +++ b/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc @@ -1,5 +1,4 @@ array('type' => 'INT'), 'value' => array('type' => 'VARCHAR')); -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 0 $foo = array( 'a', 'b' ); $foo = array('a', 'b'); $foo = array( 'a', 'b' ); @@ -401,15 +399,6 @@ $bar = array( 'c' ); $bar = array( 'c' ); $bar = array('c'); -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 1 -$foo = array( 'a', 'b' ); -$foo = array('a', 'b'); -$foo = array( 'a', 'b' ); -$bar = array( 'c' ); -$bar = array( 'c' ); -$bar = array('c'); - -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 0 $arr = array('a', array( 'a' => 1, 'b' => 2, diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed b/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed index 84dad85..21e24d3 100644 --- a/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed +++ b/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed @@ -1,5 +1,4 @@ array('type' => 'VARCHAR'), ); -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 0 $foo = array('a', 'b'); $foo = array('a', 'b'); $foo = array('a', 'b'); @@ -413,15 +411,6 @@ $bar = array('c'); $bar = array('c'); $bar = array('c'); -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 1 -$foo = array( 'a', 'b' ); -$foo = array( 'a', 'b' ); -$foo = array( 'a', 'b' ); -$bar = array( 'c' ); -$bar = array( 'c' ); -$bar = array( 'c' ); - -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 0 $arr = array('a', array( 'a' => 1, 'b' => 2, diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc b/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc index 4f365a7..f2b7a81 100644 --- a/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc +++ b/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc @@ -1,5 +1,4 @@ implode('
', $aliases) ]; -$x = +$x = [ $x, $y, @@ -385,15 +384,6 @@ $fields = [ 'id' => ['type' => 'INT'], 'value' => ['type' => 'VARCHAR']]; -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 0 -$foo = [ 'a', 'b' ]; -$foo = ['a', 'b']; -$foo = [ 'a', 'b' ]; -$bar = [ 'c' ]; -$bar = [ 'c' ]; -$bar = ['c']; - -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 1 $foo = [ 'a', 'b' ]; $foo = ['a', 'b']; $foo = [ 'a', 'b' ]; @@ -401,7 +391,6 @@ $bar = [ 'c' ]; $bar = [ 'c' ]; $bar = ['c']; -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 0 $arr = ['a', [ 'a' => 1, 'b' => 2, diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed b/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed index d0bb430..1e2e1e8 100644 --- a/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed +++ b/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed @@ -1,5 +1,4 @@ implode('
', $aliases), ]; -$x = +$x = [ $x, $y, @@ -399,7 +398,6 @@ $fields = [ 'value' => ['type' => 'VARCHAR'], ]; -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 0 $foo = ['a', 'b']; $foo = ['a', 'b']; $foo = ['a', 'b']; @@ -407,15 +405,6 @@ $bar = ['c']; $bar = ['c']; $bar = ['c']; -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 1 -$foo = [ 'a', 'b' ]; -$foo = [ 'a', 'b' ]; -$foo = [ 'a', 'b' ]; -$bar = [ 'c' ]; -$bar = [ 'c' ]; -$bar = [ 'c' ]; - -// @codingStandardsChangeSetting Application.Arrays.ArrayDeclaration singleLineBracketSpacing 0 $arr = ['a', [ 'a' => 1, 'b' => 2, diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.php b/Application/Tests/Arrays/ArrayDeclarationUnitTest.php index ad868f4..bf63048 100644 --- a/Application/Tests/Arrays/ArrayDeclarationUnitTest.php +++ b/Application/Tests/Arrays/ArrayDeclarationUnitTest.php @@ -50,184 +50,176 @@ public function getErrorList($testFile='') switch ($testFile) { case 'ArrayDeclarationUnitTest.1.inc': return array( - 7 => 2, - 9 => 1, + 6 => 2, + 8 => 1, + 9 => 1, 10 => 1, - 11 => 1, - 22 => 1, - // 23 => 1, + 21 => 1, + // 22 => 1, + 23 => 1, 24 => 1, - 25 => 1, - 31 => 1, + 30 => 1, + 34 => 1, 35 => 1, - 36 => 1, - // 41 => 1, + // 40 => 1, + 45 => 1, 46 => 1, - 47 => 1, + 49 => 1, 50 => 1, - 51 => 1, - 53 => 1, - 56 => 1, - 58 => 1, - 61 => 1, - 62 => 2, + 52 => 1, + 55 => 1, + 57 => 1, + 60 => 1, + 61 => 2, + 62 => 1, 63 => 1, 64 => 1, - 65 => 1, - 66 => 2, - 70 => 1, - 76 => 2, - 77 => 1, - 78 => 6, - 79 => 2, - 81 => 2, - 82 => 4, - 88 => 1, + 65 => 2, + 69 => 1, + 75 => 2, + 76 => 1, + 77 => 6, + 78 => 2, + 80 => 2, + 81 => 4, + 87 => 1, + 99 => 1, 100 => 1, 101 => 1, - 102 => 1, - 105 => 1, + 104 => 1, + 105 => 2, 106 => 2, - 107 => 2, + 124 => 1, 125 => 1, - 126 => 1, - 141 => 1, - 144 => 2, - 146 => 1, - 148 => 1, - 157 => 1, - 173 => 1, - 174 => 4, - 179 => 1, - 182 => 1, - 188 => 1, - 207 => 1, - 212 => 1, - 214 => 1, + 140 => 1, + 143 => 2, + 145 => 1, + 147 => 1, + 156 => 1, + 172 => 1, + 173 => 4, + 178 => 1, + 181 => 1, + 187 => 1, + 206 => 1, + 211 => 1, + 213 => 1, + 217 => 5, 218 => 5, - 219 => 5, - 255 => 1, + 254 => 1, + 293 => 1, 294 => 1, 295 => 1, - 296 => 1, - 313 => 1, - 320 => 1, - 338 => 1, - 342 => 1, - 347 => 2, - 348 => 1, - 349 => 2, - 350 => 1, - 355 => 2, - 356 => 1, - 357 => 2, - 358 => 1, - 376 => 1, - 381 => 1, + 312 => 1, + 319 => 1, + 337 => 1, + 341 => 1, + 346 => 2, + 347 => 1, + 348 => 2, + 349 => 1, + 354 => 2, + 355 => 1, + 356 => 2, + 357 => 1, + 375 => 1, + 380 => 1, + 382 => 1, 383 => 1, - 384 => 1, - 388 => 1, - 394 => 2, + 387 => 1, + 393 => 2, + 395 => 2, 397 => 2, + 398 => 2, 399 => 2, - 400 => 2, - 401 => 2, - 405 => 2, - 406 => 2, - 409 => 2, - 410 => 2, - 429 => 2, - 437 => 1, - 441 => 1, - 449 => 1, - 453 => 1, + 418 => 2, + 426 => 1, + 430 => 1, + 438 => 1, + 442 => 1, ); case 'ArrayDeclarationUnitTest.2.inc': return array( + 9 => 1, 10 => 1, - 11 => 1, - // 23 => 1, + // 22 => 1, + 23 => 1, 24 => 1, - 25 => 1, - 31 => 1, - 36 => 1, - // 41 => 1, + 30 => 1, + 35 => 1, + // 40 => 1, + 45 => 1, 46 => 1, - 47 => 1, - 51 => 1, - 53 => 1, - 56 => 1, + 50 => 1, + 52 => 1, + 55 => 1, + 60 => 1, 61 => 1, 62 => 1, 63 => 1, 64 => 1, 65 => 1, - 66 => 1, - 70 => 1, + 69 => 1, + 75 => 1, 76 => 1, - 77 => 1, - 78 => 6, - 79 => 2, - 81 => 2, - 82 => 4, - 88 => 1, + 77 => 6, + 78 => 2, + 80 => 2, + 81 => 4, + 87 => 1, + 99 => 1, 100 => 1, 101 => 1, - 102 => 1, - 105 => 1, + 104 => 1, + 105 => 2, 106 => 2, - 107 => 2, + 124 => 1, 125 => 1, - 126 => 1, - 141 => 1, - 144 => 2, - 146 => 1, - 148 => 1, - 157 => 1, - 173 => 1, - 174 => 4, - 179 => 1, + 140 => 1, + 143 => 2, + 145 => 1, + 147 => 1, + 156 => 1, + 172 => 1, + 173 => 4, + 178 => 1, + 189 => 1, 190 => 1, 191 => 1, - 192 => 1, - 207 => 1, + 206 => 1, + 209 => 4, 210 => 4, - 211 => 4, - 247 => 1, - 286 => 1, + 246 => 1, 287 => 1, - 288 => 1, - 305 => 1, - 312 => 1, - 330 => 1, - 334 => 1, - 339 => 2, - 340 => 1, - 341 => 2, - 342 => 1, - 347 => 2, - 348 => 1, - 349 => 2, - 350 => 1, - 368 => 1, - 373 => 1, + 286 => 1, + 285 => 1, + 304 => 1, + 311 => 1, + 329 => 1, + 333 => 1, + 338 => 2, + 339 => 1, + 340 => 2, + 341 => 1, + 346 => 2, + 347 => 1, + 348 => 2, + 349 => 1, + 367 => 1, + 372 => 1, + 374 => 1, 375 => 1, - 376 => 1, - 380 => 1, - 386 => 2, + 379 => 1, + 385 => 2, + 387 => 2, 389 => 2, + 390 => 2, 391 => 2, - 392 => 2, - 393 => 2, - 397 => 2, - 398 => 2, - 401 => 2, - 402 => 2, - 421 => 2, - 429 => 1, - 433 => 1, - 441 => 1, - 445 => 1, + 410 => 2, + 418 => 1, + 422 => 1, + 430 => 1, + 434 => 1, ); default: return array(); From 3e566fca37161b03c4322390087abb63adc7c366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 8 Jul 2022 15:12:35 +0200 Subject: [PATCH 24/46] add missing variable --- Application/Sniffs/Arrays/ArrayDeclarationSniff.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Application/Sniffs/Arrays/ArrayDeclarationSniff.php b/Application/Sniffs/Arrays/ArrayDeclarationSniff.php index f5e517c..a0f8869 100644 --- a/Application/Sniffs/Arrays/ArrayDeclarationSniff.php +++ b/Application/Sniffs/Arrays/ArrayDeclarationSniff.php @@ -412,6 +412,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array // We need to work out how far indented the array // itself is, so we can work out how far to // indent the elements. + $start = $phpcsFile->findStartOfStatement($stackPtr); foreach (array('stackPtr', 'start') as $checkToken) { $x = $$checkToken; for ($i = ($x - 1); $i >= 0; $i--) { From a19a3f95f0117499106f662167c6cebaab18b66a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 8 Jul 2022 15:32:52 +0200 Subject: [PATCH 25/46] fix array declaration docs --- docs/rules.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index 7e03790..6c1ebb0 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -44,8 +44,7 @@ Rules There MUST be at least one space before and exactly one space after the `=>` symbol. There MAY be more than one space after the `=>` symbol, but if so, all the `=>` symbols in the array declaration must be aligned to the same column. - Keyless items SHOULD NOT be placed between items with keys, they SHOULD be placed before all items with keys. - * Reason: Consistency with [PSR2][PSR2] multi-line function call style. + * Reason: Consistency with [PSR-12][PSR-12] multi-line function call style. Comma after last line leads to cleaner diffs and makes it easier to add items. Aligned array values may be easier to read in some cases. @@ -56,7 +55,16 @@ Rules 'hello' => 'world', 'longkey' => 'value', ]; + // bad + $arr = [ + 'baz', + 'foo' => 'bar', + 'hello' => 'world', + 'longkey' => 'value', + ]; + + // good $arr = [ 'foo' => 'bar', 'baz', From 29e84b74c21207fb7d4bd1df55df4dcce2c79386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 8 Jul 2022 15:39:56 +0200 Subject: [PATCH 26/46] improve docs --- docs/rules.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index 6c1ebb0..baa4e75 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -1,12 +1,10 @@ Coding Style Guide ================== -This coding style guide extends and expands on [PSR2]. -It also incorporates several rules from the [Yii 2 Core Framework Code Style][Yii2]. +This coding style guide extends and expands on [PSR-12][]. -The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", -"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be -interpreted as described in [RFC 2119][]. +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and +"OPTIONAL" in this document are to be interpreted as described in [RFC 2119][]. [RFC 2119]: http://tools.ietf.org/html/rfc2119 @@ -31,7 +29,7 @@ Rules * There MUST NOT be a space between the closing parenthesis and the colon in control structures using the alternative syntax. * Reason: This is how most people write code and how the examples in the [PHP manual](http://php.net/manual/en/control-structures.alternative-syntax.php) look like. - [PSR2][PSR2] ignores the alternative syntax, but the PSR2 ruleset in PHPCS enforces one space. + [PSR-12][] ignores the alternative syntax, but the PSR-12 ruleset in PHPCS enforces one space. * Alternative control structure syntax MUST NOT be used, except in view files. * Reason: There should not be two ways to do the same thing. @@ -44,7 +42,7 @@ Rules There MUST be at least one space before and exactly one space after the `=>` symbol. There MAY be more than one space after the `=>` symbol, but if so, all the `=>` symbols in the array declaration must be aligned to the same column. - * Reason: Consistency with [PSR-12][PSR-12] multi-line function call style. + * Reason: Consistency with [PSR-12][] multi-line function call style. Comma after last line leads to cleaner diffs and makes it easier to add items. Aligned array values may be easier to read in some cases. @@ -198,8 +196,6 @@ Rules References ========== -* [Yii 2 Core Framework Code Style][Yii2] -* [PSR2][PSR2] +* [PSR-12][PSR-12] -[Yii2]: https://github.com/yiisoft/yii2/blob/master/docs/internals/core-code-style.md -[PSR2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md +[PSR-12]: https://www.php-fig.org/psr/psr-12/ From e70d3b8ea883bd414dce1a04c28eab2fbc491c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 8 Jul 2022 15:41:31 +0200 Subject: [PATCH 27/46] remove rules that is defined in PSR-12 --- docs/rules.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index baa4e75..814aa53 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -128,16 +128,13 @@ Rules * There MUST NOT be a space before a semicolon. -* There MUST NOT be any whitespace in cast operators. * There MUST NOT be a space after a cast operator. ```php // bad - $foo = ( int )$bar; $foo = (int) $bar; // good $foo = (int)$bar; - $foo = (int)$bar; ``` * All binary and ternary (but not unary) operators MUST be preceded and followed by one space. From 4e13d92372c11d9732d2a11b8f535ec653cb5ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 8 Jul 2022 15:42:18 +0200 Subject: [PATCH 28/46] remove rules that is not defined in rulesets --- docs/rules.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index 814aa53..ae71bd0 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -139,19 +139,13 @@ Rules * All binary and ternary (but not unary) operators MUST be preceded and followed by one space. -* There MUST NOT be a space before or after an object operator. A newline is allowed before the operator, - but the next line SHOULD be indented. +* There MUST NOT be a space before or after an object operator. ```php // bad $foo -> bar(); - $foor-> - bar(); // good $foo->bar(); - $foo->bar() - ->baz() - ->qux(); ``` * Echoed strings MUST NOT be enclosed in parentheses. From 18a09233bca7ede45715cdb671717622d8d51ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 8 Jul 2022 15:43:30 +0200 Subject: [PATCH 29/46] use single quote instead of double --- docs/rules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index ae71bd0..4331ab8 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -151,10 +151,10 @@ Rules * Echoed strings MUST NOT be enclosed in parentheses. ```php // bad - echo("foo"); + echo('foo'); // good - echo "foo"; + echo 'foo'; ``` * Strings MUST use single quotes unless double quotes are required. From cb291db246b2c6b0ccf767a4f57a8f6547361e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Mon, 11 Jul 2022 23:19:37 +0200 Subject: [PATCH 30/46] replace links --- docs/rules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index 4331ab8..fd8ee2b 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -6,7 +6,7 @@ This coding style guide extends and expands on [PSR-12][]. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119][]. -[RFC 2119]: http://tools.ietf.org/html/rfc2119 +[RFC 2119]: https://datatracker.ietf.org/doc/html/rfc2119 Rules ----- @@ -21,14 +21,14 @@ Rules Constants MUST be accessed using `self`. Private static methods and properties MUST be accessed using `self`. A class name MUST NOT be used if it is the same as the current class, except in closures. - * Reason: Using `static` (i.e. [late static binding](http://php.net/manual/en/language.oop5.late-static-bindings.php)) + * Reason: Using `static` (i.e. [late static binding](https://php.net/manual/en/language.oop5.late-static-bindings.php)) allows a child class to override the method or the property. In the case of constants and private static methods and properties, using `static` would also allow overriding, so `self` must be used to prevent this. * There MUST NOT be a space between the closing parenthesis and the colon in control structures using the alternative syntax. * Reason: This is how most people write code and how the examples in the - [PHP manual](http://php.net/manual/en/control-structures.alternative-syntax.php) look like. + [PHP manual](https://php.net/manual/en/control-structures.alternative-syntax.php) look like. [PSR-12][] ignores the alternative syntax, but the PSR-12 ruleset in PHPCS enforces one space. * Alternative control structure syntax MUST NOT be used, except in view files. From 249b55615006d66371e8ff2c1080a4f675a2440c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Mon, 11 Jul 2022 23:21:15 +0200 Subject: [PATCH 31/46] remove rule which is not defined in ruleset --- docs/rules.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/rules.md b/docs/rules.md index fd8ee2b..34215e2 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -107,7 +107,6 @@ Rules * Single-line array declarations MUST NOT have a space after the opening bracket and before the closing bracket. There MUST be a single space before and after the `=>` symbol. There MUST NOT be a space after the last item. - Keyless items SHOULD be placed before all items with keys. ```php $arr = ['foo', 'bar' => 'baz']; From f545b52e491faa03c3cbd84134c846cc93c0fb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Tue, 12 Jul 2022 15:50:24 +0200 Subject: [PATCH 32/46] add xdebug to docker --- docker/Dockerfile | 4 ++++ docker/xdebug.ini | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 docker/xdebug.ini diff --git a/docker/Dockerfile b/docker/Dockerfile index 288f5b5..9e1dfe9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,6 +6,10 @@ RUN apt-get update && \ git \ unzip +RUN pecl install xdebug + +ADD xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini + RUN php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php \ && php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \ diff --git a/docker/xdebug.ini b/docker/xdebug.ini new file mode 100644 index 0000000..18c82b8 --- /dev/null +++ b/docker/xdebug.ini @@ -0,0 +1,4 @@ +zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so + +[xdebug] +xdebug.mode = "coverage" From 647e779ef4268b575d3a85cd6df8bdafa91d33d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Tue, 12 Jul 2022 15:51:02 +0200 Subject: [PATCH 33/46] add new clover generator --- README.md | 2 +- composer.json | 5 +++-- phpunit.xml.dist | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 807bc3b..d857803 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Mito Yii 2 Coding Standards This repository contains [Mito](https://mito.hu/)'s coding standards for Yii 2 based applications. -[![Coverage Status](https://coveralls.io/repos/github/hellowearemito/yii2-coding-standards/badge.svg?branch=master)](https://coveralls.io/github/hellowearemito/yii2-coding-standards?branch=master) +![Code coverage](docs/clover.svg) Getting the code ---------------- diff --git a/composer.json b/composer.json index 1592130..cef5738 100644 --- a/composer.json +++ b/composer.json @@ -24,11 +24,12 @@ }, "require-dev": { "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", - "satooshi/php-coveralls": "^1.0" + "jaschilz/php-coverage-badger": "^2.0" }, "scripts": { "phpunit": [ - "./vendor/bin/phpunit" + "./vendor/bin/phpunit --coverage-clover tests/clover.xml", + "./vendor/bin/php-coverage-badger tests/clover.xml docs/clover.svg" ] } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5e5b277..b692d08 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,12 +1,12 @@ - + tests/AllTests.php - + Application Others Views From 5e4721807995cea871e138ab6cb58a0f3636ea8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Tue, 12 Jul 2022 15:51:16 +0200 Subject: [PATCH 34/46] add clover --- docs/clover.svg | 21 + tests/clover.xml | 1380 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1401 insertions(+) create mode 100644 docs/clover.svg create mode 100644 tests/clover.xml diff --git a/docs/clover.svg b/docs/clover.svg new file mode 100644 index 0000000..6764a8d --- /dev/null +++ b/docs/clover.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + coverage + coverage + 91% + 91% + + \ No newline at end of file diff --git a/tests/clover.xml b/tests/clover.xml new file mode 100644 index 0000000..1a50898 --- /dev/null +++ b/tests/clover.xml @@ -0,0 +1,1380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 16685412d759238aa7a2ab6383810ac313770966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Tue, 12 Jul 2022 15:55:12 +0200 Subject: [PATCH 35/46] update gitignore and add lock file to repo --- .gitignore | 4 +- composer.lock | 1736 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1737 insertions(+), 3 deletions(-) create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 17f3172..5791e8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ .idea vendor -composer.phar -composer.lock -/_coverage + diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..f0c6917 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1736 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "c98800011bfb442023ad0a568b1bba4d", + "packages": [ + { + "name": "squizlabs/php_codesniffer", + "version": "3.7.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2022-06-18T07:21:10+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-03-03T08:28:38+00:00" + }, + { + "name": "jaschilz/php-coverage-badger", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/JASchilz/PHPCoverageBadge.git", + "reference": "9def6f0c2649dc020849420e633a4819878bac03" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JASchilz/PHPCoverageBadge/zipball/9def6f0c2649dc020849420e633a4819878bac03", + "reference": "9def6f0c2649dc020849420e633a4819878bac03", + "shasum": "" + }, + "bin": [ + "bin/php-coverage-badger" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com" + }, + { + "name": "Joseph Schilz", + "email": "joseph@schilz.org", + "homepage": "https://www.schilz.org" + } + ], + "description": "Create a code coverage badge from a PHPUnit Clover XML file.", + "homepage": "https://github.com/jaschilz/PhpCoverageBadge", + "support": { + "source": "https://github.com/JASchilz/PHPCoverageBadge/tree/master" + }, + "time": "2017-07-21T20:03:56+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2022-03-03T13:19:32+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/master" + }, + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/master" + }, + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" + }, + "require-dev": { + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "77a32518733312af16a44300404e945338981de3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "psalm/phar": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + }, + "time": "2022-03-15T21:29:03+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + }, + "time": "2021-12-08T12:19:24+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + }, + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:42:26+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:20:02+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2021-07-26T12:15:06+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.20", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" + }, + "time": "2020-01-08T08:45:45+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:15:22+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:04:30+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:59:04+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:53:42+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T13:51:24+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + }, + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:40:27+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:37:18+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:34:24+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:30:19+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": "^7.2 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.11.0" + }, + "time": "2022-06-03T18:03:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4.0" + }, + "platform-dev": [], + "plugin-api-version": "2.3.0" +} From fcab46f1c64dce2ca4cc0a5348e8c4c748aa9d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 13 Jul 2022 17:47:11 +0200 Subject: [PATCH 36/46] move source into src folder --- phpunit.xml.dist | 10 ++--- .../Sniffs/Arrays/ArrayDeclarationSniff.php | 0 .../Sniffs/Classes/PropertyOrderSniff.php | 0 .../Sniffs/Classes/StaticSelfSniff.php | 0 .../ControlSignatureSniff.php | 0 ...AlternativeControlStructureSyntaxSniff.php | 0 .../Sniffs/PHP/ForbiddenFunctionsSniff.php | 0 .../Application}/Sniffs/PHP/IsNullSniff.php | 0 .../WhiteSpace/OperatorSpacingSniff.php | 0 .../Arrays/ArrayDeclarationUnitTest.1.inc | 0 .../ArrayDeclarationUnitTest.1.inc.fixed | 0 .../Arrays/ArrayDeclarationUnitTest.2.inc | 0 .../ArrayDeclarationUnitTest.2.inc.fixed | 0 .../Tests/Arrays/ArrayDeclarationUnitTest.php | 0 .../Tests/Classes/PropertyOrderUnitTest.inc | 0 .../Tests/Classes/PropertyOrderUnitTest.php | 0 .../Tests/Classes/StaticSelfUnitTest.2.inc | 0 .../Classes/StaticSelfUnitTest.2.inc.fixed | 0 .../Tests/Classes/StaticSelfUnitTest.inc | 0 .../Classes/StaticSelfUnitTest.inc.fixed | 0 .../Tests/Classes/StaticSelfUnitTest.php | 0 .../ControlSignatureUnitTest.inc | 0 .../ControlSignatureUnitTest.inc.fixed | 0 .../ControlSignatureUnitTest.js | 0 .../ControlSignatureUnitTest.js.fixed | 0 .../ControlSignatureUnitTest.php | 0 ...ernativeControlStructureSyntaxUnitTest.inc | 0 ...veControlStructureSyntaxUnitTest.inc.fixed | 0 ...ernativeControlStructureSyntaxUnitTest.php | 0 .../Tests/PHP/ForbiddenFunctionsUnitTest.inc | 0 .../PHP/ForbiddenFunctionsUnitTest.inc.fixed | 0 .../Tests/PHP/ForbiddenFunctionsUnitTest.php | 0 .../Application}/Tests/PHP/IsNullUnitTest.inc | 0 .../Tests/PHP/IsNullUnitTest.inc.fixed | 0 .../Application}/Tests/PHP/IsNullUnitTest.php | 0 .../WhiteSpace/OperatorSpacingUnitTest.inc | 0 .../OperatorSpacingUnitTest.inc.fixed | 0 .../WhiteSpace/OperatorSpacingUnitTest.js | 0 .../OperatorSpacingUnitTest.js.fixed | 0 .../WhiteSpace/OperatorSpacingUnitTest.php | 0 {Application => src/Application}/ruleset.xml | 0 {Others => src/Others}/ruleset.xml | 0 {Views => src/Views}/ruleset.xml | 0 ...AlternativeControlStructureSyntaxSniff.php | 0 ...ernativeControlStructureSyntaxUnitTest.inc | 0 ...veControlStructureSyntaxUnitTest.inc.fixed | 0 ...ernativeControlStructureSyntaxUnitTest.php | 0 .../ViewsAlternate}/ruleset.xml | 0 {ViewsMixed => src/ViewsMixed}/ruleset.xml | 0 tests/AllSniffs.php | 2 +- tests/clover.xml | 40 +++++++++---------- 51 files changed, 26 insertions(+), 26 deletions(-) rename {Application => src/Application}/Sniffs/Arrays/ArrayDeclarationSniff.php (100%) rename {Application => src/Application}/Sniffs/Classes/PropertyOrderSniff.php (100%) rename {Application => src/Application}/Sniffs/Classes/StaticSelfSniff.php (100%) rename {Application => src/Application}/Sniffs/ControlStructures/ControlSignatureSniff.php (100%) rename {Application => src/Application}/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php (100%) rename {Application => src/Application}/Sniffs/PHP/ForbiddenFunctionsSniff.php (100%) rename {Application => src/Application}/Sniffs/PHP/IsNullSniff.php (100%) rename {Application => src/Application}/Sniffs/WhiteSpace/OperatorSpacingSniff.php (100%) rename {Application => src/Application}/Tests/Arrays/ArrayDeclarationUnitTest.1.inc (100%) rename {Application => src/Application}/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed (100%) rename {Application => src/Application}/Tests/Arrays/ArrayDeclarationUnitTest.2.inc (100%) rename {Application => src/Application}/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed (100%) rename {Application => src/Application}/Tests/Arrays/ArrayDeclarationUnitTest.php (100%) rename {Application => src/Application}/Tests/Classes/PropertyOrderUnitTest.inc (100%) rename {Application => src/Application}/Tests/Classes/PropertyOrderUnitTest.php (100%) rename {Application => src/Application}/Tests/Classes/StaticSelfUnitTest.2.inc (100%) rename {Application => src/Application}/Tests/Classes/StaticSelfUnitTest.2.inc.fixed (100%) rename {Application => src/Application}/Tests/Classes/StaticSelfUnitTest.inc (100%) rename {Application => src/Application}/Tests/Classes/StaticSelfUnitTest.inc.fixed (100%) rename {Application => src/Application}/Tests/Classes/StaticSelfUnitTest.php (100%) rename {Application => src/Application}/Tests/ControlStructures/ControlSignatureUnitTest.inc (100%) rename {Application => src/Application}/Tests/ControlStructures/ControlSignatureUnitTest.inc.fixed (100%) rename {Application => src/Application}/Tests/ControlStructures/ControlSignatureUnitTest.js (100%) rename {Application => src/Application}/Tests/ControlStructures/ControlSignatureUnitTest.js.fixed (100%) rename {Application => src/Application}/Tests/ControlStructures/ControlSignatureUnitTest.php (100%) rename {Application => src/Application}/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc (100%) rename {Application => src/Application}/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc.fixed (100%) rename {Application => src/Application}/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.php (100%) rename {Application => src/Application}/Tests/PHP/ForbiddenFunctionsUnitTest.inc (100%) rename {Application => src/Application}/Tests/PHP/ForbiddenFunctionsUnitTest.inc.fixed (100%) rename {Application => src/Application}/Tests/PHP/ForbiddenFunctionsUnitTest.php (100%) rename {Application => src/Application}/Tests/PHP/IsNullUnitTest.inc (100%) rename {Application => src/Application}/Tests/PHP/IsNullUnitTest.inc.fixed (100%) rename {Application => src/Application}/Tests/PHP/IsNullUnitTest.php (100%) rename {Application => src/Application}/Tests/WhiteSpace/OperatorSpacingUnitTest.inc (100%) rename {Application => src/Application}/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed (100%) rename {Application => src/Application}/Tests/WhiteSpace/OperatorSpacingUnitTest.js (100%) rename {Application => src/Application}/Tests/WhiteSpace/OperatorSpacingUnitTest.js.fixed (100%) rename {Application => src/Application}/Tests/WhiteSpace/OperatorSpacingUnitTest.php (100%) rename {Application => src/Application}/ruleset.xml (100%) rename {Others => src/Others}/ruleset.xml (100%) rename {Views => src/Views}/ruleset.xml (100%) rename {ViewsAlternate => src/ViewsAlternate}/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php (100%) rename {ViewsAlternate => src/ViewsAlternate}/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc (100%) rename {ViewsAlternate => src/ViewsAlternate}/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc.fixed (100%) rename {ViewsAlternate => src/ViewsAlternate}/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.php (100%) rename {ViewsAlternate => src/ViewsAlternate}/ruleset.xml (100%) rename {ViewsMixed => src/ViewsMixed}/ruleset.xml (100%) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b692d08..e31dc17 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,11 +7,11 @@ - Application - Others - Views - ViewsAlternate - ViewsMixed + src/Application + src/Others + src/Views + src/ViewsAlternate + src/ViewsMixed diff --git a/Application/Sniffs/Arrays/ArrayDeclarationSniff.php b/src/Application/Sniffs/Arrays/ArrayDeclarationSniff.php similarity index 100% rename from Application/Sniffs/Arrays/ArrayDeclarationSniff.php rename to src/Application/Sniffs/Arrays/ArrayDeclarationSniff.php diff --git a/Application/Sniffs/Classes/PropertyOrderSniff.php b/src/Application/Sniffs/Classes/PropertyOrderSniff.php similarity index 100% rename from Application/Sniffs/Classes/PropertyOrderSniff.php rename to src/Application/Sniffs/Classes/PropertyOrderSniff.php diff --git a/Application/Sniffs/Classes/StaticSelfSniff.php b/src/Application/Sniffs/Classes/StaticSelfSniff.php similarity index 100% rename from Application/Sniffs/Classes/StaticSelfSniff.php rename to src/Application/Sniffs/Classes/StaticSelfSniff.php diff --git a/Application/Sniffs/ControlStructures/ControlSignatureSniff.php b/src/Application/Sniffs/ControlStructures/ControlSignatureSniff.php similarity index 100% rename from Application/Sniffs/ControlStructures/ControlSignatureSniff.php rename to src/Application/Sniffs/ControlStructures/ControlSignatureSniff.php diff --git a/Application/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php b/src/Application/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php similarity index 100% rename from Application/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php rename to src/Application/Sniffs/ControlStructures/DisallowAlternativeControlStructureSyntaxSniff.php diff --git a/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php b/src/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php similarity index 100% rename from Application/Sniffs/PHP/ForbiddenFunctionsSniff.php rename to src/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php diff --git a/Application/Sniffs/PHP/IsNullSniff.php b/src/Application/Sniffs/PHP/IsNullSniff.php similarity index 100% rename from Application/Sniffs/PHP/IsNullSniff.php rename to src/Application/Sniffs/PHP/IsNullSniff.php diff --git a/Application/Sniffs/WhiteSpace/OperatorSpacingSniff.php b/src/Application/Sniffs/WhiteSpace/OperatorSpacingSniff.php similarity index 100% rename from Application/Sniffs/WhiteSpace/OperatorSpacingSniff.php rename to src/Application/Sniffs/WhiteSpace/OperatorSpacingSniff.php diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc similarity index 100% rename from Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc rename to src/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed similarity index 100% rename from Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed rename to src/Application/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc similarity index 100% rename from Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc rename to src/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed similarity index 100% rename from Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed rename to src/Application/Tests/Arrays/ArrayDeclarationUnitTest.2.inc.fixed diff --git a/Application/Tests/Arrays/ArrayDeclarationUnitTest.php b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.php similarity index 100% rename from Application/Tests/Arrays/ArrayDeclarationUnitTest.php rename to src/Application/Tests/Arrays/ArrayDeclarationUnitTest.php diff --git a/Application/Tests/Classes/PropertyOrderUnitTest.inc b/src/Application/Tests/Classes/PropertyOrderUnitTest.inc similarity index 100% rename from Application/Tests/Classes/PropertyOrderUnitTest.inc rename to src/Application/Tests/Classes/PropertyOrderUnitTest.inc diff --git a/Application/Tests/Classes/PropertyOrderUnitTest.php b/src/Application/Tests/Classes/PropertyOrderUnitTest.php similarity index 100% rename from Application/Tests/Classes/PropertyOrderUnitTest.php rename to src/Application/Tests/Classes/PropertyOrderUnitTest.php diff --git a/Application/Tests/Classes/StaticSelfUnitTest.2.inc b/src/Application/Tests/Classes/StaticSelfUnitTest.2.inc similarity index 100% rename from Application/Tests/Classes/StaticSelfUnitTest.2.inc rename to src/Application/Tests/Classes/StaticSelfUnitTest.2.inc diff --git a/Application/Tests/Classes/StaticSelfUnitTest.2.inc.fixed b/src/Application/Tests/Classes/StaticSelfUnitTest.2.inc.fixed similarity index 100% rename from Application/Tests/Classes/StaticSelfUnitTest.2.inc.fixed rename to src/Application/Tests/Classes/StaticSelfUnitTest.2.inc.fixed diff --git a/Application/Tests/Classes/StaticSelfUnitTest.inc b/src/Application/Tests/Classes/StaticSelfUnitTest.inc similarity index 100% rename from Application/Tests/Classes/StaticSelfUnitTest.inc rename to src/Application/Tests/Classes/StaticSelfUnitTest.inc diff --git a/Application/Tests/Classes/StaticSelfUnitTest.inc.fixed b/src/Application/Tests/Classes/StaticSelfUnitTest.inc.fixed similarity index 100% rename from Application/Tests/Classes/StaticSelfUnitTest.inc.fixed rename to src/Application/Tests/Classes/StaticSelfUnitTest.inc.fixed diff --git a/Application/Tests/Classes/StaticSelfUnitTest.php b/src/Application/Tests/Classes/StaticSelfUnitTest.php similarity index 100% rename from Application/Tests/Classes/StaticSelfUnitTest.php rename to src/Application/Tests/Classes/StaticSelfUnitTest.php diff --git a/Application/Tests/ControlStructures/ControlSignatureUnitTest.inc b/src/Application/Tests/ControlStructures/ControlSignatureUnitTest.inc similarity index 100% rename from Application/Tests/ControlStructures/ControlSignatureUnitTest.inc rename to src/Application/Tests/ControlStructures/ControlSignatureUnitTest.inc diff --git a/Application/Tests/ControlStructures/ControlSignatureUnitTest.inc.fixed b/src/Application/Tests/ControlStructures/ControlSignatureUnitTest.inc.fixed similarity index 100% rename from Application/Tests/ControlStructures/ControlSignatureUnitTest.inc.fixed rename to src/Application/Tests/ControlStructures/ControlSignatureUnitTest.inc.fixed diff --git a/Application/Tests/ControlStructures/ControlSignatureUnitTest.js b/src/Application/Tests/ControlStructures/ControlSignatureUnitTest.js similarity index 100% rename from Application/Tests/ControlStructures/ControlSignatureUnitTest.js rename to src/Application/Tests/ControlStructures/ControlSignatureUnitTest.js diff --git a/Application/Tests/ControlStructures/ControlSignatureUnitTest.js.fixed b/src/Application/Tests/ControlStructures/ControlSignatureUnitTest.js.fixed similarity index 100% rename from Application/Tests/ControlStructures/ControlSignatureUnitTest.js.fixed rename to src/Application/Tests/ControlStructures/ControlSignatureUnitTest.js.fixed diff --git a/Application/Tests/ControlStructures/ControlSignatureUnitTest.php b/src/Application/Tests/ControlStructures/ControlSignatureUnitTest.php similarity index 100% rename from Application/Tests/ControlStructures/ControlSignatureUnitTest.php rename to src/Application/Tests/ControlStructures/ControlSignatureUnitTest.php diff --git a/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc b/src/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc similarity index 100% rename from Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc rename to src/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc diff --git a/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc.fixed b/src/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc.fixed similarity index 100% rename from Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc.fixed rename to src/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.inc.fixed diff --git a/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.php b/src/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.php similarity index 100% rename from Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.php rename to src/Application/Tests/ControlStructures/DisallowAlternativeControlStructureSyntaxUnitTest.php diff --git a/Application/Tests/PHP/ForbiddenFunctionsUnitTest.inc b/src/Application/Tests/PHP/ForbiddenFunctionsUnitTest.inc similarity index 100% rename from Application/Tests/PHP/ForbiddenFunctionsUnitTest.inc rename to src/Application/Tests/PHP/ForbiddenFunctionsUnitTest.inc diff --git a/Application/Tests/PHP/ForbiddenFunctionsUnitTest.inc.fixed b/src/Application/Tests/PHP/ForbiddenFunctionsUnitTest.inc.fixed similarity index 100% rename from Application/Tests/PHP/ForbiddenFunctionsUnitTest.inc.fixed rename to src/Application/Tests/PHP/ForbiddenFunctionsUnitTest.inc.fixed diff --git a/Application/Tests/PHP/ForbiddenFunctionsUnitTest.php b/src/Application/Tests/PHP/ForbiddenFunctionsUnitTest.php similarity index 100% rename from Application/Tests/PHP/ForbiddenFunctionsUnitTest.php rename to src/Application/Tests/PHP/ForbiddenFunctionsUnitTest.php diff --git a/Application/Tests/PHP/IsNullUnitTest.inc b/src/Application/Tests/PHP/IsNullUnitTest.inc similarity index 100% rename from Application/Tests/PHP/IsNullUnitTest.inc rename to src/Application/Tests/PHP/IsNullUnitTest.inc diff --git a/Application/Tests/PHP/IsNullUnitTest.inc.fixed b/src/Application/Tests/PHP/IsNullUnitTest.inc.fixed similarity index 100% rename from Application/Tests/PHP/IsNullUnitTest.inc.fixed rename to src/Application/Tests/PHP/IsNullUnitTest.inc.fixed diff --git a/Application/Tests/PHP/IsNullUnitTest.php b/src/Application/Tests/PHP/IsNullUnitTest.php similarity index 100% rename from Application/Tests/PHP/IsNullUnitTest.php rename to src/Application/Tests/PHP/IsNullUnitTest.php diff --git a/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.inc b/src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.inc similarity index 100% rename from Application/Tests/WhiteSpace/OperatorSpacingUnitTest.inc rename to src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.inc diff --git a/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed b/src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed similarity index 100% rename from Application/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed rename to src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.inc.fixed diff --git a/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.js b/src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.js similarity index 100% rename from Application/Tests/WhiteSpace/OperatorSpacingUnitTest.js rename to src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.js diff --git a/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.js.fixed b/src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.js.fixed similarity index 100% rename from Application/Tests/WhiteSpace/OperatorSpacingUnitTest.js.fixed rename to src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.js.fixed diff --git a/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.php b/src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.php similarity index 100% rename from Application/Tests/WhiteSpace/OperatorSpacingUnitTest.php rename to src/Application/Tests/WhiteSpace/OperatorSpacingUnitTest.php diff --git a/Application/ruleset.xml b/src/Application/ruleset.xml similarity index 100% rename from Application/ruleset.xml rename to src/Application/ruleset.xml diff --git a/Others/ruleset.xml b/src/Others/ruleset.xml similarity index 100% rename from Others/ruleset.xml rename to src/Others/ruleset.xml diff --git a/Views/ruleset.xml b/src/Views/ruleset.xml similarity index 100% rename from Views/ruleset.xml rename to src/Views/ruleset.xml diff --git a/ViewsAlternate/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php b/src/ViewsAlternate/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php similarity index 100% rename from ViewsAlternate/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php rename to src/ViewsAlternate/Sniffs/ControlStructures/AlternativeControlStructureSyntaxSniff.php diff --git a/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc b/src/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc similarity index 100% rename from ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc rename to src/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc diff --git a/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc.fixed b/src/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc.fixed similarity index 100% rename from ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc.fixed rename to src/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.inc.fixed diff --git a/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.php b/src/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.php similarity index 100% rename from ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.php rename to src/ViewsAlternate/Tests/ControlStructures/AlternativeControlStructureSyntaxUnitTest.php diff --git a/ViewsAlternate/ruleset.xml b/src/ViewsAlternate/ruleset.xml similarity index 100% rename from ViewsAlternate/ruleset.xml rename to src/ViewsAlternate/ruleset.xml diff --git a/ViewsMixed/ruleset.xml b/src/ViewsMixed/ruleset.xml similarity index 100% rename from ViewsMixed/ruleset.xml rename to src/ViewsMixed/ruleset.xml diff --git a/tests/AllSniffs.php b/tests/AllSniffs.php index 9668ebd..7520904 100644 --- a/tests/AllSniffs.php +++ b/tests/AllSniffs.php @@ -47,7 +47,7 @@ public static function suite() 'Views', 'ViewsAlternate', ]; - $path = dirname(__DIR__); + $path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src'; Autoload::addSearchPath($path); diff --git a/tests/clover.xml b/tests/clover.xml index 1a50898..a088769 100644 --- a/tests/clover.xml +++ b/tests/clover.xml @@ -1,8 +1,8 @@ - - + + - + @@ -527,7 +527,7 @@ - + @@ -569,7 +569,7 @@ - + @@ -728,7 +728,7 @@ - + @@ -868,7 +868,7 @@ - + @@ -926,7 +926,7 @@ - + @@ -959,7 +959,7 @@ - + @@ -1021,7 +1021,7 @@ - + @@ -1169,7 +1169,7 @@ - + @@ -1186,7 +1186,7 @@ - + @@ -1197,7 +1197,7 @@ - + @@ -1214,7 +1214,7 @@ - + @@ -1246,7 +1246,7 @@ - + @@ -1259,7 +1259,7 @@ - + @@ -1270,7 +1270,7 @@ - + @@ -1283,7 +1283,7 @@ - + @@ -1300,7 +1300,7 @@ - + @@ -1363,7 +1363,7 @@ - + From 1de4cd1557101d026341f18832d76e5838057079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 13 Jul 2022 17:47:33 +0200 Subject: [PATCH 37/46] use composer install instead of update --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4dadbef..98a19ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,7 +47,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies with Composer - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader + run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Run tests with PhpUnit run: vendor/bin/phpunit $PHPUNIT_FLAGS From cb2fe9f2571cc80e93a8ec3f4a338216ee72ceeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Wed, 13 Jul 2022 18:00:38 +0200 Subject: [PATCH 38/46] reformat files --- .gitignore | 1 - .gitlab-ci.yml | 1 - composer.json | 60 +++++++++++++++++++++++++------------------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 5791e8f..3ce5adb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .idea vendor - diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9deeab..814b734 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,4 +14,3 @@ test: - docker script: - ./vendor/bin/phpunit - diff --git a/composer.json b/composer.json index cef5738..63acecb 100644 --- a/composer.json +++ b/composer.json @@ -1,35 +1,35 @@ { - "name": "mito/yii2-coding-standards", - "description": "Mito coding standards", - "keywords": ["codesniffer", "phpcs", "coding standards"], - "homepage": "https://mito.hu/", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "Nikola Kovacs", - "email": "nikola.kovacs@gmail.com" - }, - { - "name": "Albert Borsos", - "email": "a.borsos@mito.hu" - }, - { - "name": "Peter Simon", - "email": "p.simon@mito.hu" - } - ], - "require": { - "php": ">=5.4.0", - "squizlabs/php_codesniffer": "^3.7.1" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", + "name": "mito/yii2-coding-standards", + "description": "Mito coding standards", + "keywords": ["codesniffer", "phpcs", "coding standards"], + "homepage": "https://mito.hu/", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Nikola Kovacs", + "email": "nikola.kovacs@gmail.com" + }, + { + "name": "Albert Borsos", + "email": "a.borsos@mito.hu" + }, + { + "name": "Peter Simon", + "email": "p.simon@mito.hu" + } + ], + "require": { + "php": ">=5.4.0", + "squizlabs/php_codesniffer": "^3.7.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", "jaschilz/php-coverage-badger": "^2.0" - }, - "scripts": { - "phpunit": [ + }, + "scripts": { + "phpunit": [ "./vendor/bin/phpunit --coverage-clover tests/clover.xml", "./vendor/bin/php-coverage-badger tests/clover.xml docs/clover.svg" - ] - } + ] + } } From d38012e2368c3322b2c3db070d27ff3f0a268939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Tue, 30 Aug 2022 14:08:02 +0200 Subject: [PATCH 39/46] replace old and unexistent exception classes --- src/Application/Sniffs/Classes/PropertyOrderSniff.php | 4 +++- src/Application/Sniffs/Classes/StaticSelfSniff.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Application/Sniffs/Classes/PropertyOrderSniff.php b/src/Application/Sniffs/Classes/PropertyOrderSniff.php index 7d31c78..234a090 100644 --- a/src/Application/Sniffs/Classes/PropertyOrderSniff.php +++ b/src/Application/Sniffs/Classes/PropertyOrderSniff.php @@ -2,6 +2,8 @@ namespace Mito\Application\Sniffs\Classes; +use PHP_CodeSniffer\Exceptions\RuntimeException; + /** * PropertyOrderSniff. * @@ -94,7 +96,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) } else if ($tokens[$i]['code'] === T_VARIABLE) { try { $propProps = $phpcsFile->getMemberProperties($i); - } catch (\PHP_CodeSniffer_Exception $e) { + } catch (RuntimeException $e) { // Not a class member var. continue; } diff --git a/src/Application/Sniffs/Classes/StaticSelfSniff.php b/src/Application/Sniffs/Classes/StaticSelfSniff.php index fa7c636..bb775e7 100644 --- a/src/Application/Sniffs/Classes/StaticSelfSniff.php +++ b/src/Application/Sniffs/Classes/StaticSelfSniff.php @@ -3,6 +3,7 @@ namespace Mito\Application\Sniffs\Classes; use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Exceptions\RuntimeException; /** * StaticSelfSniff. @@ -109,7 +110,7 @@ protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFil } else if ($tokens[$i]['code'] === T_VARIABLE) { try { $propProps = $phpcsFile->getMemberProperties($i); - } catch (\PHP_CodeSniffer_Exception $e) { + } catch (RuntimeException $e) { // Not a class member var. continue; } From 52c569f6040200a13d840d1069844e1ad0bd3686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Tue, 30 Aug 2022 14:50:42 +0200 Subject: [PATCH 40/46] use php 5.6 docker image to improve backward compatibility --- docker/Dockerfile | 4 ++-- docker/xdebug.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 9e1dfe9..9854ee0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.4.30-cli-buster +FROM php:5.6.40-cli-stretch WORKDIR /usr/src/app RUN apt-get update && \ @@ -6,7 +6,7 @@ RUN apt-get update && \ git \ unzip -RUN pecl install xdebug +RUN pecl install xdebug-2.5.5 ADD xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini diff --git a/docker/xdebug.ini b/docker/xdebug.ini index 18c82b8..a407a15 100644 --- a/docker/xdebug.ini +++ b/docker/xdebug.ini @@ -1,4 +1,4 @@ -zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so +zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so [xdebug] xdebug.mode = "coverage" From aa731851506932b1a7c0d5dc418b7518b2b140f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Tue, 30 Aug 2022 14:51:25 +0200 Subject: [PATCH 41/46] update lock file --- composer.lock | 1004 ++++++++++++++++++++++--------------------------- 1 file changed, 452 insertions(+), 552 deletions(-) diff --git a/composer.lock b/composer.lock index f0c6917..0d3d6a0 100644 --- a/composer.lock +++ b/composer.lock @@ -66,32 +66,34 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": ">=5.3,<8.0-DEV" }, "require-dev": { - "doctrine/coding-standard": "^9", + "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -105,34 +107,20 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" + "homepage": "http://ocramius.github.com/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "homepage": "https://github.com/doctrine/instantiator", "keywords": [ "constructor", "instantiate" ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/master" }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "jaschilz/php-coverage-badger", @@ -177,29 +165,25 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "php": "^5.6 || ^7.0" }, "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" }, "type": "library", "autoload": { @@ -224,152 +208,41 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.x" }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2022-03-03T13:19:32+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" - }, - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/master" - }, - "time": "2018-07-08T19:19:57+00:00" + "time": "2017-10-19T19:58:43+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "2.2.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" }, "type": "library", "extra": { "branch-alias": { - "dev-2.x": "2.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src/" + "phpDocumentor\\Reflection\\": [ + "src" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -393,44 +266,40 @@ ], "support": { "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master" }, - "time": "2020-06-27T09:03:43+00:00" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2", + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2", "shasum": "" }, "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" + "php": "^5.6 || ^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src" + "phpDocumentor\\Reflection\\": [ + "src/" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -441,50 +310,48 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/3.x" }, - "time": "2021-10-19T17:43:47+00:00" + "time": "2017-11-10T14:09:06+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.1", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src" + "phpDocumentor\\Reflection\\": [ + "src/" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -497,42 +364,41 @@ "email": "me@mikevanriel.com" } ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/master" }, - "time": "2022-03-15T21:29:03+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.15.0", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -567,46 +433,46 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" }, - "time": "2021-12-08T12:19:24+00:00" + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "php": "^5.6 || ^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "^1.0 || ^2.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.5.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -621,7 +487,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", + "email": "sb@sebastian-bergmann.de", "role": "lead" } ], @@ -633,35 +499,33 @@ "xunit" ], "support": { + "irc": "irc://irc.freenode.net/phpunit", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/4.0" }, - "time": "2018-10-31T16:06:48+00:00" + "time": "2017-04-02T07:44:40+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.5", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" + "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -676,7 +540,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", + "email": "sb@sebastian-bergmann.de", "role": "lead" } ], @@ -687,16 +551,11 @@ "iterator" ], "support": { + "irc": "irc://irc.freenode.net/phpunit", "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-02T12:42:26+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -745,28 +604,28 @@ }, { "name": "phpunit/php-timer", - "version": "2.1.3", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=7.1" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -781,7 +640,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", + "email": "sb@sebastian-bergmann.de", "role": "lead" } ], @@ -792,41 +651,35 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/master" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T08:20:02+00:00" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.1.3", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=7.1" + "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "~4.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -851,66 +704,58 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "abandoned": true, - "time": "2021-07-26T12:15:06+00:00" + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.20", + "version": "5.7.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^4.0.4", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "^1.4.3", + "sebastian/environment": "^1.3.4 || ^2.0", + "sebastian/exporter": "~2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "~2.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "^1.0.6|^2.0.1", + "symfony/yaml": "~2.1|~3.0|~4.0" }, "conflict": { - "phpunit/phpunit-mock-objects": "*" + "phpdocumentor/reflection-docblock": "3.0.2" }, "require-dev": { "ext-pdo": "*" }, "suggest": { - "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "~1.1" }, "bin": [ "phpunit" @@ -918,7 +763,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "5.7.x-dev" } }, "autoload": { @@ -946,9 +791,74 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/5.7.27" + }, + "time": "2018-02-01T05:50:59+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "3.4.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "support": { + "irc": "irc://irc.freenode.net/phpunit", + "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", + "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/3.4" }, - "time": "2020-01-08T08:45:45+00:00" + "abandoned": true, + "time": "2017-06-30T09:13:00+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1007,30 +917,30 @@ }, { "name": "sebastian/comparator", - "version": "3.0.3", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1043,10 +953,6 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1058,10 +964,14 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", + "homepage": "http://www.github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", @@ -1069,41 +979,34 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/comparator/tree/1.2" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T08:04:30+00:00" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "3.0.3", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=7.1" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -1116,62 +1019,50 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Kore Nordmann", "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" + "diff" ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/1.4" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:59:04+00:00" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", - "version": "4.2.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "shasum": "" }, "require": { - "php": ">=7.1" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" + "phpunit/phpunit": "^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1198,42 +1089,36 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + "source": "https://github.com/sebastianbergmann/environment/tree/master" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:53:42+00:00" + "time": "2016-11-26T07:53:53+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", "shasum": "" }, "require": { - "php": ">=7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=5.3.3", + "sebastian/recursion-context": "~2.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1246,10 +1131,6 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1259,12 +1140,16 @@ "email": "github@wallbash.com" }, { - "name": "Adam Harvey", - "email": "aharvey@php.net" + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" }, { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1275,35 +1160,29 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/master" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-11-11T13:51:24+00:00" + "time": "2016-11-19T08:54:04+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "~4.2" }, "suggest": { "ext-uopz": "*" @@ -1311,7 +1190,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -1336,36 +1215,35 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + "source": "https://github.com/sebastianbergmann/global-state/tree/1.1.1" }, - "time": "2017-04-27T15:39:26+00:00" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.4", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", "shasum": "" }, "require": { - "php": ">=7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "~5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1387,95 +1265,34 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/master" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:40:27+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:37:18+00:00" + "time": "2017-02-18T15:18:39+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", "shasum": "" }, "require": { - "php": ">=7.0" + "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1488,14 +1305,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -1505,37 +1322,31 @@ "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:34:24+00:00" + "time": "2016-11-19T07:33:16+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.2", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=5.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -1557,15 +1368,9 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/master" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-30T07:30:19+00:00" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", @@ -1615,86 +1420,181 @@ "time": "2016-10-03T07:35:21+00:00" }, { - "name": "theseer/tokenizer", - "version": "1.2.1", + "name": "symfony/polyfill-ctype", + "version": "v1.19.0", "source": { "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b", + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, "autoload": { - "classmap": [ - "src/" + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T09:01:57+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "88289caa3c166321883f67fe5130188ebbb47094" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", + "reference": "88289caa3c166321883f67fe5130188ebbb47094", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/symfony/yaml/tree/v3.4.47" }, "funding": [ { - "url": "https://github.com/theseer", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { "name": "webmozart/assert", - "version": "1.11.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "ext-ctype": "*", - "php": "^7.2 || ^8.0" + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" + "vimeo/psalm": "<3.9.1" }, "require-dev": { - "phpunit/phpunit": "^8.5.13" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1718,9 +1618,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.11.0" + "source": "https://github.com/webmozarts/assert/tree/1.9.1" }, - "time": "2022-06-03T18:03:27+00:00" + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], @@ -1732,5 +1632,5 @@ "php": ">=5.4.0" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } From e51f6adec95b82ee3493451eaddfed7176dbc2c5 Mon Sep 17 00:00:00 2001 From: Albert Borsos Date: Wed, 31 Aug 2022 09:24:31 +0200 Subject: [PATCH 42/46] fix builds with composer update --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 98a19ce..4dadbef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,7 +47,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies with Composer - run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Run tests with PhpUnit run: vendor/bin/phpunit $PHPUNIT_FLAGS From 6cb33d320a8292143476662a49314638b0a67984 Mon Sep 17 00:00:00 2001 From: Albert Borsos Date: Wed, 31 Aug 2022 09:25:56 +0200 Subject: [PATCH 43/46] use mb string functions in sniffs to prevent invalid errors for if unicode characters exists in strings --- composer.json | 3 +- composer.lock | 85 ++++++++++++++++++- .../Sniffs/Arrays/ArrayDeclarationSniff.php | 20 ++--- .../Sniffs/Classes/StaticSelfSniff.php | 8 +- .../ControlSignatureSniff.php | 18 ++-- .../Sniffs/PHP/ForbiddenFunctionsSniff.php | 2 +- src/Application/Sniffs/PHP/IsNullSniff.php | 2 +- .../Arrays/ArrayDeclarationUnitTest.3.inc | 6 ++ .../ArrayDeclarationUnitTest.3.inc.fixed | 6 ++ 9 files changed, 123 insertions(+), 27 deletions(-) create mode 100644 src/Application/Tests/Arrays/ArrayDeclarationUnitTest.3.inc create mode 100644 src/Application/Tests/Arrays/ArrayDeclarationUnitTest.3.inc.fixed diff --git a/composer.json b/composer.json index 63acecb..31767f5 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ ], "require": { "php": ">=5.4.0", - "squizlabs/php_codesniffer": "^3.7.1" + "squizlabs/php_codesniffer": "^3.7.1", + "symfony/polyfill-mbstring": "*" }, "require-dev": { "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", diff --git a/composer.lock b/composer.lock index f0c6917..dceb427 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c98800011bfb442023ad0a568b1bba4d", + "content-hash": "60e15bb6ed68f94f402c2ddb3146b060", "packages": [ { "name": "squizlabs/php_codesniffer", @@ -61,6 +61,89 @@ "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, "time": "2022-06-18T07:21:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-24T11:49:31+00:00" } ], "packages-dev": [ diff --git a/src/Application/Sniffs/Arrays/ArrayDeclarationSniff.php b/src/Application/Sniffs/Arrays/ArrayDeclarationSniff.php index a0f8869..d5d4410 100644 --- a/src/Application/Sniffs/Arrays/ArrayDeclarationSniff.php +++ b/src/Application/Sniffs/Arrays/ArrayDeclarationSniff.php @@ -67,8 +67,8 @@ public function process(File $phpcsFile, $stackPtr) $phpcsFile->recordMetric($stackPtr, 'Short array syntax used', 'no'); // Array keyword should be lower case. - if ($tokens[$stackPtr]['content'] !== strtolower($tokens[$stackPtr]['content'])) { - if ($tokens[$stackPtr]['content'] === strtoupper($tokens[$stackPtr]['content'])) { + if ($tokens[$stackPtr]['content'] !== mb_strtolower($tokens[$stackPtr]['content'])) { + if ($tokens[$stackPtr]['content'] === mb_strtoupper($tokens[$stackPtr]['content'])) { $phpcsFile->recordMetric($stackPtr, 'Array keyword case', 'upper'); } else { $phpcsFile->recordMetric($stackPtr, 'Array keyword case', 'mixed'); @@ -425,19 +425,19 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array if ($i <= 0) { $arrayIndent = 0; } else if ($tokens[$i]['code'] === T_WHITESPACE) { - $arrayIndent = strlen($tokens[$i]['content']); + $arrayIndent = mb_strlen($tokens[$i]['content']); } else if ($tokens[$i]['code'] === T_CONSTANT_ENCAPSED_STRING) { $arrayIndent = 0; } else { $trimmed = ltrim($tokens[$i]['content']); if ($trimmed === '') { if ($tokens[$i]['code'] === T_INLINE_HTML) { - $arrayIndent = strlen($tokens[$i]['content']); + $arrayIndent = mb_strlen($tokens[$i]['content']); } else { $arrayIndent = ($tokens[$i]['column'] - 1); } } else { - $arrayIndent = (strlen($tokens[$i]['content']) - strlen($trimmed)); + $arrayIndent = (mb_strlen($tokens[$i]['content']) - mb_strlen($trimmed)); } } @@ -595,13 +595,13 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array $currentEntry['index'] = $indexStart; $currentEntry['index_end'] = $indexEnd; - $indexLength = strlen($currentEntry['index_content']); + $indexLength = mb_strlen($currentEntry['index_content']); if ($tokens[$indexEnd]['line'] === $tokens[$nextToken]['line']) { if ($maxLength < $indexLength) { $maxLength = $indexLength; } - $arrowDistance = ($tokens[$nextToken]['column'] - (strlen($currentEntry['index_content']) + $tokens[$indexStart]['column'])); + $arrowDistance = ($tokens[$nextToken]['column'] - (mb_strlen($currentEntry['index_content']) + $tokens[$indexStart]['column'])); if ($maxArrowDistance < $arrowDistance) { $maxArrowDistance = $arrowDistance; } @@ -898,12 +898,12 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array if ($arrayShouldBeAligned === true) { $arrowStart = ($indicesStart + $maxLength + 1); } else { - $arrowStart = ((strlen($index['index_content']) + $tokens[$index['index']]['column']) + 1); + $arrowStart = ((mb_strlen($index['index_content']) + $tokens[$index['index']]['column']) + 1); } if ($tokens[$index['arrow']]['column'] !== $arrowStart) { - $expected = ($arrowStart - (strlen($index['index_content']) + $tokens[$index['index']]['column'])); - $found = ($tokens[$index['arrow']]['column'] - (strlen($index['index_content']) + $tokens[$index['index']]['column'])); + $expected = ($arrowStart - (mb_strlen($index['index_content']) + $tokens[$index['index']]['column'])); + $found = ($tokens[$index['arrow']]['column'] - (mb_strlen($index['index_content']) + $tokens[$index['index']]['column'])); $error = 'Array double arrow not aligned correctly; expected %s space(s) but found %s'; $data = array( $expected, diff --git a/src/Application/Sniffs/Classes/StaticSelfSniff.php b/src/Application/Sniffs/Classes/StaticSelfSniff.php index bb775e7..9ca4cfd 100644 --- a/src/Application/Sniffs/Classes/StaticSelfSniff.php +++ b/src/Application/Sniffs/Classes/StaticSelfSniff.php @@ -161,7 +161,7 @@ protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFil }//end if if ($tokens[($stackPtr - 1)]['code'] === T_WHITESPACE) { - $found = strlen($tokens[($stackPtr - 1)]['content']); + $found = mb_strlen($tokens[($stackPtr - 1)]['content']); $error = 'Expected 0 spaces before double colon; %s found'; $data = array($found); $fix = $phpcsFile->addFixableError($error, $calledClassName, 'SpaceBefore', $data); @@ -172,7 +172,7 @@ protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFil } if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) { - $found = strlen($tokens[($stackPtr + 1)]['content']); + $found = mb_strlen($tokens[($stackPtr + 1)]['content']); $error = 'Expected 0 spaces after double colon; %s found'; $data = array($found); $fix = $phpcsFile->addFixableError($error, $calledClassName, 'SpaceAfter', $data); @@ -202,7 +202,7 @@ protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFil } } else if ($tokens[$nextToken]['code'] === T_STRING // Special case for PHP 5.5 class name resolution. - && strtolower($tokens[$nextToken]['content']) !== 'class' + && mb_strtolower($tokens[$nextToken]['content']) !== 'class' ) { // Method call or constant. $openBracket = $phpcsFile->findNext(T_WHITESPACE, ($nextToken + 1), null, true, null, true); @@ -258,7 +258,7 @@ protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFil } if ($tokens[$calledClassName]['code'] !== $expected - || strtolower($declarationName) !== $declarationName + || mb_strtolower($declarationName) !== $declarationName ) { $error = 'Expected "%s::%s" %s; found "%s::%s"'; $data = array( diff --git a/src/Application/Sniffs/ControlStructures/ControlSignatureSniff.php b/src/Application/Sniffs/ControlStructures/ControlSignatureSniff.php index 3dde6b3..02c241e 100644 --- a/src/Application/Sniffs/ControlStructures/ControlSignatureSniff.php +++ b/src/Application/Sniffs/ControlStructures/ControlSignatureSniff.php @@ -102,17 +102,17 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) // Single space after the keyword. if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) { $found = 0; - } else if (strpos($tokens[($stackPtr + 1)]['content'], $phpcsFile->eolChar) !== false) { + } else if (mb_strpos($tokens[($stackPtr + 1)]['content'], $phpcsFile->eolChar) !== false) { $found = 'newline'; } else { - $found = strlen($tokens[($stackPtr + 1)]['content']); + $found = mb_strlen($tokens[($stackPtr + 1)]['content']); } if ($found !== $expectedSpaces) { $error = 'Expected %s space(s) after %s keyword; %s found'; $data = array( $expectedSpaces, - strtoupper($tokens[$stackPtr]['content']), + mb_strtoupper($tokens[$stackPtr]['content']), $found, ); @@ -140,10 +140,10 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) } if (trim($content) === '') { - if (strpos($content, $phpcsFile->eolChar) !== false) { + if (mb_strpos($content, $phpcsFile->eolChar) !== false) { $found = 'newline'; } else { - $found = strlen($content); + $found = mb_strlen($content); } } else { $found = '"'.str_replace($phpcsFile->eolChar, '\n', $content).'"'; @@ -235,10 +235,10 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) $closer = $tokens[$stackPtr]['parenthesis_closer']; $found = 0; if ($tokens[($closer + 1)]['code'] === T_WHITESPACE) { - if (strpos($tokens[($closer + 1)]['content'], $phpcsFile->eolChar) !== false) { + if (mb_strpos($tokens[($closer + 1)]['content'], $phpcsFile->eolChar) !== false) { $found = 'newline'; } else { - $found = strlen($tokens[($closer + 1)]['content']); + $found = mb_strlen($tokens[($closer + 1)]['content']); } } @@ -276,10 +276,10 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) if ($tokens[($closer + 1)]['code'] !== T_WHITESPACE) { $found = 0; } else if ($tokens[($closer + 1)]['content'] !== ' ') { - if (strpos($tokens[($closer + 1)]['content'], $phpcsFile->eolChar) !== false) { + if (mb_strpos($tokens[($closer + 1)]['content'], $phpcsFile->eolChar) !== false) { $found = 'newline'; } else { - $found = strlen($tokens[($closer + 1)]['content']); + $found = mb_strlen($tokens[($closer + 1)]['content']); } } diff --git a/src/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php b/src/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php index 8a58571..dec7b4c 100644 --- a/src/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php +++ b/src/Application/Sniffs/PHP/ForbiddenFunctionsSniff.php @@ -73,7 +73,7 @@ protected function addError($phpcsFile, $stackPtr, $function, $pattern=null) } if ($pattern === null) { - $pattern = strtolower($function); + $pattern = mb_strtolower($function); } $replacement = null; diff --git a/src/Application/Sniffs/PHP/IsNullSniff.php b/src/Application/Sniffs/PHP/IsNullSniff.php index 889b937..cf57338 100644 --- a/src/Application/Sniffs/PHP/IsNullSniff.php +++ b/src/Application/Sniffs/PHP/IsNullSniff.php @@ -102,7 +102,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) return; } - $function = strtolower($tokens[$stackPtr]['content']); + $function = mb_strtolower($tokens[$stackPtr]['content']); if ($function !== 'is_null') { return; diff --git a/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.3.inc b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.3.inc new file mode 100644 index 0000000..8475b9d --- /dev/null +++ b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.3.inc @@ -0,0 +1,6 @@ + [['phoneNumber' => '11234567']], + 'valid landline - phoneNumber | Érd' => [['phoneNumber' => '23361988']], +]; diff --git a/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.3.inc.fixed b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.3.inc.fixed new file mode 100644 index 0000000..8475b9d --- /dev/null +++ b/src/Application/Tests/Arrays/ArrayDeclarationUnitTest.3.inc.fixed @@ -0,0 +1,6 @@ + [['phoneNumber' => '11234567']], + 'valid landline - phoneNumber | Érd' => [['phoneNumber' => '23361988']], +]; From 61929e90edb974f8f71e6da0f679f624fdb0dd37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 2 Sep 2022 19:34:29 +0200 Subject: [PATCH 44/46] rename package --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 31767f5..03ed2c9 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "mito/yii2-coding-standards", + "name": "mito/coding-standards", "description": "Mito coding standards", "keywords": ["codesniffer", "phpcs", "coding standards"], "homepage": "https://mito.hu/", From fa8bfb4aa63b1be885efe6a331acc3f406af031e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 2 Sep 2022 19:34:42 +0200 Subject: [PATCH 45/46] update dependencies --- composer.lock | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index a85c5a0..58b1126 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "60e15bb6ed68f94f402c2ddb3146b060", + "content-hash": "72bb1f4ae038e164c9da6e00c8b369b9", "packages": [ { "name": "squizlabs/php_codesniffer", @@ -64,23 +64,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b5f7b932ee6fa802fc792eabd77c4c88084517ce", + "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" + "php": ">=5.3.3" }, "suggest": { "ext-mbstring": "For best performance" @@ -88,7 +85,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.19-dev" }, "thanks": { "name": "symfony/polyfill", @@ -127,7 +124,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.19.0" }, "funding": [ { @@ -143,7 +140,7 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2020-10-23T09:01:57+00:00" } ], "packages-dev": [ From e7798a7e36a38c40c6378869b1bdd493d21b6bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20P=C3=A9ter?= Date: Fri, 2 Sep 2022 19:34:56 +0200 Subject: [PATCH 46/46] update clover --- docs/clover.svg | 4 +- tests/clover.xml | 925 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 770 insertions(+), 159 deletions(-) diff --git a/docs/clover.svg b/docs/clover.svg index 6764a8d..072682e 100644 --- a/docs/clover.svg +++ b/docs/clover.svg @@ -15,7 +15,7 @@ coverage coverage - 91% - 91% + 93% + 93% \ No newline at end of file diff --git a/tests/clover.xml b/tests/clover.xml index a088769..6882d80 100644 --- a/tests/clover.xml +++ b/tests/clover.xml @@ -1,27 +1,31 @@ - - + + - - + + - + + + + + @@ -32,12 +36,17 @@ + + + + + @@ -50,7 +59,10 @@ + + + @@ -70,11 +82,15 @@ + + + + @@ -103,10 +119,14 @@ + + + + @@ -116,15 +136,20 @@ + + + + + @@ -132,18 +157,25 @@ + + + + + + + @@ -152,14 +184,19 @@ + + + + + @@ -167,11 +204,15 @@ + + + + @@ -181,26 +222,36 @@ + + + + + + + + + + - + @@ -209,20 +260,25 @@ + + + + + @@ -230,27 +286,34 @@ + + + + + + + @@ -258,17 +321,21 @@ + + + + @@ -278,21 +345,26 @@ + + + - + + + @@ -306,6 +378,7 @@ + @@ -313,18 +386,25 @@ + + + - + + + + + @@ -333,15 +413,21 @@ - + + + + + - + + + @@ -349,7 +435,8 @@ - + + @@ -357,14 +444,19 @@ + + + + + @@ -392,6 +484,7 @@ + @@ -399,13 +492,16 @@ + + + - + @@ -413,34 +509,46 @@ + - + + + + + + + + + + + + @@ -448,7 +556,9 @@ + + @@ -457,11 +567,14 @@ + + + @@ -476,10 +589,13 @@ + + + @@ -487,13 +603,17 @@ + + + + @@ -501,15 +621,18 @@ + + + @@ -517,97 +640,112 @@ + + + + + - + - - + + - - - + - - + + + + + + + - + - - - + + + - - - - + + + - - + + + - + + + + + - + + - - + + - - - - - - + + + + + - + - + - - - + + + + - - - + + + - - + + - - - - - + + + + + - + - + + + @@ -616,121 +754,152 @@ - + - + + + - - + + - + + + + - + - + + + - + - + + + - + + + - - - + + + + - - + + + - + + - + + + - + + + - + - - + + + + - + + - + + - + + - + + - - - + + + + + + - + + - - + + - + - - - - + + + + + + + - - + + @@ -743,44 +912,57 @@ - + + + + + + + + + + + + + + @@ -788,12 +970,16 @@ + + + + @@ -801,18 +987,25 @@ + + + + + + - + + @@ -824,21 +1017,29 @@ + + + + + + + + @@ -846,9 +1047,11 @@ + + @@ -856,7 +1059,9 @@ + + @@ -864,13 +1069,16 @@ + + + - + - - + + @@ -878,7 +1086,8 @@ - + + @@ -902,11 +1111,13 @@ + + @@ -914,58 +1125,70 @@ + + + + - + - - + + - + + + + + + + + + - + - - + + - + @@ -979,6 +1202,7 @@ + @@ -986,6 +1210,7 @@ + @@ -1001,6 +1226,7 @@ + @@ -1012,18 +1238,21 @@ + + + - + - - + + @@ -1031,12 +1260,15 @@ + + + @@ -1044,15 +1276,22 @@ + + + + + + + @@ -1062,35 +1301,45 @@ + + + - + + + + + + - + + + @@ -1113,8 +1362,10 @@ + + @@ -1122,17 +1373,20 @@ + + - + + @@ -1141,8 +1395,14 @@ + + + + + + @@ -1150,76 +1410,299 @@ + + + + - + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + + + + + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + + + + + + + + + + + + + + + + + + + + + @@ -1241,68 +1724,182 @@ + - + - - + + + + + + + + - + - - + + + + + - + - - + + + + + + + + + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + @@ -1310,7 +1907,8 @@ - + + @@ -1326,6 +1924,7 @@ + @@ -1339,11 +1938,13 @@ + + @@ -1354,27 +1955,37 @@ + + + + - + - - + + + + + + + + - + - +