diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/LogicalOperatorsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/LogicalOperatorsFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/LongToShorthandOperatorFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/LongToShorthandOperatorFixer.php old mode 100755 new mode 100644 index ca57caa4..fad4c48a --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/LongToShorthandOperatorFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/LongToShorthandOperatorFixer.php @@ -40,7 +40,7 @@ final class LongToShorthandOperatorFixer extends AbstractShortOperatorFixer ]; /** - * @var string[] + * @var list */ private array $operatorTypes; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithBracesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithBracesFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithParenthesesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NewWithParenthesesFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoSpaceAroundDoubleColonFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoSpaceAroundDoubleColonFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoUselessConcatOperatorFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoUselessConcatOperatorFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoUselessNullsafeOperatorFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NoUselessNullsafeOperatorFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NotOperatorWithSpaceFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NotOperatorWithSpaceFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NotOperatorWithSuccessorSpaceFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/NotOperatorWithSuccessorSpaceFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/ObjectOperatorWithoutWhitespaceFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/ObjectOperatorWithoutWhitespaceFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/OperatorLinebreakFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/OperatorLinebreakFixer.php old mode 100755 new mode 100644 index a83717f9..a73a28c4 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/OperatorLinebreakFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/OperatorLinebreakFixer.php @@ -40,7 +40,7 @@ final class OperatorLinebreakFixer extends AbstractFixer implements Configurable private string $position = 'beginning'; /** - * @var list|string> + * @var list */ private array $operators = []; @@ -144,7 +144,7 @@ function foo() { } /** - * @param int[] $operatorIndices + * @param non-empty-list $operatorIndices */ private function fixOperatorLinebreak(Tokens $tokens, array $operatorIndices): void { @@ -176,7 +176,7 @@ function foo() { } /** - * @param int[] $operatorIndices + * @param non-empty-list $operatorIndices */ private function fixMoveToTheBeginning(Tokens $tokens, array $operatorIndices): void { @@ -201,7 +201,7 @@ function foo() { } /** - * @param int[] $operatorIndices + * @param non-empty-list $operatorIndices */ private function fixMoveToTheEnd(Tokens $tokens, array $operatorIndices): void { @@ -226,9 +226,9 @@ function foo() { } /** - * @param int[] $indices + * @param list $indices * - * @return Token[] + * @return list */ private function getReplacementsAndClear(Tokens $tokens, array $indices, int $direction): array { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/StandardizeIncrementFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/StandardizeIncrementFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/StandardizeNotEqualsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/StandardizeNotEqualsFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/TernaryOperatorSpacesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/TernaryOperatorSpacesFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/TernaryToElvisOperatorFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/TernaryToElvisOperatorFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/TernaryToNullCoalescingFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/TernaryToNullCoalescingFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/UnaryOperatorSpacesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Operator/UnaryOperatorSpacesFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/BlankLineAfterOpeningTagFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/BlankLineAfterOpeningTagFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/EchoTagSyntaxFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/EchoTagSyntaxFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/FullOpeningTagFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/FullOpeningTagFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/LinebreakAfterOpeningTagFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/LinebreakAfterOpeningTagFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/NoClosingTagFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpTag/NoClosingTagFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitAttributesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitAttributesFixer.php old mode 100755 new mode 100644 index 474b0d2d..a6246afd --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitAttributesFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitAttributesFixer.php @@ -17,11 +17,13 @@ namespace PhpCsFixer\Fixer\PhpUnit; use PhpCsFixer\DocBlock\Annotation; use PhpCsFixer\DocBlock\DocBlock; use PhpCsFixer\Fixer\AbstractPhpUnitFixer; +use PhpCsFixer\Fixer\AttributeNotation\OrderedAttributesFixer; use PhpCsFixer\FixerDefinition\FixerDefinition; use PhpCsFixer\FixerDefinition\FixerDefinitionInterface; use PhpCsFixer\FixerDefinition\VersionSpecification; use PhpCsFixer\FixerDefinition\VersionSpecificCodeSample; use PhpCsFixer\Preg; +use PhpCsFixer\Tokenizer\Analyzer\AttributeAnalyzer; use PhpCsFixer\Tokenizer\CT; use PhpCsFixer\Tokenizer\Processor\ImportProcessor; use PhpCsFixer\Tokenizer\Token; @@ -120,6 +122,10 @@ final class PhpUnitAttributesFixer extends AbstractPhpUnitFixer /** @phpstan-ignore-next-line */ $tokensToInsert = self::{$this->fixingMap[$annotationName]}($tokens, $index, $annotation); + if (self::isAttributeAlreadyPresent($tokens, $index, $tokensToInsert)) { + continue; + } + if ([] === $tokensToInsert) { continue; } @@ -196,6 +202,52 @@ final class PhpUnitAttributesFixer extends AbstractPhpUnitFixer return true; } + /** + * @param list $tokensToInsert + */ + private static function isAttributeAlreadyPresent(Tokens $tokens, int $index, array $tokensToInsert): bool + { + $attributeIndex = $tokens->getNextMeaningfulToken($index); + if (!$tokens[$attributeIndex]->isGivenKind(T_ATTRIBUTE)) { + return false; + } + + $insertedClassName = ''; + foreach (\array_slice($tokensToInsert, 3) as $token) { + if ($token->equals('(') || $token->isGivenKind(CT::T_ATTRIBUTE_CLOSE)) { + break; + } + $insertedClassName .= $token->getContent(); + } + + // @TODO: refactor OrderedAttributesFixer::determineAttributeFullyQualifiedName to shared analyzer + static $determineAttributeFullyQualifiedName = null; + static $orderedAttributesFixer = null; + if (null === $determineAttributeFullyQualifiedName) { + $orderedAttributesFixer = new OrderedAttributesFixer(); + $reflection = new \ReflectionObject($orderedAttributesFixer); + $determineAttributeFullyQualifiedName = $reflection->getMethod('determineAttributeFullyQualifiedName'); + $determineAttributeFullyQualifiedName->setAccessible(true); + } + + foreach (AttributeAnalyzer::collect($tokens, $attributeIndex) as $attributeAnalysis) { + foreach ($attributeAnalysis->getAttributes() as $attribute) { + $className = ltrim($determineAttributeFullyQualifiedName->invokeArgs( + $orderedAttributesFixer, + [$tokens, + $attribute['name'], + $attribute['start']], + ), '\\'); + + if ($insertedClassName === $className) { + return true; + } + } + } + + return false; + } + /** * @return list */ @@ -210,7 +262,7 @@ final class PhpUnitAttributesFixer extends AbstractPhpUnitFixer private static function fixWithSingleStringValue(Tokens $tokens, int $index, Annotation $annotation): array { Preg::match( - sprintf('/@%s\s+(.*\S)(?:\R|\s*\*+\\/$)/', $annotation->getTag()->getName()), + sprintf('/@%s\s+(.*\S)(?:\R|\s*\*+\/$)/', $annotation->getTag()->getName()), $annotation->getContent(), $matches, ); @@ -375,11 +427,13 @@ final class PhpUnitAttributesFixer extends AbstractPhpUnitFixer new Token([T_WHITESPACE, ' ']), self::createEscapedStringToken($method), ]; + } elseif ('RequiresPhp' === $attributeName && isset($matches[3])) { + $attributeTokens = [self::createEscapedStringToken($matches[2].' '.$matches[3])]; } else { $attributeTokens = [self::createEscapedStringToken($matches[2])]; } - if (isset($matches[3])) { + if (isset($matches[3]) && 'RequiresPhp' !== $attributeName) { $attributeTokens[] = new Token(','); $attributeTokens[] = new Token([T_WHITESPACE, ' ']); $attributeTokens[] = self::createEscapedStringToken($matches[3]); @@ -425,7 +479,7 @@ final class PhpUnitAttributesFixer extends AbstractPhpUnitFixer if (str_starts_with($matches[1], '::')) { $attributeName = 'UsesFunction'; $attributeTokens = [self::createEscapedStringToken(substr($matches[1], 2))]; - } elseif (Preg::match('/^[a-zA-Z\d\\\\]+$/', $matches[1])) { + } elseif (Preg::match('/^[a-zA-Z\d\\\]+$/', $matches[1])) { $attributeName = 'UsesClass'; $attributeTokens = self::toClassConstant($matches[1]); } else { @@ -436,16 +490,18 @@ final class PhpUnitAttributesFixer extends AbstractPhpUnitFixer } /** - * @return array + * @return list */ private static function getMatches(Annotation $annotation): array { Preg::match( - sprintf('/@%s\s+(\S+)(?:\s+(\S+))?(?:\s+(.+\S))?\s*(?:\R|\*+\\/$)/', $annotation->getTag()->getName()), + sprintf('/@%s\s+(\S+)(?:\s+(\S+))?(?:\s+(.+\S))?\s*(?:\R|\*+\/$)/', $annotation->getTag()->getName()), $annotation->getContent(), $matches, ); + \assert(array_is_list($matches)); // preg_match matches is not well typed, it depends on used regex, let's assure the type to instruct SCA + return $matches; } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitConstructFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitConstructFixer.php old mode 100755 new mode 100644 index 58c2c7f6..47211482 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitConstructFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitConstructFixer.php @@ -32,16 +32,6 @@ use PhpCsFixer\Tokenizer\Tokens; */ final class PhpUnitConstructFixer extends AbstractPhpUnitFixer implements ConfigurableFixerInterface { - /** - * @var array - */ - private static array $assertionFixers = [ - 'assertSame' => 'fixAssertPositive', - 'assertEquals' => 'fixAssertPositive', - 'assertNotEquals' => 'fixAssertNegative', - 'assertNotSame' => 'fixAssertNegative', - ]; - public function isRisky(): bool { return true; @@ -93,6 +83,10 @@ final class FooTest extends \PHPUnit_Framework_TestCase { return -8; } + /** + * @uses fixAssertNegative() + * @uses fixAssertPositive() + */ protected function applyPhpUnitClassFix(Tokens $tokens, int $startIndex, int $endIndex): void { // no assertions to be fixed - fast return @@ -101,10 +95,13 @@ final class FooTest extends \PHPUnit_Framework_TestCase { } foreach ($this->configuration['assertions'] as $assertionMethod) { - $assertionFixer = self::$assertionFixers[$assertionMethod]; - for ($index = $startIndex; $index < $endIndex; ++$index) { - $index = $this->{$assertionFixer}($tokens, $index, $assertionMethod); + $index = \call_user_func_array( + \in_array($assertionMethod, ['assertSame', 'assertEquals'], true) + ? [$this, 'fixAssertPositive'] + : [$this, 'fixAssertNegative'], + [$tokens, $index, $assertionMethod] + ); if (null === $index) { break; @@ -115,16 +112,18 @@ final class FooTest extends \PHPUnit_Framework_TestCase { protected function createConfigurationDefinition(): FixerConfigurationResolverInterface { + $assertMethods = [ + 'assertEquals', + 'assertSame', + 'assertNotEquals', + 'assertNotSame', + ]; + return new FixerConfigurationResolver([ (new FixerOptionBuilder('assertions', 'List of assertion methods to fix.')) - ->setAllowedTypes(['array']) - ->setAllowedValues([new AllowedValueSubset(array_keys(self::$assertionFixers))]) - ->setDefault([ - 'assertEquals', - 'assertSame', - 'assertNotEquals', - 'assertNotSame', - ]) + ->setAllowedTypes(['string[]']) + ->setAllowedValues([new AllowedValueSubset($assertMethods)]) + ->setDefault($assertMethods) ->getOption(), ]); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderNameFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderNameFixer.php old mode 100755 new mode 100644 index c42123b8..ae69b579 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderNameFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderNameFixer.php @@ -101,7 +101,17 @@ class FooTest extends TestCase { ); } - public function getConfigurationDefinition(): FixerConfigurationResolverInterface + public function getPriority(): int + { + return 0; + } + + public function isRisky(): bool + { + return true; + } + + protected function createConfigurationDefinition(): FixerConfigurationResolverInterface { return new FixerConfigurationResolver([ (new FixerOptionBuilder('prefix', 'Prefix that replaces "test".')) @@ -115,16 +125,6 @@ class FooTest extends TestCase { ]); } - public function getPriority(): int - { - return 0; - } - - public function isRisky(): bool - { - return true; - } - protected function applyPhpUnitClassFix(Tokens $tokens, int $startIndex, int $endIndex): void { $dataProviderAnalyzer = new DataProviderAnalyzer(); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderReturnTypeFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderReturnTypeFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderStaticFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderStaticFixer.php old mode 100755 new mode 100644 index a2860325..70fb1d5f --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderStaticFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDataProviderStaticFixer.php @@ -117,6 +117,8 @@ class FooTest extends TestCase { continue; } } + + /** @var int $functionIndex */ $functionIndex = $tokens->getPrevTokenOfKind($dataProviderDefinitionIndex->getNameIndex(), [[T_FUNCTION]]); $methodAttributes = $tokensAnalyzer->getMethodAttributes($functionIndex); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDedicateAssertFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDedicateAssertFixer.php old mode 100755 new mode 100644 index ed599f5f..c65dd239 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDedicateAssertFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDedicateAssertFixer.php @@ -34,7 +34,7 @@ use PhpCsFixer\Tokenizer\Tokens; final class PhpUnitDedicateAssertFixer extends AbstractPhpUnitFixer implements ConfigurableFixerInterface { /** - * @var array|true> + * @var array */ private static array $fixMap = [ 'array_key_exists' => [ @@ -109,7 +109,7 @@ final class PhpUnitDedicateAssertFixer extends AbstractPhpUnitFixer implements C ]; /** - * @var string[] + * @var list */ private array $functions = []; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDedicateAssertInternalTypeFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitDedicateAssertInternalTypeFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitExpectationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitExpectationFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitFqcnAnnotationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitFqcnAnnotationFixer.php old mode 100755 new mode 100644 index 65ae1ada..46bb9a7d --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitFqcnAnnotationFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitFqcnAnnotationFixer.php @@ -77,7 +77,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase if ($tokens[$index]->isGivenKind(T_DOC_COMMENT)) { $tokens[$index] = new Token([T_DOC_COMMENT, Preg::replace( '~^(\s*\*\s*@(?:expectedException|covers|coversDefaultClass|uses)\h+)(?!(?:self|static)::)(\w.*)$~m', - '$1\\\\$2', + '$1\\\$2', $tokens[$index]->getContent() )]); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php old mode 100755 new mode 100644 index a156ea40..40f34838 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php @@ -63,7 +63,7 @@ final class PhpUnitInternalClassFixer extends AbstractPhpUnitFixer implements Wh return new FixerConfigurationResolver([ (new FixerOptionBuilder('types', 'What types of classes to mark as internal.')) ->setAllowedValues([new AllowedValueSubset($types)]) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setDefault(['normal', 'final']) ->getOption(), ]); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitMethodCasingFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitMethodCasingFixer.php old mode 100755 new mode 100644 index 04a3e5f7..c742c2d1 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitMethodCasingFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitMethodCasingFixer.php @@ -52,7 +52,7 @@ final class PhpUnitMethodCasingFixer extends AbstractPhpUnitFixer implements Con [ new CodeSample( 'configuration['group'], self::SIZES, - [], + [ + 'phpunit\framework\attributes\small', + 'phpunit\framework\attributes\medium', + 'phpunit\framework\attributes\large', + ], ); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitStrictFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitStrictFixer.php old mode 100755 new mode 100644 index 5d3d565f..75efba02 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitStrictFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitStrictFixer.php @@ -127,7 +127,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase { return new FixerConfigurationResolver([ (new FixerOptionBuilder('assertions', 'List of assertion methods to fix.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setAllowedValues([new AllowedValueSubset(array_keys(self::$assertionMap))]) ->setDefault([ 'assertAttributeEquals', diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTargetVersion.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTargetVersion.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestAnnotationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestAnnotationFixer.php old mode 100755 new mode 100644 index 3ae0ca06..455d512b --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestAnnotationFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestAnnotationFixer.php @@ -47,14 +47,14 @@ final class PhpUnitTestAnnotationFixer extends AbstractPhpUnitFixer implements C 'Adds or removes @test annotations from tests, following configuration.', [ new CodeSample('whitespacesConfig->getLineEnding()), new CodeSample('whitespacesConfig->getLineEnding(), ['style' => 'annotation']), ], @@ -278,9 +278,9 @@ public function testItDoesSomething() {}}'.$this->whitespacesConfig->getLineEndi /** * Take a one line doc block, and turn it into a multi line doc block. * - * @param Line[] $lines + * @param non-empty-list $lines * - * @return Line[] + * @return list */ private function splitUpDocBlock(array $lines, Tokens $tokens, int $docBlockIndex): array { @@ -298,7 +298,7 @@ public function testItDoesSomething() {}}'.$this->whitespacesConfig->getLineEndi /** * @todo check whether it's doable to use \PhpCsFixer\DocBlock\DocBlock::getSingleLineDocBlockEntry instead * - * @param Line[] $lines + * @param non-empty-list $lines */ private function getSingleLineDocBlockEntry(array $lines): string { @@ -377,9 +377,9 @@ public function testItDoesSomething() {}}'.$this->whitespacesConfig->getLineEndi } /** - * @param Line[] $lines + * @param list $lines * - * @return Line[] + * @return list */ private function addTestAnnotation(array $lines, Tokens $tokens, int $docBlockIndex): array { @@ -389,7 +389,8 @@ public function testItDoesSomething() {}}'.$this->whitespacesConfig->getLineEndi $originalIndent = WhitespacesAnalyzer::detectIndent($tokens, $docBlockIndex); $lineEnd = $this->whitespacesConfig->getLineEnding(); - array_splice($lines, -1, 0, $originalIndent.' *'.$lineEnd.$originalIndent.' * @test'.$lineEnd); + array_splice($lines, -1, 0, [new Line($originalIndent.' *'.$lineEnd.$originalIndent.' * @test'.$lineEnd)]); + \assert(array_is_list($lines)); // we know it's list, but we need to tell PHPStan } return $lines; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixer.php old mode 100755 new mode 100644 index 20537717..534cfc65 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestCaseStaticMethodCallsFixer.php @@ -315,7 +315,7 @@ final class PhpUnitTestCaseStaticMethodCallsFixer extends AbstractPhpUnitFixer i ]; /** - * @var array>> + * @var array> */ private array $conversionMap = [ self::CALL_TYPE_THIS => [[T_OBJECT_OPERATOR, '->'], [T_VARIABLE, '$this']], @@ -372,7 +372,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase ->setDefault('static') ->getOption(), (new FixerOptionBuilder('methods', 'Dictionary of `method` => `call_type` values that differ from the default strategy.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setAllowedValues([static function (array $option): bool { foreach ($option as $method => $value) { if (!isset(self::STATIC_METHODS[$method])) { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestClassRequiresCoversFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestClassRequiresCoversFixer.php old mode 100755 new mode 100644 index d2f2929b..b95abb75 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestClassRequiresCoversFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/PhpUnit/PhpUnitTestClassRequiresCoversFixer.php @@ -78,8 +78,8 @@ final class MyTest extends \PHPUnit_Framework_TestCase 'coversNothing', ], [ - 'phpunit\\framework\\attributes\\coversclass', - 'phpunit\\framework\\attributes\\coversnothing', + 'phpunit\framework\attributes\coversclass', + 'phpunit\framework\attributes\coversnothing', ], ); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php old mode 100755 new mode 100644 index 60c27d10..eb6b3158 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php @@ -34,7 +34,7 @@ use PhpCsFixer\Tokenizer\Tokens; final class AlignMultilineCommentFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface { /** - * @var null|int[] + * @var null|list */ private $tokenKinds; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php old mode 100755 new mode 100644 index b2282e86..03245f22 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php @@ -127,7 +127,7 @@ function foo() {} { return new FixerConfigurationResolver([ (new FixerOptionBuilder('annotations', 'List of annotations to remove, e.g. `["author"]`.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setDefault([]) ->getOption(), (new FixerOptionBuilder('case_sensitive', 'Should annotations be case sensitive.')) diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php old mode 100755 new mode 100644 index 7f68db60..efe9da1c --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/GeneralPhpdocTagRenameFixer.php @@ -91,7 +91,7 @@ final class GeneralPhpdocTagRenameFixer extends AbstractFixer implements Configu ->setDefault(true) ->getOption(), (new FixerOptionBuilder('replacements', 'A map of tags to replace.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setNormalizer(static function (Options $options, array $value): array { $normalizedValue = []; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoBlankLinesAfterPhpdocFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoEmptyPhpdocFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php old mode 100755 new mode 100644 index 90cf1ad6..e98ffe61 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php @@ -467,6 +467,8 @@ class Foo { if (true === $this->configuration['allow_hidden_params']) { $paramsString = $tokens->generatePartialCode($start, $end); Preg::matchAll('|/\*[^$]*(\$\w+)[^*]*\*/|', $paramsString, $matches); + + /** @var non-empty-string $match */ foreach ($matches[1] as $match) { $argumentsInfo[$match] = self::NO_TYPE_INFO; // HINT: one could try to extract actual type for hidden param, for now we only indicate it's existence } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocAddMissingParamAnnotationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocAddMissingParamAnnotationFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocAlignFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocAlignFixer.php old mode 100755 new mode 100644 index bc6a9597..0c30e6da --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocAlignFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocAlignFixer.php @@ -230,7 +230,7 @@ final class PhpdocAlignFixer extends AbstractFixer implements ConfigurableFixerI 'The tags that should be aligned. Allowed values are tags with name (`\''.implode('\', \'', self::TAGS_WITH_NAME).'\'`), tags with method signature (`\''.implode('\', \'', self::TAGS_WITH_METHOD_SIGNATURE).'\'`) and any custom tag with description (e.g. `@tag `).' ); $tags - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setDefault(self::DEFAULT_TAGS) ; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocAnnotationWithoutDotFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocAnnotationWithoutDotFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocArrayTypeFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocArrayTypeFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocIndentFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocIndentFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocInlineTagNormalizerFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocInlineTagNormalizerFixer.php old mode 100755 new mode 100644 index 668dd843..a6270fde --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocInlineTagNormalizerFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocInlineTagNormalizerFixer.php @@ -99,7 +99,7 @@ final class PhpdocInlineTagNormalizerFixer extends AbstractFixer implements Conf { return new FixerConfigurationResolver([ (new FixerOptionBuilder('tags', 'The list of tags to normalize.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setDefault(['example', 'id', 'internal', 'inheritdoc', 'inheritdocs', 'link', 'source', 'toc', 'tutorial']) ->getOption(), ]); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocLineSpanFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocLineSpanFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocListTypeFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocListTypeFixer.php old mode 100755 new mode 100644 index cfd56af1..9d2cdff9 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocListTypeFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocListTypeFixer.php @@ -65,6 +65,6 @@ final class PhpdocListTypeFixer extends AbstractPhpdocTypesFixer protected function normalize(string $type): string { - return Preg::replace('/array(?=<(?:[^,<]|<[^>]+>)+(>|{|\\())/i', 'list', $type); + return Preg::replace('/array(?=<(?:[^,<]|<[^>]+>)+(>|{|\())/i', 'list', $type); } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoAccessFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoAccessFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php old mode 100755 new mode 100644 index 5bd71385..48699f55 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoAliasTagFixer.php @@ -108,7 +108,7 @@ final class Example { return new FixerConfigurationResolver([ (new FixerOptionBuilder('replacements', 'Mapping between replaced annotations with new ones.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setDefault([ 'property-read' => 'property', 'property-write' => 'property', diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoEmptyReturnFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoPackageFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoPackageFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoUselessInheritdocFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocNoUselessInheritdocFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php old mode 100755 new mode 100644 index 7b8568c5..be879093 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocOrderByValueFixer.php @@ -188,9 +188,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase return new FixerConfigurationResolver([ (new FixerOptionBuilder('annotations', 'List of annotations to order, e.g. `["covers"]`.')) - ->setAllowedTypes([ - 'array', - ]) + ->setAllowedTypes(['string[]']) ->setAllowedValues([ new AllowedValueSubset($allowedValues), ]) diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocOrderFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocOrderFixer.php old mode 100755 new mode 100644 index 7764e9af..d858f535 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocOrderFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocOrderFixer.php @@ -102,6 +102,9 @@ final class PhpdocOrderFixer extends AbstractFixer implements ConfigurableFixerI protected function applyFix(\SplFileInfo $file, Tokens $tokens): void { + /** @var list */ + $order = $this->configuration['order']; + foreach ($tokens as $index => $token) { if (!$token->isGivenKind(T_DOC_COMMENT)) { continue; @@ -111,7 +114,7 @@ final class PhpdocOrderFixer extends AbstractFixer implements ConfigurableFixerI $content = $token->getContent(); // sort annotations - $successors = $this->configuration['order']; + $successors = $order; while (\count($successors) >= 3) { $predecessor = array_shift($successors); $content = $this->moveAnnotationsBefore($predecessor, $successors, $content); @@ -119,7 +122,7 @@ final class PhpdocOrderFixer extends AbstractFixer implements ConfigurableFixerI // we're parsing the content last time to make sure the internal // state of the docblock is correct after the modifications - $predecessors = $this->configuration['order']; + $predecessors = $order; $last = array_pop($predecessors); $content = $this->moveAnnotationsAfter($last, $predecessors, $content); @@ -131,8 +134,8 @@ final class PhpdocOrderFixer extends AbstractFixer implements ConfigurableFixerI /** * Move all given annotations in before given set of annotations. * - * @param string $move Tag of annotations that should be moved - * @param string[] $before Tags of annotations that should moved annotations be placed before + * @param string $move Tag of annotations that should be moved + * @param list $before Tags of annotations that should moved annotations be placed before */ private function moveAnnotationsBefore(string $move, array $before, string $content): string { @@ -170,8 +173,8 @@ final class PhpdocOrderFixer extends AbstractFixer implements ConfigurableFixerI /** * Move all given annotations after given set of annotations. * - * @param string $move Tag of annotations that should be moved - * @param string[] $after Tags of annotations that should moved annotations be placed after + * @param string $move Tag of annotations that should be moved + * @param list $after Tags of annotations that should moved annotations be placed after */ private function moveAnnotationsAfter(string $move, array $after, string $content): string { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocParamOrderFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocParamOrderFixer.php old mode 100755 new mode 100644 index afe587e6..dbed46eb --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocParamOrderFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocParamOrderFixer.php @@ -103,7 +103,7 @@ function m($a, array $b, Foo $c) {} } /** - * @return Token[] + * @return list */ private function getFunctionParamNames(Tokens $tokens, int $paramBlockStart): array { @@ -124,8 +124,8 @@ function m($a, array $b, Foo $c) {} /** * Overwrite the param annotations in order. * - * @param Token[] $paramNames - * @param Annotation[] $paramAnnotations + * @param list $paramNames + * @param list $paramAnnotations */ private function rewriteDocBlock(DocBlock $doc, array $paramNames, array $paramAnnotations): DocBlock { @@ -161,8 +161,8 @@ function m($a, array $b, Foo $c) {} /** * Sort the param annotations according to the function parameters. * - * @param Token[] $funcParamNames - * @param Annotation[] $paramAnnotations + * @param list $funcParamNames + * @param list $paramAnnotations * * @return list */ @@ -181,9 +181,10 @@ function m($a, array $b, Foo $c) {} } // Detect superfluous annotations - /** @var Annotation[] $invalidParams */ - $invalidParams = array_diff_key($paramAnnotations, $validParams); - $invalidParams = array_values($invalidParams); + /** @var list $invalidParams */ + $invalidParams = array_values( + array_diff_key($paramAnnotations, $validParams) + ); // Append invalid parameters to the (ordered) valid ones $orderedParams = array_values($validParams); @@ -197,7 +198,7 @@ function m($a, array $b, Foo $c) {} /** * Fetch all annotations except the param ones. * - * @param Annotation[] $paramAnnotations + * @param list $paramAnnotations * * @return list */ @@ -227,7 +228,7 @@ function m($a, array $b, Foo $c) {} /** * Return the indices of the lines of a specific parameter annotation. * - * @param Annotation[] $paramAnnotations + * @param list $paramAnnotations * * @return ?list */ diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixer.php old mode 100755 new mode 100644 index f672e1ee..3c204954 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixer.php @@ -33,7 +33,7 @@ use Symfony\Component\OptionsResolver\Options; final class PhpdocReturnSelfReferenceFixer extends AbstractFixer implements ConfigurableFixerInterface { /** - * @var string[] + * @var list */ private static array $toTypes = [ '$this', @@ -135,7 +135,7 @@ class Sample return new FixerConfigurationResolver([ (new FixerOptionBuilder('replacements', 'Mapping between replaced return types with new ones.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setNormalizer(static function (Options $options, array $value) use ($default): array { $normalizedValue = []; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocScalarFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocScalarFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocSeparationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocSeparationFixer.php old mode 100755 new mode 100644 index 3fade23f..197bab67 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocSeparationFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocSeparationFixer.php @@ -38,7 +38,7 @@ final class PhpdocSeparationFixer extends AbstractFixer implements ConfigurableF /** * @internal * - * @var string[][] + * @var list> */ public const OPTION_GROUPS_DEFAULT = [ ['author', 'copyright', 'license'], @@ -48,7 +48,7 @@ final class PhpdocSeparationFixer extends AbstractFixer implements ConfigurableF ]; /** - * @var string[][] + * @var list> */ private array $groups; @@ -295,7 +295,7 @@ final class PhpdocSeparationFixer extends AbstractFixer implements ConfigurableF private function tagName(Annotation $annotation): ?string { - Preg::match('/@([a-zA-Z0-9_\\\\-]+(?=\s|$|\())/', $annotation->getContent(), $matches); + Preg::match('/@([a-zA-Z0-9_\\\-]+(?=\s|$|\())/', $annotation->getContent(), $matches); return $matches[1] ?? null; } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocSingleLineVarSpacingFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocSingleLineVarSpacingFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocSummaryFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocSummaryFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php old mode 100755 new mode 100644 index cdeb5315..a2a29e01 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTagCasingFixer.php @@ -84,7 +84,7 @@ final class PhpdocTagCasingFixer extends AbstractProxyFixer implements Configura { return new FixerConfigurationResolver([ (new FixerOptionBuilder('tags', 'List of tags to fix with their expected casing.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setDefault(['inheritDoc']) ->getOption(), ]); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTagTypeFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTagTypeFixer.php old mode 100755 new mode 100644 index 274db397..54b6e2ae --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTagTypeFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTagTypeFixer.php @@ -135,7 +135,7 @@ final class PhpdocTagTypeFixer extends AbstractFixer implements ConfigurableFixe { return new FixerConfigurationResolver([ (new FixerOptionBuilder('tags', 'The list of tags to fix.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setAllowedValues([static function (array $value): bool { foreach ($value as $type) { if (!\in_array($type, ['annotation', 'inline'], true)) { @@ -182,7 +182,7 @@ final class PhpdocTagTypeFixer extends AbstractFixer implements ConfigurableFixe } /** - * @param list $parts + * @param array $parts */ private function tagIsSurroundedByText(array $parts, int $index): bool { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocToCommentFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocToCommentFixer.php old mode 100755 new mode 100644 index 8f2ea442..389f8d5d --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocToCommentFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocToCommentFixer.php @@ -127,7 +127,7 @@ function returnClassName() { { return new FixerConfigurationResolver([ (new FixerOptionBuilder('ignored_tags', 'List of ignored tags (matched case insensitively).')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setDefault([]) ->getOption(), (new FixerOptionBuilder('allow_before_return_statement', 'Whether to allow PHPDoc before return statement.')) @@ -158,7 +158,7 @@ function returnClassName() { continue; } - if (0 < Preg::matchAll('~\@([a-zA-Z0-9_\\\\-]+)\b~', $token->getContent(), $matches)) { + if (0 < Preg::matchAll('~\@([a-zA-Z0-9_\\\-]+)\b~', $token->getContent(), $matches)) { foreach ($matches[1] as $match) { if (\in_array(strtolower($match), $this->ignoredTags, true)) { continue 2; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php old mode 100755 new mode 100644 index e50d7c12..6b107af1 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTrimConsecutiveBlankLineSeparationFixer.php @@ -165,13 +165,16 @@ function fnc($foo) {} private function findFirstAnnotationOrEnd(DocBlock $doc): int { - $index = null; foreach ($doc->getLines() as $index => $line) { if ($line->containsATag()) { return $index; } } + if (!isset($index)) { + throw new \LogicException('PHPDoc has empty lines collection.'); + } + return $index; // no Annotation, return the last line } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTrimFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTrimFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTypesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTypesFixer.php old mode 100755 new mode 100644 index e5b02477..a1dba965 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTypesFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTypesFixer.php @@ -148,7 +148,7 @@ final class PhpdocTypesFixer extends AbstractPhpdocTypesFixer implements Configu return new FixerConfigurationResolver([ (new FixerOptionBuilder('groups', 'Type groups to fix.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setAllowedValues([new AllowedValueSubset($possibleGroups)]) ->setDefault($possibleGroups) ->getOption(), diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocVarAnnotationCorrectOrderFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocVarAnnotationCorrectOrderFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocVarWithoutNameFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/PhpdocVarWithoutNameFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/NoUselessReturnFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/NoUselessReturnFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/ReturnAssignmentFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/ReturnAssignmentFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/SimplifiedNullReturnFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/SimplifiedNullReturnFixer.php old mode 100755 new mode 100644 index b745b212..38d13393 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/SimplifiedNullReturnFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/ReturnNotation/SimplifiedNullReturnFixer.php @@ -79,7 +79,7 @@ final class SimplifiedNullReturnFixer extends AbstractFixer */ private function clear(Tokens $tokens, int $index): void { - while (!$tokens[++$index]->equals(';')) { + while (!$tokens[++$index]->equalsAny([';', [T_CLOSE_TAG]])) { if ($this->shouldClearToken($tokens, $index)) { $tokens->clearAt($index); } @@ -96,13 +96,16 @@ final class SimplifiedNullReturnFixer extends AbstractFixer } $content = ''; - while (!$tokens[$index]->equals(';')) { + while (!$tokens[$index]->equalsAny([';', [T_CLOSE_TAG]])) { $index = $tokens->getNextMeaningfulToken($index); $content .= $tokens[$index]->getContent(); } + $lastTokenContent = $tokens[$index]->getContent(); + $content = substr($content, 0, -\strlen($lastTokenContent)); + $content = ltrim($content, '('); - $content = rtrim($content, ');'); + $content = rtrim($content, ')'); return 'null' === strtolower($content); } @@ -137,13 +140,32 @@ final class SimplifiedNullReturnFixer extends AbstractFixer /** * Should we clear the specific token? * - * If the token is a comment, or is whitespace that is immediately before a - * comment, then we'll leave it alone. + * We'll leave it alone if + * - token is a comment + * - token is whitespace that is immediately before a comment + * - token is whitespace that is immediately before the PHP close tag + * - token is whitespace that is immediately after a comment and before a semicolon */ private function shouldClearToken(Tokens $tokens, int $index): bool { $token = $tokens[$index]; - return !$token->isComment() && !($token->isWhitespace() && $tokens[$index + 1]->isComment()); + if ($token->isComment()) { + return false; + } + + if (!$token->isWhitespace()) { + return true; + } + + if ( + $tokens[$index + 1]->isComment() + || $tokens[$index + 1]->equals([T_CLOSE_TAG]) + || ($tokens[$index - 1]->isComment() && $tokens[$index + 1]->equals(';')) + ) { + return false; + } + + return true; } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/NoEmptyStatementFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/NoEmptyStatementFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/NoSinglelineWhitespaceBeforeSemicolonsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/NoSinglelineWhitespaceBeforeSemicolonsFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/SemicolonAfterInstructionFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/SemicolonAfterInstructionFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/SpaceAfterSemicolonFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Semicolon/SpaceAfterSemicolonFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Strict/DeclareStrictTypesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Strict/DeclareStrictTypesFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Strict/StrictComparisonFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Strict/StrictComparisonFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Strict/StrictParamFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Strict/StrictParamFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/EscapeImplicitBackslashesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/EscapeImplicitBackslashesFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/ExplicitStringVariableFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/ExplicitStringVariableFixer.php old mode 100755 new mode 100644 index 5194a72e..1671940c --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/ExplicitStringVariableFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/ExplicitStringVariableFixer.php @@ -42,8 +42,8 @@ final class ExplicitStringVariableFixer extends AbstractFixer )], 'The reasoning behind this rule is the following:' ."\n".'- When there are two valid ways of doing the same thing, using both is confusing, there should be a coding standard to follow.' - ."\n".'- PHP manual marks `"$var"` syntax as implicit and `"${var}"` syntax as explicit: explicit code should always be preferred.' - ."\n".'- Explicit syntax allows word concatenation inside strings, e.g. `"${var}IsAVar"`, implicit doesn\'t.' + ."\n".'- PHP manual marks `"$var"` syntax as implicit and `"{$var}"` syntax as explicit: explicit code should always be preferred.' + ."\n".'- Explicit syntax allows word concatenation inside strings, e.g. `"{$var}IsAVar"`, implicit doesn\'t.' ."\n".'- Explicit syntax is easier to detect for IDE/editors and therefore has colors/highlight with higher contrast, which is easier to read.' ."\n".'Backtick operator is skipped because it is harder to handle; you can use `backtick_to_shell_exec` fixer to normalize backticks to strings.' ); diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/HeredocClosingMarkerFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/HeredocClosingMarkerFixer.php old mode 100755 new mode 100644 index a4245c9f..75dee21e --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/HeredocClosingMarkerFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/HeredocClosingMarkerFixer.php @@ -104,7 +104,7 @@ final class HeredocClosingMarkerFixer extends AbstractFixer implements Configura 'reserved_closing_markers', 'Reserved closing markers to be kept unchanged.' )) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setDefault(self::RESERVED_CLOSING_MARKERS) ->getOption(), (new FixerOptionBuilder( diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/HeredocToNowdocFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/HeredocToNowdocFixer.php old mode 100755 new mode 100644 index 800c79db..9c736c14 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/HeredocToNowdocFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/HeredocToNowdocFixer.php @@ -81,12 +81,12 @@ final class HeredocToNowdocFixer extends AbstractFixer $content = $tokens[$index + 1]->getContent(); // regex: odd number of backslashes, not followed by dollar - if (Preg::match('/(?convertToNowdoc($token); - $content = str_replace(['\\\\', '\\$'], ['\\', '$'], $content); + $content = str_replace(['\\\\', '\$'], ['\\', '$'], $content); $tokens[$index + 1] = new Token([ $tokens[$index + 1]->getId(), $content, diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/MultilineStringToHeredocFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/MultilineStringToHeredocFixer.php old mode 100755 new mode 100644 index 841a68fa..1a6790e6 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/MultilineStringToHeredocFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/MultilineStringToHeredocFixer.php @@ -108,9 +108,9 @@ final class MultilineStringToHeredocFixer extends AbstractFixer $content = substr($content, 1, -1); if ($isSingleQuoted) { - $content = Preg::replace('~\\\\([\\\\\'])~', '$1', $content); + $content = Preg::replace('~\\\([\\\\\'])~', '$1', $content); } else { - $content = Preg::replace('~(\\\\\\\\)|\\\\(")~', '$1$2', $content); + $content = Preg::replace('~(\\\\\\\)|\\\(")~', '$1$2', $content); } $constantStringToken = new Token([T_ENCAPSED_AND_WHITESPACE, $content."\n"]); @@ -143,7 +143,7 @@ final class MultilineStringToHeredocFixer extends AbstractFixer if ($tokens[$i]->isGivenKind(T_ENCAPSED_AND_WHITESPACE)) { $tokens[$i] = new Token([ $tokens[$i]->getId(), - Preg::replace('~(\\\\\\\\)|\\\\(")~', '$1$2', $tokens[$i]->getContent()), + Preg::replace('~(\\\\\\\)|\\\(")~', '$1$2', $tokens[$i]->getContent()), ]); } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/NoBinaryStringFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/NoBinaryStringFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/NoTrailingWhitespaceInStringFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/NoTrailingWhitespaceInStringFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/SimpleToComplexStringVariableFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/SimpleToComplexStringVariableFixer.php old mode 100755 new mode 100644 index 75891ac0..efb139ca --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/SimpleToComplexStringVariableFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/SimpleToComplexStringVariableFixer.php @@ -94,8 +94,8 @@ final class SimpleToComplexStringVariableFixer extends AbstractFixer $tokenOfStringBeforeToken = $tokens[$index - 1]; $stringContent = $tokenOfStringBeforeToken->getContent(); - if (str_ends_with($stringContent, '$') && !str_ends_with($stringContent, '\\$')) { - $newContent = substr($stringContent, 0, -1).'\\$'; + if (str_ends_with($stringContent, '$') && !str_ends_with($stringContent, '\$')) { + $newContent = substr($stringContent, 0, -1).'\$'; $tokenOfStringBeforeToken = new Token([T_ENCAPSED_AND_WHITESPACE, $newContent]); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/SingleQuoteFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/SingleQuoteFixer.php old mode 100755 new mode 100644 index a56c6b4e..10698a69 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/SingleQuoteFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/StringNotation/SingleQuoteFixer.php @@ -88,10 +88,10 @@ final class SingleQuoteFixer extends AbstractFixer implements ConfigurableFixerI '"' === $content[0] && (true === $this->configuration['strings_containing_single_quote_chars'] || !str_contains($content, "'")) // regex: odd number of backslashes, not followed by double quote or dollar - && !Preg::match('/(?setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setAllowedValues([new AllowedValueSubset(array_keys(self::$tokenMap))]) ->setDefault([ 'break', diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/BlankLineBetweenImportGroupsFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/BlankLineBetweenImportGroupsFixer.php old mode 100755 new mode 100644 index 1976aefb..7bd48ca6 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/BlankLineBetweenImportGroupsFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/BlankLineBetweenImportGroupsFixer.php @@ -111,7 +111,7 @@ use Bar; } /** - * @param int[] $uses + * @param list $uses */ private function walkOverUses(Tokens $tokens, array $uses): void { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypeDeclarationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypeDeclarationFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypehintFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/CompactNullableTypehintFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/HeredocIndentationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/HeredocIndentationFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/IndentationTypeFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/IndentationTypeFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/LineEndingFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/LineEndingFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/MethodChainingIndentationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/MethodChainingIndentationFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoExtraBlankLinesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoExtraBlankLinesFixer.php old mode 100755 new mode 100644 index f01db92b..2389238d --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoExtraBlankLinesFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoExtraBlankLinesFixer.php @@ -38,7 +38,7 @@ use PhpCsFixer\Utils; final class NoExtraBlankLinesFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface { /** - * @var string[] + * @var list */ private static array $availableTokens = [ 'attribute', @@ -58,12 +58,12 @@ final class NoExtraBlankLinesFixer extends AbstractFixer implements Configurable ]; /** - * @var array key is token id, value is name of callback + * @var array key is token id */ private array $tokenKindCallbackMap; /** - * @var array token prototype, value is name of callback + * @var array key is token's content */ private array $tokenEqualsMap; @@ -84,26 +84,27 @@ final class NoExtraBlankLinesFixer extends AbstractFixer implements Configurable $this->tokenEqualsMap = []; if (\in_array('curly_brace_block', $tokensConfiguration, true)) { - $this->tokenEqualsMap['{'] = 'fixStructureOpenCloseIfMultiLine'; // i.e. not: CT::T_ARRAY_INDEX_CURLY_BRACE_OPEN + $this->tokenEqualsMap['{'] = [$this, 'fixStructureOpenCloseIfMultiLine']; // i.e. not: CT::T_ARRAY_INDEX_CURLY_BRACE_OPEN } if (\in_array('parenthesis_brace_block', $tokensConfiguration, true)) { - $this->tokenEqualsMap['('] = 'fixStructureOpenCloseIfMultiLine'; // i.e. not: CT::T_BRACE_CLASS_INSTANTIATION_OPEN + $this->tokenEqualsMap['('] = [$this, 'fixStructureOpenCloseIfMultiLine']; // i.e. not: CT::T_BRACE_CLASS_INSTANTIATION_OPEN } - static $configMap = [ - 'attribute' => [CT::T_ATTRIBUTE_CLOSE, 'fixAfterToken'], - 'break' => [T_BREAK, 'fixAfterToken'], - 'case' => [T_CASE, 'fixAfterCaseToken'], - 'continue' => [T_CONTINUE, 'fixAfterToken'], - 'default' => [T_DEFAULT, 'fixAfterToken'], - 'extra' => [T_WHITESPACE, 'removeMultipleBlankLines'], - 'return' => [T_RETURN, 'fixAfterToken'], - 'square_brace_block' => [CT::T_ARRAY_SQUARE_BRACE_OPEN, 'fixStructureOpenCloseIfMultiLine'], - 'switch' => [T_SWITCH, 'fixAfterToken'], - 'throw' => [T_THROW, 'fixAfterThrowToken'], - 'use' => [T_USE, 'removeBetweenUse'], - 'use_trait' => [CT::T_USE_TRAIT, 'removeBetweenUse'], + // Each item requires explicit array-like callable, otherwise PHPStan will complain about unused private methods. + $configMap = [ + 'attribute' => [CT::T_ATTRIBUTE_CLOSE, [$this, 'fixAfterToken']], + 'break' => [T_BREAK, [$this, 'fixAfterToken']], + 'case' => [T_CASE, [$this, 'fixAfterCaseToken']], + 'continue' => [T_CONTINUE, [$this, 'fixAfterToken']], + 'default' => [T_DEFAULT, [$this, 'fixAfterToken']], + 'extra' => [T_WHITESPACE, [$this, 'removeMultipleBlankLines']], + 'return' => [T_RETURN, [$this, 'fixAfterToken']], + 'square_brace_block' => [CT::T_ARRAY_SQUARE_BRACE_OPEN, [$this, 'fixStructureOpenCloseIfMultiLine']], + 'switch' => [T_SWITCH, [$this, 'fixAfterToken']], + 'throw' => [T_THROW, [$this, 'fixAfterThrowToken']], + 'use' => [T_USE, [$this, 'removeBetweenUse']], + 'use_trait' => [CT::T_USE_TRAIT, [$this, 'removeBetweenUse']], ]; $this->tokenKindCallbackMap = []; @@ -282,13 +283,21 @@ switch($a) { { return new FixerConfigurationResolver([ (new FixerOptionBuilder('tokens', 'List of tokens to fix.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setAllowedValues([new AllowedValueSubset(self::$availableTokens)]) ->setDefault(['extra']) ->getOption(), ]); } + /** + * @uses fixAfterToken() + * @uses fixAfterCaseToken() + * @uses fixAfterThrowToken() + * @uses fixStructureOpenCloseIfMultiLine() + * @uses removeBetweenUse() + * @uses removeMultipleBlankLines() + */ private function fixByToken(Token $token, int $index): void { foreach ($this->tokenKindCallbackMap as $kind => $callback) { @@ -296,7 +305,7 @@ switch($a) { continue; } - $this->{$callback}($index); + \call_user_func_array($this->tokenKindCallbackMap[$token->getId()], [$index]); return; } @@ -306,7 +315,7 @@ switch($a) { continue; } - $this->{$callback}($index); + \call_user_func_array($this->tokenEqualsMap[$token->getContent()], [$index]); return; } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesAroundOffsetFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesAroundOffsetFixer.php old mode 100755 new mode 100644 index b3a0849f..3b1b239f --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesAroundOffsetFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesAroundOffsetFixer.php @@ -90,7 +90,7 @@ final class NoSpacesAroundOffsetFixer extends AbstractFixer implements Configura return new FixerConfigurationResolver([ (new FixerOptionBuilder('positions', 'Whether spacing should be fixed inside and/or outside the offset braces.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setAllowedValues([new AllowedValueSubset($values)]) ->setDefault($values) ->getOption(), diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesInsideParenthesisFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoSpacesInsideParenthesisFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoTrailingWhitespaceFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoTrailingWhitespaceFixer.php old mode 100755 new mode 100644 index c21ff39f..e05a9fdd --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoTrailingWhitespaceFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoTrailingWhitespaceFixer.php @@ -76,7 +76,7 @@ final class NoTrailingWhitespaceFixer extends AbstractFixer continue; } - $lines = Preg::split('/(\\R+)/', $token->getContent(), -1, PREG_SPLIT_DELIM_CAPTURE); + $lines = Preg::split('/(\R+)/', $token->getContent(), -1, PREG_SPLIT_DELIM_CAPTURE); $linesSize = \count($lines); // fix only multiline whitespaces or singleline whitespaces at the end of file diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoWhitespaceInBlankLineFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/NoWhitespaceInBlankLineFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/SingleBlankLineAtEofFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/SingleBlankLineAtEofFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/SpacesInsideParenthesesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/SpacesInsideParenthesesFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/StatementIndentationFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/StatementIndentationFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/TypeDeclarationSpacesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/TypeDeclarationSpacesFixer.php old mode 100755 new mode 100644 index 29cd7f5a..d33dbcb6 --- a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/TypeDeclarationSpacesFixer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/TypeDeclarationSpacesFixer.php @@ -89,7 +89,7 @@ class Foo { return new FixerConfigurationResolver([ (new FixerOptionBuilder('elements', 'Structural elements where the spacing after the type declaration should be fixed.')) - ->setAllowedTypes(['array']) + ->setAllowedTypes(['string[]']) ->setAllowedValues([new AllowedValueSubset(['function', 'property'])]) ->setDefault(['function', 'property']) ->getOption(), diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/TypesSpacesFixer.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/Whitespace/TypesSpacesFixer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Fixer/WhitespacesAwareFixerInterface.php b/vendor/friendsofphp/php-cs-fixer/src/Fixer/WhitespacesAwareFixerInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/AliasedFixerOption.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/AliasedFixerOption.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/AliasedFixerOptionBuilder.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/AliasedFixerOptionBuilder.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/AllowedValueSubset.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/AllowedValueSubset.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/DeprecatedFixerOption.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/DeprecatedFixerOption.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/DeprecatedFixerOptionInterface.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/DeprecatedFixerOptionInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerConfigurationResolver.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerConfigurationResolver.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerConfigurationResolverInterface.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerConfigurationResolverInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerOption.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerOption.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerOptionBuilder.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerOptionBuilder.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerOptionInterface.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerOptionInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerOptionSorter.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerOptionSorter.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/InvalidOptionsForEnvException.php b/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/InvalidOptionsForEnvException.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/CodeSample.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/CodeSample.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/CodeSampleInterface.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/CodeSampleInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/FileSpecificCodeSample.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/FileSpecificCodeSample.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/FileSpecificCodeSampleInterface.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/FileSpecificCodeSampleInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/FixerDefinition.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/FixerDefinition.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/FixerDefinitionInterface.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/FixerDefinitionInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/VersionSpecificCodeSample.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/VersionSpecificCodeSample.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/VersionSpecificCodeSampleInterface.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/VersionSpecificCodeSampleInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/VersionSpecification.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/VersionSpecification.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/VersionSpecificationInterface.php b/vendor/friendsofphp/php-cs-fixer/src/FixerDefinition/VersionSpecificationInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerFactory.php b/vendor/friendsofphp/php-cs-fixer/src/FixerFactory.php old mode 100755 new mode 100644 index a364db65..214f8577 --- a/vendor/friendsofphp/php-cs-fixer/src/FixerFactory.php +++ b/vendor/friendsofphp/php-cs-fixer/src/FixerFactory.php @@ -89,7 +89,7 @@ final class FixerFactory /** @var SplFileInfo $file */ foreach (SymfonyFinder::create()->files()->in(__DIR__.'/Fixer')->name('*Fixer.php')->depth(1) as $file) { $relativeNamespace = $file->getRelativePath(); - $fixerClass = 'PhpCsFixer\\Fixer\\'.('' !== $relativeNamespace ? $relativeNamespace.'\\' : '').$file->getBasename('.php'); + $fixerClass = 'PhpCsFixer\Fixer\\'.('' !== $relativeNamespace ? $relativeNamespace.'\\' : '').$file->getBasename('.php'); $builtInFixers[] = $fixerClass; } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerFileProcessedEvent.php b/vendor/friendsofphp/php-cs-fixer/src/FixerFileProcessedEvent.php old mode 100755 new mode 100644 index b609da49..c9e9cb9f --- a/vendor/friendsofphp/php-cs-fixer/src/FixerFileProcessedEvent.php +++ b/vendor/friendsofphp/php-cs-fixer/src/FixerFileProcessedEvent.php @@ -39,13 +39,28 @@ final class FixerFileProcessedEvent extends Event private int $status; - public function __construct(int $status) + private ?string $fileRelativePath; + private ?string $fileHash; + + public function __construct(int $status, ?string $fileRelativePath = null, ?string $fileHash = null) { $this->status = $status; + $this->fileRelativePath = $fileRelativePath; + $this->fileHash = $fileHash; } public function getStatus(): int { return $this->status; } + + public function getFileRelativePath(): ?string + { + return $this->fileRelativePath; + } + + public function getFileHash(): ?string + { + return $this->fileHash; + } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/FixerNameValidator.php b/vendor/friendsofphp/php-cs-fixer/src/FixerNameValidator.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Indicator/PhpUnitTestCaseIndicator.php b/vendor/friendsofphp/php-cs-fixer/src/Indicator/PhpUnitTestCaseIndicator.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/CachingLinter.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/CachingLinter.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/Linter.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/Linter.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/LinterInterface.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/LinterInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/LintingException.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/LintingException.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/LintingResultInterface.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/LintingResultInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/ProcessLinter.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/ProcessLinter.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/ProcessLinterProcessBuilder.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/ProcessLinterProcessBuilder.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/ProcessLintingResult.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/ProcessLintingResult.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/TokenizerLinter.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/TokenizerLinter.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/TokenizerLintingResult.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/TokenizerLintingResult.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Linter/UnavailableLinterException.php b/vendor/friendsofphp/php-cs-fixer/src/Linter/UnavailableLinterException.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/PharChecker.php b/vendor/friendsofphp/php-cs-fixer/src/PharChecker.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/PharCheckerInterface.php b/vendor/friendsofphp/php-cs-fixer/src/PharCheckerInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Preg.php b/vendor/friendsofphp/php-cs-fixer/src/Preg.php old mode 100755 new mode 100644 index 86ab96c9..48b7e830 --- a/vendor/friendsofphp/php-cs-fixer/src/Preg.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Preg.php @@ -53,7 +53,7 @@ final class Preg return 1 === $result; } - throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, (array) $pattern); + throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, $pattern); } /** @@ -74,7 +74,7 @@ final class Preg * ? list> * : ($flags is int-mask&770 * ? list> - * : array + * : ($flags is 0 ? array> : array) * ) * ) * ) @@ -97,11 +97,11 @@ final class Preg return $result; } - throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, (array) $pattern); + throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, $pattern); } /** - * @param string|string[] $subject + * @param array|string $subject * * @param-out int $count * @@ -119,7 +119,7 @@ final class Preg return $result; } - throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, (array) $pattern); + throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, $pattern); } /** @@ -139,11 +139,11 @@ final class Preg return $result; } - throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, (array) $pattern); + throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, $pattern); } /** - * @return string[] + * @return list * * @throws PregException */ @@ -159,34 +159,16 @@ final class Preg return $result; } - throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, (array) $pattern); + throw self::newPregException(preg_last_error(), preg_last_error_msg(), __METHOD__, $pattern); } - /** - * @param string|string[] $pattern - * - * @return string|string[] - */ - private static function addUtf8Modifier($pattern) + private static function addUtf8Modifier(string $pattern): string { - if (\is_array($pattern)) { - return array_map(__METHOD__, $pattern); - } - return $pattern.'u'; } - /** - * @param string|string[] $pattern - * - * @return string|string[] - */ - private static function removeUtf8Modifier($pattern) + private static function removeUtf8Modifier(string $pattern): string { - if (\is_array($pattern)) { - return array_map(__METHOD__, $pattern); - } - if ('' === $pattern) { return ''; } @@ -199,44 +181,35 @@ final class Preg } /** - * Create PregException. - * - * Create the generic PregException message and if possible due to finding - * an invalid pattern, tell more about such kind of error in the message. - * - * @param string[] $patterns + * Create the generic PregException message and tell more about such kind of error in the message. */ - private static function newPregException(int $error, string $errorMsg, string $method, array $patterns): PregException + private static function newPregException(int $error, string $errorMsg, string $method, string $pattern): PregException { - foreach ($patterns as $pattern) { - $result = null; - $errorMessage = null; + $result = null; + $errorMessage = null; - try { - $result = ExecutorWithoutErrorHandler::execute(static fn () => preg_match($pattern, '')); - } catch (ExecutorWithoutErrorHandlerException $e) { - $result = false; - $errorMessage = $e->getMessage(); - } - - if (false !== $result) { - continue; - } - - $code = preg_last_error(); - - $message = sprintf( - '(code: %d) %s', - $code, - preg_replace('~preg_[a-z_]+[()]{2}: ~', '', $errorMessage) - ); - - return new PregException( - sprintf('%s(): Invalid PCRE pattern "%s": %s (version: %s)', $method, $pattern, $message, PCRE_VERSION), - $code - ); + try { + $result = ExecutorWithoutErrorHandler::execute(static fn () => preg_match($pattern, '')); + } catch (ExecutorWithoutErrorHandlerException $e) { + $result = false; + $errorMessage = $e->getMessage(); } - return new PregException(sprintf('Error occurred when calling %s: %s.', $method, $errorMsg), $error); + if (false !== $result) { + return new PregException(sprintf('Unknown error occurred when calling %s: %s.', $method, $errorMsg), $error); + } + + $code = preg_last_error(); + + $message = sprintf( + '(code: %d) %s', + $code, + preg_replace('~preg_[a-z_]+[()]{2}: ~', '', $errorMessage) + ); + + return new PregException( + sprintf('%s(): Invalid PCRE pattern "%s": %s (version: %s)', $method, $pattern, $message, PCRE_VERSION), + $code + ); } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/PregException.php b/vendor/friendsofphp/php-cs-fixer/src/PregException.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/AbstractMigrationSetDescription.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/AbstractMigrationSetDescription.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/AbstractRuleSetDescription.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/AbstractRuleSetDescription.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/DeprecatedRuleSetDescriptionInterface.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/DeprecatedRuleSetDescriptionInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSetDescriptionInterface.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSetDescriptionInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSetInterface.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSetInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSets.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSets.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/DoctrineAnnotationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/DoctrineAnnotationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS1x0RiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS1x0RiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS1x0Set.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS1x0Set.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0RiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0RiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0Set.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCS2x0Set.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERCSSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PERSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP54MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP54MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP56MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP56MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP70MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP70MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP70MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP70MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP71MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP71MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP71MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP71MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP73MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP73MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP74MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP74MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP74MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP74MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP80MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP80MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP80MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP80MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP81MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP81MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP82MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP82MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP83MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP83MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP84MigrationSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHP84MigrationSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit100MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit100MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit30MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit30MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit32MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit32MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit35MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit35MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit43MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit43MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit48MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit48MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit50MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit50MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit52MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit52MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit54MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit54MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit55MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit55MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit56MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit56MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit57MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit57MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit60MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit60MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit75MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit75MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit84MigrationRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PHPUnit84MigrationRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR12RiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR12RiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR12Set.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR12Set.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR1Set.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR1Set.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR2Set.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PSR2Set.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerSet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/PhpCsFixerSet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/SymfonyRiskySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/SymfonyRiskySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/SymfonySet.php b/vendor/friendsofphp/php-cs-fixer/src/RuleSet/Sets/SymfonySet.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Runner/FileCachingLintingIterator.php b/vendor/friendsofphp/php-cs-fixer/src/Runner/FileCachingLintingIterator.php deleted file mode 100755 index c07dbbd2..00000000 --- a/vendor/friendsofphp/php-cs-fixer/src/Runner/FileCachingLintingIterator.php +++ /dev/null @@ -1,84 +0,0 @@ - - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace PhpCsFixer\Runner; - -use PhpCsFixer\Linter\LinterInterface; -use PhpCsFixer\Linter\LintingResultInterface; - -/** - * @author Dariusz Rumiński - * - * @internal - * - * @extends \CachingIterator> - */ -final class FileCachingLintingIterator extends \CachingIterator -{ - private LinterInterface $linter; - - /** - * @var LintingResultInterface - */ - private $currentResult; - - /** - * @var LintingResultInterface - */ - private $nextResult; - - /** - * @param \Iterator $iterator - */ - public function __construct(\Iterator $iterator, LinterInterface $linter) - { - parent::__construct($iterator); - - $this->linter = $linter; - } - - public function currentLintingResult(): LintingResultInterface - { - return $this->currentResult; - } - - public function next(): void - { - parent::next(); - - $this->currentResult = $this->nextResult; - - if ($this->hasNext()) { - $this->nextResult = $this->handleItem($this->getInnerIterator()->current()); - } - } - - public function rewind(): void - { - parent::rewind(); - - if ($this->valid()) { - $this->currentResult = $this->handleItem($this->current()); - } - - if ($this->hasNext()) { - $this->nextResult = $this->handleItem($this->getInnerIterator()->current()); - } - } - - private function handleItem(\SplFileInfo $file): LintingResultInterface - { - return $this->linter->lintFile($file->getRealPath()); - } -} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Runner/FileFilterIterator.php b/vendor/friendsofphp/php-cs-fixer/src/Runner/FileFilterIterator.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Runner/FileLintingIterator.php b/vendor/friendsofphp/php-cs-fixer/src/Runner/FileLintingIterator.php deleted file mode 100755 index 09cec8da..00000000 --- a/vendor/friendsofphp/php-cs-fixer/src/Runner/FileLintingIterator.php +++ /dev/null @@ -1,69 +0,0 @@ - - * Dariusz Rumiński - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace PhpCsFixer\Runner; - -use PhpCsFixer\Linter\LinterInterface; -use PhpCsFixer\Linter\LintingResultInterface; - -/** - * @author Dariusz Rumiński - * - * @internal - * - * @extends \IteratorIterator> - */ -final class FileLintingIterator extends \IteratorIterator -{ - /** - * @var null|LintingResultInterface - */ - private $currentResult; - - private LinterInterface $linter; - - /** - * @param \Iterator $iterator - */ - public function __construct(\Iterator $iterator, LinterInterface $linter) - { - parent::__construct($iterator); - - $this->linter = $linter; - } - - public function currentLintingResult(): ?LintingResultInterface - { - return $this->currentResult; - } - - public function next(): void - { - parent::next(); - - $this->currentResult = $this->valid() ? $this->handleItem($this->current()) : null; - } - - public function rewind(): void - { - parent::rewind(); - - $this->currentResult = $this->valid() ? $this->handleItem($this->current()) : null; - } - - private function handleItem(\SplFileInfo $file): LintingResultInterface - { - return $this->linter->lintFile($file->getRealPath()); - } -} diff --git a/vendor/friendsofphp/php-cs-fixer/src/Runner/Runner.php b/vendor/friendsofphp/php-cs-fixer/src/Runner/Runner.php old mode 100755 new mode 100644 index 7a3bc822..f0c7e5fd --- a/vendor/friendsofphp/php-cs-fixer/src/Runner/Runner.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Runner/Runner.php @@ -14,26 +14,46 @@ declare(strict_types=1); namespace PhpCsFixer\Runner; +use Clue\React\NDJson\Decoder; +use Clue\React\NDJson\Encoder; use PhpCsFixer\AbstractFixer; use PhpCsFixer\Cache\CacheManagerInterface; use PhpCsFixer\Cache\Directory; use PhpCsFixer\Cache\DirectoryInterface; +use PhpCsFixer\Console\Command\WorkerCommand; use PhpCsFixer\Differ\DifferInterface; use PhpCsFixer\Error\Error; use PhpCsFixer\Error\ErrorsManager; +use PhpCsFixer\Error\SourceExceptionFactory; use PhpCsFixer\FileReader; use PhpCsFixer\Fixer\FixerInterface; use PhpCsFixer\FixerFileProcessedEvent; use PhpCsFixer\Linter\LinterInterface; use PhpCsFixer\Linter\LintingException; use PhpCsFixer\Linter\LintingResultInterface; +use PhpCsFixer\Preg; +use PhpCsFixer\Runner\Parallel\ParallelAction; +use PhpCsFixer\Runner\Parallel\ParallelConfig; +use PhpCsFixer\Runner\Parallel\ParallelConfigFactory; +use PhpCsFixer\Runner\Parallel\ParallelisationException; +use PhpCsFixer\Runner\Parallel\ProcessFactory; +use PhpCsFixer\Runner\Parallel\ProcessIdentifier; +use PhpCsFixer\Runner\Parallel\ProcessPool; +use PhpCsFixer\Runner\Parallel\WorkerException; use PhpCsFixer\Tokenizer\Tokens; +use React\EventLoop\StreamSelectLoop; +use React\Socket\ConnectionInterface; +use React\Socket\TcpServer; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Contracts\EventDispatcher\Event; /** * @author Dariusz Rumiński + * @author Greg Korba + * + * @phpstan-type _RunResult array, diff: string}> */ final class Runner { @@ -52,9 +72,11 @@ final class Runner private LinterInterface $linter; /** - * @var \Traversable<\SplFileInfo> + * @var null|\Traversable */ - private $finder; + private $fileIterator; + + private int $fileCount; /** * @var list @@ -63,12 +85,18 @@ final class Runner private bool $stopOnViolation; + private ParallelConfig $parallelConfig; + + private ?InputInterface $input; + + private ?string $configFile; + /** - * @param \Traversable<\SplFileInfo> $finder - * @param list $fixers + * @param null|\Traversable $fileIterator + * @param list $fixers */ public function __construct( - \Traversable $finder, + ?\Traversable $fileIterator, array $fixers, DifferInterface $differ, ?EventDispatcherInterface $eventDispatcher, @@ -77,9 +105,16 @@ final class Runner bool $isDryRun, CacheManagerInterface $cacheManager, ?DirectoryInterface $directory = null, - bool $stopOnViolation = false + bool $stopOnViolation = false, + // @TODO Make these arguments required in 4.0 + ?ParallelConfig $parallelConfig = null, + ?InputInterface $input = null, + ?string $configFile = null ) { - $this->finder = $finder; + // Required only for main process (calculating workers count) + $this->fileCount = null !== $fileIterator ? \count(iterator_to_array($fileIterator)) : 0; + + $this->fileIterator = $fileIterator; $this->fixers = $fixers; $this->differ = $differ; $this->eventDispatcher = $eventDispatcher; @@ -89,26 +124,240 @@ final class Runner $this->cacheManager = $cacheManager; $this->directory = $directory ?? new Directory(''); $this->stopOnViolation = $stopOnViolation; + $this->parallelConfig = $parallelConfig ?? ParallelConfigFactory::sequential(); + $this->input = $input; + $this->configFile = $configFile; } /** - * @return array, diff: string}> + * @TODO consider to drop this method and make iterator parameter obligatory in constructor, + * more in https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/7777/files#r1590447581 + * + * @param \Traversable $fileIterator + */ + public function setFileIterator(iterable $fileIterator): void + { + $this->fileIterator = $fileIterator; + + // Required only for main process (calculating workers count) + $this->fileCount = \count(iterator_to_array($fileIterator)); + } + + /** + * @return _RunResult */ public function fix(): array + { + if (0 === $this->fileCount) { + return []; + } + + // @TODO Remove condition for the input argument in 4.0, as it should be required in the constructor + return $this->parallelConfig->getMaxProcesses() > 1 && null !== $this->input + ? $this->fixParallel() + : $this->fixSequential(); + } + + /** + * Heavily inspired by {@see https://github.com/phpstan/phpstan-src/blob/9ce425bca5337039fb52c0acf96a20a2b8ace490/src/Parallel/ParallelAnalyser.php}. + * + * @return _RunResult + */ + private function fixParallel(): array { $changed = []; + $streamSelectLoop = new StreamSelectLoop(); + $server = new TcpServer('127.0.0.1:0', $streamSelectLoop); + $serverPort = parse_url($server->getAddress() ?? '', PHP_URL_PORT); - $finder = $this->finder; - $finderIterator = $finder instanceof \IteratorAggregate ? $finder->getIterator() : $finder; - $fileFilteredFileIterator = new FileFilterIterator( - $finderIterator, - $this->eventDispatcher, - $this->cacheManager + if (!is_numeric($serverPort)) { + throw new ParallelisationException(sprintf( + 'Unable to parse server port from "%s"', + $server->getAddress() ?? '' + )); + } + + $processPool = new ProcessPool($server); + $maxFilesPerProcess = $this->parallelConfig->getFilesPerProcess(); + $fileIterator = $this->getFilteringFileIterator(); + $fileIterator->rewind(); + + $getFileChunk = static function () use ($fileIterator, $maxFilesPerProcess): array { + $files = []; + + while (\count($files) < $maxFilesPerProcess) { + $current = $fileIterator->current(); + + if (null === $current) { + break; + } + + $files[] = $current->getRealPath(); + + $fileIterator->next(); + } + + return $files; + }; + + // [REACT] Handle worker's handshake (init connection) + $server->on('connection', static function (ConnectionInterface $connection) use ($processPool, $getFileChunk): void { + $jsonInvalidUtf8Ignore = \defined('JSON_INVALID_UTF8_IGNORE') ? JSON_INVALID_UTF8_IGNORE : 0; + $decoder = new Decoder($connection, true, 512, $jsonInvalidUtf8Ignore); + $encoder = new Encoder($connection, $jsonInvalidUtf8Ignore); + + // [REACT] Bind connection when worker's process requests "hello" action (enables 2-way communication) + $decoder->on('data', static function (array $data) use ($processPool, $getFileChunk, $decoder, $encoder): void { + if (ParallelAction::WORKER_HELLO !== $data['action']) { + return; + } + + $identifier = ProcessIdentifier::fromRaw($data['identifier']); + $process = $processPool->getProcess($identifier); + $process->bindConnection($decoder, $encoder); + $fileChunk = $getFileChunk(); + + if (0 === \count($fileChunk)) { + $process->request(['action' => ParallelAction::RUNNER_THANK_YOU]); + $processPool->endProcessIfKnown($identifier); + + return; + } + + $process->request(['action' => ParallelAction::RUNNER_REQUEST_ANALYSIS, 'files' => $fileChunk]); + }); + }); + + $processesToSpawn = min( + $this->parallelConfig->getMaxProcesses(), + max( + 1, + (int) ceil($this->fileCount / $this->parallelConfig->getFilesPerProcess()), + ) ); + $processFactory = new ProcessFactory($this->input); - $collection = $this->linter->isAsync() - ? new FileCachingLintingIterator($fileFilteredFileIterator, $this->linter) - : new FileLintingIterator($fileFilteredFileIterator, $this->linter); + for ($i = 0; $i < $processesToSpawn; ++$i) { + $identifier = ProcessIdentifier::create(); + $process = $processFactory->create( + $streamSelectLoop, + new RunnerConfig( + $this->isDryRun, + $this->stopOnViolation, + $this->parallelConfig, + $this->configFile + ), + $identifier, + $serverPort, + ); + $processPool->addProcess($identifier, $process); + $process->start( + // [REACT] Handle workers' responses (multiple actions possible) + function (array $workerResponse) use ($processPool, $process, $identifier, $getFileChunk, &$changed): void { + // File analysis result (we want close-to-realtime progress with frequent cache savings) + if (ParallelAction::WORKER_RESULT === $workerResponse['action']) { + $fileAbsolutePath = $workerResponse['file']; + $fileRelativePath = $this->directory->getRelativePathTo($fileAbsolutePath); + + // Dispatch an event for each file processed and dispatch its status (required for progress output) + $this->dispatchEvent( + FixerFileProcessedEvent::NAME, + new FixerFileProcessedEvent($workerResponse['status']) + ); + + if (isset($workerResponse['fileHash'])) { + $this->cacheManager->setFileHash($fileRelativePath, $workerResponse['fileHash']); + } + + foreach ($workerResponse['errors'] ?? [] as $error) { + $this->errorsManager->report(new Error( + $error['type'], + $error['filePath'], + null !== $error['source'] + ? SourceExceptionFactory::fromArray($error['source']) + : null, + $error['appliedFixers'], + $error['diff'] + )); + } + + // Pass-back information about applied changes (only if there are any) + if (isset($workerResponse['fixInfo'])) { + $changed[$fileRelativePath] = $workerResponse['fixInfo']; + + if ($this->stopOnViolation) { + $processPool->endAll(); + + return; + } + } + + return; + } + + if (ParallelAction::WORKER_GET_FILE_CHUNK === $workerResponse['action']) { + // Request another chunk of files, if still available + $fileChunk = $getFileChunk(); + + if (0 === \count($fileChunk)) { + $process->request(['action' => ParallelAction::RUNNER_THANK_YOU]); + $processPool->endProcessIfKnown($identifier); + + return; + } + + $process->request(['action' => ParallelAction::RUNNER_REQUEST_ANALYSIS, 'files' => $fileChunk]); + + return; + } + + if (ParallelAction::WORKER_ERROR_REPORT === $workerResponse['action']) { + throw WorkerException::fromRaw($workerResponse); // @phpstan-ignore-line + } + + throw new ParallelisationException('Unsupported action: '.($workerResponse['action'] ?? 'n/a')); + }, + + // [REACT] Handle errors encountered during worker's execution + static function (\Throwable $error) use ($processPool): void { + $processPool->endAll(); + + throw new ParallelisationException($error->getMessage(), $error->getCode(), $error); + }, + + // [REACT] Handle worker's shutdown + static function ($exitCode, string $output) use ($processPool, $identifier): void { + $processPool->endProcessIfKnown($identifier); + + if (0 === $exitCode || null === $exitCode) { + return; + } + + $errorsReported = Preg::matchAll( + sprintf('/^(?:%s)([^\n]+)+/m', WorkerCommand::ERROR_PREFIX), + $output, + $matches + ); + + if ($errorsReported > 0) { + throw WorkerException::fromRaw(json_decode($matches[1][0], true)); + } + } + ); + } + + $streamSelectLoop->run(); + + return $changed; + } + + /** + * @return _RunResult + */ + private function fixSequential(): array + { + $changed = []; + $collection = $this->getLintingFileIterator(); foreach ($collection as $file) { $fixInfo = $this->fixFile($file, $collection->currentLintingResult()); @@ -154,8 +403,8 @@ final class Runner $tokens = Tokens::fromCode($old); $oldHash = $tokens->getCodeHash(); - $newHash = $oldHash; $new = $old; + $newHash = $oldHash; $appliedFixers = []; @@ -266,11 +515,11 @@ final class Runner } } - $this->cacheManager->setFile($name, $new); + $this->cacheManager->setFileHash($name, $newHash); $this->dispatchEvent( FixerFileProcessedEvent::NAME, - new FixerFileProcessedEvent(null !== $fixInfo ? FixerFileProcessedEvent::STATUS_FIXED : FixerFileProcessedEvent::STATUS_NO_CHANGES) + new FixerFileProcessedEvent(null !== $fixInfo ? FixerFileProcessedEvent::STATUS_FIXED : FixerFileProcessedEvent::STATUS_NO_CHANGES, $name, $newHash) ); return $fixInfo; @@ -297,4 +546,28 @@ final class Runner $this->eventDispatcher->dispatch($event, $name); } + + private function getLintingFileIterator(): LintingResultAwareFileIteratorInterface + { + $fileFilterIterator = $this->getFilteringFileIterator(); + + return $this->linter->isAsync() + ? new FileCachingLintingFileIterator($fileFilterIterator, $this->linter) + : new LintingFileIterator($fileFilterIterator, $this->linter); + } + + private function getFilteringFileIterator(): FileFilterIterator + { + if (null === $this->fileIterator) { + throw new \RuntimeException('File iterator is not configured. Pass paths during Runner initialisation or set them after with `setFileIterator()`.'); + } + + return new FileFilterIterator( + $this->fileIterator instanceof \IteratorAggregate + ? $this->fileIterator->getIterator() + : $this->fileIterator, + $this->eventDispatcher, + $this->cacheManager + ); + } } diff --git a/vendor/friendsofphp/php-cs-fixer/src/StdinFileInfo.php b/vendor/friendsofphp/php-cs-fixer/src/StdinFileInfo.php old mode 100755 new mode 100644 index 7ce19091..2fba503e --- a/vendor/friendsofphp/php-cs-fixer/src/StdinFileInfo.php +++ b/vendor/friendsofphp/php-cs-fixer/src/StdinFileInfo.php @@ -58,7 +58,7 @@ final class StdinFileInfo extends \SplFileInfo return '.php'; } - public function getFileInfo($className = null): \SplFileInfo + public function getFileInfo($class = null): \SplFileInfo { throw new \BadMethodCallException(sprintf('Method "%s" is not implemented.', __METHOD__)); } @@ -105,7 +105,7 @@ final class StdinFileInfo extends \SplFileInfo return ''; } - public function getPathInfo($className = null): \SplFileInfo + public function getPathInfo($class = null): \SplFileInfo { throw new \BadMethodCallException(sprintf('Method "%s" is not implemented.', __METHOD__)); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/AbstractTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/AbstractTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/AbstractTypeTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/AbstractTypeTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/AlternativeSyntaxAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/AlternativeSyntaxAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/AbstractControlCaseStructuresAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/AbstractControlCaseStructuresAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/ArgumentAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/ArgumentAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/AttributeAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/AttributeAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/CaseAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/CaseAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/DataProviderAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/DataProviderAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/DefaultAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/DefaultAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/EnumAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/EnumAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/MatchAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/MatchAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/NamespaceAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/NamespaceAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/NamespaceUseAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/NamespaceUseAnalysis.php old mode 100755 new mode 100644 index c1586fbd..9056bf87 --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/NamespaceUseAnalysis.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/NamespaceUseAnalysis.php @@ -68,6 +68,8 @@ final class NamespaceUseAnalysis implements StartEndTokenAwareAnalysis /** * The type of import: class, function or constant. + * + * @var self::TYPE_* */ private int $type; @@ -140,6 +142,9 @@ final class NamespaceUseAnalysis implements StartEndTokenAwareAnalysis return $this->chunkEndIndex; } + /** + * @return self::TYPE_* + */ public function getType(): int { return $this->type; diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/StartEndTokenAwareAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/StartEndTokenAwareAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/SwitchAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/SwitchAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/TypeAnalysis.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/Analysis/TypeAnalysis.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/ArgumentsAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/ArgumentsAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/AttributeAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/AttributeAnalyzer.php old mode 100755 new mode 100644 index 615fe3b5..3dffcd73 --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/AttributeAnalyzer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/AttributeAnalyzer.php @@ -110,7 +110,9 @@ final class AttributeAnalyzer } $startIndex = $index; - if ($tokens[$prevIndex = $tokens->getPrevMeaningfulToken($index)]->isGivenKind(CT::T_ATTRIBUTE_CLOSE)) { + $prevIndex = $tokens->getPrevMeaningfulToken($index); + + if ($tokens[$tokens->getPrevMeaningfulToken($index)]->isGivenKind(CT::T_ATTRIBUTE_CLOSE)) { // Include comments/PHPDoc if they are present $startIndex = $tokens->getNextNonWhitespace($prevIndex); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/BlocksAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/BlocksAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/ClassyAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/ClassyAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/CommentsAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/CommentsAnalyzer.php old mode 100755 new mode 100644 index ad9b05a2..c2822c60 --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/CommentsAnalyzer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/CommentsAnalyzer.php @@ -125,7 +125,7 @@ final class CommentsAnalyzer * * @param int $index T_COMMENT index * - * @return list + * @return non-empty-list */ public function getCommentBlockIndices(Tokens $tokens, int $index): array { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/ControlCaseStructuresAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/ControlCaseStructuresAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/DataProviderAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/DataProviderAnalyzer.php old mode 100755 new mode 100644 index 09f58b70..78040f3a --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/DataProviderAnalyzer.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/DataProviderAnalyzer.php @@ -26,7 +26,7 @@ use PhpCsFixer\Tokenizer\Tokens; */ final class DataProviderAnalyzer { - private const REGEX_CLASS = '(?:\\\\?+'.TypeExpression::REGEX_IDENTIFIER + private const REGEX_CLASS = '(?:\\\?+'.TypeExpression::REGEX_IDENTIFIER .'(\\\\'.TypeExpression::REGEX_IDENTIFIER.')*+)'; /** diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/FunctionsAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/FunctionsAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/GotoLabelAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/GotoLabelAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/NamespaceUsesAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/NamespaceUsesAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/NamespacesAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/NamespacesAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/RangeAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/RangeAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/ReferenceAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/ReferenceAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/SwitchAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/SwitchAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/WhitespacesAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Analyzer/WhitespacesAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/CT.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/CT.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/CodeHasher.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/CodeHasher.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Processor/ImportProcessor.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Processor/ImportProcessor.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Token.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Token.php old mode 100755 new mode 100644 index 213644c6..353f88ff --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Token.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Token.php @@ -306,7 +306,7 @@ final class Token /** * Generate array containing all keywords that exists in PHP version in use. * - * @return array + * @return list */ public static function getKeywords(): array { diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Tokens.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Tokens.php old mode 100755 new mode 100644 index 7d9cd91c..5468d4ef --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Tokens.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Tokens.php @@ -14,9 +14,11 @@ declare(strict_types=1); namespace PhpCsFixer\Tokenizer; +use PhpCsFixer\Console\Application; use PhpCsFixer\Preg; use PhpCsFixer\Tokenizer\Analyzer\Analysis\NamespaceAnalysis; use PhpCsFixer\Tokenizer\Analyzer\NamespacesAnalyzer; +use PhpCsFixer\Utils; /** * Collection of code tokens. @@ -164,13 +166,17 @@ class Tokens extends \SplFixedArray { $tokens = new self(\count($array)); - if ($saveIndices ?? true) { + if (false !== $saveIndices && !array_is_list($array)) { + Utils::triggerDeprecation(new \InvalidArgumentException(sprintf( + 'Parameter "array" should be a list. This will be enforced in version %d.0.', + Application::getMajorVersion() + 1 + ))); + foreach ($array as $key => $val) { $tokens[$key] = $val; } } else { $index = 0; - foreach ($array as $val) { $tokens[$index++] = $val; } @@ -290,7 +296,7 @@ class Tokens extends \SplFixedArray #[\ReturnTypeWillChange] public function setSize($size): bool { - if ($this->getSize() !== $size) { + if (\count($this) !== $size) { $this->changed = true; $this->namespaceDeclarations = null; @@ -307,6 +313,13 @@ class Tokens extends \SplFixedArray */ public function offsetUnset($index): void { + if (\count($this) - 1 !== $index) { + Utils::triggerDeprecation(new \InvalidArgumentException(sprintf( + 'Tokens should be a list - only the last index can be unset. This will be enforced in version %d.0.', + Application::getMajorVersion() + 1 + ))); + } + if (isset($this[$index])) { if (isset($this->blockStartCache[$index])) { unset($this->blockEndCache[$this->blockStartCache[$index]], $this->blockStartCache[$index]); @@ -334,6 +347,13 @@ class Tokens extends \SplFixedArray */ public function offsetSet($index, $newval): void { + if (0 > $index || \count($this) <= $index) { + Utils::triggerDeprecation(new \InvalidArgumentException(sprintf( + 'Tokens should be a list - index must be within the existing range. This will be enforced in version %d.0.', + Application::getMajorVersion() + 1 + ))); + } + if (!isset($this[$index]) || !$this[$index]->equals($newval)) { if (isset($this[$index])) { if (isset($this->blockStartCache[$index])) { @@ -370,7 +390,7 @@ class Tokens extends \SplFixedArray */ public function clearEmptyTokens(): void { - $limit = $this->count(); + $limit = \count($this); for ($index = 0; $index < $limit; ++$index) { if ($this->isEmptyAt($index)) { @@ -470,7 +490,7 @@ class Tokens extends \SplFixedArray * @param self::BLOCK_TYPE_* $type type of block * @param int $searchIndex index of opening brace * - * @return int index of closing brace + * @return int<0, max> index of closing brace */ public function findBlockEnd(int $type, int $searchIndex): int { @@ -481,7 +501,7 @@ class Tokens extends \SplFixedArray * @param self::BLOCK_TYPE_* $type type of block * @param int $searchIndex index of closing brace * - * @return int index of opening brace + * @return int<0, max> index of opening brace */ public function findBlockStart(int $type, int $searchIndex): int { @@ -493,12 +513,12 @@ class Tokens extends \SplFixedArray * @param int $start optional offset * @param null|int $end optional limit * - * @return ($possibleKind is int ? array : array>) + * @return ($possibleKind is int ? array, Token> : array, Token>>) */ public function findGivenKind($possibleKind, int $start = 0, ?int $end = null): array { if (null === $end) { - $end = $this->count(); + $end = \count($this); } $elements = []; @@ -593,7 +613,6 @@ class Tokens extends \SplFixedArray { while (true) { $index += $direction; - if (!$this->offsetExists($index)) { return null; } @@ -648,7 +667,6 @@ class Tokens extends \SplFixedArray while (true) { $index += $direction; - if (!$this->offsetExists($index)) { return null; } @@ -716,7 +734,6 @@ class Tokens extends \SplFixedArray { while (true) { $index += $direction; - if (!$this->offsetExists($index)) { return null; } @@ -757,7 +774,7 @@ class Tokens extends \SplFixedArray * the ones used in $sequence. If any is missing, the default case-sensitive * comparison is used * - * @return null|non-empty-array an array containing the tokens matching the sequence elements, indexed by their position + * @return null|non-empty-array, Token> an array containing the tokens matching the sequence elements, indexed by their position */ public function findSequence(array $sequence, int $start = 0, ?int $end = null, $caseSensitive = true): ?array { @@ -924,7 +941,7 @@ class Tokens extends \SplFixedArray $sliceCount = \count($slice); for ($i = $previousSliceIndex - 1; $i >= $index; --$i) { - parent::offsetSet($i + $itemsCount, parent::offsetGet($i)); + parent::offsetSet($i + $itemsCount, $this[$i]); } $previousSliceIndex = $index; @@ -1030,6 +1047,8 @@ class Tokens extends \SplFixedArray // clear memory $this->setSize(0); + $this->blockStartCache = []; + $this->blockEndCache = []; $tokens = token_get_all($code, TOKEN_PARSE); @@ -1261,7 +1280,7 @@ class Tokens extends \SplFixedArray * @param int $searchIndex index of starting brace * @param bool $findEnd if method should find block's end or start * - * @return int index of opposite brace + * @return int<0, max> index of opposite brace */ private function findOppositeBlockEdge(int $type, int $searchIndex, bool $findEnd): int { @@ -1282,7 +1301,7 @@ class Tokens extends \SplFixedArray $startEdge = $blockEdgeDefinitions[$type]['start']; $endEdge = $blockEdgeDefinitions[$type]['end']; $startIndex = $searchIndex; - $endIndex = $this->count() - 1; + $endIndex = \count($this) - 1; $indexOffset = 1; if (!$findEnd) { @@ -1448,7 +1467,6 @@ class Tokens extends \SplFixedArray { while (true) { $index += $direction; - if (!$this->offsetExists($index)) { return null; } diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/TokensAnalyzer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/TokensAnalyzer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ArrayTypehintTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ArrayTypehintTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/AttributeTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/AttributeTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceClassInstantiationTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceClassInstantiationTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/BraceTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ClassConstantTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ClassConstantTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ConstructorPromotionTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ConstructorPromotionTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/DisjunctiveNormalFormTypeParenthesisTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/DisjunctiveNormalFormTypeParenthesisTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/FirstClassCallableTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/FirstClassCallableTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ImportTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ImportTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/NameQualifiedTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/NameQualifiedTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/NamedArgumentTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/NamedArgumentTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/NamespaceOperatorTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/NamespaceOperatorTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/NullableTypeTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/NullableTypeTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ReturnRefTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/ReturnRefTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/SquareBraceTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/SquareBraceTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/TypeAlternationTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/TypeAlternationTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/TypeColonTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/TypeColonTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/TypeIntersectionTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/TypeIntersectionTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/UseTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/UseTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/WhitespacyCommentTransformer.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformer/WhitespacyCommentTransformer.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/TransformerInterface.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/TransformerInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformers.php b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformers.php old mode 100755 new mode 100644 index e8745538..e5650659 --- a/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformers.php +++ b/vendor/friendsofphp/php-cs-fixer/src/Tokenizer/Transformers.php @@ -101,7 +101,7 @@ final class Transformers /** @var SplFileInfo $file */ foreach (Finder::create()->files()->in(__DIR__.'/Transformer') as $file) { $relativeNamespace = $file->getRelativePath(); - $class = __NAMESPACE__.'\\Transformer\\'.('' !== $relativeNamespace ? $relativeNamespace.'\\' : '').$file->getBasename('.php'); + $class = __NAMESPACE__.'\Transformer\\'.('' !== $relativeNamespace ? $relativeNamespace.'\\' : '').$file->getBasename('.php'); yield new $class(); } diff --git a/vendor/friendsofphp/php-cs-fixer/src/ToolInfo.php b/vendor/friendsofphp/php-cs-fixer/src/ToolInfo.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/ToolInfoInterface.php b/vendor/friendsofphp/php-cs-fixer/src/ToolInfoInterface.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/Utils.php b/vendor/friendsofphp/php-cs-fixer/src/Utils.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/WhitespacesFixerConfig.php b/vendor/friendsofphp/php-cs-fixer/src/WhitespacesFixerConfig.php old mode 100755 new mode 100644 diff --git a/vendor/friendsofphp/php-cs-fixer/src/WordMatcher.php b/vendor/friendsofphp/php-cs-fixer/src/WordMatcher.php old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/LICENSE b/vendor/kint-php/kint/LICENSE old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/README.md b/vendor/kint-php/kint/README.md old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/composer.json b/vendor/kint-php/kint/composer.json old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/init.php b/vendor/kint-php/kint/init.php old mode 100755 new mode 100644 index 039489ab..d682d9a9 --- a/vendor/kint-php/kint/init.php +++ b/vendor/kint-php/kint/init.php @@ -51,7 +51,7 @@ if (\version_compare(PHP_VERSION, '7.1') < 0) { if (false !== \ini_get('xdebug.file_link_format')) { Kint::$file_link_format = \ini_get('xdebug.file_link_format'); } -if (isset($_SERVER['DOCUMENT_ROOT'])) { +if (isset($_SERVER['DOCUMENT_ROOT']) && false === \strpos($_SERVER['DOCUMENT_ROOT'], "\0")) { Kint::$app_root_dirs = [ $_SERVER['DOCUMENT_ROOT'] => '', ]; diff --git a/vendor/kint-php/kint/init_helpers.php b/vendor/kint-php/kint/init_helpers.php old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/aante-dark.css b/vendor/kint-php/kint/resources/compiled/aante-dark.css old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/aante-light.css b/vendor/kint-php/kint/resources/compiled/aante-light.css old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/microtime.js b/vendor/kint-php/kint/resources/compiled/microtime.js old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/original.css b/vendor/kint-php/kint/resources/compiled/original.css old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/plain.css b/vendor/kint-php/kint/resources/compiled/plain.css old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/plain.js b/vendor/kint-php/kint/resources/compiled/plain.js old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/rich.js b/vendor/kint-php/kint/resources/compiled/rich.js old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/shared.js b/vendor/kint-php/kint/resources/compiled/shared.js old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/solarized-dark.css b/vendor/kint-php/kint/resources/compiled/solarized-dark.css old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/resources/compiled/solarized.css b/vendor/kint-php/kint/resources/compiled/solarized.css old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/src/CallFinder.php b/vendor/kint-php/kint/src/CallFinder.php old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/src/FacadeInterface.php b/vendor/kint-php/kint/src/FacadeInterface.php old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/src/Kint.php b/vendor/kint-php/kint/src/Kint.php old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/src/Parser/AbstractPlugin.php b/vendor/kint-php/kint/src/Parser/AbstractPlugin.php old mode 100755 new mode 100644 diff --git a/vendor/kint-php/kint/src/Parser/ArrayLimitPlugin.php b/vendor/kint-php/kint/src/Parser/ArrayLimitPlugin.php old mode 100755 new mode 100644