diff --git a/.github/workflows/grumphp.yaml b/.github/workflows/grumphp.yaml index 46b8646..d6e5293 100644 --- a/.github/workflows/grumphp.yaml +++ b/.github/workflows/grumphp.yaml @@ -7,7 +7,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3'] composer-options: ['', '--prefer-lowest'] fail-fast: false name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }} with ${{ matrix.composer-options }} diff --git a/composer.json b/composer.json index 3e9f6e0..b287b56 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ } ], "require": { - "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "php": "~8.2.0 || ~8.3.0", "ext-json": "*", - "azjezz/psl": "^2.5", + "azjezz/psl": "^3.0", "cardinalby/content-disposition": "^1.1", "league/uri": "^7.3", "php-http/client-common": "^2.7", diff --git a/phive.xml b/phive.xml index c9039fe..390edbb 100644 --- a/phive.xml +++ b/phive.xml @@ -1,6 +1,6 @@ - - - + + + diff --git a/src/Encoding/Binary/BinaryFile.php b/src/Encoding/Binary/BinaryFile.php index 4d7bc9a..5d5ff74 100644 --- a/src/Encoding/Binary/BinaryFile.php +++ b/src/Encoding/Binary/BinaryFile.php @@ -14,7 +14,7 @@ public function __construct( private readonly ?string $mimeType, private readonly ?string $fileName, private readonly ?string $extension, - private readonly ?string $hash + private readonly ?string $hash, ) { } diff --git a/src/Encoding/Binary/BinaryFileDecoder.php b/src/Encoding/Binary/BinaryFileDecoder.php index 51dd09a..256b104 100644 --- a/src/Encoding/Binary/BinaryFileDecoder.php +++ b/src/Encoding/Binary/BinaryFileDecoder.php @@ -50,7 +50,7 @@ public function __construct( callable $mimeTypeExtractor, callable $fileNameExtractor, callable $extensionExtractor, - callable $hashExtractor + callable $hashExtractor, ) { $this->sizeExtractor = $sizeExtractor; $this->mimeTypeExtractor = $mimeTypeExtractor; @@ -66,7 +66,7 @@ public static function createWithAutodiscoveredPsrFactories(): self new Extractor\MimeTypeExtractor(), new Extractor\FilenameExtractor(), new Extractor\ExtensionExtractor(), - new Extractor\HashExtractor(Algorithm::MD5), + new Extractor\HashExtractor(Algorithm::Md5), ); } diff --git a/src/Encoding/Binary/Extractor/ExtensionExtractor.php b/src/Encoding/Binary/Extractor/ExtensionExtractor.php index 3c4a066..17f7791 100644 --- a/src/Encoding/Binary/Extractor/ExtensionExtractor.php +++ b/src/Encoding/Binary/Extractor/ExtensionExtractor.php @@ -15,7 +15,8 @@ final class ExtensionExtractor { public function __invoke(ResponseInterface $response): ?string { - if ($mimeType = (new MimeTypeExtractor())($response)) { + $mimeType = (new MimeTypeExtractor())($response); + if (null !== $mimeType) { SymfonyMimeDependency::guard(); $extensions = MimeTypes::getDefault()->getExtensions($mimeType); if ($extensions) { @@ -23,7 +24,8 @@ public function __invoke(ResponseInterface $response): ?string } } - if ($originalName = (new FilenameExtractor())($response)) { + $originalName = (new FilenameExtractor())($response); + if (null !== $originalName) { return pathinfo($originalName, PATHINFO_EXTENSION) ?: null; } diff --git a/src/Encoding/Binary/Extractor/FilenameExtractor.php b/src/Encoding/Binary/Extractor/FilenameExtractor.php index 99ee107..527771b 100644 --- a/src/Encoding/Binary/Extractor/FilenameExtractor.php +++ b/src/Encoding/Binary/Extractor/FilenameExtractor.php @@ -15,7 +15,8 @@ final class FilenameExtractor { public function __invoke(ResponseInterface $response): ?string { - if (!$disposition = first($response->getHeader('Content-Disposition'))) { + $disposition = first($response->getHeader('Content-Disposition')); + if (null === $disposition) { return null; } diff --git a/src/Encoding/Binary/Extractor/HashExtractor.php b/src/Encoding/Binary/Extractor/HashExtractor.php index f2ce071..aefb4cb 100644 --- a/src/Encoding/Binary/Extractor/HashExtractor.php +++ b/src/Encoding/Binary/Extractor/HashExtractor.php @@ -11,7 +11,7 @@ final class HashExtractor { public function __construct( - private readonly Algorithm $algorithm + private readonly Algorithm $algorithm, ) { } diff --git a/src/Encoding/Binary/Extractor/MimeTypeExtractor.php b/src/Encoding/Binary/Extractor/MimeTypeExtractor.php index a8b3d74..89566da 100644 --- a/src/Encoding/Binary/Extractor/MimeTypeExtractor.php +++ b/src/Encoding/Binary/Extractor/MimeTypeExtractor.php @@ -15,11 +15,13 @@ final class MimeTypeExtractor { public function __invoke(ResponseInterface $response): ?string { - if ($contentType = first($response->getHeader('Content-Type'))) { + $contentType = first($response->getHeader('Content-Type')); + if (null !== $contentType && '' !== $contentType) { return $contentType; } - if ($originalName = (new FilenameExtractor())($response)) { + $originalName = (new FilenameExtractor())($response); + if (null !== $originalName) { if ($extension = pathinfo($originalName, PATHINFO_EXTENSION)) { SymfonyMimeDependency::guard(); $mimeTypes = MimeTypes::getDefault()->getMimeTypes($extension); diff --git a/src/Encoding/Binary/Extractor/SizeExtractor.php b/src/Encoding/Binary/Extractor/SizeExtractor.php index 82060fd..e1f3d02 100644 --- a/src/Encoding/Binary/Extractor/SizeExtractor.php +++ b/src/Encoding/Binary/Extractor/SizeExtractor.php @@ -19,7 +19,8 @@ public function __invoke(ResponseInterface $response): ?int return $size; } - if ($length = first($response->getHeader('Content-Length'))) { + $length = first($response->getHeader('Content-Length')); + if (null !== $length) { return try_catch( static fn () => int()->coerce($length), static fn () => null diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index fd2e2db..cfbc017 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -8,7 +8,7 @@ abstract class RuntimeException extends \RuntimeException { - protected function __construct(string $message = '', int $code = 0, Throwable $previous = null) + protected function __construct(string $message = '', int $code = 0, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/Formatter/RemoveSensitiveQueryStringsFormatter.php b/src/Formatter/RemoveSensitiveQueryStringsFormatter.php index 9b65fd6..9a72360 100644 --- a/src/Formatter/RemoveSensitiveQueryStringsFormatter.php +++ b/src/Formatter/RemoveSensitiveQueryStringsFormatter.php @@ -22,7 +22,7 @@ final class RemoveSensitiveQueryStringsFormatter implements HttpFormatter */ public function __construct( HttpFormatter $formatter, - array $sensitiveKeys + array $sensitiveKeys, ) { $this->formatter = $formatter; $this->sensitiveKeys = $sensitiveKeys; diff --git a/src/Test/UseHttpToolsFactories.php b/src/Test/UseHttpToolsFactories.php index 816a25e..002604e 100644 --- a/src/Test/UseHttpToolsFactories.php +++ b/src/Test/UseHttpToolsFactories.php @@ -21,7 +21,7 @@ private function createToolsRequest( string $method, string $uri, array $uriParams = [], - $body = null + $body = null, ): RequestInterface { return new Request($method, $uri, $uriParams, $body); } diff --git a/src/Test/UseMockClient.php b/src/Test/UseMockClient.php index 8f68a3d..7c984ed 100644 --- a/src/Test/UseMockClient.php +++ b/src/Test/UseMockClient.php @@ -14,7 +14,7 @@ trait UseMockClient /** * @param callable(Client $client): Client|null $configurator */ - private function mockClient(callable $configurator = null): Client + private function mockClient(?callable $configurator = null): Client { MockClientDependency::guard(); $configurator ??= fn (Client $client) => $client; diff --git a/src/Test/UseVcrClient.php b/src/Test/UseVcrClient.php index 9ab2295..3d4ed42 100644 --- a/src/Test/UseVcrClient.php +++ b/src/Test/UseVcrClient.php @@ -19,7 +19,7 @@ trait UseVcrClient /** * @return array{RecordPlugin, ReplayPlugin} */ - private function useRecording(string $path, NamingStrategyInterface $namingStrategy = null): array + private function useRecording(string $path, ?NamingStrategyInterface $namingStrategy = null): array { VcrPluginDependency::guard(); diff --git a/src/Transport/CallbackTransport.php b/src/Transport/CallbackTransport.php index 54c8393..0798e6a 100644 --- a/src/Transport/CallbackTransport.php +++ b/src/Transport/CallbackTransport.php @@ -39,7 +39,7 @@ final class CallbackTransport implements TransportInterface public function __construct( callable $requestConverter, callable $sender, - callable $responseConverter + callable $responseConverter, ) { $this->requestConverter = $requestConverter; $this->sender = $sender; diff --git a/src/Transport/EncodedTransportFactory.php b/src/Transport/EncodedTransportFactory.php index d297450..e8ca0c2 100644 --- a/src/Transport/EncodedTransportFactory.php +++ b/src/Transport/EncodedTransportFactory.php @@ -27,7 +27,7 @@ public static function create( ClientInterface $client, UriBuilderInterface $uriBuilder, EncoderInterface $encoder, - DecoderInterface $decoder + DecoderInterface $decoder, ): TransportInterface { /** @var CallbackTransport $transport */ $transport = new CallbackTransport( diff --git a/src/Transport/IO/Input/EncodingRequestConverter.php b/src/Transport/IO/Input/EncodingRequestConverter.php index 296321d..89ddf8d 100644 --- a/src/Transport/IO/Input/EncodingRequestConverter.php +++ b/src/Transport/IO/Input/EncodingRequestConverter.php @@ -31,7 +31,7 @@ final class EncodingRequestConverter implements RequestConverterInterface public function __construct( RequestFactoryInterface $requestFactory, UriBuilderInterface $uriBuilder, - EncoderInterface $encoder + EncoderInterface $encoder, ) { $this->requestFactory = $requestFactory; $this->encoder = $encoder; @@ -40,7 +40,7 @@ public function __construct( public static function createWithAutodiscoveredPsrFactories( UriBuilderInterface $uriBuilder, - EncoderInterface $encoder + EncoderInterface $encoder, ): self { return new self( Psr17FactoryDiscovery::findRequestFactory(), diff --git a/src/Transport/Presets/BinaryDownloadPreset.php b/src/Transport/Presets/BinaryDownloadPreset.php index 720fe31..4a69500 100644 --- a/src/Transport/Presets/BinaryDownloadPreset.php +++ b/src/Transport/Presets/BinaryDownloadPreset.php @@ -23,7 +23,7 @@ final class BinaryDownloadPreset */ public static function create( ClientInterface $client, - UriBuilderInterface $uriBuilder + UriBuilderInterface $uriBuilder, ): TransportInterface { return self::withEmptyRequest($client, $uriBuilder); } @@ -33,7 +33,7 @@ public static function create( */ public static function withEmptyRequest( ClientInterface $client, - UriBuilderInterface $uriBuilder + UriBuilderInterface $uriBuilder, ): TransportInterface { return EncodedTransportFactory::create( $client, @@ -48,7 +48,7 @@ public static function withEmptyRequest( */ public static function withMultiPartRequest( ClientInterface $client, - UriBuilderInterface $uriBuilder + UriBuilderInterface $uriBuilder, ): TransportInterface { return EncodedTransportFactory::create( $client, diff --git a/src/Transport/Presets/JsonPreset.php b/src/Transport/Presets/JsonPreset.php index e58a269..a93092d 100644 --- a/src/Transport/Presets/JsonPreset.php +++ b/src/Transport/Presets/JsonPreset.php @@ -18,7 +18,7 @@ final class JsonPreset */ public static function create( ClientInterface $client, - UriBuilderInterface $uriBuilder + UriBuilderInterface $uriBuilder, ): TransportInterface { return EncodedTransportFactory::create( $client, diff --git a/src/Transport/Presets/PsrPreset.php b/src/Transport/Presets/PsrPreset.php index 5d6c163..d3fa62f 100644 --- a/src/Transport/Presets/PsrPreset.php +++ b/src/Transport/Presets/PsrPreset.php @@ -19,7 +19,7 @@ final class PsrPreset */ public static function create( ClientInterface $client, - UriBuilderInterface $uriBuilder + UriBuilderInterface $uriBuilder, ): TransportInterface { return EncodedTransportFactory::create( $client, diff --git a/src/Transport/Presets/RawPreset.php b/src/Transport/Presets/RawPreset.php index 821fe4a..61d8807 100644 --- a/src/Transport/Presets/RawPreset.php +++ b/src/Transport/Presets/RawPreset.php @@ -18,7 +18,7 @@ final class RawPreset */ public static function create( ClientInterface $client, - UriBuilderInterface $uriBuilder + UriBuilderInterface $uriBuilder, ): TransportInterface { return EncodedTransportFactory::create( $client, diff --git a/src/Transport/Serializer/SerializerTransport.php b/src/Transport/Serializer/SerializerTransport.php index bbf20a2..421b65f 100644 --- a/src/Transport/Serializer/SerializerTransport.php +++ b/src/Transport/Serializer/SerializerTransport.php @@ -33,7 +33,7 @@ final class SerializerTransport implements TransportInterface */ public function __construct( SerializerInterface $serializer, - TransportInterface $transport + TransportInterface $transport, ) { $this->transport = $transport; $this->serializer = $serializer; diff --git a/tests/Unit/Encoding/Binary/BinaryFileDecoderTest.php b/tests/Unit/Encoding/Binary/BinaryFileDecoderTest.php index 7251a53..422d2bf 100644 --- a/tests/Unit/Encoding/Binary/BinaryFileDecoderTest.php +++ b/tests/Unit/Encoding/Binary/BinaryFileDecoderTest.php @@ -22,7 +22,7 @@ final class BinaryFileDecoderTest extends TestCase public function it_can_decode_binary_files( BinaryFileDecoder $decoder, ResponseInterface $response, - BinaryFile $expected + BinaryFile $expected, ): void { $actual = $decoder($response); diff --git a/tests/Unit/Encoding/Binary/Extractor/HashExtractorTest.php b/tests/Unit/Encoding/Binary/Extractor/HashExtractorTest.php index 27fd010..acdd0ee 100644 --- a/tests/Unit/Encoding/Binary/Extractor/HashExtractorTest.php +++ b/tests/Unit/Encoding/Binary/Extractor/HashExtractorTest.php @@ -24,7 +24,7 @@ final class HashExtractorTest extends TestCase */ public function it_can_extract_hash(ResponseInterface $response, string $expected, int $endPosition = 0): void { - $extractor = new HashExtractor(Algorithm::MD5); + $extractor = new HashExtractor(Algorithm::Md5); $actual = $extractor($response); self::assertSame($actual, $expected); @@ -35,7 +35,7 @@ public function provideCases() { yield 'from-empty-stream-size' => [ $this->createResponse(), - hash('', Algorithm::MD5), + hash('', Algorithm::Md5), ]; yield 'from-stream-size' => [ @@ -43,7 +43,7 @@ public function provideCases() ->withBody( $this->createStream('12345') ), - hash('12345', Algorithm::MD5), + hash('12345', Algorithm::Md5), ]; $stream = $this->createStream('12345'); @@ -51,7 +51,7 @@ public function provideCases() yield 'from-partially-read-stream' => [ $this->createResponse() ->withBody($stream), - hash('12345', Algorithm::MD5), + hash('12345', Algorithm::Md5), 3, ]; } diff --git a/tests/Unit/Formatter/RemoveSensitiveHeaderKeysFormatterTest.php b/tests/Unit/Formatter/RemoveSensitiveHeaderKeysFormatterTest.php index c8321ad..41817b8 100644 --- a/tests/Unit/Formatter/RemoveSensitiveHeaderKeysFormatterTest.php +++ b/tests/Unit/Formatter/RemoveSensitiveHeaderKeysFormatterTest.php @@ -70,7 +70,7 @@ public function it_can_remove_sensitive_keys_from_response(array $headers, array */ public function it_can_remove_sensitive_keys_from_response_with_request_context( array $headers, - array $expected + array $expected, ): void { $request = $this->createRequest('GET', 'something'); @@ -96,7 +96,7 @@ public function it_can_remove_sensitive_keys_from_response_with_request_context( */ public function it_can_remove_sensitive_keys_from_response_with_request_context_even_if_base_method_does_not_exist( array $headers, - array $expected + array $expected, ): void { $request = $this->createRequest('GET', 'something'); diff --git a/tests/Unit/Formatter/RemoveSensitiveJsonKeysFormatterTest.php b/tests/Unit/Formatter/RemoveSensitiveJsonKeysFormatterTest.php index b6706bd..a296e35 100644 --- a/tests/Unit/Formatter/RemoveSensitiveJsonKeysFormatterTest.php +++ b/tests/Unit/Formatter/RemoveSensitiveJsonKeysFormatterTest.php @@ -67,7 +67,7 @@ public function it_can_remove_sensitive_json_keys_from_response(array $content, */ public function it_can_remove_sensitive_json_keys_from_response_with_request_context( array $content, - array $expected + array $expected, ): void { $request = $this->createRequest('GET', 'something') ->withBody( @@ -91,7 +91,7 @@ public function it_can_remove_sensitive_json_keys_from_response_with_request_con */ public function it_can_remove_sensitive_json_keys_from_response_with_request_context_if_base_method_does_not_exist( array $content, - array $expected + array $expected, ): void { $request = $this->createRequest('GET', 'something') ->withBody( diff --git a/tests/Unit/Formatter/RemoveSensitiveQueryStringsFormatterTest.php b/tests/Unit/Formatter/RemoveSensitiveQueryStringsFormatterTest.php index e035a75..9fdc19f 100644 --- a/tests/Unit/Formatter/RemoveSensitiveQueryStringsFormatterTest.php +++ b/tests/Unit/Formatter/RemoveSensitiveQueryStringsFormatterTest.php @@ -31,7 +31,7 @@ protected function setUp(): void */ public function it_can_remove_sensitive_query_strings_from_request( string $actual, - string $expected + string $expected, ): void { $request = $this->createRequest('GET', $actual); $formatted = $this->formatter->formatRequest($request); diff --git a/tools/php-cs-fixer.phar b/tools/php-cs-fixer.phar index 9a03f3e..d071fa5 100755 Binary files a/tools/php-cs-fixer.phar and b/tools/php-cs-fixer.phar differ diff --git a/tools/phpunit.phar b/tools/phpunit.phar index 8d1aedb..c7e66d0 100755 --- a/tools/phpunit.phar +++ b/tools/phpunit.phar @@ -19,7 +19,7 @@ if (version_compare('7.3.0', PHP_VERSION, '>')) { fwrite( STDERR, sprintf( - 'PHPUnit 9.6.13 by Sebastian Bergmann and contributors.' . PHP_EOL . PHP_EOL . + 'PHPUnit 9.6.20 by Sebastian Bergmann and contributors.' . PHP_EOL . PHP_EOL . 'This version of PHPUnit requires PHP >= 7.3.' . PHP_EOL . 'You are using PHP %s (%s).' . PHP_EOL, PHP_VERSION, @@ -61,13 +61,15 @@ if (__FILE__ === realpath($_SERVER['SCRIPT_NAME'])) { $execute = false; } -$options = getopt('', array('prepend:', 'manifest', 'sbom')); +$options = getopt('', array('prepend:', 'composer-lock', 'manifest', 'sbom')); if (isset($options['prepend'])) { require $options['prepend']; } -if (isset($options['manifest'])) { +if (isset($options['composer-lock'])) { + $printComposerLock = true; +} elseif (isset($options['manifest'])) { $printManifest = true; } elseif (isset($options['sbom'])) { $printSbom = true; @@ -76,45 +78,770 @@ if (isset($options['manifest'])) { unset($options); define('__PHPUNIT_PHAR__', str_replace(DIRECTORY_SEPARATOR, '/', __FILE__)); -define('__PHPUNIT_PHAR_ROOT__', 'phar://phpunit-9.6.13.phar'); +define('__PHPUNIT_PHAR_ROOT__', 'phar://phpunit-9.6.20.phar'); -Phar::mapPhar('phpunit-9.6.13.phar'); +Phar::mapPhar('phpunit-9.6.20.phar'); spl_autoload_register( function ($class) { static $classes = null; if ($classes === null) { - $classes = ['PHPUnit\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy.php', - 'PHPUnit\\DeepCopy\\Exception\\CloneException' => '/myclabs-deep-copy/DeepCopy/Exception/CloneException.php', - 'PHPUnit\\DeepCopy\\Exception\\PropertyException' => '/myclabs-deep-copy/DeepCopy/Exception/PropertyException.php', - 'PHPUnit\\DeepCopy\\Filter\\ChainableFilter' => '/myclabs-deep-copy/DeepCopy/Filter/ChainableFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\Doctrine\\DoctrineCollectionFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\Doctrine\\DoctrineEmptyCollectionFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\Doctrine\\DoctrineProxyFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\Filter' => '/myclabs-deep-copy/DeepCopy/Filter/Filter.php', - 'PHPUnit\\DeepCopy\\Filter\\KeepFilter' => '/myclabs-deep-copy/DeepCopy/Filter/KeepFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\ReplaceFilter' => '/myclabs-deep-copy/DeepCopy/Filter/ReplaceFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\SetNullFilter' => '/myclabs-deep-copy/DeepCopy/Filter/SetNullFilter.php', - 'PHPUnit\\DeepCopy\\Matcher\\Doctrine\\DoctrineProxyMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php', - 'PHPUnit\\DeepCopy\\Matcher\\Matcher' => '/myclabs-deep-copy/DeepCopy/Matcher/Matcher.php', - 'PHPUnit\\DeepCopy\\Matcher\\PropertyMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyMatcher.php', - 'PHPUnit\\DeepCopy\\Matcher\\PropertyNameMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyNameMatcher.php', - 'PHPUnit\\DeepCopy\\Matcher\\PropertyTypeMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyTypeMatcher.php', - 'PHPUnit\\DeepCopy\\Reflection\\ReflectionHelper' => '/myclabs-deep-copy/DeepCopy/Reflection/ReflectionHelper.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\Date\\DateIntervalFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Date/DateIntervalFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\ReplaceFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/ReplaceFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\ShallowCopyFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/ShallowCopyFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\Spl\\ArrayObjectFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/ArrayObjectFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\Spl\\SplDoublyLinkedList' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\Spl\\SplDoublyLinkedListFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\TypeFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/TypeFilter.php', - 'PHPUnit\\DeepCopy\\TypeMatcher\\TypeMatcher' => '/myclabs-deep-copy/DeepCopy/TypeMatcher/TypeMatcher.php', - 'PHPUnit\\Doctrine\\Instantiator\\Exception\\ExceptionInterface' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/ExceptionInterface.php', - 'PHPUnit\\Doctrine\\Instantiator\\Exception\\InvalidArgumentException' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/InvalidArgumentException.php', - 'PHPUnit\\Doctrine\\Instantiator\\Exception\\UnexpectedValueException' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/UnexpectedValueException.php', - 'PHPUnit\\Doctrine\\Instantiator\\Instantiator' => '/doctrine-instantiator/Doctrine/Instantiator/Instantiator.php', - 'PHPUnit\\Doctrine\\Instantiator\\InstantiatorInterface' => '/doctrine-instantiator/Doctrine/Instantiator/InstantiatorInterface.php', + $classes = ['Doctrine\\Deprecations\\PHPUnit\\VerifyDeprecations' => '/doctrine-deprecations/Doctrine/Deprecations/PHPUnit/VerifyDeprecations.php', + 'PHPUnitPHAR\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy.php', + 'PHPUnitPHAR\\DeepCopy\\Exception\\CloneException' => '/myclabs-deep-copy/DeepCopy/Exception/CloneException.php', + 'PHPUnitPHAR\\DeepCopy\\Exception\\PropertyException' => '/myclabs-deep-copy/DeepCopy/Exception/PropertyException.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\ChainableFilter' => '/myclabs-deep-copy/DeepCopy/Filter/ChainableFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\Doctrine\\DoctrineCollectionFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\Doctrine\\DoctrineEmptyCollectionFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\Doctrine\\DoctrineProxyFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\Filter' => '/myclabs-deep-copy/DeepCopy/Filter/Filter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\KeepFilter' => '/myclabs-deep-copy/DeepCopy/Filter/KeepFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\ReplaceFilter' => '/myclabs-deep-copy/DeepCopy/Filter/ReplaceFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\SetNullFilter' => '/myclabs-deep-copy/DeepCopy/Filter/SetNullFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\Doctrine\\DoctrineProxyMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\Matcher' => '/myclabs-deep-copy/DeepCopy/Matcher/Matcher.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\PropertyMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyMatcher.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\PropertyNameMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyNameMatcher.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\PropertyTypeMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyTypeMatcher.php', + 'PHPUnitPHAR\\DeepCopy\\Reflection\\ReflectionHelper' => '/myclabs-deep-copy/DeepCopy/Reflection/ReflectionHelper.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\Date\\DateIntervalFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Date/DateIntervalFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\ReplaceFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/ReplaceFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\ShallowCopyFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/ShallowCopyFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\Spl\\ArrayObjectFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/ArrayObjectFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\Spl\\SplDoublyLinkedList' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\Spl\\SplDoublyLinkedListFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\TypeFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/TypeFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeMatcher\\TypeMatcher' => '/myclabs-deep-copy/DeepCopy/TypeMatcher/TypeMatcher.php', + 'PHPUnitPHAR\\Doctrine\\Deprecations\\Deprecation' => '/doctrine-deprecations/Doctrine/Deprecations/Deprecation.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\Exception\\ExceptionInterface' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/ExceptionInterface.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\Exception\\InvalidArgumentException' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/InvalidArgumentException.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\Exception\\UnexpectedValueException' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/UnexpectedValueException.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\Instantiator' => '/doctrine-instantiator/Doctrine/Instantiator/Instantiator.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\InstantiatorInterface' => '/doctrine-instantiator/Doctrine/Instantiator/InstantiatorInterface.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\AbstractNodeVisitor' => '/phpstan-phpdoc-parser/Ast/AbstractNodeVisitor.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Attribute' => '/phpstan-phpdoc-parser/Ast/Attribute.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprArrayItemNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprArrayItemNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprArrayNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprArrayNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprFalseNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprFalseNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprFloatNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprFloatNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprIntegerNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprIntegerNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprNullNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprNullNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprStringNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprStringNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprTrueNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprTrueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstFetchNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstFetchNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\DoctrineConstExprStringNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/DoctrineConstExprStringNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\QuoteAwareConstExprStringNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/QuoteAwareConstExprStringNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Node' => '/phpstan-phpdoc-parser/Ast/Node.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\NodeAttributes' => '/phpstan-phpdoc-parser/Ast/NodeAttributes.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\NodeTraverser' => '/phpstan-phpdoc-parser/Ast/NodeTraverser.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\NodeVisitor' => '/phpstan-phpdoc-parser/Ast/NodeVisitor.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\NodeVisitor\\CloningVisitor' => '/phpstan-phpdoc-parser/Ast/NodeVisitor/CloningVisitor.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\AssertTagMethodValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagMethodValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\AssertTagPropertyValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagPropertyValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\AssertTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\DeprecatedTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/DeprecatedTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineAnnotation' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineAnnotation.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineArgument' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArgument.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineArray' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArray.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineArrayItem' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArrayItem.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ExtendsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ExtendsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\GenericTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/GenericTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ImplementsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ImplementsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\InvalidTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/InvalidTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\MethodTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/MethodTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\MethodTagValueParameterNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/MethodTagValueParameterNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\MixinTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/MixinTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamClosureThisTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamClosureThisTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamImmediatelyInvokedCallableTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamImmediatelyInvokedCallableTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamLaterInvokedCallableTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamLaterInvokedCallableTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamOutTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamOutTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocChildNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocChildNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTagNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTextNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTextNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PropertyTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PropertyTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\RequireExtendsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/RequireExtendsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\RequireImplementsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/RequireImplementsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ReturnTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ReturnTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\SelfOutTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/SelfOutTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\TemplateTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/TemplateTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ThrowsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ThrowsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\TypeAliasImportTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/TypeAliasImportTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\TypeAliasTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/TypeAliasTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\TypelessParamTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/TypelessParamTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\UsesTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/UsesTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\VarTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/VarTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ArrayShapeItemNode' => '/phpstan-phpdoc-parser/Ast/Type/ArrayShapeItemNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ArrayShapeNode' => '/phpstan-phpdoc-parser/Ast/Type/ArrayShapeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ArrayTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/ArrayTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\CallableTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/CallableTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\CallableTypeParameterNode' => '/phpstan-phpdoc-parser/Ast/Type/CallableTypeParameterNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ConditionalTypeForParameterNode' => '/phpstan-phpdoc-parser/Ast/Type/ConditionalTypeForParameterNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ConditionalTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/ConditionalTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ConstTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/ConstTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\GenericTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/GenericTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\IdentifierTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/IdentifierTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\IntersectionTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/IntersectionTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\InvalidTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/InvalidTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\NullableTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/NullableTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ObjectShapeItemNode' => '/phpstan-phpdoc-parser/Ast/Type/ObjectShapeItemNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ObjectShapeNode' => '/phpstan-phpdoc-parser/Ast/Type/ObjectShapeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\OffsetAccessTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/OffsetAccessTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ThisTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/ThisTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\TypeNode' => '/phpstan-phpdoc-parser/Ast/Type/TypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\UnionTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/UnionTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Lexer\\Lexer' => '/phpstan-phpdoc-parser/Lexer/Lexer.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\ConstExprParser' => '/phpstan-phpdoc-parser/Parser/ConstExprParser.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\ParserException' => '/phpstan-phpdoc-parser/Parser/ParserException.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\PhpDocParser' => '/phpstan-phpdoc-parser/Parser/PhpDocParser.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\StringUnescaper' => '/phpstan-phpdoc-parser/Parser/StringUnescaper.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\TokenIterator' => '/phpstan-phpdoc-parser/Parser/TokenIterator.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\TypeParser' => '/phpstan-phpdoc-parser/Parser/TypeParser.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Printer\\DiffElem' => '/phpstan-phpdoc-parser/Printer/DiffElem.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Printer\\Differ' => '/phpstan-phpdoc-parser/Printer/Differ.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Printer\\Printer' => '/phpstan-phpdoc-parser/Printer/Printer.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Application' => '/phar-io-manifest/values/Application.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ApplicationName' => '/phar-io-manifest/values/ApplicationName.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Author' => '/phar-io-manifest/values/Author.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\AuthorCollection' => '/phar-io-manifest/values/AuthorCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\AuthorCollectionIterator' => '/phar-io-manifest/values/AuthorCollectionIterator.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\AuthorElement' => '/phar-io-manifest/xml/AuthorElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\AuthorElementCollection' => '/phar-io-manifest/xml/AuthorElementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\BundledComponent' => '/phar-io-manifest/values/BundledComponent.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\BundledComponentCollection' => '/phar-io-manifest/values/BundledComponentCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\BundledComponentCollectionIterator' => '/phar-io-manifest/values/BundledComponentCollectionIterator.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\BundlesElement' => '/phar-io-manifest/xml/BundlesElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ComponentElement' => '/phar-io-manifest/xml/ComponentElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ComponentElementCollection' => '/phar-io-manifest/xml/ComponentElementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ContainsElement' => '/phar-io-manifest/xml/ContainsElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\CopyrightElement' => '/phar-io-manifest/xml/CopyrightElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\CopyrightInformation' => '/phar-io-manifest/values/CopyrightInformation.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ElementCollection' => '/phar-io-manifest/xml/ElementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ElementCollectionException' => '/phar-io-manifest/exceptions/ElementCollectionException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Email' => '/phar-io-manifest/values/Email.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Exception' => '/phar-io-manifest/exceptions/Exception.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ExtElement' => '/phar-io-manifest/xml/ExtElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ExtElementCollection' => '/phar-io-manifest/xml/ExtElementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Extension' => '/phar-io-manifest/values/Extension.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ExtensionElement' => '/phar-io-manifest/xml/ExtensionElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\InvalidApplicationNameException' => '/phar-io-manifest/exceptions/InvalidApplicationNameException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\InvalidEmailException' => '/phar-io-manifest/exceptions/InvalidEmailException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\InvalidUrlException' => '/phar-io-manifest/exceptions/InvalidUrlException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Library' => '/phar-io-manifest/values/Library.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\License' => '/phar-io-manifest/values/License.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\LicenseElement' => '/phar-io-manifest/xml/LicenseElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Manifest' => '/phar-io-manifest/values/Manifest.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocument' => '/phar-io-manifest/xml/ManifestDocument.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocumentException' => '/phar-io-manifest/exceptions/ManifestDocumentException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocumentLoadingException' => '/phar-io-manifest/exceptions/ManifestDocumentLoadingException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocumentMapper' => '/phar-io-manifest/ManifestDocumentMapper.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocumentMapperException' => '/phar-io-manifest/exceptions/ManifestDocumentMapperException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestElement' => '/phar-io-manifest/xml/ManifestElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestElementException' => '/phar-io-manifest/exceptions/ManifestElementException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestLoader' => '/phar-io-manifest/ManifestLoader.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestLoaderException' => '/phar-io-manifest/exceptions/ManifestLoaderException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestSerializer' => '/phar-io-manifest/ManifestSerializer.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\NoEmailAddressException' => '/phar-io-manifest/exceptions/NoEmailAddressException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\PhpElement' => '/phar-io-manifest/xml/PhpElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\PhpExtensionRequirement' => '/phar-io-manifest/values/PhpExtensionRequirement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\PhpVersionRequirement' => '/phar-io-manifest/values/PhpVersionRequirement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Requirement' => '/phar-io-manifest/values/Requirement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\RequirementCollection' => '/phar-io-manifest/values/RequirementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\RequirementCollectionIterator' => '/phar-io-manifest/values/RequirementCollectionIterator.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\RequiresElement' => '/phar-io-manifest/xml/RequiresElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Type' => '/phar-io-manifest/values/Type.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Url' => '/phar-io-manifest/values/Url.php', + 'PHPUnitPHAR\\PharIo\\Version\\AbstractVersionConstraint' => '/phar-io-version/constraints/AbstractVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\AndVersionConstraintGroup' => '/phar-io-version/constraints/AndVersionConstraintGroup.php', + 'PHPUnitPHAR\\PharIo\\Version\\AnyVersionConstraint' => '/phar-io-version/constraints/AnyVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\BuildMetaData' => '/phar-io-version/BuildMetaData.php', + 'PHPUnitPHAR\\PharIo\\Version\\ExactVersionConstraint' => '/phar-io-version/constraints/ExactVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\Exception' => '/phar-io-version/exceptions/Exception.php', + 'PHPUnitPHAR\\PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => '/phar-io-version/constraints/GreaterThanOrEqualToVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\InvalidPreReleaseSuffixException' => '/phar-io-version/exceptions/InvalidPreReleaseSuffixException.php', + 'PHPUnitPHAR\\PharIo\\Version\\InvalidVersionException' => '/phar-io-version/exceptions/InvalidVersionException.php', + 'PHPUnitPHAR\\PharIo\\Version\\NoBuildMetaDataException' => '/phar-io-version/exceptions/NoBuildMetaDataException.php', + 'PHPUnitPHAR\\PharIo\\Version\\NoPreReleaseSuffixException' => '/phar-io-version/exceptions/NoPreReleaseSuffixException.php', + 'PHPUnitPHAR\\PharIo\\Version\\OrVersionConstraintGroup' => '/phar-io-version/constraints/OrVersionConstraintGroup.php', + 'PHPUnitPHAR\\PharIo\\Version\\PreReleaseSuffix' => '/phar-io-version/PreReleaseSuffix.php', + 'PHPUnitPHAR\\PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => '/phar-io-version/constraints/SpecificMajorAndMinorVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\SpecificMajorVersionConstraint' => '/phar-io-version/constraints/SpecificMajorVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\UnsupportedVersionConstraintException' => '/phar-io-version/exceptions/UnsupportedVersionConstraintException.php', + 'PHPUnitPHAR\\PharIo\\Version\\Version' => '/phar-io-version/Version.php', + 'PHPUnitPHAR\\PharIo\\Version\\VersionConstraint' => '/phar-io-version/constraints/VersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\VersionConstraintParser' => '/phar-io-version/VersionConstraintParser.php', + 'PHPUnitPHAR\\PharIo\\Version\\VersionConstraintValue' => '/phar-io-version/VersionConstraintValue.php', + 'PHPUnitPHAR\\PharIo\\Version\\VersionNumber' => '/phar-io-version/VersionNumber.php', + 'PHPUnitPHAR\\PhpParser\\Builder' => '/nikic-php-parser/PhpParser/Builder.php', + 'PHPUnitPHAR\\PhpParser\\BuilderFactory' => '/nikic-php-parser/PhpParser/BuilderFactory.php', + 'PHPUnitPHAR\\PhpParser\\BuilderHelpers' => '/nikic-php-parser/PhpParser/BuilderHelpers.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\ClassConst' => '/nikic-php-parser/PhpParser/Builder/ClassConst.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Class_' => '/nikic-php-parser/PhpParser/Builder/Class_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Declaration' => '/nikic-php-parser/PhpParser/Builder/Declaration.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\EnumCase' => '/nikic-php-parser/PhpParser/Builder/EnumCase.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Enum_' => '/nikic-php-parser/PhpParser/Builder/Enum_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\FunctionLike' => '/nikic-php-parser/PhpParser/Builder/FunctionLike.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Function_' => '/nikic-php-parser/PhpParser/Builder/Function_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Interface_' => '/nikic-php-parser/PhpParser/Builder/Interface_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Method' => '/nikic-php-parser/PhpParser/Builder/Method.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Namespace_' => '/nikic-php-parser/PhpParser/Builder/Namespace_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Param' => '/nikic-php-parser/PhpParser/Builder/Param.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Property' => '/nikic-php-parser/PhpParser/Builder/Property.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\TraitUse' => '/nikic-php-parser/PhpParser/Builder/TraitUse.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\TraitUseAdaptation' => '/nikic-php-parser/PhpParser/Builder/TraitUseAdaptation.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Trait_' => '/nikic-php-parser/PhpParser/Builder/Trait_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Use_' => '/nikic-php-parser/PhpParser/Builder/Use_.php', + 'PHPUnitPHAR\\PhpParser\\Comment' => '/nikic-php-parser/PhpParser/Comment.php', + 'PHPUnitPHAR\\PhpParser\\Comment\\Doc' => '/nikic-php-parser/PhpParser/Comment/Doc.php', + 'PHPUnitPHAR\\PhpParser\\ConstExprEvaluationException' => '/nikic-php-parser/PhpParser/ConstExprEvaluationException.php', + 'PHPUnitPHAR\\PhpParser\\ConstExprEvaluator' => '/nikic-php-parser/PhpParser/ConstExprEvaluator.php', + 'PHPUnitPHAR\\PhpParser\\Error' => '/nikic-php-parser/PhpParser/Error.php', + 'PHPUnitPHAR\\PhpParser\\ErrorHandler' => '/nikic-php-parser/PhpParser/ErrorHandler.php', + 'PHPUnitPHAR\\PhpParser\\ErrorHandler\\Collecting' => '/nikic-php-parser/PhpParser/ErrorHandler/Collecting.php', + 'PHPUnitPHAR\\PhpParser\\ErrorHandler\\Throwing' => '/nikic-php-parser/PhpParser/ErrorHandler/Throwing.php', + 'PHPUnitPHAR\\PhpParser\\Internal\\DiffElem' => '/nikic-php-parser/PhpParser/Internal/DiffElem.php', + 'PHPUnitPHAR\\PhpParser\\Internal\\Differ' => '/nikic-php-parser/PhpParser/Internal/Differ.php', + 'PHPUnitPHAR\\PhpParser\\Internal\\PrintableNewAnonClassNode' => '/nikic-php-parser/PhpParser/Internal/PrintableNewAnonClassNode.php', + 'PHPUnitPHAR\\PhpParser\\Internal\\TokenStream' => '/nikic-php-parser/PhpParser/Internal/TokenStream.php', + 'PHPUnitPHAR\\PhpParser\\JsonDecoder' => '/nikic-php-parser/PhpParser/JsonDecoder.php', + 'PHPUnitPHAR\\PhpParser\\Lexer' => '/nikic-php-parser/PhpParser/Lexer.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\Emulative' => '/nikic-php-parser/PhpParser/Lexer/Emulative.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\CoaleseEqualTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\FlexibleDocStringEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\NumericLiteralSeparatorEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\ReadonlyFunctionTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\ReadonlyTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\ReverseEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\TokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/TokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\NameContext' => '/nikic-php-parser/PhpParser/NameContext.php', + 'PHPUnitPHAR\\PhpParser\\Node' => '/nikic-php-parser/PhpParser/Node.php', + 'PHPUnitPHAR\\PhpParser\\NodeAbstract' => '/nikic-php-parser/PhpParser/NodeAbstract.php', + 'PHPUnitPHAR\\PhpParser\\NodeDumper' => '/nikic-php-parser/PhpParser/NodeDumper.php', + 'PHPUnitPHAR\\PhpParser\\NodeFinder' => '/nikic-php-parser/PhpParser/NodeFinder.php', + 'PHPUnitPHAR\\PhpParser\\NodeTraverser' => '/nikic-php-parser/PhpParser/NodeTraverser.php', + 'PHPUnitPHAR\\PhpParser\\NodeTraverserInterface' => '/nikic-php-parser/PhpParser/NodeTraverserInterface.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitorAbstract' => '/nikic-php-parser/PhpParser/NodeVisitorAbstract.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\CloningVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/CloningVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\FindingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/FindingVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\FirstFindingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/FirstFindingVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\NameResolver' => '/nikic-php-parser/PhpParser/NodeVisitor/NameResolver.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\NodeConnectingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/NodeConnectingVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\ParentConnectingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/ParentConnectingVisitor.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Arg' => '/nikic-php-parser/PhpParser/Node/Arg.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Attribute' => '/nikic-php-parser/PhpParser/Node/Attribute.php', + 'PHPUnitPHAR\\PhpParser\\Node\\AttributeGroup' => '/nikic-php-parser/PhpParser/Node/AttributeGroup.php', + 'PHPUnitPHAR\\PhpParser\\Node\\ComplexType' => '/nikic-php-parser/PhpParser/Node/ComplexType.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Const_' => '/nikic-php-parser/PhpParser/Node/Const_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr' => '/nikic-php-parser/PhpParser/Node/Expr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ArrayDimFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ArrayDimFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ArrayItem' => '/nikic-php-parser/PhpParser/Node/Expr/ArrayItem.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Array_' => '/nikic-php-parser/PhpParser/Node/Expr/Array_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ArrowFunction' => '/nikic-php-parser/PhpParser/Node/Expr/ArrowFunction.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Assign' => '/nikic-php-parser/PhpParser/Node/Expr/Assign.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseOr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseXor.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Coalesce' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Coalesce.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Concat' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Concat.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Div' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Div.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Minus' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Minus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Mod' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mod.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Mul' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mul.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Plus' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Plus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Pow' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Pow.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\ShiftLeft' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftLeft.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\ShiftRight' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftRight.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignRef' => '/nikic-php-parser/PhpParser/Node/Expr/AssignRef.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseXor' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BooleanAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BooleanOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanOr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Coalesce' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Coalesce.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Concat' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Concat.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Div' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Div.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Equal' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Equal.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Greater' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Greater.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\GreaterOrEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Identical' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Identical.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalOr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalXor' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalXor.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Minus' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Minus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Mod' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mod.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Mul' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mul.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\NotEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotEqual.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\NotIdentical' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotIdentical.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Plus' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Plus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Pow' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Pow.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\ShiftLeft' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\ShiftRight' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftRight.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Smaller' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Smaller.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\SmallerOrEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Spaceship.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BitwiseNot' => '/nikic-php-parser/PhpParser/Node/Expr/BitwiseNot.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BooleanNot' => '/nikic-php-parser/PhpParser/Node/Expr/BooleanNot.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\CallLike' => '/nikic-php-parser/PhpParser/Node/Expr/CallLike.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast' => '/nikic-php-parser/PhpParser/Node/Expr/Cast.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Array_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Array_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Bool_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Bool_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Double' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Double.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Int_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Int_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Object_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Object_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\String_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/String_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Unset_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Unset_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ClassConstFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ClassConstFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Clone_' => '/nikic-php-parser/PhpParser/Node/Expr/Clone_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Closure' => '/nikic-php-parser/PhpParser/Node/Expr/Closure.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ClosureUse' => '/nikic-php-parser/PhpParser/Node/Expr/ClosureUse.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ConstFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ConstFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Empty_' => '/nikic-php-parser/PhpParser/Node/Expr/Empty_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Error' => '/nikic-php-parser/PhpParser/Node/Expr/Error.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ErrorSuppress' => '/nikic-php-parser/PhpParser/Node/Expr/ErrorSuppress.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Eval_' => '/nikic-php-parser/PhpParser/Node/Expr/Eval_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Exit_' => '/nikic-php-parser/PhpParser/Node/Expr/Exit_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\FuncCall' => '/nikic-php-parser/PhpParser/Node/Expr/FuncCall.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Include_' => '/nikic-php-parser/PhpParser/Node/Expr/Include_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Instanceof_' => '/nikic-php-parser/PhpParser/Node/Expr/Instanceof_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Isset_' => '/nikic-php-parser/PhpParser/Node/Expr/Isset_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\List_' => '/nikic-php-parser/PhpParser/Node/Expr/List_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Match_' => '/nikic-php-parser/PhpParser/Node/Expr/Match_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\MethodCall' => '/nikic-php-parser/PhpParser/Node/Expr/MethodCall.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\New_' => '/nikic-php-parser/PhpParser/Node/Expr/New_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\NullsafeMethodCall' => '/nikic-php-parser/PhpParser/Node/Expr/NullsafeMethodCall.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\NullsafePropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/NullsafePropertyFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PostDec' => '/nikic-php-parser/PhpParser/Node/Expr/PostDec.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PostInc' => '/nikic-php-parser/PhpParser/Node/Expr/PostInc.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PreDec' => '/nikic-php-parser/PhpParser/Node/Expr/PreDec.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PreInc' => '/nikic-php-parser/PhpParser/Node/Expr/PreInc.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Print_' => '/nikic-php-parser/PhpParser/Node/Expr/Print_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/PropertyFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ShellExec' => '/nikic-php-parser/PhpParser/Node/Expr/ShellExec.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\StaticCall' => '/nikic-php-parser/PhpParser/Node/Expr/StaticCall.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\StaticPropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/StaticPropertyFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Ternary' => '/nikic-php-parser/PhpParser/Node/Expr/Ternary.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Throw_' => '/nikic-php-parser/PhpParser/Node/Expr/Throw_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\UnaryMinus' => '/nikic-php-parser/PhpParser/Node/Expr/UnaryMinus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\UnaryPlus' => '/nikic-php-parser/PhpParser/Node/Expr/UnaryPlus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Variable' => '/nikic-php-parser/PhpParser/Node/Expr/Variable.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\YieldFrom' => '/nikic-php-parser/PhpParser/Node/Expr/YieldFrom.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Yield_' => '/nikic-php-parser/PhpParser/Node/Expr/Yield_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\FunctionLike' => '/nikic-php-parser/PhpParser/Node/FunctionLike.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Identifier' => '/nikic-php-parser/PhpParser/Node/Identifier.php', + 'PHPUnitPHAR\\PhpParser\\Node\\IntersectionType' => '/nikic-php-parser/PhpParser/Node/IntersectionType.php', + 'PHPUnitPHAR\\PhpParser\\Node\\MatchArm' => '/nikic-php-parser/PhpParser/Node/MatchArm.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Name' => '/nikic-php-parser/PhpParser/Node/Name.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Name\\FullyQualified' => '/nikic-php-parser/PhpParser/Node/Name/FullyQualified.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Name\\Relative' => '/nikic-php-parser/PhpParser/Node/Name/Relative.php', + 'PHPUnitPHAR\\PhpParser\\Node\\NullableType' => '/nikic-php-parser/PhpParser/Node/NullableType.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Param' => '/nikic-php-parser/PhpParser/Node/Param.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar' => '/nikic-php-parser/PhpParser/Node/Scalar.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\DNumber' => '/nikic-php-parser/PhpParser/Node/Scalar/DNumber.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\Encapsed' => '/nikic-php-parser/PhpParser/Node/Scalar/Encapsed.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\EncapsedStringPart' => '/nikic-php-parser/PhpParser/Node/Scalar/EncapsedStringPart.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\LNumber' => '/nikic-php-parser/PhpParser/Node/Scalar/LNumber.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Class_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Class_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Dir' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Dir.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\File' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/File.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Function_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Function_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Line' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Line.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Method' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Method.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Namespace_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Trait_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\String_' => '/nikic-php-parser/PhpParser/Node/Scalar/String_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt' => '/nikic-php-parser/PhpParser/Node/Stmt.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Break_' => '/nikic-php-parser/PhpParser/Node/Stmt/Break_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Case_' => '/nikic-php-parser/PhpParser/Node/Stmt/Case_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Catch_' => '/nikic-php-parser/PhpParser/Node/Stmt/Catch_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\ClassConst' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassConst.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\ClassLike' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassLike.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\ClassMethod' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassMethod.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Class_' => '/nikic-php-parser/PhpParser/Node/Stmt/Class_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Const_' => '/nikic-php-parser/PhpParser/Node/Stmt/Const_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Continue_' => '/nikic-php-parser/PhpParser/Node/Stmt/Continue_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\DeclareDeclare' => '/nikic-php-parser/PhpParser/Node/Stmt/DeclareDeclare.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Declare_' => '/nikic-php-parser/PhpParser/Node/Stmt/Declare_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Do_' => '/nikic-php-parser/PhpParser/Node/Stmt/Do_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Echo_' => '/nikic-php-parser/PhpParser/Node/Stmt/Echo_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\ElseIf_' => '/nikic-php-parser/PhpParser/Node/Stmt/ElseIf_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Else_' => '/nikic-php-parser/PhpParser/Node/Stmt/Else_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\EnumCase' => '/nikic-php-parser/PhpParser/Node/Stmt/EnumCase.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Enum_' => '/nikic-php-parser/PhpParser/Node/Stmt/Enum_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Expression' => '/nikic-php-parser/PhpParser/Node/Stmt/Expression.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Finally_' => '/nikic-php-parser/PhpParser/Node/Stmt/Finally_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\For_' => '/nikic-php-parser/PhpParser/Node/Stmt/For_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Foreach_' => '/nikic-php-parser/PhpParser/Node/Stmt/Foreach_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Function_' => '/nikic-php-parser/PhpParser/Node/Stmt/Function_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Global_' => '/nikic-php-parser/PhpParser/Node/Stmt/Global_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Goto_' => '/nikic-php-parser/PhpParser/Node/Stmt/Goto_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\GroupUse' => '/nikic-php-parser/PhpParser/Node/Stmt/GroupUse.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\HaltCompiler' => '/nikic-php-parser/PhpParser/Node/Stmt/HaltCompiler.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\If_' => '/nikic-php-parser/PhpParser/Node/Stmt/If_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\InlineHTML' => '/nikic-php-parser/PhpParser/Node/Stmt/InlineHTML.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Interface_' => '/nikic-php-parser/PhpParser/Node/Stmt/Interface_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Label' => '/nikic-php-parser/PhpParser/Node/Stmt/Label.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Namespace_' => '/nikic-php-parser/PhpParser/Node/Stmt/Namespace_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Nop' => '/nikic-php-parser/PhpParser/Node/Stmt/Nop.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Property' => '/nikic-php-parser/PhpParser/Node/Stmt/Property.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\PropertyProperty' => '/nikic-php-parser/PhpParser/Node/Stmt/PropertyProperty.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Return_' => '/nikic-php-parser/PhpParser/Node/Stmt/Return_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\StaticVar' => '/nikic-php-parser/PhpParser/Node/Stmt/StaticVar.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Static_' => '/nikic-php-parser/PhpParser/Node/Stmt/Static_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Switch_' => '/nikic-php-parser/PhpParser/Node/Stmt/Switch_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Throw_' => '/nikic-php-parser/PhpParser/Node/Stmt/Throw_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TraitUse' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUse.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TraitUseAdaptation' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Precedence' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Trait_' => '/nikic-php-parser/PhpParser/Node/Stmt/Trait_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TryCatch' => '/nikic-php-parser/PhpParser/Node/Stmt/TryCatch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Unset_' => '/nikic-php-parser/PhpParser/Node/Stmt/Unset_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\UseUse' => '/nikic-php-parser/PhpParser/Node/Stmt/UseUse.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Use_' => '/nikic-php-parser/PhpParser/Node/Stmt/Use_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\While_' => '/nikic-php-parser/PhpParser/Node/Stmt/While_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\UnionType' => '/nikic-php-parser/PhpParser/Node/UnionType.php', + 'PHPUnitPHAR\\PhpParser\\Node\\VarLikeIdentifier' => '/nikic-php-parser/PhpParser/Node/VarLikeIdentifier.php', + 'PHPUnitPHAR\\PhpParser\\Node\\VariadicPlaceholder' => '/nikic-php-parser/PhpParser/Node/VariadicPlaceholder.php', + 'PHPUnitPHAR\\PhpParser\\Parser' => '/nikic-php-parser/PhpParser/Parser.php', + 'PHPUnitPHAR\\PhpParser\\ParserAbstract' => '/nikic-php-parser/PhpParser/ParserAbstract.php', + 'PHPUnitPHAR\\PhpParser\\ParserFactory' => '/nikic-php-parser/PhpParser/ParserFactory.php', + 'PHPUnitPHAR\\PhpParser\\Parser\\Multiple' => '/nikic-php-parser/PhpParser/Parser/Multiple.php', + 'PHPUnitPHAR\\PhpParser\\Parser\\Php5' => '/nikic-php-parser/PhpParser/Parser/Php5.php', + 'PHPUnitPHAR\\PhpParser\\Parser\\Php7' => '/nikic-php-parser/PhpParser/Parser/Php7.php', + 'PHPUnitPHAR\\PhpParser\\Parser\\Tokens' => '/nikic-php-parser/PhpParser/Parser/Tokens.php', + 'PHPUnitPHAR\\PhpParser\\PrettyPrinterAbstract' => '/nikic-php-parser/PhpParser/PrettyPrinterAbstract.php', + 'PHPUnitPHAR\\PhpParser\\PrettyPrinter\\Standard' => '/nikic-php-parser/PhpParser/PrettyPrinter/Standard.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\AmbiguousOptionException' => '/sebastian-cli-parser/exceptions/AmbiguousOptionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\Exception' => '/sebastian-cli-parser/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\OptionDoesNotAllowArgumentException' => '/sebastian-cli-parser/exceptions/OptionDoesNotAllowArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\Parser' => '/sebastian-cli-parser/Parser.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\RequiredOptionArgumentMissingException' => '/sebastian-cli-parser/exceptions/RequiredOptionArgumentMissingException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\UnknownOptionException' => '/sebastian-cli-parser/exceptions/UnknownOptionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\BranchAndPathCoverageNotSupportedException' => '/php-code-coverage/Exception/BranchAndPathCoverageNotSupportedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\CodeCoverage' => '/php-code-coverage/CodeCoverage.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\DeadCodeDetectionNotSupportedException' => '/php-code-coverage/Exception/DeadCodeDetectionNotSupportedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Driver' => '/php-code-coverage/Driver/Driver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PathExistsButIsNotDirectoryException' => '/php-code-coverage/Exception/PathExistsButIsNotDirectoryException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PcovDriver' => '/php-code-coverage/Driver/PcovDriver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PcovNotAvailableException' => '/php-code-coverage/Exception/PcovNotAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PhpdbgDriver' => '/php-code-coverage/Driver/PhpdbgDriver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PhpdbgNotAvailableException' => '/php-code-coverage/Exception/PhpdbgNotAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Selector' => '/php-code-coverage/Driver/Selector.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\WriteOperationFailedException' => '/php-code-coverage/Exception/WriteOperationFailedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\WrongXdebugVersionException' => '/php-code-coverage/Exception/WrongXdebugVersionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug2Driver' => '/php-code-coverage/Driver/Xdebug2Driver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug2NotEnabledException' => '/php-code-coverage/Exception/Xdebug2NotEnabledException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug3Driver' => '/php-code-coverage/Driver/Xdebug3Driver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug3NotEnabledException' => '/php-code-coverage/Exception/Xdebug3NotEnabledException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotAvailableException' => '/php-code-coverage/Exception/XdebugNotAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Exception' => '/php-code-coverage/Exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Filter' => '/php-code-coverage/Filter.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => '/php-code-coverage/Exception/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverAvailableException' => '/php-code-coverage/Exception/NoCodeCoverageDriverAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverWithPathCoverageSupportAvailableException' => '/php-code-coverage/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => '/php-code-coverage/Node/AbstractNode.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\Builder' => '/php-code-coverage/Node/Builder.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\CrapIndex' => '/php-code-coverage/Node/CrapIndex.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\Directory' => '/php-code-coverage/Node/Directory.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\File' => '/php-code-coverage/Node/File.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\Iterator' => '/php-code-coverage/Node/Iterator.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\ParserException' => '/php-code-coverage/Exception/ParserException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\ProcessedCodeCoverageData' => '/php-code-coverage/ProcessedCodeCoverageData.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\RawCodeCoverageData' => '/php-code-coverage/RawCodeCoverageData.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\ReflectionException' => '/php-code-coverage/Exception/ReflectionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\ReportAlreadyFinalizedException' => '/php-code-coverage/Exception/ReportAlreadyFinalizedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Clover' => '/php-code-coverage/Report/Clover.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Cobertura' => '/php-code-coverage/Report/Cobertura.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => '/php-code-coverage/Report/Crap4j.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => '/php-code-coverage/Report/Html/Renderer/Dashboard.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => '/php-code-coverage/Report/Html/Renderer/Directory.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => '/php-code-coverage/Report/Html/Facade.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => '/php-code-coverage/Report/Html/Renderer/File.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => '/php-code-coverage/Report/Html/Renderer.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\PHP' => '/php-code-coverage/Report/PHP.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Text' => '/php-code-coverage/Report/Text.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => '/php-code-coverage/Report/Xml/BuildInformation.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => '/php-code-coverage/Report/Xml/Coverage.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => '/php-code-coverage/Report/Xml/Directory.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => '/php-code-coverage/Report/Xml/Facade.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => '/php-code-coverage/Report/Xml/File.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => '/php-code-coverage/Report/Xml/Method.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => '/php-code-coverage/Report/Xml/Node.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => '/php-code-coverage/Report/Xml/Project.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => '/php-code-coverage/Report/Xml/Report.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => '/php-code-coverage/Report/Xml/Source.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => '/php-code-coverage/Report/Xml/Tests.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => '/php-code-coverage/Report/Xml/Totals.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => '/php-code-coverage/Report/Xml/Unit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysisCacheNotConfiguredException' => '/php-code-coverage/Exception/StaticAnalysisCacheNotConfiguredException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CacheWarmer' => '/php-code-coverage/StaticAnalysis/CacheWarmer.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CachingFileAnalyser' => '/php-code-coverage/StaticAnalysis/CachingFileAnalyser.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CodeUnitFindingVisitor' => '/php-code-coverage/StaticAnalysis/CodeUnitFindingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ExecutableLinesFindingVisitor' => '/php-code-coverage/StaticAnalysis/ExecutableLinesFindingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\FileAnalyser' => '/php-code-coverage/StaticAnalysis/FileAnalyser.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\IgnoredLinesFindingVisitor' => '/php-code-coverage/StaticAnalysis/IgnoredLinesFindingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ParsingFileAnalyser' => '/php-code-coverage/StaticAnalysis/ParsingFileAnalyser.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\TestIdMissingException' => '/php-code-coverage/Exception/TestIdMissingException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => '/php-code-coverage/Exception/UnintentionallyCoveredCodeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Util\\DirectoryCouldNotBeCreatedException' => '/php-code-coverage/Exception/DirectoryCouldNotBeCreatedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Util\\Filesystem' => '/php-code-coverage/Util/Filesystem.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Util\\Percentage' => '/php-code-coverage/Util/Percentage.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Version' => '/php-code-coverage/Version.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\XmlException' => '/php-code-coverage/Exception/XmlException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => '/sebastian-code-unit-reverse-lookup/Wizard.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\ClassMethodUnit' => '/sebastian-code-unit/ClassMethodUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\ClassUnit' => '/sebastian-code-unit/ClassUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\CodeUnit' => '/sebastian-code-unit/CodeUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\CodeUnitCollection' => '/sebastian-code-unit/CodeUnitCollection.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\CodeUnitCollectionIterator' => '/sebastian-code-unit/CodeUnitCollectionIterator.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\Exception' => '/sebastian-code-unit/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\FunctionUnit' => '/sebastian-code-unit/FunctionUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\InterfaceMethodUnit' => '/sebastian-code-unit/InterfaceMethodUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\InterfaceUnit' => '/sebastian-code-unit/InterfaceUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\InvalidCodeUnitException' => '/sebastian-code-unit/exceptions/InvalidCodeUnitException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\Mapper' => '/sebastian-code-unit/Mapper.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\NoTraitException' => '/sebastian-code-unit/exceptions/NoTraitException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\ReflectionException' => '/sebastian-code-unit/exceptions/ReflectionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\TraitMethodUnit' => '/sebastian-code-unit/TraitMethodUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\TraitUnit' => '/sebastian-code-unit/TraitUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ArrayComparator' => '/sebastian-comparator/ArrayComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\Comparator' => '/sebastian-comparator/Comparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ComparisonFailure' => '/sebastian-comparator/ComparisonFailure.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\DOMNodeComparator' => '/sebastian-comparator/DOMNodeComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\DateTimeComparator' => '/sebastian-comparator/DateTimeComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\DoubleComparator' => '/sebastian-comparator/DoubleComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\Exception' => '/sebastian-comparator/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ExceptionComparator' => '/sebastian-comparator/ExceptionComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\Factory' => '/sebastian-comparator/Factory.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\MockObjectComparator' => '/sebastian-comparator/MockObjectComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\NumericComparator' => '/sebastian-comparator/NumericComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ObjectComparator' => '/sebastian-comparator/ObjectComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ResourceComparator' => '/sebastian-comparator/ResourceComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\RuntimeException' => '/sebastian-comparator/exceptions/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ScalarComparator' => '/sebastian-comparator/ScalarComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\SplObjectStorageComparator' => '/sebastian-comparator/SplObjectStorageComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\TypeComparator' => '/sebastian-comparator/TypeComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\Calculator' => '/sebastian-complexity/Calculator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\Complexity' => '/sebastian-complexity/Complexity/Complexity.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\ComplexityCalculatingVisitor' => '/sebastian-complexity/Visitor/ComplexityCalculatingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\ComplexityCollection' => '/sebastian-complexity/Complexity/ComplexityCollection.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\ComplexityCollectionIterator' => '/sebastian-complexity/Complexity/ComplexityCollectionIterator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\CyclomaticComplexityCalculatingVisitor' => '/sebastian-complexity/Visitor/CyclomaticComplexityCalculatingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\Exception' => '/sebastian-complexity/Exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\RuntimeException' => '/sebastian-complexity/Exception/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Chunk' => '/sebastian-diff/Chunk.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\ConfigurationException' => '/sebastian-diff/Exception/ConfigurationException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Diff' => '/sebastian-diff/Diff.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Differ' => '/sebastian-diff/Differ.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Exception' => '/sebastian-diff/Exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\InvalidArgumentException' => '/sebastian-diff/Exception/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Line' => '/sebastian-diff/Line.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => '/sebastian-diff/LongestCommonSubsequenceCalculator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => '/sebastian-diff/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => '/sebastian-diff/Output/AbstractChunkOutputBuilder.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => '/sebastian-diff/Output/DiffOnlyOutputBuilder.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => '/sebastian-diff/Output/DiffOutputBuilderInterface.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => '/sebastian-diff/Output/StrictUnifiedDiffOutputBuilder.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => '/sebastian-diff/Output/UnifiedDiffOutputBuilder.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Parser' => '/sebastian-diff/Parser.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => '/sebastian-diff/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Environment\\Console' => '/sebastian-environment/Console.php', + 'PHPUnitPHAR\\SebastianBergmann\\Environment\\OperatingSystem' => '/sebastian-environment/OperatingSystem.php', + 'PHPUnitPHAR\\SebastianBergmann\\Environment\\Runtime' => '/sebastian-environment/Runtime.php', + 'PHPUnitPHAR\\SebastianBergmann\\Exporter\\Exporter' => '/sebastian-exporter/Exporter.php', + 'PHPUnitPHAR\\SebastianBergmann\\FileIterator\\Facade' => '/php-file-iterator/Facade.php', + 'PHPUnitPHAR\\SebastianBergmann\\FileIterator\\Factory' => '/php-file-iterator/Factory.php', + 'PHPUnitPHAR\\SebastianBergmann\\FileIterator\\Iterator' => '/php-file-iterator/Iterator.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\CodeExporter' => '/sebastian-global-state/CodeExporter.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\Exception' => '/sebastian-global-state/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\ExcludeList' => '/sebastian-global-state/ExcludeList.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\Restorer' => '/sebastian-global-state/Restorer.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\RuntimeException' => '/sebastian-global-state/exceptions/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\Snapshot' => '/sebastian-global-state/Snapshot.php', + 'PHPUnitPHAR\\SebastianBergmann\\Invoker\\Exception' => '/php-invoker/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Invoker\\Invoker' => '/php-invoker/Invoker.php', + 'PHPUnitPHAR\\SebastianBergmann\\Invoker\\ProcessControlExtensionNotLoadedException' => '/php-invoker/exceptions/ProcessControlExtensionNotLoadedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Invoker\\TimeoutException' => '/php-invoker/exceptions/TimeoutException.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\Counter' => '/sebastian-lines-of-code/Counter.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\Exception' => '/sebastian-lines-of-code/Exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\IllogicalValuesException' => '/sebastian-lines-of-code/Exception/IllogicalValuesException.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\LineCountingVisitor' => '/sebastian-lines-of-code/LineCountingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\LinesOfCode' => '/sebastian-lines-of-code/LinesOfCode.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\NegativeValueException' => '/sebastian-lines-of-code/Exception/NegativeValueException.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\RuntimeException' => '/sebastian-lines-of-code/Exception/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectEnumerator\\Enumerator' => '/sebastian-object-enumerator/Enumerator.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectEnumerator\\Exception' => '/sebastian-object-enumerator/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => '/sebastian-object-enumerator/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectReflector\\Exception' => '/sebastian-object-reflector/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => '/sebastian-object-reflector/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectReflector\\ObjectReflector' => '/sebastian-object-reflector/ObjectReflector.php', + 'PHPUnitPHAR\\SebastianBergmann\\RecursionContext\\Context' => '/sebastian-recursion-context/Context.php', + 'PHPUnitPHAR\\SebastianBergmann\\RecursionContext\\Exception' => '/sebastian-recursion-context/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\RecursionContext\\InvalidArgumentException' => '/sebastian-recursion-context/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\ResourceOperations\\ResourceOperations' => '/sebastian-resource-operations/ResourceOperations.php', + 'PHPUnitPHAR\\SebastianBergmann\\Template\\Exception' => '/php-text-template/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Template\\InvalidArgumentException' => '/php-text-template/exceptions/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Template\\RuntimeException' => '/php-text-template/exceptions/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Template\\Template' => '/php-text-template/Template.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\Duration' => '/php-timer/Duration.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\Exception' => '/php-timer/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\NoActiveTimerException' => '/php-timer/exceptions/NoActiveTimerException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\ResourceUsageFormatter' => '/php-timer/ResourceUsageFormatter.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\TimeSinceStartOfRequestNotAvailableException' => '/php-timer/exceptions/TimeSinceStartOfRequestNotAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\Timer' => '/php-timer/Timer.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\CallableType' => '/sebastian-type/type/CallableType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\Exception' => '/sebastian-type/exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\FalseType' => '/sebastian-type/type/FalseType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\GenericObjectType' => '/sebastian-type/type/GenericObjectType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\IntersectionType' => '/sebastian-type/type/IntersectionType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\IterableType' => '/sebastian-type/type/IterableType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\MixedType' => '/sebastian-type/type/MixedType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\NeverType' => '/sebastian-type/type/NeverType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\NullType' => '/sebastian-type/type/NullType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\ObjectType' => '/sebastian-type/type/ObjectType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\Parameter' => '/sebastian-type/Parameter.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\ReflectionMapper' => '/sebastian-type/ReflectionMapper.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\RuntimeException' => '/sebastian-type/exception/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\SimpleType' => '/sebastian-type/type/SimpleType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\StaticType' => '/sebastian-type/type/StaticType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\TrueType' => '/sebastian-type/type/TrueType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\Type' => '/sebastian-type/type/Type.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\TypeName' => '/sebastian-type/TypeName.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\UnionType' => '/sebastian-type/type/UnionType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\UnknownType' => '/sebastian-type/type/UnknownType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\VoidType' => '/sebastian-type/type/VoidType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Version' => '/sebastian-version/Version.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\Exception' => '/theseer-tokenizer/Exception.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\NamespaceUri' => '/theseer-tokenizer/NamespaceUri.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\NamespaceUriException' => '/theseer-tokenizer/NamespaceUriException.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\Token' => '/theseer-tokenizer/Token.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\TokenCollection' => '/theseer-tokenizer/TokenCollection.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\TokenCollectionException' => '/theseer-tokenizer/TokenCollectionException.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\Tokenizer' => '/theseer-tokenizer/Tokenizer.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\XMLSerializer' => '/theseer-tokenizer/XMLSerializer.php', + 'PHPUnitPHAR\\Webmozart\\Assert\\Assert' => '/webmozart-assert/Assert.php', + 'PHPUnitPHAR\\Webmozart\\Assert\\InvalidArgumentException' => '/webmozart-assert/InvalidArgumentException.php', + 'PHPUnitPHAR\\Webmozart\\Assert\\Mixin' => '/webmozart-assert/Mixin.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock' => '/phpdocumentor-reflection-docblock/DocBlock.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlockFactory' => '/phpdocumentor-reflection-docblock/DocBlockFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlockFactoryInterface' => '/phpdocumentor-reflection-docblock/DocBlockFactoryInterface.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Description' => '/phpdocumentor-reflection-docblock/DocBlock/Description.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\DescriptionFactory' => '/phpdocumentor-reflection-docblock/DocBlock/DescriptionFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\ExampleFinder' => '/phpdocumentor-reflection-docblock/DocBlock/ExampleFinder.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Serializer' => '/phpdocumentor-reflection-docblock/DocBlock/Serializer.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\StandardTagFactory' => '/phpdocumentor-reflection-docblock/DocBlock/StandardTagFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tag' => '/phpdocumentor-reflection-docblock/DocBlock/Tag.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\TagFactory' => '/phpdocumentor-reflection-docblock/DocBlock/TagFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Author' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Author.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\BaseTag' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/BaseTag.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Covers' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Covers.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Deprecated' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Deprecated.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Example' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Example.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Factory\\StaticMethod' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Factory/StaticMethod.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter\\AlignFormatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/AlignFormatter.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter\\PassthroughFormatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/PassthroughFormatter.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Generic' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Generic.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\InvalidTag' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/InvalidTag.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Link' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Link.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Method' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Method.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Param' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Param.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Property' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Property.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyRead' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyRead.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyWrite' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyWrite.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Fqsen' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Fqsen.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Reference' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Reference.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Url' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Url.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Return_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\See' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/See.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Since' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Since.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Source' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Source.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\TagWithType' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/TagWithType.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Throws' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Throws.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Uses' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Uses.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Var_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Version' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Version.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Element' => '/phpdocumentor-reflection-common/Element.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Exception\\PcreException' => '/phpdocumentor-reflection-docblock/Exception/PcreException.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\File' => '/phpdocumentor-reflection-common/File.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Fqsen' => '/phpdocumentor-reflection-common/Fqsen.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\FqsenResolver' => '/phpdocumentor-type-resolver/FqsenResolver.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Location' => '/phpdocumentor-reflection-common/Location.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Project' => '/phpdocumentor-reflection-common/Project.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\ProjectFactory' => '/phpdocumentor-reflection-common/ProjectFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoType' => '/phpdocumentor-type-resolver/PseudoType.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\ArrayShape' => '/phpdocumentor-type-resolver/PseudoTypes/ArrayShape.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\ArrayShapeItem' => '/phpdocumentor-type-resolver/PseudoTypes/ArrayShapeItem.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\CallableString' => '/phpdocumentor-type-resolver/PseudoTypes/CallableString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\ConstExpression' => '/phpdocumentor-type-resolver/PseudoTypes/ConstExpression.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\False_' => '/phpdocumentor-type-resolver/PseudoTypes/False_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\FloatValue' => '/phpdocumentor-type-resolver/PseudoTypes/FloatValue.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\HtmlEscapedString' => '/phpdocumentor-type-resolver/PseudoTypes/HtmlEscapedString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\IntegerRange' => '/phpdocumentor-type-resolver/PseudoTypes/IntegerRange.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\IntegerValue' => '/phpdocumentor-type-resolver/PseudoTypes/IntegerValue.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\List_' => '/phpdocumentor-type-resolver/PseudoTypes/List_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\LiteralString' => '/phpdocumentor-type-resolver/PseudoTypes/LiteralString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\LowercaseString' => '/phpdocumentor-type-resolver/PseudoTypes/LowercaseString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NegativeInteger' => '/phpdocumentor-type-resolver/PseudoTypes/NegativeInteger.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyList' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyList.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyLowercaseString' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyLowercaseString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyString' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NumericString' => '/phpdocumentor-type-resolver/PseudoTypes/NumericString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\Numeric_' => '/phpdocumentor-type-resolver/PseudoTypes/Numeric_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\PositiveInteger' => '/phpdocumentor-type-resolver/PseudoTypes/PositiveInteger.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\StringValue' => '/phpdocumentor-type-resolver/PseudoTypes/StringValue.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\TraitString' => '/phpdocumentor-type-resolver/PseudoTypes/TraitString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\True_' => '/phpdocumentor-type-resolver/PseudoTypes/True_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Type' => '/phpdocumentor-type-resolver/Type.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\TypeResolver' => '/phpdocumentor-type-resolver/TypeResolver.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\AbstractList' => '/phpdocumentor-type-resolver/Types/AbstractList.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\AggregatedType' => '/phpdocumentor-type-resolver/Types/AggregatedType.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\ArrayKey' => '/phpdocumentor-type-resolver/Types/ArrayKey.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Array_' => '/phpdocumentor-type-resolver/Types/Array_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Boolean' => '/phpdocumentor-type-resolver/Types/Boolean.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\CallableParameter' => '/phpdocumentor-type-resolver/Types/CallableParameter.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Callable_' => '/phpdocumentor-type-resolver/Types/Callable_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\ClassString' => '/phpdocumentor-type-resolver/Types/ClassString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Collection' => '/phpdocumentor-type-resolver/Types/Collection.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Compound' => '/phpdocumentor-type-resolver/Types/Compound.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Context' => '/phpdocumentor-type-resolver/Types/Context.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\ContextFactory' => '/phpdocumentor-type-resolver/Types/ContextFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Expression' => '/phpdocumentor-type-resolver/Types/Expression.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Float_' => '/phpdocumentor-type-resolver/Types/Float_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Integer' => '/phpdocumentor-type-resolver/Types/Integer.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\InterfaceString' => '/phpdocumentor-type-resolver/Types/InterfaceString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Intersection' => '/phpdocumentor-type-resolver/Types/Intersection.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Iterable_' => '/phpdocumentor-type-resolver/Types/Iterable_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Mixed_' => '/phpdocumentor-type-resolver/Types/Mixed_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Never_' => '/phpdocumentor-type-resolver/Types/Never_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Null_' => '/phpdocumentor-type-resolver/Types/Null_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Nullable' => '/phpdocumentor-type-resolver/Types/Nullable.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Object_' => '/phpdocumentor-type-resolver/Types/Object_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Parent_' => '/phpdocumentor-type-resolver/Types/Parent_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Resource_' => '/phpdocumentor-type-resolver/Types/Resource_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Scalar' => '/phpdocumentor-type-resolver/Types/Scalar.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Self_' => '/phpdocumentor-type-resolver/Types/Self_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Static_' => '/phpdocumentor-type-resolver/Types/Static_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\String_' => '/phpdocumentor-type-resolver/Types/String_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\This' => '/phpdocumentor-type-resolver/Types/This.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Void_' => '/phpdocumentor-type-resolver/Types/Void_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Utils' => '/phpdocumentor-reflection-docblock/Utils.php', 'PHPUnit\\Exception' => '/phpunit/Exception.php', 'PHPUnit\\Framework\\ActualValueIsNotAnObjectException' => '/phpunit/Framework/Exception/ActualValueIsNotAnObjectException.php', 'PHPUnit\\Framework\\Assert' => '/phpunit/Framework/Assert.php', @@ -292,327 +1019,6 @@ spl_autoload_register( 'PHPUnit\\Framework\\UnintentionallyCoveredCodeError' => '/phpunit/Framework/Exception/UnintentionallyCoveredCodeError.php', 'PHPUnit\\Framework\\Warning' => '/phpunit/Framework/Exception/Warning.php', 'PHPUnit\\Framework\\WarningTestCase' => '/phpunit/Framework/WarningTestCase.php', - 'PHPUnit\\PharIo\\Manifest\\Application' => '/phar-io-manifest/values/Application.php', - 'PHPUnit\\PharIo\\Manifest\\ApplicationName' => '/phar-io-manifest/values/ApplicationName.php', - 'PHPUnit\\PharIo\\Manifest\\Author' => '/phar-io-manifest/values/Author.php', - 'PHPUnit\\PharIo\\Manifest\\AuthorCollection' => '/phar-io-manifest/values/AuthorCollection.php', - 'PHPUnit\\PharIo\\Manifest\\AuthorCollectionIterator' => '/phar-io-manifest/values/AuthorCollectionIterator.php', - 'PHPUnit\\PharIo\\Manifest\\AuthorElement' => '/phar-io-manifest/xml/AuthorElement.php', - 'PHPUnit\\PharIo\\Manifest\\AuthorElementCollection' => '/phar-io-manifest/xml/AuthorElementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\BundledComponent' => '/phar-io-manifest/values/BundledComponent.php', - 'PHPUnit\\PharIo\\Manifest\\BundledComponentCollection' => '/phar-io-manifest/values/BundledComponentCollection.php', - 'PHPUnit\\PharIo\\Manifest\\BundledComponentCollectionIterator' => '/phar-io-manifest/values/BundledComponentCollectionIterator.php', - 'PHPUnit\\PharIo\\Manifest\\BundlesElement' => '/phar-io-manifest/xml/BundlesElement.php', - 'PHPUnit\\PharIo\\Manifest\\ComponentElement' => '/phar-io-manifest/xml/ComponentElement.php', - 'PHPUnit\\PharIo\\Manifest\\ComponentElementCollection' => '/phar-io-manifest/xml/ComponentElementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\ContainsElement' => '/phar-io-manifest/xml/ContainsElement.php', - 'PHPUnit\\PharIo\\Manifest\\CopyrightElement' => '/phar-io-manifest/xml/CopyrightElement.php', - 'PHPUnit\\PharIo\\Manifest\\CopyrightInformation' => '/phar-io-manifest/values/CopyrightInformation.php', - 'PHPUnit\\PharIo\\Manifest\\ElementCollection' => '/phar-io-manifest/xml/ElementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\ElementCollectionException' => '/phar-io-manifest/exceptions/ElementCollectionException.php', - 'PHPUnit\\PharIo\\Manifest\\Email' => '/phar-io-manifest/values/Email.php', - 'PHPUnit\\PharIo\\Manifest\\Exception' => '/phar-io-manifest/exceptions/Exception.php', - 'PHPUnit\\PharIo\\Manifest\\ExtElement' => '/phar-io-manifest/xml/ExtElement.php', - 'PHPUnit\\PharIo\\Manifest\\ExtElementCollection' => '/phar-io-manifest/xml/ExtElementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\Extension' => '/phar-io-manifest/values/Extension.php', - 'PHPUnit\\PharIo\\Manifest\\ExtensionElement' => '/phar-io-manifest/xml/ExtensionElement.php', - 'PHPUnit\\PharIo\\Manifest\\InvalidApplicationNameException' => '/phar-io-manifest/exceptions/InvalidApplicationNameException.php', - 'PHPUnit\\PharIo\\Manifest\\InvalidEmailException' => '/phar-io-manifest/exceptions/InvalidEmailException.php', - 'PHPUnit\\PharIo\\Manifest\\InvalidUrlException' => '/phar-io-manifest/exceptions/InvalidUrlException.php', - 'PHPUnit\\PharIo\\Manifest\\Library' => '/phar-io-manifest/values/Library.php', - 'PHPUnit\\PharIo\\Manifest\\License' => '/phar-io-manifest/values/License.php', - 'PHPUnit\\PharIo\\Manifest\\LicenseElement' => '/phar-io-manifest/xml/LicenseElement.php', - 'PHPUnit\\PharIo\\Manifest\\Manifest' => '/phar-io-manifest/values/Manifest.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocument' => '/phar-io-manifest/xml/ManifestDocument.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocumentException' => '/phar-io-manifest/exceptions/ManifestDocumentException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocumentLoadingException' => '/phar-io-manifest/exceptions/ManifestDocumentLoadingException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocumentMapper' => '/phar-io-manifest/ManifestDocumentMapper.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocumentMapperException' => '/phar-io-manifest/exceptions/ManifestDocumentMapperException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestElement' => '/phar-io-manifest/xml/ManifestElement.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestElementException' => '/phar-io-manifest/exceptions/ManifestElementException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestLoader' => '/phar-io-manifest/ManifestLoader.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestLoaderException' => '/phar-io-manifest/exceptions/ManifestLoaderException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestSerializer' => '/phar-io-manifest/ManifestSerializer.php', - 'PHPUnit\\PharIo\\Manifest\\PhpElement' => '/phar-io-manifest/xml/PhpElement.php', - 'PHPUnit\\PharIo\\Manifest\\PhpExtensionRequirement' => '/phar-io-manifest/values/PhpExtensionRequirement.php', - 'PHPUnit\\PharIo\\Manifest\\PhpVersionRequirement' => '/phar-io-manifest/values/PhpVersionRequirement.php', - 'PHPUnit\\PharIo\\Manifest\\Requirement' => '/phar-io-manifest/values/Requirement.php', - 'PHPUnit\\PharIo\\Manifest\\RequirementCollection' => '/phar-io-manifest/values/RequirementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\RequirementCollectionIterator' => '/phar-io-manifest/values/RequirementCollectionIterator.php', - 'PHPUnit\\PharIo\\Manifest\\RequiresElement' => '/phar-io-manifest/xml/RequiresElement.php', - 'PHPUnit\\PharIo\\Manifest\\Type' => '/phar-io-manifest/values/Type.php', - 'PHPUnit\\PharIo\\Manifest\\Url' => '/phar-io-manifest/values/Url.php', - 'PHPUnit\\PharIo\\Version\\AbstractVersionConstraint' => '/phar-io-version/constraints/AbstractVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\AndVersionConstraintGroup' => '/phar-io-version/constraints/AndVersionConstraintGroup.php', - 'PHPUnit\\PharIo\\Version\\AnyVersionConstraint' => '/phar-io-version/constraints/AnyVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\BuildMetaData' => '/phar-io-version/BuildMetaData.php', - 'PHPUnit\\PharIo\\Version\\ExactVersionConstraint' => '/phar-io-version/constraints/ExactVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\Exception' => '/phar-io-version/exceptions/Exception.php', - 'PHPUnit\\PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => '/phar-io-version/constraints/GreaterThanOrEqualToVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\InvalidPreReleaseSuffixException' => '/phar-io-version/exceptions/InvalidPreReleaseSuffixException.php', - 'PHPUnit\\PharIo\\Version\\InvalidVersionException' => '/phar-io-version/exceptions/InvalidVersionException.php', - 'PHPUnit\\PharIo\\Version\\NoBuildMetaDataException' => '/phar-io-version/exceptions/NoBuildMetaDataException.php', - 'PHPUnit\\PharIo\\Version\\NoPreReleaseSuffixException' => '/phar-io-version/exceptions/NoPreReleaseSuffixException.php', - 'PHPUnit\\PharIo\\Version\\OrVersionConstraintGroup' => '/phar-io-version/constraints/OrVersionConstraintGroup.php', - 'PHPUnit\\PharIo\\Version\\PreReleaseSuffix' => '/phar-io-version/PreReleaseSuffix.php', - 'PHPUnit\\PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => '/phar-io-version/constraints/SpecificMajorAndMinorVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\SpecificMajorVersionConstraint' => '/phar-io-version/constraints/SpecificMajorVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\UnsupportedVersionConstraintException' => '/phar-io-version/exceptions/UnsupportedVersionConstraintException.php', - 'PHPUnit\\PharIo\\Version\\Version' => '/phar-io-version/Version.php', - 'PHPUnit\\PharIo\\Version\\VersionConstraint' => '/phar-io-version/constraints/VersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\VersionConstraintParser' => '/phar-io-version/VersionConstraintParser.php', - 'PHPUnit\\PharIo\\Version\\VersionConstraintValue' => '/phar-io-version/VersionConstraintValue.php', - 'PHPUnit\\PharIo\\Version\\VersionNumber' => '/phar-io-version/VersionNumber.php', - 'PHPUnit\\PhpParser\\Builder' => '/nikic-php-parser/PhpParser/Builder.php', - 'PHPUnit\\PhpParser\\BuilderFactory' => '/nikic-php-parser/PhpParser/BuilderFactory.php', - 'PHPUnit\\PhpParser\\BuilderHelpers' => '/nikic-php-parser/PhpParser/BuilderHelpers.php', - 'PHPUnit\\PhpParser\\Builder\\ClassConst' => '/nikic-php-parser/PhpParser/Builder/ClassConst.php', - 'PHPUnit\\PhpParser\\Builder\\Class_' => '/nikic-php-parser/PhpParser/Builder/Class_.php', - 'PHPUnit\\PhpParser\\Builder\\Declaration' => '/nikic-php-parser/PhpParser/Builder/Declaration.php', - 'PHPUnit\\PhpParser\\Builder\\EnumCase' => '/nikic-php-parser/PhpParser/Builder/EnumCase.php', - 'PHPUnit\\PhpParser\\Builder\\Enum_' => '/nikic-php-parser/PhpParser/Builder/Enum_.php', - 'PHPUnit\\PhpParser\\Builder\\FunctionLike' => '/nikic-php-parser/PhpParser/Builder/FunctionLike.php', - 'PHPUnit\\PhpParser\\Builder\\Function_' => '/nikic-php-parser/PhpParser/Builder/Function_.php', - 'PHPUnit\\PhpParser\\Builder\\Interface_' => '/nikic-php-parser/PhpParser/Builder/Interface_.php', - 'PHPUnit\\PhpParser\\Builder\\Method' => '/nikic-php-parser/PhpParser/Builder/Method.php', - 'PHPUnit\\PhpParser\\Builder\\Namespace_' => '/nikic-php-parser/PhpParser/Builder/Namespace_.php', - 'PHPUnit\\PhpParser\\Builder\\Param' => '/nikic-php-parser/PhpParser/Builder/Param.php', - 'PHPUnit\\PhpParser\\Builder\\Property' => '/nikic-php-parser/PhpParser/Builder/Property.php', - 'PHPUnit\\PhpParser\\Builder\\TraitUse' => '/nikic-php-parser/PhpParser/Builder/TraitUse.php', - 'PHPUnit\\PhpParser\\Builder\\TraitUseAdaptation' => '/nikic-php-parser/PhpParser/Builder/TraitUseAdaptation.php', - 'PHPUnit\\PhpParser\\Builder\\Trait_' => '/nikic-php-parser/PhpParser/Builder/Trait_.php', - 'PHPUnit\\PhpParser\\Builder\\Use_' => '/nikic-php-parser/PhpParser/Builder/Use_.php', - 'PHPUnit\\PhpParser\\Comment' => '/nikic-php-parser/PhpParser/Comment.php', - 'PHPUnit\\PhpParser\\Comment\\Doc' => '/nikic-php-parser/PhpParser/Comment/Doc.php', - 'PHPUnit\\PhpParser\\ConstExprEvaluationException' => '/nikic-php-parser/PhpParser/ConstExprEvaluationException.php', - 'PHPUnit\\PhpParser\\ConstExprEvaluator' => '/nikic-php-parser/PhpParser/ConstExprEvaluator.php', - 'PHPUnit\\PhpParser\\Error' => '/nikic-php-parser/PhpParser/Error.php', - 'PHPUnit\\PhpParser\\ErrorHandler' => '/nikic-php-parser/PhpParser/ErrorHandler.php', - 'PHPUnit\\PhpParser\\ErrorHandler\\Collecting' => '/nikic-php-parser/PhpParser/ErrorHandler/Collecting.php', - 'PHPUnit\\PhpParser\\ErrorHandler\\Throwing' => '/nikic-php-parser/PhpParser/ErrorHandler/Throwing.php', - 'PHPUnit\\PhpParser\\Internal\\DiffElem' => '/nikic-php-parser/PhpParser/Internal/DiffElem.php', - 'PHPUnit\\PhpParser\\Internal\\Differ' => '/nikic-php-parser/PhpParser/Internal/Differ.php', - 'PHPUnit\\PhpParser\\Internal\\PrintableNewAnonClassNode' => '/nikic-php-parser/PhpParser/Internal/PrintableNewAnonClassNode.php', - 'PHPUnit\\PhpParser\\Internal\\TokenStream' => '/nikic-php-parser/PhpParser/Internal/TokenStream.php', - 'PHPUnit\\PhpParser\\JsonDecoder' => '/nikic-php-parser/PhpParser/JsonDecoder.php', - 'PHPUnit\\PhpParser\\Lexer' => '/nikic-php-parser/PhpParser/Lexer.php', - 'PHPUnit\\PhpParser\\Lexer\\Emulative' => '/nikic-php-parser/PhpParser/Lexer/Emulative.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\CoaleseEqualTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\FlexibleDocStringEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\NumericLiteralSeparatorEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\ReadonlyFunctionTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\ReadonlyTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\ReverseEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\TokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/TokenEmulator.php', - 'PHPUnit\\PhpParser\\NameContext' => '/nikic-php-parser/PhpParser/NameContext.php', - 'PHPUnit\\PhpParser\\Node' => '/nikic-php-parser/PhpParser/Node.php', - 'PHPUnit\\PhpParser\\NodeAbstract' => '/nikic-php-parser/PhpParser/NodeAbstract.php', - 'PHPUnit\\PhpParser\\NodeDumper' => '/nikic-php-parser/PhpParser/NodeDumper.php', - 'PHPUnit\\PhpParser\\NodeFinder' => '/nikic-php-parser/PhpParser/NodeFinder.php', - 'PHPUnit\\PhpParser\\NodeTraverser' => '/nikic-php-parser/PhpParser/NodeTraverser.php', - 'PHPUnit\\PhpParser\\NodeTraverserInterface' => '/nikic-php-parser/PhpParser/NodeTraverserInterface.php', - 'PHPUnit\\PhpParser\\NodeVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitorAbstract' => '/nikic-php-parser/PhpParser/NodeVisitorAbstract.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\CloningVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/CloningVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\FindingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/FindingVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\FirstFindingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/FirstFindingVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\NameResolver' => '/nikic-php-parser/PhpParser/NodeVisitor/NameResolver.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\NodeConnectingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/NodeConnectingVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\ParentConnectingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/ParentConnectingVisitor.php', - 'PHPUnit\\PhpParser\\Node\\Arg' => '/nikic-php-parser/PhpParser/Node/Arg.php', - 'PHPUnit\\PhpParser\\Node\\Attribute' => '/nikic-php-parser/PhpParser/Node/Attribute.php', - 'PHPUnit\\PhpParser\\Node\\AttributeGroup' => '/nikic-php-parser/PhpParser/Node/AttributeGroup.php', - 'PHPUnit\\PhpParser\\Node\\ComplexType' => '/nikic-php-parser/PhpParser/Node/ComplexType.php', - 'PHPUnit\\PhpParser\\Node\\Const_' => '/nikic-php-parser/PhpParser/Node/Const_.php', - 'PHPUnit\\PhpParser\\Node\\Expr' => '/nikic-php-parser/PhpParser/Node/Expr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ArrayDimFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ArrayDimFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ArrayItem' => '/nikic-php-parser/PhpParser/Node/Expr/ArrayItem.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Array_' => '/nikic-php-parser/PhpParser/Node/Expr/Array_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ArrowFunction' => '/nikic-php-parser/PhpParser/Node/Expr/ArrowFunction.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Assign' => '/nikic-php-parser/PhpParser/Node/Expr/Assign.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseOr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseXor.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Coalesce' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Coalesce.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Concat' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Concat.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Div' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Div.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Minus' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Minus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Mod' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mod.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Mul' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mul.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Plus' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Plus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Pow' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Pow.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\ShiftLeft' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftLeft.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\ShiftRight' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftRight.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignRef' => '/nikic-php-parser/PhpParser/Node/Expr/AssignRef.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseXor' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BooleanAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BooleanOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanOr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Coalesce' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Coalesce.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Concat' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Concat.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Div' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Div.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Equal' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Equal.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Greater' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Greater.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\GreaterOrEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Identical' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Identical.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalOr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalXor' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalXor.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Minus' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Minus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Mod' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mod.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Mul' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mul.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\NotEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotEqual.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\NotIdentical' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotIdentical.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Plus' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Plus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Pow' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Pow.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\ShiftLeft' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\ShiftRight' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftRight.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Smaller' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Smaller.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\SmallerOrEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Spaceship.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BitwiseNot' => '/nikic-php-parser/PhpParser/Node/Expr/BitwiseNot.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BooleanNot' => '/nikic-php-parser/PhpParser/Node/Expr/BooleanNot.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\CallLike' => '/nikic-php-parser/PhpParser/Node/Expr/CallLike.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast' => '/nikic-php-parser/PhpParser/Node/Expr/Cast.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Array_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Array_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Bool_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Bool_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Double' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Double.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Int_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Int_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Object_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Object_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\String_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/String_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Unset_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Unset_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ClassConstFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ClassConstFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Clone_' => '/nikic-php-parser/PhpParser/Node/Expr/Clone_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Closure' => '/nikic-php-parser/PhpParser/Node/Expr/Closure.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ClosureUse' => '/nikic-php-parser/PhpParser/Node/Expr/ClosureUse.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ConstFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ConstFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Empty_' => '/nikic-php-parser/PhpParser/Node/Expr/Empty_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Error' => '/nikic-php-parser/PhpParser/Node/Expr/Error.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ErrorSuppress' => '/nikic-php-parser/PhpParser/Node/Expr/ErrorSuppress.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Eval_' => '/nikic-php-parser/PhpParser/Node/Expr/Eval_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Exit_' => '/nikic-php-parser/PhpParser/Node/Expr/Exit_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\FuncCall' => '/nikic-php-parser/PhpParser/Node/Expr/FuncCall.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Include_' => '/nikic-php-parser/PhpParser/Node/Expr/Include_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Instanceof_' => '/nikic-php-parser/PhpParser/Node/Expr/Instanceof_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Isset_' => '/nikic-php-parser/PhpParser/Node/Expr/Isset_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\List_' => '/nikic-php-parser/PhpParser/Node/Expr/List_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Match_' => '/nikic-php-parser/PhpParser/Node/Expr/Match_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\MethodCall' => '/nikic-php-parser/PhpParser/Node/Expr/MethodCall.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\New_' => '/nikic-php-parser/PhpParser/Node/Expr/New_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\NullsafeMethodCall' => '/nikic-php-parser/PhpParser/Node/Expr/NullsafeMethodCall.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\NullsafePropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/NullsafePropertyFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PostDec' => '/nikic-php-parser/PhpParser/Node/Expr/PostDec.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PostInc' => '/nikic-php-parser/PhpParser/Node/Expr/PostInc.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PreDec' => '/nikic-php-parser/PhpParser/Node/Expr/PreDec.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PreInc' => '/nikic-php-parser/PhpParser/Node/Expr/PreInc.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Print_' => '/nikic-php-parser/PhpParser/Node/Expr/Print_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/PropertyFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ShellExec' => '/nikic-php-parser/PhpParser/Node/Expr/ShellExec.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\StaticCall' => '/nikic-php-parser/PhpParser/Node/Expr/StaticCall.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\StaticPropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/StaticPropertyFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Ternary' => '/nikic-php-parser/PhpParser/Node/Expr/Ternary.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Throw_' => '/nikic-php-parser/PhpParser/Node/Expr/Throw_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\UnaryMinus' => '/nikic-php-parser/PhpParser/Node/Expr/UnaryMinus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\UnaryPlus' => '/nikic-php-parser/PhpParser/Node/Expr/UnaryPlus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Variable' => '/nikic-php-parser/PhpParser/Node/Expr/Variable.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\YieldFrom' => '/nikic-php-parser/PhpParser/Node/Expr/YieldFrom.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Yield_' => '/nikic-php-parser/PhpParser/Node/Expr/Yield_.php', - 'PHPUnit\\PhpParser\\Node\\FunctionLike' => '/nikic-php-parser/PhpParser/Node/FunctionLike.php', - 'PHPUnit\\PhpParser\\Node\\Identifier' => '/nikic-php-parser/PhpParser/Node/Identifier.php', - 'PHPUnit\\PhpParser\\Node\\IntersectionType' => '/nikic-php-parser/PhpParser/Node/IntersectionType.php', - 'PHPUnit\\PhpParser\\Node\\MatchArm' => '/nikic-php-parser/PhpParser/Node/MatchArm.php', - 'PHPUnit\\PhpParser\\Node\\Name' => '/nikic-php-parser/PhpParser/Node/Name.php', - 'PHPUnit\\PhpParser\\Node\\Name\\FullyQualified' => '/nikic-php-parser/PhpParser/Node/Name/FullyQualified.php', - 'PHPUnit\\PhpParser\\Node\\Name\\Relative' => '/nikic-php-parser/PhpParser/Node/Name/Relative.php', - 'PHPUnit\\PhpParser\\Node\\NullableType' => '/nikic-php-parser/PhpParser/Node/NullableType.php', - 'PHPUnit\\PhpParser\\Node\\Param' => '/nikic-php-parser/PhpParser/Node/Param.php', - 'PHPUnit\\PhpParser\\Node\\Scalar' => '/nikic-php-parser/PhpParser/Node/Scalar.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\DNumber' => '/nikic-php-parser/PhpParser/Node/Scalar/DNumber.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\Encapsed' => '/nikic-php-parser/PhpParser/Node/Scalar/Encapsed.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\EncapsedStringPart' => '/nikic-php-parser/PhpParser/Node/Scalar/EncapsedStringPart.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\LNumber' => '/nikic-php-parser/PhpParser/Node/Scalar/LNumber.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Class_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Class_.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Dir' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Dir.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\File' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/File.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Function_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Function_.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Line' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Line.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Method' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Method.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Namespace_.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Trait_.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\String_' => '/nikic-php-parser/PhpParser/Node/Scalar/String_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt' => '/nikic-php-parser/PhpParser/Node/Stmt.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Break_' => '/nikic-php-parser/PhpParser/Node/Stmt/Break_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Case_' => '/nikic-php-parser/PhpParser/Node/Stmt/Case_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Catch_' => '/nikic-php-parser/PhpParser/Node/Stmt/Catch_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\ClassConst' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassConst.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\ClassLike' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassLike.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\ClassMethod' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassMethod.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Class_' => '/nikic-php-parser/PhpParser/Node/Stmt/Class_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Const_' => '/nikic-php-parser/PhpParser/Node/Stmt/Const_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Continue_' => '/nikic-php-parser/PhpParser/Node/Stmt/Continue_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\DeclareDeclare' => '/nikic-php-parser/PhpParser/Node/Stmt/DeclareDeclare.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Declare_' => '/nikic-php-parser/PhpParser/Node/Stmt/Declare_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Do_' => '/nikic-php-parser/PhpParser/Node/Stmt/Do_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Echo_' => '/nikic-php-parser/PhpParser/Node/Stmt/Echo_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\ElseIf_' => '/nikic-php-parser/PhpParser/Node/Stmt/ElseIf_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Else_' => '/nikic-php-parser/PhpParser/Node/Stmt/Else_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\EnumCase' => '/nikic-php-parser/PhpParser/Node/Stmt/EnumCase.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Enum_' => '/nikic-php-parser/PhpParser/Node/Stmt/Enum_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Expression' => '/nikic-php-parser/PhpParser/Node/Stmt/Expression.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Finally_' => '/nikic-php-parser/PhpParser/Node/Stmt/Finally_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\For_' => '/nikic-php-parser/PhpParser/Node/Stmt/For_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Foreach_' => '/nikic-php-parser/PhpParser/Node/Stmt/Foreach_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Function_' => '/nikic-php-parser/PhpParser/Node/Stmt/Function_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Global_' => '/nikic-php-parser/PhpParser/Node/Stmt/Global_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Goto_' => '/nikic-php-parser/PhpParser/Node/Stmt/Goto_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\GroupUse' => '/nikic-php-parser/PhpParser/Node/Stmt/GroupUse.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\HaltCompiler' => '/nikic-php-parser/PhpParser/Node/Stmt/HaltCompiler.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\If_' => '/nikic-php-parser/PhpParser/Node/Stmt/If_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\InlineHTML' => '/nikic-php-parser/PhpParser/Node/Stmt/InlineHTML.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Interface_' => '/nikic-php-parser/PhpParser/Node/Stmt/Interface_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Label' => '/nikic-php-parser/PhpParser/Node/Stmt/Label.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Namespace_' => '/nikic-php-parser/PhpParser/Node/Stmt/Namespace_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Nop' => '/nikic-php-parser/PhpParser/Node/Stmt/Nop.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Property' => '/nikic-php-parser/PhpParser/Node/Stmt/Property.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\PropertyProperty' => '/nikic-php-parser/PhpParser/Node/Stmt/PropertyProperty.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Return_' => '/nikic-php-parser/PhpParser/Node/Stmt/Return_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\StaticVar' => '/nikic-php-parser/PhpParser/Node/Stmt/StaticVar.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Static_' => '/nikic-php-parser/PhpParser/Node/Stmt/Static_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Switch_' => '/nikic-php-parser/PhpParser/Node/Stmt/Switch_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Throw_' => '/nikic-php-parser/PhpParser/Node/Stmt/Throw_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TraitUse' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUse.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TraitUseAdaptation' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Precedence' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Trait_' => '/nikic-php-parser/PhpParser/Node/Stmt/Trait_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TryCatch' => '/nikic-php-parser/PhpParser/Node/Stmt/TryCatch.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Unset_' => '/nikic-php-parser/PhpParser/Node/Stmt/Unset_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\UseUse' => '/nikic-php-parser/PhpParser/Node/Stmt/UseUse.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Use_' => '/nikic-php-parser/PhpParser/Node/Stmt/Use_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\While_' => '/nikic-php-parser/PhpParser/Node/Stmt/While_.php', - 'PHPUnit\\PhpParser\\Node\\UnionType' => '/nikic-php-parser/PhpParser/Node/UnionType.php', - 'PHPUnit\\PhpParser\\Node\\VarLikeIdentifier' => '/nikic-php-parser/PhpParser/Node/VarLikeIdentifier.php', - 'PHPUnit\\PhpParser\\Node\\VariadicPlaceholder' => '/nikic-php-parser/PhpParser/Node/VariadicPlaceholder.php', - 'PHPUnit\\PhpParser\\Parser' => '/nikic-php-parser/PhpParser/Parser.php', - 'PHPUnit\\PhpParser\\ParserAbstract' => '/nikic-php-parser/PhpParser/ParserAbstract.php', - 'PHPUnit\\PhpParser\\ParserFactory' => '/nikic-php-parser/PhpParser/ParserFactory.php', - 'PHPUnit\\PhpParser\\Parser\\Multiple' => '/nikic-php-parser/PhpParser/Parser/Multiple.php', - 'PHPUnit\\PhpParser\\Parser\\Php5' => '/nikic-php-parser/PhpParser/Parser/Php5.php', - 'PHPUnit\\PhpParser\\Parser\\Php7' => '/nikic-php-parser/PhpParser/Parser/Php7.php', - 'PHPUnit\\PhpParser\\Parser\\Tokens' => '/nikic-php-parser/PhpParser/Parser/Tokens.php', - 'PHPUnit\\PhpParser\\PrettyPrinterAbstract' => '/nikic-php-parser/PhpParser/PrettyPrinterAbstract.php', - 'PHPUnit\\PhpParser\\PrettyPrinter\\Standard' => '/nikic-php-parser/PhpParser/PrettyPrinter/Standard.php', 'PHPUnit\\Runner\\AfterIncompleteTestHook' => '/phpunit/Runner/Hook/AfterIncompleteTestHook.php', 'PHPUnit\\Runner\\AfterLastTestHook' => '/phpunit/Runner/Hook/AfterLastTestHook.php', 'PHPUnit\\Runner\\AfterRiskyTestHook' => '/phpunit/Runner/Hook/AfterRiskyTestHook.php', @@ -645,206 +1051,6 @@ spl_autoload_register( 'PHPUnit\\Runner\\TestSuiteLoader' => '/phpunit/Runner/TestSuiteLoader.php', 'PHPUnit\\Runner\\TestSuiteSorter' => '/phpunit/Runner/TestSuiteSorter.php', 'PHPUnit\\Runner\\Version' => '/phpunit/Runner/Version.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\AmbiguousOptionException' => '/sebastian-cli-parser/exceptions/AmbiguousOptionException.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\Exception' => '/sebastian-cli-parser/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\OptionDoesNotAllowArgumentException' => '/sebastian-cli-parser/exceptions/OptionDoesNotAllowArgumentException.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\Parser' => '/sebastian-cli-parser/Parser.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\RequiredOptionArgumentMissingException' => '/sebastian-cli-parser/exceptions/RequiredOptionArgumentMissingException.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\UnknownOptionException' => '/sebastian-cli-parser/exceptions/UnknownOptionException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\BranchAndPathCoverageNotSupportedException' => '/php-code-coverage/Exception/BranchAndPathCoverageNotSupportedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\CodeCoverage' => '/php-code-coverage/CodeCoverage.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\DeadCodeDetectionNotSupportedException' => '/php-code-coverage/Exception/DeadCodeDetectionNotSupportedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Driver' => '/php-code-coverage/Driver/Driver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PathExistsButIsNotDirectoryException' => '/php-code-coverage/Exception/PathExistsButIsNotDirectoryException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PcovDriver' => '/php-code-coverage/Driver/PcovDriver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PcovNotAvailableException' => '/php-code-coverage/Exception/PcovNotAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PhpdbgDriver' => '/php-code-coverage/Driver/PhpdbgDriver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PhpdbgNotAvailableException' => '/php-code-coverage/Exception/PhpdbgNotAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Selector' => '/php-code-coverage/Driver/Selector.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\WriteOperationFailedException' => '/php-code-coverage/Exception/WriteOperationFailedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\WrongXdebugVersionException' => '/php-code-coverage/Exception/WrongXdebugVersionException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug2Driver' => '/php-code-coverage/Driver/Xdebug2Driver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug2NotEnabledException' => '/php-code-coverage/Exception/Xdebug2NotEnabledException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug3Driver' => '/php-code-coverage/Driver/Xdebug3Driver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug3NotEnabledException' => '/php-code-coverage/Exception/Xdebug3NotEnabledException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotAvailableException' => '/php-code-coverage/Exception/XdebugNotAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Exception' => '/php-code-coverage/Exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Filter' => '/php-code-coverage/Filter.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => '/php-code-coverage/Exception/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverAvailableException' => '/php-code-coverage/Exception/NoCodeCoverageDriverAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverWithPathCoverageSupportAvailableException' => '/php-code-coverage/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => '/php-code-coverage/Node/AbstractNode.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\Builder' => '/php-code-coverage/Node/Builder.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\CrapIndex' => '/php-code-coverage/Node/CrapIndex.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\Directory' => '/php-code-coverage/Node/Directory.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\File' => '/php-code-coverage/Node/File.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\Iterator' => '/php-code-coverage/Node/Iterator.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\ParserException' => '/php-code-coverage/Exception/ParserException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\ProcessedCodeCoverageData' => '/php-code-coverage/ProcessedCodeCoverageData.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\RawCodeCoverageData' => '/php-code-coverage/RawCodeCoverageData.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\ReflectionException' => '/php-code-coverage/Exception/ReflectionException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\ReportAlreadyFinalizedException' => '/php-code-coverage/Exception/ReportAlreadyFinalizedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Clover' => '/php-code-coverage/Report/Clover.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Cobertura' => '/php-code-coverage/Report/Cobertura.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => '/php-code-coverage/Report/Crap4j.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => '/php-code-coverage/Report/Html/Renderer/Dashboard.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => '/php-code-coverage/Report/Html/Renderer/Directory.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => '/php-code-coverage/Report/Html/Facade.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => '/php-code-coverage/Report/Html/Renderer/File.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => '/php-code-coverage/Report/Html/Renderer.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\PHP' => '/php-code-coverage/Report/PHP.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Text' => '/php-code-coverage/Report/Text.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => '/php-code-coverage/Report/Xml/BuildInformation.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => '/php-code-coverage/Report/Xml/Coverage.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => '/php-code-coverage/Report/Xml/Directory.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => '/php-code-coverage/Report/Xml/Facade.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => '/php-code-coverage/Report/Xml/File.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => '/php-code-coverage/Report/Xml/Method.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => '/php-code-coverage/Report/Xml/Node.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => '/php-code-coverage/Report/Xml/Project.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => '/php-code-coverage/Report/Xml/Report.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => '/php-code-coverage/Report/Xml/Source.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => '/php-code-coverage/Report/Xml/Tests.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => '/php-code-coverage/Report/Xml/Totals.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => '/php-code-coverage/Report/Xml/Unit.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysisCacheNotConfiguredException' => '/php-code-coverage/Exception/StaticAnalysisCacheNotConfiguredException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CacheWarmer' => '/php-code-coverage/StaticAnalysis/CacheWarmer.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CachingFileAnalyser' => '/php-code-coverage/StaticAnalysis/CachingFileAnalyser.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CodeUnitFindingVisitor' => '/php-code-coverage/StaticAnalysis/CodeUnitFindingVisitor.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ExecutableLinesFindingVisitor' => '/php-code-coverage/StaticAnalysis/ExecutableLinesFindingVisitor.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\FileAnalyser' => '/php-code-coverage/StaticAnalysis/FileAnalyser.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\IgnoredLinesFindingVisitor' => '/php-code-coverage/StaticAnalysis/IgnoredLinesFindingVisitor.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ParsingFileAnalyser' => '/php-code-coverage/StaticAnalysis/ParsingFileAnalyser.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\TestIdMissingException' => '/php-code-coverage/Exception/TestIdMissingException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => '/php-code-coverage/Exception/UnintentionallyCoveredCodeException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Util\\DirectoryCouldNotBeCreatedException' => '/php-code-coverage/Exception/DirectoryCouldNotBeCreatedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Util\\Filesystem' => '/php-code-coverage/Util/Filesystem.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Util\\Percentage' => '/php-code-coverage/Util/Percentage.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Version' => '/php-code-coverage/Version.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\XmlException' => '/php-code-coverage/Exception/XmlException.php', - 'PHPUnit\\SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => '/sebastian-code-unit-reverse-lookup/Wizard.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\ClassMethodUnit' => '/sebastian-code-unit/ClassMethodUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\ClassUnit' => '/sebastian-code-unit/ClassUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\CodeUnit' => '/sebastian-code-unit/CodeUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\CodeUnitCollection' => '/sebastian-code-unit/CodeUnitCollection.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\CodeUnitCollectionIterator' => '/sebastian-code-unit/CodeUnitCollectionIterator.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\Exception' => '/sebastian-code-unit/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\FunctionUnit' => '/sebastian-code-unit/FunctionUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\InterfaceMethodUnit' => '/sebastian-code-unit/InterfaceMethodUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\InterfaceUnit' => '/sebastian-code-unit/InterfaceUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\InvalidCodeUnitException' => '/sebastian-code-unit/exceptions/InvalidCodeUnitException.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\Mapper' => '/sebastian-code-unit/Mapper.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\NoTraitException' => '/sebastian-code-unit/exceptions/NoTraitException.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\ReflectionException' => '/sebastian-code-unit/exceptions/ReflectionException.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\TraitMethodUnit' => '/sebastian-code-unit/TraitMethodUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\TraitUnit' => '/sebastian-code-unit/TraitUnit.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ArrayComparator' => '/sebastian-comparator/ArrayComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\Comparator' => '/sebastian-comparator/Comparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ComparisonFailure' => '/sebastian-comparator/ComparisonFailure.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\DOMNodeComparator' => '/sebastian-comparator/DOMNodeComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\DateTimeComparator' => '/sebastian-comparator/DateTimeComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\DoubleComparator' => '/sebastian-comparator/DoubleComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\Exception' => '/sebastian-comparator/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ExceptionComparator' => '/sebastian-comparator/ExceptionComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\Factory' => '/sebastian-comparator/Factory.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\MockObjectComparator' => '/sebastian-comparator/MockObjectComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\NumericComparator' => '/sebastian-comparator/NumericComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ObjectComparator' => '/sebastian-comparator/ObjectComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ResourceComparator' => '/sebastian-comparator/ResourceComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\RuntimeException' => '/sebastian-comparator/exceptions/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ScalarComparator' => '/sebastian-comparator/ScalarComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\SplObjectStorageComparator' => '/sebastian-comparator/SplObjectStorageComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\TypeComparator' => '/sebastian-comparator/TypeComparator.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\Calculator' => '/sebastian-complexity/Calculator.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\Complexity' => '/sebastian-complexity/Complexity/Complexity.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\ComplexityCalculatingVisitor' => '/sebastian-complexity/Visitor/ComplexityCalculatingVisitor.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\ComplexityCollection' => '/sebastian-complexity/Complexity/ComplexityCollection.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\ComplexityCollectionIterator' => '/sebastian-complexity/Complexity/ComplexityCollectionIterator.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\CyclomaticComplexityCalculatingVisitor' => '/sebastian-complexity/Visitor/CyclomaticComplexityCalculatingVisitor.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\Exception' => '/sebastian-complexity/Exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\RuntimeException' => '/sebastian-complexity/Exception/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Chunk' => '/sebastian-diff/Chunk.php', - 'PHPUnit\\SebastianBergmann\\Diff\\ConfigurationException' => '/sebastian-diff/Exception/ConfigurationException.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Diff' => '/sebastian-diff/Diff.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Differ' => '/sebastian-diff/Differ.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Exception' => '/sebastian-diff/Exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\Diff\\InvalidArgumentException' => '/sebastian-diff/Exception/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Line' => '/sebastian-diff/Line.php', - 'PHPUnit\\SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => '/sebastian-diff/LongestCommonSubsequenceCalculator.php', - 'PHPUnit\\SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => '/sebastian-diff/MemoryEfficientLongestCommonSubsequenceCalculator.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => '/sebastian-diff/Output/AbstractChunkOutputBuilder.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => '/sebastian-diff/Output/DiffOnlyOutputBuilder.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => '/sebastian-diff/Output/DiffOutputBuilderInterface.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => '/sebastian-diff/Output/StrictUnifiedDiffOutputBuilder.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => '/sebastian-diff/Output/UnifiedDiffOutputBuilder.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Parser' => '/sebastian-diff/Parser.php', - 'PHPUnit\\SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => '/sebastian-diff/TimeEfficientLongestCommonSubsequenceCalculator.php', - 'PHPUnit\\SebastianBergmann\\Environment\\Console' => '/sebastian-environment/Console.php', - 'PHPUnit\\SebastianBergmann\\Environment\\OperatingSystem' => '/sebastian-environment/OperatingSystem.php', - 'PHPUnit\\SebastianBergmann\\Environment\\Runtime' => '/sebastian-environment/Runtime.php', - 'PHPUnit\\SebastianBergmann\\Exporter\\Exporter' => '/sebastian-exporter/Exporter.php', - 'PHPUnit\\SebastianBergmann\\FileIterator\\Facade' => '/php-file-iterator/Facade.php', - 'PHPUnit\\SebastianBergmann\\FileIterator\\Factory' => '/php-file-iterator/Factory.php', - 'PHPUnit\\SebastianBergmann\\FileIterator\\Iterator' => '/php-file-iterator/Iterator.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\CodeExporter' => '/sebastian-global-state/CodeExporter.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\Exception' => '/sebastian-global-state/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\ExcludeList' => '/sebastian-global-state/ExcludeList.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\Restorer' => '/sebastian-global-state/Restorer.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\RuntimeException' => '/sebastian-global-state/exceptions/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\Snapshot' => '/sebastian-global-state/Snapshot.php', - 'PHPUnit\\SebastianBergmann\\Invoker\\Exception' => '/php-invoker/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\Invoker\\Invoker' => '/php-invoker/Invoker.php', - 'PHPUnit\\SebastianBergmann\\Invoker\\ProcessControlExtensionNotLoadedException' => '/php-invoker/exceptions/ProcessControlExtensionNotLoadedException.php', - 'PHPUnit\\SebastianBergmann\\Invoker\\TimeoutException' => '/php-invoker/exceptions/TimeoutException.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\Counter' => '/sebastian-lines-of-code/Counter.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\Exception' => '/sebastian-lines-of-code/Exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\IllogicalValuesException' => '/sebastian-lines-of-code/Exception/IllogicalValuesException.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\LineCountingVisitor' => '/sebastian-lines-of-code/LineCountingVisitor.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\LinesOfCode' => '/sebastian-lines-of-code/LinesOfCode.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\NegativeValueException' => '/sebastian-lines-of-code/Exception/NegativeValueException.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\RuntimeException' => '/sebastian-lines-of-code/Exception/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\ObjectEnumerator\\Enumerator' => '/sebastian-object-enumerator/Enumerator.php', - 'PHPUnit\\SebastianBergmann\\ObjectEnumerator\\Exception' => '/sebastian-object-enumerator/Exception.php', - 'PHPUnit\\SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => '/sebastian-object-enumerator/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\ObjectReflector\\Exception' => '/sebastian-object-reflector/Exception.php', - 'PHPUnit\\SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => '/sebastian-object-reflector/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\ObjectReflector\\ObjectReflector' => '/sebastian-object-reflector/ObjectReflector.php', - 'PHPUnit\\SebastianBergmann\\RecursionContext\\Context' => '/sebastian-recursion-context/Context.php', - 'PHPUnit\\SebastianBergmann\\RecursionContext\\Exception' => '/sebastian-recursion-context/Exception.php', - 'PHPUnit\\SebastianBergmann\\RecursionContext\\InvalidArgumentException' => '/sebastian-recursion-context/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\ResourceOperations\\ResourceOperations' => '/sebastian-resource-operations/ResourceOperations.php', - 'PHPUnit\\SebastianBergmann\\Template\\Exception' => '/php-text-template/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\Template\\InvalidArgumentException' => '/php-text-template/exceptions/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\Template\\RuntimeException' => '/php-text-template/exceptions/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\Template\\Template' => '/php-text-template/Template.php', - 'PHPUnit\\SebastianBergmann\\Timer\\Duration' => '/php-timer/Duration.php', - 'PHPUnit\\SebastianBergmann\\Timer\\Exception' => '/php-timer/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\Timer\\NoActiveTimerException' => '/php-timer/exceptions/NoActiveTimerException.php', - 'PHPUnit\\SebastianBergmann\\Timer\\ResourceUsageFormatter' => '/php-timer/ResourceUsageFormatter.php', - 'PHPUnit\\SebastianBergmann\\Timer\\TimeSinceStartOfRequestNotAvailableException' => '/php-timer/exceptions/TimeSinceStartOfRequestNotAvailableException.php', - 'PHPUnit\\SebastianBergmann\\Timer\\Timer' => '/php-timer/Timer.php', - 'PHPUnit\\SebastianBergmann\\Type\\CallableType' => '/sebastian-type/type/CallableType.php', - 'PHPUnit\\SebastianBergmann\\Type\\Exception' => '/sebastian-type/exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\Type\\FalseType' => '/sebastian-type/type/FalseType.php', - 'PHPUnit\\SebastianBergmann\\Type\\GenericObjectType' => '/sebastian-type/type/GenericObjectType.php', - 'PHPUnit\\SebastianBergmann\\Type\\IntersectionType' => '/sebastian-type/type/IntersectionType.php', - 'PHPUnit\\SebastianBergmann\\Type\\IterableType' => '/sebastian-type/type/IterableType.php', - 'PHPUnit\\SebastianBergmann\\Type\\MixedType' => '/sebastian-type/type/MixedType.php', - 'PHPUnit\\SebastianBergmann\\Type\\NeverType' => '/sebastian-type/type/NeverType.php', - 'PHPUnit\\SebastianBergmann\\Type\\NullType' => '/sebastian-type/type/NullType.php', - 'PHPUnit\\SebastianBergmann\\Type\\ObjectType' => '/sebastian-type/type/ObjectType.php', - 'PHPUnit\\SebastianBergmann\\Type\\Parameter' => '/sebastian-type/Parameter.php', - 'PHPUnit\\SebastianBergmann\\Type\\ReflectionMapper' => '/sebastian-type/ReflectionMapper.php', - 'PHPUnit\\SebastianBergmann\\Type\\RuntimeException' => '/sebastian-type/exception/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\Type\\SimpleType' => '/sebastian-type/type/SimpleType.php', - 'PHPUnit\\SebastianBergmann\\Type\\StaticType' => '/sebastian-type/type/StaticType.php', - 'PHPUnit\\SebastianBergmann\\Type\\TrueType' => '/sebastian-type/type/TrueType.php', - 'PHPUnit\\SebastianBergmann\\Type\\Type' => '/sebastian-type/type/Type.php', - 'PHPUnit\\SebastianBergmann\\Type\\TypeName' => '/sebastian-type/TypeName.php', - 'PHPUnit\\SebastianBergmann\\Type\\UnionType' => '/sebastian-type/type/UnionType.php', - 'PHPUnit\\SebastianBergmann\\Type\\UnknownType' => '/sebastian-type/type/UnknownType.php', - 'PHPUnit\\SebastianBergmann\\Type\\VoidType' => '/sebastian-type/type/VoidType.php', - 'PHPUnit\\SebastianBergmann\\Version' => '/sebastian-version/Version.php', 'PHPUnit\\TextUI\\CliArguments\\Builder' => '/phpunit/TextUI/CliArguments/Builder.php', 'PHPUnit\\TextUI\\CliArguments\\Configuration' => '/phpunit/TextUI/CliArguments/Configuration.php', 'PHPUnit\\TextUI\\CliArguments\\Exception' => '/phpunit/TextUI/CliArguments/Exception.php', @@ -939,14 +1145,6 @@ spl_autoload_register( 'PHPUnit\\TextUI\\XmlConfiguration\\Variable' => '/phpunit/TextUI/XmlConfiguration/PHP/Variable.php', 'PHPUnit\\TextUI\\XmlConfiguration\\VariableCollection' => '/phpunit/TextUI/XmlConfiguration/PHP/VariableCollection.php', 'PHPUnit\\TextUI\\XmlConfiguration\\VariableCollectionIterator' => '/phpunit/TextUI/XmlConfiguration/PHP/VariableCollectionIterator.php', - 'PHPUnit\\TheSeer\\Tokenizer\\Exception' => '/theseer-tokenizer/Exception.php', - 'PHPUnit\\TheSeer\\Tokenizer\\NamespaceUri' => '/theseer-tokenizer/NamespaceUri.php', - 'PHPUnit\\TheSeer\\Tokenizer\\NamespaceUriException' => '/theseer-tokenizer/NamespaceUriException.php', - 'PHPUnit\\TheSeer\\Tokenizer\\Token' => '/theseer-tokenizer/Token.php', - 'PHPUnit\\TheSeer\\Tokenizer\\TokenCollection' => '/theseer-tokenizer/TokenCollection.php', - 'PHPUnit\\TheSeer\\Tokenizer\\TokenCollectionException' => '/theseer-tokenizer/TokenCollectionException.php', - 'PHPUnit\\TheSeer\\Tokenizer\\Tokenizer' => '/theseer-tokenizer/Tokenizer.php', - 'PHPUnit\\TheSeer\\Tokenizer\\XMLSerializer' => '/theseer-tokenizer/XMLSerializer.php', 'PHPUnit\\Util\\Annotation\\DocBlock' => '/phpunit/Util/Annotation/DocBlock.php', 'PHPUnit\\Util\\Annotation\\Registry' => '/phpunit/Util/Annotation/Registry.php', 'PHPUnit\\Util\\Blacklist' => '/phpunit/Util/Blacklist.php', @@ -993,105 +1191,6 @@ spl_autoload_register( 'PHPUnit\\Util\\Xml\\SuccessfulSchemaDetectionResult' => '/phpunit/Util/Xml/SuccessfulSchemaDetectionResult.php', 'PHPUnit\\Util\\Xml\\ValidationResult' => '/phpunit/Util/Xml/ValidationResult.php', 'PHPUnit\\Util\\Xml\\Validator' => '/phpunit/Util/Xml/Validator.php', - 'PHPUnit\\Webmozart\\Assert\\Assert' => '/webmozart-assert/Assert.php', - 'PHPUnit\\Webmozart\\Assert\\InvalidArgumentException' => '/webmozart-assert/InvalidArgumentException.php', - 'PHPUnit\\Webmozart\\Assert\\Mixin' => '/webmozart-assert/Mixin.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock' => '/phpdocumentor-reflection-docblock/DocBlock.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlockFactory' => '/phpdocumentor-reflection-docblock/DocBlockFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlockFactoryInterface' => '/phpdocumentor-reflection-docblock/DocBlockFactoryInterface.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Description' => '/phpdocumentor-reflection-docblock/DocBlock/Description.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\DescriptionFactory' => '/phpdocumentor-reflection-docblock/DocBlock/DescriptionFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\ExampleFinder' => '/phpdocumentor-reflection-docblock/DocBlock/ExampleFinder.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Serializer' => '/phpdocumentor-reflection-docblock/DocBlock/Serializer.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\StandardTagFactory' => '/phpdocumentor-reflection-docblock/DocBlock/StandardTagFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tag' => '/phpdocumentor-reflection-docblock/DocBlock/Tag.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\TagFactory' => '/phpdocumentor-reflection-docblock/DocBlock/TagFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Author' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Author.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\BaseTag' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/BaseTag.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Covers' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Covers.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Deprecated' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Deprecated.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Example' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Example.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Factory\\StaticMethod' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Factory/StaticMethod.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter\\AlignFormatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/AlignFormatter.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter\\PassthroughFormatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/PassthroughFormatter.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Generic' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Generic.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\InvalidTag' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/InvalidTag.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Link' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Link.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Method' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Method.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Param' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Param.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Property' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Property.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyRead' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyRead.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyWrite' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyWrite.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Fqsen' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Fqsen.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Reference' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Reference.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Url' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Url.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Return_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\See' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/See.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Since' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Since.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Source' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Source.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\TagWithType' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/TagWithType.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Throws' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Throws.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Uses' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Uses.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Var_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Version' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Version.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Element' => '/phpdocumentor-reflection-common/Element.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Exception\\PcreException' => '/phpdocumentor-reflection-docblock/Exception/PcreException.php', - 'PHPUnit\\phpDocumentor\\Reflection\\File' => '/phpdocumentor-reflection-common/File.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Fqsen' => '/phpdocumentor-reflection-common/Fqsen.php', - 'PHPUnit\\phpDocumentor\\Reflection\\FqsenResolver' => '/phpdocumentor-type-resolver/FqsenResolver.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Location' => '/phpdocumentor-reflection-common/Location.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Project' => '/phpdocumentor-reflection-common/Project.php', - 'PHPUnit\\phpDocumentor\\Reflection\\ProjectFactory' => '/phpdocumentor-reflection-common/ProjectFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoType' => '/phpdocumentor-type-resolver/PseudoType.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\CallableString' => '/phpdocumentor-type-resolver/PseudoTypes/CallableString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\False_' => '/phpdocumentor-type-resolver/PseudoTypes/False_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\HtmlEscapedString' => '/phpdocumentor-type-resolver/PseudoTypes/HtmlEscapedString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\IntegerRange' => '/phpdocumentor-type-resolver/PseudoTypes/IntegerRange.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\List_' => '/phpdocumentor-type-resolver/PseudoTypes/List_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\LiteralString' => '/phpdocumentor-type-resolver/PseudoTypes/LiteralString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\LowercaseString' => '/phpdocumentor-type-resolver/PseudoTypes/LowercaseString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\NegativeInteger' => '/phpdocumentor-type-resolver/PseudoTypes/NegativeInteger.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyLowercaseString' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyLowercaseString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyString' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\NumericString' => '/phpdocumentor-type-resolver/PseudoTypes/NumericString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\Numeric_' => '/phpdocumentor-type-resolver/PseudoTypes/Numeric_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\PositiveInteger' => '/phpdocumentor-type-resolver/PseudoTypes/PositiveInteger.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\TraitString' => '/phpdocumentor-type-resolver/PseudoTypes/TraitString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\True_' => '/phpdocumentor-type-resolver/PseudoTypes/True_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Type' => '/phpdocumentor-type-resolver/Type.php', - 'PHPUnit\\phpDocumentor\\Reflection\\TypeResolver' => '/phpdocumentor-type-resolver/TypeResolver.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\AbstractList' => '/phpdocumentor-type-resolver/Types/AbstractList.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\AggregatedType' => '/phpdocumentor-type-resolver/Types/AggregatedType.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\ArrayKey' => '/phpdocumentor-type-resolver/Types/ArrayKey.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Array_' => '/phpdocumentor-type-resolver/Types/Array_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Boolean' => '/phpdocumentor-type-resolver/Types/Boolean.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Callable_' => '/phpdocumentor-type-resolver/Types/Callable_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\ClassString' => '/phpdocumentor-type-resolver/Types/ClassString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Collection' => '/phpdocumentor-type-resolver/Types/Collection.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Compound' => '/phpdocumentor-type-resolver/Types/Compound.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Context' => '/phpdocumentor-type-resolver/Types/Context.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\ContextFactory' => '/phpdocumentor-type-resolver/Types/ContextFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Expression' => '/phpdocumentor-type-resolver/Types/Expression.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Float_' => '/phpdocumentor-type-resolver/Types/Float_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Integer' => '/phpdocumentor-type-resolver/Types/Integer.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\InterfaceString' => '/phpdocumentor-type-resolver/Types/InterfaceString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Intersection' => '/phpdocumentor-type-resolver/Types/Intersection.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Iterable_' => '/phpdocumentor-type-resolver/Types/Iterable_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Mixed_' => '/phpdocumentor-type-resolver/Types/Mixed_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Never_' => '/phpdocumentor-type-resolver/Types/Never_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Null_' => '/phpdocumentor-type-resolver/Types/Null_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Nullable' => '/phpdocumentor-type-resolver/Types/Nullable.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Object_' => '/phpdocumentor-type-resolver/Types/Object_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Parent_' => '/phpdocumentor-type-resolver/Types/Parent_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Resource_' => '/phpdocumentor-type-resolver/Types/Resource_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Scalar' => '/phpdocumentor-type-resolver/Types/Scalar.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Self_' => '/phpdocumentor-type-resolver/Types/Self_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Static_' => '/phpdocumentor-type-resolver/Types/Static_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\String_' => '/phpdocumentor-type-resolver/Types/String_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\This' => '/phpdocumentor-type-resolver/Types/This.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Void_' => '/phpdocumentor-type-resolver/Types/Void_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Utils' => '/phpdocumentor-reflection-docblock/Utils.php', 'Prophecy\\Argument' => '/phpspec-prophecy/Prophecy/Argument.php', 'Prophecy\\Argument\\ArgumentsWildcard' => '/phpspec-prophecy/Prophecy/Argument/ArgumentsWildcard.php', 'Prophecy\\Argument\\Token\\AnyValueToken' => '/phpspec-prophecy/Prophecy/Argument/Token/AnyValueToken.php', @@ -1188,43 +1287,768 @@ spl_autoload_register( } if (isset($classes[$class])) { - require_once 'phar://phpunit-9.6.13.phar' . $classes[$class]; + require_once 'phar://phpunit-9.6.20.phar' . $classes[$class]; } }, true, false ); -foreach (['PHPUnit\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy.php', - 'PHPUnit\\DeepCopy\\Exception\\CloneException' => '/myclabs-deep-copy/DeepCopy/Exception/CloneException.php', - 'PHPUnit\\DeepCopy\\Exception\\PropertyException' => '/myclabs-deep-copy/DeepCopy/Exception/PropertyException.php', - 'PHPUnit\\DeepCopy\\Filter\\ChainableFilter' => '/myclabs-deep-copy/DeepCopy/Filter/ChainableFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\Doctrine\\DoctrineCollectionFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\Doctrine\\DoctrineEmptyCollectionFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\Doctrine\\DoctrineProxyFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\Filter' => '/myclabs-deep-copy/DeepCopy/Filter/Filter.php', - 'PHPUnit\\DeepCopy\\Filter\\KeepFilter' => '/myclabs-deep-copy/DeepCopy/Filter/KeepFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\ReplaceFilter' => '/myclabs-deep-copy/DeepCopy/Filter/ReplaceFilter.php', - 'PHPUnit\\DeepCopy\\Filter\\SetNullFilter' => '/myclabs-deep-copy/DeepCopy/Filter/SetNullFilter.php', - 'PHPUnit\\DeepCopy\\Matcher\\Doctrine\\DoctrineProxyMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php', - 'PHPUnit\\DeepCopy\\Matcher\\Matcher' => '/myclabs-deep-copy/DeepCopy/Matcher/Matcher.php', - 'PHPUnit\\DeepCopy\\Matcher\\PropertyMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyMatcher.php', - 'PHPUnit\\DeepCopy\\Matcher\\PropertyNameMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyNameMatcher.php', - 'PHPUnit\\DeepCopy\\Matcher\\PropertyTypeMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyTypeMatcher.php', - 'PHPUnit\\DeepCopy\\Reflection\\ReflectionHelper' => '/myclabs-deep-copy/DeepCopy/Reflection/ReflectionHelper.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\Date\\DateIntervalFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Date/DateIntervalFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\ReplaceFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/ReplaceFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\ShallowCopyFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/ShallowCopyFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\Spl\\ArrayObjectFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/ArrayObjectFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\Spl\\SplDoublyLinkedList' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\Spl\\SplDoublyLinkedListFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php', - 'PHPUnit\\DeepCopy\\TypeFilter\\TypeFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/TypeFilter.php', - 'PHPUnit\\DeepCopy\\TypeMatcher\\TypeMatcher' => '/myclabs-deep-copy/DeepCopy/TypeMatcher/TypeMatcher.php', - 'PHPUnit\\Doctrine\\Instantiator\\Exception\\ExceptionInterface' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/ExceptionInterface.php', - 'PHPUnit\\Doctrine\\Instantiator\\Exception\\InvalidArgumentException' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/InvalidArgumentException.php', - 'PHPUnit\\Doctrine\\Instantiator\\Exception\\UnexpectedValueException' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/UnexpectedValueException.php', - 'PHPUnit\\Doctrine\\Instantiator\\Instantiator' => '/doctrine-instantiator/Doctrine/Instantiator/Instantiator.php', - 'PHPUnit\\Doctrine\\Instantiator\\InstantiatorInterface' => '/doctrine-instantiator/Doctrine/Instantiator/InstantiatorInterface.php', +foreach (['Doctrine\\Deprecations\\PHPUnit\\VerifyDeprecations' => '/doctrine-deprecations/Doctrine/Deprecations/PHPUnit/VerifyDeprecations.php', + 'PHPUnitPHAR\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy.php', + 'PHPUnitPHAR\\DeepCopy\\Exception\\CloneException' => '/myclabs-deep-copy/DeepCopy/Exception/CloneException.php', + 'PHPUnitPHAR\\DeepCopy\\Exception\\PropertyException' => '/myclabs-deep-copy/DeepCopy/Exception/PropertyException.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\ChainableFilter' => '/myclabs-deep-copy/DeepCopy/Filter/ChainableFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\Doctrine\\DoctrineCollectionFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\Doctrine\\DoctrineEmptyCollectionFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\Doctrine\\DoctrineProxyFilter' => '/myclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\Filter' => '/myclabs-deep-copy/DeepCopy/Filter/Filter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\KeepFilter' => '/myclabs-deep-copy/DeepCopy/Filter/KeepFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\ReplaceFilter' => '/myclabs-deep-copy/DeepCopy/Filter/ReplaceFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Filter\\SetNullFilter' => '/myclabs-deep-copy/DeepCopy/Filter/SetNullFilter.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\Doctrine\\DoctrineProxyMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\Matcher' => '/myclabs-deep-copy/DeepCopy/Matcher/Matcher.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\PropertyMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyMatcher.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\PropertyNameMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyNameMatcher.php', + 'PHPUnitPHAR\\DeepCopy\\Matcher\\PropertyTypeMatcher' => '/myclabs-deep-copy/DeepCopy/Matcher/PropertyTypeMatcher.php', + 'PHPUnitPHAR\\DeepCopy\\Reflection\\ReflectionHelper' => '/myclabs-deep-copy/DeepCopy/Reflection/ReflectionHelper.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\Date\\DateIntervalFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Date/DateIntervalFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\ReplaceFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/ReplaceFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\ShallowCopyFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/ShallowCopyFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\Spl\\ArrayObjectFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/ArrayObjectFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\Spl\\SplDoublyLinkedList' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\Spl\\SplDoublyLinkedListFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeFilter\\TypeFilter' => '/myclabs-deep-copy/DeepCopy/TypeFilter/TypeFilter.php', + 'PHPUnitPHAR\\DeepCopy\\TypeMatcher\\TypeMatcher' => '/myclabs-deep-copy/DeepCopy/TypeMatcher/TypeMatcher.php', + 'PHPUnitPHAR\\Doctrine\\Deprecations\\Deprecation' => '/doctrine-deprecations/Doctrine/Deprecations/Deprecation.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\Exception\\ExceptionInterface' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/ExceptionInterface.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\Exception\\InvalidArgumentException' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/InvalidArgumentException.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\Exception\\UnexpectedValueException' => '/doctrine-instantiator/Doctrine/Instantiator/Exception/UnexpectedValueException.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\Instantiator' => '/doctrine-instantiator/Doctrine/Instantiator/Instantiator.php', + 'PHPUnitPHAR\\Doctrine\\Instantiator\\InstantiatorInterface' => '/doctrine-instantiator/Doctrine/Instantiator/InstantiatorInterface.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\AbstractNodeVisitor' => '/phpstan-phpdoc-parser/Ast/AbstractNodeVisitor.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Attribute' => '/phpstan-phpdoc-parser/Ast/Attribute.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprArrayItemNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprArrayItemNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprArrayNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprArrayNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprFalseNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprFalseNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprFloatNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprFloatNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprIntegerNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprIntegerNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprNullNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprNullNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprStringNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprStringNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprTrueNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprTrueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstFetchNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/ConstFetchNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\DoctrineConstExprStringNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/DoctrineConstExprStringNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\ConstExpr\\QuoteAwareConstExprStringNode' => '/phpstan-phpdoc-parser/Ast/ConstExpr/QuoteAwareConstExprStringNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Node' => '/phpstan-phpdoc-parser/Ast/Node.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\NodeAttributes' => '/phpstan-phpdoc-parser/Ast/NodeAttributes.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\NodeTraverser' => '/phpstan-phpdoc-parser/Ast/NodeTraverser.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\NodeVisitor' => '/phpstan-phpdoc-parser/Ast/NodeVisitor.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\NodeVisitor\\CloningVisitor' => '/phpstan-phpdoc-parser/Ast/NodeVisitor/CloningVisitor.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\AssertTagMethodValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagMethodValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\AssertTagPropertyValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagPropertyValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\AssertTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\DeprecatedTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/DeprecatedTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineAnnotation' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineAnnotation.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineArgument' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArgument.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineArray' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArray.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineArrayItem' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArrayItem.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\Doctrine\\DoctrineTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ExtendsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ExtendsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\GenericTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/GenericTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ImplementsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ImplementsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\InvalidTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/InvalidTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\MethodTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/MethodTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\MethodTagValueParameterNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/MethodTagValueParameterNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\MixinTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/MixinTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamClosureThisTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamClosureThisTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamImmediatelyInvokedCallableTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamImmediatelyInvokedCallableTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamLaterInvokedCallableTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamLaterInvokedCallableTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamOutTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamOutTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ParamTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ParamTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocChildNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocChildNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTagNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTextNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTextNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PropertyTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/PropertyTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\RequireExtendsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/RequireExtendsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\RequireImplementsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/RequireImplementsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ReturnTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ReturnTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\SelfOutTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/SelfOutTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\TemplateTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/TemplateTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\ThrowsTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/ThrowsTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\TypeAliasImportTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/TypeAliasImportTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\TypeAliasTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/TypeAliasTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\TypelessParamTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/TypelessParamTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\UsesTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/UsesTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\PhpDoc\\VarTagValueNode' => '/phpstan-phpdoc-parser/Ast/PhpDoc/VarTagValueNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ArrayShapeItemNode' => '/phpstan-phpdoc-parser/Ast/Type/ArrayShapeItemNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ArrayShapeNode' => '/phpstan-phpdoc-parser/Ast/Type/ArrayShapeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ArrayTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/ArrayTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\CallableTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/CallableTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\CallableTypeParameterNode' => '/phpstan-phpdoc-parser/Ast/Type/CallableTypeParameterNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ConditionalTypeForParameterNode' => '/phpstan-phpdoc-parser/Ast/Type/ConditionalTypeForParameterNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ConditionalTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/ConditionalTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ConstTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/ConstTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\GenericTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/GenericTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\IdentifierTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/IdentifierTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\IntersectionTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/IntersectionTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\InvalidTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/InvalidTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\NullableTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/NullableTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ObjectShapeItemNode' => '/phpstan-phpdoc-parser/Ast/Type/ObjectShapeItemNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ObjectShapeNode' => '/phpstan-phpdoc-parser/Ast/Type/ObjectShapeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\OffsetAccessTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/OffsetAccessTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\ThisTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/ThisTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\TypeNode' => '/phpstan-phpdoc-parser/Ast/Type/TypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Ast\\Type\\UnionTypeNode' => '/phpstan-phpdoc-parser/Ast/Type/UnionTypeNode.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Lexer\\Lexer' => '/phpstan-phpdoc-parser/Lexer/Lexer.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\ConstExprParser' => '/phpstan-phpdoc-parser/Parser/ConstExprParser.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\ParserException' => '/phpstan-phpdoc-parser/Parser/ParserException.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\PhpDocParser' => '/phpstan-phpdoc-parser/Parser/PhpDocParser.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\StringUnescaper' => '/phpstan-phpdoc-parser/Parser/StringUnescaper.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\TokenIterator' => '/phpstan-phpdoc-parser/Parser/TokenIterator.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Parser\\TypeParser' => '/phpstan-phpdoc-parser/Parser/TypeParser.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Printer\\DiffElem' => '/phpstan-phpdoc-parser/Printer/DiffElem.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Printer\\Differ' => '/phpstan-phpdoc-parser/Printer/Differ.php', + 'PHPUnitPHAR\\PHPStan\\PhpDocParser\\Printer\\Printer' => '/phpstan-phpdoc-parser/Printer/Printer.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Application' => '/phar-io-manifest/values/Application.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ApplicationName' => '/phar-io-manifest/values/ApplicationName.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Author' => '/phar-io-manifest/values/Author.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\AuthorCollection' => '/phar-io-manifest/values/AuthorCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\AuthorCollectionIterator' => '/phar-io-manifest/values/AuthorCollectionIterator.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\AuthorElement' => '/phar-io-manifest/xml/AuthorElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\AuthorElementCollection' => '/phar-io-manifest/xml/AuthorElementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\BundledComponent' => '/phar-io-manifest/values/BundledComponent.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\BundledComponentCollection' => '/phar-io-manifest/values/BundledComponentCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\BundledComponentCollectionIterator' => '/phar-io-manifest/values/BundledComponentCollectionIterator.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\BundlesElement' => '/phar-io-manifest/xml/BundlesElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ComponentElement' => '/phar-io-manifest/xml/ComponentElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ComponentElementCollection' => '/phar-io-manifest/xml/ComponentElementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ContainsElement' => '/phar-io-manifest/xml/ContainsElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\CopyrightElement' => '/phar-io-manifest/xml/CopyrightElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\CopyrightInformation' => '/phar-io-manifest/values/CopyrightInformation.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ElementCollection' => '/phar-io-manifest/xml/ElementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ElementCollectionException' => '/phar-io-manifest/exceptions/ElementCollectionException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Email' => '/phar-io-manifest/values/Email.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Exception' => '/phar-io-manifest/exceptions/Exception.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ExtElement' => '/phar-io-manifest/xml/ExtElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ExtElementCollection' => '/phar-io-manifest/xml/ExtElementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Extension' => '/phar-io-manifest/values/Extension.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ExtensionElement' => '/phar-io-manifest/xml/ExtensionElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\InvalidApplicationNameException' => '/phar-io-manifest/exceptions/InvalidApplicationNameException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\InvalidEmailException' => '/phar-io-manifest/exceptions/InvalidEmailException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\InvalidUrlException' => '/phar-io-manifest/exceptions/InvalidUrlException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Library' => '/phar-io-manifest/values/Library.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\License' => '/phar-io-manifest/values/License.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\LicenseElement' => '/phar-io-manifest/xml/LicenseElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Manifest' => '/phar-io-manifest/values/Manifest.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocument' => '/phar-io-manifest/xml/ManifestDocument.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocumentException' => '/phar-io-manifest/exceptions/ManifestDocumentException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocumentLoadingException' => '/phar-io-manifest/exceptions/ManifestDocumentLoadingException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocumentMapper' => '/phar-io-manifest/ManifestDocumentMapper.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestDocumentMapperException' => '/phar-io-manifest/exceptions/ManifestDocumentMapperException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestElement' => '/phar-io-manifest/xml/ManifestElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestElementException' => '/phar-io-manifest/exceptions/ManifestElementException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestLoader' => '/phar-io-manifest/ManifestLoader.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestLoaderException' => '/phar-io-manifest/exceptions/ManifestLoaderException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\ManifestSerializer' => '/phar-io-manifest/ManifestSerializer.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\NoEmailAddressException' => '/phar-io-manifest/exceptions/NoEmailAddressException.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\PhpElement' => '/phar-io-manifest/xml/PhpElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\PhpExtensionRequirement' => '/phar-io-manifest/values/PhpExtensionRequirement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\PhpVersionRequirement' => '/phar-io-manifest/values/PhpVersionRequirement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Requirement' => '/phar-io-manifest/values/Requirement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\RequirementCollection' => '/phar-io-manifest/values/RequirementCollection.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\RequirementCollectionIterator' => '/phar-io-manifest/values/RequirementCollectionIterator.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\RequiresElement' => '/phar-io-manifest/xml/RequiresElement.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Type' => '/phar-io-manifest/values/Type.php', + 'PHPUnitPHAR\\PharIo\\Manifest\\Url' => '/phar-io-manifest/values/Url.php', + 'PHPUnitPHAR\\PharIo\\Version\\AbstractVersionConstraint' => '/phar-io-version/constraints/AbstractVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\AndVersionConstraintGroup' => '/phar-io-version/constraints/AndVersionConstraintGroup.php', + 'PHPUnitPHAR\\PharIo\\Version\\AnyVersionConstraint' => '/phar-io-version/constraints/AnyVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\BuildMetaData' => '/phar-io-version/BuildMetaData.php', + 'PHPUnitPHAR\\PharIo\\Version\\ExactVersionConstraint' => '/phar-io-version/constraints/ExactVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\Exception' => '/phar-io-version/exceptions/Exception.php', + 'PHPUnitPHAR\\PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => '/phar-io-version/constraints/GreaterThanOrEqualToVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\InvalidPreReleaseSuffixException' => '/phar-io-version/exceptions/InvalidPreReleaseSuffixException.php', + 'PHPUnitPHAR\\PharIo\\Version\\InvalidVersionException' => '/phar-io-version/exceptions/InvalidVersionException.php', + 'PHPUnitPHAR\\PharIo\\Version\\NoBuildMetaDataException' => '/phar-io-version/exceptions/NoBuildMetaDataException.php', + 'PHPUnitPHAR\\PharIo\\Version\\NoPreReleaseSuffixException' => '/phar-io-version/exceptions/NoPreReleaseSuffixException.php', + 'PHPUnitPHAR\\PharIo\\Version\\OrVersionConstraintGroup' => '/phar-io-version/constraints/OrVersionConstraintGroup.php', + 'PHPUnitPHAR\\PharIo\\Version\\PreReleaseSuffix' => '/phar-io-version/PreReleaseSuffix.php', + 'PHPUnitPHAR\\PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => '/phar-io-version/constraints/SpecificMajorAndMinorVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\SpecificMajorVersionConstraint' => '/phar-io-version/constraints/SpecificMajorVersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\UnsupportedVersionConstraintException' => '/phar-io-version/exceptions/UnsupportedVersionConstraintException.php', + 'PHPUnitPHAR\\PharIo\\Version\\Version' => '/phar-io-version/Version.php', + 'PHPUnitPHAR\\PharIo\\Version\\VersionConstraint' => '/phar-io-version/constraints/VersionConstraint.php', + 'PHPUnitPHAR\\PharIo\\Version\\VersionConstraintParser' => '/phar-io-version/VersionConstraintParser.php', + 'PHPUnitPHAR\\PharIo\\Version\\VersionConstraintValue' => '/phar-io-version/VersionConstraintValue.php', + 'PHPUnitPHAR\\PharIo\\Version\\VersionNumber' => '/phar-io-version/VersionNumber.php', + 'PHPUnitPHAR\\PhpParser\\Builder' => '/nikic-php-parser/PhpParser/Builder.php', + 'PHPUnitPHAR\\PhpParser\\BuilderFactory' => '/nikic-php-parser/PhpParser/BuilderFactory.php', + 'PHPUnitPHAR\\PhpParser\\BuilderHelpers' => '/nikic-php-parser/PhpParser/BuilderHelpers.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\ClassConst' => '/nikic-php-parser/PhpParser/Builder/ClassConst.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Class_' => '/nikic-php-parser/PhpParser/Builder/Class_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Declaration' => '/nikic-php-parser/PhpParser/Builder/Declaration.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\EnumCase' => '/nikic-php-parser/PhpParser/Builder/EnumCase.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Enum_' => '/nikic-php-parser/PhpParser/Builder/Enum_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\FunctionLike' => '/nikic-php-parser/PhpParser/Builder/FunctionLike.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Function_' => '/nikic-php-parser/PhpParser/Builder/Function_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Interface_' => '/nikic-php-parser/PhpParser/Builder/Interface_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Method' => '/nikic-php-parser/PhpParser/Builder/Method.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Namespace_' => '/nikic-php-parser/PhpParser/Builder/Namespace_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Param' => '/nikic-php-parser/PhpParser/Builder/Param.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Property' => '/nikic-php-parser/PhpParser/Builder/Property.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\TraitUse' => '/nikic-php-parser/PhpParser/Builder/TraitUse.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\TraitUseAdaptation' => '/nikic-php-parser/PhpParser/Builder/TraitUseAdaptation.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Trait_' => '/nikic-php-parser/PhpParser/Builder/Trait_.php', + 'PHPUnitPHAR\\PhpParser\\Builder\\Use_' => '/nikic-php-parser/PhpParser/Builder/Use_.php', + 'PHPUnitPHAR\\PhpParser\\Comment' => '/nikic-php-parser/PhpParser/Comment.php', + 'PHPUnitPHAR\\PhpParser\\Comment\\Doc' => '/nikic-php-parser/PhpParser/Comment/Doc.php', + 'PHPUnitPHAR\\PhpParser\\ConstExprEvaluationException' => '/nikic-php-parser/PhpParser/ConstExprEvaluationException.php', + 'PHPUnitPHAR\\PhpParser\\ConstExprEvaluator' => '/nikic-php-parser/PhpParser/ConstExprEvaluator.php', + 'PHPUnitPHAR\\PhpParser\\Error' => '/nikic-php-parser/PhpParser/Error.php', + 'PHPUnitPHAR\\PhpParser\\ErrorHandler' => '/nikic-php-parser/PhpParser/ErrorHandler.php', + 'PHPUnitPHAR\\PhpParser\\ErrorHandler\\Collecting' => '/nikic-php-parser/PhpParser/ErrorHandler/Collecting.php', + 'PHPUnitPHAR\\PhpParser\\ErrorHandler\\Throwing' => '/nikic-php-parser/PhpParser/ErrorHandler/Throwing.php', + 'PHPUnitPHAR\\PhpParser\\Internal\\DiffElem' => '/nikic-php-parser/PhpParser/Internal/DiffElem.php', + 'PHPUnitPHAR\\PhpParser\\Internal\\Differ' => '/nikic-php-parser/PhpParser/Internal/Differ.php', + 'PHPUnitPHAR\\PhpParser\\Internal\\PrintableNewAnonClassNode' => '/nikic-php-parser/PhpParser/Internal/PrintableNewAnonClassNode.php', + 'PHPUnitPHAR\\PhpParser\\Internal\\TokenStream' => '/nikic-php-parser/PhpParser/Internal/TokenStream.php', + 'PHPUnitPHAR\\PhpParser\\JsonDecoder' => '/nikic-php-parser/PhpParser/JsonDecoder.php', + 'PHPUnitPHAR\\PhpParser\\Lexer' => '/nikic-php-parser/PhpParser/Lexer.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\Emulative' => '/nikic-php-parser/PhpParser/Lexer/Emulative.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\CoaleseEqualTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\FlexibleDocStringEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\NumericLiteralSeparatorEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\ReadonlyFunctionTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\ReadonlyTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\ReverseEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php', + 'PHPUnitPHAR\\PhpParser\\Lexer\\TokenEmulator\\TokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/TokenEmulator.php', + 'PHPUnitPHAR\\PhpParser\\NameContext' => '/nikic-php-parser/PhpParser/NameContext.php', + 'PHPUnitPHAR\\PhpParser\\Node' => '/nikic-php-parser/PhpParser/Node.php', + 'PHPUnitPHAR\\PhpParser\\NodeAbstract' => '/nikic-php-parser/PhpParser/NodeAbstract.php', + 'PHPUnitPHAR\\PhpParser\\NodeDumper' => '/nikic-php-parser/PhpParser/NodeDumper.php', + 'PHPUnitPHAR\\PhpParser\\NodeFinder' => '/nikic-php-parser/PhpParser/NodeFinder.php', + 'PHPUnitPHAR\\PhpParser\\NodeTraverser' => '/nikic-php-parser/PhpParser/NodeTraverser.php', + 'PHPUnitPHAR\\PhpParser\\NodeTraverserInterface' => '/nikic-php-parser/PhpParser/NodeTraverserInterface.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitorAbstract' => '/nikic-php-parser/PhpParser/NodeVisitorAbstract.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\CloningVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/CloningVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\FindingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/FindingVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\FirstFindingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/FirstFindingVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\NameResolver' => '/nikic-php-parser/PhpParser/NodeVisitor/NameResolver.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\NodeConnectingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/NodeConnectingVisitor.php', + 'PHPUnitPHAR\\PhpParser\\NodeVisitor\\ParentConnectingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/ParentConnectingVisitor.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Arg' => '/nikic-php-parser/PhpParser/Node/Arg.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Attribute' => '/nikic-php-parser/PhpParser/Node/Attribute.php', + 'PHPUnitPHAR\\PhpParser\\Node\\AttributeGroup' => '/nikic-php-parser/PhpParser/Node/AttributeGroup.php', + 'PHPUnitPHAR\\PhpParser\\Node\\ComplexType' => '/nikic-php-parser/PhpParser/Node/ComplexType.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Const_' => '/nikic-php-parser/PhpParser/Node/Const_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr' => '/nikic-php-parser/PhpParser/Node/Expr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ArrayDimFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ArrayDimFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ArrayItem' => '/nikic-php-parser/PhpParser/Node/Expr/ArrayItem.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Array_' => '/nikic-php-parser/PhpParser/Node/Expr/Array_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ArrowFunction' => '/nikic-php-parser/PhpParser/Node/Expr/ArrowFunction.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Assign' => '/nikic-php-parser/PhpParser/Node/Expr/Assign.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseOr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseXor.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Coalesce' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Coalesce.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Concat' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Concat.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Div' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Div.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Minus' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Minus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Mod' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mod.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Mul' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mul.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Plus' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Plus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\Pow' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Pow.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\ShiftLeft' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftLeft.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignOp\\ShiftRight' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftRight.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\AssignRef' => '/nikic-php-parser/PhpParser/Node/Expr/AssignRef.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseXor' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BooleanAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\BooleanOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanOr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Coalesce' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Coalesce.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Concat' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Concat.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Div' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Div.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Equal' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Equal.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Greater' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Greater.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\GreaterOrEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Identical' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Identical.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalOr.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalXor' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalXor.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Minus' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Minus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Mod' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mod.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Mul' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mul.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\NotEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotEqual.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\NotIdentical' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotIdentical.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Plus' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Plus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Pow' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Pow.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\ShiftLeft' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\ShiftRight' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftRight.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Smaller' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Smaller.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\SmallerOrEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Spaceship.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BitwiseNot' => '/nikic-php-parser/PhpParser/Node/Expr/BitwiseNot.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\BooleanNot' => '/nikic-php-parser/PhpParser/Node/Expr/BooleanNot.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\CallLike' => '/nikic-php-parser/PhpParser/Node/Expr/CallLike.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast' => '/nikic-php-parser/PhpParser/Node/Expr/Cast.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Array_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Array_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Bool_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Bool_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Double' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Double.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Int_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Int_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Object_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Object_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\String_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/String_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Cast\\Unset_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Unset_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ClassConstFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ClassConstFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Clone_' => '/nikic-php-parser/PhpParser/Node/Expr/Clone_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Closure' => '/nikic-php-parser/PhpParser/Node/Expr/Closure.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ClosureUse' => '/nikic-php-parser/PhpParser/Node/Expr/ClosureUse.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ConstFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ConstFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Empty_' => '/nikic-php-parser/PhpParser/Node/Expr/Empty_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Error' => '/nikic-php-parser/PhpParser/Node/Expr/Error.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ErrorSuppress' => '/nikic-php-parser/PhpParser/Node/Expr/ErrorSuppress.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Eval_' => '/nikic-php-parser/PhpParser/Node/Expr/Eval_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Exit_' => '/nikic-php-parser/PhpParser/Node/Expr/Exit_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\FuncCall' => '/nikic-php-parser/PhpParser/Node/Expr/FuncCall.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Include_' => '/nikic-php-parser/PhpParser/Node/Expr/Include_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Instanceof_' => '/nikic-php-parser/PhpParser/Node/Expr/Instanceof_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Isset_' => '/nikic-php-parser/PhpParser/Node/Expr/Isset_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\List_' => '/nikic-php-parser/PhpParser/Node/Expr/List_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Match_' => '/nikic-php-parser/PhpParser/Node/Expr/Match_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\MethodCall' => '/nikic-php-parser/PhpParser/Node/Expr/MethodCall.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\New_' => '/nikic-php-parser/PhpParser/Node/Expr/New_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\NullsafeMethodCall' => '/nikic-php-parser/PhpParser/Node/Expr/NullsafeMethodCall.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\NullsafePropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/NullsafePropertyFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PostDec' => '/nikic-php-parser/PhpParser/Node/Expr/PostDec.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PostInc' => '/nikic-php-parser/PhpParser/Node/Expr/PostInc.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PreDec' => '/nikic-php-parser/PhpParser/Node/Expr/PreDec.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PreInc' => '/nikic-php-parser/PhpParser/Node/Expr/PreInc.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Print_' => '/nikic-php-parser/PhpParser/Node/Expr/Print_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\PropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/PropertyFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\ShellExec' => '/nikic-php-parser/PhpParser/Node/Expr/ShellExec.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\StaticCall' => '/nikic-php-parser/PhpParser/Node/Expr/StaticCall.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\StaticPropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/StaticPropertyFetch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Ternary' => '/nikic-php-parser/PhpParser/Node/Expr/Ternary.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Throw_' => '/nikic-php-parser/PhpParser/Node/Expr/Throw_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\UnaryMinus' => '/nikic-php-parser/PhpParser/Node/Expr/UnaryMinus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\UnaryPlus' => '/nikic-php-parser/PhpParser/Node/Expr/UnaryPlus.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Variable' => '/nikic-php-parser/PhpParser/Node/Expr/Variable.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\YieldFrom' => '/nikic-php-parser/PhpParser/Node/Expr/YieldFrom.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Expr\\Yield_' => '/nikic-php-parser/PhpParser/Node/Expr/Yield_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\FunctionLike' => '/nikic-php-parser/PhpParser/Node/FunctionLike.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Identifier' => '/nikic-php-parser/PhpParser/Node/Identifier.php', + 'PHPUnitPHAR\\PhpParser\\Node\\IntersectionType' => '/nikic-php-parser/PhpParser/Node/IntersectionType.php', + 'PHPUnitPHAR\\PhpParser\\Node\\MatchArm' => '/nikic-php-parser/PhpParser/Node/MatchArm.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Name' => '/nikic-php-parser/PhpParser/Node/Name.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Name\\FullyQualified' => '/nikic-php-parser/PhpParser/Node/Name/FullyQualified.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Name\\Relative' => '/nikic-php-parser/PhpParser/Node/Name/Relative.php', + 'PHPUnitPHAR\\PhpParser\\Node\\NullableType' => '/nikic-php-parser/PhpParser/Node/NullableType.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Param' => '/nikic-php-parser/PhpParser/Node/Param.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar' => '/nikic-php-parser/PhpParser/Node/Scalar.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\DNumber' => '/nikic-php-parser/PhpParser/Node/Scalar/DNumber.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\Encapsed' => '/nikic-php-parser/PhpParser/Node/Scalar/Encapsed.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\EncapsedStringPart' => '/nikic-php-parser/PhpParser/Node/Scalar/EncapsedStringPart.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\LNumber' => '/nikic-php-parser/PhpParser/Node/Scalar/LNumber.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Class_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Class_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Dir' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Dir.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\File' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/File.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Function_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Function_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Line' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Line.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Method' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Method.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Namespace_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Trait_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Scalar\\String_' => '/nikic-php-parser/PhpParser/Node/Scalar/String_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt' => '/nikic-php-parser/PhpParser/Node/Stmt.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Break_' => '/nikic-php-parser/PhpParser/Node/Stmt/Break_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Case_' => '/nikic-php-parser/PhpParser/Node/Stmt/Case_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Catch_' => '/nikic-php-parser/PhpParser/Node/Stmt/Catch_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\ClassConst' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassConst.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\ClassLike' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassLike.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\ClassMethod' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassMethod.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Class_' => '/nikic-php-parser/PhpParser/Node/Stmt/Class_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Const_' => '/nikic-php-parser/PhpParser/Node/Stmt/Const_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Continue_' => '/nikic-php-parser/PhpParser/Node/Stmt/Continue_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\DeclareDeclare' => '/nikic-php-parser/PhpParser/Node/Stmt/DeclareDeclare.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Declare_' => '/nikic-php-parser/PhpParser/Node/Stmt/Declare_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Do_' => '/nikic-php-parser/PhpParser/Node/Stmt/Do_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Echo_' => '/nikic-php-parser/PhpParser/Node/Stmt/Echo_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\ElseIf_' => '/nikic-php-parser/PhpParser/Node/Stmt/ElseIf_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Else_' => '/nikic-php-parser/PhpParser/Node/Stmt/Else_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\EnumCase' => '/nikic-php-parser/PhpParser/Node/Stmt/EnumCase.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Enum_' => '/nikic-php-parser/PhpParser/Node/Stmt/Enum_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Expression' => '/nikic-php-parser/PhpParser/Node/Stmt/Expression.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Finally_' => '/nikic-php-parser/PhpParser/Node/Stmt/Finally_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\For_' => '/nikic-php-parser/PhpParser/Node/Stmt/For_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Foreach_' => '/nikic-php-parser/PhpParser/Node/Stmt/Foreach_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Function_' => '/nikic-php-parser/PhpParser/Node/Stmt/Function_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Global_' => '/nikic-php-parser/PhpParser/Node/Stmt/Global_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Goto_' => '/nikic-php-parser/PhpParser/Node/Stmt/Goto_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\GroupUse' => '/nikic-php-parser/PhpParser/Node/Stmt/GroupUse.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\HaltCompiler' => '/nikic-php-parser/PhpParser/Node/Stmt/HaltCompiler.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\If_' => '/nikic-php-parser/PhpParser/Node/Stmt/If_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\InlineHTML' => '/nikic-php-parser/PhpParser/Node/Stmt/InlineHTML.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Interface_' => '/nikic-php-parser/PhpParser/Node/Stmt/Interface_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Label' => '/nikic-php-parser/PhpParser/Node/Stmt/Label.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Namespace_' => '/nikic-php-parser/PhpParser/Node/Stmt/Namespace_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Nop' => '/nikic-php-parser/PhpParser/Node/Stmt/Nop.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Property' => '/nikic-php-parser/PhpParser/Node/Stmt/Property.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\PropertyProperty' => '/nikic-php-parser/PhpParser/Node/Stmt/PropertyProperty.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Return_' => '/nikic-php-parser/PhpParser/Node/Stmt/Return_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\StaticVar' => '/nikic-php-parser/PhpParser/Node/Stmt/StaticVar.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Static_' => '/nikic-php-parser/PhpParser/Node/Stmt/Static_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Switch_' => '/nikic-php-parser/PhpParser/Node/Stmt/Switch_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Throw_' => '/nikic-php-parser/PhpParser/Node/Stmt/Throw_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TraitUse' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUse.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TraitUseAdaptation' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Precedence' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Trait_' => '/nikic-php-parser/PhpParser/Node/Stmt/Trait_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\TryCatch' => '/nikic-php-parser/PhpParser/Node/Stmt/TryCatch.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Unset_' => '/nikic-php-parser/PhpParser/Node/Stmt/Unset_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\UseUse' => '/nikic-php-parser/PhpParser/Node/Stmt/UseUse.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\Use_' => '/nikic-php-parser/PhpParser/Node/Stmt/Use_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\Stmt\\While_' => '/nikic-php-parser/PhpParser/Node/Stmt/While_.php', + 'PHPUnitPHAR\\PhpParser\\Node\\UnionType' => '/nikic-php-parser/PhpParser/Node/UnionType.php', + 'PHPUnitPHAR\\PhpParser\\Node\\VarLikeIdentifier' => '/nikic-php-parser/PhpParser/Node/VarLikeIdentifier.php', + 'PHPUnitPHAR\\PhpParser\\Node\\VariadicPlaceholder' => '/nikic-php-parser/PhpParser/Node/VariadicPlaceholder.php', + 'PHPUnitPHAR\\PhpParser\\Parser' => '/nikic-php-parser/PhpParser/Parser.php', + 'PHPUnitPHAR\\PhpParser\\ParserAbstract' => '/nikic-php-parser/PhpParser/ParserAbstract.php', + 'PHPUnitPHAR\\PhpParser\\ParserFactory' => '/nikic-php-parser/PhpParser/ParserFactory.php', + 'PHPUnitPHAR\\PhpParser\\Parser\\Multiple' => '/nikic-php-parser/PhpParser/Parser/Multiple.php', + 'PHPUnitPHAR\\PhpParser\\Parser\\Php5' => '/nikic-php-parser/PhpParser/Parser/Php5.php', + 'PHPUnitPHAR\\PhpParser\\Parser\\Php7' => '/nikic-php-parser/PhpParser/Parser/Php7.php', + 'PHPUnitPHAR\\PhpParser\\Parser\\Tokens' => '/nikic-php-parser/PhpParser/Parser/Tokens.php', + 'PHPUnitPHAR\\PhpParser\\PrettyPrinterAbstract' => '/nikic-php-parser/PhpParser/PrettyPrinterAbstract.php', + 'PHPUnitPHAR\\PhpParser\\PrettyPrinter\\Standard' => '/nikic-php-parser/PhpParser/PrettyPrinter/Standard.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\AmbiguousOptionException' => '/sebastian-cli-parser/exceptions/AmbiguousOptionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\Exception' => '/sebastian-cli-parser/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\OptionDoesNotAllowArgumentException' => '/sebastian-cli-parser/exceptions/OptionDoesNotAllowArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\Parser' => '/sebastian-cli-parser/Parser.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\RequiredOptionArgumentMissingException' => '/sebastian-cli-parser/exceptions/RequiredOptionArgumentMissingException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CliParser\\UnknownOptionException' => '/sebastian-cli-parser/exceptions/UnknownOptionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\BranchAndPathCoverageNotSupportedException' => '/php-code-coverage/Exception/BranchAndPathCoverageNotSupportedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\CodeCoverage' => '/php-code-coverage/CodeCoverage.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\DeadCodeDetectionNotSupportedException' => '/php-code-coverage/Exception/DeadCodeDetectionNotSupportedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Driver' => '/php-code-coverage/Driver/Driver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PathExistsButIsNotDirectoryException' => '/php-code-coverage/Exception/PathExistsButIsNotDirectoryException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PcovDriver' => '/php-code-coverage/Driver/PcovDriver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PcovNotAvailableException' => '/php-code-coverage/Exception/PcovNotAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PhpdbgDriver' => '/php-code-coverage/Driver/PhpdbgDriver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\PhpdbgNotAvailableException' => '/php-code-coverage/Exception/PhpdbgNotAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Selector' => '/php-code-coverage/Driver/Selector.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\WriteOperationFailedException' => '/php-code-coverage/Exception/WriteOperationFailedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\WrongXdebugVersionException' => '/php-code-coverage/Exception/WrongXdebugVersionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug2Driver' => '/php-code-coverage/Driver/Xdebug2Driver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug2NotEnabledException' => '/php-code-coverage/Exception/Xdebug2NotEnabledException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug3Driver' => '/php-code-coverage/Driver/Xdebug3Driver.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug3NotEnabledException' => '/php-code-coverage/Exception/Xdebug3NotEnabledException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotAvailableException' => '/php-code-coverage/Exception/XdebugNotAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Exception' => '/php-code-coverage/Exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Filter' => '/php-code-coverage/Filter.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => '/php-code-coverage/Exception/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverAvailableException' => '/php-code-coverage/Exception/NoCodeCoverageDriverAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverWithPathCoverageSupportAvailableException' => '/php-code-coverage/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => '/php-code-coverage/Node/AbstractNode.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\Builder' => '/php-code-coverage/Node/Builder.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\CrapIndex' => '/php-code-coverage/Node/CrapIndex.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\Directory' => '/php-code-coverage/Node/Directory.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\File' => '/php-code-coverage/Node/File.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Node\\Iterator' => '/php-code-coverage/Node/Iterator.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\ParserException' => '/php-code-coverage/Exception/ParserException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\ProcessedCodeCoverageData' => '/php-code-coverage/ProcessedCodeCoverageData.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\RawCodeCoverageData' => '/php-code-coverage/RawCodeCoverageData.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\ReflectionException' => '/php-code-coverage/Exception/ReflectionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\ReportAlreadyFinalizedException' => '/php-code-coverage/Exception/ReportAlreadyFinalizedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Clover' => '/php-code-coverage/Report/Clover.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Cobertura' => '/php-code-coverage/Report/Cobertura.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => '/php-code-coverage/Report/Crap4j.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => '/php-code-coverage/Report/Html/Renderer/Dashboard.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => '/php-code-coverage/Report/Html/Renderer/Directory.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => '/php-code-coverage/Report/Html/Facade.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => '/php-code-coverage/Report/Html/Renderer/File.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => '/php-code-coverage/Report/Html/Renderer.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\PHP' => '/php-code-coverage/Report/PHP.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Text' => '/php-code-coverage/Report/Text.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => '/php-code-coverage/Report/Xml/BuildInformation.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => '/php-code-coverage/Report/Xml/Coverage.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => '/php-code-coverage/Report/Xml/Directory.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => '/php-code-coverage/Report/Xml/Facade.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => '/php-code-coverage/Report/Xml/File.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => '/php-code-coverage/Report/Xml/Method.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => '/php-code-coverage/Report/Xml/Node.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => '/php-code-coverage/Report/Xml/Project.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => '/php-code-coverage/Report/Xml/Report.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => '/php-code-coverage/Report/Xml/Source.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => '/php-code-coverage/Report/Xml/Tests.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => '/php-code-coverage/Report/Xml/Totals.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => '/php-code-coverage/Report/Xml/Unit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysisCacheNotConfiguredException' => '/php-code-coverage/Exception/StaticAnalysisCacheNotConfiguredException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CacheWarmer' => '/php-code-coverage/StaticAnalysis/CacheWarmer.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CachingFileAnalyser' => '/php-code-coverage/StaticAnalysis/CachingFileAnalyser.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CodeUnitFindingVisitor' => '/php-code-coverage/StaticAnalysis/CodeUnitFindingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ExecutableLinesFindingVisitor' => '/php-code-coverage/StaticAnalysis/ExecutableLinesFindingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\FileAnalyser' => '/php-code-coverage/StaticAnalysis/FileAnalyser.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\IgnoredLinesFindingVisitor' => '/php-code-coverage/StaticAnalysis/IgnoredLinesFindingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ParsingFileAnalyser' => '/php-code-coverage/StaticAnalysis/ParsingFileAnalyser.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\TestIdMissingException' => '/php-code-coverage/Exception/TestIdMissingException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => '/php-code-coverage/Exception/UnintentionallyCoveredCodeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Util\\DirectoryCouldNotBeCreatedException' => '/php-code-coverage/Exception/DirectoryCouldNotBeCreatedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Util\\Filesystem' => '/php-code-coverage/Util/Filesystem.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Util\\Percentage' => '/php-code-coverage/Util/Percentage.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\Version' => '/php-code-coverage/Version.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeCoverage\\XmlException' => '/php-code-coverage/Exception/XmlException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => '/sebastian-code-unit-reverse-lookup/Wizard.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\ClassMethodUnit' => '/sebastian-code-unit/ClassMethodUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\ClassUnit' => '/sebastian-code-unit/ClassUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\CodeUnit' => '/sebastian-code-unit/CodeUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\CodeUnitCollection' => '/sebastian-code-unit/CodeUnitCollection.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\CodeUnitCollectionIterator' => '/sebastian-code-unit/CodeUnitCollectionIterator.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\Exception' => '/sebastian-code-unit/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\FunctionUnit' => '/sebastian-code-unit/FunctionUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\InterfaceMethodUnit' => '/sebastian-code-unit/InterfaceMethodUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\InterfaceUnit' => '/sebastian-code-unit/InterfaceUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\InvalidCodeUnitException' => '/sebastian-code-unit/exceptions/InvalidCodeUnitException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\Mapper' => '/sebastian-code-unit/Mapper.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\NoTraitException' => '/sebastian-code-unit/exceptions/NoTraitException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\ReflectionException' => '/sebastian-code-unit/exceptions/ReflectionException.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\TraitMethodUnit' => '/sebastian-code-unit/TraitMethodUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\CodeUnit\\TraitUnit' => '/sebastian-code-unit/TraitUnit.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ArrayComparator' => '/sebastian-comparator/ArrayComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\Comparator' => '/sebastian-comparator/Comparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ComparisonFailure' => '/sebastian-comparator/ComparisonFailure.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\DOMNodeComparator' => '/sebastian-comparator/DOMNodeComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\DateTimeComparator' => '/sebastian-comparator/DateTimeComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\DoubleComparator' => '/sebastian-comparator/DoubleComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\Exception' => '/sebastian-comparator/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ExceptionComparator' => '/sebastian-comparator/ExceptionComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\Factory' => '/sebastian-comparator/Factory.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\MockObjectComparator' => '/sebastian-comparator/MockObjectComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\NumericComparator' => '/sebastian-comparator/NumericComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ObjectComparator' => '/sebastian-comparator/ObjectComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ResourceComparator' => '/sebastian-comparator/ResourceComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\RuntimeException' => '/sebastian-comparator/exceptions/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\ScalarComparator' => '/sebastian-comparator/ScalarComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\SplObjectStorageComparator' => '/sebastian-comparator/SplObjectStorageComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Comparator\\TypeComparator' => '/sebastian-comparator/TypeComparator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\Calculator' => '/sebastian-complexity/Calculator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\Complexity' => '/sebastian-complexity/Complexity/Complexity.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\ComplexityCalculatingVisitor' => '/sebastian-complexity/Visitor/ComplexityCalculatingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\ComplexityCollection' => '/sebastian-complexity/Complexity/ComplexityCollection.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\ComplexityCollectionIterator' => '/sebastian-complexity/Complexity/ComplexityCollectionIterator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\CyclomaticComplexityCalculatingVisitor' => '/sebastian-complexity/Visitor/CyclomaticComplexityCalculatingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\Exception' => '/sebastian-complexity/Exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Complexity\\RuntimeException' => '/sebastian-complexity/Exception/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Chunk' => '/sebastian-diff/Chunk.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\ConfigurationException' => '/sebastian-diff/Exception/ConfigurationException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Diff' => '/sebastian-diff/Diff.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Differ' => '/sebastian-diff/Differ.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Exception' => '/sebastian-diff/Exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\InvalidArgumentException' => '/sebastian-diff/Exception/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Line' => '/sebastian-diff/Line.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => '/sebastian-diff/LongestCommonSubsequenceCalculator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => '/sebastian-diff/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => '/sebastian-diff/Output/AbstractChunkOutputBuilder.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => '/sebastian-diff/Output/DiffOnlyOutputBuilder.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => '/sebastian-diff/Output/DiffOutputBuilderInterface.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => '/sebastian-diff/Output/StrictUnifiedDiffOutputBuilder.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => '/sebastian-diff/Output/UnifiedDiffOutputBuilder.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\Parser' => '/sebastian-diff/Parser.php', + 'PHPUnitPHAR\\SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => '/sebastian-diff/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'PHPUnitPHAR\\SebastianBergmann\\Environment\\Console' => '/sebastian-environment/Console.php', + 'PHPUnitPHAR\\SebastianBergmann\\Environment\\OperatingSystem' => '/sebastian-environment/OperatingSystem.php', + 'PHPUnitPHAR\\SebastianBergmann\\Environment\\Runtime' => '/sebastian-environment/Runtime.php', + 'PHPUnitPHAR\\SebastianBergmann\\Exporter\\Exporter' => '/sebastian-exporter/Exporter.php', + 'PHPUnitPHAR\\SebastianBergmann\\FileIterator\\Facade' => '/php-file-iterator/Facade.php', + 'PHPUnitPHAR\\SebastianBergmann\\FileIterator\\Factory' => '/php-file-iterator/Factory.php', + 'PHPUnitPHAR\\SebastianBergmann\\FileIterator\\Iterator' => '/php-file-iterator/Iterator.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\CodeExporter' => '/sebastian-global-state/CodeExporter.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\Exception' => '/sebastian-global-state/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\ExcludeList' => '/sebastian-global-state/ExcludeList.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\Restorer' => '/sebastian-global-state/Restorer.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\RuntimeException' => '/sebastian-global-state/exceptions/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\GlobalState\\Snapshot' => '/sebastian-global-state/Snapshot.php', + 'PHPUnitPHAR\\SebastianBergmann\\Invoker\\Exception' => '/php-invoker/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Invoker\\Invoker' => '/php-invoker/Invoker.php', + 'PHPUnitPHAR\\SebastianBergmann\\Invoker\\ProcessControlExtensionNotLoadedException' => '/php-invoker/exceptions/ProcessControlExtensionNotLoadedException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Invoker\\TimeoutException' => '/php-invoker/exceptions/TimeoutException.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\Counter' => '/sebastian-lines-of-code/Counter.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\Exception' => '/sebastian-lines-of-code/Exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\IllogicalValuesException' => '/sebastian-lines-of-code/Exception/IllogicalValuesException.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\LineCountingVisitor' => '/sebastian-lines-of-code/LineCountingVisitor.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\LinesOfCode' => '/sebastian-lines-of-code/LinesOfCode.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\NegativeValueException' => '/sebastian-lines-of-code/Exception/NegativeValueException.php', + 'PHPUnitPHAR\\SebastianBergmann\\LinesOfCode\\RuntimeException' => '/sebastian-lines-of-code/Exception/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectEnumerator\\Enumerator' => '/sebastian-object-enumerator/Enumerator.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectEnumerator\\Exception' => '/sebastian-object-enumerator/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => '/sebastian-object-enumerator/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectReflector\\Exception' => '/sebastian-object-reflector/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => '/sebastian-object-reflector/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\ObjectReflector\\ObjectReflector' => '/sebastian-object-reflector/ObjectReflector.php', + 'PHPUnitPHAR\\SebastianBergmann\\RecursionContext\\Context' => '/sebastian-recursion-context/Context.php', + 'PHPUnitPHAR\\SebastianBergmann\\RecursionContext\\Exception' => '/sebastian-recursion-context/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\RecursionContext\\InvalidArgumentException' => '/sebastian-recursion-context/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\ResourceOperations\\ResourceOperations' => '/sebastian-resource-operations/ResourceOperations.php', + 'PHPUnitPHAR\\SebastianBergmann\\Template\\Exception' => '/php-text-template/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Template\\InvalidArgumentException' => '/php-text-template/exceptions/InvalidArgumentException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Template\\RuntimeException' => '/php-text-template/exceptions/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Template\\Template' => '/php-text-template/Template.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\Duration' => '/php-timer/Duration.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\Exception' => '/php-timer/exceptions/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\NoActiveTimerException' => '/php-timer/exceptions/NoActiveTimerException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\ResourceUsageFormatter' => '/php-timer/ResourceUsageFormatter.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\TimeSinceStartOfRequestNotAvailableException' => '/php-timer/exceptions/TimeSinceStartOfRequestNotAvailableException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Timer\\Timer' => '/php-timer/Timer.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\CallableType' => '/sebastian-type/type/CallableType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\Exception' => '/sebastian-type/exception/Exception.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\FalseType' => '/sebastian-type/type/FalseType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\GenericObjectType' => '/sebastian-type/type/GenericObjectType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\IntersectionType' => '/sebastian-type/type/IntersectionType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\IterableType' => '/sebastian-type/type/IterableType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\MixedType' => '/sebastian-type/type/MixedType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\NeverType' => '/sebastian-type/type/NeverType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\NullType' => '/sebastian-type/type/NullType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\ObjectType' => '/sebastian-type/type/ObjectType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\Parameter' => '/sebastian-type/Parameter.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\ReflectionMapper' => '/sebastian-type/ReflectionMapper.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\RuntimeException' => '/sebastian-type/exception/RuntimeException.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\SimpleType' => '/sebastian-type/type/SimpleType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\StaticType' => '/sebastian-type/type/StaticType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\TrueType' => '/sebastian-type/type/TrueType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\Type' => '/sebastian-type/type/Type.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\TypeName' => '/sebastian-type/TypeName.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\UnionType' => '/sebastian-type/type/UnionType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\UnknownType' => '/sebastian-type/type/UnknownType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Type\\VoidType' => '/sebastian-type/type/VoidType.php', + 'PHPUnitPHAR\\SebastianBergmann\\Version' => '/sebastian-version/Version.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\Exception' => '/theseer-tokenizer/Exception.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\NamespaceUri' => '/theseer-tokenizer/NamespaceUri.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\NamespaceUriException' => '/theseer-tokenizer/NamespaceUriException.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\Token' => '/theseer-tokenizer/Token.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\TokenCollection' => '/theseer-tokenizer/TokenCollection.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\TokenCollectionException' => '/theseer-tokenizer/TokenCollectionException.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\Tokenizer' => '/theseer-tokenizer/Tokenizer.php', + 'PHPUnitPHAR\\TheSeer\\Tokenizer\\XMLSerializer' => '/theseer-tokenizer/XMLSerializer.php', + 'PHPUnitPHAR\\Webmozart\\Assert\\Assert' => '/webmozart-assert/Assert.php', + 'PHPUnitPHAR\\Webmozart\\Assert\\InvalidArgumentException' => '/webmozart-assert/InvalidArgumentException.php', + 'PHPUnitPHAR\\Webmozart\\Assert\\Mixin' => '/webmozart-assert/Mixin.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock' => '/phpdocumentor-reflection-docblock/DocBlock.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlockFactory' => '/phpdocumentor-reflection-docblock/DocBlockFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlockFactoryInterface' => '/phpdocumentor-reflection-docblock/DocBlockFactoryInterface.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Description' => '/phpdocumentor-reflection-docblock/DocBlock/Description.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\DescriptionFactory' => '/phpdocumentor-reflection-docblock/DocBlock/DescriptionFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\ExampleFinder' => '/phpdocumentor-reflection-docblock/DocBlock/ExampleFinder.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Serializer' => '/phpdocumentor-reflection-docblock/DocBlock/Serializer.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\StandardTagFactory' => '/phpdocumentor-reflection-docblock/DocBlock/StandardTagFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tag' => '/phpdocumentor-reflection-docblock/DocBlock/Tag.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\TagFactory' => '/phpdocumentor-reflection-docblock/DocBlock/TagFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Author' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Author.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\BaseTag' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/BaseTag.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Covers' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Covers.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Deprecated' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Deprecated.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Example' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Example.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Factory\\StaticMethod' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Factory/StaticMethod.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter\\AlignFormatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/AlignFormatter.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter\\PassthroughFormatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/PassthroughFormatter.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Generic' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Generic.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\InvalidTag' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/InvalidTag.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Link' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Link.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Method' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Method.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Param' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Param.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Property' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Property.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyRead' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyRead.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyWrite' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyWrite.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Fqsen' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Fqsen.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Reference' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Reference.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Url' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Url.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Return_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\See' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/See.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Since' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Since.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Source' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Source.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\TagWithType' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/TagWithType.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Throws' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Throws.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Uses' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Uses.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Var_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Version' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Version.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Element' => '/phpdocumentor-reflection-common/Element.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Exception\\PcreException' => '/phpdocumentor-reflection-docblock/Exception/PcreException.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\File' => '/phpdocumentor-reflection-common/File.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Fqsen' => '/phpdocumentor-reflection-common/Fqsen.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\FqsenResolver' => '/phpdocumentor-type-resolver/FqsenResolver.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Location' => '/phpdocumentor-reflection-common/Location.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Project' => '/phpdocumentor-reflection-common/Project.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\ProjectFactory' => '/phpdocumentor-reflection-common/ProjectFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoType' => '/phpdocumentor-type-resolver/PseudoType.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\ArrayShape' => '/phpdocumentor-type-resolver/PseudoTypes/ArrayShape.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\ArrayShapeItem' => '/phpdocumentor-type-resolver/PseudoTypes/ArrayShapeItem.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\CallableString' => '/phpdocumentor-type-resolver/PseudoTypes/CallableString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\ConstExpression' => '/phpdocumentor-type-resolver/PseudoTypes/ConstExpression.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\False_' => '/phpdocumentor-type-resolver/PseudoTypes/False_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\FloatValue' => '/phpdocumentor-type-resolver/PseudoTypes/FloatValue.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\HtmlEscapedString' => '/phpdocumentor-type-resolver/PseudoTypes/HtmlEscapedString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\IntegerRange' => '/phpdocumentor-type-resolver/PseudoTypes/IntegerRange.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\IntegerValue' => '/phpdocumentor-type-resolver/PseudoTypes/IntegerValue.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\List_' => '/phpdocumentor-type-resolver/PseudoTypes/List_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\LiteralString' => '/phpdocumentor-type-resolver/PseudoTypes/LiteralString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\LowercaseString' => '/phpdocumentor-type-resolver/PseudoTypes/LowercaseString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NegativeInteger' => '/phpdocumentor-type-resolver/PseudoTypes/NegativeInteger.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyList' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyList.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyLowercaseString' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyLowercaseString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyString' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\NumericString' => '/phpdocumentor-type-resolver/PseudoTypes/NumericString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\Numeric_' => '/phpdocumentor-type-resolver/PseudoTypes/Numeric_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\PositiveInteger' => '/phpdocumentor-type-resolver/PseudoTypes/PositiveInteger.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\StringValue' => '/phpdocumentor-type-resolver/PseudoTypes/StringValue.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\TraitString' => '/phpdocumentor-type-resolver/PseudoTypes/TraitString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\PseudoTypes\\True_' => '/phpdocumentor-type-resolver/PseudoTypes/True_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Type' => '/phpdocumentor-type-resolver/Type.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\TypeResolver' => '/phpdocumentor-type-resolver/TypeResolver.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\AbstractList' => '/phpdocumentor-type-resolver/Types/AbstractList.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\AggregatedType' => '/phpdocumentor-type-resolver/Types/AggregatedType.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\ArrayKey' => '/phpdocumentor-type-resolver/Types/ArrayKey.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Array_' => '/phpdocumentor-type-resolver/Types/Array_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Boolean' => '/phpdocumentor-type-resolver/Types/Boolean.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\CallableParameter' => '/phpdocumentor-type-resolver/Types/CallableParameter.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Callable_' => '/phpdocumentor-type-resolver/Types/Callable_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\ClassString' => '/phpdocumentor-type-resolver/Types/ClassString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Collection' => '/phpdocumentor-type-resolver/Types/Collection.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Compound' => '/phpdocumentor-type-resolver/Types/Compound.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Context' => '/phpdocumentor-type-resolver/Types/Context.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\ContextFactory' => '/phpdocumentor-type-resolver/Types/ContextFactory.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Expression' => '/phpdocumentor-type-resolver/Types/Expression.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Float_' => '/phpdocumentor-type-resolver/Types/Float_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Integer' => '/phpdocumentor-type-resolver/Types/Integer.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\InterfaceString' => '/phpdocumentor-type-resolver/Types/InterfaceString.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Intersection' => '/phpdocumentor-type-resolver/Types/Intersection.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Iterable_' => '/phpdocumentor-type-resolver/Types/Iterable_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Mixed_' => '/phpdocumentor-type-resolver/Types/Mixed_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Never_' => '/phpdocumentor-type-resolver/Types/Never_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Null_' => '/phpdocumentor-type-resolver/Types/Null_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Nullable' => '/phpdocumentor-type-resolver/Types/Nullable.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Object_' => '/phpdocumentor-type-resolver/Types/Object_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Parent_' => '/phpdocumentor-type-resolver/Types/Parent_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Resource_' => '/phpdocumentor-type-resolver/Types/Resource_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Scalar' => '/phpdocumentor-type-resolver/Types/Scalar.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Self_' => '/phpdocumentor-type-resolver/Types/Self_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Static_' => '/phpdocumentor-type-resolver/Types/Static_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\String_' => '/phpdocumentor-type-resolver/Types/String_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\This' => '/phpdocumentor-type-resolver/Types/This.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Types\\Void_' => '/phpdocumentor-type-resolver/Types/Void_.php', + 'PHPUnitPHAR\\phpDocumentor\\Reflection\\Utils' => '/phpdocumentor-reflection-docblock/Utils.php', 'PHPUnit\\Exception' => '/phpunit/Exception.php', 'PHPUnit\\Framework\\ActualValueIsNotAnObjectException' => '/phpunit/Framework/Exception/ActualValueIsNotAnObjectException.php', 'PHPUnit\\Framework\\Assert' => '/phpunit/Framework/Assert.php', @@ -1402,327 +2226,6 @@ foreach (['PHPUnit\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy 'PHPUnit\\Framework\\UnintentionallyCoveredCodeError' => '/phpunit/Framework/Exception/UnintentionallyCoveredCodeError.php', 'PHPUnit\\Framework\\Warning' => '/phpunit/Framework/Exception/Warning.php', 'PHPUnit\\Framework\\WarningTestCase' => '/phpunit/Framework/WarningTestCase.php', - 'PHPUnit\\PharIo\\Manifest\\Application' => '/phar-io-manifest/values/Application.php', - 'PHPUnit\\PharIo\\Manifest\\ApplicationName' => '/phar-io-manifest/values/ApplicationName.php', - 'PHPUnit\\PharIo\\Manifest\\Author' => '/phar-io-manifest/values/Author.php', - 'PHPUnit\\PharIo\\Manifest\\AuthorCollection' => '/phar-io-manifest/values/AuthorCollection.php', - 'PHPUnit\\PharIo\\Manifest\\AuthorCollectionIterator' => '/phar-io-manifest/values/AuthorCollectionIterator.php', - 'PHPUnit\\PharIo\\Manifest\\AuthorElement' => '/phar-io-manifest/xml/AuthorElement.php', - 'PHPUnit\\PharIo\\Manifest\\AuthorElementCollection' => '/phar-io-manifest/xml/AuthorElementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\BundledComponent' => '/phar-io-manifest/values/BundledComponent.php', - 'PHPUnit\\PharIo\\Manifest\\BundledComponentCollection' => '/phar-io-manifest/values/BundledComponentCollection.php', - 'PHPUnit\\PharIo\\Manifest\\BundledComponentCollectionIterator' => '/phar-io-manifest/values/BundledComponentCollectionIterator.php', - 'PHPUnit\\PharIo\\Manifest\\BundlesElement' => '/phar-io-manifest/xml/BundlesElement.php', - 'PHPUnit\\PharIo\\Manifest\\ComponentElement' => '/phar-io-manifest/xml/ComponentElement.php', - 'PHPUnit\\PharIo\\Manifest\\ComponentElementCollection' => '/phar-io-manifest/xml/ComponentElementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\ContainsElement' => '/phar-io-manifest/xml/ContainsElement.php', - 'PHPUnit\\PharIo\\Manifest\\CopyrightElement' => '/phar-io-manifest/xml/CopyrightElement.php', - 'PHPUnit\\PharIo\\Manifest\\CopyrightInformation' => '/phar-io-manifest/values/CopyrightInformation.php', - 'PHPUnit\\PharIo\\Manifest\\ElementCollection' => '/phar-io-manifest/xml/ElementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\ElementCollectionException' => '/phar-io-manifest/exceptions/ElementCollectionException.php', - 'PHPUnit\\PharIo\\Manifest\\Email' => '/phar-io-manifest/values/Email.php', - 'PHPUnit\\PharIo\\Manifest\\Exception' => '/phar-io-manifest/exceptions/Exception.php', - 'PHPUnit\\PharIo\\Manifest\\ExtElement' => '/phar-io-manifest/xml/ExtElement.php', - 'PHPUnit\\PharIo\\Manifest\\ExtElementCollection' => '/phar-io-manifest/xml/ExtElementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\Extension' => '/phar-io-manifest/values/Extension.php', - 'PHPUnit\\PharIo\\Manifest\\ExtensionElement' => '/phar-io-manifest/xml/ExtensionElement.php', - 'PHPUnit\\PharIo\\Manifest\\InvalidApplicationNameException' => '/phar-io-manifest/exceptions/InvalidApplicationNameException.php', - 'PHPUnit\\PharIo\\Manifest\\InvalidEmailException' => '/phar-io-manifest/exceptions/InvalidEmailException.php', - 'PHPUnit\\PharIo\\Manifest\\InvalidUrlException' => '/phar-io-manifest/exceptions/InvalidUrlException.php', - 'PHPUnit\\PharIo\\Manifest\\Library' => '/phar-io-manifest/values/Library.php', - 'PHPUnit\\PharIo\\Manifest\\License' => '/phar-io-manifest/values/License.php', - 'PHPUnit\\PharIo\\Manifest\\LicenseElement' => '/phar-io-manifest/xml/LicenseElement.php', - 'PHPUnit\\PharIo\\Manifest\\Manifest' => '/phar-io-manifest/values/Manifest.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocument' => '/phar-io-manifest/xml/ManifestDocument.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocumentException' => '/phar-io-manifest/exceptions/ManifestDocumentException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocumentLoadingException' => '/phar-io-manifest/exceptions/ManifestDocumentLoadingException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocumentMapper' => '/phar-io-manifest/ManifestDocumentMapper.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestDocumentMapperException' => '/phar-io-manifest/exceptions/ManifestDocumentMapperException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestElement' => '/phar-io-manifest/xml/ManifestElement.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestElementException' => '/phar-io-manifest/exceptions/ManifestElementException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestLoader' => '/phar-io-manifest/ManifestLoader.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestLoaderException' => '/phar-io-manifest/exceptions/ManifestLoaderException.php', - 'PHPUnit\\PharIo\\Manifest\\ManifestSerializer' => '/phar-io-manifest/ManifestSerializer.php', - 'PHPUnit\\PharIo\\Manifest\\PhpElement' => '/phar-io-manifest/xml/PhpElement.php', - 'PHPUnit\\PharIo\\Manifest\\PhpExtensionRequirement' => '/phar-io-manifest/values/PhpExtensionRequirement.php', - 'PHPUnit\\PharIo\\Manifest\\PhpVersionRequirement' => '/phar-io-manifest/values/PhpVersionRequirement.php', - 'PHPUnit\\PharIo\\Manifest\\Requirement' => '/phar-io-manifest/values/Requirement.php', - 'PHPUnit\\PharIo\\Manifest\\RequirementCollection' => '/phar-io-manifest/values/RequirementCollection.php', - 'PHPUnit\\PharIo\\Manifest\\RequirementCollectionIterator' => '/phar-io-manifest/values/RequirementCollectionIterator.php', - 'PHPUnit\\PharIo\\Manifest\\RequiresElement' => '/phar-io-manifest/xml/RequiresElement.php', - 'PHPUnit\\PharIo\\Manifest\\Type' => '/phar-io-manifest/values/Type.php', - 'PHPUnit\\PharIo\\Manifest\\Url' => '/phar-io-manifest/values/Url.php', - 'PHPUnit\\PharIo\\Version\\AbstractVersionConstraint' => '/phar-io-version/constraints/AbstractVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\AndVersionConstraintGroup' => '/phar-io-version/constraints/AndVersionConstraintGroup.php', - 'PHPUnit\\PharIo\\Version\\AnyVersionConstraint' => '/phar-io-version/constraints/AnyVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\BuildMetaData' => '/phar-io-version/BuildMetaData.php', - 'PHPUnit\\PharIo\\Version\\ExactVersionConstraint' => '/phar-io-version/constraints/ExactVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\Exception' => '/phar-io-version/exceptions/Exception.php', - 'PHPUnit\\PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => '/phar-io-version/constraints/GreaterThanOrEqualToVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\InvalidPreReleaseSuffixException' => '/phar-io-version/exceptions/InvalidPreReleaseSuffixException.php', - 'PHPUnit\\PharIo\\Version\\InvalidVersionException' => '/phar-io-version/exceptions/InvalidVersionException.php', - 'PHPUnit\\PharIo\\Version\\NoBuildMetaDataException' => '/phar-io-version/exceptions/NoBuildMetaDataException.php', - 'PHPUnit\\PharIo\\Version\\NoPreReleaseSuffixException' => '/phar-io-version/exceptions/NoPreReleaseSuffixException.php', - 'PHPUnit\\PharIo\\Version\\OrVersionConstraintGroup' => '/phar-io-version/constraints/OrVersionConstraintGroup.php', - 'PHPUnit\\PharIo\\Version\\PreReleaseSuffix' => '/phar-io-version/PreReleaseSuffix.php', - 'PHPUnit\\PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => '/phar-io-version/constraints/SpecificMajorAndMinorVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\SpecificMajorVersionConstraint' => '/phar-io-version/constraints/SpecificMajorVersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\UnsupportedVersionConstraintException' => '/phar-io-version/exceptions/UnsupportedVersionConstraintException.php', - 'PHPUnit\\PharIo\\Version\\Version' => '/phar-io-version/Version.php', - 'PHPUnit\\PharIo\\Version\\VersionConstraint' => '/phar-io-version/constraints/VersionConstraint.php', - 'PHPUnit\\PharIo\\Version\\VersionConstraintParser' => '/phar-io-version/VersionConstraintParser.php', - 'PHPUnit\\PharIo\\Version\\VersionConstraintValue' => '/phar-io-version/VersionConstraintValue.php', - 'PHPUnit\\PharIo\\Version\\VersionNumber' => '/phar-io-version/VersionNumber.php', - 'PHPUnit\\PhpParser\\Builder' => '/nikic-php-parser/PhpParser/Builder.php', - 'PHPUnit\\PhpParser\\BuilderFactory' => '/nikic-php-parser/PhpParser/BuilderFactory.php', - 'PHPUnit\\PhpParser\\BuilderHelpers' => '/nikic-php-parser/PhpParser/BuilderHelpers.php', - 'PHPUnit\\PhpParser\\Builder\\ClassConst' => '/nikic-php-parser/PhpParser/Builder/ClassConst.php', - 'PHPUnit\\PhpParser\\Builder\\Class_' => '/nikic-php-parser/PhpParser/Builder/Class_.php', - 'PHPUnit\\PhpParser\\Builder\\Declaration' => '/nikic-php-parser/PhpParser/Builder/Declaration.php', - 'PHPUnit\\PhpParser\\Builder\\EnumCase' => '/nikic-php-parser/PhpParser/Builder/EnumCase.php', - 'PHPUnit\\PhpParser\\Builder\\Enum_' => '/nikic-php-parser/PhpParser/Builder/Enum_.php', - 'PHPUnit\\PhpParser\\Builder\\FunctionLike' => '/nikic-php-parser/PhpParser/Builder/FunctionLike.php', - 'PHPUnit\\PhpParser\\Builder\\Function_' => '/nikic-php-parser/PhpParser/Builder/Function_.php', - 'PHPUnit\\PhpParser\\Builder\\Interface_' => '/nikic-php-parser/PhpParser/Builder/Interface_.php', - 'PHPUnit\\PhpParser\\Builder\\Method' => '/nikic-php-parser/PhpParser/Builder/Method.php', - 'PHPUnit\\PhpParser\\Builder\\Namespace_' => '/nikic-php-parser/PhpParser/Builder/Namespace_.php', - 'PHPUnit\\PhpParser\\Builder\\Param' => '/nikic-php-parser/PhpParser/Builder/Param.php', - 'PHPUnit\\PhpParser\\Builder\\Property' => '/nikic-php-parser/PhpParser/Builder/Property.php', - 'PHPUnit\\PhpParser\\Builder\\TraitUse' => '/nikic-php-parser/PhpParser/Builder/TraitUse.php', - 'PHPUnit\\PhpParser\\Builder\\TraitUseAdaptation' => '/nikic-php-parser/PhpParser/Builder/TraitUseAdaptation.php', - 'PHPUnit\\PhpParser\\Builder\\Trait_' => '/nikic-php-parser/PhpParser/Builder/Trait_.php', - 'PHPUnit\\PhpParser\\Builder\\Use_' => '/nikic-php-parser/PhpParser/Builder/Use_.php', - 'PHPUnit\\PhpParser\\Comment' => '/nikic-php-parser/PhpParser/Comment.php', - 'PHPUnit\\PhpParser\\Comment\\Doc' => '/nikic-php-parser/PhpParser/Comment/Doc.php', - 'PHPUnit\\PhpParser\\ConstExprEvaluationException' => '/nikic-php-parser/PhpParser/ConstExprEvaluationException.php', - 'PHPUnit\\PhpParser\\ConstExprEvaluator' => '/nikic-php-parser/PhpParser/ConstExprEvaluator.php', - 'PHPUnit\\PhpParser\\Error' => '/nikic-php-parser/PhpParser/Error.php', - 'PHPUnit\\PhpParser\\ErrorHandler' => '/nikic-php-parser/PhpParser/ErrorHandler.php', - 'PHPUnit\\PhpParser\\ErrorHandler\\Collecting' => '/nikic-php-parser/PhpParser/ErrorHandler/Collecting.php', - 'PHPUnit\\PhpParser\\ErrorHandler\\Throwing' => '/nikic-php-parser/PhpParser/ErrorHandler/Throwing.php', - 'PHPUnit\\PhpParser\\Internal\\DiffElem' => '/nikic-php-parser/PhpParser/Internal/DiffElem.php', - 'PHPUnit\\PhpParser\\Internal\\Differ' => '/nikic-php-parser/PhpParser/Internal/Differ.php', - 'PHPUnit\\PhpParser\\Internal\\PrintableNewAnonClassNode' => '/nikic-php-parser/PhpParser/Internal/PrintableNewAnonClassNode.php', - 'PHPUnit\\PhpParser\\Internal\\TokenStream' => '/nikic-php-parser/PhpParser/Internal/TokenStream.php', - 'PHPUnit\\PhpParser\\JsonDecoder' => '/nikic-php-parser/PhpParser/JsonDecoder.php', - 'PHPUnit\\PhpParser\\Lexer' => '/nikic-php-parser/PhpParser/Lexer.php', - 'PHPUnit\\PhpParser\\Lexer\\Emulative' => '/nikic-php-parser/PhpParser/Lexer/Emulative.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\CoaleseEqualTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\FlexibleDocStringEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\NumericLiteralSeparatorEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\ReadonlyFunctionTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\ReadonlyTokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\ReverseEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php', - 'PHPUnit\\PhpParser\\Lexer\\TokenEmulator\\TokenEmulator' => '/nikic-php-parser/PhpParser/Lexer/TokenEmulator/TokenEmulator.php', - 'PHPUnit\\PhpParser\\NameContext' => '/nikic-php-parser/PhpParser/NameContext.php', - 'PHPUnit\\PhpParser\\Node' => '/nikic-php-parser/PhpParser/Node.php', - 'PHPUnit\\PhpParser\\NodeAbstract' => '/nikic-php-parser/PhpParser/NodeAbstract.php', - 'PHPUnit\\PhpParser\\NodeDumper' => '/nikic-php-parser/PhpParser/NodeDumper.php', - 'PHPUnit\\PhpParser\\NodeFinder' => '/nikic-php-parser/PhpParser/NodeFinder.php', - 'PHPUnit\\PhpParser\\NodeTraverser' => '/nikic-php-parser/PhpParser/NodeTraverser.php', - 'PHPUnit\\PhpParser\\NodeTraverserInterface' => '/nikic-php-parser/PhpParser/NodeTraverserInterface.php', - 'PHPUnit\\PhpParser\\NodeVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitorAbstract' => '/nikic-php-parser/PhpParser/NodeVisitorAbstract.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\CloningVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/CloningVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\FindingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/FindingVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\FirstFindingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/FirstFindingVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\NameResolver' => '/nikic-php-parser/PhpParser/NodeVisitor/NameResolver.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\NodeConnectingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/NodeConnectingVisitor.php', - 'PHPUnit\\PhpParser\\NodeVisitor\\ParentConnectingVisitor' => '/nikic-php-parser/PhpParser/NodeVisitor/ParentConnectingVisitor.php', - 'PHPUnit\\PhpParser\\Node\\Arg' => '/nikic-php-parser/PhpParser/Node/Arg.php', - 'PHPUnit\\PhpParser\\Node\\Attribute' => '/nikic-php-parser/PhpParser/Node/Attribute.php', - 'PHPUnit\\PhpParser\\Node\\AttributeGroup' => '/nikic-php-parser/PhpParser/Node/AttributeGroup.php', - 'PHPUnit\\PhpParser\\Node\\ComplexType' => '/nikic-php-parser/PhpParser/Node/ComplexType.php', - 'PHPUnit\\PhpParser\\Node\\Const_' => '/nikic-php-parser/PhpParser/Node/Const_.php', - 'PHPUnit\\PhpParser\\Node\\Expr' => '/nikic-php-parser/PhpParser/Node/Expr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ArrayDimFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ArrayDimFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ArrayItem' => '/nikic-php-parser/PhpParser/Node/Expr/ArrayItem.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Array_' => '/nikic-php-parser/PhpParser/Node/Expr/Array_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ArrowFunction' => '/nikic-php-parser/PhpParser/Node/Expr/ArrowFunction.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Assign' => '/nikic-php-parser/PhpParser/Node/Expr/Assign.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseOr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseXor.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Coalesce' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Coalesce.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Concat' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Concat.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Div' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Div.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Minus' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Minus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Mod' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mod.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Mul' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mul.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Plus' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Plus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\Pow' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/Pow.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\ShiftLeft' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftLeft.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignOp\\ShiftRight' => '/nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftRight.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\AssignRef' => '/nikic-php-parser/PhpParser/Node/Expr/AssignRef.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BitwiseXor' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BooleanAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\BooleanOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanOr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Coalesce' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Coalesce.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Concat' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Concat.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Div' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Div.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Equal' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Equal.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Greater' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Greater.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\GreaterOrEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Identical' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Identical.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalAnd' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalOr' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalOr.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\LogicalXor' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalXor.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Minus' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Minus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Mod' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mod.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Mul' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mul.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\NotEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotEqual.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\NotIdentical' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotIdentical.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Plus' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Plus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Pow' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Pow.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\ShiftLeft' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\ShiftRight' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftRight.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Smaller' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Smaller.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\SmallerOrEqual' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => '/nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Spaceship.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BitwiseNot' => '/nikic-php-parser/PhpParser/Node/Expr/BitwiseNot.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\BooleanNot' => '/nikic-php-parser/PhpParser/Node/Expr/BooleanNot.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\CallLike' => '/nikic-php-parser/PhpParser/Node/Expr/CallLike.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast' => '/nikic-php-parser/PhpParser/Node/Expr/Cast.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Array_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Array_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Bool_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Bool_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Double' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Double.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Int_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Int_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Object_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Object_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\String_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/String_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Cast\\Unset_' => '/nikic-php-parser/PhpParser/Node/Expr/Cast/Unset_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ClassConstFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ClassConstFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Clone_' => '/nikic-php-parser/PhpParser/Node/Expr/Clone_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Closure' => '/nikic-php-parser/PhpParser/Node/Expr/Closure.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ClosureUse' => '/nikic-php-parser/PhpParser/Node/Expr/ClosureUse.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ConstFetch' => '/nikic-php-parser/PhpParser/Node/Expr/ConstFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Empty_' => '/nikic-php-parser/PhpParser/Node/Expr/Empty_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Error' => '/nikic-php-parser/PhpParser/Node/Expr/Error.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ErrorSuppress' => '/nikic-php-parser/PhpParser/Node/Expr/ErrorSuppress.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Eval_' => '/nikic-php-parser/PhpParser/Node/Expr/Eval_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Exit_' => '/nikic-php-parser/PhpParser/Node/Expr/Exit_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\FuncCall' => '/nikic-php-parser/PhpParser/Node/Expr/FuncCall.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Include_' => '/nikic-php-parser/PhpParser/Node/Expr/Include_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Instanceof_' => '/nikic-php-parser/PhpParser/Node/Expr/Instanceof_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Isset_' => '/nikic-php-parser/PhpParser/Node/Expr/Isset_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\List_' => '/nikic-php-parser/PhpParser/Node/Expr/List_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Match_' => '/nikic-php-parser/PhpParser/Node/Expr/Match_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\MethodCall' => '/nikic-php-parser/PhpParser/Node/Expr/MethodCall.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\New_' => '/nikic-php-parser/PhpParser/Node/Expr/New_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\NullsafeMethodCall' => '/nikic-php-parser/PhpParser/Node/Expr/NullsafeMethodCall.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\NullsafePropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/NullsafePropertyFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PostDec' => '/nikic-php-parser/PhpParser/Node/Expr/PostDec.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PostInc' => '/nikic-php-parser/PhpParser/Node/Expr/PostInc.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PreDec' => '/nikic-php-parser/PhpParser/Node/Expr/PreDec.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PreInc' => '/nikic-php-parser/PhpParser/Node/Expr/PreInc.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Print_' => '/nikic-php-parser/PhpParser/Node/Expr/Print_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\PropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/PropertyFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\ShellExec' => '/nikic-php-parser/PhpParser/Node/Expr/ShellExec.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\StaticCall' => '/nikic-php-parser/PhpParser/Node/Expr/StaticCall.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\StaticPropertyFetch' => '/nikic-php-parser/PhpParser/Node/Expr/StaticPropertyFetch.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Ternary' => '/nikic-php-parser/PhpParser/Node/Expr/Ternary.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Throw_' => '/nikic-php-parser/PhpParser/Node/Expr/Throw_.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\UnaryMinus' => '/nikic-php-parser/PhpParser/Node/Expr/UnaryMinus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\UnaryPlus' => '/nikic-php-parser/PhpParser/Node/Expr/UnaryPlus.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Variable' => '/nikic-php-parser/PhpParser/Node/Expr/Variable.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\YieldFrom' => '/nikic-php-parser/PhpParser/Node/Expr/YieldFrom.php', - 'PHPUnit\\PhpParser\\Node\\Expr\\Yield_' => '/nikic-php-parser/PhpParser/Node/Expr/Yield_.php', - 'PHPUnit\\PhpParser\\Node\\FunctionLike' => '/nikic-php-parser/PhpParser/Node/FunctionLike.php', - 'PHPUnit\\PhpParser\\Node\\Identifier' => '/nikic-php-parser/PhpParser/Node/Identifier.php', - 'PHPUnit\\PhpParser\\Node\\IntersectionType' => '/nikic-php-parser/PhpParser/Node/IntersectionType.php', - 'PHPUnit\\PhpParser\\Node\\MatchArm' => '/nikic-php-parser/PhpParser/Node/MatchArm.php', - 'PHPUnit\\PhpParser\\Node\\Name' => '/nikic-php-parser/PhpParser/Node/Name.php', - 'PHPUnit\\PhpParser\\Node\\Name\\FullyQualified' => '/nikic-php-parser/PhpParser/Node/Name/FullyQualified.php', - 'PHPUnit\\PhpParser\\Node\\Name\\Relative' => '/nikic-php-parser/PhpParser/Node/Name/Relative.php', - 'PHPUnit\\PhpParser\\Node\\NullableType' => '/nikic-php-parser/PhpParser/Node/NullableType.php', - 'PHPUnit\\PhpParser\\Node\\Param' => '/nikic-php-parser/PhpParser/Node/Param.php', - 'PHPUnit\\PhpParser\\Node\\Scalar' => '/nikic-php-parser/PhpParser/Node/Scalar.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\DNumber' => '/nikic-php-parser/PhpParser/Node/Scalar/DNumber.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\Encapsed' => '/nikic-php-parser/PhpParser/Node/Scalar/Encapsed.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\EncapsedStringPart' => '/nikic-php-parser/PhpParser/Node/Scalar/EncapsedStringPart.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\LNumber' => '/nikic-php-parser/PhpParser/Node/Scalar/LNumber.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Class_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Class_.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Dir' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Dir.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\File' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/File.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Function_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Function_.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Line' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Line.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Method' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Method.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Namespace_.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => '/nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Trait_.php', - 'PHPUnit\\PhpParser\\Node\\Scalar\\String_' => '/nikic-php-parser/PhpParser/Node/Scalar/String_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt' => '/nikic-php-parser/PhpParser/Node/Stmt.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Break_' => '/nikic-php-parser/PhpParser/Node/Stmt/Break_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Case_' => '/nikic-php-parser/PhpParser/Node/Stmt/Case_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Catch_' => '/nikic-php-parser/PhpParser/Node/Stmt/Catch_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\ClassConst' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassConst.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\ClassLike' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassLike.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\ClassMethod' => '/nikic-php-parser/PhpParser/Node/Stmt/ClassMethod.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Class_' => '/nikic-php-parser/PhpParser/Node/Stmt/Class_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Const_' => '/nikic-php-parser/PhpParser/Node/Stmt/Const_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Continue_' => '/nikic-php-parser/PhpParser/Node/Stmt/Continue_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\DeclareDeclare' => '/nikic-php-parser/PhpParser/Node/Stmt/DeclareDeclare.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Declare_' => '/nikic-php-parser/PhpParser/Node/Stmt/Declare_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Do_' => '/nikic-php-parser/PhpParser/Node/Stmt/Do_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Echo_' => '/nikic-php-parser/PhpParser/Node/Stmt/Echo_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\ElseIf_' => '/nikic-php-parser/PhpParser/Node/Stmt/ElseIf_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Else_' => '/nikic-php-parser/PhpParser/Node/Stmt/Else_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\EnumCase' => '/nikic-php-parser/PhpParser/Node/Stmt/EnumCase.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Enum_' => '/nikic-php-parser/PhpParser/Node/Stmt/Enum_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Expression' => '/nikic-php-parser/PhpParser/Node/Stmt/Expression.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Finally_' => '/nikic-php-parser/PhpParser/Node/Stmt/Finally_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\For_' => '/nikic-php-parser/PhpParser/Node/Stmt/For_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Foreach_' => '/nikic-php-parser/PhpParser/Node/Stmt/Foreach_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Function_' => '/nikic-php-parser/PhpParser/Node/Stmt/Function_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Global_' => '/nikic-php-parser/PhpParser/Node/Stmt/Global_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Goto_' => '/nikic-php-parser/PhpParser/Node/Stmt/Goto_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\GroupUse' => '/nikic-php-parser/PhpParser/Node/Stmt/GroupUse.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\HaltCompiler' => '/nikic-php-parser/PhpParser/Node/Stmt/HaltCompiler.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\If_' => '/nikic-php-parser/PhpParser/Node/Stmt/If_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\InlineHTML' => '/nikic-php-parser/PhpParser/Node/Stmt/InlineHTML.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Interface_' => '/nikic-php-parser/PhpParser/Node/Stmt/Interface_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Label' => '/nikic-php-parser/PhpParser/Node/Stmt/Label.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Namespace_' => '/nikic-php-parser/PhpParser/Node/Stmt/Namespace_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Nop' => '/nikic-php-parser/PhpParser/Node/Stmt/Nop.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Property' => '/nikic-php-parser/PhpParser/Node/Stmt/Property.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\PropertyProperty' => '/nikic-php-parser/PhpParser/Node/Stmt/PropertyProperty.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Return_' => '/nikic-php-parser/PhpParser/Node/Stmt/Return_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\StaticVar' => '/nikic-php-parser/PhpParser/Node/Stmt/StaticVar.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Static_' => '/nikic-php-parser/PhpParser/Node/Stmt/Static_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Switch_' => '/nikic-php-parser/PhpParser/Node/Stmt/Switch_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Throw_' => '/nikic-php-parser/PhpParser/Node/Stmt/Throw_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TraitUse' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUse.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TraitUseAdaptation' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Precedence' => '/nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Trait_' => '/nikic-php-parser/PhpParser/Node/Stmt/Trait_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\TryCatch' => '/nikic-php-parser/PhpParser/Node/Stmt/TryCatch.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Unset_' => '/nikic-php-parser/PhpParser/Node/Stmt/Unset_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\UseUse' => '/nikic-php-parser/PhpParser/Node/Stmt/UseUse.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\Use_' => '/nikic-php-parser/PhpParser/Node/Stmt/Use_.php', - 'PHPUnit\\PhpParser\\Node\\Stmt\\While_' => '/nikic-php-parser/PhpParser/Node/Stmt/While_.php', - 'PHPUnit\\PhpParser\\Node\\UnionType' => '/nikic-php-parser/PhpParser/Node/UnionType.php', - 'PHPUnit\\PhpParser\\Node\\VarLikeIdentifier' => '/nikic-php-parser/PhpParser/Node/VarLikeIdentifier.php', - 'PHPUnit\\PhpParser\\Node\\VariadicPlaceholder' => '/nikic-php-parser/PhpParser/Node/VariadicPlaceholder.php', - 'PHPUnit\\PhpParser\\Parser' => '/nikic-php-parser/PhpParser/Parser.php', - 'PHPUnit\\PhpParser\\ParserAbstract' => '/nikic-php-parser/PhpParser/ParserAbstract.php', - 'PHPUnit\\PhpParser\\ParserFactory' => '/nikic-php-parser/PhpParser/ParserFactory.php', - 'PHPUnit\\PhpParser\\Parser\\Multiple' => '/nikic-php-parser/PhpParser/Parser/Multiple.php', - 'PHPUnit\\PhpParser\\Parser\\Php5' => '/nikic-php-parser/PhpParser/Parser/Php5.php', - 'PHPUnit\\PhpParser\\Parser\\Php7' => '/nikic-php-parser/PhpParser/Parser/Php7.php', - 'PHPUnit\\PhpParser\\Parser\\Tokens' => '/nikic-php-parser/PhpParser/Parser/Tokens.php', - 'PHPUnit\\PhpParser\\PrettyPrinterAbstract' => '/nikic-php-parser/PhpParser/PrettyPrinterAbstract.php', - 'PHPUnit\\PhpParser\\PrettyPrinter\\Standard' => '/nikic-php-parser/PhpParser/PrettyPrinter/Standard.php', 'PHPUnit\\Runner\\AfterIncompleteTestHook' => '/phpunit/Runner/Hook/AfterIncompleteTestHook.php', 'PHPUnit\\Runner\\AfterLastTestHook' => '/phpunit/Runner/Hook/AfterLastTestHook.php', 'PHPUnit\\Runner\\AfterRiskyTestHook' => '/phpunit/Runner/Hook/AfterRiskyTestHook.php', @@ -1755,206 +2258,6 @@ foreach (['PHPUnit\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy 'PHPUnit\\Runner\\TestSuiteLoader' => '/phpunit/Runner/TestSuiteLoader.php', 'PHPUnit\\Runner\\TestSuiteSorter' => '/phpunit/Runner/TestSuiteSorter.php', 'PHPUnit\\Runner\\Version' => '/phpunit/Runner/Version.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\AmbiguousOptionException' => '/sebastian-cli-parser/exceptions/AmbiguousOptionException.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\Exception' => '/sebastian-cli-parser/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\OptionDoesNotAllowArgumentException' => '/sebastian-cli-parser/exceptions/OptionDoesNotAllowArgumentException.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\Parser' => '/sebastian-cli-parser/Parser.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\RequiredOptionArgumentMissingException' => '/sebastian-cli-parser/exceptions/RequiredOptionArgumentMissingException.php', - 'PHPUnit\\SebastianBergmann\\CliParser\\UnknownOptionException' => '/sebastian-cli-parser/exceptions/UnknownOptionException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\BranchAndPathCoverageNotSupportedException' => '/php-code-coverage/Exception/BranchAndPathCoverageNotSupportedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\CodeCoverage' => '/php-code-coverage/CodeCoverage.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\DeadCodeDetectionNotSupportedException' => '/php-code-coverage/Exception/DeadCodeDetectionNotSupportedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Driver' => '/php-code-coverage/Driver/Driver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PathExistsButIsNotDirectoryException' => '/php-code-coverage/Exception/PathExistsButIsNotDirectoryException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PcovDriver' => '/php-code-coverage/Driver/PcovDriver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PcovNotAvailableException' => '/php-code-coverage/Exception/PcovNotAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PhpdbgDriver' => '/php-code-coverage/Driver/PhpdbgDriver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\PhpdbgNotAvailableException' => '/php-code-coverage/Exception/PhpdbgNotAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Selector' => '/php-code-coverage/Driver/Selector.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\WriteOperationFailedException' => '/php-code-coverage/Exception/WriteOperationFailedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\WrongXdebugVersionException' => '/php-code-coverage/Exception/WrongXdebugVersionException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug2Driver' => '/php-code-coverage/Driver/Xdebug2Driver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug2NotEnabledException' => '/php-code-coverage/Exception/Xdebug2NotEnabledException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug3Driver' => '/php-code-coverage/Driver/Xdebug3Driver.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\Xdebug3NotEnabledException' => '/php-code-coverage/Exception/Xdebug3NotEnabledException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotAvailableException' => '/php-code-coverage/Exception/XdebugNotAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Exception' => '/php-code-coverage/Exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Filter' => '/php-code-coverage/Filter.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => '/php-code-coverage/Exception/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverAvailableException' => '/php-code-coverage/Exception/NoCodeCoverageDriverAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverWithPathCoverageSupportAvailableException' => '/php-code-coverage/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => '/php-code-coverage/Node/AbstractNode.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\Builder' => '/php-code-coverage/Node/Builder.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\CrapIndex' => '/php-code-coverage/Node/CrapIndex.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\Directory' => '/php-code-coverage/Node/Directory.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\File' => '/php-code-coverage/Node/File.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Node\\Iterator' => '/php-code-coverage/Node/Iterator.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\ParserException' => '/php-code-coverage/Exception/ParserException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\ProcessedCodeCoverageData' => '/php-code-coverage/ProcessedCodeCoverageData.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\RawCodeCoverageData' => '/php-code-coverage/RawCodeCoverageData.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\ReflectionException' => '/php-code-coverage/Exception/ReflectionException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\ReportAlreadyFinalizedException' => '/php-code-coverage/Exception/ReportAlreadyFinalizedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Clover' => '/php-code-coverage/Report/Clover.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Cobertura' => '/php-code-coverage/Report/Cobertura.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => '/php-code-coverage/Report/Crap4j.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => '/php-code-coverage/Report/Html/Renderer/Dashboard.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => '/php-code-coverage/Report/Html/Renderer/Directory.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => '/php-code-coverage/Report/Html/Facade.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => '/php-code-coverage/Report/Html/Renderer/File.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => '/php-code-coverage/Report/Html/Renderer.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\PHP' => '/php-code-coverage/Report/PHP.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Text' => '/php-code-coverage/Report/Text.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => '/php-code-coverage/Report/Xml/BuildInformation.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => '/php-code-coverage/Report/Xml/Coverage.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => '/php-code-coverage/Report/Xml/Directory.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => '/php-code-coverage/Report/Xml/Facade.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => '/php-code-coverage/Report/Xml/File.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => '/php-code-coverage/Report/Xml/Method.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => '/php-code-coverage/Report/Xml/Node.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => '/php-code-coverage/Report/Xml/Project.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => '/php-code-coverage/Report/Xml/Report.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => '/php-code-coverage/Report/Xml/Source.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => '/php-code-coverage/Report/Xml/Tests.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => '/php-code-coverage/Report/Xml/Totals.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => '/php-code-coverage/Report/Xml/Unit.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysisCacheNotConfiguredException' => '/php-code-coverage/Exception/StaticAnalysisCacheNotConfiguredException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CacheWarmer' => '/php-code-coverage/StaticAnalysis/CacheWarmer.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CachingFileAnalyser' => '/php-code-coverage/StaticAnalysis/CachingFileAnalyser.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CodeUnitFindingVisitor' => '/php-code-coverage/StaticAnalysis/CodeUnitFindingVisitor.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ExecutableLinesFindingVisitor' => '/php-code-coverage/StaticAnalysis/ExecutableLinesFindingVisitor.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\FileAnalyser' => '/php-code-coverage/StaticAnalysis/FileAnalyser.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\IgnoredLinesFindingVisitor' => '/php-code-coverage/StaticAnalysis/IgnoredLinesFindingVisitor.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ParsingFileAnalyser' => '/php-code-coverage/StaticAnalysis/ParsingFileAnalyser.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\TestIdMissingException' => '/php-code-coverage/Exception/TestIdMissingException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => '/php-code-coverage/Exception/UnintentionallyCoveredCodeException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Util\\DirectoryCouldNotBeCreatedException' => '/php-code-coverage/Exception/DirectoryCouldNotBeCreatedException.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Util\\Filesystem' => '/php-code-coverage/Util/Filesystem.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Util\\Percentage' => '/php-code-coverage/Util/Percentage.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\Version' => '/php-code-coverage/Version.php', - 'PHPUnit\\SebastianBergmann\\CodeCoverage\\XmlException' => '/php-code-coverage/Exception/XmlException.php', - 'PHPUnit\\SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => '/sebastian-code-unit-reverse-lookup/Wizard.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\ClassMethodUnit' => '/sebastian-code-unit/ClassMethodUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\ClassUnit' => '/sebastian-code-unit/ClassUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\CodeUnit' => '/sebastian-code-unit/CodeUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\CodeUnitCollection' => '/sebastian-code-unit/CodeUnitCollection.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\CodeUnitCollectionIterator' => '/sebastian-code-unit/CodeUnitCollectionIterator.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\Exception' => '/sebastian-code-unit/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\FunctionUnit' => '/sebastian-code-unit/FunctionUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\InterfaceMethodUnit' => '/sebastian-code-unit/InterfaceMethodUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\InterfaceUnit' => '/sebastian-code-unit/InterfaceUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\InvalidCodeUnitException' => '/sebastian-code-unit/exceptions/InvalidCodeUnitException.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\Mapper' => '/sebastian-code-unit/Mapper.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\NoTraitException' => '/sebastian-code-unit/exceptions/NoTraitException.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\ReflectionException' => '/sebastian-code-unit/exceptions/ReflectionException.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\TraitMethodUnit' => '/sebastian-code-unit/TraitMethodUnit.php', - 'PHPUnit\\SebastianBergmann\\CodeUnit\\TraitUnit' => '/sebastian-code-unit/TraitUnit.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ArrayComparator' => '/sebastian-comparator/ArrayComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\Comparator' => '/sebastian-comparator/Comparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ComparisonFailure' => '/sebastian-comparator/ComparisonFailure.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\DOMNodeComparator' => '/sebastian-comparator/DOMNodeComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\DateTimeComparator' => '/sebastian-comparator/DateTimeComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\DoubleComparator' => '/sebastian-comparator/DoubleComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\Exception' => '/sebastian-comparator/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ExceptionComparator' => '/sebastian-comparator/ExceptionComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\Factory' => '/sebastian-comparator/Factory.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\MockObjectComparator' => '/sebastian-comparator/MockObjectComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\NumericComparator' => '/sebastian-comparator/NumericComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ObjectComparator' => '/sebastian-comparator/ObjectComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ResourceComparator' => '/sebastian-comparator/ResourceComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\RuntimeException' => '/sebastian-comparator/exceptions/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\ScalarComparator' => '/sebastian-comparator/ScalarComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\SplObjectStorageComparator' => '/sebastian-comparator/SplObjectStorageComparator.php', - 'PHPUnit\\SebastianBergmann\\Comparator\\TypeComparator' => '/sebastian-comparator/TypeComparator.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\Calculator' => '/sebastian-complexity/Calculator.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\Complexity' => '/sebastian-complexity/Complexity/Complexity.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\ComplexityCalculatingVisitor' => '/sebastian-complexity/Visitor/ComplexityCalculatingVisitor.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\ComplexityCollection' => '/sebastian-complexity/Complexity/ComplexityCollection.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\ComplexityCollectionIterator' => '/sebastian-complexity/Complexity/ComplexityCollectionIterator.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\CyclomaticComplexityCalculatingVisitor' => '/sebastian-complexity/Visitor/CyclomaticComplexityCalculatingVisitor.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\Exception' => '/sebastian-complexity/Exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\Complexity\\RuntimeException' => '/sebastian-complexity/Exception/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Chunk' => '/sebastian-diff/Chunk.php', - 'PHPUnit\\SebastianBergmann\\Diff\\ConfigurationException' => '/sebastian-diff/Exception/ConfigurationException.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Diff' => '/sebastian-diff/Diff.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Differ' => '/sebastian-diff/Differ.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Exception' => '/sebastian-diff/Exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\Diff\\InvalidArgumentException' => '/sebastian-diff/Exception/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Line' => '/sebastian-diff/Line.php', - 'PHPUnit\\SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => '/sebastian-diff/LongestCommonSubsequenceCalculator.php', - 'PHPUnit\\SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => '/sebastian-diff/MemoryEfficientLongestCommonSubsequenceCalculator.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => '/sebastian-diff/Output/AbstractChunkOutputBuilder.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => '/sebastian-diff/Output/DiffOnlyOutputBuilder.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => '/sebastian-diff/Output/DiffOutputBuilderInterface.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => '/sebastian-diff/Output/StrictUnifiedDiffOutputBuilder.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => '/sebastian-diff/Output/UnifiedDiffOutputBuilder.php', - 'PHPUnit\\SebastianBergmann\\Diff\\Parser' => '/sebastian-diff/Parser.php', - 'PHPUnit\\SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => '/sebastian-diff/TimeEfficientLongestCommonSubsequenceCalculator.php', - 'PHPUnit\\SebastianBergmann\\Environment\\Console' => '/sebastian-environment/Console.php', - 'PHPUnit\\SebastianBergmann\\Environment\\OperatingSystem' => '/sebastian-environment/OperatingSystem.php', - 'PHPUnit\\SebastianBergmann\\Environment\\Runtime' => '/sebastian-environment/Runtime.php', - 'PHPUnit\\SebastianBergmann\\Exporter\\Exporter' => '/sebastian-exporter/Exporter.php', - 'PHPUnit\\SebastianBergmann\\FileIterator\\Facade' => '/php-file-iterator/Facade.php', - 'PHPUnit\\SebastianBergmann\\FileIterator\\Factory' => '/php-file-iterator/Factory.php', - 'PHPUnit\\SebastianBergmann\\FileIterator\\Iterator' => '/php-file-iterator/Iterator.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\CodeExporter' => '/sebastian-global-state/CodeExporter.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\Exception' => '/sebastian-global-state/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\ExcludeList' => '/sebastian-global-state/ExcludeList.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\Restorer' => '/sebastian-global-state/Restorer.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\RuntimeException' => '/sebastian-global-state/exceptions/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\GlobalState\\Snapshot' => '/sebastian-global-state/Snapshot.php', - 'PHPUnit\\SebastianBergmann\\Invoker\\Exception' => '/php-invoker/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\Invoker\\Invoker' => '/php-invoker/Invoker.php', - 'PHPUnit\\SebastianBergmann\\Invoker\\ProcessControlExtensionNotLoadedException' => '/php-invoker/exceptions/ProcessControlExtensionNotLoadedException.php', - 'PHPUnit\\SebastianBergmann\\Invoker\\TimeoutException' => '/php-invoker/exceptions/TimeoutException.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\Counter' => '/sebastian-lines-of-code/Counter.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\Exception' => '/sebastian-lines-of-code/Exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\IllogicalValuesException' => '/sebastian-lines-of-code/Exception/IllogicalValuesException.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\LineCountingVisitor' => '/sebastian-lines-of-code/LineCountingVisitor.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\LinesOfCode' => '/sebastian-lines-of-code/LinesOfCode.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\NegativeValueException' => '/sebastian-lines-of-code/Exception/NegativeValueException.php', - 'PHPUnit\\SebastianBergmann\\LinesOfCode\\RuntimeException' => '/sebastian-lines-of-code/Exception/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\ObjectEnumerator\\Enumerator' => '/sebastian-object-enumerator/Enumerator.php', - 'PHPUnit\\SebastianBergmann\\ObjectEnumerator\\Exception' => '/sebastian-object-enumerator/Exception.php', - 'PHPUnit\\SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => '/sebastian-object-enumerator/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\ObjectReflector\\Exception' => '/sebastian-object-reflector/Exception.php', - 'PHPUnit\\SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => '/sebastian-object-reflector/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\ObjectReflector\\ObjectReflector' => '/sebastian-object-reflector/ObjectReflector.php', - 'PHPUnit\\SebastianBergmann\\RecursionContext\\Context' => '/sebastian-recursion-context/Context.php', - 'PHPUnit\\SebastianBergmann\\RecursionContext\\Exception' => '/sebastian-recursion-context/Exception.php', - 'PHPUnit\\SebastianBergmann\\RecursionContext\\InvalidArgumentException' => '/sebastian-recursion-context/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\ResourceOperations\\ResourceOperations' => '/sebastian-resource-operations/ResourceOperations.php', - 'PHPUnit\\SebastianBergmann\\Template\\Exception' => '/php-text-template/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\Template\\InvalidArgumentException' => '/php-text-template/exceptions/InvalidArgumentException.php', - 'PHPUnit\\SebastianBergmann\\Template\\RuntimeException' => '/php-text-template/exceptions/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\Template\\Template' => '/php-text-template/Template.php', - 'PHPUnit\\SebastianBergmann\\Timer\\Duration' => '/php-timer/Duration.php', - 'PHPUnit\\SebastianBergmann\\Timer\\Exception' => '/php-timer/exceptions/Exception.php', - 'PHPUnit\\SebastianBergmann\\Timer\\NoActiveTimerException' => '/php-timer/exceptions/NoActiveTimerException.php', - 'PHPUnit\\SebastianBergmann\\Timer\\ResourceUsageFormatter' => '/php-timer/ResourceUsageFormatter.php', - 'PHPUnit\\SebastianBergmann\\Timer\\TimeSinceStartOfRequestNotAvailableException' => '/php-timer/exceptions/TimeSinceStartOfRequestNotAvailableException.php', - 'PHPUnit\\SebastianBergmann\\Timer\\Timer' => '/php-timer/Timer.php', - 'PHPUnit\\SebastianBergmann\\Type\\CallableType' => '/sebastian-type/type/CallableType.php', - 'PHPUnit\\SebastianBergmann\\Type\\Exception' => '/sebastian-type/exception/Exception.php', - 'PHPUnit\\SebastianBergmann\\Type\\FalseType' => '/sebastian-type/type/FalseType.php', - 'PHPUnit\\SebastianBergmann\\Type\\GenericObjectType' => '/sebastian-type/type/GenericObjectType.php', - 'PHPUnit\\SebastianBergmann\\Type\\IntersectionType' => '/sebastian-type/type/IntersectionType.php', - 'PHPUnit\\SebastianBergmann\\Type\\IterableType' => '/sebastian-type/type/IterableType.php', - 'PHPUnit\\SebastianBergmann\\Type\\MixedType' => '/sebastian-type/type/MixedType.php', - 'PHPUnit\\SebastianBergmann\\Type\\NeverType' => '/sebastian-type/type/NeverType.php', - 'PHPUnit\\SebastianBergmann\\Type\\NullType' => '/sebastian-type/type/NullType.php', - 'PHPUnit\\SebastianBergmann\\Type\\ObjectType' => '/sebastian-type/type/ObjectType.php', - 'PHPUnit\\SebastianBergmann\\Type\\Parameter' => '/sebastian-type/Parameter.php', - 'PHPUnit\\SebastianBergmann\\Type\\ReflectionMapper' => '/sebastian-type/ReflectionMapper.php', - 'PHPUnit\\SebastianBergmann\\Type\\RuntimeException' => '/sebastian-type/exception/RuntimeException.php', - 'PHPUnit\\SebastianBergmann\\Type\\SimpleType' => '/sebastian-type/type/SimpleType.php', - 'PHPUnit\\SebastianBergmann\\Type\\StaticType' => '/sebastian-type/type/StaticType.php', - 'PHPUnit\\SebastianBergmann\\Type\\TrueType' => '/sebastian-type/type/TrueType.php', - 'PHPUnit\\SebastianBergmann\\Type\\Type' => '/sebastian-type/type/Type.php', - 'PHPUnit\\SebastianBergmann\\Type\\TypeName' => '/sebastian-type/TypeName.php', - 'PHPUnit\\SebastianBergmann\\Type\\UnionType' => '/sebastian-type/type/UnionType.php', - 'PHPUnit\\SebastianBergmann\\Type\\UnknownType' => '/sebastian-type/type/UnknownType.php', - 'PHPUnit\\SebastianBergmann\\Type\\VoidType' => '/sebastian-type/type/VoidType.php', - 'PHPUnit\\SebastianBergmann\\Version' => '/sebastian-version/Version.php', 'PHPUnit\\TextUI\\CliArguments\\Builder' => '/phpunit/TextUI/CliArguments/Builder.php', 'PHPUnit\\TextUI\\CliArguments\\Configuration' => '/phpunit/TextUI/CliArguments/Configuration.php', 'PHPUnit\\TextUI\\CliArguments\\Exception' => '/phpunit/TextUI/CliArguments/Exception.php', @@ -2049,14 +2352,6 @@ foreach (['PHPUnit\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy 'PHPUnit\\TextUI\\XmlConfiguration\\Variable' => '/phpunit/TextUI/XmlConfiguration/PHP/Variable.php', 'PHPUnit\\TextUI\\XmlConfiguration\\VariableCollection' => '/phpunit/TextUI/XmlConfiguration/PHP/VariableCollection.php', 'PHPUnit\\TextUI\\XmlConfiguration\\VariableCollectionIterator' => '/phpunit/TextUI/XmlConfiguration/PHP/VariableCollectionIterator.php', - 'PHPUnit\\TheSeer\\Tokenizer\\Exception' => '/theseer-tokenizer/Exception.php', - 'PHPUnit\\TheSeer\\Tokenizer\\NamespaceUri' => '/theseer-tokenizer/NamespaceUri.php', - 'PHPUnit\\TheSeer\\Tokenizer\\NamespaceUriException' => '/theseer-tokenizer/NamespaceUriException.php', - 'PHPUnit\\TheSeer\\Tokenizer\\Token' => '/theseer-tokenizer/Token.php', - 'PHPUnit\\TheSeer\\Tokenizer\\TokenCollection' => '/theseer-tokenizer/TokenCollection.php', - 'PHPUnit\\TheSeer\\Tokenizer\\TokenCollectionException' => '/theseer-tokenizer/TokenCollectionException.php', - 'PHPUnit\\TheSeer\\Tokenizer\\Tokenizer' => '/theseer-tokenizer/Tokenizer.php', - 'PHPUnit\\TheSeer\\Tokenizer\\XMLSerializer' => '/theseer-tokenizer/XMLSerializer.php', 'PHPUnit\\Util\\Annotation\\DocBlock' => '/phpunit/Util/Annotation/DocBlock.php', 'PHPUnit\\Util\\Annotation\\Registry' => '/phpunit/Util/Annotation/Registry.php', 'PHPUnit\\Util\\Blacklist' => '/phpunit/Util/Blacklist.php', @@ -2103,105 +2398,6 @@ foreach (['PHPUnit\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy 'PHPUnit\\Util\\Xml\\SuccessfulSchemaDetectionResult' => '/phpunit/Util/Xml/SuccessfulSchemaDetectionResult.php', 'PHPUnit\\Util\\Xml\\ValidationResult' => '/phpunit/Util/Xml/ValidationResult.php', 'PHPUnit\\Util\\Xml\\Validator' => '/phpunit/Util/Xml/Validator.php', - 'PHPUnit\\Webmozart\\Assert\\Assert' => '/webmozart-assert/Assert.php', - 'PHPUnit\\Webmozart\\Assert\\InvalidArgumentException' => '/webmozart-assert/InvalidArgumentException.php', - 'PHPUnit\\Webmozart\\Assert\\Mixin' => '/webmozart-assert/Mixin.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock' => '/phpdocumentor-reflection-docblock/DocBlock.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlockFactory' => '/phpdocumentor-reflection-docblock/DocBlockFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlockFactoryInterface' => '/phpdocumentor-reflection-docblock/DocBlockFactoryInterface.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Description' => '/phpdocumentor-reflection-docblock/DocBlock/Description.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\DescriptionFactory' => '/phpdocumentor-reflection-docblock/DocBlock/DescriptionFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\ExampleFinder' => '/phpdocumentor-reflection-docblock/DocBlock/ExampleFinder.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Serializer' => '/phpdocumentor-reflection-docblock/DocBlock/Serializer.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\StandardTagFactory' => '/phpdocumentor-reflection-docblock/DocBlock/StandardTagFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tag' => '/phpdocumentor-reflection-docblock/DocBlock/Tag.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\TagFactory' => '/phpdocumentor-reflection-docblock/DocBlock/TagFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Author' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Author.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\BaseTag' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/BaseTag.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Covers' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Covers.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Deprecated' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Deprecated.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Example' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Example.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Factory\\StaticMethod' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Factory/StaticMethod.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter\\AlignFormatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/AlignFormatter.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Formatter\\PassthroughFormatter' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/PassthroughFormatter.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Generic' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Generic.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\InvalidTag' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/InvalidTag.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Link' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Link.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Method' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Method.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Param' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Param.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Property' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Property.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyRead' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyRead.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyWrite' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyWrite.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Fqsen' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Fqsen.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Reference' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Reference.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Url' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Url.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Return_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\See' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/See.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Since' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Since.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Source' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Source.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\TagWithType' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/TagWithType.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Throws' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Throws.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Uses' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Uses.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Var_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\DocBlock\\Tags\\Version' => '/phpdocumentor-reflection-docblock/DocBlock/Tags/Version.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Element' => '/phpdocumentor-reflection-common/Element.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Exception\\PcreException' => '/phpdocumentor-reflection-docblock/Exception/PcreException.php', - 'PHPUnit\\phpDocumentor\\Reflection\\File' => '/phpdocumentor-reflection-common/File.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Fqsen' => '/phpdocumentor-reflection-common/Fqsen.php', - 'PHPUnit\\phpDocumentor\\Reflection\\FqsenResolver' => '/phpdocumentor-type-resolver/FqsenResolver.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Location' => '/phpdocumentor-reflection-common/Location.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Project' => '/phpdocumentor-reflection-common/Project.php', - 'PHPUnit\\phpDocumentor\\Reflection\\ProjectFactory' => '/phpdocumentor-reflection-common/ProjectFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoType' => '/phpdocumentor-type-resolver/PseudoType.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\CallableString' => '/phpdocumentor-type-resolver/PseudoTypes/CallableString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\False_' => '/phpdocumentor-type-resolver/PseudoTypes/False_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\HtmlEscapedString' => '/phpdocumentor-type-resolver/PseudoTypes/HtmlEscapedString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\IntegerRange' => '/phpdocumentor-type-resolver/PseudoTypes/IntegerRange.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\List_' => '/phpdocumentor-type-resolver/PseudoTypes/List_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\LiteralString' => '/phpdocumentor-type-resolver/PseudoTypes/LiteralString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\LowercaseString' => '/phpdocumentor-type-resolver/PseudoTypes/LowercaseString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\NegativeInteger' => '/phpdocumentor-type-resolver/PseudoTypes/NegativeInteger.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyLowercaseString' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyLowercaseString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\NonEmptyString' => '/phpdocumentor-type-resolver/PseudoTypes/NonEmptyString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\NumericString' => '/phpdocumentor-type-resolver/PseudoTypes/NumericString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\Numeric_' => '/phpdocumentor-type-resolver/PseudoTypes/Numeric_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\PositiveInteger' => '/phpdocumentor-type-resolver/PseudoTypes/PositiveInteger.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\TraitString' => '/phpdocumentor-type-resolver/PseudoTypes/TraitString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\PseudoTypes\\True_' => '/phpdocumentor-type-resolver/PseudoTypes/True_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Type' => '/phpdocumentor-type-resolver/Type.php', - 'PHPUnit\\phpDocumentor\\Reflection\\TypeResolver' => '/phpdocumentor-type-resolver/TypeResolver.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\AbstractList' => '/phpdocumentor-type-resolver/Types/AbstractList.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\AggregatedType' => '/phpdocumentor-type-resolver/Types/AggregatedType.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\ArrayKey' => '/phpdocumentor-type-resolver/Types/ArrayKey.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Array_' => '/phpdocumentor-type-resolver/Types/Array_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Boolean' => '/phpdocumentor-type-resolver/Types/Boolean.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Callable_' => '/phpdocumentor-type-resolver/Types/Callable_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\ClassString' => '/phpdocumentor-type-resolver/Types/ClassString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Collection' => '/phpdocumentor-type-resolver/Types/Collection.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Compound' => '/phpdocumentor-type-resolver/Types/Compound.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Context' => '/phpdocumentor-type-resolver/Types/Context.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\ContextFactory' => '/phpdocumentor-type-resolver/Types/ContextFactory.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Expression' => '/phpdocumentor-type-resolver/Types/Expression.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Float_' => '/phpdocumentor-type-resolver/Types/Float_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Integer' => '/phpdocumentor-type-resolver/Types/Integer.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\InterfaceString' => '/phpdocumentor-type-resolver/Types/InterfaceString.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Intersection' => '/phpdocumentor-type-resolver/Types/Intersection.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Iterable_' => '/phpdocumentor-type-resolver/Types/Iterable_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Mixed_' => '/phpdocumentor-type-resolver/Types/Mixed_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Never_' => '/phpdocumentor-type-resolver/Types/Never_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Null_' => '/phpdocumentor-type-resolver/Types/Null_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Nullable' => '/phpdocumentor-type-resolver/Types/Nullable.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Object_' => '/phpdocumentor-type-resolver/Types/Object_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Parent_' => '/phpdocumentor-type-resolver/Types/Parent_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Resource_' => '/phpdocumentor-type-resolver/Types/Resource_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Scalar' => '/phpdocumentor-type-resolver/Types/Scalar.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Self_' => '/phpdocumentor-type-resolver/Types/Self_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Static_' => '/phpdocumentor-type-resolver/Types/Static_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\String_' => '/phpdocumentor-type-resolver/Types/String_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\This' => '/phpdocumentor-type-resolver/Types/This.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Types\\Void_' => '/phpdocumentor-type-resolver/Types/Void_.php', - 'PHPUnit\\phpDocumentor\\Reflection\\Utils' => '/phpdocumentor-reflection-docblock/Utils.php', 'Prophecy\\Argument' => '/phpspec-prophecy/Prophecy/Argument.php', 'Prophecy\\Argument\\ArgumentsWildcard' => '/phpspec-prophecy/Prophecy/Argument/ArgumentsWildcard.php', 'Prophecy\\Argument\\Token\\AnyValueToken' => '/phpspec-prophecy/Prophecy/Argument/Token/AnyValueToken.php', @@ -2295,12 +2491,18 @@ foreach (['PHPUnit\\DeepCopy\\DeepCopy' => '/myclabs-deep-copy/DeepCopy/DeepCopy 'Prophecy\\Prophet' => '/phpspec-prophecy/Prophecy/Prophet.php', 'Prophecy\\Util\\ExportUtil' => '/phpspec-prophecy/Prophecy/Util/ExportUtil.php', 'Prophecy\\Util\\StringUtil' => '/phpspec-prophecy/Prophecy/Util/StringUtil.php'] as $file) { - require_once 'phar://phpunit-9.6.13.phar' . $file; + require_once 'phar://phpunit-9.6.20.phar' . $file; } require __PHPUNIT_PHAR_ROOT__ . '/phpunit/Framework/Assert/Functions.php'; if ($execute) { + if (isset($printComposerLock)) { + print file_get_contents(__PHPUNIT_PHAR_ROOT__ . '/composer.lock'); + + exit; + } + if (isset($printManifest)) { print file_get_contents(__PHPUNIT_PHAR_ROOT__ . '/manifest.txt'); @@ -2319,106 +2521,2455 @@ if ($execute) { } __HALT_COMPILER(); ?> -kphpunit-9.6.13.pharLdoctrine-instantiator/Doctrine/Instantiator/Exception/ExceptionInterface.php(4 ebRdoctrine-instantiator/Doctrine/Instantiator/Exception/InvalidArgumentException.php(4 eRdoctrine-instantiator/Doctrine/Instantiator/Exception/UnexpectedValueException.php:(4 e:_Y%[<doctrine-instantiator/Doctrine/Instantiator/Instantiator.php(4 e87Edoctrine-instantiator/Doctrine/Instantiator/InstantiatorInterface.php (4 e LȤdoctrine-instantiator/LICENSE$(4 e$ -͂ manifest.txt(4 eRoa'myclabs-deep-copy/DeepCopy/DeepCopy.php(4 eLä7myclabs-deep-copy/DeepCopy/Exception/CloneException.php(4 e {ˤ:myclabs-deep-copy/DeepCopy/Exception/PropertyException.php(4 e3Gz5myclabs-deep-copy/DeepCopy/Filter/ChainableFilter.php(4 eTE Gmyclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php -(4 e -DgLmyclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php(4 e)$Bmyclabs-deep-copy/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php(4 e),myclabs-deep-copy/DeepCopy/Filter/Filter.phpd(4 edM0myclabs-deep-copy/DeepCopy/Filter/KeepFilter.php(4 eYn3myclabs-deep-copy/DeepCopy/Filter/ReplaceFilter.php(4 e3myclabs-deep-copy/DeepCopy/Filter/SetNullFilter.php(4 e䊉Dmyclabs-deep-copy/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php(4 epr.myclabs-deep-copy/DeepCopy/Matcher/Matcher.php(4 e6myclabs-deep-copy/DeepCopy/Matcher/PropertyMatcher.php(4 e=Bv:myclabs-deep-copy/DeepCopy/Matcher/PropertyNameMatcher.php(4 eR:myclabs-deep-copy/DeepCopy/Matcher/PropertyTypeMatcher.php2(4 e2ZQͤ:myclabs-deep-copy/DeepCopy/Reflection/ReflectionHelper.php5(4 e5ىAmyclabs-deep-copy/DeepCopy/TypeFilter/Date/DateIntervalFilter.php(4 eƤ7myclabs-deep-copy/DeepCopy/TypeFilter/ReplaceFilter.php(4 ez;myclabs-deep-copy/DeepCopy/TypeFilter/ShallowCopyFilter.php(4 eؤ?myclabs-deep-copy/DeepCopy/TypeFilter/Spl/ArrayObjectFilter.php(4 e^Amyclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php(4 ev|Gmyclabs-deep-copy/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php(4 eT+4myclabs-deep-copy/DeepCopy/TypeFilter/TypeFilter.php(4 eVD6myclabs-deep-copy/DeepCopy/TypeMatcher/TypeMatcher.php(4 eQBŤ(myclabs-deep-copy/DeepCopy/deep_copy.php(4 erxmyclabs-deep-copy/LICENSE5(4 e5ʭ˄nikic-php-parser/LICENSE(4 e*&nikic-php-parser/PhpParser/Builder.php(4 e61nikic-php-parser/PhpParser/Builder/ClassConst.php(4 e-nikic-php-parser/PhpParser/Builder/Class_.php(4 ec32nikic-php-parser/PhpParser/Builder/Declaration.php(4 eE7/nikic-php-parser/PhpParser/Builder/EnumCase.php^(4 e^ueT,nikic-php-parser/PhpParser/Builder/Enum_.php (4 e #3nikic-php-parser/PhpParser/Builder/FunctionLike.php(4 eZqe0nikic-php-parser/PhpParser/Builder/Function_.phpF(4 eFux1nikic-php-parser/PhpParser/Builder/Interface_.php (4 e -nikic-php-parser/PhpParser/Builder/Method.php(4 e}1nikic-php-parser/PhpParser/Builder/Namespace_.php:(4 e:ˆp,nikic-php-parser/PhpParser/Builder/Param.php{(4 e{j4/nikic-php-parser/PhpParser/Builder/Property.php|(4 e|O /nikic-php-parser/PhpParser/Builder/TraitUse.phpW(4 eWL@9nikic-php-parser/PhpParser/Builder/TraitUseAdaptation.php(4 eUVx-nikic-php-parser/PhpParser/Builder/Trait_.php(4 ekj+nikic-php-parser/PhpParser/Builder/Use_.php(4 es-nikic-php-parser/PhpParser/BuilderFactory.php+(4 e+ $-nikic-php-parser/PhpParser/BuilderHelpers.php$(4 e$:@&nikic-php-parser/PhpParser/Comment.php(4 eA*nikic-php-parser/PhpParser/Comment/Doc.phpx(4 exp;nikic-php-parser/PhpParser/ConstExprEvaluationException.php_(4 e_I 1nikic-php-parser/PhpParser/ConstExprEvaluator.phpl%(4 el%evQ$nikic-php-parser/PhpParser/Error.php(4 eQZ+nikic-php-parser/PhpParser/ErrorHandler.php/(4 e/#\6nikic-php-parser/PhpParser/ErrorHandler/Collecting.php(4 e&Ȥ4nikic-php-parser/PhpParser/ErrorHandler/Throwing.php(4 eS}<0nikic-php-parser/PhpParser/Internal/DiffElem.php7(4 e7$.nikic-php-parser/PhpParser/Internal/Differ.php-(4 e-^Anikic-php-parser/PhpParser/Internal/PrintableNewAnonClassNode.php(4 e<3nikic-php-parser/PhpParser/Internal/TokenStream.php#(4 e#f*nikic-php-parser/PhpParser/JsonDecoder.php (4 e xg$nikic-php-parser/PhpParser/Lexer.phpyZ(4 eyZq⃤.nikic-php-parser/PhpParser/Lexer/Emulative.phpO#(4 eO#ܲݤDnikic-php-parser/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php(4 erLnikic-php-parser/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php (4 e *§oDnikic-php-parser/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php(4 eLFHnikic-php-parser/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php(4 e*#Lnikic-php-parser/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.phpn (4 en 1Bnikic-php-parser/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php(4 ejBnikic-php-parser/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php(4 e`atEnikic-php-parser/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php(4 ec/Hnikic-php-parser/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php(4 e:&ERnikic-php-parser/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.phpV(4 eVPnikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php(4 ee!ćHnikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.phpL(4 eL -`9JBnikic-php-parser/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php(4 eI}@nikic-php-parser/PhpParser/Lexer/TokenEmulator/TokenEmulator.phpu(4 euD4h*nikic-php-parser/PhpParser/NameContext.php%(4 e%G-#nikic-php-parser/PhpParser/Node.php(4 eyݗ'nikic-php-parser/PhpParser/Node/Arg.php0(4 e0q H-nikic-php-parser/PhpParser/Node/Attribute.phpH(4 eHhqK2nikic-php-parser/PhpParser/Node/AttributeGroup.php(4 eB9/nikic-php-parser/PhpParser/Node/ComplexType.phpS(4 eS(*nikic-php-parser/PhpParser/Node/Const_.php(4 eZ(nikic-php-parser/PhpParser/Node/Expr.php(4 eh傤6nikic-php-parser/PhpParser/Node/Expr/ArrayDimFetch.phpM(4 eMIY2nikic-php-parser/PhpParser/Node/Expr/ArrayItem.phpx(4 ex| 2/nikic-php-parser/PhpParser/Node/Expr/Array_.php8(4 e8;p6nikic-php-parser/PhpParser/Node/Expr/ArrowFunction.php (4 e w3/nikic-php-parser/PhpParser/Node/Expr/Assign.php(4 e1nikic-php-parser/PhpParser/Node/Expr/AssignOp.php(4 e,<nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php(4 eu;nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseOr.php(4 e;<nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseXor.php(4 elϚ:nikic-php-parser/PhpParser/Node/Expr/AssignOp/Coalesce.php(4 eq,8nikic-php-parser/PhpParser/Node/Expr/AssignOp/Concat.php(4 e5nikic-php-parser/PhpParser/Node/Expr/AssignOp/Div.php(4 eYP -7nikic-php-parser/PhpParser/Node/Expr/AssignOp/Minus.php(4 e隤5nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mod.php(4 e]10Y5nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mul.php(4 eπ/6nikic-php-parser/PhpParser/Node/Expr/AssignOp/Plus.php(4 e&|5nikic-php-parser/PhpParser/Node/Expr/AssignOp/Pow.php(4 eyV;nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftLeft.php(4 e<nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftRight.php(4 es*2nikic-php-parser/PhpParser/Node/Expr/AssignRef.phpH(4 eHE`ob1nikic-php-parser/PhpParser/Node/Expr/BinaryOp.phpo(4 eo Ѥ<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.phpP(4 eP6L6;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseOr.phpN(4 eN_|<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseXor.phpP(4 eP~Ƥ<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanAnd.phpQ(4 eQ5v;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanOr.phpO(4 eOeӸ:nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Coalesce.phpM(4 eMY 8nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Concat.phpH(4 eH @q5nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Div.phpB(4 eBi7nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Equal.phpG(4 eGݙʤ9nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Greater.phpJ(4 eJ4ͤ@nikic-php-parser/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.phpY(4 eY^ز;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Identical.phpP(4 eP"<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalAnd.phpR(4 eRi;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalOr.phpO(4 eO@<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalXor.phpR(4 eR4e7nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Minus.phpF(4 eF$Lˤ5nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mod.phpB(4 eBʤ5nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mul.phpB(4 eB|:nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotEqual.phpM(4 eM>nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotIdentical.phpV(4 eVh< -6nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Plus.phpD(4 eD' ,5nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Pow.phpC(4 eC;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftLeft.phpO(4 eOQ#<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftRight.phpQ(4 eQǤ9nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Smaller.phpJ(4 eJf@nikic-php-parser/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.phpY(4 eY⍤;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Spaceship.phpP(4 ePHƉ.3nikic-php-parser/PhpParser/Node/Expr/BitwiseNot.php(4 e~'3nikic-php-parser/PhpParser/Node/Expr/BooleanNot.php(4 eDC1nikic-php-parser/PhpParser/Node/Expr/CallLike.php&(4 e&KS0-nikic-php-parser/PhpParser/Node/Expr/Cast.phpA(4 eA:Vs4nikic-php-parser/PhpParser/Node/Expr/Cast/Array_.php(4 eI|3nikic-php-parser/PhpParser/Node/Expr/Cast/Bool_.php(4 e V]S4nikic-php-parser/PhpParser/Node/Expr/Cast/Double.php(4 e>,2nikic-php-parser/PhpParser/Node/Expr/Cast/Int_.php(4 ec5nikic-php-parser/PhpParser/Node/Expr/Cast/Object_.php(4 e5nikic-php-parser/PhpParser/Node/Expr/Cast/String_.php(4 e4nikic-php-parser/PhpParser/Node/Expr/Cast/Unset_.php(4 e1Ӥ8nikic-php-parser/PhpParser/Node/Expr/ClassConstFetch.php(4 eE/nikic-php-parser/PhpParser/Node/Expr/Clone_.php(4 eW0nikic-php-parser/PhpParser/Node/Expr/Closure.php -(4 e -U;3nikic-php-parser/PhpParser/Node/Expr/ClosureUse.php(4 eh3nikic-php-parser/PhpParser/Node/Expr/ConstFetch.php(4 e޶%/nikic-php-parser/PhpParser/Node/Expr/Empty_.php(4 e'.nikic-php-parser/PhpParser/Node/Expr/Error.php(4 ea\6nikic-php-parser/PhpParser/Node/Expr/ErrorSuppress.php(4 eg.nikic-php-parser/PhpParser/Node/Expr/Eval_.php(4 e356.nikic-php-parser/PhpParser/Node/Expr/Exit_.php(4 e1nikic-php-parser/PhpParser/Node/Expr/FuncCall.php3(4 e3%A1nikic-php-parser/PhpParser/Node/Expr/Include_.php(4 ei4nikic-php-parser/PhpParser/Node/Expr/Instanceof_.phpa(4 ea< /nikic-php-parser/PhpParser/Node/Expr/Isset_.php(4 eI.nikic-php-parser/PhpParser/Node/Expr/List_.php(4 e/nikic-php-parser/PhpParser/Node/Expr/Match_.php(4 eW 3nikic-php-parser/PhpParser/Node/Expr/MethodCall.phpO(4 eODWX-nikic-php-parser/PhpParser/Node/Expr/New_.php(4 eiĤ;nikic-php-parser/PhpParser/Node/Expr/NullsafeMethodCall.phpf(4 efɤ>nikic-php-parser/PhpParser/Node/Expr/NullsafePropertyFetch.php(4 e /N0nikic-php-parser/PhpParser/Node/Expr/PostDec.php(4 ew:0nikic-php-parser/PhpParser/Node/Expr/PostInc.php(4 eᦦ!/nikic-php-parser/PhpParser/Node/Expr/PreDec.php(4 etg/nikic-php-parser/PhpParser/Node/Expr/PreInc.php(4 eYä/nikic-php-parser/PhpParser/Node/Expr/Print_.php(4 enX6nikic-php-parser/PhpParser/Node/Expr/PropertyFetch.php(4 eɾ2nikic-php-parser/PhpParser/Node/Expr/ShellExec.php(4 ehy3nikic-php-parser/PhpParser/Node/Expr/StaticCall.phpe(4 ee<nikic-php-parser/PhpParser/Node/Expr/StaticPropertyFetch.php&(4 e&ܐ0nikic-php-parser/PhpParser/Node/Expr/Ternary.php(4 eQͤ/nikic-php-parser/PhpParser/Node/Expr/Throw_.php(4 e ?3nikic-php-parser/PhpParser/Node/Expr/UnaryMinus.php(4 elA2nikic-php-parser/PhpParser/Node/Expr/UnaryPlus.php(4 ee̤1nikic-php-parser/PhpParser/Node/Expr/Variable.php(4 emJr2nikic-php-parser/PhpParser/Node/Expr/YieldFrom.php(4 ew8/nikic-php-parser/PhpParser/Node/Expr/Yield_.php\(4 e\ 0nikic-php-parser/PhpParser/Node/FunctionLike.php(4 e4ͤ.nikic-php-parser/PhpParser/Node/Identifier.php(4 eJa4nikic-php-parser/PhpParser/Node/IntersectionType.php(4 eo,nikic-php-parser/PhpParser/Node/MatchArm.php(4 e+m6(nikic-php-parser/PhpParser/Node/Name.php (4 e 7nikic-php-parser/PhpParser/Node/Name/FullyQualified.php(4 e 1nikic-php-parser/PhpParser/Node/Name/Relative.php(4 eǛEf0nikic-php-parser/PhpParser/Node/NullableType.php(4 e6C)nikic-php-parser/PhpParser/Node/Param.phpb(4 ebMߤ*nikic-php-parser/PhpParser/Node/Scalar.phpk(4 ek,ߤ2nikic-php-parser/PhpParser/Node/Scalar/DNumber.php(4 ex3H:3nikic-php-parser/PhpParser/Node/Scalar/Encapsed.php(4 eRU=nikic-php-parser/PhpParser/Node/Scalar/EncapsedStringPart.php(4 e%2nikic-php-parser/PhpParser/Node/Scalar/LNumber.php (4 e z5nikic-php-parser/PhpParser/Node/Scalar/MagicConst.phpc(4 ec,xG<nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Class_.phpT(4 eT㨘X9nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Dir.phpM(4 eMal:nikic-php-parser/PhpParser/Node/Scalar/MagicConst/File.phpP(4 eP#?nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Function_.php](4 e]HnY:nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Line.phpP(4 ePM4<nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Method.phpV(4 eVΤ@nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Namespace_.php`(4 e`><nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Trait_.phpT(4 eTd2nikic-php-parser/PhpParser/Node/Scalar/String_.phpq(4 eqT$Q(nikic-php-parser/PhpParser/Node/Stmt.php(4 ev2//nikic-php-parser/PhpParser/Node/Stmt/Break_.php(4 e֤.nikic-php-parser/PhpParser/Node/Stmt/Case_.phpl(4 elu/nikic-php-parser/PhpParser/Node/Stmt/Catch_.php|(4 e|*V>3nikic-php-parser/PhpParser/Node/Stmt/ClassConst.php| (4 e| K:d2nikic-php-parser/PhpParser/Node/Stmt/ClassLike.php (4 e 04nikic-php-parser/PhpParser/Node/Stmt/ClassMethod.php(4 eX/nikic-php-parser/PhpParser/Node/Stmt/Class_.phpu(4 eu_ļ/nikic-php-parser/PhpParser/Node/Stmt/Const_.php(4 e2nikic-php-parser/PhpParser/Node/Stmt/Continue_.php(4 e7nikic-php-parser/PhpParser/Node/Stmt/DeclareDeclare.php(4 eƀ1nikic-php-parser/PhpParser/Node/Stmt/Declare_.php(4 e.. -,nikic-php-parser/PhpParser/Node/Stmt/Do_.phpB(4 eB -@.nikic-php-parser/PhpParser/Node/Stmt/Echo_.php(4 e͘Ƥ0nikic-php-parser/PhpParser/Node/Stmt/ElseIf_.phpI(4 eIEä.nikic-php-parser/PhpParser/Node/Stmt/Else_.php(4 e|ä1nikic-php-parser/PhpParser/Node/Stmt/EnumCase.php(4 ejD.nikic-php-parser/PhpParser/Node/Stmt/Enum_.php=(4 e=dA3nikic-php-parser/PhpParser/Node/Stmt/Expression.php(4 eRK1nikic-php-parser/PhpParser/Node/Stmt/Finally_.php(4 e1A-nikic-php-parser/PhpParser/Node/Stmt/For_.php>(4 e>NQ1nikic-php-parser/PhpParser/Node/Stmt/Foreach_.phpo(4 eo92nikic-php-parser/PhpParser/Node/Stmt/Function_.php, -(4 e, -nL0nikic-php-parser/PhpParser/Node/Stmt/Global_.php(4 e.nikic-php-parser/PhpParser/Node/Stmt/Goto_.php(4 eVyPn1nikic-php-parser/PhpParser/Node/Stmt/GroupUse.php -(4 e -ߎ0|5nikic-php-parser/PhpParser/Node/Stmt/HaltCompiler.php(4 e];,nikic-php-parser/PhpParser/Node/Stmt/If_.php:(4 e:u٤3nikic-php-parser/PhpParser/Node/Stmt/InlineHTML.php(4 e]3nikic-php-parser/PhpParser/Node/Stmt/Interface_.php(4 eL/Ǥ.nikic-php-parser/PhpParser/Node/Stmt/Label.php(4 eӤ3nikic-php-parser/PhpParser/Node/Stmt/Namespace_.php(4 e㹀,nikic-php-parser/PhpParser/Node/Stmt/Nop.php@(4 e@G1nikic-php-parser/PhpParser/Node/Stmt/Property.phpO -(4 eO -=9nikic-php-parser/PhpParser/Node/Stmt/PropertyProperty.php(4 e҉0nikic-php-parser/PhpParser/Node/Stmt/Return_.php(4 eͿ)e2nikic-php-parser/PhpParser/Node/Stmt/StaticVar.php(4 e0nikic-php-parser/PhpParser/Node/Stmt/Static_.php(4 e0nikic-php-parser/PhpParser/Node/Stmt/Switch_.php5(4 e5FFY/nikic-php-parser/PhpParser/Node/Stmt/Throw_.php(4 e1nikic-php-parser/PhpParser/Node/Stmt/TraitUse.php(4 eg,;nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation.php(4 ea8Anikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.phpA(4 eAdFnikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.phpZ(4 eZP֤/nikic-php-parser/PhpParser/Node/Stmt/Trait_.php(4 e$v1nikic-php-parser/PhpParser/Node/Stmt/TryCatch.php$(4 e$W/nikic-php-parser/PhpParser/Node/Stmt/Unset_.php(4 e=oB/nikic-php-parser/PhpParser/Node/Stmt/UseUse.phpd(4 edb-nikic-php-parser/PhpParser/Node/Stmt/Use_.phpl(4 el9=|/nikic-php-parser/PhpParser/Node/Stmt/While_.phpE(4 eEա-nikic-php-parser/PhpParser/Node/UnionType.php(4 eԛ5nikic-php-parser/PhpParser/Node/VarLikeIdentifier.php(4 e&7nikic-php-parser/PhpParser/Node/VariadicPlaceholder.php(4 eP+nikic-php-parser/PhpParser/NodeAbstract.phpZ(4 eZ׻@)nikic-php-parser/PhpParser/NodeDumper.phpd(4 edY l)nikic-php-parser/PhpParser/NodeFinder.php (4 e ,nikic-php-parser/PhpParser/NodeTraverser.php]'(4 e]'TG:Ƥ5nikic-php-parser/PhpParser/NodeTraverserInterface.php|(4 e|Ś *nikic-php-parser/PhpParser/NodeVisitor.php(4 e39nikic-php-parser/PhpParser/NodeVisitor/CloningVisitor.php(4 e"WJ9nikic-php-parser/PhpParser/NodeVisitor/FindingVisitor.php(4 eB>nikic-php-parser/PhpParser/NodeVisitor/FirstFindingVisitor.php(4 em4Ť7nikic-php-parser/PhpParser/NodeVisitor/NameResolver.phpq&(4 eq&ǠG@nikic-php-parser/PhpParser/NodeVisitor/NodeConnectingVisitor.php(4 eu -äBnikic-php-parser/PhpParser/NodeVisitor/ParentConnectingVisitor.phpu(4 euME2nikic-php-parser/PhpParser/NodeVisitorAbstract.php(4 e%nikic-php-parser/PhpParser/Parser.php}(4 e}{.nikic-php-parser/PhpParser/Parser/Multiple.php(4 esF)7*nikic-php-parser/PhpParser/Parser/Php5.php+(4 e+1*nikic-php-parser/PhpParser/Parser/Php7.phpT(4 eT!V`,nikic-php-parser/PhpParser/Parser/Tokens.php&(4 e&<-nikic-php-parser/PhpParser/ParserAbstract.phpT(4 eT'[,nikic-php-parser/PhpParser/ParserFactory.php(4 e -~&5nikic-php-parser/PhpParser/PrettyPrinter/Standard.php+(4 e+4nikic-php-parser/PhpParser/PrettyPrinterAbstract.phpQ(4 eQ%jobject-enumerator/LICENSE(4 ey{object-reflector/LICENSE(4 e9vphar-io-manifest/LICENSE`(4 e`p+phar-io-manifest/ManifestDocumentMapper.php(4 e:#phar-io-manifest/ManifestLoader.php(4 e.-a'phar-io-manifest/ManifestSerializer.php(4 erp:phar-io-manifest/exceptions/ElementCollectionException.php(4 e I)phar-io-manifest/exceptions/Exception.php(4 e?phar-io-manifest/exceptions/InvalidApplicationNameException.php(4 e:@>5phar-io-manifest/exceptions/InvalidEmailException.php(4 e<3phar-io-manifest/exceptions/InvalidUrlException.php(4 e 9phar-io-manifest/exceptions/ManifestDocumentException.php(4 e!P4@phar-io-manifest/exceptions/ManifestDocumentLoadingException.phpH(4 eHǃ?phar-io-manifest/exceptions/ManifestDocumentMapperException.php(4 e:9z8phar-io-manifest/exceptions/ManifestElementException.php(4 eA47phar-io-manifest/exceptions/ManifestLoaderException.php(4 eD>'phar-io-manifest/values/Application.php(4 eI$ۤ+phar-io-manifest/values/ApplicationName.php;(4 e;D"phar-io-manifest/values/Author.php(4 eF,phar-io-manifest/values/AuthorCollection.php(4 eo4phar-io-manifest/values/AuthorCollectionIterator.php3(4 e3џ,phar-io-manifest/values/BundledComponent.php@(4 e@DP`6phar-io-manifest/values/BundledComponentCollection.php (4 e ¾W6>phar-io-manifest/values/BundledComponentCollectionIterator.php(4 eVh0phar-io-manifest/values/CopyrightInformation.phpP(4 eP ai!phar-io-manifest/values/Email.phpN(4 eNZ&%phar-io-manifest/values/Extension.php(4 eq}#phar-io-manifest/values/Library.php(4 eO#phar-io-manifest/values/License.php(4 e&!o$phar-io-manifest/values/Manifest.php -(4 e -=La3phar-io-manifest/values/PhpExtensionRequirement.php(4 e11phar-io-manifest/values/PhpVersionRequirement.php(4 em?'phar-io-manifest/values/Requirement.php(4 ed1phar-io-manifest/values/RequirementCollection.php(4 eP9phar-io-manifest/values/RequirementCollectionIterator.phpj(4 ejܭ: phar-io-manifest/values/Type.php(4 e=%phar-io-manifest/values/Url.php(4 e͚&phar-io-manifest/xml/AuthorElement.phpr(4 er<0phar-io-manifest/xml/AuthorElementCollection.php,(4 e,-'phar-io-manifest/xml/BundlesElement.phpS(4 eSWN>)phar-io-manifest/xml/ComponentElement.phpy(4 eyݤ3phar-io-manifest/xml/ComponentElementCollection.php5(4 e5(\(phar-io-manifest/xml/ContainsElement.phpn(4 enf)phar-io-manifest/xml/CopyrightElement.php(4 e7*phar-io-manifest/xml/ElementCollection.php(4 e@ #phar-io-manifest/xml/ExtElement.php (4 e y>-phar-io-manifest/xml/ExtElementCollection.php#(4 e#E)phar-io-manifest/xml/ExtensionElement.php}(4 e}0'phar-io-manifest/xml/LicenseElement.phpo(4 eo%:')phar-io-manifest/xml/ManifestDocument.php - (4 e - 4(phar-io-manifest/xml/ManifestElement.php4(4 e4#phar-io-manifest/xml/PhpElement.php(4 eB:5(phar-io-manifest/xml/RequiresElement.php$(4 e$>!phar-io-version/BuildMetaData.php(4 ephar-io-version/LICENSE&(4 e&Ҫ $phar-io-version/PreReleaseSuffix.php(4 e:phar-io-version/Version.php(4 eu#+phar-io-version/VersionConstraintParser.phpT (4 eT Ф*phar-io-version/VersionConstraintValue.phpH -(4 eH -F{~4!phar-io-version/VersionNumber.php(4 eO19phar-io-version/constraints/AbstractVersionConstraint.php(4 exB9phar-io-version/constraints/AndVersionConstraintGroup.php(4 eY4phar-io-version/constraints/AnyVersionConstraint.phpR(4 eR #6phar-io-version/constraints/ExactVersionConstraint.php(4 e!Ephar-io-version/constraints/GreaterThanOrEqualToVersionConstraint.php(4 eVU8phar-io-version/constraints/OrVersionConstraintGroup.php(4 eM%Fphar-io-version/constraints/SpecificMajorAndMinorVersionConstraint.php(4 eɍ>phar-io-version/constraints/SpecificMajorVersionConstraint.php(4 e`9q:1phar-io-version/constraints/VersionConstraint.php(4 eeDq(phar-io-version/exceptions/Exception.php(4 e$eb?phar-io-version/exceptions/InvalidPreReleaseSuffixException.php(4 eҵ6phar-io-version/exceptions/InvalidVersionException.php(4 e4/S7phar-io-version/exceptions/NoBuildMetaDataException.php(4 e]:phar-io-version/exceptions/NoPreReleaseSuffixException.php(4 eT4Dphar-io-version/exceptions/UnsupportedVersionConstraintException.php(4 e9"php-code-coverage/CodeCoverage.phpNE(4 eNE3M%#php-code-coverage/Driver/Driver.php(4 e3A'php-code-coverage/Driver/PcovDriver.phpJ(4 eJ)php-code-coverage/Driver/PhpdbgDriver.php^ -(4 e^ -_2G%php-code-coverage/Driver/Selector.php (4 e 6]*php-code-coverage/Driver/Xdebug2Driver.phpA (4 eA *php-code-coverage/Driver/Xdebug3Driver.php (4 e h*Jphp-code-coverage/Exception/BranchAndPathCoverageNotSupportedException.php(4 e77Fphp-code-coverage/Exception/DeadCodeDetectionNotSupportedException.php(4 eCphp-code-coverage/Exception/DirectoryCouldNotBeCreatedException.php(4 e)php-code-coverage/Exception/Exception.php}(4 e}z8php-code-coverage/Exception/InvalidArgumentException.php(4 eK.nFphp-code-coverage/Exception/NoCodeCoverageDriverAvailableException.php/(4 e/6R]php-code-coverage/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.phpa(4 ea"A/php-code-coverage/Exception/ParserException.php(4 e,/Dphp-code-coverage/Exception/PathExistsButIsNotDirectoryException.php(4 e.29php-code-coverage/Exception/PcovNotAvailableException.phpa(4 eaj;php-code-coverage/Exception/PhpdbgNotAvailableException.php`(4 e`3php-code-coverage/Exception/ReflectionException.php(4 ek)?php-code-coverage/Exception/ReportAlreadyFinalizedException.php:(4 e:d%6Iphp-code-coverage/Exception/StaticAnalysisCacheNotConfiguredException.php(4 e}6php-code-coverage/Exception/TestIdMissingException.php(4 e -Cphp-code-coverage/Exception/UnintentionallyCoveredCodeException.php+(4 e+Q_ª=php-code-coverage/Exception/WriteOperationFailedException.php(4 e(e;php-code-coverage/Exception/WrongXdebugVersionException.php(4 e Ȥ:php-code-coverage/Exception/Xdebug2NotEnabledException.phpf(4 ef,':php-code-coverage/Exception/Xdebug3NotEnabledException.phpy(4 ey<>;php-code-coverage/Exception/XdebugNotAvailableException.phpe(4 eeNG,php-code-coverage/Exception/XmlException.php(4 eWܤphp-code-coverage/Filter.php (4 e 4php-code-coverage/LICENSE(4 e-~y֤'php-code-coverage/Node/AbstractNode.php:(4 e:%^"php-code-coverage/Node/Builder.php (4 e 2N$php-code-coverage/Node/CrapIndex.php(4 e# $php-code-coverage/Node/Directory.php -&(4 e -&}php-code-coverage/Node/File.phpK(4 eK{#php-code-coverage/Node/Iterator.php(4 eHk/php-code-coverage/ProcessedCodeCoverageData.php$(4 e$')php-code-coverage/RawCodeCoverageData.php!(4 e!#php-code-coverage/Report/Clover.phpW((4 eW(yD&php-code-coverage/Report/Cobertura.php1(4 e1 Z#php-code-coverage/Report/Crap4j.php<(4 e<r(php-code-coverage/Report/Html/Facade.php"(4 e";ڤ*php-code-coverage/Report/Html/Renderer.phpU!(4 eU!}4php-code-coverage/Report/Html/Renderer/Dashboard.phpC (4 eC L+4php-code-coverage/Report/Html/Renderer/Directory.php (4 e (/php-code-coverage/Report/Html/Renderer/File.php (4 e ZuBphp-code-coverage/Report/Html/Renderer/Template/branches.html.dist(4 eh2+Fphp-code-coverage/Report/Html/Renderer/Template/coverage_bar.html.dist'(4 e'O}Mphp-code-coverage/Report/Html/Renderer/Template/coverage_bar_branch.html.dist'(4 e'O}Ephp-code-coverage/Report/Html/Renderer/Template/css/bootstrap.min.cssy(4 eyĤ>php-code-coverage/Report/Html/Renderer/Template/css/custom.css(4 eAphp-code-coverage/Report/Html/Renderer/Template/css/nv.d3.min.cssX%(4 eX%0,@php-code-coverage/Report/Html/Renderer/Template/css/octicons.cssX(4 eX'#=php-code-coverage/Report/Html/Renderer/Template/css/style.css -(4 e -Cphp-code-coverage/Report/Html/Renderer/Template/dashboard.html.dist(4 eDJphp-code-coverage/Report/Html/Renderer/Template/dashboard_branch.html.dist(4 eDCphp-code-coverage/Report/Html/Renderer/Template/directory.html.dist(4 eՆJphp-code-coverage/Report/Html/Renderer/Template/directory_branch.html.dist(4 en2]Hphp-code-coverage/Report/Html/Renderer/Template/directory_item.html.distA(4 eAdsOphp-code-coverage/Report/Html/Renderer/Template/directory_item_branch.html.dist;(4 e;mۤ>php-code-coverage/Report/Html/Renderer/Template/file.html.distP (4 eP j*Ephp-code-coverage/Report/Html/Renderer/Template/file_branch.html.dist (4 e ㉞Cphp-code-coverage/Report/Html/Renderer/Template/file_item.html.distr(4 er/yJphp-code-coverage/Report/Html/Renderer/Template/file_item_branch.html.distl(4 el-Cphp-code-coverage/Report/Html/Renderer/Template/icons/file-code.svg0(4 e0QUUHphp-code-coverage/Report/Html/Renderer/Template/icons/file-directory.svg(4 eZCphp-code-coverage/Report/Html/Renderer/Template/js/bootstrap.min.jsc(4 ec"#<php-code-coverage/Report/Html/Renderer/Template/js/d3.min.jsP(4 ePhb:php-code-coverage/Report/Html/Renderer/Template/js/file.js(4 eb䆤@php-code-coverage/Report/Html/Renderer/Template/js/jquery.min.js@^(4 e@^ ?php-code-coverage/Report/Html/Renderer/Template/js/nv.d3.min.jsR(4 eRphp-code-coverage/Report/Html/Renderer/Template/line.html.dist(4 e{?php-code-coverage/Report/Html/Renderer/Template/lines.html.diste(4 eedf Ephp-code-coverage/Report/Html/Renderer/Template/method_item.html.dist(4 ejפLphp-code-coverage/Report/Html/Renderer/Template/method_item_branch.html.dist(4 eyĎk?php-code-coverage/Report/Html/Renderer/Template/paths.html.dist(4 e*'ݤ php-code-coverage/Report/PHP.php(4 e<[!php-code-coverage/Report/Text.php'(4 e' 6H1php-code-coverage/Report/Xml/BuildInformation.php (4 e T3e)php-code-coverage/Report/Xml/Coverage.php+(4 e+9E*php-code-coverage/Report/Xml/Directory.php(4 eAf'php-code-coverage/Report/Xml/Facade.php"(4 e"O}%php-code-coverage/Report/Xml/File.php+(4 e+g׃'php-code-coverage/Report/Xml/Method.phpW(4 eW ʤ%php-code-coverage/Report/Xml/Node.php3(4 e3(php-code-coverage/Report/Xml/Project.phpf(4 efPe'php-code-coverage/Report/Xml/Report.php (4 e HC'php-code-coverage/Report/Xml/Source.phpz(4 ez'1&php-code-coverage/Report/Xml/Tests.php(4 e'php-code-coverage/Report/Xml/Totals.php(4 e:6%php-code-coverage/Report/Xml/Unit.php(4 eY0php-code-coverage/StaticAnalysis/CacheWarmer.php`(4 e`_%פ8php-code-coverage/StaticAnalysis/CachingFileAnalyser.php(4 e2Q;php-code-coverage/StaticAnalysis/CodeUnitFindingVisitor.php,((4 e,(vMBphp-code-coverage/StaticAnalysis/ExecutableLinesFindingVisitor.phpm'(4 em'i1php-code-coverage/StaticAnalysis/FileAnalyser.php(4 eJ?php-code-coverage/StaticAnalysis/IgnoredLinesFindingVisitor.php (4 e 8php-code-coverage/StaticAnalysis/ParsingFileAnalyser.php(4 ed%php-code-coverage/Util/Filesystem.php(4 e%php-code-coverage/Util/Percentage.php(4 ephp-code-coverage/Version.php(4 eR郤php-file-iterator/Facade.php% -(4 e% -Τphp-file-iterator/Factory.php(4 eg ,php-file-iterator/Iterator.phpZ (4 eZ C܎php-file-iterator/LICENSE(4 eo:php-invoker/Invoker.php(4 e+L$php-invoker/exceptions/Exception.phpr(4 ervvduDphp-invoker/exceptions/ProcessControlExtensionNotLoadedException.php(4 e +php-invoker/exceptions/TimeoutException.php(4 e.php-text-template/LICENSE(4 euphp-text-template/Template.php( (4 e( *php-text-template/exceptions/Exception.phpy(4 eyn9php-text-template/exceptions/InvalidArgumentException.php(4 eaM1php-text-template/exceptions/RuntimeException.php(4 eYm'php-timer/Duration.php -(4 e -tXyphp-timer/LICENSE(4 ex$php-timer/ResourceUsageFormatter.php(4 ePھphp-timer/Timer.php(4 ecAɤ"php-timer/exceptions/Exception.phpn(4 eniuۤ/php-timer/exceptions/NoActiveTimerException.php(4 el٤Ephp-timer/exceptions/TimeSinceStartOfRequestNotAvailableException.php(4 e$b+phpdocumentor-reflection-common/Element.php (4 e %(phpdocumentor-reflection-common/File.php(4 eI))phpdocumentor-reflection-common/Fqsen.php(4 e?'phpdocumentor-reflection-common/LICENSE9(4 e9*2Ȑ,phpdocumentor-reflection-common/Location.php(4 e=(+phpdocumentor-reflection-common/Project.php(4 eJ2phpdocumentor-reflection-common/ProjectFactory.php_(4 e_j\".phpdocumentor-reflection-docblock/DocBlock.php(4 eHx>$:phpdocumentor-reflection-docblock/DocBlock/Description.php (4 e 54Aphpdocumentor-reflection-docblock/DocBlock/DescriptionFactory.php(4 ed=<phpdocumentor-reflection-docblock/DocBlock/ExampleFinder.php,(4 e,ׯf9phpdocumentor-reflection-docblock/DocBlock/Serializer.php (4 e ]Aphpdocumentor-reflection-docblock/DocBlock/StandardTagFactory.php0(4 e0<2phpdocumentor-reflection-docblock/DocBlock/Tag.php(4 e9phpdocumentor-reflection-docblock/DocBlock/TagFactory.php(4 eJMx:phpdocumentor-reflection-docblock/DocBlock/Tags/Author.php (4 e ;phpdocumentor-reflection-docblock/DocBlock/Tags/BaseTag.php(4 eZr:phpdocumentor-reflection-docblock/DocBlock/Tags/Covers.phpg -(4 eg -w8>phpdocumentor-reflection-docblock/DocBlock/Tags/Deprecated.php -(4 e -}CO;phpdocumentor-reflection-docblock/DocBlock/Tags/Example.php(4 ealN@Hphpdocumentor-reflection-docblock/DocBlock/Tags/Factory/StaticMethod.php(4 e.ͤ=phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter.php(4 e}BܤLphpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/AlignFormatter.phpq(4 eqRphpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/PassthroughFormatter.php(4 eP~;phpdocumentor-reflection-docblock/DocBlock/Tags/Generic.phpx (4 ex Bn>phpdocumentor-reflection-docblock/DocBlock/Tags/InvalidTag.php,(4 e,Md88phpdocumentor-reflection-docblock/DocBlock/Tags/Link.php(4 eG:phpdocumentor-reflection-docblock/DocBlock/Tags/Method.php(4 eYKc9phpdocumentor-reflection-docblock/DocBlock/Tags/Param.php(4 eB<phpdocumentor-reflection-docblock/DocBlock/Tags/Property.php (4 e |yCϤ@phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyRead.php (4 e #k:Aphpdocumentor-reflection-docblock/DocBlock/Tags/PropertyWrite.php (4 e v Cphpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Fqsen.php,(4 e,%8Gphpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Reference.php(4 e Aphpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Url.php(4 ec[];phpdocumentor-reflection-docblock/DocBlock/Tags/Return_.php(4 e N7phpdocumentor-reflection-docblock/DocBlock/Tags/See.php (4 e :e9phpdocumentor-reflection-docblock/DocBlock/Tags/Since.phpW -(4 eW -1>:phpdocumentor-reflection-docblock/DocBlock/Tags/Source.php (4 e [K?phpdocumentor-reflection-docblock/DocBlock/Tags/TagWithType.php(4 e;u:phpdocumentor-reflection-docblock/DocBlock/Tags/Throws.php(4 e"G8phpdocumentor-reflection-docblock/DocBlock/Tags/Uses.php> -(4 e> - -8phpdocumentor-reflection-docblock/DocBlock/Tags/Var_.php (4 e u:ڤ;phpdocumentor-reflection-docblock/DocBlock/Tags/Version.php -(4 e -@S5phpdocumentor-reflection-docblock/DocBlockFactory.php$(4 e$br>phpdocumentor-reflection-docblock/DocBlockFactoryInterface.php(4 e)%ߤ=phpdocumentor-reflection-docblock/Exception/PcreException.php(4 e V)phpdocumentor-reflection-docblock/LICENSE8(4 e8ʤ+phpdocumentor-reflection-docblock/Utils.php (4 e -phpdocumentor-type-resolver/FqsenResolver.php(4 ej^#phpdocumentor-type-resolver/LICENSE8(4 e8ʤ*phpdocumentor-type-resolver/PseudoType.phpu(4 eu]\:phpdocumentor-type-resolver/PseudoTypes/CallableString.php`(4 e`Z2phpdocumentor-type-resolver/PseudoTypes/False_.php(4 eo䈤=phpdocumentor-type-resolver/PseudoTypes/HtmlEscapedString.phpg(4 egwe8phpdocumentor-type-resolver/PseudoTypes/IntegerRange.php%(4 e%R1phpdocumentor-type-resolver/PseudoTypes/List_.php(4 ewu9phpdocumentor-type-resolver/PseudoTypes/LiteralString.php^(4 e^=oNW;phpdocumentor-type-resolver/PseudoTypes/LowercaseString.phpb(4 eb7 ;phpdocumentor-type-resolver/PseudoTypes/NegativeInteger.php[(4 e[DEۤCphpdocumentor-type-resolver/PseudoTypes/NonEmptyLowercaseString.phpt(4 et):phpdocumentor-type-resolver/PseudoTypes/NonEmptyString.phpa(4 ea²,9phpdocumentor-type-resolver/PseudoTypes/NumericString.php^(4 e^8M4phpdocumentor-type-resolver/PseudoTypes/Numeric_.php(4 e=k;phpdocumentor-type-resolver/PseudoTypes/PositiveInteger.php[(4 e[H7phpdocumentor-type-resolver/PseudoTypes/TraitString.phpZ(4 eZgC1phpdocumentor-type-resolver/PseudoTypes/True_.php(4 el$phpdocumentor-type-resolver/Type.php(4 eb&,phpdocumentor-type-resolver/TypeResolver.php%U(4 e%UU2phpdocumentor-type-resolver/Types/AbstractList.phpt(4 ett4phpdocumentor-type-resolver/Types/AggregatedType.php -(4 e -Hɵ.phpdocumentor-type-resolver/Types/ArrayKey.php(4 ePĤ,phpdocumentor-type-resolver/Types/Array_.php(4 e4-phpdocumentor-type-resolver/Types/Boolean.phpn(4 enrĤ/phpdocumentor-type-resolver/Types/Callable_.php{(4 e{E1phpdocumentor-type-resolver/Types/ClassString.phpC(4 eCrvy0phpdocumentor-type-resolver/Types/Collection.php(4 e?.phpdocumentor-type-resolver/Types/Compound.php(4 e>7-phpdocumentor-type-resolver/Types/Context.php (4 e ]Z4phpdocumentor-type-resolver/Types/ContextFactory.php6(4 e6\0phpdocumentor-type-resolver/Types/Expression.php8(4 e8g,phpdocumentor-type-resolver/Types/Float_.phpm(4 em)J-phpdocumentor-type-resolver/Types/Integer.phpj(4 ejv5phpdocumentor-type-resolver/Types/InterfaceString.php(4 e2phpdocumentor-type-resolver/Types/Intersection.php(4 eUz$/phpdocumentor-type-resolver/Types/Iterable_.php?(4 e?Q8,phpdocumentor-type-resolver/Types/Mixed_.php(4 e3i,phpdocumentor-type-resolver/Types/Never_.php(4 ej+phpdocumentor-type-resolver/Types/Null_.phpx(4 exs.phpdocumentor-type-resolver/Types/Nullable.phpR(4 eRCp\-phpdocumentor-type-resolver/Types/Object_.php(4 ewEhN-phpdocumentor-type-resolver/Types/Parent_.php(4 eO!./phpdocumentor-type-resolver/Types/Resource_.php(4 eŞX,phpdocumentor-type-resolver/Types/Scalar.php(4 e+phpdocumentor-type-resolver/Types/Self_.php(4 eoȤ-phpdocumentor-type-resolver/Types/Static_.php(4 e8-phpdocumentor-type-resolver/Types/String_.phps(4 esH*phpdocumentor-type-resolver/Types/This.phpY(4 eY^?ֈ+phpdocumentor-type-resolver/Types/Void_.php(4 ekphpspec-prophecy/LICENSE}(4 e} ߦ&phpspec-prophecy/Prophecy/Argument.php](4 e]eQ8phpspec-prophecy/Prophecy/Argument/ArgumentsWildcard.php (4 e N<:phpspec-prophecy/Prophecy/Argument/Token/AnyValueToken.php(4 eIZ%%;phpspec-prophecy/Prophecy/Argument/Token/AnyValuesToken.php(4 e'`Bphpspec-prophecy/Prophecy/Argument/Token/ApproximateValueToken.phpm(4 em٬c<phpspec-prophecy/Prophecy/Argument/Token/ArrayCountToken.phpQ(4 eQ_穤<phpspec-prophecy/Prophecy/Argument/Token/ArrayEntryToken.php(4 eRAphpspec-prophecy/Prophecy/Argument/Token/ArrayEveryEntryToken.php(4 e#:phpspec-prophecy/Prophecy/Argument/Token/CallbackToken.php(4 ef"<phpspec-prophecy/Prophecy/Argument/Token/ExactValueToken.php (4 e :٤@phpspec-prophecy/Prophecy/Argument/Token/IdenticalValueToken.php(4 e49phpspec-prophecy/Prophecy/Argument/Token/InArrayToken.php(4 eͪ!<phpspec-prophecy/Prophecy/Argument/Token/LogicalAndToken.php(4 e<phpspec-prophecy/Prophecy/Argument/Token/LogicalNotToken.phpA(4 eA<phpspec-prophecy/Prophecy/Argument/Token/NotInArrayToken.php(4 e=phpspec-prophecy/Prophecy/Argument/Token/ObjectStateToken.php -(4 e -#"lV@phpspec-prophecy/Prophecy/Argument/Token/StringContainsToken.php-(4 e-3xD;phpspec-prophecy/Prophecy/Argument/Token/TokenInterface.php(4 eG66phpspec-prophecy/Prophecy/Argument/Token/TypeToken.php(4 e$'phpspec-prophecy/Prophecy/Call/Call.php(4 e΂-phpspec-prophecy/Prophecy/Call/CallCenter.php(4 e\%-j:phpspec-prophecy/Prophecy/Comparator/ClosureComparator.php(4 eO0phpspec-prophecy/Prophecy/Comparator/Factory.php(4 eU%8phpspec-prophecy/Prophecy/Comparator/FactoryProvider.php(4 ek;phpspec-prophecy/Prophecy/Comparator/ProphecyComparator.php (4 e 3phpspec-prophecy/Prophecy/Doubler/CachedDoubler.php(4 eUWDphpspec-prophecy/Prophecy/Doubler/ClassPatch/ClassPatchInterface.phph(4 ehq!ʤHphpspec-prophecy/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php(4 e,g=phpspec-prophecy/Prophecy/Doubler/ClassPatch/KeywordPatch.php'(4 e'?phpspec-prophecy/Prophecy/Doubler/ClassPatch/MagicCallPatch.php (4 e Q)7Ephpspec-prophecy/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php$ (4 e$ bBۀPphpspec-prophecy/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php(4 e -,Aphpspec-prophecy/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php@ (4 e@ YyG?phpspec-prophecy/Prophecy/Doubler/ClassPatch/ThrowablePatch.php" (4 e" aԤAphpspec-prophecy/Prophecy/Doubler/ClassPatch/TraversablePatch.php (4 e wp5phpspec-prophecy/Prophecy/Doubler/DoubleInterface.php(4 eBۤ-phpspec-prophecy/Prophecy/Doubler/Doubler.php(4 ePvlBphpspec-prophecy/Prophecy/Doubler/Generator/ClassCodeGenerator.php (4 e Wy<phpspec-prophecy/Prophecy/Doubler/Generator/ClassCreator.phpb(4 ebH1ؤ;phpspec-prophecy/Prophecy/Doubler/Generator/ClassMirror.php#(4 e#Aphpspec-prophecy/Prophecy/Doubler/Generator/Node/ArgumentNode.php(4 eZfEphpspec-prophecy/Prophecy/Doubler/Generator/Node/ArgumentTypeNode.php(4 eˤ>phpspec-prophecy/Prophecy/Doubler/Generator/Node/ClassNode.phpN(4 eN׉ ?phpspec-prophecy/Prophecy/Doubler/Generator/Node/MethodNode.php(4 eCphpspec-prophecy/Prophecy/Doubler/Generator/Node/ReturnTypeNode.php(4 eCٮEphpspec-prophecy/Prophecy/Doubler/Generator/Node/TypeNodeAbstract.php (4 e eCphpspec-prophecy/Prophecy/Doubler/Generator/ReflectionInterface.php(4 e YAphpspec-prophecy/Prophecy/Doubler/Generator/TypeHintReference.php"(4 e"&0phpspec-prophecy/Prophecy/Doubler/LazyDouble.php (4 e 3phpspec-prophecy/Prophecy/Doubler/NameGenerator.php(4 e,ôyDphpspec-prophecy/Prophecy/Exception/Call/UnexpectedCallException.php(4 eOEphpspec-prophecy/Prophecy/Exception/Doubler/ClassCreatorException.phpD(4 eDyXDphpspec-prophecy/Prophecy/Exception/Doubler/ClassMirrorException.phpd(4 edv48Fphpspec-prophecy/Prophecy/Exception/Doubler/ClassNotFoundException.php(4 e}:?phpspec-prophecy/Prophecy/Exception/Doubler/DoubleException.php(4 eV"^@phpspec-prophecy/Prophecy/Exception/Doubler/DoublerException.php(4 ehJphpspec-prophecy/Prophecy/Exception/Doubler/InterfaceNotFoundException.php!(4 e!R3Lphpspec-prophecy/Prophecy/Exception/Doubler/MethodNotExtendableException.php(4 e[Gphpspec-prophecy/Prophecy/Exception/Doubler/MethodNotFoundException.php(4 e#kJphpspec-prophecy/Prophecy/Exception/Doubler/ReturnByReferenceException.php(4 eL?1phpspec-prophecy/Prophecy/Exception/Exception.php(4 ex@phpspec-prophecy/Prophecy/Exception/InvalidArgumentException.php(4 e󱙤Ephpspec-prophecy/Prophecy/Exception/Prediction/AggregateException.php;(4 e;.Lphpspec-prophecy/Prophecy/Exception/Prediction/FailedPredictionException.phpg(4 eg3'}}Cphpspec-prophecy/Prophecy/Exception/Prediction/NoCallsException.php(4 eZFphpspec-prophecy/Prophecy/Exception/Prediction/PredictionException.php(4 eR2ͤPphpspec-prophecy/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php (4 e ڶKphpspec-prophecy/Prophecy/Exception/Prediction/UnexpectedCallsException.php(4 eHphpspec-prophecy/Prophecy/Exception/Prophecy/MethodProphecyException.phpo(4 eoHphpspec-prophecy/Prophecy/Exception/Prophecy/ObjectProphecyException.php(4 eg6ڤBphpspec-prophecy/Prophecy/Exception/Prophecy/ProphecyException.php(4 eD7jIphpspec-prophecy/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php\(4 e\,|Ϥ=phpspec-prophecy/Prophecy/PhpDocumentor/ClassTagRetriever.php(4 eGphpspec-prophecy/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php(4 eB7phpspec-prophecy/Prophecy/Prediction/CallPrediction.php"(4 e"Ҷڤ<phpspec-prophecy/Prophecy/Prediction/CallTimesPrediction.phpH (4 eH ,;phpspec-prophecy/Prophecy/Prediction/CallbackPrediction.php(4 e :phpspec-prophecy/Prophecy/Prediction/NoCallsPrediction.php>(4 e>y<phpspec-prophecy/Prophecy/Prediction/PredictionInterface.php(4 eD5phpspec-prophecy/Prophecy/Promise/CallbackPromise.php#(4 e#26phpspec-prophecy/Prophecy/Promise/PromiseInterface.phpa(4 eaĶ= -;phpspec-prophecy/Prophecy/Promise/ReturnArgumentPromise.phpE(4 eEj3phpspec-prophecy/Prophecy/Promise/ReturnPromise.phpu(4 euR2phpspec-prophecy/Prophecy/Promise/ThrowPromise.php -(4 e -cb5phpspec-prophecy/Prophecy/Prophecy/MethodProphecy.phpt<(4 et<n(5phpspec-prophecy/Prophecy/Prophecy/ObjectProphecy.php(4 eVK%8phpspec-prophecy/Prophecy/Prophecy/ProphecyInterface.phpq(4 eqhRw¤?phpspec-prophecy/Prophecy/Prophecy/ProphecySubjectInterface.php(4 eġAr/phpspec-prophecy/Prophecy/Prophecy/Revealer.php(4 e m8phpspec-prophecy/Prophecy/Prophecy/RevealerInterface.phpG(4 eGWnZ%phpspec-prophecy/Prophecy/Prophet.php(4 eNȤ-phpspec-prophecy/Prophecy/Util/ExportUtil.php(4 et-phpspec-prophecy/Prophecy/Util/StringUtil.php -(4 e -v|= phpunit.xsdRF(4 eRFAgphpunit/Exception.php(4 ea#phpunit/Framework/Assert.phpc(4 ectN&phpunit/Framework/Assert/Functions.php (4 e s0phpunit/Framework/Constraint/Boolean/IsFalse.php(4 e/phpunit/Framework/Constraint/Boolean/IsTrue.php(4 e})phpunit/Framework/Constraint/Callback.php?(4 e? -b2phpunit/Framework/Constraint/Cardinality/Count.phpj (4 ej xR@ؤ8phpunit/Framework/Constraint/Cardinality/GreaterThan.php(4 eh,d}4phpunit/Framework/Constraint/Cardinality/IsEmpty.php(4 ehf5phpunit/Framework/Constraint/Cardinality/LessThan.php(4 ea T5phpunit/Framework/Constraint/Cardinality/SameSize.php_(4 e_uŤ+phpunit/Framework/Constraint/Constraint.php"(4 e"*yK1phpunit/Framework/Constraint/Equality/IsEqual.php (4 e \hh?phpunit/Framework/Constraint/Equality/IsEqualCanonicalizing.php -(4 e -~=phpunit/Framework/Constraint/Equality/IsEqualIgnoringCase.php -(4 e -C\:phpunit/Framework/Constraint/Equality/IsEqualWithDelta.php -(4 e -(v4phpunit/Framework/Constraint/Exception/Exception.php(4 eRu{8phpunit/Framework/Constraint/Exception/ExceptionCode.php(4 eiأ;phpunit/Framework/Constraint/Exception/ExceptionMessage.php(4 ew;Lphpunit/Framework/Constraint/Exception/ExceptionMessageRegularExpression.php(4 eLj[i;phpunit/Framework/Constraint/Filesystem/DirectoryExists.phpj(4 eji+6phpunit/Framework/Constraint/Filesystem/FileExists.phpe(4 eeK6phpunit/Framework/Constraint/Filesystem/IsReadable.phpe(4 ee16phpunit/Framework/Constraint/Filesystem/IsWritable.phpe(4 ee+phpunit/Framework/Constraint/IsAnything.php(4 eE,phpunit/Framework/Constraint/IsIdentical.php (4 e &,phpunit/Framework/Constraint/JsonMatches.php% (4 e% 儃@phpunit/Framework/Constraint/JsonMatchesErrorMessageProvider.php5(4 e5mһ.phpunit/Framework/Constraint/Math/IsFinite.php(4 eZҗ0phpunit/Framework/Constraint/Math/IsInfinite.php(4 e'*~+phpunit/Framework/Constraint/Math/IsNan.php(4 e4g09phpunit/Framework/Constraint/Object/ClassHasAttribute.php(4 e*?phpunit/Framework/Constraint/Object/ClassHasStaticAttribute.php*(4 e*!%4phpunit/Framework/Constraint/Object/ObjectEquals.php -(4 e -0W:phpunit/Framework/Constraint/Object/ObjectHasAttribute.php(4 e$9phpunit/Framework/Constraint/Object/ObjectHasProperty.php(4 e|8phpunit/Framework/Constraint/Operator/BinaryOperator.phpG(4 eGS\4phpunit/Framework/Constraint/Operator/LogicalAnd.php(4 ebJ4phpunit/Framework/Constraint/Operator/LogicalNot.php (4 e 3phpunit/Framework/Constraint/Operator/LogicalOr.php(4 eZ4phpunit/Framework/Constraint/Operator/LogicalXor.php$(4 e$O2phpunit/Framework/Constraint/Operator/Operator.php&(4 e& Dܤ7phpunit/Framework/Constraint/Operator/UnaryOperator.php -(4 e - a.phpunit/Framework/Constraint/String/IsJson.php(4 e\@9phpunit/Framework/Constraint/String/RegularExpression.php(4 e+J6phpunit/Framework/Constraint/String/StringContains.php(4 eij"6phpunit/Framework/Constraint/String/StringEndsWith.php(4 e{Fphpunit/Framework/Constraint/String/StringMatchesFormatDescription.php -(4 e -J8phpunit/Framework/Constraint/String/StringStartsWith.php&(4 e&c>8phpunit/Framework/Constraint/Traversable/ArrayHasKey.php(4 e6@!@phpunit/Framework/Constraint/Traversable/TraversableContains.php(4 eEphpunit/Framework/Constraint/Traversable/TraversableContainsEqual.phpa(4 eawAIphpunit/Framework/Constraint/Traversable/TraversableContainsIdentical.php'(4 e'sӤDphpunit/Framework/Constraint/Traversable/TraversableContainsOnly.php (4 e RuФ2phpunit/Framework/Constraint/Type/IsInstanceOf.php:(4 e:@,phpunit/Framework/Constraint/Type/IsNull.php(4 e?),phpunit/Framework/Constraint/Type/IsType.php(4 eGȤ+phpunit/Framework/DataProviderTestSuite.php(4 e\8&phpunit/Framework/Error/Deprecated.phpz(4 ezV!phpunit/Framework/Error/Error.phpl(4 el]"phpunit/Framework/Error/Notice.phpv(4 evˤ#phpunit/Framework/Error/Warning.phpw(4 ewG#phpunit/Framework/ErrorTestCase.php(4 ecȶAphpunit/Framework/Exception/ActualValueIsNotAnObjectException.php(4 e`B4phpunit/Framework/Exception/AssertionFailedError.php(4 e5phpunit/Framework/Exception/CodeCoverageException.php(4 e[Sphpunit/Framework/Exception/ComparisonMethodDoesNotAcceptParameterTypeException.phpk(4 ek:phpunit/Framework/MockObject/Builder/InvocationStubber.php(4 e8phpunit/Framework/MockObject/Builder/MethodNameMatch.phpw(4 ewTy8phpunit/Framework/MockObject/Builder/ParametersMatch.php(4 eڃ-phpunit/Framework/MockObject/Builder/Stub.php(4 e(3phpunit/Framework/MockObject/ConfigurableMethod.php(4 eAphpunit/Framework/MockObject/Exception/BadMethodCallException.php(4 eΫXGphpunit/Framework/MockObject/Exception/CannotUseAddMethodsException.php5(4 e5{Hphpunit/Framework/MockObject/Exception/CannotUseOnlyMethodsException.phpE(4 eEFphpunit/Framework/MockObject/Exception/ClassAlreadyExistsException.php(4 e@phpunit/Framework/MockObject/Exception/ClassIsFinalException.php(4 e()Cphpunit/Framework/MockObject/Exception/ClassIsReadonlyException.php(4 eOuXYphpunit/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php (4 e ɅWCphpunit/Framework/MockObject/Exception/DuplicateMethodException.php(4 ey4phpunit/Framework/MockObject/Exception/Exception.php(4 eB'Kphpunit/Framework/MockObject/Exception/IncompatibleReturnValueException.php(4 e3dfEphpunit/Framework/MockObject/Exception/InvalidMethodNameException.php(4 e ܤHphpunit/Framework/MockObject/Exception/MatchBuilderNotFoundException.php(4 eLphpunit/Framework/MockObject/Exception/MatcherAlreadyRegisteredException.php(4 ez'Lphpunit/Framework/MockObject/Exception/MethodCannotBeConfiguredException.php(4 e}QOphpunit/Framework/MockObject/Exception/MethodNameAlreadyConfiguredException.php(4 eӁƤKphpunit/Framework/MockObject/Exception/MethodNameNotConfiguredException.php~(4 e~x1)Uphpunit/Framework/MockObject/Exception/MethodParametersAlreadyConfiguredException.php(4 e rYphpunit/Framework/MockObject/Exception/OriginalConstructorInvocationRequiredException.php(4 eک>phpunit/Framework/MockObject/Exception/ReflectionException.php(4 e.ؔLphpunit/Framework/MockObject/Exception/ReturnValueNotConfiguredException.php6(4 e6?먙;phpunit/Framework/MockObject/Exception/RuntimeException.php(4 e_|Mphpunit/Framework/MockObject/Exception/SoapExtensionNotAvailableException.php(4 ez@phpunit/Framework/MockObject/Exception/UnknownClassException.php(4 e5uW@phpunit/Framework/MockObject/Exception/UnknownTraitException.php(4 eq¥?phpunit/Framework/MockObject/Exception/UnknownTypeException.php(4 e~*phpunit/Framework/MockObject/Generator.phpb(4 ebiEۤ6phpunit/Framework/MockObject/Generator/deprecation.tpl;(4 e;O5s7phpunit/Framework/MockObject/Generator/intersection.tplL(4 eL-X7phpunit/Framework/MockObject/Generator/mocked_class.tpl(4 ewZ8phpunit/Framework/MockObject/Generator/mocked_method.tplF(4 eFKFphpunit/Framework/MockObject/Generator/mocked_method_never_or_void.tpl(4 ep?phpunit/Framework/MockObject/Generator/mocked_static_method.tpl(4 e 4R9phpunit/Framework/MockObject/Generator/proxied_method.tpl}(4 e}@ėGphpunit/Framework/MockObject/Generator/proxied_method_never_or_void.tplv(4 evT6phpunit/Framework/MockObject/Generator/trait_class.tplQ(4 eQ<Ȥ5phpunit/Framework/MockObject/Generator/wsdl_class.tpl(4 e6phpunit/Framework/MockObject/Generator/wsdl_method.tpl<(4 e<i+phpunit/Framework/MockObject/Invocation.php(4 eid2phpunit/Framework/MockObject/InvocationHandler.php:(4 e:ˤ(phpunit/Framework/MockObject/Matcher.php(4 eD-5phpunit/Framework/MockObject/MethodNameConstraint.php -(4 e -A1|,phpunit/Framework/MockObject/MockBuilder.phpY+(4 eY+ϴ=*phpunit/Framework/MockObject/MockClass.php(4 e'C+phpunit/Framework/MockObject/MockMethod.phpz&(4 ez&p.phpunit/Framework/MockObject/MockMethodSet.php8(4 e8G\+phpunit/Framework/MockObject/MockObject.php(4 ebt*phpunit/Framework/MockObject/MockTrait.php(4 e&nä)phpunit/Framework/MockObject/MockType.php(4 eFFt5phpunit/Framework/MockObject/Rule/AnyInvokedCount.phpj(4 ej`Ť3phpunit/Framework/MockObject/Rule/AnyParameters.php(4 e~';phpunit/Framework/MockObject/Rule/ConsecutiveParameters.php~ (4 e~ 5phpunit/Framework/MockObject/Rule/InvocationOrder.php(4 eLDӤ4phpunit/Framework/MockObject/Rule/InvokedAtIndex.php,(4 e,kK9phpunit/Framework/MockObject/Rule/InvokedAtLeastCount.php(4 eB8phpunit/Framework/MockObject/Rule/InvokedAtLeastOnce.php-(4 e- (8phpunit/Framework/MockObject/Rule/InvokedAtMostCount.php(4 egY2phpunit/Framework/MockObject/Rule/InvokedCount.php (4 e ^ 0phpunit/Framework/MockObject/Rule/MethodName.php(4 e -WG0phpunit/Framework/MockObject/Rule/Parameters.phpQ(4 eQ`g|4phpunit/Framework/MockObject/Rule/ParametersRule.phpc(4 ec?(%phpunit/Framework/MockObject/Stub.php(4 eŎ6phpunit/Framework/MockObject/Stub/ConsecutiveCalls.php (4 e ./phpunit/Framework/MockObject/Stub/Exception.php((4 e(J4phpunit/Framework/MockObject/Stub/ReturnArgument.php(4 e?}64phpunit/Framework/MockObject/Stub/ReturnCallback.php(4 eD0Ӥ5phpunit/Framework/MockObject/Stub/ReturnReference.php (4 e f0phpunit/Framework/MockObject/Stub/ReturnSelf.php4(4 e4DD0phpunit/Framework/MockObject/Stub/ReturnStub.php(4 e4phpunit/Framework/MockObject/Stub/ReturnValueMap.php(4 eۤ*phpunit/Framework/MockObject/Stub/Stub.php3(4 e3>++phpunit/Framework/MockObject/Verifiable.php(4 e̐ s!phpunit/Framework/Reorderable.php(4 ez0$phpunit/Framework/SelfDescribing.php -(4 e -s!phpunit/Framework/SkippedTest.php(4 eS.%phpunit/Framework/SkippedTestCase.php(4 eQKhphpunit/Framework/Test.php~(4 e~wt!phpunit/Framework/TestBuilder.php"(4 e"14jphpunit/Framework/TestCase.php.(4 e.] !phpunit/Framework/TestFailure.php(4 e'q"phpunit/Framework/TestListener.phpr(4 erӪc^7phpunit/Framework/TestListenerDefaultImplementation.php'(4 e'! phpunit/Framework/TestResult.php -(4 e -rOphpunit/Framework/TestSuite.phpQd(4 eQd5ܛ'phpunit/Framework/TestSuiteIterator.php6(4 e6$ u%phpunit/Framework/WarningTestCase.php'(4 e'n@ !phpunit/Runner/BaseTestRunner.php (4 e C +)phpunit/Runner/DefaultTestResultCache.php!(4 e!/i^phpunit/Runner/Exception.php(4 ezZ-phpunit/Runner/Extension/ExtensionHandler.php (4 e Az'phpunit/Runner/Extension/PharLoader.php (4 e /4phpunit/Runner/Filter/ExcludeGroupFilterIterator.phps(4 es} -Z!phpunit/Runner/Filter/Factory.php(4 edcΤ-phpunit/Runner/Filter/GroupFilterIterator.php(4 e=;4phpunit/Runner/Filter/IncludeGroupFilterIterator.phpr(4 erP;AD,phpunit/Runner/Filter/NameFilterIterator.phpv (4 ev Z/phpunit/Runner/Hook/AfterIncompleteTestHook.php-(4 e-zԤ)phpunit/Runner/Hook/AfterLastTestHook.php(4 e0B֤*phpunit/Runner/Hook/AfterRiskyTestHook.php#(4 e#dm,phpunit/Runner/Hook/AfterSkippedTestHook.php'(4 e':/phpunit/Runner/Hook/AfterSuccessfulTestHook.php(4 e5w*phpunit/Runner/Hook/AfterTestErrorHook.php#(4 e#ݮ,phpunit/Runner/Hook/AfterTestFailureHook.php'(4 e'2F%phpunit/Runner/Hook/AfterTestHook.php(4 e;gA,phpunit/Runner/Hook/AfterTestWarningHook.php'(4 e'':+phpunit/Runner/Hook/BeforeFirstTestHook.php(4 ehWt&phpunit/Runner/Hook/BeforeTestHook.php(4 e"bphpunit/Runner/Hook/Hook.php(4 e. phpunit/Runner/Hook/TestHook.php(4 eZ_ -+phpunit/Runner/Hook/TestListenerAdapter.php(4 e\6E&phpunit/Runner/NullTestResultCache.php(4 eW<phpunit/Runner/PhptTestCase.phpRV(4 eRVԴO'phpunit/Runner/ResultCacheExtension.php<(4 e<6 _*phpunit/Runner/StandardTestSuiteLoader.php(4 e;i Ȥ"phpunit/Runner/TestResultCache.php(4 eK"phpunit/Runner/TestSuiteLoader.php(4 eޤ"phpunit/Runner/TestSuiteSorter.php,(4 e,kڤphpunit/Runner/Version.php(4 e'phpunit/TextUI/CliArguments/Builder.phpT(4 eTɣۤ-phpunit/TextUI/CliArguments/Configuration.php(4 eX)phpunit/TextUI/CliArguments/Exception.php(4 e%zE&phpunit/TextUI/CliArguments/Mapper.php+,(4 e+,'aphpunit/TextUI/Command.php`o(4 e`o;e"'phpunit/TextUI/DefaultResultPrinter.phpY7(4 eY7}G(J&phpunit/TextUI/Exception/Exception.php(4 eD{i0phpunit/TextUI/Exception/ReflectionException.php(4 e Y-phpunit/TextUI/Exception/RuntimeException.php(4 eF;phpunit/TextUI/Exception/TestDirectoryNotFoundException.php(4 e6phpunit/TextUI/Exception/TestFileNotFoundException.php(4 epCphpunit/TextUI/Help.php.(4 e.  phpunit/TextUI/ResultPrinter.phpp(4 epܤphpunit/TextUI/TestRunner.php(4 eG"phpunit/TextUI/TestSuiteMapper.php (4 e +;-=phpunit/TextUI/XmlConfiguration/CodeCoverage/CodeCoverage.php(4 erAphpunit/TextUI/XmlConfiguration/CodeCoverage/Filter/Directory.php(4 ec{Kphpunit/TextUI/XmlConfiguration/CodeCoverage/Filter/DirectoryCollection.php(4 eju}Sphpunit/TextUI/XmlConfiguration/CodeCoverage/Filter/DirectoryCollectionIterator.php(4 eJ=phpunit/TextUI/XmlConfiguration/CodeCoverage/FilterMapper.php(4 e}ݚ>phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Clover.php(4 e=CAphpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Cobertura.php(4 ei>phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Crap4j.php(4 eG<phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Html.php(4 eE6;phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Php.php(4 epS<phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Text.php(4 eKkw;phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Xml.php(4 e?u1phpunit/TextUI/XmlConfiguration/Configuration.php5(4 e5˞-phpunit/TextUI/XmlConfiguration/Exception.php(4 eN5+8phpunit/TextUI/XmlConfiguration/Filesystem/Directory.php(4 e@Bphpunit/TextUI/XmlConfiguration/Filesystem/DirectoryCollection.php(4 e1EqJphpunit/TextUI/XmlConfiguration/Filesystem/DirectoryCollectionIterator.php(4 e&3phpunit/TextUI/XmlConfiguration/Filesystem/File.php(4 e.P =phpunit/TextUI/XmlConfiguration/Filesystem/FileCollection.php~(4 e~]rEphpunit/TextUI/XmlConfiguration/Filesystem/FileCollectionIterator.phpf(4 efĤ-phpunit/TextUI/XmlConfiguration/Generator.php(4 eF /phpunit/TextUI/XmlConfiguration/Group/Group.php(4 e9phpunit/TextUI/XmlConfiguration/Group/GroupCollection.php(4 eyAphpunit/TextUI/XmlConfiguration/Group/GroupCollectionIterator.phpq(4 eqY50phpunit/TextUI/XmlConfiguration/Group/Groups.php(4 e@I*phpunit/TextUI/XmlConfiguration/Loader.php(4 ecB1phpunit/TextUI/XmlConfiguration/Logging/Junit.php(4 eciG3phpunit/TextUI/XmlConfiguration/Logging/Logging.php (4 e ]٤4phpunit/TextUI/XmlConfiguration/Logging/TeamCity.php(4 e7Z鵤8phpunit/TextUI/XmlConfiguration/Logging/TestDox/Html.php(4 eV2ܤ8phpunit/TextUI/XmlConfiguration/Logging/TestDox/Text.php(4 eώ7phpunit/TextUI/XmlConfiguration/Logging/TestDox/Xml.php(4 et0phpunit/TextUI/XmlConfiguration/Logging/Text.php(4 eCn>phpunit/TextUI/XmlConfiguration/Migration/MigrationBuilder.php (4 e r:Gphpunit/TextUI/XmlConfiguration/Migration/MigrationBuilderException.php(4 eUWĝ@phpunit/TextUI/XmlConfiguration/Migration/MigrationException.php(4 e\ZHphpunit/TextUI/XmlConfiguration/Migration/Migrations/ConvertLogTypes.php(4 ehoeOphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageCloverToReport.phpX(4 eXijOphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageCrap4jToReport.php(4 e$i'Mphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageHtmlToReport.php(4 eՄjLphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoveragePhpToReport.phpF(4 eF^ӤMphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageTextToReport.php(4 eV_Lphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageXmlToReport.phpK(4 eK_ Qphpunit/TextUI/XmlConfiguration/Migration/Migrations/IntroduceCoverageElement.php(4 eUMphpunit/TextUI/XmlConfiguration/Migration/Migrations/LogToReportMigration.php(4 eUBphpunit/TextUI/XmlConfiguration/Migration/Migrations/Migration.php(4 e'dphpunit/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php(4 eU%5Yphpunit/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromRootToCoverage.phpC(4 eCcFXphpunit/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistExcludesToCoverage.php(4 eXphpunit/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistIncludesToCoverage.php(4 etSphpunit/TextUI/XmlConfiguration/Migration/Migrations/RemoveCacheTokensAttribute.php(4 ewJphpunit/TextUI/XmlConfiguration/Migration/Migrations/RemoveEmptyFilter.php{(4 e{KGphpunit/TextUI/XmlConfiguration/Migration/Migrations/RemoveLogTypes.phpo(4 eo3Qphpunit/TextUI/XmlConfiguration/Migration/Migrations/UpdateSchemaLocationTo93.php(4 ebJ6phpunit/TextUI/XmlConfiguration/Migration/Migrator.php(4 eo$V0phpunit/TextUI/XmlConfiguration/PHP/Constant.php7(4 e7$Ҥ:phpunit/TextUI/XmlConfiguration/PHP/ConstantCollection.phpl(4 el%(Bphpunit/TextUI/XmlConfiguration/PHP/ConstantCollectionIterator.php(4 e}=Ƥ2phpunit/TextUI/XmlConfiguration/PHP/IniSetting.phpJ(4 eJOt<phpunit/TextUI/XmlConfiguration/PHP/IniSettingCollection.php(4 eޛ;Dphpunit/TextUI/XmlConfiguration/PHP/IniSettingCollectionIterator.php(4 e/mo+phpunit/TextUI/XmlConfiguration/PHP/Php.php(4 e6僤2phpunit/TextUI/XmlConfiguration/PHP/PhpHandler.phpw(4 ew` -0phpunit/TextUI/XmlConfiguration/PHP/Variable.php(4 eN:phpunit/TextUI/XmlConfiguration/PHP/VariableCollection.phpl(4 elsB@٤Bphpunit/TextUI/XmlConfiguration/PHP/VariableCollectionIterator.php(4 e!~gȤ5phpunit/TextUI/XmlConfiguration/PHPUnit/Extension.php(4 e}Q?phpunit/TextUI/XmlConfiguration/PHPUnit/ExtensionCollection.php(4 eo;RGphpunit/TextUI/XmlConfiguration/PHPUnit/ExtensionCollectionIterator.php(4 e|D?3phpunit/TextUI/XmlConfiguration/PHPUnit/PHPUnit.phplC(4 elCv;phpunit/TextUI/XmlConfiguration/TestSuite/TestDirectory.phpC(4 eC0Ephpunit/TextUI/XmlConfiguration/TestSuite/TestDirectoryCollection.php(4 eLCMphpunit/TextUI/XmlConfiguration/TestSuite/TestDirectoryCollectionIterator.php(4 en6phpunit/TextUI/XmlConfiguration/TestSuite/TestFile.php(4 e?y@phpunit/TextUI/XmlConfiguration/TestSuite/TestFileCollection.php(4 eXHphpunit/TextUI/XmlConfiguration/TestSuite/TestFileCollectionIterator.phpz(4 ezX17phpunit/TextUI/XmlConfiguration/TestSuite/TestSuite.php(4 e8wAphpunit/TextUI/XmlConfiguration/TestSuite/TestSuiteCollection.php(4 e/jIphpunit/TextUI/XmlConfiguration/TestSuite/TestSuiteCollectionIterator.php(4 e+6$phpunit/Util/Annotation/DocBlock.php@(4 e@n"$phpunit/Util/Annotation/Registry.phpN -(4 eN -?caphpunit/Util/Blacklist.php(4 esphpunit/Util/Cloner.php(4 e"Ɩܤphpunit/Util/Color.php(4 ej?phpunit/Util/ErrorHandler.php(4 e=phpunit/Util/Exception.php(4 e다phpunit/Util/ExcludeList.php(4 efphpunit/Util/FileLoader.php (4 e 'phpunit/Util/Filesystem.php(4 eܐphpunit/Util/Filter.php (4 e l* phpunit/Util/GlobalState.php(4 el(phpunit/Util/InvalidDataSetException.php(4 e1 phpunit/Util/Json.phpE (4 eE !phpunit/Util/Log/JUnit.phpb*(4 eb*}3phpunit/Util/Log/TeamCity.phpy&(4 ey&4g'phpunit/Util/PHP/AbstractPhpProcess.php'(4 e'-Eʤ&phpunit/Util/PHP/DefaultPhpProcess.phpz(4 ezCp*phpunit/Util/PHP/Template/PhptTestCase.tpl(4 e+phpunit/Util/PHP/Template/TestCaseClass.tpl (4 e #,phpunit/Util/PHP/Template/TestCaseMethod.tpl*(4 e* &phpunit/Util/PHP/WindowsPhpProcess.php(4 e)aBphpunit/Util/Printer.php (4 e shphpunit/Util/Reflection.php(4 eW챤"phpunit/Util/RegularExpression.php(4 e0uR)phpunit/Util/Test.php](4 e]1fä*phpunit/Util/TestDox/CliTestDoxPrinter.php(*(4 e(*@f*phpunit/Util/TestDox/HtmlResultPrinter.php (4 e 3~ʤ'phpunit/Util/TestDox/NamePrettifier.php/"(4 e/"p~J&phpunit/Util/TestDox/ResultPrinter.php"(4 e"1q$'phpunit/Util/TestDox/TestDoxPrinter.php)(4 e)K̤*phpunit/Util/TestDox/TextResultPrinter.php(4 eȹ!.)phpunit/Util/TestDox/XmlResultPrinter.php(4 eQ%phpunit/Util/TextTestListRenderer.php6(4 e6.phpunit/Util/Type.php(4 e|ä*phpunit/Util/VersionComparisonOperator.php(4 eb,phpunit/Util/XdebugFilterScriptGenerator.phpw(4 ewتphpunit/Util/Xml.php(4 e̤phpunit/Util/Xml/Exception.php(4 eӤ0phpunit/Util/Xml/FailedSchemaDetectionResult.php(4 e#Sphpunit/Util/Xml/Loader.php (4 e ,?*phpunit/Util/Xml/SchemaDetectionResult.php(4 e4χz#phpunit/Util/Xml/SchemaDetector.php-(4 e-!phpunit/Util/Xml/SchemaFinder.php(4 eS%phpunit/Util/Xml/SnapshotNodeList.phpH(4 eH ^d4phpunit/Util/Xml/SuccessfulSchemaDetectionResult.php'(4 e'g%phpunit/Util/Xml/ValidationResult.php(4 exv:phpunit/Util/Xml/Validator.php(4 eV$phpunit/Util/XmlTestListRenderer.php -(4 e -8sbom.xml -/(4 e -/OOschema/8.5.xsdB(4 eB贅schema/9.2.xsdB(4 eB|lsebastian-cli-parser/LICENSE(4 eusebastian-cli-parser/Parser.php(4 ekM<sebastian-cli-parser/exceptions/AmbiguousOptionException.phpF(4 eFm\-sebastian-cli-parser/exceptions/Exception.phpu(4 euӫGsebastian-cli-parser/exceptions/OptionDoesNotAllowArgumentException.php_(4 e_|13Jsebastian-cli-parser/exceptions/RequiredOptionArgumentMissingException.phph(4 ehC:sebastian-cli-parser/exceptions/UnknownOptionException.php?(4 e?vD*sebastian-code-unit-reverse-lookup/LICENSE(4 e3G (-sebastian-code-unit-reverse-lookup/Wizard.php (4 e }Z['sebastian-code-unit/ClassMethodUnit.php(4 e@[!sebastian-code-unit/ClassUnit.php(4 eF sebastian-code-unit/CodeUnit.php~%(4 e~%D){*sebastian-code-unit/CodeUnitCollection.php(4 eJ2sebastian-code-unit/CodeUnitCollectionIterator.php;(4 e;Lʤ$sebastian-code-unit/FunctionUnit.php(4 e`+sebastian-code-unit/InterfaceMethodUnit.php(4 eǦ%sebastian-code-unit/InterfaceUnit.php(4 ecsebastian-code-unit/LICENSE (4 e psebastian-code-unit/Mapper.php-(4 e-#'sebastian-code-unit/TraitMethodUnit.php(4 eqz!sebastian-code-unit/TraitUnit.php(4 eXA,sebastian-code-unit/exceptions/Exception.phps(4 estg;sebastian-code-unit/exceptions/InvalidCodeUnitException.php(4 e6-3sebastian-code-unit/exceptions/NoTraitException.php(4 eQ36sebastian-code-unit/exceptions/ReflectionException.php(4 e$(sebastian-comparator/ArrayComparator.phpu(4 euEmhf#sebastian-comparator/Comparator.php(4 et*sebastian-comparator/ComparisonFailure.php (4 e %*sebastian-comparator/DOMNodeComparator.php (4 e 1i+sebastian-comparator/DateTimeComparator.php (4 e KQ)sebastian-comparator/DoubleComparator.php(4 e:n,sebastian-comparator/ExceptionComparator.php(4 e1 sebastian-comparator/Factory.php(4 e?Nsebastian-comparator/LICENSE (4 e =(-sebastian-comparator/MockObjectComparator.php(4 eI*sebastian-comparator/NumericComparator.php3 (4 e3 i{l)sebastian-comparator/ObjectComparator.phpX (4 eX ׌+sebastian-comparator/ResourceComparator.php(4 eJ)sebastian-comparator/ScalarComparator.php/ (4 e/ dF3sebastian-comparator/SplObjectStorageComparator.php(4 e?/'sebastian-comparator/TypeComparator.php(4 ecX\-sebastian-comparator/exceptions/Exception.phpv(4 evEᵤ4sebastian-comparator/exceptions/RuntimeException.php(4 eV'#sebastian-complexity/Calculator.phpe (4 ee (6.sebastian-complexity/Complexity/Complexity.phpQ(4 eQl8sebastian-complexity/Complexity/ComplexityCollection.php(4 eil@sebastian-complexity/Complexity/ComplexityCollectionIterator.php,(4 e,e,sebastian-complexity/Exception/Exception.phpv(4 ev73sebastian-complexity/Exception/RuntimeException.php(4 eCdWsebastian-complexity/LICENSE(4 e=ݤ=sebastian-complexity/Visitor/ComplexityCalculatingVisitor.php (4 e OGsebastian-complexity/Visitor/CyclomaticComplexityCalculatingVisitor.php (4 e 7Ysebastian-diff/Chunk.php_(4 e_vsebastian-diff/Diff.phpj(4 ejbXAsebastian-diff/Differ.php $(4 e $wkz3sebastian-diff/Exception/ConfigurationException.php=(4 e=1/Ff&sebastian-diff/Exception/Exception.phpj(4 ej05sebastian-diff/Exception/InvalidArgumentException.php(4 eqsebastian-diff/LICENSE (4 e a1sebastian-diff/Line.phpL(4 eL -q5sebastian-diff/LongestCommonSubsequenceCalculator.php(4 e}e7zDsebastian-diff/MemoryEfficientLongestCommonSubsequenceCalculator.php{ (4 e{ d^4sebastian-diff/Output/AbstractChunkOutputBuilder.php(4 e\t/sebastian-diff/Output/DiffOnlyOutputBuilder.phpz(4 ezc4sebastian-diff/Output/DiffOutputBuilderInterface.php(4 eV8sebastian-diff/Output/StrictUnifiedDiffOutputBuilder.php((4 e(kv2sebastian-diff/Output/UnifiedDiffOutputBuilder.php>(4 e>'q)sebastian-diff/Parser.php (4 e X{Bsebastian-diff/TimeEfficientLongestCommonSubsequenceCalculator.php0 (4 e0 B !sebastian-environment/Console.php(4 eP1Ťsebastian-environment/LICENSE(4 eFy٤)sebastian-environment/OperatingSystem.php(4 ē!sebastian-environment/Runtime.php(4 e4sebastian-exporter/Exporter.phpx$(4 ex$sebastian-exporter/LICENSE(4 e 5٤'sebastian-global-state/CodeExporter.php (4 e &sebastian-global-state/ExcludeList.php -(4 e -R{sebastian-global-state/LICENSE(4 eJ#sebastian-global-state/Restorer.php(4 e9}b#sebastian-global-state/Snapshot.php*(4 e*X%/sebastian-global-state/exceptions/Exception.phpy(4 eyJ6sebastian-global-state/exceptions/RuntimeException.php(4 e;#sebastian-lines-of-code/Counter.php(4 eH5/sebastian-lines-of-code/Exception/Exception.phpz(4 ez aV>sebastian-lines-of-code/Exception/IllogicalValuesException.php(4 eG<sebastian-lines-of-code/Exception/NegativeValueException.php(4 e -ڤ6sebastian-lines-of-code/Exception/RuntimeException.php(4 eKsebastian-lines-of-code/LICENSE(4 ebS~/sebastian-lines-of-code/LineCountingVisitor.php(4 e~A'sebastian-lines-of-code/LinesOfCode.php (4 e fӤ*sebastian-object-enumerator/Enumerator.php(4 ex})sebastian-object-enumerator/Exception.php(4 e}Ȥ8sebastian-object-enumerator/InvalidArgumentException.php(4 eâ(sebastian-object-reflector/Exception.php(4 eЬۤ7sebastian-object-reflector/InvalidArgumentException.php(4 e -M.sebastian-object-reflector/ObjectReflector.php(4 e_'sebastian-recursion-context/Context.phpB(4 eBlLnikic-php-parser/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php ctf ^ĤDnikic-php-parser/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.phpctfB=Hnikic-php-parser/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.phpctfLnikic-php-parser/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.phpl ctfl GBnikic-php-parser/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.phpctfۧBnikic-php-parser/PhpParser/Lexer/TokenEmulator/KeywordEmulator.phpctf Enikic-php-parser/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.phpctf(Hnikic-php-parser/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.phpctfXRnikic-php-parser/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.phpEctfEj^פPnikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.phpctf RHnikic-php-parser/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.phpPctfPpBnikic-php-parser/PhpParser/Lexer/TokenEmulator/ReverseEmulator.phpctf ++@nikic-php-parser/PhpParser/Lexer/TokenEmulator/TokenEmulator.phptctftݤ*nikic-php-parser/PhpParser/NameContext.php%ctf%@ss#nikic-php-parser/PhpParser/Node.phpxctfxbڤ'nikic-php-parser/PhpParser/Node/Arg.php;ctf;yT-nikic-php-parser/PhpParser/Node/Attribute.phpRctfRU;2nikic-php-parser/PhpParser/Node/AttributeGroup.phpctfU~aԤ/nikic-php-parser/PhpParser/Node/ComplexType.php[ctf[0Us*nikic-php-parser/PhpParser/Node/Const_.phpctfJ`ä(nikic-php-parser/PhpParser/Node/Expr.phpctf|)6nikic-php-parser/PhpParser/Node/Expr/ArrayDimFetch.phpTctfTt2nikic-php-parser/PhpParser/Node/Expr/ArrayItem.phpctf/^l/nikic-php-parser/PhpParser/Node/Expr/Array_.php>ctf>:M6nikic-php-parser/PhpParser/Node/Expr/ArrowFunction.php ctf 8I7/nikic-php-parser/PhpParser/Node/Expr/Assign.phpctf/}1nikic-php-parser/PhpParser/Node/Expr/AssignOp.phpctf,J<nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseAnd.phpctf?Q;nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseOr.phpctf)<nikic-php-parser/PhpParser/Node/Expr/AssignOp/BitwiseXor.phpctf&T:nikic-php-parser/PhpParser/Node/Expr/AssignOp/Coalesce.phpctf98nikic-php-parser/PhpParser/Node/Expr/AssignOp/Concat.phpctfG35nikic-php-parser/PhpParser/Node/Expr/AssignOp/Div.phpctf/7nikic-php-parser/PhpParser/Node/Expr/AssignOp/Minus.phpctfc5nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mod.phpctfj5nikic-php-parser/PhpParser/Node/Expr/AssignOp/Mul.phpctfY:;6nikic-php-parser/PhpParser/Node/Expr/AssignOp/Plus.phpctfK]5nikic-php-parser/PhpParser/Node/Expr/AssignOp/Pow.phpctfߊA;nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftLeft.phpctf(?<nikic-php-parser/PhpParser/Node/Expr/AssignOp/ShiftRight.phpctf2nikic-php-parser/PhpParser/Node/Expr/AssignRef.phpNctfN21nikic-php-parser/PhpParser/Node/Expr/BinaryOp.phpuctfuTKѤ<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.phpVctfVNVD;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseOr.phpTctfT<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BitwiseXor.phpVctfV3$<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanAnd.phpWctfW;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/BooleanOr.phpUctfUG:nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Coalesce.phpSctfS/8nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Concat.phpNctfN5nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Div.phpHctfHA+7nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Equal.phpMctfM$39nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Greater.phpPctfPX@nikic-php-parser/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php_ctf_ ;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Identical.phpVctfV<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalAnd.phpXctfXF=;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalOr.phpUctfU-3<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/LogicalXor.phpXctfX7nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Minus.phpLctfL"75nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mod.phpHctfH + +5nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Mul.phpHctfH t:nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotEqual.phpSctfSͤ>nikic-php-parser/PhpParser/Node/Expr/BinaryOp/NotIdentical.php\ctf\c_6nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Plus.phpJctfJcm¤5nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Pow.phpIctfI,;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftLeft.phpUctfUCXe<nikic-php-parser/PhpParser/Node/Expr/BinaryOp/ShiftRight.phpWctfW;9nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Smaller.phpPctfPT@nikic-php-parser/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php_ctf_J;nikic-php-parser/PhpParser/Node/Expr/BinaryOp/Spaceship.phpVctfVEx3nikic-php-parser/PhpParser/Node/Expr/BitwiseNot.phpctfEg3nikic-php-parser/PhpParser/Node/Expr/BooleanNot.phpctfѩ古1nikic-php-parser/PhpParser/Node/Expr/CallLike.php2ctf2:"-nikic-php-parser/PhpParser/Node/Expr/Cast.phpHctfH4nikic-php-parser/PhpParser/Node/Expr/Cast/Array_.phpctfȯ3nikic-php-parser/PhpParser/Node/Expr/Cast/Bool_.phpctf>4nikic-php-parser/PhpParser/Node/Expr/Cast/Double.phpctf2!&2nikic-php-parser/PhpParser/Node/Expr/Cast/Int_.phpctf,͜5nikic-php-parser/PhpParser/Node/Expr/Cast/Object_.phpctf\5nikic-php-parser/PhpParser/Node/Expr/Cast/String_.phpctf*u4nikic-php-parser/PhpParser/Node/Expr/Cast/Unset_.phpctfɔԤ8nikic-php-parser/PhpParser/Node/Expr/ClassConstFetch.phpctfC|Z/nikic-php-parser/PhpParser/Node/Expr/Clone_.phpctf4r0nikic-php-parser/PhpParser/Node/Expr/Closure.php +ctf +\3nikic-php-parser/PhpParser/Node/Expr/ClosureUse.phpctfd-3nikic-php-parser/PhpParser/Node/Expr/ConstFetch.phpctf`|Ϥ/nikic-php-parser/PhpParser/Node/Expr/Empty_.phpctfk.nikic-php-parser/PhpParser/Node/Expr/Error.phpctfؖ6nikic-php-parser/PhpParser/Node/Expr/ErrorSuppress.phpctfiO.nikic-php-parser/PhpParser/Node/Expr/Eval_.phpctflrc.nikic-php-parser/PhpParser/Node/Expr/Exit_.php ctf ֏61nikic-php-parser/PhpParser/Node/Expr/FuncCall.php<ctf<.ݤ1nikic-php-parser/PhpParser/Node/Expr/Include_.phpctfp8X4nikic-php-parser/PhpParser/Node/Expr/Instanceof_.phpkctfkY8#/nikic-php-parser/PhpParser/Node/Expr/Isset_.phpctf.nikic-php-parser/PhpParser/Node/Expr/List_.phpctfwd/nikic-php-parser/PhpParser/Node/Expr/Match_.phpctf0B3nikic-php-parser/PhpParser/Node/Expr/MethodCall.php`ctf`v/]-nikic-php-parser/PhpParser/Node/Expr/New_.phpctfWA~;nikic-php-parser/PhpParser/Node/Expr/NullsafeMethodCall.phpwctfw*ۤ>nikic-php-parser/PhpParser/Node/Expr/NullsafePropertyFetch.phpctf(qT0nikic-php-parser/PhpParser/Node/Expr/PostDec.phpctfgc0nikic-php-parser/PhpParser/Node/Expr/PostInc.phpctf^-^D/nikic-php-parser/PhpParser/Node/Expr/PreDec.phpctf=%Ϥ/nikic-php-parser/PhpParser/Node/Expr/PreInc.phpctfM"/nikic-php-parser/PhpParser/Node/Expr/Print_.phpctf٤6nikic-php-parser/PhpParser/Node/Expr/PropertyFetch.phpctf ܺ/2nikic-php-parser/PhpParser/Node/Expr/ShellExec.phpctfsN3nikic-php-parser/PhpParser/Node/Expr/StaticCall.phpzctfzPʤ<nikic-php-parser/PhpParser/Node/Expr/StaticPropertyFetch.php4ctf4bF|0nikic-php-parser/PhpParser/Node/Expr/Ternary.phpctfA/nikic-php-parser/PhpParser/Node/Expr/Throw_.phpctf-s3nikic-php-parser/PhpParser/Node/Expr/UnaryMinus.phpctfxPX2nikic-php-parser/PhpParser/Node/Expr/UnaryPlus.phpctf1nikic-php-parser/PhpParser/Node/Expr/Variable.phpctfO_2nikic-php-parser/PhpParser/Node/Expr/YieldFrom.phpctflנh/nikic-php-parser/PhpParser/Node/Expr/Yield_.phpdctfd40nikic-php-parser/PhpParser/Node/FunctionLike.phpctf3.nikic-php-parser/PhpParser/Node/Identifier.phpctf-$巤4nikic-php-parser/PhpParser/Node/IntersectionType.phpctf!ޤ,nikic-php-parser/PhpParser/Node/MatchArm.phpctf((nikic-php-parser/PhpParser/Node/Name.phpctf{7nikic-php-parser/PhpParser/Node/Name/FullyQualified.phpctf21nikic-php-parser/PhpParser/Node/Name/Relative.phpctf8V0nikic-php-parser/PhpParser/Node/NullableType.phpctf]@z)nikic-php-parser/PhpParser/Node/Param.phpictfiL*nikic-php-parser/PhpParser/Node/Scalar.phpoctfo=2nikic-php-parser/PhpParser/Node/Scalar/DNumber.phpctfWr3nikic-php-parser/PhpParser/Node/Scalar/Encapsed.phpctf&`=nikic-php-parser/PhpParser/Node/Scalar/EncapsedStringPart.phpctf)IY2nikic-php-parser/PhpParser/Node/Scalar/LNumber.php ctf *5nikic-php-parser/PhpParser/Node/Scalar/MagicConst.phpictfiQdj<nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Class_.phpZctfZ59nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Dir.phpSctfSrfɤ:nikic-php-parser/PhpParser/Node/Scalar/MagicConst/File.phpVctfV6Q?nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Function_.phpcctfc5:nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Line.phpVctfVDE<nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Method.php\ctf\2 N@nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Namespace_.phpfctffq<nikic-php-parser/PhpParser/Node/Scalar/MagicConst/Trait_.phpZctfZݤ2nikic-php-parser/PhpParser/Node/Scalar/String_.phpbctfb}NҺ(nikic-php-parser/PhpParser/Node/Stmt.phpctfy/nikic-php-parser/PhpParser/Node/Stmt/Break_.phpctf׊s.nikic-php-parser/PhpParser/Node/Stmt/Case_.phprctfr':$/nikic-php-parser/PhpParser/Node/Stmt/Catch_.phpctf<3nikic-php-parser/PhpParser/Node/Stmt/ClassConst.php~ ctf~ dKn2nikic-php-parser/PhpParser/Node/Stmt/ClassLike.php ctf /͞4nikic-php-parser/PhpParser/Node/Stmt/ClassMethod.phpctf6/nikic-php-parser/PhpParser/Node/Stmt/Class_.php{ctf{Ϥ/nikic-php-parser/PhpParser/Node/Stmt/Const_.phpctfjob2nikic-php-parser/PhpParser/Node/Stmt/Continue_.phpctf;7nikic-php-parser/PhpParser/Node/Stmt/DeclareDeclare.phpctflm1nikic-php-parser/PhpParser/Node/Stmt/Declare_.phpctf. ,nikic-php-parser/PhpParser/Node/Stmt/Do_.phpHctfHs.nikic-php-parser/PhpParser/Node/Stmt/Echo_.phpctf0nikic-php-parser/PhpParser/Node/Stmt/ElseIf_.phpOctfOcz.nikic-php-parser/PhpParser/Node/Stmt/Else_.phpctf 1nikic-php-parser/PhpParser/Node/Stmt/EnumCase.phpctf.nikic-php-parser/PhpParser/Node/Stmt/Enum_.phpCctfCo'3nikic-php-parser/PhpParser/Node/Stmt/Expression.phpctf+1nikic-php-parser/PhpParser/Node/Stmt/Finally_.phpctfDۤ-nikic-php-parser/PhpParser/Node/Stmt/For_.phpDctfDd *1nikic-php-parser/PhpParser/Node/Stmt/Foreach_.phpuctfu2u2nikic-php-parser/PhpParser/Node/Stmt/Function_.php2 +ctf2 +U0nikic-php-parser/PhpParser/Node/Stmt/Global_.phpctfn.nikic-php-parser/PhpParser/Node/Stmt/Goto_.phpctf\r1nikic-php-parser/PhpParser/Node/Stmt/GroupUse.phpctfeqq5nikic-php-parser/PhpParser/Node/Stmt/HaltCompiler.php ctf m,nikic-php-parser/PhpParser/Node/Stmt/If_.php@ctf@&sY3nikic-php-parser/PhpParser/Node/Stmt/InlineHTML.phpctf#ޤ3nikic-php-parser/PhpParser/Node/Stmt/Interface_.phpctf_).nikic-php-parser/PhpParser/Node/Stmt/Label.phpctfjc3nikic-php-parser/PhpParser/Node/Stmt/Namespace_.phpctfj,nikic-php-parser/PhpParser/Node/Stmt/Nop.phpFctfF$6ؤ1nikic-php-parser/PhpParser/Node/Stmt/Property.php\ +ctf\ +^9nikic-php-parser/PhpParser/Node/Stmt/PropertyProperty.phpctf000nikic-php-parser/PhpParser/Node/Stmt/Return_.phpctf #2nikic-php-parser/PhpParser/Node/Stmt/StaticVar.phpctf+0nikic-php-parser/PhpParser/Node/Stmt/Static_.phpctfyT?0nikic-php-parser/PhpParser/Node/Stmt/Switch_.php;ctf;!]/nikic-php-parser/PhpParser/Node/Stmt/Throw_.phpctfrޤ1nikic-php-parser/PhpParser/Node/Stmt/TraitUse.phpctf.;nikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation.php"ctf")DAnikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.phpGctfGa/.Fnikic-php-parser/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php`ctf`U/nikic-php-parser/PhpParser/Node/Stmt/Trait_.php ctf ܤ1nikic-php-parser/PhpParser/Node/Stmt/TryCatch.php+ctf+6/nikic-php-parser/PhpParser/Node/Stmt/Unset_.phpctf/Ҥ/nikic-php-parser/PhpParser/Node/Stmt/UseUse.phpmctfmN 5-nikic-php-parser/PhpParser/Node/Stmt/Use_.phprctfr]I]/nikic-php-parser/PhpParser/Node/Stmt/While_.phpKctfKwf9I-nikic-php-parser/PhpParser/Node/UnionType.phpctf9W5nikic-php-parser/PhpParser/Node/VarLikeIdentifier.phpctfy.7nikic-php-parser/PhpParser/Node/VariadicPlaceholder.phpctf6Y+nikic-php-parser/PhpParser/NodeAbstract.phpNctfNZ|)nikic-php-parser/PhpParser/NodeDumper.phpnctfns٤)nikic-php-parser/PhpParser/NodeFinder.php ctf aۅ,nikic-php-parser/PhpParser/NodeTraverser.phpT'ctfT'L;5nikic-php-parser/PhpParser/NodeTraverserInterface.phpctf[i*nikic-php-parser/PhpParser/NodeVisitor.phpctf.Jq9nikic-php-parser/PhpParser/NodeVisitor/CloningVisitor.phpctf"ۤ9nikic-php-parser/PhpParser/NodeVisitor/FindingVisitor.phpctf@>nikic-php-parser/PhpParser/NodeVisitor/FirstFindingVisitor.php ctf bt 7nikic-php-parser/PhpParser/NodeVisitor/NameResolver.php%ctf%h๤@nikic-php-parser/PhpParser/NodeVisitor/NodeConnectingVisitor.phpctf߬Bnikic-php-parser/PhpParser/NodeVisitor/ParentConnectingVisitor.phpctfv`2nikic-php-parser/PhpParser/NodeVisitorAbstract.phpctf8%nikic-php-parser/PhpParser/Parser.phpctfv+.nikic-php-parser/PhpParser/Parser/Multiple.phpctf"7*nikic-php-parser/PhpParser/Parser/Php5.php+ctf+iH*nikic-php-parser/PhpParser/Parser/Php7.phpTctfTJx,nikic-php-parser/PhpParser/Parser/Tokens.php*ctf*ˣդ-nikic-php-parser/PhpParser/ParserAbstract.phphctfhxμ,nikic-php-parser/PhpParser/ParserFactory.php +ctf + W5nikic-php-parser/PhpParser/PrettyPrinter/Standard.php:ctf:es4nikic-php-parser/PhpParser/PrettyPrinterAbstract.php"ctf"object-enumerator/LICENSEctfy{object-reflector/LICENSEctf9vphar-io-manifest/LICENSE`ctf`p+phar-io-manifest/ManifestDocumentMapper.phpctf^D#phar-io-manifest/ManifestLoader.phpctfXj'phar-io-manifest/ManifestSerializer.phpctf?j':phar-io-manifest/exceptions/ElementCollectionException.phpctfIn)phar-io-manifest/exceptions/Exception.phpctfֽН?phar-io-manifest/exceptions/InvalidApplicationNameException.php<ctf<W5phar-io-manifest/exceptions/InvalidEmailException.phpctf)Ϫ}3phar-io-manifest/exceptions/InvalidUrlException.php ctf x᳤9phar-io-manifest/exceptions/ManifestDocumentException.phpctf/"@phar-io-manifest/exceptions/ManifestDocumentLoadingException.php~ctf~H}?phar-io-manifest/exceptions/ManifestDocumentMapperException.phpctfJR18phar-io-manifest/exceptions/ManifestElementException.phpctf̏7phar-io-manifest/exceptions/ManifestLoaderException.phpctfl +7phar-io-manifest/exceptions/NoEmailAddressException.phpctf'phar-io-manifest/values/Application.php ctf ;k+phar-io-manifest/values/ApplicationName.phpctf"phar-io-manifest/values/Author.phpctfx,phar-io-manifest/values/AuthorCollection.php-ctf-4phar-io-manifest/values/AuthorCollectionIterator.phpctfЪe,phar-io-manifest/values/BundledComponent.phpdctfd76phar-io-manifest/values/BundledComponentCollection.phpctfߤ>phar-io-manifest/values/BundledComponentCollectionIterator.phpctf _0phar-io-manifest/values/CopyrightInformation.phppctfpP!phar-io-manifest/values/Email.phpctfS%phar-io-manifest/values/Extension.phpctfF {#phar-io-manifest/values/Library.phpctfv#phar-io-manifest/values/License.phpctf4$phar-io-manifest/values/Manifest.php& +ctf& +3phar-io-manifest/values/PhpExtensionRequirement.phpctfPη1phar-io-manifest/values/PhpVersionRequirement.phpActfAi'phar-io-manifest/values/Requirement.phpctf U1phar-io-manifest/values/RequirementCollection.phpsctfs6M9phar-io-manifest/values/RequirementCollectionIterator.phpctfU phar-io-manifest/values/Type.phpctfܲ3phar-io-manifest/values/Url.phpctfO&phar-io-manifest/xml/AuthorElement.phpctfڤ0phar-io-manifest/xml/AuthorElementCollection.phpMctfMj'phar-io-manifest/xml/BundlesElement.phptctft]Y)phar-io-manifest/xml/ComponentElement.phpctfna3phar-io-manifest/xml/ComponentElementCollection.phpVctfV?(phar-io-manifest/xml/ContainsElement.phpctfl8)phar-io-manifest/xml/CopyrightElement.phpctfhDp*phar-io-manifest/xml/ElementCollection.phpctf<^ޤ#phar-io-manifest/xml/ExtElement.php*ctf*^פ-phar-io-manifest/xml/ExtElementCollection.phpDctfDβS)phar-io-manifest/xml/ExtensionElement.phpctf J'phar-io-manifest/xml/LicenseElement.phpctfv/!)phar-io-manifest/xml/ManifestDocument.php ctf i_(phar-io-manifest/xml/ManifestElement.phpctf#=#phar-io-manifest/xml/PhpElement.phpctfY(phar-io-manifest/xml/RequiresElement.phpEctfEdwʤ!phar-io-version/BuildMetaData.phpctf3A(*phar-io-version/LICENSE&ctf&Ҫ $phar-io-version/PreReleaseSuffix.phpctf8^phar-io-version/Version.phpctf+phar-io-version/VersionConstraintParser.phpN ctfN n%ˤ*phar-io-version/VersionConstraintValue.phpE +ctfE +qDF!phar-io-version/VersionNumber.phpctfKp_9phar-io-version/constraints/AbstractVersionConstraint.phpctf42o9phar-io-version/constraints/AndVersionConstraintGroup.phpctfkO4phar-io-version/constraints/AnyVersionConstraint.phpTctfTv6phar-io-version/constraints/ExactVersionConstraint.phpctfgqEphar-io-version/constraints/GreaterThanOrEqualToVersionConstraint.phpctf_8phar-io-version/constraints/OrVersionConstraintGroup.phpctf6Fphar-io-version/constraints/SpecificMajorAndMinorVersionConstraint.phpctfB,>phar-io-version/constraints/SpecificMajorVersionConstraint.php ctf 1phar-io-version/constraints/VersionConstraint.phpctfd(phar-io-version/exceptions/Exception.phpctf<?phar-io-version/exceptions/InvalidPreReleaseSuffixException.phpctf[6phar-io-version/exceptions/InvalidVersionException.phpctfy7phar-io-version/exceptions/NoBuildMetaDataException.phpctf+${:phar-io-version/exceptions/NoPreReleaseSuffixException.phpctf"Dphar-io-version/exceptions/UnsupportedVersionConstraintException.phpctf樤"php-code-coverage/CodeCoverage.phpEEctfEEcX#php-code-coverage/Driver/Driver.phpctfN'php-code-coverage/Driver/PcovDriver.phpSctfS؁D)php-code-coverage/Driver/PhpdbgDriver.phpb +ctfb +H.Y%php-code-coverage/Driver/Selector.php ctf iH*php-code-coverage/Driver/Xdebug2Driver.phpH ctfH ^팤*php-code-coverage/Driver/Xdebug3Driver.php ctf k{Jphp-code-coverage/Exception/BranchAndPathCoverageNotSupportedException.phpctfzFphp-code-coverage/Exception/DeadCodeDetectionNotSupportedException.phpctfoICphp-code-coverage/Exception/DirectoryCouldNotBeCreatedException.phpctf<6')php-code-coverage/Exception/Exception.phpctf+Q8php-code-coverage/Exception/InvalidArgumentException.phpctfl~ФFphp-code-coverage/Exception/NoCodeCoverageDriverAvailableException.php3ctf35oYC]php-code-coverage/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.phpectfeX3/php-code-coverage/Exception/ParserException.phpctfpڤDphp-code-coverage/Exception/PathExistsButIsNotDirectoryException.phpctfikd9php-code-coverage/Exception/PcovNotAvailableException.phpictfiq;php-code-coverage/Exception/PhpdbgNotAvailableException.phphctfh |=3php-code-coverage/Exception/ReflectionException.phpctf`?php-code-coverage/Exception/ReportAlreadyFinalizedException.php>ctf>mU=Iphp-code-coverage/Exception/StaticAnalysisCacheNotConfiguredException.phpctfp6php-code-coverage/Exception/TestIdMissingException.phpctf3OCphp-code-coverage/Exception/UnintentionallyCoveredCodeException.php-ctf-Ť=php-code-coverage/Exception/WriteOperationFailedException.phpctfu䶤;php-code-coverage/Exception/WrongXdebugVersionException.phpctft!:php-code-coverage/Exception/Xdebug2NotEnabledException.phpnctfn`h:php-code-coverage/Exception/Xdebug3NotEnabledException.phpctfY+C;php-code-coverage/Exception/XdebugNotAvailableException.phpmctfm{F,php-code-coverage/Exception/XmlException.phpctf0)Rphp-code-coverage/Filter.php ctf 0php-code-coverage/LICENSEctf-~y֤'php-code-coverage/Node/AbstractNode.phpctf{"php-code-coverage/Node/Builder.phpctf$php-code-coverage/Node/CrapIndex.phpctf!$php-code-coverage/Node/Directory.php%ctf%ةphp-code-coverage/Node/File.php{Kctf{KWҤ#php-code-coverage/Node/Iterator.php~ctf~r9/php-code-coverage/ProcessedCodeCoverageData.php $ctf $`R)php-code-coverage/RawCodeCoverageData.php!ctf!Av#php-code-coverage/Report/Clover.phpj(ctfj(?g&php-code-coverage/Report/Cobertura.php1ctf1c)#php-code-coverage/Report/Crap4j.phpMctfMƽ(php-code-coverage/Report/Html/Facade.php3ctf38x*php-code-coverage/Report/Html/Renderer.phph!ctfh!4php-code-coverage/Report/Html/Renderer/Dashboard.phpM ctfM 4php-code-coverage/Report/Html/Renderer/Directory.php.ctf.'/php-code-coverage/Report/Html/Renderer/File.php ctf TBphp-code-coverage/Report/Html/Renderer/Template/branches.html.distctfh2+Fphp-code-coverage/Report/Html/Renderer/Template/coverage_bar.html.dist'ctf'O}Mphp-code-coverage/Report/Html/Renderer/Template/coverage_bar_branch.html.dist'ctf'O}Ephp-code-coverage/Report/Html/Renderer/Template/css/bootstrap.min.cssyctfyĤ>php-code-coverage/Report/Html/Renderer/Template/css/custom.cssctfAphp-code-coverage/Report/Html/Renderer/Template/css/nv.d3.min.cssX%ctfX%0,@php-code-coverage/Report/Html/Renderer/Template/css/octicons.cssXctfX'#=php-code-coverage/Report/Html/Renderer/Template/css/style.css +ctf +Cphp-code-coverage/Report/Html/Renderer/Template/dashboard.html.distctfDJphp-code-coverage/Report/Html/Renderer/Template/dashboard_branch.html.distctfDCphp-code-coverage/Report/Html/Renderer/Template/directory.html.distctfՆJphp-code-coverage/Report/Html/Renderer/Template/directory_branch.html.distctfn2]Hphp-code-coverage/Report/Html/Renderer/Template/directory_item.html.distActfAdsOphp-code-coverage/Report/Html/Renderer/Template/directory_item_branch.html.dist;ctf;mۤ>php-code-coverage/Report/Html/Renderer/Template/file.html.distP ctfP j*Ephp-code-coverage/Report/Html/Renderer/Template/file_branch.html.dist ctf ㉞Cphp-code-coverage/Report/Html/Renderer/Template/file_item.html.distrctfr/yJphp-code-coverage/Report/Html/Renderer/Template/file_item_branch.html.distlctfl-Cphp-code-coverage/Report/Html/Renderer/Template/icons/file-code.svg0ctf0QUUHphp-code-coverage/Report/Html/Renderer/Template/icons/file-directory.svgctfZCphp-code-coverage/Report/Html/Renderer/Template/js/bootstrap.min.jscctfc"#<php-code-coverage/Report/Html/Renderer/Template/js/d3.min.jsPctfPhb:php-code-coverage/Report/Html/Renderer/Template/js/file.jsctfb䆤@php-code-coverage/Report/Html/Renderer/Template/js/jquery.min.js@^ctf@^ ?php-code-coverage/Report/Html/Renderer/Template/js/nv.d3.min.jsRctfRphp-code-coverage/Report/Html/Renderer/Template/line.html.distctf{?php-code-coverage/Report/Html/Renderer/Template/lines.html.distectfedf Ephp-code-coverage/Report/Html/Renderer/Template/method_item.html.distctfjפLphp-code-coverage/Report/Html/Renderer/Template/method_item_branch.html.distctfyĎk?php-code-coverage/Report/Html/Renderer/Template/paths.html.distctf*'ݤ php-code-coverage/Report/PHP.php&ctf&< +P!php-code-coverage/Report/Text.php'ctf',1php-code-coverage/Report/Xml/BuildInformation.php ctf )php-code-coverage/Report/Xml/Coverage.php1ctf1W*php-code-coverage/Report/Xml/Directory.phpctf Fn'php-code-coverage/Report/Xml/Facade.php("ctf("YU~%php-code-coverage/Report/Xml/File.php+ctf+jdΤ'php-code-coverage/Report/Xml/Method.phpVctfV+%php-code-coverage/Report/Xml/Node.php1ctf1yk (php-code-coverage/Report/Xml/Project.phpdctfd'php-code-coverage/Report/Xml/Report.php ctf d'php-code-coverage/Report/Xml/Source.phpctf5&php-code-coverage/Report/Xml/Tests.phpctf>'php-code-coverage/Report/Xml/Totals.phpctfT3x%php-code-coverage/Report/Xml/Unit.phpctf]-r0php-code-coverage/StaticAnalysis/CacheWarmer.phpgctfg][78php-code-coverage/StaticAnalysis/CachingFileAnalyser.phpctfƤ;php-code-coverage/StaticAnalysis/CodeUnitFindingVisitor.phpd(ctfd(TBphp-code-coverage/StaticAnalysis/ExecutableLinesFindingVisitor.php)ctf)Oli1php-code-coverage/StaticAnalysis/FileAnalyser.phpctf?php-code-coverage/StaticAnalysis/IgnoredLinesFindingVisitor.php> ctf> 5s8php-code-coverage/StaticAnalysis/ParsingFileAnalyser.phpctf#x%php-code-coverage/Util/Filesystem.phpctf(У|%php-code-coverage/Util/Percentage.phpctfphp-code-coverage/Version.phpctfҿt&php-file-iterator/Facade.php' +ctf' +>3php-file-iterator/Factory.phpctfY php-file-iterator/Iterator.phpX ctfX 춧ܤphp-file-iterator/LICENSEctfo:php-invoker/Invoker.php ctf {I$php-invoker/exceptions/Exception.phpvctfv'P=Dphp-invoker/exceptions/ProcessControlExtensionNotLoadedException.phpctfӤ+php-invoker/exceptions/TimeoutException.phpctftJphp-text-template/LICENSEctfuphp-text-template/Template.php( ctf( d&C*php-text-template/exceptions/Exception.php}ctf}`"9php-text-template/exceptions/InvalidArgumentException.phpctf¤1php-text-template/exceptions/RuntimeException.phpctf]Mpphp-timer/Duration.php +ctf +pjphp-timer/LICENSEctfx$php-timer/ResourceUsageFormatter.phpctf拤php-timer/Timer.phpctf"Ѧ{"php-timer/exceptions/Exception.phprctfr</php-timer/exceptions/NoActiveTimerException.phpctf*Ephp-timer/exceptions/TimeSinceStartOfRequestNotAvailableException.phpctf.+phpdocumentor-reflection-common/Element.php ctf aoy(phpdocumentor-reflection-common/File.phpctfI)phpdocumentor-reflection-common/Fqsen.phpctf<ڨ'phpdocumentor-reflection-common/LICENSE9ctf9*2Ȑ,phpdocumentor-reflection-common/Location.phpctf+phpdocumentor-reflection-common/Project.phpctf2phpdocumentor-reflection-common/ProjectFactory.phpbctfby+R.phpdocumentor-reflection-docblock/DocBlock.phpctfTP:phpdocumentor-reflection-docblock/DocBlock/Description.php ctf Q_Aphpdocumentor-reflection-docblock/DocBlock/DescriptionFactory.phpctf\|H<phpdocumentor-reflection-docblock/DocBlock/ExampleFinder.php-ctf-s9phpdocumentor-reflection-docblock/DocBlock/Serializer.phpctf!Aphpdocumentor-reflection-docblock/DocBlock/StandardTagFactory.php51ctf51Y62phpdocumentor-reflection-docblock/DocBlock/Tag.phpctfm4?9phpdocumentor-reflection-docblock/DocBlock/TagFactory.phpctfSB:phpdocumentor-reflection-docblock/DocBlock/Tags/Author.php ctf 7/l;phpdocumentor-reflection-docblock/DocBlock/Tags/BaseTag.phpctfD=:phpdocumentor-reflection-docblock/DocBlock/Tags/Covers.php +ctf + +/>phpdocumentor-reflection-docblock/DocBlock/Tags/Deprecated.php +ctf +W=;phpdocumentor-reflection-docblock/DocBlock/Tags/Example.phpctf6Hphpdocumentor-reflection-docblock/DocBlock/Tags/Factory/StaticMethod.php"ctf"V`i=phpdocumentor-reflection-docblock/DocBlock/Tags/Formatter.php%ctf%F.Lphpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/AlignFormatter.php|ctf|YRphpdocumentor-reflection-docblock/DocBlock/Tags/Formatter/PassthroughFormatter.phpctf?;phpdocumentor-reflection-docblock/DocBlock/Tags/Generic.php ctf ~>phpdocumentor-reflection-docblock/DocBlock/Tags/InvalidTag.php,ctf,nyh8phpdocumentor-reflection-docblock/DocBlock/Tags/Link.phpctf%פ:phpdocumentor-reflection-docblock/DocBlock/Tags/Method.phpctf M9phpdocumentor-reflection-docblock/DocBlock/Tags/Param.php!ctf!⥤<phpdocumentor-reflection-docblock/DocBlock/Tags/Property.php ctf c@phpdocumentor-reflection-docblock/DocBlock/Tags/PropertyRead.php ctf j +Aphpdocumentor-reflection-docblock/DocBlock/Tags/PropertyWrite.php ctf 8F]Cphpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Fqsen.php3ctf3FbGphpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Reference.phpctfAphpdocumentor-reflection-docblock/DocBlock/Tags/Reference/Url.phpctfX;phpdocumentor-reflection-docblock/DocBlock/Tags/Return_.php+ctf+sJ7phpdocumentor-reflection-docblock/DocBlock/Tags/See.php1 ctf1 Qcl9phpdocumentor-reflection-docblock/DocBlock/Tags/Since.phpb +ctfb +{:phpdocumentor-reflection-docblock/DocBlock/Tags/Source.php ctf |$?phpdocumentor-reflection-docblock/DocBlock/Tags/TagWithType.phpctfK Ƥ:phpdocumentor-reflection-docblock/DocBlock/Tags/Throws.php.ctf.ů8phpdocumentor-reflection-docblock/DocBlock/Tags/Uses.php] +ctf] +x8phpdocumentor-reflection-docblock/DocBlock/Tags/Var_.php ctf P/;phpdocumentor-reflection-docblock/DocBlock/Tags/Version.php +ctf + z5phpdocumentor-reflection-docblock/DocBlockFactory.php$ctf$wJ>phpdocumentor-reflection-docblock/DocBlockFactoryInterface.phpctfF=phpdocumentor-reflection-docblock/Exception/PcreException.phpctfx)phpdocumentor-reflection-docblock/LICENSE8ctf8ʤ+phpdocumentor-reflection-docblock/Utils.php ctf Yy$-phpdocumentor-type-resolver/FqsenResolver.php ctf ǻ}#phpdocumentor-type-resolver/LICENSE8ctf8ʤ*phpdocumentor-type-resolver/PseudoType.phpxctfxoϚV6phpdocumentor-type-resolver/PseudoTypes/ArrayShape.phpctfI}:phpdocumentor-type-resolver/PseudoTypes/ArrayShapeItem.phpctfR:phpdocumentor-type-resolver/PseudoTypes/CallableString.phpnctfn̤;phpdocumentor-type-resolver/PseudoTypes/ConstExpression.phpctfQL2phpdocumentor-type-resolver/PseudoTypes/False_.phpctfMޤ6phpdocumentor-type-resolver/PseudoTypes/FloatValue.phpctf{=phpdocumentor-type-resolver/PseudoTypes/HtmlEscapedString.phpuctfuq8phpdocumentor-type-resolver/PseudoTypes/IntegerRange.php1ctf1aNۤ8phpdocumentor-type-resolver/PseudoTypes/IntegerValue.phpctf&Jg1phpdocumentor-type-resolver/PseudoTypes/List_.phpctfkmP9phpdocumentor-type-resolver/PseudoTypes/LiteralString.phplctflet;phpdocumentor-type-resolver/PseudoTypes/LowercaseString.phppctfp-oפ;phpdocumentor-type-resolver/PseudoTypes/NegativeInteger.phpictfixZǤ8phpdocumentor-type-resolver/PseudoTypes/NonEmptyList.phpctfmFACphpdocumentor-type-resolver/PseudoTypes/NonEmptyLowercaseString.phpctf 3:phpdocumentor-type-resolver/PseudoTypes/NonEmptyString.phpoctfo_9phpdocumentor-type-resolver/PseudoTypes/NumericString.phplctflx!4phpdocumentor-type-resolver/PseudoTypes/Numeric_.phpctf;phpdocumentor-type-resolver/PseudoTypes/PositiveInteger.phpictfi/=<7phpdocumentor-type-resolver/PseudoTypes/StringValue.phpctf5>q7phpdocumentor-type-resolver/PseudoTypes/TraitString.phphctfhX:1phpdocumentor-type-resolver/PseudoTypes/True_.phpctfT1$phpdocumentor-type-resolver/Type.phpctf ,phpdocumentor-type-resolver/TypeResolver.phpUctfU2phpdocumentor-type-resolver/Types/AbstractList.phpzctfzOǤ4phpdocumentor-type-resolver/Types/AggregatedType.php +ctf +*..phpdocumentor-type-resolver/Types/ArrayKey.phpctfe,phpdocumentor-type-resolver/Types/Array_.phpctf=y-phpdocumentor-type-resolver/Types/Boolean.phpuctfu;Z7phpdocumentor-type-resolver/Types/CallableParameter.phpctf~o/phpdocumentor-type-resolver/Types/Callable_.phpctf䔤1phpdocumentor-type-resolver/Types/ClassString.phpPctfP8Bؤ0phpdocumentor-type-resolver/Types/Collection.phpctfdܫ.phpdocumentor-type-resolver/Types/Compound.phpctf݇9-phpdocumentor-type-resolver/Types/Context.php ctf E4phpdocumentor-type-resolver/Types/ContextFactory.php7ctf7O0phpdocumentor-type-resolver/Types/Expression.php>ctf>c,phpdocumentor-type-resolver/Types/Float_.phpnctfn-phpdocumentor-type-resolver/Types/Integer.phpqctfqkQ5phpdocumentor-type-resolver/Types/InterfaceString.phpctfV2phpdocumentor-type-resolver/Types/Intersection.phpctf6פ/phpdocumentor-type-resolver/Types/Iterable_.phpBctfBuQ,phpdocumentor-type-resolver/Types/Mixed_.phpctfBIw,phpdocumentor-type-resolver/Types/Never_.phpctf}+phpdocumentor-type-resolver/Types/Null_.phpctfw.phpdocumentor-type-resolver/Types/Nullable.phpXctfXv-phpdocumentor-type-resolver/Types/Object_.phpctfd,-phpdocumentor-type-resolver/Types/Parent_.phpctfG32/phpdocumentor-type-resolver/Types/Resource_.phpctfJY,phpdocumentor-type-resolver/Types/Scalar.phpctfS+phpdocumentor-type-resolver/Types/Self_.phpctfd -phpdocumentor-type-resolver/Types/Static_.php ctf ]A%-phpdocumentor-type-resolver/Types/String_.phpzctfz.^|*phpdocumentor-type-resolver/Types/This.php`ctf`fr+phpdocumentor-type-resolver/Types/Void_.phpctf¬Gphpspec-prophecy/LICENSE}ctf} ߦ&phpspec-prophecy/Prophecy/Argument.php]ctf]eQ8phpspec-prophecy/Prophecy/Argument/ArgumentsWildcard.php ctf ϯM*:phpspec-prophecy/Prophecy/Argument/Token/AnyValueToken.phpctfIZ%%;phpspec-prophecy/Prophecy/Argument/Token/AnyValuesToken.phpctf'`Bphpspec-prophecy/Prophecy/Argument/Token/ApproximateValueToken.phpkctfk>3<phpspec-prophecy/Prophecy/Argument/Token/ArrayCountToken.phpPctfP!v<phpspec-prophecy/Prophecy/Argument/Token/ArrayEntryToken.phpctftrAphpspec-prophecy/Prophecy/Argument/Token/ArrayEveryEntryToken.phpctf9*:phpspec-prophecy/Prophecy/Argument/Token/CallbackToken.phpctf'eФ<phpspec-prophecy/Prophecy/Argument/Token/ExactValueToken.phpy ctfy @phpspec-prophecy/Prophecy/Argument/Token/IdenticalValueToken.phpctfc9phpspec-prophecy/Prophecy/Argument/Token/InArrayToken.phpctf |<phpspec-prophecy/Prophecy/Argument/Token/LogicalAndToken.phpctf<phpspec-prophecy/Prophecy/Argument/Token/LogicalNotToken.phpDctfDs62<phpspec-prophecy/Prophecy/Argument/Token/NotInArrayToken.phpctf t=phpspec-prophecy/Prophecy/Argument/Token/ObjectStateToken.php +ctf +R8q@phpspec-prophecy/Prophecy/Argument/Token/StringContainsToken.php,ctf,줊;phpspec-prophecy/Prophecy/Argument/Token/TokenInterface.phpctfG66phpspec-prophecy/Prophecy/Argument/Token/TypeToken.phpctf>7'phpspec-prophecy/Prophecy/Call/Call.phpctfn -phpspec-prophecy/Prophecy/Call/CallCenter.phpctfŸ:phpspec-prophecy/Prophecy/Comparator/ClosureComparator.phpctfͤI0phpspec-prophecy/Prophecy/Comparator/Factory.phpctfZ>8phpspec-prophecy/Prophecy/Comparator/FactoryProvider.phpctfH,;phpspec-prophecy/Prophecy/Comparator/ProphecyComparator.php'ctf'vD3phpspec-prophecy/Prophecy/Doubler/CachedDoubler.phpctfM1Dphpspec-prophecy/Prophecy/Doubler/ClassPatch/ClassPatchInterface.phphctfhq!ʤHphpspec-prophecy/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.phpctf,g=phpspec-prophecy/Prophecy/Doubler/ClassPatch/KeywordPatch.php%ctf%hI?phpspec-prophecy/Prophecy/Doubler/ClassPatch/MagicCallPatch.php ctf Ephpspec-prophecy/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php ctf !BPphpspec-prophecy/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.phpctf +,Aphpspec-prophecy/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php8 ctf8 AU5?phpspec-prophecy/Prophecy/Doubler/ClassPatch/ThrowablePatch.php ctf I[Aphpspec-prophecy/Prophecy/Doubler/ClassPatch/TraversablePatch.php ctf 5phpspec-prophecy/Prophecy/Doubler/DoubleInterface.phpctfBۤ-phpspec-prophecy/Prophecy/Doubler/Doubler.phpctf:T*Bphpspec-prophecy/Prophecy/Doubler/Generator/ClassCodeGenerator.php ctf \k<phpspec-prophecy/Prophecy/Doubler/Generator/ClassCreator.php]ctf];phpspec-prophecy/Prophecy/Doubler/Generator/ClassMirror.php#ctf#:Aphpspec-prophecy/Prophecy/Doubler/Generator/Node/ArgumentNode.phpctfĊEphpspec-prophecy/Prophecy/Doubler/Generator/Node/ArgumentTypeNode.phpctfˤ>phpspec-prophecy/Prophecy/Doubler/Generator/Node/ClassNode.phpwctfw`b?phpspec-prophecy/Prophecy/Doubler/Generator/Node/MethodNode.phpctfCphpspec-prophecy/Prophecy/Doubler/Generator/Node/ReturnTypeNode.phpctfvEphpspec-prophecy/Prophecy/Doubler/Generator/Node/TypeNodeAbstract.php ctf ?^Cphpspec-prophecy/Prophecy/Doubler/Generator/ReflectionInterface.phpctf YAphpspec-prophecy/Prophecy/Doubler/Generator/TypeHintReference.php"ctf"&0phpspec-prophecy/Prophecy/Doubler/LazyDouble.phpctf|3phpspec-prophecy/Prophecy/Doubler/NameGenerator.phpctf^Dphpspec-prophecy/Prophecy/Exception/Call/UnexpectedCallException.phpctfOEphpspec-prophecy/Prophecy/Exception/Doubler/ClassCreatorException.phpDctfDyXDphpspec-prophecy/Prophecy/Exception/Doubler/ClassMirrorException.phpdctfdv48Fphpspec-prophecy/Prophecy/Exception/Doubler/ClassNotFoundException.phpctf}:?phpspec-prophecy/Prophecy/Exception/Doubler/DoubleException.phpctfV"^@phpspec-prophecy/Prophecy/Exception/Doubler/DoublerException.phpctfhJphpspec-prophecy/Prophecy/Exception/Doubler/InterfaceNotFoundException.php!ctf!R3Lphpspec-prophecy/Prophecy/Exception/Doubler/MethodNotExtendableException.phpctf[Gphpspec-prophecy/Prophecy/Exception/Doubler/MethodNotFoundException.phpctf#kJphpspec-prophecy/Prophecy/Exception/Doubler/ReturnByReferenceException.phpctfL?1phpspec-prophecy/Prophecy/Exception/Exception.phpctfx@phpspec-prophecy/Prophecy/Exception/InvalidArgumentException.phpctf󱙤Ephpspec-prophecy/Prophecy/Exception/Prediction/AggregateException.php;ctf;%ăLphpspec-prophecy/Prophecy/Exception/Prediction/FailedPredictionException.phpgctfg3'}}Cphpspec-prophecy/Prophecy/Exception/Prediction/NoCallsException.phpctfZFphpspec-prophecy/Prophecy/Exception/Prediction/PredictionException.phpctfR2ͤPphpspec-prophecy/Prophecy/Exception/Prediction/UnexpectedCallsCountException.phpctfL]Kphpspec-prophecy/Prophecy/Exception/Prediction/UnexpectedCallsException.phpctfHphpspec-prophecy/Prophecy/Exception/Prophecy/MethodProphecyException.phpoctfoHphpspec-prophecy/Prophecy/Exception/Prophecy/ObjectProphecyException.phpctfg6ڤBphpspec-prophecy/Prophecy/Exception/Prophecy/ProphecyException.phpctfD7jIphpspec-prophecy/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php^ctf^)D=phpspec-prophecy/Prophecy/PhpDocumentor/ClassTagRetriever.phpctf:Gphpspec-prophecy/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.phpctfQ7phpspec-prophecy/Prophecy/Prediction/CallPrediction.phpctfe<phpspec-prophecy/Prophecy/Prediction/CallTimesPrediction.php= ctf= 1;phpspec-prophecy/Prophecy/Prediction/CallbackPrediction.phpctfP(:phpspec-prophecy/Prophecy/Prediction/NoCallsPrediction.php;ctf;"̤<phpspec-prophecy/Prophecy/Prediction/PredictionInterface.phpctfD5phpspec-prophecy/Prophecy/Promise/CallbackPromise.phpctfh$6phpspec-prophecy/Prophecy/Promise/PromiseInterface.phpactfaĶ= +;phpspec-prophecy/Prophecy/Promise/ReturnArgumentPromise.phpDctfDoTФ3phpspec-prophecy/Prophecy/Promise/ReturnPromise.phpsctfs|g2phpspec-prophecy/Prophecy/Promise/ThrowPromise.php +ctf +ju5phpspec-prophecy/Prophecy/Prophecy/MethodProphecy.php?ctf?W5phpspec-prophecy/Prophecy/Prophecy/ObjectProphecy.phpctf~L)8phpspec-prophecy/Prophecy/Prophecy/ProphecyInterface.phpqctfqhRw¤?phpspec-prophecy/Prophecy/Prophecy/ProphecySubjectInterface.phpctfġAr/phpspec-prophecy/Prophecy/Prophecy/Revealer.phpctf$x8phpspec-prophecy/Prophecy/Prophecy/RevealerInterface.phpGctfGWnZ%phpspec-prophecy/Prophecy/Prophet.php8ctf8-phpspec-prophecy/Prophecy/Util/ExportUtil.phpcctfcTgGϤ-phpspec-prophecy/Prophecy/Util/StringUtil.php +ctf +bg1phpstan-phpdoc-parser/Ast/AbstractNodeVisitor.phpctf7'phpstan-phpdoc-parser/Ast/Attribute.phpEctfEhVX>phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprArrayItemNode.phpctf :phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprArrayNode.php9ctf9 s:phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprFalseNode.php0ctf0a:phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprFloatNode.phpctf%<phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprIntegerNode.phpctf5phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprNode.phpctf79phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprNullNode.php.ctf.g,ƺ;phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprStringNode.phpctf"9phpstan-phpdoc-parser/Ast/ConstExpr/ConstExprTrueNode.php.ctf.9:6phpstan-phpdoc-parser/Ast/ConstExpr/ConstFetchNode.phpctfEJQCphpstan-phpdoc-parser/Ast/ConstExpr/DoctrineConstExprStringNode.phpfctff KsEphpstan-phpdoc-parser/Ast/ConstExpr/QuoteAwareConstExprStringNode.php ctf "phpstan-phpdoc-parser/Ast/Node.phpctfDL,phpstan-phpdoc-parser/Ast/NodeAttributes.phpctf ;+phpstan-phpdoc-parser/Ast/NodeTraverser.php)ctf){)phpstan-phpdoc-parser/Ast/NodeVisitor.php +ctf +x8phpstan-phpdoc-parser/Ast/NodeVisitor/CloningVisitor.phpctf"l=phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagMethodValueNode.phpctfn?phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagPropertyValueNode.phpctfx=u;7phpstan-phpdoc-parser/Ast/PhpDoc/AssertTagValueNode.phprctfr/͉;phpstan-phpdoc-parser/Ast/PhpDoc/DeprecatedTagValueNode.phpctf@phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineAnnotation.phpctfrŗ>phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArgument.phpctf;phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArray.phpwctfwF?phpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineArrayItem.phpctfI@ˤBphpstan-phpdoc-parser/Ast/PhpDoc/Doctrine/DoctrineTagValueNode.phpctf>{8phpstan-phpdoc-parser/Ast/PhpDoc/ExtendsTagValueNode.phpctf8phpstan-phpdoc-parser/Ast/PhpDoc/GenericTagValueNode.phpctf;phpstan-phpdoc-parser/Ast/PhpDoc/ImplementsTagValueNode.phpctf&X8phpstan-phpdoc-parser/Ast/PhpDoc/InvalidTagValueNode.phpctfYy:7phpstan-phpdoc-parser/Ast/PhpDoc/MethodTagValueNode.phpctfΡ.@phpstan-phpdoc-parser/Ast/PhpDoc/MethodTagValueParameterNode.phprctfr 86phpstan-phpdoc-parser/Ast/PhpDoc/MixinTagValueNode.phpctfD%Aphpstan-phpdoc-parser/Ast/PhpDoc/ParamClosureThisTagValueNode.php<ctf<ҫPphpstan-phpdoc-parser/Ast/PhpDoc/ParamImmediatelyInvokedCallableTagValueNode.phpctf5=Jphpstan-phpdoc-parser/Ast/PhpDoc/ParamLaterInvokedCallableTagValueNode.phpctfG9phpstan-phpdoc-parser/Ast/PhpDoc/ParamOutTagValueNode.php4ctf4\6phpstan-phpdoc-parser/Ast/PhpDoc/ParamTagValueNode.phpctfU4phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocChildNode.phpctfC/phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocNode.php+ctf+Je2phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTagNode.php ctf !D7phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTagValueNode.phpctf 3phpstan-phpdoc-parser/Ast/PhpDoc/PhpDocTextNode.phpctf+9phpstan-phpdoc-parser/Ast/PhpDoc/PropertyTagValueNode.php/ctf/?phpstan-phpdoc-parser/Ast/PhpDoc/RequireExtendsTagValueNode.phpctf|8Bphpstan-phpdoc-parser/Ast/PhpDoc/RequireImplementsTagValueNode.phpctf8;7phpstan-phpdoc-parser/Ast/PhpDoc/ReturnTagValueNode.phpctfQ-ۤ8phpstan-phpdoc-parser/Ast/PhpDoc/SelfOutTagValueNode.phpctf~9phpstan-phpdoc-parser/Ast/PhpDoc/TemplateTagValueNode.phpVctfV37phpstan-phpdoc-parser/Ast/PhpDoc/ThrowsTagValueNode.phpctf@phpstan-phpdoc-parser/Ast/PhpDoc/TypeAliasImportTagValueNode.phpctfڤ:phpstan-phpdoc-parser/Ast/PhpDoc/TypeAliasTagValueNode.phpyctfy>phpstan-phpdoc-parser/Ast/PhpDoc/TypelessParamTagValueNode.phpctfh:45phpstan-phpdoc-parser/Ast/PhpDoc/UsesTagValueNode.phpctfώ 4phpstan-phpdoc-parser/Ast/PhpDoc/VarTagValueNode.phpDctfD_)y5phpstan-phpdoc-parser/Ast/Type/ArrayShapeItemNode.php{ctf{OY1phpstan-phpdoc-parser/Ast/Type/ArrayShapeNode.phpctf0phpstan-phpdoc-parser/Ast/Type/ArrayTypeNode.phprctfr|Ф3phpstan-phpdoc-parser/Ast/Type/CallableTypeNode.phpctf]<phpstan-phpdoc-parser/Ast/Type/CallableTypeParameterNode.phpctf>5Bphpstan-phpdoc-parser/Ast/Type/ConditionalTypeForParameterNode.phpctf9ѝ6phpstan-phpdoc-parser/Ast/Type/ConditionalTypeNode.phpctfGʤ0phpstan-phpdoc-parser/Ast/Type/ConstTypeNode.phpctfZF2phpstan-phpdoc-parser/Ast/Type/GenericTypeNode.php+ctf+zk5phpstan-phpdoc-parser/Ast/Type/IdentifierTypeNode.phpctfR +7phpstan-phpdoc-parser/Ast/Type/IntersectionTypeNode.phpctfՌ2phpstan-phpdoc-parser/Ast/Type/InvalidTypeNode.phpVctfVNO-3phpstan-phpdoc-parser/Ast/Type/NullableTypeNode.phpctf1٤6phpstan-phpdoc-parser/Ast/Type/ObjectShapeItemNode.phpctfI[2phpstan-phpdoc-parser/Ast/Type/ObjectShapeNode.phpEctfE.>ܤ7phpstan-phpdoc-parser/Ast/Type/OffsetAccessTypeNode.phpctfkz/phpstan-phpdoc-parser/Ast/Type/ThisTypeNode.php ctf 5+phpstan-phpdoc-parser/Ast/Type/TypeNode.phpctfǖ׹0phpstan-phpdoc-parser/Ast/Type/UnionTypeNode.phpctftߤphpstan-phpdoc-parser/LICENSE.ctf.-%phpstan-phpdoc-parser/Lexer/Lexer.phpctfcg +0phpstan-phpdoc-parser/Parser/ConstExprParser.phpt&ctft&D0phpstan-phpdoc-parser/Parser/ParserException.php| ctf| ԧ$-phpstan-phpdoc-parser/Parser/PhpDocParser.php-ctf-wͤ0phpstan-phpdoc-parser/Parser/StringUnescaper.php ctf $E.phpstan-phpdoc-parser/Parser/TokenIterator.php#ctf#&+phpstan-phpdoc-parser/Parser/TypeParser.phpctf*phpstan-phpdoc-parser/Printer/DiffElem.phpctf=!s(phpstan-phpdoc-parser/Printer/Differ.phpbctfb)phpstan-phpdoc-parser/Printer/Printer.php}ctf}/ phpunit.xsdRFctfRFAgphpunit/Exception.phpctfa#phpunit/Framework/Assert.phpbctfbʏ&phpunit/Framework/Assert/Functions.phpԊctfԊ60phpunit/Framework/Constraint/Boolean/IsFalse.phpctfx*ۺ/phpunit/Framework/Constraint/Boolean/IsTrue.phpctf,v^)phpunit/Framework/Constraint/Callback.php=ctf=J:2phpunit/Framework/Constraint/Cardinality/Count.phpe ctfe F8phpunit/Framework/Constraint/Cardinality/GreaterThan.php +ctf +)!4phpunit/Framework/Constraint/Cardinality/IsEmpty.phpctfV认5phpunit/Framework/Constraint/Cardinality/LessThan.phpctfS5phpunit/Framework/Constraint/Cardinality/SameSize.php_ctf_uŤ+phpunit/Framework/Constraint/Constraint.php!ctf!7}B1phpunit/Framework/Constraint/Equality/IsEqual.php ctf iL?phpunit/Framework/Constraint/Equality/IsEqualCanonicalizing.php +ctf +,=phpunit/Framework/Constraint/Equality/IsEqualIgnoringCase.php +ctf +moC:phpunit/Framework/Constraint/Equality/IsEqualWithDelta.php= +ctf= +ݬ4phpunit/Framework/Constraint/Exception/Exception.phpctf7N8phpunit/Framework/Constraint/Exception/ExceptionCode.phpctf*1#;phpunit/Framework/Constraint/Exception/ExceptionMessage.phpctf"Lphpunit/Framework/Constraint/Exception/ExceptionMessageRegularExpression.phpctfw4;phpunit/Framework/Constraint/Filesystem/DirectoryExists.phpgctfg,q6phpunit/Framework/Constraint/Filesystem/FileExists.phpbctfb"E6phpunit/Framework/Constraint/Filesystem/IsReadable.phpbctfb,j6phpunit/Framework/Constraint/Filesystem/IsWritable.phpbctfbD+phpunit/Framework/Constraint/IsAnything.phpctf-%6$,phpunit/Framework/Constraint/IsIdentical.php ctf G,phpunit/Framework/Constraint/JsonMatches.php^ ctf^ h {@phpunit/Framework/Constraint/JsonMatchesErrorMessageProvider.php3ctf3 +.phpunit/Framework/Constraint/Math/IsFinite.phpctf]"0phpunit/Framework/Constraint/Math/IsInfinite.phpctfWڤ+phpunit/Framework/Constraint/Math/IsNan.phpctf\ Lj9phpunit/Framework/Constraint/Object/ClassHasAttribute.phpctfl?phpunit/Framework/Constraint/Object/ClassHasStaticAttribute.php(ctf(P4phpunit/Framework/Constraint/Object/ObjectEquals.phpctf\ޤ:phpunit/Framework/Constraint/Object/ObjectHasAttribute.phpctf޼9phpunit/Framework/Constraint/Object/ObjectHasProperty.phpctfgŶ8phpunit/Framework/Constraint/Operator/BinaryOperator.php=ctf=qc4phpunit/Framework/Constraint/Operator/LogicalAnd.phpctfN(4phpunit/Framework/Constraint/Operator/LogicalNot.php1 ctf1 [vɤ3phpunit/Framework/Constraint/Operator/LogicalOr.phpctf.cߤ4phpunit/Framework/Constraint/Operator/LogicalXor.php!ctf!{_2phpunit/Framework/Constraint/Operator/Operator.php!ctf!K-V7phpunit/Framework/Constraint/Operator/UnaryOperator.php,ctf,7FΤ.phpunit/Framework/Constraint/String/IsJson.phpctf2.9phpunit/Framework/Constraint/String/RegularExpression.phpctf=E6phpunit/Framework/Constraint/String/StringContains.phpctfsj6phpunit/Framework/Constraint/String/StringEndsWith.phpctfxWFphpunit/Framework/Constraint/String/StringMatchesFormatDescription.php +ctf +z8phpunit/Framework/Constraint/String/StringStartsWith.php$ctf$@8phpunit/Framework/Constraint/Traversable/ArrayHasKey.phpctfʹ@phpunit/Framework/Constraint/Traversable/TraversableContains.php ctf WƴEphpunit/Framework/Constraint/Traversable/TraversableContainsEqual.php`ctf`kɋIphpunit/Framework/Constraint/Traversable/TraversableContainsIdentical.php&ctf&)3Dphpunit/Framework/Constraint/Traversable/TraversableContainsOnly.phpN ctfN ˤ2phpunit/Framework/Constraint/Type/IsInstanceOf.php_ctf_X,phpunit/Framework/Constraint/Type/IsNull.phpctf>,phpunit/Framework/Constraint/Type/IsType.phpctf:+phpunit/Framework/DataProviderTestSuite.php7ctf7~&phpunit/Framework/Error/Deprecated.phpzctfzV!phpunit/Framework/Error/Error.phpmctfmYg"phpunit/Framework/Error/Notice.phpvctfvˤ#phpunit/Framework/Error/Warning.phpwctfwG#phpunit/Framework/ErrorTestCase.phpctf4Aphpunit/Framework/Exception/ActualValueIsNotAnObjectException.phpctfC~4phpunit/Framework/Exception/AssertionFailedError.phpctf5phpunit/Framework/Exception/CodeCoverageException.phpctf[Sphpunit/Framework/Exception/ComparisonMethodDoesNotAcceptParameterTypeException.phpjctfjӰUphpunit/Framework/Exception/ComparisonMethodDoesNotDeclareBoolReturnTypeException.phpQctfQv $Zphpunit/Framework/Exception/ComparisonMethodDoesNotDeclareExactlyOneParameterException.php[ctf[MFbTphpunit/Framework/Exception/ComparisonMethodDoesNotDeclareParameterTypeException.phpYctfYzEphpunit/Framework/Exception/ComparisonMethodDoesNotExistException.php.ctf.5譤?phpunit/Framework/Exception/CoveredCodeNotExecutedException.phpctf8YФ%phpunit/Framework/Exception/Error.phpctfG)phpunit/Framework/Exception/Exception.php ctf 8w:phpunit/Framework/Exception/ExpectationFailedException.phpctf3ˤ3phpunit/Framework/Exception/IncompleteTestError.phpctfםܤ8phpunit/Framework/Exception/InvalidArgumentException.phpctfk<phpunit/Framework/Exception/InvalidCoversTargetException.phpctfo苤<phpunit/Framework/Exception/InvalidDataProviderException.phpctf.ڜɤ@phpunit/Framework/Exception/MissingCoversAnnotationException.phpctf|9phpunit/Framework/Exception/NoChildTestSuiteException.phpctfP$+phpunit/Framework/Exception/OutputError.phpctf8phpunit/Framework/Exception/PHPTAssertionFailedError.php3ctf3.phpunit/Framework/Exception/RiskyTestError.phpctf*y0phpunit/Framework/Exception/SkippedTestError.phpctf O~5phpunit/Framework/Exception/SkippedTestSuiteError.phpctfx.phpunit/Framework/Exception/SyntheticError.php2ctf25phpunit/Framework/Exception/SyntheticSkippedError.phpctfԗ?phpunit/Framework/Exception/UnintentionallyCoveredCodeError.phpctf'phpunit/Framework/Exception/Warning.phpctfNG[&phpunit/Framework/ExceptionWrapper.phpwctfwKT.phpunit/Framework/ExecutionOrderDependency.phpctfҦդ$phpunit/Framework/IncompleteTest.phpctf,+(phpunit/Framework/IncompleteTestCase.phpctf 4phpunit/Framework/InvalidParameterGroupException.phpctf(phpunit/Framework/MockObject/Api/Api.php ctf 7f+phpunit/Framework/MockObject/Api/Method.phpctf1phpunit/Framework/MockObject/Builder/Identity.phpctf9phpunit/Framework/MockObject/Builder/InvocationMocker.php, ctf, ܠҤ:phpunit/Framework/MockObject/Builder/InvocationStubber.phpctf Ƥ8phpunit/Framework/MockObject/Builder/MethodNameMatch.phpctf8,8phpunit/Framework/MockObject/Builder/ParametersMatch.phpctfڃ-phpunit/Framework/MockObject/Builder/Stub.phpctfȉ3phpunit/Framework/MockObject/ConfigurableMethod.phpctf +?Aphpunit/Framework/MockObject/Exception/BadMethodCallException.phpctfΫXGphpunit/Framework/MockObject/Exception/CannotUseAddMethodsException.php5ctf5{Hphpunit/Framework/MockObject/Exception/CannotUseOnlyMethodsException.phpEctfEFphpunit/Framework/MockObject/Exception/ClassAlreadyExistsException.phpctf@phpunit/Framework/MockObject/Exception/ClassIsFinalException.phpctf()Cphpunit/Framework/MockObject/Exception/ClassIsReadonlyException.phpctfOuXYphpunit/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php ctf ɅWCphpunit/Framework/MockObject/Exception/DuplicateMethodException.phpctfy4phpunit/Framework/MockObject/Exception/Exception.phpctfB'Kphpunit/Framework/MockObject/Exception/IncompatibleReturnValueException.phpctf3dfEphpunit/Framework/MockObject/Exception/InvalidMethodNameException.phpctf ܤHphpunit/Framework/MockObject/Exception/MatchBuilderNotFoundException.phpctfLphpunit/Framework/MockObject/Exception/MatcherAlreadyRegisteredException.phpctfz'Lphpunit/Framework/MockObject/Exception/MethodCannotBeConfiguredException.phpctf}QOphpunit/Framework/MockObject/Exception/MethodNameAlreadyConfiguredException.phpctfӁƤKphpunit/Framework/MockObject/Exception/MethodNameNotConfiguredException.php~ctf~x1)Uphpunit/Framework/MockObject/Exception/MethodParametersAlreadyConfiguredException.phpctf rYphpunit/Framework/MockObject/Exception/OriginalConstructorInvocationRequiredException.phpctfک>phpunit/Framework/MockObject/Exception/ReflectionException.phpctf.ؔLphpunit/Framework/MockObject/Exception/ReturnValueNotConfiguredException.php6ctf6?먙;phpunit/Framework/MockObject/Exception/RuntimeException.phpctf_|Mphpunit/Framework/MockObject/Exception/SoapExtensionNotAvailableException.phpctfz@phpunit/Framework/MockObject/Exception/UnknownClassException.phpctf5uW@phpunit/Framework/MockObject/Exception/UnknownTraitException.phpctfq¥?phpunit/Framework/MockObject/Exception/UnknownTypeException.phpctf~*phpunit/Framework/MockObject/Generator.phpctfߑ鹤6phpunit/Framework/MockObject/Generator/deprecation.tpl;ctf;O5s7phpunit/Framework/MockObject/Generator/intersection.tplLctfL-X7phpunit/Framework/MockObject/Generator/mocked_class.tplctfwZ8phpunit/Framework/MockObject/Generator/mocked_method.tplFctfFKFphpunit/Framework/MockObject/Generator/mocked_method_never_or_void.tplctfp?phpunit/Framework/MockObject/Generator/mocked_static_method.tplctf 4R9phpunit/Framework/MockObject/Generator/proxied_method.tpl}ctf}@ėGphpunit/Framework/MockObject/Generator/proxied_method_never_or_void.tplvctfvT6phpunit/Framework/MockObject/Generator/trait_class.tplQctfQ<Ȥ5phpunit/Framework/MockObject/Generator/wsdl_class.tplctf6phpunit/Framework/MockObject/Generator/wsdl_method.tpl<ctf<i+phpunit/Framework/MockObject/Invocation.phpctfzmn42phpunit/Framework/MockObject/InvocationHandler.php3ctf3Ї(phpunit/Framework/MockObject/Matcher.phpctfݽ_O5phpunit/Framework/MockObject/MethodNameConstraint.phpctfn~嵤,phpunit/Framework/MockObject/MockBuilder.php[+ctf[+ᗩ*phpunit/Framework/MockObject/MockClass.phpctf~m+phpunit/Framework/MockObject/MockMethod.php{&ctf{&c3.phpunit/Framework/MockObject/MockMethodSet.php5ctf5v+phpunit/Framework/MockObject/MockObject.phpctf *phpunit/Framework/MockObject/MockTrait.phpctf))phpunit/Framework/MockObject/MockType.phpctf³ݤ5phpunit/Framework/MockObject/Rule/AnyInvokedCount.phpfctffVEL3phpunit/Framework/MockObject/Rule/AnyParameters.phpctf^e;phpunit/Framework/MockObject/Rule/ConsecutiveParameters.phpV ctfV 615phpunit/Framework/MockObject/Rule/InvocationOrder.phpctf4r4phpunit/Framework/MockObject/Rule/InvokedAtIndex.php(ctf(VF69phpunit/Framework/MockObject/Rule/InvokedAtLeastCount.phpctf5`;8phpunit/Framework/MockObject/Rule/InvokedAtLeastOnce.php)ctf)B8phpunit/Framework/MockObject/Rule/InvokedAtMostCount.phpctfUv-2phpunit/Framework/MockObject/Rule/InvokedCount.php ctf 80phpunit/Framework/MockObject/Rule/MethodName.phpctfX~$0phpunit/Framework/MockObject/Rule/Parameters.phpQctfQ4phpunit/Framework/MockObject/Rule/ParametersRule.phpactfa̤%phpunit/Framework/MockObject/Stub.phpctfQA6phpunit/Framework/MockObject/Stub/ConsecutiveCalls.phpctfy^/phpunit/Framework/MockObject/Stub/Exception.php*ctf*Q4phpunit/Framework/MockObject/Stub/ReturnArgument.phpctfX`. 4phpunit/Framework/MockObject/Stub/ReturnCallback.phpctfa25phpunit/Framework/MockObject/Stub/ReturnReference.phpctfs殤0phpunit/Framework/MockObject/Stub/ReturnSelf.php3ctf3Hդ0phpunit/Framework/MockObject/Stub/ReturnStub.phpctfH4phpunit/Framework/MockObject/Stub/ReturnValueMap.phpctf53*phpunit/Framework/MockObject/Stub/Stub.php3ctf3>++phpunit/Framework/MockObject/Verifiable.phpctfhy!phpunit/Framework/Reorderable.phpctf$phpunit/Framework/SelfDescribing.php ctf ]H4!phpunit/Framework/SkippedTest.phpctfS.%phpunit/Framework/SkippedTestCase.phpctf.phpunit/Framework/Test.php~ctf~Qu!phpunit/Framework/TestBuilder.phpctf phpunit/Framework/TestCase.php-ctf-*HF!phpunit/Framework/TestFailure.phpctf%Ĥ"phpunit/Framework/TestListener.phphctfhq7phpunit/Framework/TestListenerDefaultImplementation.phpctf4DJ phpunit/Framework/TestResult.php~ctf~.phpunit/Framework/TestSuite.phpTdctfTdR'phpunit/Framework/TestSuiteIterator.php/ctf/ +%phpunit/Framework/WarningTestCase.php$ctf$!phpunit/Runner/BaseTestRunner.php ctf Ԥ)phpunit/Runner/DefaultTestResultCache.phpctfmJ/phpunit/Runner/Exception.phpctfzZ-phpunit/Runner/Extension/ExtensionHandler.php{ ctf{ 'phpunit/Runner/Extension/PharLoader.php ctf z/t4phpunit/Runner/Filter/ExcludeGroupFilterIterator.phprctfru]!phpunit/Runner/Filter/Factory.phpctfu}-phpunit/Runner/Filter/GroupFilterIterator.phpctf~4phpunit/Runner/Filter/IncludeGroupFilterIterator.phpqctfqLm:,phpunit/Runner/Filter/NameFilterIterator.php ctf a{/phpunit/Runner/Hook/AfterIncompleteTestHook.php,ctf,)phpunit/Runner/Hook/AfterLastTestHook.phpctfO**phpunit/Runner/Hook/AfterRiskyTestHook.php"ctf"yDP,phpunit/Runner/Hook/AfterSkippedTestHook.php&ctf&I7/phpunit/Runner/Hook/AfterSuccessfulTestHook.phpctf*phpunit/Runner/Hook/AfterTestErrorHook.php"ctf"cw,phpunit/Runner/Hook/AfterTestFailureHook.php&ctf&@@ +%phpunit/Runner/Hook/AfterTestHook.phpctfDm [,phpunit/Runner/Hook/AfterTestWarningHook.php&ctf&+phpunit/Runner/Hook/BeforeFirstTestHook.phpctflēl&phpunit/Runner/Hook/BeforeTestHook.phpctf#?phpunit/Runner/Hook/Hook.phpctf. phpunit/Runner/Hook/TestHook.phpctfZ_ ++phpunit/Runner/Hook/TestListenerAdapter.phpctfK&phpunit/Runner/NullTestResultCache.phpctfzGphpunit/Runner/PhptTestCase.phpVctfV'phpunit/Runner/ResultCacheExtension.php-ctf-[*phpunit/Runner/StandardTestSuiteLoader.phpctf6"phpunit/Runner/TestResultCache.phpctff$"phpunit/Runner/TestSuiteLoader.phpctf3\ؤ"phpunit/Runner/TestSuiteSorter.php+ctf+cphpunit/Runner/Version.phpctfU=ܤ'phpunit/TextUI/CliArguments/Builder.phpTctfT#MM-phpunit/TextUI/CliArguments/Configuration.phpBctfB4)phpunit/TextUI/CliArguments/Exception.phpctf%zE&phpunit/TextUI/CliArguments/Mapper.php*,ctf*,[ᤤphpunit/TextUI/Command.phpxrctfxrfФ'phpunit/TextUI/DefaultResultPrinter.phpM7ctfM7k&phpunit/TextUI/Exception/Exception.phpctfD{i0phpunit/TextUI/Exception/ReflectionException.phpctf Y-phpunit/TextUI/Exception/RuntimeException.phpctfF;phpunit/TextUI/Exception/TestDirectoryNotFoundException.phpctf6phpunit/TextUI/Exception/TestFileNotFoundException.phpctfpCphpunit/TextUI/Help.php1ctf1B phpunit/TextUI/ResultPrinter.phpnctfn^phpunit/TextUI/TestRunner.phpctf1"phpunit/TextUI/TestSuiteMapper.php ctf =phpunit/TextUI/XmlConfiguration/CodeCoverage/CodeCoverage.phpuctfu_Aphpunit/TextUI/XmlConfiguration/CodeCoverage/Filter/Directory.phpctfc斤Kphpunit/TextUI/XmlConfiguration/CodeCoverage/Filter/DirectoryCollection.phpctfХǤSphpunit/TextUI/XmlConfiguration/CodeCoverage/Filter/DirectoryCollectionIterator.phpctf=phpunit/TextUI/XmlConfiguration/CodeCoverage/FilterMapper.phpctf>phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Clover.phpctfAphpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Cobertura.phpctfդ>phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Crap4j.phpctf_T<phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Html.phpctflӶ;phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Php.phpctf.w<phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Text.phpctf g;phpunit/TextUI/XmlConfiguration/CodeCoverage/Report/Xml.phpctf1phpunit/TextUI/XmlConfiguration/Configuration.php)ctf)XN-phpunit/TextUI/XmlConfiguration/Exception.phpctfN5+8phpunit/TextUI/XmlConfiguration/Filesystem/Directory.phpctfVjBphpunit/TextUI/XmlConfiguration/Filesystem/DirectoryCollection.phpctfJphpunit/TextUI/XmlConfiguration/Filesystem/DirectoryCollectionIterator.phpctfj3phpunit/TextUI/XmlConfiguration/Filesystem/File.phpctfX=phpunit/TextUI/XmlConfiguration/Filesystem/FileCollection.phpyctfyCWzEphpunit/TextUI/XmlConfiguration/Filesystem/FileCollectionIterator.php`ctf`"J-phpunit/TextUI/XmlConfiguration/Generator.phpctfnm/phpunit/TextUI/XmlConfiguration/Group/Group.phpctf 9phpunit/TextUI/XmlConfiguration/Group/GroupCollection.phpctf=m+Aphpunit/TextUI/XmlConfiguration/Group/GroupCollectionIterator.phpkctfkYE0phpunit/TextUI/XmlConfiguration/Group/Groups.phpctf5ʤ*phpunit/TextUI/XmlConfiguration/Loader.phpqctfqSФ1phpunit/TextUI/XmlConfiguration/Logging/Junit.phpctf2-_Ť3phpunit/TextUI/XmlConfiguration/Logging/Logging.php ctf 4phpunit/TextUI/XmlConfiguration/Logging/TeamCity.phpctfa7'8phpunit/TextUI/XmlConfiguration/Logging/TestDox/Html.phpctf+&8phpunit/TextUI/XmlConfiguration/Logging/TestDox/Text.phpctf 7phpunit/TextUI/XmlConfiguration/Logging/TestDox/Xml.phpctf ݤ0phpunit/TextUI/XmlConfiguration/Logging/Text.phpctfK26>phpunit/TextUI/XmlConfiguration/Migration/MigrationBuilder.phpctfqnGphpunit/TextUI/XmlConfiguration/Migration/MigrationBuilderException.phpctfbs@phpunit/TextUI/XmlConfiguration/Migration/MigrationException.php +ctf +pHphpunit/TextUI/XmlConfiguration/Migration/Migrations/ConvertLogTypes.phpctfEނ$Ophpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageCloverToReport.phpVctfV$s¤Ophpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageCrap4jToReport.phpctfIOMphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageHtmlToReport.phpctfDLphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoveragePhpToReport.phpDctfDRYMphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageTextToReport.phpctfmi0_Lphpunit/TextUI/XmlConfiguration/Migration/Migrations/CoverageXmlToReport.phpIctfIKQphpunit/TextUI/XmlConfiguration/Migration/Migrations/IntroduceCoverageElement.phpctf{Mphpunit/TextUI/XmlConfiguration/Migration/Migrations/LogToReportMigration.phpctf|Bphpunit/TextUI/XmlConfiguration/Migration/Migrations/Migration.phpctfwgdphpunit/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.phpctfĉYphpunit/TextUI/XmlConfiguration/Migration/Migrations/MoveAttributesFromRootToCoverage.phpBctfBvDXphpunit/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistExcludesToCoverage.phpctfŚYXphpunit/TextUI/XmlConfiguration/Migration/Migrations/MoveWhitelistIncludesToCoverage.phpctf(Sphpunit/TextUI/XmlConfiguration/Migration/Migrations/RemoveCacheTokensAttribute.phpctfUPJphpunit/TextUI/XmlConfiguration/Migration/Migrations/RemoveEmptyFilter.phpyctfyJcGphpunit/TextUI/XmlConfiguration/Migration/Migrations/RemoveLogTypes.phpnctfng;Qphpunit/TextUI/XmlConfiguration/Migration/Migrations/UpdateSchemaLocationTo93.phpctf(x6phpunit/TextUI/XmlConfiguration/Migration/Migrator.phpctfՕ0phpunit/TextUI/XmlConfiguration/PHP/Constant.php6ctf6n:phpunit/TextUI/XmlConfiguration/PHP/ConstantCollection.phphctfh8Bphpunit/TextUI/XmlConfiguration/PHP/ConstantCollectionIterator.phpctfQ2phpunit/TextUI/XmlConfiguration/PHP/IniSetting.phpHctfH- jD<phpunit/TextUI/XmlConfiguration/PHP/IniSettingCollection.phpctfhDphpunit/TextUI/XmlConfiguration/PHP/IniSettingCollectionIterator.phpctf!f+phpunit/TextUI/XmlConfiguration/PHP/Php.php +ctf +IGƤ2phpunit/TextUI/XmlConfiguration/PHP/PhpHandler.phpoctfoR0phpunit/TextUI/XmlConfiguration/PHP/Variable.phpctfl :phpunit/TextUI/XmlConfiguration/PHP/VariableCollection.phphctfhͤBphpunit/TextUI/XmlConfiguration/PHP/VariableCollectionIterator.phpctf45phpunit/TextUI/XmlConfiguration/PHPUnit/Extension.phpctfG?phpunit/TextUI/XmlConfiguration/PHPUnit/ExtensionCollection.phpctf^ 'Gphpunit/TextUI/XmlConfiguration/PHPUnit/ExtensionCollectionIterator.phpctfF3phpunit/TextUI/XmlConfiguration/PHPUnit/PHPUnit.php2Cctf2C;phpunit/TextUI/XmlConfiguration/TestSuite/TestDirectory.php>ctf>U'bEphpunit/TextUI/XmlConfiguration/TestSuite/TestDirectoryCollection.phpctf] ǰMphpunit/TextUI/XmlConfiguration/TestSuite/TestDirectoryCollectionIterator.phpctfq6phpunit/TextUI/XmlConfiguration/TestSuite/TestFile.phpctf@phpunit/TextUI/XmlConfiguration/TestSuite/TestFileCollection.phpctf'Hphpunit/TextUI/XmlConfiguration/TestSuite/TestFileCollectionIterator.phptctftq7phpunit/TextUI/XmlConfiguration/TestSuite/TestSuite.phpctfDۤAphpunit/TextUI/XmlConfiguration/TestSuite/TestSuiteCollection.phpctf Iphpunit/TextUI/XmlConfiguration/TestSuite/TestSuiteCollectionIterator.phpctfZ$phpunit/Util/Annotation/DocBlock.php@ctf@<׹$phpunit/Util/Annotation/Registry.phpI +ctfI +tͤphpunit/Util/Blacklist.phpctfgphpunit/Util/Cloner.phpctfephpunit/Util/Color.phpctf#vphpunit/Util/ErrorHandler.phpctfy+#phpunit/Util/Exception.phpctf다phpunit/Util/ExcludeList.phpctf??phpunit/Util/FileLoader.php ctf Tphpunit/Util/Filesystem.phpctfDphpunit/Util/Filter.php ctf Bnphpunit/Util/GlobalState.php ctf !ʤ(phpunit/Util/InvalidDataSetException.phpctf,KOphpunit/Util/Json.php/ ctf/ l{kphpunit/Util/Log/JUnit.phpT*ctfT*phpunit/Util/Log/TeamCity.phpm&ctfm&ef*'phpunit/Util/PHP/AbstractPhpProcess.php'ctf'U4&phpunit/Util/PHP/DefaultPhpProcess.phptctftds*phpunit/Util/PHP/Template/PhptTestCase.tplctf׈j+phpunit/Util/PHP/Template/TestCaseClass.tpl ctf v,phpunit/Util/PHP/Template/TestCaseMethod.tpl2ctf2?&phpunit/Util/PHP/WindowsPhpProcess.phpctf,phpunit/Util/Printer.php ctf ^1Ĥphpunit/Util/Reflection.phpctff-}"phpunit/Util/RegularExpression.phpctfphpunit/Util/Test.php]ctf]+vˤ*phpunit/Util/TestDox/CliTestDoxPrinter.phpO*ctfO*5*phpunit/Util/TestDox/HtmlResultPrinter.php ctf LL'phpunit/Util/TestDox/NamePrettifier.php0"ctf0"U>&phpunit/Util/TestDox/ResultPrinter.phpGctfG0H{ߤ'phpunit/Util/TestDox/TestDoxPrinter.php+)ctf+)#*phpunit/Util/TestDox/TextResultPrinter.phpctf`O{)phpunit/Util/TestDox/XmlResultPrinter.phpctfݤ%phpunit/Util/TextTestListRenderer.php^ctf^J/phpunit/Util/Type.phpctfW*phpunit/Util/VersionComparisonOperator.phpctf,phpunit/Util/XdebugFilterScriptGenerator.phpuctfu.Gphpunit/Util/Xml.phpctfTphpunit/Util/Xml/Exception.phpctfӤ0phpunit/Util/Xml/FailedSchemaDetectionResult.phpctf#Sphpunit/Util/Xml/Loader.php ctf $Z*phpunit/Util/Xml/SchemaDetectionResult.phpctfm#phpunit/Util/Xml/SchemaDetector.phpvctfvjo#!phpunit/Util/Xml/SchemaFinder.phpctf:~~q%phpunit/Util/Xml/SnapshotNodeList.phpEctfE6\4phpunit/Util/Xml/SuccessfulSchemaDetectionResult.phpctf@ +%phpunit/Util/Xml/ValidationResult.phpctf(>phpunit/Util/Xml/Validator.phpctf$phpunit/Util/XmlTestListRenderer.php1 +ctf1 +Fsbom.xml*2ctf*295schema/8.5.xsdBctfB2A[schema/9.0.xsd4Bctf4B7wschema/9.1.xsdBctfBq'8schema/9.2.xsdBctfBc-schema/9.3.xsdEctfEqschema/9.4.xsd +Fctf +FDOFIschema/9.5.xsdDFctfDFs|sebastian-cli-parser/LICENSEctfusebastian-cli-parser/Parser.phpctf_"<sebastian-cli-parser/exceptions/AmbiguousOptionException.phpJctfJkK*-sebastian-cli-parser/exceptions/Exception.phpyctfy>Gsebastian-cli-parser/exceptions/OptionDoesNotAllowArgumentException.phpcctfcRjYJsebastian-cli-parser/exceptions/RequiredOptionArgumentMissingException.phplctflzQ:sebastian-cli-parser/exceptions/UnknownOptionException.phpCctfC*tP*sebastian-code-unit-reverse-lookup/LICENSEctf3G (-sebastian-code-unit-reverse-lookup/Wizard.php ctf 'sebastian-code-unit/ClassMethodUnit.phpctfv!sebastian-code-unit/ClassUnit.phpctfJk sebastian-code-unit/CodeUnit.phpk%ctfk%6*sebastian-code-unit/CodeUnitCollection.php}ctf}*ﬤ2sebastian-code-unit/CodeUnitCollectionIterator.php:ctf:,e$sebastian-code-unit/FunctionUnit.phpctf􋕤+sebastian-code-unit/InterfaceMethodUnit.php"ctf"_!_%sebastian-code-unit/InterfaceUnit.phpctfš%sebastian-code-unit/LICENSE ctf psebastian-code-unit/Mapper.php-ctf-4'sebastian-code-unit/TraitMethodUnit.phpctf%E:!sebastian-code-unit/TraitUnit.phpctfߕ,sebastian-code-unit/exceptions/Exception.phpwctfw5Ǥ;sebastian-code-unit/exceptions/InvalidCodeUnitException.phpctfMvԊ3sebastian-code-unit/exceptions/NoTraitException.phpctf]56sebastian-code-unit/exceptions/ReflectionException.phpctfcQ(sebastian-comparator/ArrayComparator.phpyctfy}פ#sebastian-comparator/Comparator.phpctf$*sebastian-comparator/ComparisonFailure.php ctf yP٤*sebastian-comparator/DOMNodeComparator.php) ctf) L+sebastian-comparator/DateTimeComparator.php ctf c)sebastian-comparator/DoubleComparator.phpctf&,sebastian-comparator/ExceptionComparator.phpctf.L0 sebastian-comparator/Factory.phpctfpxsebastian-comparator/LICENSE ctf =(-sebastian-comparator/MockObjectComparator.phpctf]*sebastian-comparator/NumericComparator.php5 ctf5 c)sebastian-comparator/ObjectComparator.php\ ctf\ Fɫ+sebastian-comparator/ResourceComparator.php ctf WꞤ)sebastian-comparator/ScalarComparator.php3 ctf3 3sebastian-comparator/SplObjectStorageComparator.phpctfF'sebastian-comparator/TypeComparator.phpctf%Y\-sebastian-comparator/exceptions/Exception.phpzctfzϤ4sebastian-comparator/exceptions/RuntimeException.phpctf_#sebastian-complexity/Calculator.phpctf2k.sebastian-complexity/Complexity/Complexity.phpSctfS!p,8sebastian-complexity/Complexity/ComplexityCollection.phpctf@sebastian-complexity/Complexity/ComplexityCollectionIterator.php+ctf+F4,sebastian-complexity/Exception/Exception.phpzctfzȬˤ3sebastian-complexity/Exception/RuntimeException.phpctfsebastian-complexity/LICENSEctf=ݤ=sebastian-complexity/Visitor/ComplexityCalculatingVisitor.php ctf ;Gsebastian-complexity/Visitor/CyclomaticComplexityCalculatingVisitor.phpEctfEj)౤sebastian-diff/Chunk.php]ctf]90sebastian-diff/Diff.phpjctfj2 1sebastian-diff/Differ.php$ctf$]X-3sebastian-diff/Exception/ConfigurationException.phpFctfFӶ &sebastian-diff/Exception/Exception.phpnctfn/\5sebastian-diff/Exception/InvalidArgumentException.phpctf$ysebastian-diff/LICENSE ctf a1sebastian-diff/Line.phpNctfNN +ͤ5sebastian-diff/LongestCommonSubsequenceCalculator.phpctfep6Dsebastian-diff/MemoryEfficientLongestCommonSubsequenceCalculator.phpctfMR"4sebastian-diff/Output/AbstractChunkOutputBuilder.phpctfa=/sebastian-diff/Output/DiffOnlyOutputBuilder.phpctf&cF4sebastian-diff/Output/DiffOutputBuilderInterface.phpctfpm8sebastian-diff/Output/StrictUnifiedDiffOutputBuilder.php(ctf(X^q\2sebastian-diff/Output/UnifiedDiffOutputBuilder.phpIctfIӎsebastian-diff/Parser.php ctf `TBsebastian-diff/TimeEfficientLongestCommonSubsequenceCalculator.phpctfra!sebastian-environment/Console.phpctf` sebastian-environment/LICENSEctfFy٤)sebastian-environment/OperatingSystem.phpctf.3j!sebastian-environment/Runtime.phpctf8դsebastian-exporter/Exporter.phpP$ctfP$Җsebastian-exporter/LICENSEctf 5٤'sebastian-global-state/CodeExporter.php ctf Xc&sebastian-global-state/ExcludeList.php +ctf +} +sebastian-global-state/LICENSEctfJ#sebastian-global-state/Restorer.phpctfBߤ#sebastian-global-state/Snapshot.php*ctf*}./sebastian-global-state/exceptions/Exception.php}ctf}ⴤ6sebastian-global-state/exceptions/RuntimeException.phpctf##sebastian-lines-of-code/Counter.phpGctfGq{p/sebastian-lines-of-code/Exception/Exception.php~ctf~%>>sebastian-lines-of-code/Exception/IllogicalValuesException.phpctfr<sebastian-lines-of-code/Exception/NegativeValueException.phpctf&Ӥ6sebastian-lines-of-code/Exception/RuntimeException.phpctf)Ϲsebastian-lines-of-code/LICENSEctfbS~/sebastian-lines-of-code/LineCountingVisitor.phpctf\L'sebastian-lines-of-code/LinesOfCode.php ctf 3*sebastian-object-enumerator/Enumerator.phpctf9Ϥ)sebastian-object-enumerator/Exception.phpctfNo8sebastian-object-enumerator/InvalidArgumentException.phpctf(sebastian-object-reflector/Exception.phpctf}dS7sebastian-object-reflector/InvalidArgumentException.phpctf[a.sebastian-object-reflector/ObjectReflector.phpctfxA'sebastian-recursion-context/Context.phpGctfGW{)sebastian-recursion-context/Exception.phpctf8sebastian-recursion-context/InvalidArgumentException.phpctf#sebastian-recursion-context/LICENSEctfڤ%sebastian-resource-operations/LICENSEctf]<4sebastian-resource-operations/ResourceOperations.php(ctf(5sebastian-type/LICENSE ctf &.sebastian-type/Parameter.phpctf!#sebastian-type/ReflectionMapper.phpkctfk8sebastian-type/TypeName.php<ctf<ע&sebastian-type/exception/Exception.phpnctfnH3-sebastian-type/exception/RuntimeException.phpctf;s֤$sebastian-type/type/CallableType.phprctfrZ\!sebastian-type/type/FalseType.phpbctfbnޅ^)sebastian-type/type/GenericObjectType.php<ctf<W0V(sebastian-type/type/IntersectionType.php +ctf +a$sebastian-type/type/IterableType.phpctf"L!sebastian-type/type/MixedType.php&ctf&Ԥ!sebastian-type/type/NeverType.phpctfS sebastian-type/type/NullType.php!ctf!n6"sebastian-type/type/ObjectType.php\ctf\4Ax"sebastian-type/type/SimpleType.phpctf"sebastian-type/type/StaticType.phpctfb sebastian-type/type/TrueType.php]ctf]zsebastian-type/type/Type.phpctfKCl!sebastian-type/type/UnionType.php ctf U#sebastian-type/type/UnknownType.phpctfH sebastian-type/type/VoidType.phpctf[sebastian-version/LICENSEctfZsebastian-version/Version.phpctfVPMtheseer-tokenizer/Exception.phprctfrmtheseer-tokenizer/LICENSEctfR ("theseer-tokenizer/NamespaceUri.phpJctfJW]+theseer-tokenizer/NamespaceUriException.php}ctf}aՓtheseer-tokenizer/Token.phpctfK`¤%theseer-tokenizer/TokenCollection.phpctf rt.theseer-tokenizer/TokenCollectionException.phpctf5ɤtheseer-tokenizer/Tokenizer.php ctf !N#theseer-tokenizer/XMLSerializer.phpctfu(դwebmozart-assert/Assert.phpctfȮ7-webmozart-assert/InvalidArgumentException.phpfctff̈́webmozart-assert/LICENSE<ctf<t}webmozart-assert/Mixin.php2ctf2a춤.phpstorm.meta.phpctfO{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "2d5520e3988f11dc781b6d1aa926c23e", + "packages": [ + { + "name": "doctrine/deprecations", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + }, + "time": "2024-01-30T19:34:25+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:15:36+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.12.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2024-06-12T14:39:25+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.19.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.1" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" + }, + "time": "2024-03-17T08:10:35+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" + }, + "require-dev": { + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.8.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "153ae662783729388a584b4361f2545e4d841e3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", + "reference": "153ae662783729388a584b4361f2545e4d841e3c", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.3 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" + }, + "require-dev": { + "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" + }, + "time": "2024-02-23T11:10:43+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/67a759e7d8746d501c41536ba40cd9c0a07d6a87", + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2 || ^2.0", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0", + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0 || ^7.0", + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "dev", + "fake", + "mock", + "spy", + "stub" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.19.0" + }, + "time": "2024-02-29T11:52:51+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.29.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" + }, + "time": "2024-05-31T08:52:43+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.31", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:37:42+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:27:43+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:19:30+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:30:58+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:33:00+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:35:11+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:20:34+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:07:39+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-14T16:00:52+00:00" + }, + { + "name": "sebastian/type", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:13:03+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:36:25+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": "^7.2 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.11.0" + }, + "time": "2022-06-03T18:03:27+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": true, + "prefer-lowest": false, + "platform": { + "php": ">=7.3", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*" + }, + "platform-dev": [], + "platform-overrides": { + "php": "7.3.0" + }, + "plugin-api-version": "2.6.0" +} +|null */ + private static $type; + /** @var LoggerInterface|null */ + private static $logger; + /** @var array */ + private static $ignoredPackages = []; + /** @var array */ + private static $triggeredDeprecations = []; + /** @var array */ + private static $ignoredLinks = []; + /** @var bool */ + private static $deduplication = \true; + /** + * Trigger a deprecation for the given package and identfier. + * + * The link should point to a Github issue or Wiki entry detailing the + * deprecation. It is additionally used to de-duplicate the trigger of the + * same deprecation during a request. + * + * @param float|int|string $args + */ + public static function trigger(string $package, string $link, string $message, ...$args): void + { + $type = self::$type ?? self::getTypeFromEnv(); + if ($type === self::TYPE_NONE) { + return; + } + if (isset(self::$ignoredLinks[$link])) { + return; + } + if (array_key_exists($link, self::$triggeredDeprecations)) { + self::$triggeredDeprecations[$link]++; + } else { + self::$triggeredDeprecations[$link] = 1; + } + if (self::$deduplication === \true && self::$triggeredDeprecations[$link] > 1) { + return; + } + if (isset(self::$ignoredPackages[$package])) { + return; + } + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); + $message = sprintf($message, ...$args); + self::delegateTriggerToBackend($message, $backtrace, $link, $package); + } + /** + * Trigger a deprecation for the given package and identifier when called from outside. + * + * "Outside" means we assume that $package is currently installed as a + * dependency and the caller is not a file in that package. When $package + * is installed as a root package then deprecations triggered from the + * tests folder are also considered "outside". + * + * This deprecation method assumes that you are using Composer to install + * the dependency and are using the default /vendor/ folder and not a + * Composer plugin to change the install location. The assumption is also + * that $package is the exact composer packge name. + * + * Compared to {@link trigger()} this method causes some overhead when + * deprecation tracking is enabled even during deduplication, because it + * needs to call {@link debug_backtrace()} + * + * @param float|int|string $args + */ + public static function triggerIfCalledFromOutside(string $package, string $link, string $message, ...$args): void + { + $type = self::$type ?? self::getTypeFromEnv(); + if ($type === self::TYPE_NONE) { + return; + } + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); + // first check that the caller is not from a tests folder, in which case we always let deprecations pass + if (isset($backtrace[1]['file'], $backtrace[0]['file']) && strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === \false) { + $path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $package) . DIRECTORY_SEPARATOR; + if (strpos($backtrace[0]['file'], $path) === \false) { + return; + } + if (strpos($backtrace[1]['file'], $path) !== \false) { + return; + } + } + if (isset(self::$ignoredLinks[$link])) { + return; + } + if (array_key_exists($link, self::$triggeredDeprecations)) { + self::$triggeredDeprecations[$link]++; + } else { + self::$triggeredDeprecations[$link] = 1; + } + if (self::$deduplication === \true && self::$triggeredDeprecations[$link] > 1) { + return; + } + if (isset(self::$ignoredPackages[$package])) { + return; + } + $message = sprintf($message, ...$args); + self::delegateTriggerToBackend($message, $backtrace, $link, $package); + } + /** + * @param list $backtrace + */ + private static function delegateTriggerToBackend(string $message, array $backtrace, string $link, string $package): void + { + $type = self::$type ?? self::getTypeFromEnv(); + if (($type & self::TYPE_PSR_LOGGER) > 0) { + $context = ['file' => $backtrace[0]['file'] ?? null, 'line' => $backtrace[0]['line'] ?? null, 'package' => $package, 'link' => $link]; + assert(self::$logger !== null); + self::$logger->notice($message, $context); + } + if (!(($type & self::TYPE_TRIGGER_ERROR) > 0)) { + return; + } + $message .= sprintf(' (%s:%d called by %s:%d, %s, package %s)', self::basename($backtrace[0]['file'] ?? 'native code'), $backtrace[0]['line'] ?? 0, self::basename($backtrace[1]['file'] ?? 'native code'), $backtrace[1]['line'] ?? 0, $link, $package); + @trigger_error($message, E_USER_DEPRECATED); + } + /** + * A non-local-aware version of PHPs basename function. + */ + private static function basename(string $filename): string + { + $pos = strrpos($filename, DIRECTORY_SEPARATOR); + if ($pos === \false) { + return $filename; + } + return substr($filename, $pos + 1); + } + public static function enableTrackingDeprecations(): void + { + self::$type = self::$type ?? 0; + self::$type |= self::TYPE_TRACK_DEPRECATIONS; + } + public static function enableWithTriggerError(): void + { + self::$type = self::$type ?? 0; + self::$type |= self::TYPE_TRIGGER_ERROR; + } + public static function enableWithPsrLogger(LoggerInterface $logger): void + { + self::$type = self::$type ?? 0; + self::$type |= self::TYPE_PSR_LOGGER; + self::$logger = $logger; + } + public static function withoutDeduplication(): void + { + self::$deduplication = \false; + } + public static function disable(): void + { + self::$type = self::TYPE_NONE; + self::$logger = null; + self::$deduplication = \true; + self::$ignoredLinks = []; + foreach (self::$triggeredDeprecations as $link => $count) { + self::$triggeredDeprecations[$link] = 0; + } + } + public static function ignorePackage(string $packageName): void + { + self::$ignoredPackages[$packageName] = \true; + } + public static function ignoreDeprecations(string ...$links): void + { + foreach ($links as $link) { + self::$ignoredLinks[$link] = \true; + } + } + public static function getUniqueTriggeredDeprecationsCount(): int + { + return array_reduce(self::$triggeredDeprecations, static function (int $carry, int $count) { + return $carry + $count; + }, 0); + } + /** + * Returns each triggered deprecation link identifier and the amount of occurrences. + * + * @return array + */ + public static function getTriggeredDeprecations(): array + { + return self::$triggeredDeprecations; + } + /** + * @return int-mask-of + */ + private static function getTypeFromEnv(): int + { + switch ($_SERVER['DOCTRINE_DEPRECATIONS'] ?? $_ENV['DOCTRINE_DEPRECATIONS'] ?? null) { + case 'trigger': + self::$type = self::TYPE_TRIGGER_ERROR; + break; + case 'track': + self::$type = self::TYPE_TRACK_DEPRECATIONS; + break; + default: + self::$type = self::TYPE_NONE; + break; + } + return self::$type; + } +} + */ + private $doctrineDeprecationsExpectations = []; + /** @var array */ + private $doctrineNoDeprecationsExpectations = []; + public function expectDeprecationWithIdentifier(string $identifier): void + { + $this->doctrineDeprecationsExpectations[$identifier] = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0; + } + public function expectNoDeprecationWithIdentifier(string $identifier): void + { + $this->doctrineNoDeprecationsExpectations[$identifier] = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0; + } + /** + * @before + */ + public function enableDeprecationTracking(): void + { + Deprecation::enableTrackingDeprecations(); + } + /** + * @after + */ + public function verifyDeprecationsAreTriggered(): void + { + foreach ($this->doctrineDeprecationsExpectations as $identifier => $expectation) { + $actualCount = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0; + $this->assertTrue($actualCount > $expectation, sprintf("Expected deprecation with identifier '%s' was not triggered by code executed in test.", $identifier)); + } + foreach ($this->doctrineNoDeprecationsExpectations as $identifier => $expectation) { + $actualCount = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0; + $this->assertTrue($actualCount === $expectation, sprintf("Expected deprecation with identifier '%s' was triggered by code executed in test, but expected not to.", $identifier)); + } + } +} +Copyright (c) 2020-2021 Doctrine Project + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +getName())); } - public static function fromEnum(string $className) : self + public static function fromEnum(string $className): self { return new self(sprintf('The provided class "%s" is an enum, and cannot be instantiated', $className)); } } getName()), 0, $exception); } @@ -2492,19 +5043,19 @@ class UnexpectedValueException extends BaseUnexpectedValueException implements E * * @template T of object */ - public static function fromUncleanUnSerialization(ReflectionClass $reflectionClass, string $errorString, int $errorCode, string $errorFile, int $errorLine) : self + public static function fromUncleanUnSerialization(ReflectionClass $reflectionClass, string $errorString, int $errorCode, string $errorFile, int $errorLine): self { return new self(sprintf('Could not produce an instance of "%s" via un-serialization, since an error was triggered ' . 'in file "%s" at line "%d"', $reflectionClass->getName(), $errorFile, $errorLine), 0, new Exception($errorString, $errorCode)); } } getReflectionClass($className); if ($this->isInstantiableViaReflection($reflectionClass)) { @@ -2607,7 +5158,7 @@ final class Instantiator implements InstantiatorInterface } $serializedString = sprintf('%s:%d:"%s":0:{}', is_subclass_of($className, Serializable::class) ? self::SERIALIZATION_FORMAT_USE_UNSERIALIZER : self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER, strlen($className), $className); $this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString); - return static function () use($serializedString) { + return static function () use ($serializedString) { return unserialize($serializedString); }; } @@ -2621,7 +5172,7 @@ final class Instantiator implements InstantiatorInterface * * @template T of object */ - private function getReflectionClass(string $className) : ReflectionClass + private function getReflectionClass(string $className): ReflectionClass { if (!class_exists($className)) { throw InvalidArgumentException::fromNonExistingClass($className); @@ -2642,9 +5193,9 @@ final class Instantiator implements InstantiatorInterface * * @template T of object */ - private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, string $serializedString) : void + private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, string $serializedString): void { - set_error_handler(static function (int $code, string $message, string $file, int $line) use($reflectionClass, &$error) : bool { + set_error_handler(static function (int $code, string $message, string $file, int $line) use ($reflectionClass, &$error): bool { $error = UnexpectedValueException::fromUncleanUnSerialization($reflectionClass, $message, $code, $file, $line); return \true; }); @@ -2664,7 +5215,7 @@ final class Instantiator implements InstantiatorInterface * * @template T of object */ - private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, string $serializedString) : void + private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, string $serializedString): void { try { unserialize($serializedString); @@ -2677,7 +5228,7 @@ final class Instantiator implements InstantiatorInterface * * @template T of object */ - private function isInstantiableViaReflection(ReflectionClass $reflectionClass) : bool + private function isInstantiableViaReflection(ReflectionClass $reflectionClass): bool { return !($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal()); } @@ -2688,7 +5239,7 @@ final class Instantiator implements InstantiatorInterface * * @template T of object */ - private function hasInternalAncestors(ReflectionClass $reflectionClass) : bool + private function hasInternalAncestors(ReflectionClass $reflectionClass): bool { do { if ($reflectionClass->isInternal()) { @@ -2707,16 +5258,16 @@ final class Instantiator implements InstantiatorInterface * * @template T of object */ - private function isSafeToClone(ReflectionClass $reflectionClass) : bool + private function isSafeToClone(ReflectionClass $reflectionClass): bool { return $reflectionClass->isCloneable() && !$reflectionClass->hasMethod('__clone') && !$reflectionClass->isSubclassOf(ArrayIterator::class); } } filters, ['matcher' => $matcher, 'filter' => $filter]); + array_unshift($this->filters, ['matcher' => $matcher, 'filter' => $filter]); } public function addTypeFilter(TypeFilter $filter, TypeMatcher $matcher) { @@ -2891,19 +5444,19 @@ class DeepCopy return $filter->apply($var); } // Resource - if (\is_resource($var)) { + if (is_resource($var)) { return $var; } // Array - if (\is_array($var)) { + if (is_array($var)) { return $this->copyArray($var); } // Scalar - if (!\is_object($var)) { + if (!is_object($var)) { return $var; } // Enum - if (\PHP_VERSION_ID >= 80100 && \enum_exists(\get_class($var))) { + if (\PHP_VERSION_ID >= 80100 && enum_exists(get_class($var))) { return $var; } // Object @@ -2932,7 +5485,7 @@ class DeepCopy */ private function copyObject($object) { - $objectHash = \spl_object_hash($object); + $objectHash = spl_object_hash($object); if (isset($this->hashMap[$objectHash])) { return $this->hashMap[$objectHash]; } @@ -2943,7 +5496,7 @@ class DeepCopy $this->hashMap[$objectHash] = $object; return $object; } - throw new CloneException(\sprintf('The class "%s" is not cloneable.', $reflectedObject->getName())); + throw new CloneException(sprintf('The class "%s" is not cloneable.', $reflectedObject->getName())); } $newObject = clone $object; $this->hashMap[$objectHash] = $newObject; @@ -2964,6 +5517,10 @@ class DeepCopy if ($property->isStatic()) { return; } + // Ignore readonly properties + if (method_exists($property, 'isReadOnly') && $property->isReadOnly()) { + return; + } // Apply the filters foreach ($this->filters as $item) { /** @var Matcher $matcher */ @@ -2983,7 +5540,7 @@ class DeepCopy } $property->setAccessible(\true); // Ignore uninitialized properties (for PHP >7.4) - if (\method_exists($property, 'isInitialized') && !$property->isInitialized($object)) { + if (method_exists($property, 'isInitialized') && !$property->isInitialized($object)) { return; } $propertyValue = $property->getValue($object); @@ -3001,7 +5558,7 @@ class DeepCopy */ private function getFirstMatchedTypeFilter(array $filterRecords, $var) { - $matched = $this->first($filterRecords, function (array $record) use($var) { + $matched = $this->first($filterRecords, function (array $record) use ($var) { /* @var TypeMatcher $matcher */ $matcher = $record['matcher']; return $matcher->matches($var); @@ -3020,7 +5577,7 @@ class DeepCopy private function first(array $elements, callable $predicate) { foreach ($elements as $element) { - if (\call_user_func($predicate, $element)) { + if (call_user_func($predicate, $element)) { return $element; } } @@ -3029,7 +5586,7 @@ class DeepCopy } setAccessible(\true); $oldCollection = $reflectionProperty->getValue($object); - $newCollection = $oldCollection->map(function ($item) use($objectCopier) { + $newCollection = $oldCollection->map(function ($item) use ($objectCopier) { return $objectCopier($item); }); $reflectionProperty->setValue($object, $newCollection); @@ -3094,11 +5651,11 @@ class DoctrineCollectionFilter implements Filter } setAccessible(\true); - $value = \call_user_func($this->callback, $reflectionProperty->getValue($object)); + $value = call_user_func($this->callback, $reflectionProperty->getValue($object)); $reflectionProperty->setValue($object, $value); } } setAccessible(\true); // Uninitialized properties (for PHP >7.4) - if (\method_exists($reflectionProperty, 'isInitialized') && !$reflectionProperty->isInitialized($object)) { + if (method_exists($reflectionProperty, 'isInitialized') && !$reflectionProperty->isInitialized($object)) { // null instanceof $this->propertyType return \false; } @@ -3378,9 +5935,9 @@ class PropertyTypeMatcher implements Matcher } hasProperty($name)) { return $reflection->getProperty($name); } if ($parentClass = $reflection->getParentClass()) { return self::getProperty($parentClass->getName(), $name); } - throw new PropertyException(\sprintf('The class "%s" doesn\'t have a property with the given name: "%s".', \is_object($object) ? \get_class($object) : $object, $name)); + throw new PropertyException(sprintf('The class "%s" doesn\'t have a property with the given name: "%s".', is_object($object) ? get_class($object) : $object, $name)); } } callback, $element); + return call_user_func($this->callback, $element); } } copier; - $copy = function (SplDoublyLinkedList $list) use($copier) { + $copy = function (SplDoublyLinkedList $list) use ($copier) { // Replace each element in the list with a deep copy of itself for ($i = 1; $i <= $list->count(); $i++) { $copy = $copier->recursiveCopy($list->shift()); @@ -3598,7 +6155,7 @@ class SplDoublyLinkedListFilter implements TypeFilter } type) : \gettype($element) === $this->type; + return is_object($element) ? is_a($element, $this->type) : (gettype($element) === $this->type); } } constants, $this->flags, $this->attributes, $this->attributeGroups, $this->type); } @@ -3850,13 +6407,13 @@ class ClassConst implements PhpParser\Builder &$this->uses, Stmt\ClassConst::class => &$this->constants, Stmt\Property::class => &$this->properties, Stmt\ClassMethod::class => &$this->methods]; $class = \get_class($stmt); if (!isset($targets[$class])) { - throw new \LogicException(\sprintf('Unexpected node of type "%s"', $stmt->getType())); + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); } $targets[$class][] = $stmt; return $this; @@ -3964,22 +6521,22 @@ class Class_ extends Declaration * * @return Stmt\Class_ The built class node */ - public function getNode() : PhpParser\Node + public function getNode(): PhpParser\Node { - return new Stmt\Class_($this->name, ['flags' => $this->flags, 'extends' => $this->extends, 'implements' => $this->implements, 'stmts' => \array_merge($this->uses, $this->constants, $this->properties, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); + return new Stmt\Class_($this->name, ['flags' => $this->flags, 'extends' => $this->extends, 'implements' => $this->implements, 'stmts' => array_merge($this->uses, $this->constants, $this->properties, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); } } name, $this->value, $this->attributeGroups, $this->attributes); } @@ -4082,14 +6639,14 @@ class EnumCase implements PhpParser\Builder &$this->uses, Stmt\EnumCase::class => &$this->enumCases, Stmt\ClassConst::class => &$this->constants, Stmt\ClassMethod::class => &$this->methods]; $class = \get_class($stmt); if (!isset($targets[$class])) { - throw new \LogicException(\sprintf('Unexpected node of type "%s"', $stmt->getType())); + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); } $targets[$class][] = $stmt; return $this; @@ -4171,18 +6728,18 @@ class Enum_ extends Declaration * * @return Stmt\Enum_ The built enum node */ - public function getNode() : PhpParser\Node + public function getNode(): PhpParser\Node { - return new Stmt\Enum_($this->name, ['scalarType' => $this->scalarType, 'implements' => $this->implements, 'stmts' => \array_merge($this->uses, $this->enumCases, $this->constants, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); + return new Stmt\Enum_($this->name, ['scalarType' => $this->scalarType, 'implements' => $this->implements, 'stmts' => array_merge($this->uses, $this->enumCases, $this->constants, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); } } getType())); + throw new \LogicException(sprintf('Expected parameter node, got "%s"', $param->getType())); } $this->params[] = $param; return $this; @@ -4245,12 +6802,12 @@ abstract class FunctionLike extends Declaration name, ['byRef' => $this->returnByRef, 'params' => $this->params, 'returnType' => $this->returnType, 'stmts' => $this->stmts, 'attrGroups' => $this->attributeGroups], $this->attributes); } @@ -4303,13 +6860,13 @@ class Function_ extends FunctionLike stmts = null; $this->methods[] = $stmt; } else { - throw new \LogicException(\sprintf('Unexpected node of type "%s"', $stmt->getType())); + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); } return $this; } @@ -4379,20 +6936,20 @@ class Interface_ extends Declaration * * @return Stmt\Interface_ The built interface node */ - public function getNode() : PhpParser\Node + public function getNode(): PhpParser\Node { - return new Stmt\Interface_($this->name, ['extends' => $this->extends, 'stmts' => \array_merge($this->constants, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); + return new Stmt\Interface_($this->name, ['extends' => $this->extends, 'stmts' => array_merge($this->constants, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); } } name, ['flags' => $this->flags, 'byRef' => $this->returnByRef, 'params' => $this->params, 'returnType' => $this->returnType, 'stmts' => $this->stmts, 'attrGroups' => $this->attributeGroups], $this->attributes); } @@ -4515,12 +7072,12 @@ class Method extends FunctionLike name = null !== $name ? BuilderHelpers::normalizeName($name) : null; + $this->name = (null !== $name) ? BuilderHelpers::normalizeName($name) : null; } /** * Adds a statement. @@ -4551,7 +7108,7 @@ class Namespace_ extends Declaration * * @return Stmt\Namespace_ The built node */ - public function getNode() : Node + public function getNode(): Node { return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes); } @@ -4559,11 +7116,11 @@ class Namespace_ extends Declaration name), $this->default, $this->type, $this->byRef, $this->variadic, [], $this->flags, $this->attributeGroups); } @@ -4709,15 +7266,15 @@ class Param implements PhpParser\Builder flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC, [new Stmt\PropertyProperty($this->name, $this->default)], $this->attributes, $this->type, $this->attributeGroups); + return new Stmt\Property(($this->flags !== 0) ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC, [new Stmt\PropertyProperty($this->name, $this->default)], $this->attributes, $this->type, $this->attributeGroups); } } traits, $this->adaptations); } @@ -4910,12 +7467,12 @@ class TraitUse implements Builder type = self::TYPE_UNDEFINED; - $this->trait = \is_null($trait) ? null : BuilderHelpers::normalizeName($trait); + $this->trait = is_null($trait) ? null : BuilderHelpers::normalizeName($trait); $this->method = BuilderHelpers::normalizeIdentifier($method); } /** @@ -4998,7 +7555,7 @@ class TraitUseAdaptation implements Builder public function insteadof(...$traits) { if ($this->type === self::TYPE_UNDEFINED) { - if (\is_null($this->trait)) { + if (is_null($this->trait)) { throw new \LogicException('Precedence adaptation must have trait'); } $this->type = self::TYPE_PRECEDENCE; @@ -5019,7 +7576,7 @@ class TraitUseAdaptation implements Builder if ($this->type !== self::TYPE_ALIAS) { throw new \LogicException('Cannot set access modifier for not alias adaptation buider'); } - if (\is_null($this->modifier)) { + if (is_null($this->modifier)) { $this->modifier = $modifier; } else { throw new \LogicException('Multiple access type modifiers are not allowed'); @@ -5030,7 +7587,7 @@ class TraitUseAdaptation implements Builder * * @return Node The built node */ - public function getNode() : Node + public function getNode(): Node { switch ($this->type) { case self::TYPE_ALIAS: @@ -5045,12 +7602,12 @@ class TraitUseAdaptation implements Builder uses[] = $stmt; } else { - throw new \LogicException(\sprintf('Unexpected node of type "%s"', $stmt->getType())); + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); } return $this; } @@ -5106,20 +7663,20 @@ class Trait_ extends Declaration * * @return Stmt\Trait_ The built interface node */ - public function getNode() : PhpParser\Node + public function getNode(): PhpParser\Node { - return new Stmt\Trait_($this->name, ['stmts' => \array_merge($this->uses, $this->properties, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); + return new Stmt\Trait_($this->name, ['stmts' => array_merge($this->uses, $this->properties, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); } } name, $this->alias)], $this->type); } @@ -5161,15 +7718,15 @@ class Use_ implements Builder args($args)); } @@ -5191,7 +7748,7 @@ class BuilderFactory * * @return Builder\Namespace_ The created namespace builder */ - public function namespace($name) : Builder\Namespace_ + public function namespace($name): Builder\Namespace_ { return new Builder\Namespace_($name); } @@ -5202,7 +7759,7 @@ class BuilderFactory * * @return Builder\Class_ The created class builder */ - public function class(string $name) : Builder\Class_ + public function class(string $name): Builder\Class_ { return new Builder\Class_($name); } @@ -5213,7 +7770,7 @@ class BuilderFactory * * @return Builder\Interface_ The created interface builder */ - public function interface(string $name) : Builder\Interface_ + public function interface(string $name): Builder\Interface_ { return new Builder\Interface_($name); } @@ -5224,7 +7781,7 @@ class BuilderFactory * * @return Builder\Trait_ The created trait builder */ - public function trait(string $name) : Builder\Trait_ + public function trait(string $name): Builder\Trait_ { return new Builder\Trait_($name); } @@ -5235,7 +7792,7 @@ class BuilderFactory * * @return Builder\Enum_ The created enum builder */ - public function enum(string $name) : Builder\Enum_ + public function enum(string $name): Builder\Enum_ { return new Builder\Enum_($name); } @@ -5246,7 +7803,7 @@ class BuilderFactory * * @return Builder\TraitUse The create trait use builder */ - public function useTrait(...$traits) : Builder\TraitUse + public function useTrait(...$traits): Builder\TraitUse { return new Builder\TraitUse(...$traits); } @@ -5258,7 +7815,7 @@ class BuilderFactory * * @return Builder\TraitUseAdaptation The create trait use adaptation builder */ - public function traitUseAdaptation($trait, $method = null) : Builder\TraitUseAdaptation + public function traitUseAdaptation($trait, $method = null): Builder\TraitUseAdaptation { if ($method === null) { $method = $trait; @@ -5273,7 +7830,7 @@ class BuilderFactory * * @return Builder\Method The created method builder */ - public function method(string $name) : Builder\Method + public function method(string $name): Builder\Method { return new Builder\Method($name); } @@ -5284,7 +7841,7 @@ class BuilderFactory * * @return Builder\Param The created parameter builder */ - public function param(string $name) : Builder\Param + public function param(string $name): Builder\Param { return new Builder\Param($name); } @@ -5295,7 +7852,7 @@ class BuilderFactory * * @return Builder\Property The created property builder */ - public function property(string $name) : Builder\Property + public function property(string $name): Builder\Property { return new Builder\Property($name); } @@ -5306,7 +7863,7 @@ class BuilderFactory * * @return Builder\Function_ The created function builder */ - public function function(string $name) : Builder\Function_ + public function function(string $name): Builder\Function_ { return new Builder\Function_($name); } @@ -5317,7 +7874,7 @@ class BuilderFactory * * @return Builder\Use_ The created use builder */ - public function use($name) : Builder\Use_ + public function use($name): Builder\Use_ { return new Builder\Use_($name, Use_::TYPE_NORMAL); } @@ -5328,7 +7885,7 @@ class BuilderFactory * * @return Builder\Use_ The created use function builder */ - public function useFunction($name) : Builder\Use_ + public function useFunction($name): Builder\Use_ { return new Builder\Use_($name, Use_::TYPE_FUNCTION); } @@ -5339,7 +7896,7 @@ class BuilderFactory * * @return Builder\Use_ The created use const builder */ - public function useConst($name) : Builder\Use_ + public function useConst($name): Builder\Use_ { return new Builder\Use_($name, Use_::TYPE_CONSTANT); } @@ -5351,7 +7908,7 @@ class BuilderFactory * * @return Builder\ClassConst The created use const builder */ - public function classConst($name, $value) : Builder\ClassConst + public function classConst($name, $value): Builder\ClassConst { return new Builder\ClassConst($name, $value); } @@ -5362,7 +7919,7 @@ class BuilderFactory * * @return Builder\EnumCase The created use const builder */ - public function enumCase($name) : Builder\EnumCase + public function enumCase($name): Builder\EnumCase { return new Builder\EnumCase($name); } @@ -5373,7 +7930,7 @@ class BuilderFactory * * @return Expr */ - public function val($value) : Expr + public function val($value): Expr { return BuilderHelpers::normalizeValue($value); } @@ -5384,7 +7941,7 @@ class BuilderFactory * * @return Expr\Variable */ - public function var($name) : Expr\Variable + public function var($name): Expr\Variable { if (!\is_string($name) && !$name instanceof Expr) { throw new \LogicException('Variable name must be string or Expr'); @@ -5400,7 +7957,7 @@ class BuilderFactory * * @return Arg[] */ - public function args(array $args) : array + public function args(array $args): array { $normalizedArgs = []; foreach ($args as $key => $arg) { @@ -5422,7 +7979,7 @@ class BuilderFactory * * @return Expr\FuncCall */ - public function funcCall($name, array $args = []) : Expr\FuncCall + public function funcCall($name, array $args = []): Expr\FuncCall { return new Expr\FuncCall(BuilderHelpers::normalizeNameOrExpr($name), $this->args($args)); } @@ -5435,7 +7992,7 @@ class BuilderFactory * * @return Expr\MethodCall */ - public function methodCall(Expr $var, $name, array $args = []) : Expr\MethodCall + public function methodCall(Expr $var, $name, array $args = []): Expr\MethodCall { return new Expr\MethodCall($var, BuilderHelpers::normalizeIdentifierOrExpr($name), $this->args($args)); } @@ -5448,7 +8005,7 @@ class BuilderFactory * * @return Expr\StaticCall */ - public function staticCall($class, $name, array $args = []) : Expr\StaticCall + public function staticCall($class, $name, array $args = []): Expr\StaticCall { return new Expr\StaticCall(BuilderHelpers::normalizeNameOrExpr($class), BuilderHelpers::normalizeIdentifierOrExpr($name), $this->args($args)); } @@ -5460,7 +8017,7 @@ class BuilderFactory * * @return Expr\New_ */ - public function new($class, array $args = []) : Expr\New_ + public function new($class, array $args = []): Expr\New_ { return new Expr\New_(BuilderHelpers::normalizeNameOrExpr($class), $this->args($args)); } @@ -5471,7 +8028,7 @@ class BuilderFactory * * @return Expr\ConstFetch */ - public function constFetch($name) : Expr\ConstFetch + public function constFetch($name): Expr\ConstFetch { return new Expr\ConstFetch(BuilderHelpers::normalizeName($name)); } @@ -5483,7 +8040,7 @@ class BuilderFactory * * @return Expr\PropertyFetch */ - public function propertyFetch(Expr $var, $name) : Expr\PropertyFetch + public function propertyFetch(Expr $var, $name): Expr\PropertyFetch { return new Expr\PropertyFetch($var, BuilderHelpers::normalizeIdentifierOrExpr($name)); } @@ -5495,7 +8052,7 @@ class BuilderFactory * * @return Expr\ClassConstFetch */ - public function classConstFetch($class, $name) : Expr\ClassConstFetch + public function classConstFetch($class, $name): Expr\ClassConstFetch { return new Expr\ClassConstFetch(BuilderHelpers::normalizeNameOrExpr($class), BuilderHelpers::normalizeIdentifierOrExpr($name)); } @@ -5506,9 +8063,9 @@ class BuilderFactory * * @return Concat */ - public function concat(...$exprs) : Concat + public function concat(...$exprs): Concat { - $numExprs = \count($exprs); + $numExprs = count($exprs); if ($numExprs < 2) { throw new \LogicException('Expected at least two expressions'); } @@ -5522,7 +8079,7 @@ class BuilderFactory * @param string|Expr $expr * @return Expr */ - private function normalizeStringExpr($expr) : Expr + private function normalizeStringExpr($expr): Expr { if ($expr instanceof Expr) { return $expr; @@ -5536,15 +8093,15 @@ class BuilderFactory getNode(); @@ -5578,7 +8135,7 @@ final class BuilderHelpers * * @return Stmt The normalized statement node */ - public static function normalizeStmt($node) : Stmt + public static function normalizeStmt($node): Stmt { $node = self::normalizeNode($node); if ($node instanceof Stmt) { @@ -5596,7 +8153,7 @@ final class BuilderHelpers * * @return Identifier The normalized identifier */ - public static function normalizeIdentifier($name) : Identifier + public static function normalizeIdentifier($name): Identifier { if ($name instanceof Identifier) { return $name; @@ -5604,7 +8161,7 @@ final class BuilderHelpers if (\is_string($name)) { return new Identifier($name); } - throw new \LogicException('Expected string or instance of Node\\Identifier'); + throw new \LogicException('Expected string or instance of Node\Identifier'); } /** * Normalizes strings to Identifier, also allowing expressions. @@ -5621,7 +8178,7 @@ final class BuilderHelpers if (\is_string($name)) { return new Identifier($name); } - throw new \LogicException('Expected string or instance of Node\\Identifier or Node\\Expr'); + throw new \LogicException('Expected string or instance of Node\Identifier or Node\Expr'); } /** * Normalizes a name: Converts string names to Name nodes. @@ -5630,24 +8187,24 @@ final class BuilderHelpers * * @return Name The normalized name */ - public static function normalizeName($name) : Name + public static function normalizeName($name): Name { if ($name instanceof Name) { return $name; } - if (\is_string($name)) { + if (is_string($name)) { if (!$name) { throw new \LogicException('Name cannot be empty'); } if ($name[0] === '\\') { - return new Name\FullyQualified(\substr($name, 1)); + return new Name\FullyQualified(substr($name, 1)); } - if (0 === \strpos($name, 'namespace\\')) { - return new Name\Relative(\substr($name, \strlen('namespace\\'))); + if (0 === strpos($name, 'namespace\\')) { + return new Name\Relative(substr($name, strlen('namespace\\'))); } return new Name($name); } - throw new \LogicException('Name must be a string or an instance of Node\\Name'); + throw new \LogicException('Name must be a string or an instance of Node\Name'); } /** * Normalizes a name: Converts string names to Name nodes, while also allowing expressions. @@ -5661,8 +8218,8 @@ final class BuilderHelpers if ($name instanceof Expr) { return $name; } - if (!\is_string($name) && !$name instanceof Name) { - throw new \LogicException('Name must be a string or an instance of Node\\Name or Node\\Expr'); + if (!is_string($name) && !$name instanceof Name) { + throw new \LogicException('Name must be a string or an instance of Node\Name or Node\Expr'); } return self::normalizeName($name); } @@ -5678,27 +8235,27 @@ final class BuilderHelpers */ public static function normalizeType($type) { - if (!\is_string($type)) { + if (!is_string($type)) { if (!$type instanceof Name && !$type instanceof Identifier && !$type instanceof ComplexType) { throw new \LogicException('Type must be a string, or an instance of Name, Identifier or ComplexType'); } return $type; } $nullable = \false; - if (\strlen($type) > 0 && $type[0] === '?') { + if (strlen($type) > 0 && $type[0] === '?') { $nullable = \true; - $type = \substr($type, 1); + $type = substr($type, 1); } $builtinTypes = ['array', 'callable', 'bool', 'int', 'float', 'string', 'iterable', 'void', 'object', 'null', 'false', 'mixed', 'never', 'true']; - $lowerType = \strtolower($type); - if (\in_array($lowerType, $builtinTypes)) { + $lowerType = strtolower($type); + if (in_array($lowerType, $builtinTypes)) { $type = new Identifier($lowerType); } else { $type = self::normalizeName($type); } $notNullableTypes = ['void', 'mixed', 'never']; - if ($nullable && \in_array((string) $type, $notNullableTypes)) { - throw new \LogicException(\sprintf('%s type cannot be nullable', $type)); + if ($nullable && in_array((string) $type, $notNullableTypes)) { + throw new \LogicException(sprintf('%s type cannot be nullable', $type)); } return $nullable ? new NullableType($type) : $type; } @@ -5710,27 +8267,27 @@ final class BuilderHelpers * * @return Expr The normalized value */ - public static function normalizeValue($value) : Expr + public static function normalizeValue($value): Expr { if ($value instanceof Node\Expr) { return $value; } - if (\is_null($value)) { + if (is_null($value)) { return new Expr\ConstFetch(new Name('null')); } - if (\is_bool($value)) { + if (is_bool($value)) { return new Expr\ConstFetch(new Name($value ? 'true' : 'false')); } - if (\is_int($value)) { + if (is_int($value)) { return new Scalar\LNumber($value); } - if (\is_float($value)) { + if (is_float($value)) { return new Scalar\DNumber($value); } - if (\is_string($value)) { + if (is_string($value)) { return new Scalar\String_($value); } - if (\is_array($value)) { + if (is_array($value)) { $items = []; $lastKey = -1; foreach ($value as $itemKey => $itemValue) { @@ -5753,15 +8310,15 @@ final class BuilderHelpers * * @return Comment\Doc The normalized doc comment */ - public static function normalizeDocComment($docComment) : Comment\Doc + public static function normalizeDocComment($docComment): Comment\Doc { if ($docComment instanceof Comment\Doc) { return $docComment; } - if (\is_string($docComment)) { + if (is_string($docComment)) { return new Comment\Doc($docComment); } - throw new \LogicException('Doc comment must be a string or an instance of PhpParser\\Comment\\Doc'); + throw new \LogicException('Doc comment must be a string or an instance of PhpParser\Comment\Doc'); } /** * Normalizes a attribute: Converts attribute to the Attribute Group if needed. @@ -5770,13 +8327,13 @@ final class BuilderHelpers * * @return Node\AttributeGroup The Attribute Group */ - public static function normalizeAttribute($attribute) : Node\AttributeGroup + public static function normalizeAttribute($attribute): Node\AttributeGroup { if ($attribute instanceof Node\AttributeGroup) { return $attribute; } if (!$attribute instanceof Node\Attribute) { - throw new \LogicException('Attribute must be an instance of PhpParser\\Node\\Attribute or PhpParser\\Node\\AttributeGroup'); + throw new \LogicException('Attribute must be an instance of PhpParser\Node\Attribute or PhpParser\Node\AttributeGroup'); } return new Node\AttributeGroup([$attribute]); } @@ -5788,7 +8345,7 @@ final class BuilderHelpers * * @return int New modifiers */ - public static function addModifier(int $modifiers, int $modifier) : int + public static function addModifier(int $modifiers, int $modifier): int { Stmt\Class_::verifyModifier($modifiers, $modifier); return $modifiers | $modifier; @@ -5797,7 +8354,7 @@ final class BuilderHelpers * Adds a modifier and returns new modifier bitmask. * @return int New modifiers */ - public static function addClassModifier(int $existingModifiers, int $modifierToSet) : int + public static function addClassModifier(int $existingModifiers, int $modifierToSet): int { Stmt\Class_::verifyClassModifier($existingModifiers, $modifierToSet); return $existingModifiers | $modifierToSet; @@ -5806,7 +8363,7 @@ final class BuilderHelpers text; } @@ -5849,7 +8406,7 @@ class Comment implements \JsonSerializable * * @return int Line number (or -1 if not available) */ - public function getStartLine() : int + public function getStartLine(): int { return $this->startLine; } @@ -5858,7 +8415,7 @@ class Comment implements \JsonSerializable * * @return int File offset (or -1 if not available) */ - public function getStartFilePos() : int + public function getStartFilePos(): int { return $this->startFilePos; } @@ -5867,7 +8424,7 @@ class Comment implements \JsonSerializable * * @return int Token offset (or -1 if not available) */ - public function getStartTokenPos() : int + public function getStartTokenPos(): int { return $this->startTokenPos; } @@ -5876,7 +8433,7 @@ class Comment implements \JsonSerializable * * @return int Line number (or -1 if not available) */ - public function getEndLine() : int + public function getEndLine(): int { return $this->endLine; } @@ -5885,7 +8442,7 @@ class Comment implements \JsonSerializable * * @return int File offset (or -1 if not available) */ - public function getEndFilePos() : int + public function getEndFilePos(): int { return $this->endFilePos; } @@ -5894,7 +8451,7 @@ class Comment implements \JsonSerializable * * @return int Token offset (or -1 if not available) */ - public function getEndTokenPos() : int + public function getEndTokenPos(): int { return $this->endTokenPos; } @@ -5905,7 +8462,7 @@ class Comment implements \JsonSerializable * * @return int Line number */ - public function getLine() : int + public function getLine(): int { return $this->startLine; } @@ -5916,7 +8473,7 @@ class Comment implements \JsonSerializable * * @return int File offset */ - public function getFilePos() : int + public function getFilePos(): int { return $this->startFilePos; } @@ -5927,7 +8484,7 @@ class Comment implements \JsonSerializable * * @return int Token offset */ - public function getTokenPos() : int + public function getTokenPos(): int { return $this->startTokenPos; } @@ -5936,7 +8493,7 @@ class Comment implements \JsonSerializable * * @return string The comment text (including comment delimiters like /*) */ - public function __toString() : string + public function __toString(): string { return $this->text; } @@ -5952,12 +8509,12 @@ class Comment implements \JsonSerializable */ public function getReformattedText() { - $text = \trim($this->text); - $newlinePos = \strpos($text, "\n"); + $text = trim($this->text); + $newlinePos = strpos($text, "\n"); if (\false === $newlinePos) { // Single line comments don't need further processing return $text; - } elseif (\preg_match('((*BSR_ANYCRLF)(*ANYCRLF)^.*(?:\\R\\s+\\*.*)+$)', $text)) { + } elseif (preg_match('((*BSR_ANYCRLF)(*ANYCRLF)^.*(?:\R\s+\*.*)+$)', $text)) { // Multi line comment of the type // // /* @@ -5966,8 +8523,8 @@ class Comment implements \JsonSerializable // */ // // is handled by replacing the whitespace sequences before the * by a single space - return \preg_replace('(^\\s+\\*)m', ' *', $this->text); - } elseif (\preg_match('(^/\\*\\*?\\s*[\\r\\n])', $text) && \preg_match('(\\n(\\s*)\\*/$)', $text, $matches)) { + return preg_replace('(^\s+\*)m', ' *', $this->text); + } elseif (preg_match('(^/\*\*?\s*[\r\n])', $text) && preg_match('(\n(\s*)\*/$)', $text, $matches)) { // Multi line comment of the type // // /* @@ -5978,8 +8535,8 @@ class Comment implements \JsonSerializable // is handled by removing the whitespace sequence on the line before the closing // */ on all lines. So if the last line is " */", then " " is removed at the // start of all lines. - return \preg_replace('(^' . \preg_quote($matches[1]) . ')m', '', $text); - } elseif (\preg_match('(^/\\*\\*?\\s*(?!\\s))', $text, $matches)) { + return preg_replace('(^' . preg_quote($matches[1]) . ')m', '', $text); + } elseif (preg_match('(^/\*\*?\s*(?!\s))', $text, $matches)) { // Multi line comment of the type // // /* Some text. @@ -5989,9 +8546,9 @@ class Comment implements \JsonSerializable // // is handled by removing the difference between the shortest whitespace prefix on all // lines and the length of the "/* " opening sequence. - $prefixLen = $this->getShortestWhitespacePrefixLen(\substr($text, $newlinePos + 1)); - $removeLen = $prefixLen - \strlen($matches[0]); - return \preg_replace('(^\\s{' . $removeLen . '})m', '', $text); + $prefixLen = $this->getShortestWhitespacePrefixLen(substr($text, $newlinePos + 1)); + $removeLen = $prefixLen - strlen($matches[0]); + return preg_replace('(^\s{' . $removeLen . '})m', '', $text); } // No idea how to format this comment, so simply return as is return $text; @@ -6004,13 +8561,13 @@ class Comment implements \JsonSerializable * @param string $str String to check * @return int Length in characters. Tabs count as single characters. */ - private function getShortestWhitespacePrefixLen(string $str) : int + private function getShortestWhitespacePrefixLen(string $str): int { - $lines = \explode("\n", $str); + $lines = explode("\n", $str); $shortestPrefixLen = \INF; foreach ($lines as $line) { - \preg_match('(^\\s*)', $line, $matches); - $prefixLen = \strlen($matches[0]); + preg_match('(^\s*)', $line, $matches); + $prefixLen = strlen($matches[0]); if ($prefixLen < $shortestPrefixLen) { $shortestPrefixLen = $prefixLen; } @@ -6021,10 +8578,10 @@ class Comment implements \JsonSerializable * @return array * @psalm-return array{nodeType:string, text:mixed, line:mixed, filePos:mixed} */ - public function jsonSerialize() : array + public function jsonSerialize(): array { // Technically not a node, but we make it look like one anyway - $type = $this instanceof Comment\Doc ? 'Comment_Doc' : 'Comment'; + $type = ($this instanceof Comment\Doc) ? 'Comment_Doc' : 'Comment'; return [ 'nodeType' => $type, 'text' => $this->text, @@ -6041,25 +8598,25 @@ class Comment implements \JsonSerializable fallbackEvaluator = $fallbackEvaluator ?? function (Expr $expr) { throw new ConstExprEvaluationException("Expression of type {$expr->getType()} cannot be evaluated"); @@ -6115,7 +8672,7 @@ class ConstExprEvaluator */ public function evaluateSilently(Expr $expr) { - \set_error_handler(function ($num, $str, $file, $line) { + set_error_handler(function ($num, $str, $file, $line) { throw new \ErrorException($str, 0, $num, $file, $line); }); try { @@ -6126,7 +8683,7 @@ class ConstExprEvaluator } throw $e; } finally { - \restore_error_handler(); + restore_error_handler(); } } /** @@ -6291,7 +8848,7 @@ class ConstExprEvaluator rawMessage = $message; - if (\is_array($attributes)) { + if (is_array($attributes)) { $this->attributes = $attributes; } else { $this->attributes = ['startLine' => $attributes]; @@ -6319,7 +8876,7 @@ class Error extends \RuntimeException * * @return string Error message */ - public function getRawMessage() : string + public function getRawMessage(): string { return $this->rawMessage; } @@ -6328,7 +8885,7 @@ class Error extends \RuntimeException * * @return int Error start line */ - public function getStartLine() : int + public function getStartLine(): int { return $this->attributes['startLine'] ?? -1; } @@ -6337,7 +8894,7 @@ class Error extends \RuntimeException * * @return int Error end line */ - public function getEndLine() : int + public function getEndLine(): int { return $this->attributes['endLine'] ?? -1; } @@ -6346,7 +8903,7 @@ class Error extends \RuntimeException * * @return array */ - public function getAttributes() : array + public function getAttributes(): array { return $this->attributes; } @@ -6387,7 +8944,7 @@ class Error extends \RuntimeException * * @return bool */ - public function hasColumnInfo() : bool + public function hasColumnInfo(): bool { return isset($this->attributes['startFilePos'], $this->attributes['endFilePos']); } @@ -6397,7 +8954,7 @@ class Error extends \RuntimeException * @param string $code Source code of the file * @return int */ - public function getStartColumn(string $code) : int + public function getStartColumn(string $code): int { if (!$this->hasColumnInfo()) { throw new \RuntimeException('Error does not have column information'); @@ -6410,7 +8967,7 @@ class Error extends \RuntimeException * @param string $code Source code of the file * @return int */ - public function getEndColumn(string $code) : int + public function getEndColumn(string $code): int { if (!$this->hasColumnInfo()) { throw new \RuntimeException('Error does not have column information'); @@ -6424,9 +8981,9 @@ class Error extends \RuntimeException * * @return string Formatted message */ - public function getMessageWithColumnInfo(string $code) : string + public function getMessageWithColumnInfo(string $code): string { - return \sprintf('%s from %d:%d to %d:%d', $this->getRawMessage(), $this->getStartLine(), $this->getStartColumn($code), $this->getEndLine(), $this->getEndColumn($code)); + return sprintf('%s from %d:%d to %d:%d', $this->getRawMessage(), $this->getStartLine(), $this->getStartColumn($code), $this->getEndLine(), $this->getEndColumn($code)); } /** * Converts a file offset into a column. @@ -6436,12 +8993,12 @@ class Error extends \RuntimeException * * @return int 1-based column (relative to start of line) */ - private function toColumn(string $code, int $pos) : int + private function toColumn(string $code, int $pos): int { - if ($pos > \strlen($code)) { + if ($pos > strlen($code)) { throw new \RuntimeException('Invalid position information'); } - $lineStartPos = \strrpos($code, "\n", $pos - \strlen($code)); + $lineStartPos = strrpos($code, "\n", $pos - strlen($code)); if (\false === $lineStartPos) { $lineStartPos = -1; } @@ -6463,7 +9020,7 @@ class Error extends \RuntimeException errors; } @@ -6508,7 +9065,7 @@ class Collecting implements ErrorHandler * * @return bool */ - public function hasErrors() : bool + public function hasErrors(): bool { return !empty($this->errors); } @@ -6523,10 +9080,10 @@ class Collecting implements ErrorHandler attrGroups = $attrGroups; @@ -6762,16 +9319,16 @@ class PrintableNewAnonClassNode extends Expr public static function fromNewNode(Expr\New_ $newNode) { $class = $newNode->class; - \assert($class instanceof Node\Stmt\Class_); + assert($class instanceof Node\Stmt\Class_); // We don't assert that $class->name is null here, to allow consumers to assign unique names // to anonymous classes for their own purposes. We simplify ignore the name here. return new self($class->attrGroups, $class->flags, $newNode->args, $class->extends, $class->implements, $class->stmts, $newNode->getAttributes()); } - public function getType() : string + public function getType(): string { return 'Expr_PrintableNewAnonClass'; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'args', 'extends', 'implements', 'stmts']; } @@ -6779,7 +9336,7 @@ class PrintableNewAnonClassNode extends Expr haveTokenImmediatelyBefore($startPos, '(') && $this->haveTokenImmediatelyAfter($endPos, ')'); } @@ -6822,7 +9379,7 @@ class TokenStream * * @return bool */ - public function haveBraces(int $startPos, int $endPos) : bool + public function haveBraces(int $startPos, int $endPos): bool { return ($this->haveTokenImmediatelyBefore($startPos, '{') || $this->haveTokenImmediatelyBefore($startPos, \T_CURLY_OPEN)) && $this->haveTokenImmediatelyAfter($endPos, '}'); } @@ -6836,7 +9393,7 @@ class TokenStream * * @return bool Whether the expected token was found */ - public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType) : bool + public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType): bool { $tokens = $this->tokens; $pos--; @@ -6861,7 +9418,7 @@ class TokenStream * * @return bool Whether the expected token was found */ - public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType) : bool + public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType): bool { $tokens = $this->tokens; $pos++; @@ -6971,7 +9528,7 @@ class TokenStream { return $this->haveTokenInRange($startPos, $endPos, '{') || $this->haveTokenInRange($startPos, $endPos, \T_CURLY_OPEN) || $this->haveTokenInRange($startPos, $endPos, '}'); } - public function haveTagInRange(int $startPos, int $endPos) : bool + public function haveTagInRange(int $startPos, int $endPos): bool { return $this->haveTokenInRange($startPos, $endPos, \T_OPEN_TAG) || $this->haveTokenInRange($startPos, $endPos, \T_CLOSE_TAG); } @@ -6982,7 +9539,7 @@ class TokenStream * * @return int Indentation depth (in spaces) */ - public function getIndentationBefore(int $pos) : int + public function getIndentationBefore(int $pos): int { return $this->indentMap[$pos]; } @@ -6995,7 +9552,7 @@ class TokenStream * * @return string Code corresponding to token range, adjusted for indentation */ - public function getTokenCode(int $from, int $to, int $indent) : string + public function getTokenCode(int $from, int $to, int $indent): string { $tokens = $this->tokens; $result = ''; @@ -7006,15 +9563,12 @@ class TokenStream $content = $token[1]; if ($type === \T_CONSTANT_ENCAPSED_STRING || $type === \T_ENCAPSED_AND_WHITESPACE) { $result .= $content; + } else if ($indent < 0) { + $result .= str_replace("\n" . str_repeat(" ", -$indent), "\n", $content); + } elseif ($indent > 0) { + $result .= str_replace("\n", "\n" . str_repeat(" ", $indent), $content); } else { - // TODO Handle non-space indentation - if ($indent < 0) { - $result .= \str_replace("\n" . \str_repeat(" ", -$indent), "\n", $content); - } elseif ($indent > 0) { - $result .= \str_replace("\n", "\n" . \str_repeat(" ", $indent), $content); - } else { - $result .= $content; - } + $result .= $content; } } else { $result .= $token; @@ -7049,7 +9603,7 @@ class TokenStream decodeRecursive($value); } @@ -7076,7 +9630,7 @@ class JsonDecoder } return $value; } - private function decodeArray(array $array) : array + private function decodeArray(array $array): array { $decodedArray = []; foreach ($array as $key => $value) { @@ -7084,7 +9638,7 @@ class JsonDecoder } return $decodedArray; } - private function decodeNode(array $value) : Node + private function decodeNode(array $value): Node { $nodeType = $value['nodeType']; if (!\is_string($nodeType)) { @@ -7107,15 +9661,15 @@ class JsonDecoder } return $node; } - private function decodeComment(array $value) : Comment + private function decodeComment(array $value): Comment { - $className = $value['nodeType'] === 'Comment' ? Comment::class : Comment\Doc::class; + $className = ($value['nodeType'] === 'Comment') ? Comment::class : Comment\Doc::class; if (!isset($value['text'])) { throw new \RuntimeException('Comment must have text'); } return new $className($value['text'], $value['line'] ?? -1, $value['filePos'] ?? -1, $value['tokenPos'] ?? -1, $value['endLine'] ?? -1, $value['endFilePos'] ?? -1, $value['endTokenPos'] ?? -1); } - private function reflectionClassFromNodeType(string $nodeType) : \ReflectionClass + private function reflectionClassFromNodeType(string $nodeType): \ReflectionClass { if (!isset($this->reflectionClassCache[$nodeType])) { $className = $this->classNameFromNodeType($nodeType); @@ -7123,14 +9677,14 @@ class JsonDecoder } return $this->reflectionClassCache[$nodeType]; } - private function classNameFromNodeType(string $nodeType) : string + private function classNameFromNodeType(string $nodeType): string { - $className = 'PhpParser\\Node\\' . \strtr($nodeType, '_', '\\'); - if (\class_exists($className)) { + $className = 'PhpParser\Node\\' . strtr($nodeType, '_', '\\'); + if (class_exists($className)) { return $className; } $className .= '_'; - if (\class_exists($className)) { + if (class_exists($className)) { return $className; } throw new \RuntimeException("Unknown node type \"{$nodeType}\""); @@ -7139,9 +9693,9 @@ class JsonDecoder identifierTokens = $this->createIdentifierTokenMap(); // map of tokens to drop while lexing (the map is only used for isset lookup, // that's why the value is simply set to 1; the value is never actually used.) - $this->dropTokens = \array_fill_keys([\T_WHITESPACE, \T_OPEN_TAG, \T_COMMENT, \T_DOC_COMMENT, \T_BAD_CHARACTER], 1); + $this->dropTokens = array_fill_keys([\T_WHITESPACE, \T_OPEN_TAG, \T_COMMENT, \T_DOC_COMMENT, \T_BAD_CHARACTER], 1); $defaultAttributes = ['comments', 'startLine', 'endLine']; - $usedAttributes = \array_fill_keys($options['usedAttributes'] ?? $defaultAttributes, \true); + $usedAttributes = array_fill_keys($options['usedAttributes'] ?? $defaultAttributes, \true); // Create individual boolean properties to make these checks faster. $this->attributeStartLineUsed = isset($usedAttributes['startLine']); $this->attributeEndLineUsed = isset($usedAttributes['endLine']); @@ -7199,7 +9753,7 @@ class Lexer * @param ErrorHandler|null $errorHandler Error handler to use for lexing errors. Defaults to * ErrorHandler\Throwing */ - public function startLexing(string $code, ErrorHandler $errorHandler = null) + public function startLexing(string $code, ?ErrorHandler $errorHandler = null) { if (null === $errorHandler) { $errorHandler = new ErrorHandler\Throwing(); @@ -7212,11 +9766,11 @@ class Lexer // If inline HTML occurs without preceding code, treat it as if it had a leading newline. // This ensures proper composability, because having a newline is the "safe" assumption. $this->prevCloseTagHasNewline = \true; - $scream = \ini_set('xdebug.scream', '0'); - $this->tokens = @\token_get_all($code); + $scream = ini_set('xdebug.scream', '0'); + $this->tokens = @token_get_all($code); $this->postprocessTokens($errorHandler); if (\false !== $scream) { - \ini_set('xdebug.scream', $scream); + ini_set('xdebug.scream', $scream); } } private function handleInvalidCharacterRange($start, $end, $line, ErrorHandler $errorHandler) @@ -7228,7 +9782,7 @@ class Lexer // PHP cuts error message after null byte, so need special case $errorMsg = 'Unexpected null byte'; } else { - $errorMsg = \sprintf('Unexpected character "%s" (ASCII %d)', $chr, \ord($chr)); + $errorMsg = sprintf('Unexpected character "%s" (ASCII %d)', $chr, ord($chr)); } $tokens[] = [\T_BAD_CHARACTER, $chr, $line]; $errorHandler->handleError(new Error($errorMsg, ['startLine' => $line, 'endLine' => $line, 'startFilePos' => $i, 'endFilePos' => $i])); @@ -7240,9 +9794,9 @@ class Lexer * * @return bool */ - private function isUnterminatedComment($token) : bool + private function isUnterminatedComment($token): bool { - return ($token[0] === \T_COMMENT || $token[0] === \T_DOC_COMMENT) && \substr($token[1], 0, 2) === '/*' && \substr($token[1], -2) !== '*/'; + return ($token[0] === \T_COMMENT || $token[0] === \T_DOC_COMMENT) && substr($token[1], 0, 2) === '/*' && substr($token[1], -2) !== '*/'; } protected function postprocessTokens(ErrorHandler $errorHandler) { @@ -7266,9 +9820,9 @@ class Lexer if ($token[0] === \T_BAD_CHARACTER) { $this->handleInvalidCharacterRange($filePos, $filePos + 1, $line, $errorHandler); } - if ($token[0] === \T_COMMENT && \substr($token[1], 0, 2) !== '/*' && \preg_match('/(\\r\\n|\\n|\\r)$/D', $token[1], $matches)) { + if ($token[0] === \T_COMMENT && substr($token[1], 0, 2) !== '/*' && preg_match('/(\r\n|\n|\r)$/D', $token[1], $matches)) { $trailingNewline = $matches[0]; - $token[1] = \substr($token[1], 0, -\strlen($trailingNewline)); + $token[1] = substr($token[1], 0, -strlen($trailingNewline)); $this->tokens[$i] = $token; if (isset($this->tokens[$i + 1]) && $this->tokens[$i + 1][0] === \T_WHITESPACE) { // Move trailing newline into following T_WHITESPACE token, if it already exists. @@ -7276,7 +9830,7 @@ class Lexer $this->tokens[$i + 1][2]--; } else { // Otherwise, we need to create a new T_WHITESPACE token. - \array_splice($this->tokens, $i + 1, 0, [[\T_WHITESPACE, $trailingNewline, $line]]); + array_splice($this->tokens, $i + 1, 0, [[\T_WHITESPACE, $trailingNewline, $line]]); $numTokens++; } } @@ -7302,20 +9856,18 @@ class Lexer if ($lastWasSeparator) { // Trailing separator is not part of the name. $j--; - $text = \substr($text, 0, -1); + $text = substr($text, 0, -1); } if ($j > $i + 1) { if ($token[0] === \T_NS_SEPARATOR) { $type = \T_NAME_FULLY_QUALIFIED; + } else if ($token[0] === \T_NAMESPACE) { + $type = \T_NAME_RELATIVE; } else { - if ($token[0] === \T_NAMESPACE) { - $type = \T_NAME_RELATIVE; - } else { - $type = \T_NAME_QUALIFIED; - } + $type = \T_NAME_QUALIFIED; } $token = [$type, $text, $line]; - \array_splice($this->tokens, $i, $j - $i, [$token]); + array_splice($this->tokens, $i, $j - $i, [$token]); $numTokens -= $j - $i - 1; } } @@ -7329,38 +9881,38 @@ class Lexer } $tokenValue = \is_string($token) ? $token : $token[1]; $tokenLen = \strlen($tokenValue); - if (\substr($this->code, $filePos, $tokenLen) !== $tokenValue) { + if (substr($this->code, $filePos, $tokenLen) !== $tokenValue) { // Something is missing, must be an invalid character - $nextFilePos = \strpos($this->code, $tokenValue, $filePos); + $nextFilePos = strpos($this->code, $tokenValue, $filePos); $badCharTokens = $this->handleInvalidCharacterRange($filePos, $nextFilePos, $line, $errorHandler); $filePos = (int) $nextFilePos; - \array_splice($this->tokens, $i, 0, $badCharTokens); + array_splice($this->tokens, $i, 0, $badCharTokens); $numTokens += \count($badCharTokens); $i += \count($badCharTokens); } $filePos += $tokenLen; - $line += \substr_count($tokenValue, "\n"); + $line += substr_count($tokenValue, "\n"); } if ($filePos !== \strlen($this->code)) { - if (\substr($this->code, $filePos, 2) === '/*') { + if (substr($this->code, $filePos, 2) === '/*') { // Unlike PHP, HHVM will drop unterminated comments entirely - $comment = \substr($this->code, $filePos); - $errorHandler->handleError(new Error('Unterminated comment', ['startLine' => $line, 'endLine' => $line + \substr_count($comment, "\n"), 'startFilePos' => $filePos, 'endFilePos' => $filePos + \strlen($comment)])); + $comment = substr($this->code, $filePos); + $errorHandler->handleError(new Error('Unterminated comment', ['startLine' => $line, 'endLine' => $line + substr_count($comment, "\n"), 'startFilePos' => $filePos, 'endFilePos' => $filePos + \strlen($comment)])); // Emulate the PHP behavior $isDocComment = isset($comment[3]) && $comment[3] === '*'; $this->tokens[] = [$isDocComment ? \T_DOC_COMMENT : \T_COMMENT, $comment, $line]; } else { // Invalid characters at the end of the input $badCharTokens = $this->handleInvalidCharacterRange($filePos, \strlen($this->code), $line, $errorHandler); - $this->tokens = \array_merge($this->tokens, $badCharTokens); + $this->tokens = array_merge($this->tokens, $badCharTokens); } return; } - if (\count($this->tokens) > 0) { + if (count($this->tokens) > 0) { // Check for unterminated comment - $lastToken = $this->tokens[\count($this->tokens) - 1]; + $lastToken = $this->tokens[count($this->tokens) - 1]; if ($this->isUnterminatedComment($lastToken)) { - $errorHandler->handleError(new Error('Unterminated comment', ['startLine' => $line - \substr_count($lastToken[1], "\n"), 'endLine' => $line, 'startFilePos' => $filePos - \strlen($lastToken[1]), 'endFilePos' => $filePos])); + $errorHandler->handleError(new Error('Unterminated comment', ['startLine' => $line - substr_count($lastToken[1], "\n"), 'endLine' => $line, 'startFilePos' => $filePos - \strlen($lastToken[1]), 'endFilePos' => $filePos])); } } } @@ -7386,7 +9938,7 @@ class Lexer * * @return int Token id */ - public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) : int + public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null): int { $startAttributes = []; $endAttributes = []; @@ -7411,29 +9963,29 @@ class Lexer if (isset($token[1])) { // bug in token_get_all $this->filePos += 2; - $id = \ord('"'); + $id = ord('"'); } else { $this->filePos += 1; - $id = \ord($token); + $id = ord($token); } } elseif (!isset($this->dropTokens[$token[0]])) { $value = $token[1]; $id = $this->tokenMap[$token[0]]; if (\T_CLOSE_TAG === $token[0]) { - $this->prevCloseTagHasNewline = \false !== \strpos($token[1], "\n") || \false !== \strpos($token[1], "\r"); + $this->prevCloseTagHasNewline = \false !== strpos($token[1], "\n") || \false !== strpos($token[1], "\r"); } elseif (\T_INLINE_HTML === $token[0]) { $startAttributes['hasLeadingNewline'] = $this->prevCloseTagHasNewline; } - $this->line += \substr_count($value, "\n"); + $this->line += substr_count($value, "\n"); $this->filePos += \strlen($value); } else { $origLine = $this->line; $origFilePos = $this->filePos; - $this->line += \substr_count($token[1], "\n"); + $this->line += substr_count($token[1], "\n"); $this->filePos += \strlen($token[1]); if (\T_COMMENT === $token[0] || \T_DOC_COMMENT === $token[0]) { if ($this->attributeCommentsUsed) { - $comment = \T_DOC_COMMENT === $token[0] ? new Comment\Doc($token[1], $origLine, $origFilePos, $this->pos, $this->line, $this->filePos - 1, $this->pos) : new Comment($token[1], $origLine, $origFilePos, $this->pos, $this->line, $this->filePos - 1, $this->pos); + $comment = (\T_DOC_COMMENT === $token[0]) ? new Comment\Doc($token[1], $origLine, $origFilePos, $this->pos, $this->line, $this->filePos - 1, $this->pos) : new Comment($token[1], $origLine, $origFilePos, $this->pos, $this->line, $this->filePos - 1, $this->pos); $startAttributes['comments'][] = $comment; } } @@ -7462,7 +10014,7 @@ class Lexer * * @return array Array of tokens in token_get_all() format */ - public function getTokens() : array + public function getTokens(): array { return $this->tokens; } @@ -7471,20 +10023,20 @@ class Lexer * * @return string Remaining text */ - public function handleHaltCompiler() : string + public function handleHaltCompiler(): string { // text after T_HALT_COMPILER, still including (); - $textAfter = \substr($this->code, $this->filePos); + $textAfter = substr($this->code, $this->filePos); // ensure that it is followed by (); // this simplifies the situation, by not allowing any comments // in between of the tokens. - if (!\preg_match('~^\\s*\\(\\s*\\)\\s*(?:;|\\?>\\r?\\n?)~', $textAfter, $matches)) { + if (!preg_match('~^\s*\(\s*\)\s*(?:;|\?>\r?\n?)~', $textAfter, $matches)) { throw new Error('__HALT_COMPILER must be followed by "();"'); } // prevent the lexer from returning any further tokens - $this->pos = \count($this->tokens); + $this->pos = count($this->tokens); // return with (); removed - return \substr($textAfter, \strlen($matches[0])); + return substr($textAfter, strlen($matches[0])); } private function defineCompatibilityTokens() { @@ -7519,7 +10071,7 @@ class Lexer $tokenId = \constant($token); $clashingToken = $usedTokenIds[$tokenId] ?? null; if ($clashingToken !== null) { - throw new \Error(\sprintf('Token %s has same ID as token %s, ' . 'you may be using a library with broken token emulation', $token, $clashingToken)); + throw new \Error(sprintf('Token %s has same ID as token %s, ' . 'you may be using a library with broken token emulation', $token, $clashingToken)); } $usedTokenIds[$tokenId] = $token; } @@ -7547,7 +10099,7 @@ class Lexer * * @return array The token map */ - protected function createTokenMap() : array + protected function createTokenMap(): array { $tokenMap = []; // 256 is the minimum possible token number, as everything below @@ -7561,23 +10113,23 @@ class Lexer $tokenMap[$i] = Tokens::T_ECHO; } elseif (\T_CLOSE_TAG === $i) { // T_CLOSE_TAG is equivalent to ';' - $tokenMap[$i] = \ord(';'); - } elseif ('UNKNOWN' !== ($name = \token_name($i))) { + $tokenMap[$i] = ord(';'); + } elseif ('UNKNOWN' !== $name = token_name($i)) { if ('T_HASHBANG' === $name) { // HHVM uses a special token for #! hashbang lines $tokenMap[$i] = Tokens::T_INLINE_HTML; - } elseif (\defined($name = Tokens::class . '::' . $name)) { + } elseif (defined($name = Tokens::class . '::' . $name)) { // Other tokens can be mapped directly - $tokenMap[$i] = \constant($name); + $tokenMap[$i] = constant($name); } } } // HHVM uses a special token for numbers that overflow to double - if (\defined('T_ONUMBER')) { + if (defined('T_ONUMBER')) { $tokenMap[\T_ONUMBER] = Tokens::T_DNUMBER; } // HHVM also has a separate token for the __COMPILER_HALT_OFFSET__ constant - if (\defined('T_COMPILER_HALT_OFFSET')) { + if (defined('T_COMPILER_HALT_OFFSET')) { $tokenMap[\T_COMPILER_HALT_OFFSET] = Tokens::T_STRING; } // Assign tokens for which we define compatibility constants, as token_name() does not know them. @@ -7595,33 +10147,33 @@ class Lexer $tokenMap[\T_READONLY] = Tokens::T_READONLY; return $tokenMap; } - private function createIdentifierTokenMap() : array + private function createIdentifierTokenMap(): array { // Based on semi_reserved production. - return \array_fill_keys([\T_STRING, \T_STATIC, \T_ABSTRACT, \T_FINAL, \T_PRIVATE, \T_PROTECTED, \T_PUBLIC, \T_READONLY, \T_INCLUDE, \T_INCLUDE_ONCE, \T_EVAL, \T_REQUIRE, \T_REQUIRE_ONCE, \T_LOGICAL_OR, \T_LOGICAL_XOR, \T_LOGICAL_AND, \T_INSTANCEOF, \T_NEW, \T_CLONE, \T_EXIT, \T_IF, \T_ELSEIF, \T_ELSE, \T_ENDIF, \T_ECHO, \T_DO, \T_WHILE, \T_ENDWHILE, \T_FOR, \T_ENDFOR, \T_FOREACH, \T_ENDFOREACH, \T_DECLARE, \T_ENDDECLARE, \T_AS, \T_TRY, \T_CATCH, \T_FINALLY, \T_THROW, \T_USE, \T_INSTEADOF, \T_GLOBAL, \T_VAR, \T_UNSET, \T_ISSET, \T_EMPTY, \T_CONTINUE, \T_GOTO, \T_FUNCTION, \T_CONST, \T_RETURN, \T_PRINT, \T_YIELD, \T_LIST, \T_SWITCH, \T_ENDSWITCH, \T_CASE, \T_DEFAULT, \T_BREAK, \T_ARRAY, \T_CALLABLE, \T_EXTENDS, \T_IMPLEMENTS, \T_NAMESPACE, \T_TRAIT, \T_INTERFACE, \T_CLASS, \T_CLASS_C, \T_TRAIT_C, \T_FUNC_C, \T_METHOD_C, \T_LINE, \T_FILE, \T_DIR, \T_NS_C, \T_HALT_COMPILER, \T_FN, \T_MATCH], \true); + return array_fill_keys([\T_STRING, \T_STATIC, \T_ABSTRACT, \T_FINAL, \T_PRIVATE, \T_PROTECTED, \T_PUBLIC, \T_READONLY, \T_INCLUDE, \T_INCLUDE_ONCE, \T_EVAL, \T_REQUIRE, \T_REQUIRE_ONCE, \T_LOGICAL_OR, \T_LOGICAL_XOR, \T_LOGICAL_AND, \T_INSTANCEOF, \T_NEW, \T_CLONE, \T_EXIT, \T_IF, \T_ELSEIF, \T_ELSE, \T_ENDIF, \T_ECHO, \T_DO, \T_WHILE, \T_ENDWHILE, \T_FOR, \T_ENDFOR, \T_FOREACH, \T_ENDFOREACH, \T_DECLARE, \T_ENDDECLARE, \T_AS, \T_TRY, \T_CATCH, \T_FINALLY, \T_THROW, \T_USE, \T_INSTEADOF, \T_GLOBAL, \T_VAR, \T_UNSET, \T_ISSET, \T_EMPTY, \T_CONTINUE, \T_GOTO, \T_FUNCTION, \T_CONST, \T_RETURN, \T_PRINT, \T_YIELD, \T_LIST, \T_SWITCH, \T_ENDSWITCH, \T_CASE, \T_DEFAULT, \T_BREAK, \T_ARRAY, \T_CALLABLE, \T_EXTENDS, \T_IMPLEMENTS, \T_NAMESPACE, \T_TRAIT, \T_INTERFACE, \T_CLASS, \T_CLASS_C, \T_TRAIT_C, \T_FUNC_C, \T_METHOD_C, \T_LINE, \T_FILE, \T_DIR, \T_NS_C, \T_HALT_COMPILER, \T_FN, \T_MATCH], \true); } } getPhpVersion(); if ($this->isForwardEmulationNeeded($emulatorPhpVersion)) { $this->emulators[] = $emulator; - } else { - if ($this->isReverseEmulationNeeded($emulatorPhpVersion)) { - $this->emulators[] = new ReverseEmulator($emulator); - } + } else if ($this->isReverseEmulationNeeded($emulatorPhpVersion)) { + $this->emulators[] = new ReverseEmulator($emulator); } } } - public function startLexing(string $code, ErrorHandler $errorHandler = null) + public function startLexing(string $code, ?ErrorHandler $errorHandler = null) { - $emulators = \array_filter($this->emulators, function ($emulator) use($code) { + $emulators = array_filter($this->emulators, function ($emulator) use ($code) { return $emulator->isEmulationNeeded($code); }); if (empty($emulators)) { @@ -7688,19 +10238,19 @@ class Emulative extends Lexer $this->tokens = $emulator->emulate($code, $this->tokens); } } - private function isForwardEmulationNeeded(string $emulatorPhpVersion) : bool + private function isForwardEmulationNeeded(string $emulatorPhpVersion): bool { - return \version_compare(\PHP_VERSION, $emulatorPhpVersion, '<') && \version_compare($this->targetPhpVersion, $emulatorPhpVersion, '>='); + return version_compare(\PHP_VERSION, $emulatorPhpVersion, '<') && version_compare($this->targetPhpVersion, $emulatorPhpVersion, '>='); } - private function isReverseEmulationNeeded(string $emulatorPhpVersion) : bool + private function isReverseEmulationNeeded(string $emulatorPhpVersion): bool { - return \version_compare(\PHP_VERSION, $emulatorPhpVersion, '>=') && \version_compare($this->targetPhpVersion, $emulatorPhpVersion, '<'); + return version_compare(\PHP_VERSION, $emulatorPhpVersion, '>=') && version_compare($this->targetPhpVersion, $emulatorPhpVersion, '<'); } private function sortPatches() { // Patches may be contributed by different emulators. // Make sure they are sorted by increasing patch position. - \usort($this->patches, function ($p1, $p2) { + usort($this->patches, function ($p1, $p2) { return $p1[0] <=> $p2[0]; }); } @@ -7719,7 +10269,7 @@ class Emulative extends Lexer if (\is_string($token)) { if ($patchPos === $pos) { // Only support replacement for string tokens. - \assert($patchType === 'replace'); + assert($patchType === 'replace'); $this->tokens[$i] = $patchText; // Fetch the next patch $patchIdx++; @@ -7739,25 +10289,23 @@ class Emulative extends Lexer if ($patchType === 'remove') { if ($patchPos === $pos && $patchTextLen === $len) { // Remove token entirely - \array_splice($this->tokens, $i, 1, []); + array_splice($this->tokens, $i, 1, []); $i--; $c--; } else { // Remove from token string - $this->tokens[$i][1] = \substr_replace($token[1], '', $patchPos - $pos + $posDelta, $patchTextLen); + $this->tokens[$i][1] = substr_replace($token[1], '', $patchPos - $pos + $posDelta, $patchTextLen); $posDelta -= $patchTextLen; } } elseif ($patchType === 'add') { // Insert into the token string - $this->tokens[$i][1] = \substr_replace($token[1], $patchText, $patchPos - $pos + $posDelta, 0); + $this->tokens[$i][1] = substr_replace($token[1], $patchText, $patchPos - $pos + $posDelta, 0); $posDelta += $patchTextLen; + } else if ($patchType === 'replace') { + // Replace inside the token string + $this->tokens[$i][1] = substr_replace($token[1], $patchText, $patchPos - $pos + $posDelta, $patchTextLen); } else { - if ($patchType === 'replace') { - // Replace inside the token string - $this->tokens[$i][1] = \substr_replace($token[1], $patchText, $patchPos - $pos + $posDelta, $patchTextLen); - } else { - \assert(\false); - } + assert(\false); } // Fetch the next patch $patchIdx++; @@ -7773,7 +10321,7 @@ class Emulative extends Lexer $pos += $len; } // A patch did not apply - \assert(\false); + assert(\false); } /** * Fixup line and position information in errors. @@ -7793,13 +10341,11 @@ class Emulative extends Lexer break; } if ($patchType === 'add') { - $posDelta += \strlen($patchText); - $lineDelta += \substr_count($patchText, "\n"); - } else { - if ($patchType === 'remove') { - $posDelta -= \strlen($patchText); - $lineDelta -= \substr_count($patchText, "\n"); - } + $posDelta += strlen($patchText); + $lineDelta += substr_count($patchText, "\n"); + } else if ($patchType === 'remove') { + $posDelta -= strlen($patchText); + $lineDelta -= substr_count($patchText, "\n"); } } $attrs['startFilePos'] += $posDelta; @@ -7813,45 +10359,45 @@ class Emulative extends Lexer resolveIntegerOrFloatToken($tokens[$i + 1][1]); - \array_splice($tokens, $i, 2, [[$tokenKind, '0' . $tokens[$i + 1][1], $tokens[$i][2]]]); + array_splice($tokens, $i, 2, [[$tokenKind, '0' . $tokens[$i + 1][1], $tokens[$i][2]]]); $c--; } } return $tokens; } - private function resolveIntegerOrFloatToken(string $str) : int + private function resolveIntegerOrFloatToken(string $str): int { - $str = \substr($str, 1); - $str = \str_replace('_', '', $str); - $num = \octdec($str); - return \is_float($num) ? \T_DNUMBER : \T_LNUMBER; + $str = substr($str, 1); + $str = str_replace('_', '', $str); + $num = octdec($str); + return is_float($num) ? \T_DNUMBER : \T_LNUMBER; } - public function reverseEmulate(string $code, array $tokens) : array + public function reverseEmulate(string $code, array $tokens): array { // Explicit octals were not legal code previously, don't bother. return $tokens; @@ -7969,9 +10515,9 @@ class ExplicitOctalEmulator extends TokenEmulator \h*)\2(?![a-zA-Z0-9_\x80-\xff])(?(?:;?[\r\n])?)/x REGEX; - public function getPhpVersion() : string + public function getPhpVersion(): string { return Emulative::PHP_7_3; } - public function isEmulationNeeded(string $code) : bool + public function isEmulationNeeded(string $code): bool { - return \strpos($code, '<<<') !== \false; + return strpos($code, '<<<') !== \false; } - public function emulate(string $code, array $tokens) : array + public function emulate(string $code, array $tokens): array { // Handled by preprocessing + fixup. return $tokens; } - public function reverseEmulate(string $code, array $tokens) : array + public function reverseEmulate(string $code, array $tokens): array { // Not supported. return $tokens; } - public function preprocessCode(string $code, array &$patches) : string + public function preprocessCode(string $code, array &$patches): string { - if (!\preg_match_all(self::FLEXIBLE_DOC_STRING_REGEX, $code, $matches, \PREG_SET_ORDER | \PREG_OFFSET_CAPTURE)) { + if (!preg_match_all(self::FLEXIBLE_DOC_STRING_REGEX, $code, $matches, \PREG_SET_ORDER | \PREG_OFFSET_CAPTURE)) { // No heredoc/nowdoc found return $code; } @@ -8017,14 +10563,14 @@ REGEX; } if ($indentation !== '') { // Remove indentation - $indentationLen = \strlen($indentation); - $code = \substr_replace($code, '', $indentationStart + $posDelta, $indentationLen); + $indentationLen = strlen($indentation); + $code = substr_replace($code, '', $indentationStart + $posDelta, $indentationLen); $patches[] = [$indentationStart + $posDelta, 'add', $indentation]; $posDelta -= $indentationLen; } if ($separator === '') { // Insert newline as separator - $code = \substr_replace($code, "\n", $separatorStart + $posDelta, 0); + $code = substr_replace($code, "\n", $separatorStart + $posDelta, 0); $patches[] = [$separatorStart + $posDelta, 'remove', "\n"]; $posDelta += 1; } @@ -8035,20 +10581,20 @@ REGEX; getKeywordString()) !== \false; + return strpos(strtolower($code), $this->getKeywordString()) !== \false; } - protected function isKeywordContext(array $tokens, int $pos) : bool + protected function isKeywordContext(array $tokens, int $pos): bool { $previousNonSpaceToken = $this->getPreviousNonSpaceToken($tokens, $pos); return $previousNonSpaceToken === null || $previousNonSpaceToken[0] !== \T_OBJECT_OPERATOR; } - public function emulate(string $code, array $tokens) : array + public function emulate(string $code, array $tokens): array { $keywordString = $this->getKeywordString(); foreach ($tokens as $i => $token) { - if ($token[0] === \T_STRING && \strtolower($token[1]) === $keywordString && $this->isKeywordContext($tokens, $i)) { + if ($token[0] === \T_STRING && strtolower($token[1]) === $keywordString && $this->isKeywordContext($tokens, $i)) { $tokens[$i][0] = $this->getKeywordToken(); } } @@ -8095,7 +10641,7 @@ abstract class KeywordEmulator extends TokenEmulator } return null; } - public function reverseEmulate(string $code, array $tokens) : array + public function reverseEmulate(string $code, array $tokens): array { $keywordToken = $this->getKeywordToken(); foreach ($tokens as $i => $token) { @@ -8109,20 +10655,20 @@ abstract class KeywordEmulator extends TokenEmulator ') !== \false; + return strpos($code, '?->') !== \false; } - public function emulate(string $code, array $tokens) : array + public function emulate(string $code, array $tokens): array { // We need to manually iterate and manage a count because we'll change // the tokens array on the way $line = 1; - for ($i = 0, $c = \count($tokens); $i < $c; ++$i) { + for ($i = 0, $c = count($tokens); $i < $c; ++$i) { if ($tokens[$i] === '?' && isset($tokens[$i + 1]) && $tokens[$i + 1][0] === \T_OBJECT_OPERATOR) { - \array_splice($tokens, $i, 2, [[\T_NULLSAFE_OBJECT_OPERATOR, '?->', $line]]); + array_splice($tokens, $i, 2, [[\T_NULLSAFE_OBJECT_OPERATOR, '?->', $line]]); $c--; continue; } // Handle ?-> inside encapsed string. - if ($tokens[$i][0] === \T_ENCAPSED_AND_WHITESPACE && isset($tokens[$i - 1]) && $tokens[$i - 1][0] === \T_VARIABLE && \preg_match('/^\\?->([a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*)/', $tokens[$i][1], $matches)) { + if ($tokens[$i][0] === \T_ENCAPSED_AND_WHITESPACE && isset($tokens[$i - 1]) && $tokens[$i - 1][0] === \T_VARIABLE && preg_match('/^\?->([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/', $tokens[$i][1], $matches)) { $replacement = [[\T_NULLSAFE_OBJECT_OPERATOR, '?->', $line], [\T_STRING, $matches[1], $line]]; if (\strlen($matches[0]) !== \strlen($tokens[$i][1])) { $replacement[] = [\T_ENCAPSED_AND_WHITESPACE, \substr($tokens[$i][1], \strlen($matches[0])), $line]; } - \array_splice($tokens, $i, 1, $replacement); + array_splice($tokens, $i, 1, $replacement); $c += \count($replacement) - 1; continue; } if (\is_array($tokens[$i])) { - $line += \substr_count($tokens[$i][1], "\n"); + $line += substr_count($tokens[$i][1], "\n"); } } return $tokens; } - public function reverseEmulate(string $code, array $tokens) : array + public function reverseEmulate(string $code, array $tokens): array { // ?-> was not valid code previously, don't bother. return $tokens; @@ -8179,40 +10725,40 @@ final class NullsafeTokenEmulator extends TokenEmulator emulator = $emulator; } - public function getPhpVersion() : string + public function getPhpVersion(): string { return $this->emulator->getPhpVersion(); } - public function isEmulationNeeded(string $code) : bool + public function isEmulationNeeded(string $code): bool { return $this->emulator->isEmulationNeeded($code); } - public function emulate(string $code, array $tokens) : array + public function emulate(string $code, array $tokens): array { return $this->emulator->reverseEmulate($code, $tokens); } - public function reverseEmulate(string $code, array $tokens) : array + public function reverseEmulate(string $code, array $tokens): array { return $this->emulator->emulate($code, $tokens); } - public function preprocessCode(string $code, array &$patches) : string + public function preprocessCode(string $code, array &$patches): string { return $code; } @@ -8366,22 +10912,22 @@ final class ReverseEmulator extends TokenEmulator namespace = $namespace; $this->origAliases = $this->aliases = [Stmt\Use_::TYPE_NORMAL => [], Stmt\Use_::TYPE_FUNCTION => [], Stmt\Use_::TYPE_CONSTANT => []]; @@ -8439,11 +10985,11 @@ class NameContext if ($type === Stmt\Use_::TYPE_CONSTANT) { $aliasLookupName = $aliasName; } else { - $aliasLookupName = \strtolower($aliasName); + $aliasLookupName = strtolower($aliasName); } if (isset($this->aliases[$type][$aliasLookupName])) { $typeStringMap = [Stmt\Use_::TYPE_NORMAL => '', Stmt\Use_::TYPE_FUNCTION => 'function ', Stmt\Use_::TYPE_CONSTANT => 'const ']; - $this->errorHandler->handleError(new Error(\sprintf('Cannot use %s%s as %s because the name is already in use', $typeStringMap[$type], $name, $aliasName), $errorAttrs)); + $this->errorHandler->handleError(new Error(sprintf('Cannot use %s%s as %s because the name is already in use', $typeStringMap[$type], $name, $aliasName), $errorAttrs)); return; } $this->aliases[$type][$aliasLookupName] = $name; @@ -8471,7 +11017,7 @@ class NameContext // don't resolve special class names if ($type === Stmt\Use_::TYPE_NORMAL && $name->isSpecialClassName()) { if (!$name->isUnqualified()) { - $this->errorHandler->handleError(new Error(\sprintf("'\\%s' is an invalid class name", $name->toString()), $name->getAttributes())); + $this->errorHandler->handleError(new Error(sprintf("'\\%s' is an invalid class name", $name->toString()), $name->getAttributes())); } return $name; } @@ -8480,7 +11026,7 @@ class NameContext return $name; } // Try to resolve aliases - if (null !== ($resolvedName = $this->resolveAlias($name, $type))) { + if (null !== $resolvedName = $this->resolveAlias($name, $type)) { return $resolvedName; } if ($type !== Stmt\Use_::TYPE_NORMAL && $name->isUnqualified()) { @@ -8501,7 +11047,7 @@ class NameContext * * @return Name Resolved name */ - public function getResolvedClassName(Name $name) : Name + public function getResolvedClassName(Name $name): Name { return $this->getResolvedName($name, Stmt\Use_::TYPE_NORMAL); } @@ -8513,9 +11059,9 @@ class NameContext * * @return Name[] Possible representations of the name */ - public function getPossibleNames(string $name, int $type) : array + public function getPossibleNames(string $name, int $type): array { - $lcName = \strtolower($name); + $lcName = strtolower($name); if ($type === Stmt\Use_::TYPE_NORMAL) { // self, parent and static must always be unqualified if ($lcName === "self" || $lcName === "parent" || $lcName === "static") { @@ -8524,7 +11070,7 @@ class NameContext } // Collect possible ways to write this name, starting with the fully-qualified name $possibleNames = [new FullyQualified($name)]; - if (null !== ($nsRelativeName = $this->getNamespaceRelativeName($name, $lcName, $type))) { + if (null !== $nsRelativeName = $this->getNamespaceRelativeName($name, $lcName, $type)) { // Make sure there is no alias that makes the normally namespace-relative name // into something else if (null === $this->resolveAlias($nsRelativeName, $type)) { @@ -8534,8 +11080,8 @@ class NameContext // Check for relevant namespace use statements foreach ($this->origAliases[Stmt\Use_::TYPE_NORMAL] as $alias => $orig) { $lcOrig = $orig->toLowerString(); - if (0 === \strpos($lcName, $lcOrig . '\\')) { - $possibleNames[] = new Name($alias . \substr($name, \strlen($lcOrig))); + if (0 === strpos($lcName, $lcOrig . '\\')) { + $possibleNames[] = new Name($alias . substr($name, strlen($lcOrig))); } } // Check for relevant type-specific use statements @@ -8546,11 +11092,8 @@ class NameContext if ($normalizedOrig === $this->normalizeConstName($name)) { $possibleNames[] = new Name($alias); } - } else { - // Everything else is case-insensitive - if ($orig->toLowerString() === $lcName) { - $possibleNames[] = new Name($alias); - } + } else if ($orig->toLowerString() === $lcName) { + $possibleNames[] = new Name($alias); } } return $possibleNames; @@ -8563,14 +11106,14 @@ class NameContext * * @return Name Shortest representation */ - public function getShortName(string $name, int $type) : Name + public function getShortName(string $name, int $type): Name { $possibleNames = $this->getPossibleNames($name, $type); // Find shortest name $shortestName = null; $shortestLength = \INF; foreach ($possibleNames as $possibleName) { - $length = \strlen($possibleName->toCodeString()); + $length = strlen($possibleName->toCodeString()); if ($length < $shortestLength) { $shortestName = $possibleName; $shortestLength = $length; @@ -8583,14 +11126,14 @@ class NameContext $firstPart = $name->getFirst(); if ($name->isQualified()) { // resolve aliases for qualified names, always against class alias table - $checkName = \strtolower($firstPart); + $checkName = strtolower($firstPart); if (isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$checkName])) { $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$checkName]; return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes()); } } elseif ($name->isUnqualified()) { // constant aliases are case-sensitive, function aliases case-insensitive - $checkName = $type === Stmt\Use_::TYPE_CONSTANT ? $firstPart : \strtolower($firstPart); + $checkName = ($type === Stmt\Use_::TYPE_CONSTANT) ? $firstPart : strtolower($firstPart); if (isset($this->aliases[$type][$checkName])) { // resolve unqualified aliases return new FullyQualified($this->aliases[$type][$checkName], $name->getAttributes()); @@ -8611,28 +11154,28 @@ class NameContext return new Name($name); } } - $namespacePrefix = \strtolower($this->namespace . '\\'); - if (0 === \strpos($lcName, $namespacePrefix)) { - return new Name(\substr($name, \strlen($namespacePrefix))); + $namespacePrefix = strtolower($this->namespace . '\\'); + if (0 === strpos($lcName, $namespacePrefix)) { + return new Name(substr($name, strlen($namespacePrefix))); } return null; } private function normalizeConstName(string $name) { - $nsSep = \strrpos($name, '\\'); + $nsSep = strrpos($name, '\\'); if (\false === $nsSep) { return $name; } // Constants have case-insensitive namespace and case-sensitive short-name - $ns = \substr($name, 0, $nsSep); - $shortName = \substr($name, $nsSep + 1); - return \strtolower($ns) . '\\' . $shortName; + $ns = substr($name, 0, $nsSep); + $shortName = substr($name, $nsSep + 1); + return strtolower($ns) . '\\' . $shortName; } } attributes = $attributes; $this->name = $name; @@ -8799,11 +11342,11 @@ class Arg extends NodeAbstract $this->byRef = $byRef; $this->unpack = $unpack; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name', 'value', 'byRef', 'unpack']; } - public function getType() : string + public function getType(): string { return 'Arg'; } @@ -8811,10 +11354,10 @@ class Arg extends NodeAbstract name = $name; $this->args = $args; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name', 'args']; } - public function getType() : string + public function getType(): string { return 'Attribute'; } @@ -8844,10 +11387,10 @@ class Attribute extends NodeAbstract attributes = $attributes; $this->attrs = $attrs; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrs']; } - public function getType() : string + public function getType(): string { return 'AttributeGroup'; } @@ -8873,9 +11416,9 @@ class AttributeGroup extends NodeAbstract name = \is_string($name) ? new Identifier($name) : $name; $this->value = $value; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name', 'value']; } - public function getType() : string + public function getType(): string { return 'Const'; } @@ -8923,18 +11466,18 @@ class Const_ extends NodeAbstract attributes = $attributes; $this->var = $var; $this->dim = $dim; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'dim']; } - public function getType() : string + public function getType(): string { return 'Expr_ArrayDimFetch'; } @@ -8966,9 +11509,9 @@ class ArrayDimFetch extends Expr attributes = $attributes; $this->key = $key; @@ -8995,11 +11538,11 @@ class ArrayItem extends Expr $this->byRef = $byRef; $this->unpack = $unpack; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['key', 'value', 'byRef', 'unpack']; } - public function getType() : string + public function getType(): string { return 'Expr_ArrayItem'; } @@ -9007,9 +11550,9 @@ class ArrayItem extends Expr attributes = $attributes; $this->items = $items; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['items']; } - public function getType() : string + public function getType(): string { return 'Expr_Array'; } @@ -9042,11 +11585,11 @@ class Array_ extends Expr expr = $subNodes['expr']; $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'static', 'byRef', 'params', 'returnType', 'expr']; } - public function returnsByRef() : bool + public function returnsByRef(): bool { return $this->byRef; } - public function getParams() : array + public function getParams(): array { return $this->params; } @@ -9098,18 +11641,18 @@ class ArrowFunction extends Expr implements FunctionLike { return $this->returnType; } - public function getAttrGroups() : array + public function getAttrGroups(): array { return $this->attrGroups; } /** * @return Node\Stmt\Return_[] */ - public function getStmts() : array + public function getStmts(): array { return [new Node\Stmt\Return_($this->expr)]; } - public function getType() : string + public function getType(): string { return 'Expr_ArrowFunction'; } @@ -9117,9 +11660,9 @@ class ArrowFunction extends Expr implements FunctionLike var = $var; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'expr']; } - public function getType() : string + public function getType(): string { return 'Expr_Assign'; } @@ -9151,9 +11694,9 @@ class Assign extends Expr var = $var; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'expr']; } @@ -9181,12 +11724,12 @@ abstract class AssignOp extends Expr var = $var; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'expr']; } - public function getType() : string + public function getType(): string { return 'Expr_AssignRef'; } @@ -9384,9 +11927,9 @@ class AssignRef extends Expr left = $left; $this->right = $right; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['left', 'right']; } @@ -9418,21 +11961,21 @@ abstract class BinaryOp extends Expr * * @return string */ - public abstract function getOperatorSigil() : string; + abstract public function getOperatorSigil(): string; } '; } - public function getType() : string + public function getType(): string { return 'Expr_BinaryOp_Greater'; } @@ -9593,16 +12136,16 @@ class Greater extends BinaryOp ='; } - public function getType() : string + public function getType(): string { return 'Expr_BinaryOp_GreaterOrEqual'; } @@ -9610,16 +12153,16 @@ class GreaterOrEqual extends BinaryOp >'; } - public function getType() : string + public function getType(): string { return 'Expr_BinaryOp_ShiftRight'; } @@ -9831,16 +12374,16 @@ class ShiftRight extends BinaryOp '; } - public function getType() : string + public function getType(): string { return 'Expr_BinaryOp_Spaceship'; } @@ -9882,9 +12425,9 @@ class Spaceship extends BinaryOp attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_BitwiseNot'; } @@ -9912,9 +12455,9 @@ class BitwiseNot extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_BooleanNot'; } @@ -9942,11 +12485,11 @@ class BooleanNot extends Expr */ - public abstract function getRawArgs() : array; + abstract public function getRawArgs(): array; /** * Returns whether this call expression is actually a first class callable. */ - public function isFirstClassCallable() : bool + public function isFirstClassCallable(): bool { foreach ($this->getRawArgs() as $arg) { if ($arg instanceof VariadicPlaceholder) { @@ -9973,18 +12516,18 @@ abstract class CallLike extends Expr * * @return Arg[] */ - public function getArgs() : array + public function getArgs(): array { - \assert(!$this->isFirstClassCallable()); + assert(!$this->isFirstClassCallable()); return $this->getRawArgs(); } } attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } @@ -10008,12 +12551,12 @@ abstract class Cast extends Expr class = $class; $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['class', 'name']; } - public function getType() : string + public function getType(): string { return 'Expr_ClassConstFetch'; } @@ -10142,9 +12685,9 @@ class ClassConstFetch extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_Clone'; } @@ -10172,11 +12715,11 @@ class Clone_ extends Expr stmts = $subNodes['stmts'] ?? []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'static', 'byRef', 'params', 'uses', 'returnType', 'stmts']; } - public function returnsByRef() : bool + public function returnsByRef(): bool { return $this->byRef; } - public function getParams() : array + public function getParams(): array { return $this->params; } @@ -10235,15 +12778,15 @@ class Closure extends Expr implements FunctionLike return $this->returnType; } /** @return Node\Stmt[] */ - public function getStmts() : array + public function getStmts(): array { return $this->stmts; } - public function getAttrGroups() : array + public function getAttrGroups(): array { return $this->attrGroups; } - public function getType() : string + public function getType(): string { return 'Expr_Closure'; } @@ -10251,9 +12794,9 @@ class Closure extends Expr implements FunctionLike var = $var; $this->byRef = $byRef; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'byRef']; } - public function getType() : string + public function getType(): string { return 'Expr_ClosureUse'; } @@ -10285,10 +12828,10 @@ class ClosureUse extends Expr attributes = $attributes; $this->name = $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name']; } - public function getType() : string + public function getType(): string { return 'Expr_ConstFetch'; } @@ -10316,9 +12859,9 @@ class ConstFetch extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_Empty'; } @@ -10346,9 +12889,9 @@ class Empty_ extends Expr attributes = $attributes; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return []; } - public function getType() : string + public function getType(): string { return 'Expr_Error'; } @@ -10378,9 +12921,9 @@ class Error extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_ErrorSuppress'; } @@ -10408,9 +12951,9 @@ class ErrorSuppress extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_Eval'; } @@ -10438,9 +12981,9 @@ class Eval_ extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_Exit'; } @@ -10471,10 +13014,10 @@ class Exit_ extends Expr name = $name; $this->args = $args; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name', 'args']; } - public function getType() : string + public function getType(): string { return 'Expr_FuncCall'; } - public function getRawArgs() : array + public function getRawArgs(): array { return $this->args; } @@ -10510,9 +13053,9 @@ class FuncCall extends CallLike expr = $expr; $this->type = $type; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr', 'type']; } - public function getType() : string + public function getType(): string { return 'Expr_Include'; } @@ -10548,10 +13091,10 @@ class Include_ extends Expr expr = $expr; $this->class = $class; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr', 'class']; } - public function getType() : string + public function getType(): string { return 'Expr_Instanceof'; } @@ -10583,9 +13126,9 @@ class Instanceof_ extends Expr attributes = $attributes; $this->vars = $vars; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['vars']; } - public function getType() : string + public function getType(): string { return 'Expr_Isset'; } @@ -10613,9 +13156,9 @@ class Isset_ extends Expr attributes = $attributes; $this->items = $items; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['items']; } - public function getType() : string + public function getType(): string { return 'Expr_List'; } @@ -10643,10 +13186,10 @@ class List_ extends Expr cond = $cond; $this->arms = $arms; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['cond', 'arms']; } - public function getType() : string + public function getType(): string { return 'Expr_Match'; } @@ -10674,12 +13217,12 @@ class Match_ extends Node\Expr name = \is_string($name) ? new Identifier($name) : $name; $this->args = $args; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'name', 'args']; } - public function getType() : string + public function getType(): string { return 'Expr_MethodCall'; } - public function getRawArgs() : array + public function getRawArgs(): array { return $this->args; } @@ -10719,12 +13262,12 @@ class MethodCall extends CallLike class = $class; $this->args = $args; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['class', 'args']; } - public function getType() : string + public function getType(): string { return 'Expr_New'; } - public function getRawArgs() : array + public function getRawArgs(): array { return $this->args; } @@ -10760,12 +13303,12 @@ class New_ extends CallLike name = \is_string($name) ? new Identifier($name) : $name; $this->args = $args; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'name', 'args']; } - public function getType() : string + public function getType(): string { return 'Expr_NullsafeMethodCall'; } - public function getRawArgs() : array + public function getRawArgs(): array { return $this->args; } @@ -10805,10 +13348,10 @@ class NullsafeMethodCall extends CallLike var = $var; $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'name']; } - public function getType() : string + public function getType(): string { return 'Expr_NullsafePropertyFetch'; } @@ -10840,9 +13383,9 @@ class NullsafePropertyFetch extends Expr attributes = $attributes; $this->var = $var; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var']; } - public function getType() : string + public function getType(): string { return 'Expr_PostDec'; } @@ -10870,9 +13413,9 @@ class PostDec extends Expr attributes = $attributes; $this->var = $var; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var']; } - public function getType() : string + public function getType(): string { return 'Expr_PostInc'; } @@ -10900,9 +13443,9 @@ class PostInc extends Expr attributes = $attributes; $this->var = $var; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var']; } - public function getType() : string + public function getType(): string { return 'Expr_PreDec'; } @@ -10930,9 +13473,9 @@ class PreDec extends Expr attributes = $attributes; $this->var = $var; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var']; } - public function getType() : string + public function getType(): string { return 'Expr_PreInc'; } @@ -10960,9 +13503,9 @@ class PreInc extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_Print'; } @@ -10990,10 +13533,10 @@ class Print_ extends Expr var = $var; $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'name']; } - public function getType() : string + public function getType(): string { return 'Expr_PropertyFetch'; } @@ -11025,9 +13568,9 @@ class PropertyFetch extends Expr attributes = $attributes; $this->parts = $parts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['parts']; } - public function getType() : string + public function getType(): string { return 'Expr_ShellExec'; } @@ -11055,13 +13598,13 @@ class ShellExec extends Expr name = \is_string($name) ? new Identifier($name) : $name; $this->args = $args; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['class', 'name', 'args']; } - public function getType() : string + public function getType(): string { return 'Expr_StaticCall'; } - public function getRawArgs() : array + public function getRawArgs(): array { return $this->args; } @@ -11101,11 +13644,11 @@ class StaticCall extends CallLike class = $class; $this->name = \is_string($name) ? new VarLikeIdentifier($name) : $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['class', 'name']; } - public function getType() : string + public function getType(): string { return 'Expr_StaticPropertyFetch'; } @@ -11137,9 +13680,9 @@ class StaticPropertyFetch extends Expr if = $if; $this->else = $else; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['cond', 'if', 'else']; } - public function getType() : string + public function getType(): string { return 'Expr_Ternary'; } @@ -11175,9 +13718,9 @@ class Ternary extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_Throw'; } @@ -11205,9 +13748,9 @@ class Throw_ extends Node\Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_UnaryMinus'; } @@ -11235,9 +13778,9 @@ class UnaryMinus extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_UnaryPlus'; } @@ -11265,9 +13808,9 @@ class UnaryPlus extends Expr attributes = $attributes; $this->name = $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name']; } - public function getType() : string + public function getType(): string { return 'Expr_Variable'; } @@ -11295,9 +13838,9 @@ class Variable extends Expr attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Expr_YieldFrom'; } @@ -11325,9 +13868,9 @@ class YieldFrom extends Expr attributes = $attributes; $this->key = $key; $this->value = $value; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['key', 'value']; } - public function getType() : string + public function getType(): string { return 'Expr_Yield'; } @@ -11359,9 +13902,9 @@ class Yield_ extends Expr attributes = $attributes; $this->name = $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name']; } @@ -11429,7 +13972,7 @@ class Identifier extends NodeAbstract * * @return string Identifier as string. */ - public function toString() : string + public function toString(): string { return $this->name; } @@ -11438,29 +13981,29 @@ class Identifier extends NodeAbstract * * @return string Lowercased identifier as string */ - public function toLowerString() : string + public function toLowerString(): string { - return \strtolower($this->name); + return strtolower($this->name); } /** * Checks whether the identifier is a special class name (self, parent or static). * * @return bool Whether identifier is a special class name */ - public function isSpecialClassName() : bool + public function isSpecialClassName(): bool { - return isset(self::$specialClassNames[\strtolower($this->name)]); + return isset(self::$specialClassNames[strtolower($this->name)]); } /** * Get identifier as string. * * @return string Identifier as string */ - public function __toString() : string + public function __toString(): string { return $this->name; } - public function getType() : string + public function getType(): string { return 'Identifier'; } @@ -11468,9 +14011,9 @@ class Identifier extends NodeAbstract attributes = $attributes; $this->types = $types; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['types']; } - public function getType() : string + public function getType(): string { return 'IntersectionType'; } @@ -11498,10 +14041,10 @@ class IntersectionType extends ComplexType body = $body; $this->attributes = $attributes; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['conds', 'body']; } - public function getType() : string + public function getType(): string { return 'MatchArm'; } @@ -11529,9 +14072,9 @@ class MatchArm extends NodeAbstract attributes = $attributes; $this->parts = self::prepareName($name); } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['parts']; } @@ -11560,7 +14103,7 @@ class Name extends NodeAbstract * * @return string[] Parts of name */ - public function getParts() : array + public function getParts(): array { return $this->parts; } @@ -11569,7 +14112,7 @@ class Name extends NodeAbstract * * @return string First part of the name */ - public function getFirst() : string + public function getFirst(): string { return $this->parts[0]; } @@ -11578,34 +14121,34 @@ class Name extends NodeAbstract * * @return string Last part of the name */ - public function getLast() : string + public function getLast(): string { - return $this->parts[\count($this->parts) - 1]; + return $this->parts[count($this->parts) - 1]; } /** * Checks whether the name is unqualified. (E.g. Name) * * @return bool Whether the name is unqualified */ - public function isUnqualified() : bool + public function isUnqualified(): bool { - return 1 === \count($this->parts); + return 1 === count($this->parts); } /** * Checks whether the name is qualified. (E.g. Name\Name) * * @return bool Whether the name is qualified */ - public function isQualified() : bool + public function isQualified(): bool { - return 1 < \count($this->parts); + return 1 < count($this->parts); } /** * Checks whether the name is fully qualified. (E.g. \Name) * * @return bool Whether the name is fully qualified */ - public function isFullyQualified() : bool + public function isFullyQualified(): bool { return \false; } @@ -11614,7 +14157,7 @@ class Name extends NodeAbstract * * @return bool Whether the name is relative */ - public function isRelative() : bool + public function isRelative(): bool { return \false; } @@ -11624,9 +14167,9 @@ class Name extends NodeAbstract * * @return string String representation */ - public function toString() : string + public function toString(): string { - return \implode('\\', $this->parts); + return implode('\\', $this->parts); } /** * Returns a string representation of the name as it would occur in code (e.g., including @@ -11634,7 +14177,7 @@ class Name extends NodeAbstract * * @return string String representation */ - public function toCodeString() : string + public function toCodeString(): string { return $this->toString(); } @@ -11644,18 +14187,18 @@ class Name extends NodeAbstract * * @return string Lowercased string representation */ - public function toLowerString() : string + public function toLowerString(): string { - return \strtolower(\implode('\\', $this->parts)); + return strtolower(implode('\\', $this->parts)); } /** * Checks whether the identifier is a special class name (self, parent or static). * * @return bool Whether identifier is a special class name */ - public function isSpecialClassName() : bool + public function isSpecialClassName(): bool { - return \count($this->parts) === 1 && isset(self::$specialClassNames[\strtolower($this->parts[0])]); + return count($this->parts) === 1 && isset(self::$specialClassNames[strtolower($this->parts[0])]); } /** * Returns a string representation of the name by imploding the namespace parts with the @@ -11663,9 +14206,9 @@ class Name extends NodeAbstract * * @return string String representation */ - public function __toString() : string + public function __toString(): string { - return \implode('\\', $this->parts); + return implode('\\', $this->parts); } /** * Gets a slice of a name (similar to array_slice). @@ -11683,26 +14226,26 @@ class Name extends NodeAbstract * * @return static|null Sliced name */ - public function slice(int $offset, int $length = null) + public function slice(int $offset, ?int $length = null) { - $numParts = \count($this->parts); - $realOffset = $offset < 0 ? $offset + $numParts : $offset; + $numParts = count($this->parts); + $realOffset = ($offset < 0) ? $offset + $numParts : $offset; if ($realOffset < 0 || $realOffset > $numParts) { - throw new \OutOfBoundsException(\sprintf('Offset %d is out of bounds', $offset)); + throw new \OutOfBoundsException(sprintf('Offset %d is out of bounds', $offset)); } if (null === $length) { $realLength = $numParts - $realOffset; } else { - $realLength = $length < 0 ? $length + $numParts - $realOffset : $length; + $realLength = ($length < 0) ? $length + $numParts - $realOffset : $length; if ($realLength < 0 || $realLength > $numParts - $realOffset) { - throw new \OutOfBoundsException(\sprintf('Length %d is out of bounds', $length)); + throw new \OutOfBoundsException(sprintf('Length %d is out of bounds', $length)); } } if ($realLength === 0) { // Empty slice is represented as null return null; } - return new static(\array_slice($this->parts, $realOffset, $realLength), $this->attributes); + return new static(array_slice($this->parts, $realOffset, $realLength), $this->attributes); } /** * Concatenate two names, yielding a new Name instance. @@ -11730,7 +14273,7 @@ class Name extends NodeAbstract } elseif (null === $name2) { return new static(self::prepareName($name1), $attributes); } else { - return new static(\array_merge(self::prepareName($name1), self::prepareName($name2)), $attributes); + return new static(array_merge(self::prepareName($name1), self::prepareName($name2)), $attributes); } } /** @@ -11741,13 +14284,13 @@ class Name extends NodeAbstract * * @return string[] Prepared name */ - private static function prepareName($name) : array + private static function prepareName($name): array { if (\is_string($name)) { if ('' === $name) { throw new \InvalidArgumentException('Name cannot be empty'); } - return \explode('\\', $name); + return explode('\\', $name); } elseif (\is_array($name)) { if (empty($name)) { throw new \InvalidArgumentException('Name cannot be empty'); @@ -11758,7 +14301,7 @@ class Name extends NodeAbstract } throw new \InvalidArgumentException('Expected string, array of parts or Name instance'); } - public function getType() : string + public function getType(): string { return 'Name'; } @@ -11766,16 +14309,16 @@ class Name extends NodeAbstract toString(); } - public function getType() : string + public function getType(): string { return 'Name_FullyQualified'; } @@ -11818,16 +14361,16 @@ class FullyQualified extends \PHPUnit\PhpParser\Node\Name toString(); } - public function getType() : string + public function getType(): string { return 'Name_Relative'; } @@ -11870,7 +14413,7 @@ class Relative extends \PHPUnit\PhpParser\Node\Name attributes = $attributes; $this->type = \is_string($type) ? new Identifier($type) : $type; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['type']; } - public function getType() : string + public function getType(): string { return 'NullableType'; } @@ -11899,9 +14442,9 @@ class NullableType extends ComplexType attributes = $attributes; $this->type = \is_string($type) ? new Identifier($type) : $type; @@ -11941,11 +14484,11 @@ class Param extends NodeAbstract $this->flags = $flags; $this->attrGroups = $attrGroups; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default']; } - public function getType() : string + public function getType(): string { return 'Param'; } @@ -11953,7 +14496,7 @@ class Param extends NodeAbstract attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['value']; } /** * @param mixed[] $attributes */ - public static function fromString(string $str, array $attributes = []) : DNumber + public static function fromString(string $str, array $attributes = []): DNumber { $attributes['rawValue'] = $str; $float = self::parse($str); @@ -12001,30 +14544,30 @@ class DNumber extends Scalar * * @return float The parsed number */ - public static function parse(string $str) : float + public static function parse(string $str): float { - $str = \str_replace('_', '', $str); + $str = str_replace('_', '', $str); // Check whether this is one of the special integer notations. if ('0' === $str[0]) { // hex if ('x' === $str[1] || 'X' === $str[1]) { - return \hexdec($str); + return hexdec($str); } // bin if ('b' === $str[1] || 'B' === $str[1]) { - return \bindec($str); + return bindec($str); } // oct, but only if the string does not contain any of '.eE'. - if (\false === \strpbrk($str, '.eE')) { + if (\false === strpbrk($str, '.eE')) { // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit // (8 or 9) so that only the digits before that are used. - return \octdec(\substr($str, 0, \strcspn($str, '89'))); + return octdec(substr($str, 0, strcspn($str, '89'))); } } // dec return (float) $str; } - public function getType() : string + public function getType(): string { return 'Scalar_DNumber'; } @@ -12032,10 +14575,10 @@ class DNumber extends Scalar attributes = $attributes; $this->parts = $parts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['parts']; } - public function getType() : string + public function getType(): string { return 'Scalar_Encapsed'; } @@ -12063,9 +14606,9 @@ class Encapsed extends Scalar attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['value']; } - public function getType() : string + public function getType(): string { return 'Scalar_EncapsedStringPart'; } @@ -12093,10 +14636,10 @@ class EncapsedStringPart extends Scalar attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['value']; } @@ -12130,34 +14673,34 @@ class LNumber extends Scalar * * @return LNumber The constructed LNumber, including kind attribute */ - public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = \false) : LNumber + public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = \false): LNumber { $attributes['rawValue'] = $str; - $str = \str_replace('_', '', $str); + $str = str_replace('_', '', $str); if ('0' !== $str[0] || '0' === $str) { $attributes['kind'] = LNumber::KIND_DEC; return new LNumber((int) $str, $attributes); } if ('x' === $str[1] || 'X' === $str[1]) { $attributes['kind'] = LNumber::KIND_HEX; - return new LNumber(\hexdec($str), $attributes); + return new LNumber(hexdec($str), $attributes); } if ('b' === $str[1] || 'B' === $str[1]) { $attributes['kind'] = LNumber::KIND_BIN; - return new LNumber(\bindec($str), $attributes); + return new LNumber(bindec($str), $attributes); } - if (!$allowInvalidOctal && \strpbrk($str, '89')) { + if (!$allowInvalidOctal && strpbrk($str, '89')) { throw new Error('Invalid numeric literal', $attributes); } // Strip optional explicit octal prefix. if ('o' === $str[1] || 'O' === $str[1]) { - $str = \substr($str, 2); + $str = substr($str, 2); } // use intval instead of octdec to get proper cutting behavior with malformed numbers $attributes['kind'] = LNumber::KIND_OCT; - return new LNumber(\intval($str, 8), $attributes); + return new LNumber(intval($str, 8), $attributes); } - public function getType() : string + public function getType(): string { return 'Scalar_LNumber'; } @@ -12165,9 +14708,9 @@ class LNumber extends Scalar attributes = $attributes; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return []; } @@ -12188,21 +14731,21 @@ abstract class MagicConst extends Scalar * * @return string Name of magic constant */ - public abstract function getName() : string; + abstract public function getName(): string; } attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['value']; } /** * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes */ - public static function fromString(string $str, array $attributes = [], bool $parseUnicodeEscape = \true) : self + public static function fromString(string $str, array $attributes = [], bool $parseUnicodeEscape = \true): self { - $attributes['kind'] = $str[0] === "'" || $str[1] === "'" && ($str[0] === 'b' || $str[0] === 'B') ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED; + $attributes['kind'] = ($str[0] === "'" || $str[1] === "'" && ($str[0] === 'b' || $str[0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED; $attributes['rawValue'] = $str; $string = self::parse($str, $parseUnicodeEscape); return new self($string, $attributes); @@ -12378,16 +14921,16 @@ class String_ extends Scalar * * @return string The parsed string */ - public static function parse(string $str, bool $parseUnicodeEscape = \true) : string + public static function parse(string $str, bool $parseUnicodeEscape = \true): string { $bLength = 0; if ('b' === $str[0] || 'B' === $str[0]) { $bLength = 1; } if ('\'' === $str[$bLength]) { - return \str_replace(['\\\\', '\\\''], ['\\', '\''], \substr($str, $bLength + 1, -1)); + return str_replace(['\\\\', '\\\''], ['\\', '\''], substr($str, $bLength + 1, -1)); } else { - return self::parseEscapeSequences(\substr($str, $bLength + 1, -1), '"', $parseUnicodeEscape); + return self::parseEscapeSequences(substr($str, $bLength + 1, -1), '"', $parseUnicodeEscape); } } /** @@ -12401,25 +14944,25 @@ class String_ extends Scalar * * @return string String with escape sequences parsed */ - public static function parseEscapeSequences(string $str, $quote, bool $parseUnicodeEscape = \true) : string + public static function parseEscapeSequences(string $str, $quote, bool $parseUnicodeEscape = \true): string { if (null !== $quote) { - $str = \str_replace('\\' . $quote, $quote, $str); + $str = str_replace('\\' . $quote, $quote, $str); } $extra = ''; if ($parseUnicodeEscape) { - $extra = '|u\\{([0-9a-fA-F]+)\\}'; + $extra = '|u\{([0-9a-fA-F]+)\}'; } - return \preg_replace_callback('~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}' . $extra . ')~', function ($matches) { + return preg_replace_callback('~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}' . $extra . ')~', function ($matches) { $str = $matches[1]; if (isset(self::$replacements[$str])) { return self::$replacements[$str]; } elseif ('x' === $str[0] || 'X' === $str[0]) { - return \chr(\hexdec(\substr($str, 1))); + return chr(hexdec(substr($str, 1))); } elseif ('u' === $str[0]) { - return self::codePointToUtf8(\hexdec($matches[2])); + return self::codePointToUtf8(hexdec($matches[2])); } else { - return \chr(\octdec($str)); + return chr(octdec($str)); } }, $str); } @@ -12430,23 +14973,23 @@ class String_ extends Scalar * * @return string UTF-8 representation of code point */ - private static function codePointToUtf8(int $num) : string + private static function codePointToUtf8(int $num): string { if ($num <= 0x7f) { - return \chr($num); + return chr($num); } if ($num <= 0x7ff) { - return \chr(($num >> 6) + 0xc0) . \chr(($num & 0x3f) + 0x80); + return chr(($num >> 6) + 0xc0) . chr(($num & 0x3f) + 0x80); } if ($num <= 0xffff) { - return \chr(($num >> 12) + 0xe0) . \chr(($num >> 6 & 0x3f) + 0x80) . \chr(($num & 0x3f) + 0x80); + return chr(($num >> 12) + 0xe0) . chr(($num >> 6 & 0x3f) + 0x80) . chr(($num & 0x3f) + 0x80); } if ($num <= 0x1fffff) { - return \chr(($num >> 18) + 0xf0) . \chr(($num >> 12 & 0x3f) + 0x80) . \chr(($num >> 6 & 0x3f) + 0x80) . \chr(($num & 0x3f) + 0x80); + return chr(($num >> 18) + 0xf0) . chr(($num >> 12 & 0x3f) + 0x80) . chr(($num >> 6 & 0x3f) + 0x80) . chr(($num & 0x3f) + 0x80); } throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); } - public function getType() : string + public function getType(): string { return 'Scalar_String'; } @@ -12454,18 +14997,18 @@ class String_ extends Scalar attributes = $attributes; $this->num = $num; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['num']; } - public function getType() : string + public function getType(): string { return 'Stmt_Break'; } @@ -12493,9 +15036,9 @@ class Break_ extends Node\Stmt cond = $cond; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['cond', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Case'; } @@ -12527,10 +15070,10 @@ class Case_ extends Node\Stmt attributes = $attributes; $this->types = $types; $this->var = $var; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['types', 'var', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Catch'; } @@ -12566,9 +15109,9 @@ class Catch_ extends Node\Stmt attrGroups = $attrGroups; $this->type = \is_string($type) ? new Node\Identifier($type) : $type; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'type', 'consts']; } @@ -12605,7 +15148,7 @@ class ClassConst extends Node\Stmt * * @return bool */ - public function isPublic() : bool + public function isPublic(): bool { return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; } @@ -12614,7 +15157,7 @@ class ClassConst extends Node\Stmt * * @return bool */ - public function isProtected() : bool + public function isProtected(): bool { return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); } @@ -12623,7 +15166,7 @@ class ClassConst extends Node\Stmt * * @return bool */ - public function isPrivate() : bool + public function isPrivate(): bool { return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); } @@ -12632,11 +15175,11 @@ class ClassConst extends Node\Stmt * * @return bool */ - public function isFinal() : bool + public function isFinal(): bool { return (bool) ($this->flags & Class_::MODIFIER_FINAL); } - public function getType() : string + public function getType(): string { return 'Stmt_ClassConst'; } @@ -12644,9 +15187,9 @@ class ClassConst extends Node\Stmt stmts as $stmt) { @@ -12673,7 +15216,7 @@ abstract class ClassLike extends Node\Stmt /** * @return ClassConst[] */ - public function getConstants() : array + public function getConstants(): array { $constants = []; foreach ($this->stmts as $stmt) { @@ -12686,7 +15229,7 @@ abstract class ClassLike extends Node\Stmt /** * @return Property[] */ - public function getProperties() : array + public function getProperties(): array { $properties = []; foreach ($this->stmts as $stmt) { @@ -12721,7 +15264,7 @@ abstract class ClassLike extends Node\Stmt * * @return ClassMethod[] */ - public function getMethods() : array + public function getMethods(): array { $methods = []; foreach ($this->stmts as $stmt) { @@ -12740,7 +15283,7 @@ abstract class ClassLike extends Node\Stmt */ public function getMethod(string $name) { - $lowerName = \strtolower($name); + $lowerName = strtolower($name); foreach ($this->stmts as $stmt) { if ($stmt instanceof ClassMethod && $lowerName === $stmt->name->toLowerString()) { return $stmt; @@ -12752,10 +15295,10 @@ abstract class ClassLike extends Node\Stmt params = $subNodes['params'] ?? []; $returnType = $subNodes['returnType'] ?? null; $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; - $this->stmts = \array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : []; + $this->stmts = array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'byRef', 'name', 'params', 'returnType', 'stmts']; } - public function returnsByRef() : bool + public function returnsByRef(): bool { return $this->byRef; } - public function getParams() : array + public function getParams(): array { return $this->params; } @@ -12818,7 +15361,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike { return $this->stmts; } - public function getAttrGroups() : array + public function getAttrGroups(): array { return $this->attrGroups; } @@ -12827,7 +15370,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isPublic() : bool + public function isPublic(): bool { return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; } @@ -12836,7 +15379,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isProtected() : bool + public function isProtected(): bool { return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); } @@ -12845,7 +15388,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isPrivate() : bool + public function isPrivate(): bool { return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); } @@ -12854,7 +15397,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isAbstract() : bool + public function isAbstract(): bool { return (bool) ($this->flags & Class_::MODIFIER_ABSTRACT); } @@ -12863,7 +15406,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isFinal() : bool + public function isFinal(): bool { return (bool) ($this->flags & Class_::MODIFIER_FINAL); } @@ -12872,7 +15415,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isStatic() : bool + public function isStatic(): bool { return (bool) ($this->flags & Class_::MODIFIER_STATIC); } @@ -12881,11 +15424,11 @@ class ClassMethod extends Node\Stmt implements FunctionLike * * @return bool */ - public function isMagic() : bool + public function isMagic(): bool { return isset(self::$magicNames[$this->name->toLowerString()]); } - public function getType() : string + public function getType(): string { return 'Stmt_ClassMethod'; } @@ -12893,10 +15436,10 @@ class ClassMethod extends Node\Stmt implements FunctionLike stmts = $subNodes['stmts'] ?? []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'name', 'extends', 'implements', 'stmts']; } @@ -12945,7 +15488,7 @@ class Class_ extends ClassLike * * @return bool */ - public function isAbstract() : bool + public function isAbstract(): bool { return (bool) ($this->flags & self::MODIFIER_ABSTRACT); } @@ -12954,11 +15497,11 @@ class Class_ extends ClassLike * * @return bool */ - public function isFinal() : bool + public function isFinal(): bool { return (bool) ($this->flags & self::MODIFIER_FINAL); } - public function isReadonly() : bool + public function isReadonly(): bool { return (bool) ($this->flags & self::MODIFIER_READONLY); } @@ -12967,7 +15510,7 @@ class Class_ extends ClassLike * * @return bool */ - public function isAnonymous() : bool + public function isAnonymous(): bool { return null === $this->name; } @@ -13013,7 +15556,7 @@ class Class_ extends ClassLike throw new Error('Cannot use the final modifier on an abstract class member'); } } - public function getType() : string + public function getType(): string { return 'Stmt_Class'; } @@ -13021,9 +15564,9 @@ class Class_ extends ClassLike attributes = $attributes; $this->consts = $consts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['consts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Const'; } @@ -13051,9 +15594,9 @@ class Const_ extends Node\Stmt attributes = $attributes; $this->num = $num; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['num']; } - public function getType() : string + public function getType(): string { return 'Stmt_Continue'; } @@ -13081,9 +15624,9 @@ class Continue_ extends Node\Stmt key = \is_string($key) ? new Node\Identifier($key) : $key; $this->value = $value; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['key', 'value']; } - public function getType() : string + public function getType(): string { return 'Stmt_DeclareDeclare'; } @@ -13115,9 +15658,9 @@ class DeclareDeclare extends Node\Stmt attributes = $attributes; $this->declares = $declares; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['declares', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Declare'; } @@ -13149,9 +15692,9 @@ class Declare_ extends Node\Stmt cond = $cond; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['stmts', 'cond']; } - public function getType() : string + public function getType(): string { return 'Stmt_Do'; } @@ -13183,9 +15726,9 @@ class Do_ extends Node\Stmt attributes = $attributes; $this->exprs = $exprs; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['exprs']; } - public function getType() : string + public function getType(): string { return 'Stmt_Echo'; } @@ -13213,9 +15756,9 @@ class Echo_ extends Node\Stmt cond = $cond; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['cond', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_ElseIf'; } @@ -13247,9 +15790,9 @@ class ElseIf_ extends Node\Stmt attributes = $attributes; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Else'; } @@ -13277,10 +15820,10 @@ class Else_ extends Node\Stmt name = \is_string($name) ? new Node\Identifier($name) : $name; $this->expr = $expr; $this->attrGroups = $attrGroups; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'name', 'expr']; } - public function getType() : string + public function getType(): string { return 'Stmt_EnumCase'; } @@ -13314,9 +15857,9 @@ class EnumCase extends Node\Stmt attrGroups = $subNodes['attrGroups'] ?? []; parent::__construct($attributes); } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'name', 'scalarType', 'implements', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Enum'; } @@ -13353,9 +15896,9 @@ class Enum_ extends ClassLike attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Stmt_Expression'; } @@ -13386,9 +15929,9 @@ class Expression extends Node\Stmt attributes = $attributes; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Finally'; } @@ -13416,9 +15959,9 @@ class Finally_ extends Node\Stmt loop = $subNodes['loop'] ?? []; $this->stmts = $subNodes['stmts'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['init', 'cond', 'loop', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_For'; } @@ -13459,9 +16002,9 @@ class For_ extends Node\Stmt valueVar = $valueVar; $this->stmts = $subNodes['stmts'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr', 'keyVar', 'byRef', 'valueVar', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Foreach'; } @@ -13506,10 +16049,10 @@ class Foreach_ extends Node\Stmt stmts = $subNodes['stmts'] ?? []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'byRef', 'name', 'params', 'returnType', 'stmts']; } - public function returnsByRef() : bool + public function returnsByRef(): bool { return $this->byRef; } - public function getParams() : array + public function getParams(): array { return $this->params; } @@ -13565,16 +16108,16 @@ class Function_ extends Node\Stmt implements FunctionLike { return $this->returnType; } - public function getAttrGroups() : array + public function getAttrGroups(): array { return $this->attrGroups; } /** @return Node\Stmt[] */ - public function getStmts() : array + public function getStmts(): array { return $this->stmts; } - public function getType() : string + public function getType(): string { return 'Stmt_Function'; } @@ -13582,9 +16125,9 @@ class Function_ extends Node\Stmt implements FunctionLike attributes = $attributes; $this->vars = $vars; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['vars']; } - public function getType() : string + public function getType(): string { return 'Stmt_Global'; } @@ -13612,10 +16155,10 @@ class Global_ extends Node\Stmt attributes = $attributes; $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name']; } - public function getType() : string + public function getType(): string { return 'Stmt_Goto'; } @@ -13643,10 +16186,10 @@ class Goto_ extends Stmt prefix = $prefix; $this->uses = $uses; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['type', 'prefix', 'uses']; } - public function getType() : string + public function getType(): string { return 'Stmt_GroupUse'; } @@ -13682,9 +16225,9 @@ class GroupUse extends Stmt attributes = $attributes; $this->remaining = $remaining; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['remaining']; } - public function getType() : string + public function getType(): string { return 'Stmt_HaltCompiler'; } @@ -13712,9 +16255,9 @@ class HaltCompiler extends Stmt elseifs = $subNodes['elseifs'] ?? []; $this->else = $subNodes['else'] ?? null; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['cond', 'stmts', 'elseifs', 'else']; } - public function getType() : string + public function getType(): string { return 'Stmt_If'; } @@ -13755,9 +16298,9 @@ class If_ extends Node\Stmt attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['value']; } - public function getType() : string + public function getType(): string { return 'Stmt_InlineHTML'; } @@ -13785,9 +16328,9 @@ class InlineHTML extends Stmt stmts = $subNodes['stmts'] ?? []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'name', 'extends', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Interface'; } @@ -13822,10 +16365,10 @@ class Interface_ extends ClassLike attributes = $attributes; $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name']; } - public function getType() : string + public function getType(): string { return 'Stmt_Label'; } @@ -13853,9 +16396,9 @@ class Label extends Stmt attributes = $attributes; $this->name = $name; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Namespace'; } @@ -13890,17 +16433,17 @@ class Namespace_ extends Node\Stmt type = \is_string($type) ? new Identifier($type) : $type; $this->attrGroups = $attrGroups; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'flags', 'type', 'props']; } @@ -13950,7 +16493,7 @@ class Property extends Node\Stmt * * @return bool */ - public function isPublic() : bool + public function isPublic(): bool { return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; } @@ -13959,7 +16502,7 @@ class Property extends Node\Stmt * * @return bool */ - public function isProtected() : bool + public function isProtected(): bool { return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); } @@ -13968,7 +16511,7 @@ class Property extends Node\Stmt * * @return bool */ - public function isPrivate() : bool + public function isPrivate(): bool { return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); } @@ -13977,7 +16520,7 @@ class Property extends Node\Stmt * * @return bool */ - public function isStatic() : bool + public function isStatic(): bool { return (bool) ($this->flags & Class_::MODIFIER_STATIC); } @@ -13986,11 +16529,11 @@ class Property extends Node\Stmt * * @return bool */ - public function isReadonly() : bool + public function isReadonly(): bool { return (bool) ($this->flags & Class_::MODIFIER_READONLY); } - public function getType() : string + public function getType(): string { return 'Stmt_Property'; } @@ -13998,9 +16541,9 @@ class Property extends Node\Stmt attributes = $attributes; $this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name; $this->default = $default; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['name', 'default']; } - public function getType() : string + public function getType(): string { return 'Stmt_PropertyProperty'; } @@ -14032,9 +16575,9 @@ class PropertyProperty extends Node\Stmt attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Stmt_Return'; } @@ -14062,10 +16605,10 @@ class Return_ extends Node\Stmt attributes = $attributes; $this->var = $var; $this->default = $default; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['var', 'default']; } - public function getType() : string + public function getType(): string { return 'Stmt_StaticVar'; } @@ -14097,9 +16640,9 @@ class StaticVar extends Node\Stmt attributes = $attributes; $this->vars = $vars; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['vars']; } - public function getType() : string + public function getType(): string { return 'Stmt_Static'; } @@ -14127,9 +16670,9 @@ class Static_ extends Stmt cond = $cond; $this->cases = $cases; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['cond', 'cases']; } - public function getType() : string + public function getType(): string { return 'Stmt_Switch'; } @@ -14161,9 +16704,9 @@ class Switch_ extends Node\Stmt attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['expr']; } - public function getType() : string + public function getType(): string { return 'Stmt_Throw'; } @@ -14191,9 +16734,9 @@ class Throw_ extends Node\Stmt traits = $traits; $this->adaptations = $adaptations; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['traits', 'adaptations']; } - public function getType() : string + public function getType(): string { return 'Stmt_TraitUse'; } @@ -14225,9 +16768,9 @@ class TraitUse extends Node\Stmt newModifier = $newModifier; $this->newName = \is_string($newName) ? new Node\Identifier($newName) : $newName; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['trait', 'method', 'newModifier', 'newName']; } - public function getType() : string + public function getType(): string { return 'Stmt_TraitUseAdaptation_Alias'; } @@ -14276,9 +16819,9 @@ class Alias extends Node\Stmt\TraitUseAdaptation method = \is_string($method) ? new Node\Identifier($method) : $method; $this->insteadof = $insteadof; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['trait', 'method', 'insteadof']; } - public function getType() : string + public function getType(): string { return 'Stmt_TraitUseAdaptation_Precedence'; } @@ -14310,9 +16853,9 @@ class Precedence extends Node\Stmt\TraitUseAdaptation stmts = $subNodes['stmts'] ?? []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['attrGroups', 'name', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_Trait'; } @@ -14343,9 +16886,9 @@ class Trait_ extends ClassLike attributes = $attributes; $this->stmts = $stmts; $this->catches = $catches; $this->finally = $finally; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['stmts', 'catches', 'finally']; } - public function getType() : string + public function getType(): string { return 'Stmt_TryCatch'; } @@ -14381,9 +16924,9 @@ class TryCatch extends Node\Stmt attributes = $attributes; $this->vars = $vars; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['vars']; } - public function getType() : string + public function getType(): string { return 'Stmt_Unset'; } @@ -14411,10 +16954,10 @@ class Unset_ extends Node\Stmt name = $name; $this->alias = \is_string($alias) ? new Identifier($alias) : $alias; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['type', 'name', 'alias']; } @@ -14447,14 +16990,14 @@ class UseUse extends Node\Stmt * * @return Identifier */ - public function getAlias() : Identifier + public function getAlias(): Identifier { if (null !== $this->alias) { return $this->alias; } return new Identifier($this->name->getLast()); } - public function getType() : string + public function getType(): string { return 'Stmt_UseUse'; } @@ -14462,9 +17005,9 @@ class UseUse extends Node\Stmt type = $type; $this->uses = $uses; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['type', 'uses']; } - public function getType() : string + public function getType(): string { return 'Stmt_Use'; } @@ -14508,9 +17051,9 @@ class Use_ extends Stmt cond = $cond; $this->stmts = $stmts; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['cond', 'stmts']; } - public function getType() : string + public function getType(): string { return 'Stmt_While'; } @@ -14542,7 +17085,7 @@ class While_ extends Node\Stmt attributes = $attributes; $this->types = $types; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return ['types']; } - public function getType() : string + public function getType(): string { return 'UnionType'; } @@ -14571,7 +17114,7 @@ class UnionType extends ComplexType attributes = $attributes; } - public function getType() : string + public function getType(): string { return 'VariadicPlaceholder'; } - public function getSubNodeNames() : array + public function getSubNodeNames(): array { return []; } @@ -14619,7 +17162,7 @@ class VariadicPlaceholder extends NodeAbstract attributes['startLine'] ?? -1; } @@ -14649,7 +17192,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int Start line (or -1 if not available) */ - public function getStartLine() : int + public function getStartLine(): int { return $this->attributes['startLine'] ?? -1; } @@ -14660,7 +17203,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int End line (or -1 if not available) */ - public function getEndLine() : int + public function getEndLine(): int { return $this->attributes['endLine'] ?? -1; } @@ -14673,7 +17216,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int Token start position (or -1 if not available) */ - public function getStartTokenPos() : int + public function getStartTokenPos(): int { return $this->attributes['startTokenPos'] ?? -1; } @@ -14686,7 +17229,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int Token end position (or -1 if not available) */ - public function getEndTokenPos() : int + public function getEndTokenPos(): int { return $this->attributes['endTokenPos'] ?? -1; } @@ -14697,7 +17240,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int File start position (or -1 if not available) */ - public function getStartFilePos() : int + public function getStartFilePos(): int { return $this->attributes['startFilePos'] ?? -1; } @@ -14708,7 +17251,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return int File end position (or -1 if not available) */ - public function getEndFilePos() : int + public function getEndFilePos(): int { return $this->attributes['endFilePos'] ?? -1; } @@ -14719,7 +17262,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable * * @return Comment[] */ - public function getComments() : array + public function getComments(): array { return $this->attributes['comments'] ?? []; } @@ -14731,7 +17274,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable public function getDocComment() { $comments = $this->getComments(); - for ($i = \count($comments) - 1; $i >= 0; $i--) { + for ($i = count($comments) - 1; $i >= 0; $i--) { $comment = $comments[$i]; if ($comment instanceof Comment\Doc) { return $comment; @@ -14749,7 +17292,7 @@ abstract class NodeAbstract implements Node, \JsonSerializable public function setDocComment(Comment\Doc $docComment) { $comments = $this->getComments(); - for ($i = \count($comments) - 1; $i >= 0; $i--) { + for ($i = count($comments) - 1; $i >= 0; $i--) { if ($comments[$i] instanceof Comment\Doc) { // Replace existing doc comment. $comments[$i] = $docComment; @@ -14765,18 +17308,18 @@ abstract class NodeAbstract implements Node, \JsonSerializable { $this->attributes[$key] = $value; } - public function hasAttribute(string $key) : bool + public function hasAttribute(string $key): bool { - return \array_key_exists($key, $this->attributes); + return array_key_exists($key, $this->attributes); } public function getAttribute(string $key, $default = null) { - if (\array_key_exists($key, $this->attributes)) { + if (array_key_exists($key, $this->attributes)) { return $this->attributes[$key]; } return $default; } - public function getAttributes() : array + public function getAttributes(): array { return $this->attributes; } @@ -14787,21 +17330,21 @@ abstract class NodeAbstract implements Node, \JsonSerializable /** * @return array */ - public function jsonSerialize() : array + public function jsonSerialize(): array { - return ['nodeType' => $this->getType()] + \get_object_vars($this); + return ['nodeType' => $this->getType()] + get_object_vars($this); } } code = $code; return $this->dumpRecursive($node); @@ -14841,7 +17384,7 @@ class NodeDumper { if ($node instanceof Node) { $r = $node->getType(); - if ($this->dumpPositions && null !== ($p = $this->dumpPosition($node))) { + if ($this->dumpPositions && null !== $p = $this->dumpPosition($node)) { $r .= $p; } $r .= '('; @@ -14854,7 +17397,7 @@ class NodeDumper $r .= 'false'; } elseif (\true === $value) { $r .= 'true'; - } elseif (\is_scalar($value)) { + } elseif (is_scalar($value)) { if ('flags' === $key || 'newModifier' === $key) { $r .= $this->dumpFlags($value); } elseif ('type' === $key && $node instanceof Include_) { @@ -14865,13 +17408,13 @@ class NodeDumper $r .= $value; } } else { - $r .= \str_replace("\n", "\n ", $this->dumpRecursive($value)); + $r .= str_replace("\n", "\n ", $this->dumpRecursive($value)); } } - if ($this->dumpComments && ($comments = $node->getComments())) { - $r .= "\n comments: " . \str_replace("\n", "\n ", $this->dumpRecursive($comments)); + if ($this->dumpComments && $comments = $node->getComments()) { + $r .= "\n comments: " . str_replace("\n", "\n ", $this->dumpRecursive($comments)); } - } elseif (\is_array($node)) { + } elseif (is_array($node)) { $r = 'array('; foreach ($node as $key => $value) { $r .= "\n " . $key . ': '; @@ -14881,10 +17424,10 @@ class NodeDumper $r .= 'false'; } elseif (\true === $value) { $r .= 'true'; - } elseif (\is_scalar($value)) { + } elseif (is_scalar($value)) { $r .= $value; } else { - $r .= \str_replace("\n", "\n ", $this->dumpRecursive($value)); + $r .= str_replace("\n", "\n ", $this->dumpRecursive($value)); } } } elseif ($node instanceof Comment) { @@ -14919,7 +17462,7 @@ class NodeDumper $strs[] = 'MODIFIER_READONLY'; } if ($strs) { - return \implode(' | ', $strs) . ' (' . $flags . ')'; + return implode(' | ', $strs) . ' (' . $flags . ')'; } else { return $flags; } @@ -14963,10 +17506,10 @@ class NodeDumper // Copied from Error class private function toColumn($code, $pos) { - if ($pos > \strlen($code)) { + if ($pos > strlen($code)) { throw new \RuntimeException('Invalid position information'); } - $lineStartPos = \strrpos($code, "\n", $pos - \strlen($code)); + $lineStartPos = strrpos($code, "\n", $pos - strlen($code)); if (\false === $lineStartPos) { $lineStartPos = -1; } @@ -14976,10 +17519,10 @@ class NodeDumper find($nodes, function ($node) use($class) { + return $this->find($nodes, function ($node) use ($class) { return $node instanceof $class; }); } @@ -15025,7 +17568,7 @@ class NodeFinder */ public function findFirst($nodes, callable $filter) { - if (!\is_array($nodes)) { + if (!is_array($nodes)) { $nodes = [$nodes]; } $visitor = new FirstFindingVisitor($filter); @@ -15044,7 +17587,7 @@ class NodeFinder */ public function findFirstInstanceOf($nodes, string $class) { - return $this->findFirst($nodes, function ($node) use($class) { + return $this->findFirst($nodes, function ($node) use ($class) { return $node instanceof $class; }); } @@ -15052,7 +17595,7 @@ class NodeFinder stopTraversal = \false; foreach ($this->visitors as $visitor) { - if (null !== ($return = $visitor->beforeTraverse($nodes))) { + if (null !== $return = $visitor->beforeTraverse($nodes)) { $nodes = $return; } } $nodes = $this->traverseArray($nodes); foreach ($this->visitors as $visitor) { - if (null !== ($return = $visitor->afterTraverse($nodes))) { + if (null !== $return = $visitor->afterTraverse($nodes)) { $nodes = $return; } } @@ -15148,7 +17691,7 @@ class NodeTraverser implements NodeTraverserInterface * * @return Node Result of traversal (may be original node or new one) */ - protected function traverseNode(Node $node) : Node + protected function traverseNode(Node $node): Node { foreach ($node->getSubNodeNames() as $name) { $subNode =& $node->{$name}; @@ -15176,7 +17719,7 @@ class NodeTraverser implements NodeTraverserInterface $this->stopTraversal = \true; break 2; } else { - throw new \LogicException('enterNode() returned invalid value of type ' . \gettype($return)); + throw new \LogicException('enterNode() returned invalid value of type ' . gettype($return)); } } } @@ -15198,7 +17741,7 @@ class NodeTraverser implements NodeTraverserInterface } elseif (\is_array($return)) { throw new \LogicException('leaveNode() may only return an array ' . 'if the parent structure is an array'); } else { - throw new \LogicException('leaveNode() returned invalid value of type ' . \gettype($return)); + throw new \LogicException('leaveNode() returned invalid value of type ' . gettype($return)); } } if ($breakVisitorIndex === $visitorIndex) { @@ -15216,7 +17759,7 @@ class NodeTraverser implements NodeTraverserInterface * * @return array Result of traversal (may be original array or changed one) */ - protected function traverseArray(array $nodes) : array + protected function traverseArray(array $nodes): array { $doNodes = []; foreach ($nodes as $i => &$node) { @@ -15239,7 +17782,7 @@ class NodeTraverser implements NodeTraverserInterface $this->stopTraversal = \true; break 2; } else { - throw new \LogicException('enterNode() returned invalid value of type ' . \gettype($return)); + throw new \LogicException('enterNode() returned invalid value of type ' . gettype($return)); } } } @@ -15267,7 +17810,7 @@ class NodeTraverser implements NodeTraverserInterface } elseif (\false === $return) { throw new \LogicException('bool(false) return from leaveNode() no longer supported. ' . 'Return NodeTraverser::REMOVE_NODE instead'); } else { - throw new \LogicException('leaveNode() returned invalid value of type ' . \gettype($return)); + throw new \LogicException('leaveNode() returned invalid value of type ' . gettype($return)); } } if ($breakVisitorIndex === $visitorIndex) { @@ -15279,8 +17822,8 @@ class NodeTraverser implements NodeTraverserInterface } } if (!empty($doNodes)) { - while (list($i, $replace) = \array_pop($doNodes)) { - \array_splice($nodes, $i, 1, $replace); + while (list($i, $replace) = array_pop($doNodes)) { + array_splice($nodes, $i, 1, $replace); } } return $nodes; @@ -15298,7 +17841,7 @@ class NodeTraverser implements NodeTraverserInterface foundNodes; } @@ -15463,11 +18006,11 @@ class FindingVisitor extends NodeVisitorAbstract nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing()); $this->preserveOriginalNames = $options['preserveOriginalNames'] ?? \false; @@ -15553,7 +18096,7 @@ class NameResolver extends NodeVisitorAbstract * * @return NameContext */ - public function getNameContext() : NameContext + public function getNameContext(): NameContext { return $this->nameContext; } @@ -15618,46 +18161,45 @@ class NameResolver extends NodeVisitorAbstract foreach ($node->consts as $const) { $this->addNamespacedName($const); } - } else { - if ($node instanceof Stmt\ClassConst) { - $this->resolveAttrGroups($node); - } else { - if ($node instanceof Stmt\EnumCase) { - $this->resolveAttrGroups($node); - } elseif ($node instanceof Expr\StaticCall || $node instanceof Expr\StaticPropertyFetch || $node instanceof Expr\ClassConstFetch || $node instanceof Expr\New_ || $node instanceof Expr\Instanceof_) { - if ($node->class instanceof Name) { - $node->class = $this->resolveClassName($node->class); - } - } elseif ($node instanceof Stmt\Catch_) { - foreach ($node->types as &$type) { - $type = $this->resolveClassName($type); - } - } elseif ($node instanceof Expr\FuncCall) { - if ($node->name instanceof Name) { - $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_FUNCTION); - } - } elseif ($node instanceof Expr\ConstFetch) { - $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_CONSTANT); - } elseif ($node instanceof Stmt\TraitUse) { - foreach ($node->traits as &$trait) { - $trait = $this->resolveClassName($trait); - } - foreach ($node->adaptations as $adaptation) { - if (null !== $adaptation->trait) { - $adaptation->trait = $this->resolveClassName($adaptation->trait); - } - if ($adaptation instanceof Stmt\TraitUseAdaptation\Precedence) { - foreach ($adaptation->insteadof as &$insteadof) { - $insteadof = $this->resolveClassName($insteadof); - } - } + } else if ($node instanceof Stmt\ClassConst) { + if (null !== $node->type) { + $node->type = $this->resolveType($node->type); + } + $this->resolveAttrGroups($node); + } else if ($node instanceof Stmt\EnumCase) { + $this->resolveAttrGroups($node); + } elseif ($node instanceof Expr\StaticCall || $node instanceof Expr\StaticPropertyFetch || $node instanceof Expr\ClassConstFetch || $node instanceof Expr\New_ || $node instanceof Expr\Instanceof_) { + if ($node->class instanceof Name) { + $node->class = $this->resolveClassName($node->class); + } + } elseif ($node instanceof Stmt\Catch_) { + foreach ($node->types as &$type) { + $type = $this->resolveClassName($type); + } + } elseif ($node instanceof Expr\FuncCall) { + if ($node->name instanceof Name) { + $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_FUNCTION); + } + } elseif ($node instanceof Expr\ConstFetch) { + $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_CONSTANT); + } elseif ($node instanceof Stmt\TraitUse) { + foreach ($node->traits as &$trait) { + $trait = $this->resolveClassName($trait); + } + foreach ($node->adaptations as $adaptation) { + if (null !== $adaptation->trait) { + $adaptation->trait = $this->resolveClassName($adaptation->trait); + } + if ($adaptation instanceof Stmt\TraitUseAdaptation\Precedence) { + foreach ($adaptation->insteadof as &$insteadof) { + $insteadof = $this->resolveClassName($insteadof); } } } } return null; } - private function addAlias(Stmt\UseUse $use, int $type, Name $prefix = null) + private function addAlias(Stmt\UseUse $use, int $type, ?Name $prefix = null) { // Add prefix for group uses $name = $prefix ? Name::concat($prefix, $use->name) : $use->name; @@ -15699,7 +18241,7 @@ class NameResolver extends NodeVisitorAbstract * * @return Name Resolved name, or original name with attribute */ - protected function resolveName(Name $name, int $type) : Name + protected function resolveName(Name $name, int $type): Name { if (!$this->replaceNodes) { $resolvedName = $this->nameContext->getResolvedName($name, $type); @@ -15745,10 +18287,10 @@ class NameResolver extends NodeVisitorAbstract stack)) { - $node->setAttribute('parent', $this->stack[\count($this->stack) - 1]); + $node->setAttribute('parent', $this->stack[count($this->stack) - 1]); } if ($this->previous !== null && $this->previous->getAttribute('parent') === $node->getAttribute('parent')) { $node->setAttribute('previous', $this->previous); @@ -15787,18 +18329,18 @@ final class NodeConnectingVisitor extends NodeVisitorAbstract public function leaveNode(Node $node) { $this->previous = $node; - \array_pop($this->stack); + array_pop($this->stack); } } parsers = $parsers; } - public function parse(string $code, ErrorHandler $errorHandler = null) + public function parse(string $code, ?ErrorHandler $errorHandler = null) { if (null === $errorHandler) { $errorHandler = new ErrorHandler\Throwing(); @@ -15907,7 +18449,7 @@ class Multiple implements Parser if ($firstError === null) { return $firstStmts; } - for ($i = 1, $c = \count($this->parsers); $i < $c; ++$i) { + for ($i = 1, $c = count($this->parsers); $i < $c; ++$i) { list($stmts, $error) = $this->tryParse($this->parsers[$i], $errorHandler, $code); if ($error === null) { return $stmts; @@ -15928,21 +18470,21 @@ class Multiple implements Parser } function ($stackPos) { $this->semValue = $this->handleNamespaces($this->semStack[$stackPos - (1 - 1)]); }, 2 => function ($stackPos) { - if (\is_array($this->semStack[$stackPos - (2 - 2)])) { - $this->semValue = \array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); + if (is_array($this->semStack[$stackPos - (2 - 2)])) { + $this->semValue = array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); } else { $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; $this->semValue = $this->semStack[$stackPos - (2 - 1)]; @@ -16164,9 +18706,9 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract }, 90 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (1 - 1)]; }, 91 => function ($stackPos) { - $this->semValue = new Name(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Name(substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 92 => function ($stackPos) { - $this->semValue = new Expr\Variable(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Expr\Variable(substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 93 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (1 - 1)]; }, 94 => function ($stackPos) { @@ -16251,8 +18793,8 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract }, 125 => function ($stackPos) { $this->semValue = new Node\Const_($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); }, 126 => function ($stackPos) { - if (\is_array($this->semStack[$stackPos - (2 - 2)])) { - $this->semValue = \array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); + if (is_array($this->semStack[$stackPos - (2 - 2)])) { + $this->semValue = array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); } else { $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; $this->semValue = $this->semStack[$stackPos - (2 - 1)]; @@ -16284,7 +18826,7 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract $attrs = $this->startAttributeStack[$stackPos - (3 - 1)]; $stmts = $this->semValue; if (!empty($attrs['comments'])) { - $stmts[0]->setAttribute('comments', \array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); + $stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); } } else { $startAttributes = $this->startAttributeStack[$stackPos - (3 - 1)]; @@ -16298,13 +18840,13 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract } } }, 134 => function ($stackPos) { - $this->semValue = new Stmt\If_($this->semStack[$stackPos - (5 - 2)], ['stmts' => \is_array($this->semStack[$stackPos - (5 - 3)]) ? $this->semStack[$stackPos - (5 - 3)] : array($this->semStack[$stackPos - (5 - 3)]), 'elseifs' => $this->semStack[$stackPos - (5 - 4)], 'else' => $this->semStack[$stackPos - (5 - 5)]], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); + $this->semValue = new Stmt\If_($this->semStack[$stackPos - (5 - 2)], ['stmts' => is_array($this->semStack[$stackPos - (5 - 3)]) ? $this->semStack[$stackPos - (5 - 3)] : array($this->semStack[$stackPos - (5 - 3)]), 'elseifs' => $this->semStack[$stackPos - (5 - 4)], 'else' => $this->semStack[$stackPos - (5 - 5)]], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); }, 135 => function ($stackPos) { $this->semValue = new Stmt\If_($this->semStack[$stackPos - (8 - 2)], ['stmts' => $this->semStack[$stackPos - (8 - 4)], 'elseifs' => $this->semStack[$stackPos - (8 - 5)], 'else' => $this->semStack[$stackPos - (8 - 6)]], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); }, 136 => function ($stackPos) { $this->semValue = new Stmt\While_($this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); }, 137 => function ($stackPos) { - $this->semValue = new Stmt\Do_($this->semStack[$stackPos - (5 - 4)], \is_array($this->semStack[$stackPos - (5 - 2)]) ? $this->semStack[$stackPos - (5 - 2)] : array($this->semStack[$stackPos - (5 - 2)]), $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); + $this->semValue = new Stmt\Do_($this->semStack[$stackPos - (5 - 4)], is_array($this->semStack[$stackPos - (5 - 2)]) ? $this->semStack[$stackPos - (5 - 2)] : array($this->semStack[$stackPos - (5 - 2)]), $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); }, 138 => function ($stackPos) { $this->semValue = new Stmt\For_(['init' => $this->semStack[$stackPos - (9 - 3)], 'cond' => $this->semStack[$stackPos - (9 - 5)], 'loop' => $this->semStack[$stackPos - (9 - 7)], 'stmts' => $this->semStack[$stackPos - (9 - 9)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); }, 139 => function ($stackPos) { @@ -16434,15 +18976,15 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; $this->semValue = $this->semStack[$stackPos - (3 - 1)]; }, 194 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); + $this->semValue = is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); }, 195 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (4 - 2)]; }, 196 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); + $this->semValue = is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); }, 197 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (4 - 2)]; }, 198 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); + $this->semValue = is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); }, 199 => function ($stackPos) { $this->semValue = null; }, 200 => function ($stackPos) { @@ -16476,7 +19018,7 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract }, 213 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos]; }, 214 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); + $this->semValue = is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); }, 215 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (4 - 2)]; }, 216 => function ($stackPos) { @@ -16485,7 +19027,7 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; $this->semValue = $this->semStack[$stackPos - (2 - 1)]; }, 218 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos - (3 - 2)], \is_array($this->semStack[$stackPos - (3 - 3)]) ? $this->semStack[$stackPos - (3 - 3)] : array($this->semStack[$stackPos - (3 - 3)]), $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos - (3 - 2)], is_array($this->semStack[$stackPos - (3 - 3)]) ? $this->semStack[$stackPos - (3 - 3)] : array($this->semStack[$stackPos - (3 - 3)]), $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); }, 219 => function ($stackPos) { $this->semValue = array(); }, 220 => function ($stackPos) { @@ -16496,7 +19038,7 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract }, 222 => function ($stackPos) { $this->semValue = null; }, 223 => function ($stackPos) { - $this->semValue = new Stmt\Else_(\is_array($this->semStack[$stackPos - (2 - 2)]) ? $this->semStack[$stackPos - (2 - 2)] : array($this->semStack[$stackPos - (2 - 2)]), $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); + $this->semValue = new Stmt\Else_(is_array($this->semStack[$stackPos - (2 - 2)]) ? $this->semStack[$stackPos - (2 - 2)] : array($this->semStack[$stackPos - (2 - 2)]), $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); }, 224 => function ($stackPos) { $this->semValue = null; }, 225 => function ($stackPos) { @@ -16577,6 +19119,8 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract if ($this->semStack[$stackPos - (2 - 2)] !== null) { $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; $this->semValue = $this->semStack[$stackPos - (2 - 1)]; + } else { + $this->semValue = $this->semStack[$stackPos - (2 - 1)]; } }, 260 => function ($stackPos) { $this->semValue = array(); @@ -16661,7 +19205,7 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; $this->semValue = $this->semStack[$stackPos - (3 - 1)]; }, 294 => function ($stackPos) { - $this->semValue = new Node\VarLikeIdentifier(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Node\VarLikeIdentifier(substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 295 => function ($stackPos) { $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos - (1 - 1)], null, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 296 => function ($stackPos) { @@ -16829,7 +19373,7 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract $this->semValue = new Expr\Cast\Unset_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); }, 376 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes; - $attrs['kind'] = \strtolower($this->semStack[$stackPos - (2 - 1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $attrs['kind'] = (strtolower($this->semStack[$stackPos - (2 - 1)]) === 'exit') ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; $this->semValue = new Expr\Exit_($this->semStack[$stackPos - (2 - 2)], $attrs); }, 377 => function ($stackPos) { $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); @@ -16919,9 +19463,9 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract }, 416 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 417 => function ($stackPos) { - $this->semValue = new Name\FullyQualified(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Name\FullyQualified(substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 418 => function ($stackPos) { - $this->semValue = new Name\Relative(\substr($this->semStack[$stackPos - (1 - 1)], 10), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Name\Relative(substr($this->semStack[$stackPos - (1 - 1)], 10), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 419 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (1 - 1)]; }, 420 => function ($stackPos) { @@ -17144,7 +19688,7 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract }, 522 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (1 - 1)]; }, 523 => function ($stackPos) { - $var = \substr($this->semStack[$stackPos - (1 - 1)], 1); + $var = substr($this->semStack[$stackPos - (1 - 1)], 1); $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes) : $var; }, 524 => function ($stackPos) { $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); @@ -17246,21 +19790,21 @@ class Php5 extends \PHPUnit\PhpParser\ParserAbstract } function ($stackPos) { $this->semValue = $this->handleNamespaces($this->semStack[$stackPos - (1 - 1)]); }, 2 => function ($stackPos) { - if (\is_array($this->semStack[$stackPos - (2 - 2)])) { - $this->semValue = \array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); + if (is_array($this->semStack[$stackPos - (2 - 2)])) { + $this->semValue = array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); } else { $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; $this->semValue = $this->semStack[$stackPos - (2 - 1)]; @@ -17492,9 +20036,9 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract }, 95 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (1 - 1)]; }, 96 => function ($stackPos) { - $this->semValue = new Name(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Name(substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 97 => function ($stackPos) { - $this->semValue = new Expr\Variable(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Expr\Variable(substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 98 => function ($stackPos) { /* nothing */ }, 99 => function ($stackPos) { @@ -17623,8 +20167,8 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract }, 151 => function ($stackPos) { $this->semValue = new Node\Const_(new Node\Identifier($this->semStack[$stackPos - (3 - 1)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributeStack[$stackPos - (3 - 1)]), $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); }, 152 => function ($stackPos) { - if (\is_array($this->semStack[$stackPos - (2 - 2)])) { - $this->semValue = \array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); + if (is_array($this->semStack[$stackPos - (2 - 2)])) { + $this->semValue = array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); } else { $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; $this->semValue = $this->semStack[$stackPos - (2 - 1)]; @@ -17656,7 +20200,7 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract $attrs = $this->startAttributeStack[$stackPos - (3 - 1)]; $stmts = $this->semValue; if (!empty($attrs['comments'])) { - $stmts[0]->setAttribute('comments', \array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); + $stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); } } else { $startAttributes = $this->startAttributeStack[$stackPos - (3 - 1)]; @@ -17670,13 +20214,13 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract } } }, 160 => function ($stackPos) { - $this->semValue = new Stmt\If_($this->semStack[$stackPos - (7 - 3)], ['stmts' => \is_array($this->semStack[$stackPos - (7 - 5)]) ? $this->semStack[$stackPos - (7 - 5)] : array($this->semStack[$stackPos - (7 - 5)]), 'elseifs' => $this->semStack[$stackPos - (7 - 6)], 'else' => $this->semStack[$stackPos - (7 - 7)]], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); + $this->semValue = new Stmt\If_($this->semStack[$stackPos - (7 - 3)], ['stmts' => is_array($this->semStack[$stackPos - (7 - 5)]) ? $this->semStack[$stackPos - (7 - 5)] : array($this->semStack[$stackPos - (7 - 5)]), 'elseifs' => $this->semStack[$stackPos - (7 - 6)], 'else' => $this->semStack[$stackPos - (7 - 7)]], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); }, 161 => function ($stackPos) { $this->semValue = new Stmt\If_($this->semStack[$stackPos - (10 - 3)], ['stmts' => $this->semStack[$stackPos - (10 - 6)], 'elseifs' => $this->semStack[$stackPos - (10 - 7)], 'else' => $this->semStack[$stackPos - (10 - 8)]], $this->startAttributeStack[$stackPos - (10 - 1)] + $this->endAttributes); }, 162 => function ($stackPos) { $this->semValue = new Stmt\While_($this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 5)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); }, 163 => function ($stackPos) { - $this->semValue = new Stmt\Do_($this->semStack[$stackPos - (7 - 5)], \is_array($this->semStack[$stackPos - (7 - 2)]) ? $this->semStack[$stackPos - (7 - 2)] : array($this->semStack[$stackPos - (7 - 2)]), $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); + $this->semValue = new Stmt\Do_($this->semStack[$stackPos - (7 - 5)], is_array($this->semStack[$stackPos - (7 - 2)]) ? $this->semStack[$stackPos - (7 - 2)] : array($this->semStack[$stackPos - (7 - 2)]), $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); }, 164 => function ($stackPos) { $this->semValue = new Stmt\For_(['init' => $this->semStack[$stackPos - (9 - 3)], 'cond' => $this->semStack[$stackPos - (9 - 5)], 'loop' => $this->semStack[$stackPos - (9 - 7)], 'stmts' => $this->semStack[$stackPos - (9 - 9)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); }, 165 => function ($stackPos) { @@ -17841,15 +20385,15 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; $this->semValue = $this->semStack[$stackPos - (3 - 1)]; }, 232 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); + $this->semValue = is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); }, 233 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (4 - 2)]; }, 234 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); + $this->semValue = is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); }, 235 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (4 - 2)]; }, 236 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); + $this->semValue = is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); }, 237 => function ($stackPos) { $this->semValue = null; }, 238 => function ($stackPos) { @@ -17900,7 +20444,7 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract }, 259 => function ($stackPos) { $this->semValue = new Node\MatchArm(null, $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); }, 260 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); + $this->semValue = is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); }, 261 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (4 - 2)]; }, 262 => function ($stackPos) { @@ -17909,7 +20453,7 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; $this->semValue = $this->semStack[$stackPos - (2 - 1)]; }, 264 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos - (5 - 3)], \is_array($this->semStack[$stackPos - (5 - 5)]) ? $this->semStack[$stackPos - (5 - 5)] : array($this->semStack[$stackPos - (5 - 5)]), $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos - (5 - 3)], is_array($this->semStack[$stackPos - (5 - 5)]) ? $this->semStack[$stackPos - (5 - 5)] : array($this->semStack[$stackPos - (5 - 5)]), $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); }, 265 => function ($stackPos) { $this->semValue = array(); }, 266 => function ($stackPos) { @@ -17921,7 +20465,7 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract }, 268 => function ($stackPos) { $this->semValue = null; }, 269 => function ($stackPos) { - $this->semValue = new Stmt\Else_(\is_array($this->semStack[$stackPos - (2 - 2)]) ? $this->semStack[$stackPos - (2 - 2)] : array($this->semStack[$stackPos - (2 - 2)]), $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); + $this->semValue = new Stmt\Else_(is_array($this->semStack[$stackPos - (2 - 2)]) ? $this->semStack[$stackPos - (2 - 2)] : array($this->semStack[$stackPos - (2 - 2)]), $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); }, 270 => function ($stackPos) { $this->semValue = null; }, 271 => function ($stackPos) { @@ -18078,6 +20622,8 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract if ($this->semStack[$stackPos - (2 - 2)] !== null) { $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; $this->semValue = $this->semStack[$stackPos - (2 - 1)]; + } else { + $this->semValue = $this->semStack[$stackPos - (2 - 1)]; } }, 341 => function ($stackPos) { $this->semValue = array(); @@ -18175,7 +20721,7 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; $this->semValue = $this->semStack[$stackPos - (3 - 1)]; }, 380 => function ($stackPos) { - $this->semValue = new Node\VarLikeIdentifier(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Node\VarLikeIdentifier(substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 381 => function ($stackPos) { $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos - (1 - 1)], null, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 382 => function ($stackPos) { @@ -18347,7 +20893,7 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract $this->semValue = new Expr\Cast\Unset_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); }, 464 => function ($stackPos) { $attrs = $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes; - $attrs['kind'] = \strtolower($this->semStack[$stackPos - (2 - 1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $attrs['kind'] = (strtolower($this->semStack[$stackPos - (2 - 1)]) === 'exit') ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; $this->semValue = new Expr\Exit_($this->semStack[$stackPos - (2 - 2)], $attrs); }, 465 => function ($stackPos) { $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); @@ -18423,9 +20969,9 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract }, 499 => function ($stackPos) { $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 500 => function ($stackPos) { - $this->semValue = new Name\FullyQualified(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Name\FullyQualified(substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 501 => function ($stackPos) { - $this->semValue = new Name\Relative(\substr($this->semStack[$stackPos - (1 - 1)], 10), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); + $this->semValue = new Name\Relative(substr($this->semStack[$stackPos - (1 - 1)], 10), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); }, 502 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (1 - 1)]; }, 503 => function ($stackPos) { @@ -18613,9 +21159,9 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract $this->semValue = new Expr\List_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); }, 584 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - $end = \count($this->semValue) - 1; + $end = count($this->semValue) - 1; if ($this->semValue[$end] === null) { - \array_pop($this->semValue); + array_pop($this->semValue); } }, 585 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos]; @@ -18685,7 +21231,7 @@ class Php7 extends \PHPUnit\PhpParser\ParserAbstract } errorHandler = $errorHandler ?: new ErrorHandler\Throwing(); $this->lexer->startLexing($code, $this->errorHandler); @@ -19018,9 +21564,9 @@ abstract class ParserAbstract implements Parser // reduced after a token was read but not yet shifted. $tokenId = $this->lexer->getNextToken($tokenValue, $startAttributes, $endAttributes); // map the lexer token id to the internally used symbols - $symbol = $tokenId >= 0 && $tokenId < $this->tokenToSymbolMapSize ? $this->tokenToSymbol[$tokenId] : $this->invalidSymbol; + $symbol = ($tokenId >= 0 && $tokenId < $this->tokenToSymbolMapSize) ? $this->tokenToSymbol[$tokenId] : $this->invalidSymbol; if ($symbol === $this->invalidSymbol) { - throw new \RangeException(\sprintf('The lexer returned an invalid token (id=%d, value=%s)', $tokenId, $tokenValue)); + throw new \RangeException(sprintf('The lexer returned an invalid token (id=%d, value=%s)', $tokenId, $tokenValue)); } // Allow productions to access the start attributes of the lookahead token. $this->lookaheadStartAttributes = $startAttributes; @@ -19157,11 +21703,11 @@ abstract class ParserAbstract implements Parser * * @return string Formatted error message */ - protected function getErrorMessage(int $symbol, int $state) : string + protected function getErrorMessage(int $symbol, int $state): string { $expectedString = ''; if ($expected = $this->getExpectedTokens($state)) { - $expectedString = ', expecting ' . \implode(' or ', $expected); + $expectedString = ', expecting ' . implode(' or ', $expected); } return 'Syntax error, unexpected ' . $this->symbolToName[$symbol] . $expectedString; } @@ -19172,7 +21718,7 @@ abstract class ParserAbstract implements Parser * * @return string[] Expected tokens. If too many, an empty array is returned. */ - protected function getExpectedTokens(int $state) : array + protected function getExpectedTokens(int $state): array { $expected = []; $base = $this->actionBase[$state]; @@ -19180,7 +21726,7 @@ abstract class ParserAbstract implements Parser $idx = $base + $symbol; if ($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol || $state < $this->YY2TBLSTATE && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol) { if ($this->action[$idx] !== $this->unexpectedTokenRule && $this->action[$idx] !== $this->defaultAction && $symbol !== $this->errorSymbol) { - if (\count($expected) === 4) { + if (count($expected) === 4) { /* Too many expected tokens */ return []; } @@ -19232,7 +21778,7 @@ abstract class ParserAbstract implements Parser * @param Node\Stmt[] $stmts * @return Node\Stmt[] */ - protected function handleNamespaces(array $stmts) : array + protected function handleNamespaces(array $stmts): array { $hasErrored = \false; $style = $this->getNamespacingStyle($stmts); @@ -19295,7 +21841,7 @@ abstract class ParserAbstract implements Parser // We only move the builtin end attributes here. This is the best we can do with the // knowledge we have. $endAttributes = ['endLine', 'endFilePos', 'endTokenPos']; - $lastStmt = $stmt->stmts[\count($stmt->stmts) - 1]; + $lastStmt = $stmt->stmts[count($stmt->stmts) - 1]; foreach ($endAttributes as $endAttribute) { if ($lastStmt->hasAttribute($endAttribute)) { $stmt->setAttribute($endAttribute, $lastStmt->getAttribute($endAttribute)); @@ -19315,7 +21861,7 @@ abstract class ParserAbstract implements Parser $hasNotAllowedStmts = \false; foreach ($stmts as $i => $stmt) { if ($stmt instanceof Node\Stmt\Namespace_) { - $currentStyle = null === $stmt->stmts ? 'semicolon' : 'brace'; + $currentStyle = (null === $stmt->stmts) ? 'semicolon' : 'brace'; if (null === $style) { $style = $currentStyle; if ($hasNotAllowedStmts) { @@ -19333,7 +21879,7 @@ abstract class ParserAbstract implements Parser continue; } /* There may be a hashbang line at the very start of the file */ - if ($i === 0 && $stmt instanceof Node\Stmt\InlineHTML && \preg_match('/\\A#!.*\\r?\\n\\z/', $stmt->value)) { + if ($i === 0 && $stmt instanceof Node\Stmt\InlineHTML && preg_match('/\A#!.*\r?\n\z/', $stmt->value)) { continue; } /* Everything else if forbidden before namespace declarations */ @@ -19355,10 +21901,10 @@ abstract class ParserAbstract implements Parser * * @return Expr\StaticCall */ - protected function fixupPhp5StaticPropCall($prop, array $args, array $attributes) : Expr\StaticCall + protected function fixupPhp5StaticPropCall($prop, array $args, array $attributes): Expr\StaticCall { if ($prop instanceof Node\Expr\StaticPropertyFetch) { - $name = $prop->name instanceof VarLikeIdentifier ? $prop->name->toString() : $prop->name; + $name = ($prop->name instanceof VarLikeIdentifier) ? $prop->name->toString() : $prop->name; $var = new Expr\Variable($name, $prop->name->getAttributes()); return new Expr\StaticCall($prop->class, $var, $args, $attributes); } elseif ($prop instanceof Node\Expr\ArrayDimFetch) { @@ -19375,7 +21921,7 @@ abstract class ParserAbstract implements Parser $tmp = $tmp->var; $this->fixupStartAttributes($tmp, $staticProp->name); } - $name = $staticProp->name instanceof VarLikeIdentifier ? $staticProp->name->toString() : $staticProp->name; + $name = ($staticProp->name instanceof VarLikeIdentifier) ? $staticProp->name->toString() : $staticProp->name; $tmp->var = new Expr\Variable($name, $staticProp->name->getAttributes()); return new Expr\StaticCall($staticProp->class, $prop, $args, $attributes); } else { @@ -19410,17 +21956,17 @@ abstract class ParserAbstract implements Parser * * @return array Combined start and end attributes */ - protected function getAttributesAt(int $pos) : array + protected function getAttributesAt(int $pos): array { return $this->startAttributeStack[$pos] + $this->endAttributeStack[$pos]; } - protected function getFloatCastKind(string $cast) : int + protected function getFloatCastKind(string $cast): int { - $cast = \strtolower($cast); - if (\strpos($cast, 'float') !== \false) { + $cast = strtolower($cast); + if (strpos($cast, 'float') !== \false) { return Double::KIND_FLOAT; } - if (\strpos($cast, 'real') !== \false) { + if (strpos($cast, 'real') !== \false) { return Double::KIND_REAL; } return Double::KIND_DOUBLE; @@ -19445,11 +21991,11 @@ abstract class ParserAbstract implements Parser */ protected function parseNumString(string $str, array $attributes) { - if (!\preg_match('/^(?:0|-?[1-9][0-9]*)$/', $str)) { + if (!preg_match('/^(?:0|-?[1-9][0-9]*)$/', $str)) { return new String_($str, $attributes); } $num = +$str; - if (!\is_int($num)) { + if (!is_int($num)) { return new String_($str, $attributes); } return new LNumber($num, $attributes); @@ -19459,34 +22005,34 @@ abstract class ParserAbstract implements Parser if ($indentLen === 0) { return $string; } - $start = $newlineAtStart ? '(?:(?<=\\n)|\\A)' : '(?<=\\n)'; - $end = $newlineAtEnd ? '(?:(?=[\\r\\n])|\\z)' : '(?=[\\r\\n])'; - $regex = '/' . $start . '([ \\t]*)(' . $end . ')?/'; - return \preg_replace_callback($regex, function ($matches) use($indentLen, $indentChar, $attributes) { - $prefix = \substr($matches[1], 0, $indentLen); - if (\false !== \strpos($prefix, $indentChar === " " ? "\t" : " ")) { + $start = $newlineAtStart ? '(?:(?<=\n)|\A)' : '(?<=\n)'; + $end = $newlineAtEnd ? '(?:(?=[\r\n])|\z)' : '(?=[\r\n])'; + $regex = '/' . $start . '([ \t]*)(' . $end . ')?/'; + return preg_replace_callback($regex, function ($matches) use ($indentLen, $indentChar, $attributes) { + $prefix = substr($matches[1], 0, $indentLen); + if (\false !== strpos($prefix, ($indentChar === " ") ? "\t" : " ")) { $this->emitError(new Error('Invalid indentation - tabs and spaces cannot be mixed', $attributes)); - } elseif (\strlen($prefix) < $indentLen && !isset($matches[2])) { + } elseif (strlen($prefix) < $indentLen && !isset($matches[2])) { $this->emitError(new Error('Invalid body indentation level ' . '(expecting an indentation level of at least ' . $indentLen . ')', $attributes)); } - return \substr($matches[0], \strlen($prefix)); + return substr($matches[0], strlen($prefix)); }, $string); } protected function parseDocString(string $startToken, $contents, string $endToken, array $attributes, array $endTokenAttributes, bool $parseUnicodeEscape) { - $kind = \strpos($startToken, "'") === \false ? String_::KIND_HEREDOC : String_::KIND_NOWDOC; - $regex = '/\\A[bB]?<<<[ \\t]*[\'"]?([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)[\'"]?(?:\\r\\n|\\n|\\r)\\z/'; - $result = \preg_match($regex, $startToken, $matches); - \assert($result === 1); + $kind = (strpos($startToken, "'") === \false) ? String_::KIND_HEREDOC : String_::KIND_NOWDOC; + $regex = '/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/'; + $result = preg_match($regex, $startToken, $matches); + assert($result === 1); $label = $matches[1]; - $result = \preg_match('/\\A[ \\t]*/', $endToken, $matches); - \assert($result === 1); + $result = preg_match('/\A[ \t]*/', $endToken, $matches); + assert($result === 1); $indentation = $matches[0]; $attributes['kind'] = $kind; $attributes['docLabel'] = $label; $attributes['docIndentation'] = $indentation; - $indentHasSpaces = \false !== \strpos($indentation, " "); - $indentHasTabs = \false !== \strpos($indentation, "\t"); + $indentHasSpaces = \false !== strpos($indentation, " "); + $indentHasTabs = \false !== strpos($indentation, "\t"); if ($indentHasSpaces && $indentHasTabs) { $this->emitError(new Error('Invalid indentation - tabs and spaces cannot be mixed', $endTokenAttributes)); // Proceed processing as if this doc string is not indented @@ -19499,13 +22045,13 @@ abstract class ParserAbstract implements Parser return new String_('', $attributes); } $contents = $this->stripIndentation($contents, $indentLen, $indentChar, \true, \true, $attributes); - $contents = \preg_replace('~(\\r\\n|\\n|\\r)\\z~', '', $contents); + $contents = preg_replace('~(\r\n|\n|\r)\z~', '', $contents); if ($kind === String_::KIND_HEREDOC) { $contents = String_::parseEscapeSequences($contents, null, $parseUnicodeEscape); } return new String_($contents, $attributes); } else { - \assert(\count($contents) > 0); + assert(count($contents) > 0); if (!$contents[0] instanceof Node\Scalar\EncapsedStringPart) { // If there is no leading encapsed string part, pretend there is an empty one $this->stripIndentation('', $indentLen, $indentChar, \true, \false, $contents[0]->getAttributes()); @@ -19517,7 +22063,7 @@ abstract class ParserAbstract implements Parser $part->value = $this->stripIndentation($part->value, $indentLen, $indentChar, $i === 0, $isLast, $part->getAttributes()); $part->value = String_::parseEscapeSequences($part->value, null, $parseUnicodeEscape); if ($isLast) { - $part->value = \preg_replace('~(\\r\\n|\\n|\\r)\\z~', '', $part->value); + $part->value = preg_replace('~(\r\n|\n|\r)\z~', '', $part->value); } if ('' === $part->value) { continue; @@ -19536,7 +22082,7 @@ abstract class ParserAbstract implements Parser */ protected function createCommentNopAttributes(array $comments) { - $comment = $comments[\count($comments) - 1]; + $comment = $comments[count($comments) - 1]; $commentEndLine = $comment->getEndLine(); $commentEndFilePos = $comment->getEndFilePos(); $commentEndTokenPos = $comment->getEndTokenPos(); @@ -19617,14 +22163,14 @@ abstract class ParserAbstract implements Parser private function checkClassName($name, $namePos) { if (null !== $name && $name->isSpecialClassName()) { - $this->emitError(new Error(\sprintf('Cannot use \'%s\' as class name as it is reserved', $name), $this->getAttributesAt($namePos))); + $this->emitError(new Error(sprintf('Cannot use \'%s\' as class name as it is reserved', $name), $this->getAttributesAt($namePos))); } } private function checkImplementedInterfaces(array $interfaces) { foreach ($interfaces as $interface) { if ($interface->isSpecialClassName()) { - $this->emitError(new Error(\sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface), $interface->getAttributes())); + $this->emitError(new Error(sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface), $interface->getAttributes())); } } } @@ -19632,7 +22178,7 @@ abstract class ParserAbstract implements Parser { $this->checkClassName($node->name, $namePos); if ($node->extends && $node->extends->isSpecialClassName()) { - $this->emitError(new Error(\sprintf('Cannot use \'%s\' as class name as it is reserved', $node->extends), $node->extends->getAttributes())); + $this->emitError(new Error(sprintf('Cannot use \'%s\' as class name as it is reserved', $node->extends), $node->extends->getAttributes())); } $this->checkImplementedInterfaces($node->implements); } @@ -19651,18 +22197,18 @@ abstract class ParserAbstract implements Parser if ($node->flags & Class_::MODIFIER_STATIC) { switch ($node->name->toLowerString()) { case '__construct': - $this->emitError(new Error(\sprintf('Constructor %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos))); + $this->emitError(new Error(sprintf('Constructor %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos))); break; case '__destruct': - $this->emitError(new Error(\sprintf('Destructor %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos))); + $this->emitError(new Error(sprintf('Destructor %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos))); break; case '__clone': - $this->emitError(new Error(\sprintf('Clone method %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos))); + $this->emitError(new Error(sprintf('Clone method %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos))); break; } } if ($node->flags & Class_::MODIFIER_READONLY) { - $this->emitError(new Error(\sprintf('Method %s() cannot be readonly', $node->name), $this->getAttributesAt($modifierPos))); + $this->emitError(new Error(sprintf('Method %s() cannot be readonly', $node->name), $this->getAttributesAt($modifierPos))); } } protected function checkClassConst(ClassConst $node, $modifierPos) @@ -19689,15 +22235,17 @@ abstract class ParserAbstract implements Parser protected function checkUseUse(UseUse $node, $namePos) { if ($node->alias && $node->alias->isSpecialClassName()) { - $this->emitError(new Error(\sprintf('Cannot use %s as %s because \'%2$s\' is a special class name', $node->name, $node->alias), $this->getAttributesAt($namePos))); + $this->emitError(new Error(sprintf('Cannot use %s as %s because \'%2$s\' is a special class name', $node->name, $node->alias), $this->getAttributesAt($namePos))); } } } getLexerOptions())); + } + /** + * Create a parser targeting the host PHP version, that is the PHP version we're currently + * running on. This parser will not use any token emulation. + * + * All supported lexer attributes (comments, startLine, endLine, startTokenPos, endTokenPos, + * startFilePos, endFilePos) will be enabled. + */ + public function createForHostVersion(): Parser + { + return new Php7(new Lexer($this->getLexerOptions())); + } + private function getLexerOptions(): array + { + return ['usedAttributes' => ['comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos', 'startFilePos', 'endFilePos']]; + } } p($typeNode); } - return \implode('|', $types); + return implode('|', $types); } protected function pIntersectionType(Node\IntersectionType $node) { @@ -19805,15 +22380,15 @@ class Standard extends PrettyPrinterAbstract // Names protected function pName(Name $node) { - return \implode('\\', $node->parts); + return implode('\\', $node->parts); } protected function pName_FullyQualified(Name\FullyQualified $node) { - return '\\' . \implode('\\', $node->parts); + return '\\' . implode('\\', $node->parts); } protected function pName_Relative(Name\Relative $node) { - return 'namespace\\' . \implode('\\', $node->parts); + return 'namespace\\' . implode('\\', $node->parts); } // Magic Constants protected function pScalar_MagicConst_Class(MagicConst\Class_ $node) @@ -19884,7 +22459,7 @@ class Standard extends PrettyPrinterAbstract if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) { $label = $node->getAttribute('docLabel'); if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) { - if (\count($node->parts) === 1 && $node->parts[0] instanceof Scalar\EncapsedStringPart && $node->parts[0]->value === '') { + if (count($node->parts) === 1 && $node->parts[0] instanceof Scalar\EncapsedStringPart && $node->parts[0]->value === '') { return "<<<{$label}\n{$label}" . $this->docStringEndToken; } return "<<<{$label}\n" . $this->pEncapsList($node->parts, null) . "\n{$label}" . $this->docStringEndToken; @@ -19912,36 +22487,36 @@ class Standard extends PrettyPrinterAbstract } switch ($kind) { case Scalar\LNumber::KIND_BIN: - return $sign . '0b' . \base_convert($str, 10, 2); + return $sign . '0b' . base_convert($str, 10, 2); case Scalar\LNumber::KIND_OCT: - return $sign . '0' . \base_convert($str, 10, 8); + return $sign . '0' . base_convert($str, 10, 8); case Scalar\LNumber::KIND_HEX: - return $sign . '0x' . \base_convert($str, 10, 16); + return $sign . '0x' . base_convert($str, 10, 16); } throw new \Exception('Invalid number kind'); } protected function pScalar_DNumber(Scalar\DNumber $node) { - if (!\is_finite($node->value)) { + if (!is_finite($node->value)) { if ($node->value === \INF) { - return '\\INF'; + return '\INF'; } elseif ($node->value === -\INF) { - return '-\\INF'; + return '-\INF'; } else { - return '\\NAN'; + return '\NAN'; } } // Try to find a short full-precision representation - $stringValue = \sprintf('%.16G', $node->value); + $stringValue = sprintf('%.16G', $node->value); if ($node->value !== (double) $stringValue) { - $stringValue = \sprintf('%.17G', $node->value); + $stringValue = sprintf('%.17G', $node->value); } // %G is locale dependent and there exists no locale-independent alternative. We don't want // mess with switching locales here, so let's assume that a comma is the only non-standard // decimal separator we may encounter... - $stringValue = \str_replace(',', '.', $stringValue); + $stringValue = str_replace(',', '.', $stringValue); // ensure that number is really printed as float - return \preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue; + return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue; } protected function pScalar_EncapsedStringPart(Scalar\EncapsedStringPart $node) { @@ -20227,7 +22802,7 @@ class Standard extends PrettyPrinterAbstract } protected function pExpr_StaticCall(Expr\StaticCall $node) { - return $this->pStaticDereferenceLhs($node->class) . '::' . ($node->name instanceof Expr ? $node->name instanceof Expr\Variable ? $this->p($node->name) : '{' . $this->p($node->name) . '}' : $node->name) . '(' . $this->pMaybeMultiline($node->args) . ')'; + return $this->pStaticDereferenceLhs($node->class) . '::' . (($node->name instanceof Expr) ? ($node->name instanceof Expr\Variable) ? $this->p($node->name) : ('{' . $this->p($node->name) . '}') : $node->name) . '(' . $this->pMaybeMultiline($node->args) . ')'; } protected function pExpr_Empty(Expr\Empty_ $node) { @@ -20274,11 +22849,11 @@ class Standard extends PrettyPrinterAbstract } protected function pExpr_ArrayItem(Expr\ArrayItem $node) { - return (null !== $node->key ? $this->p($node->key) . ' => ' : '') . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') . $this->p($node->value); + return ((null !== $node->key) ? $this->p($node->key) . ' => ' : '') . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') . $this->p($node->value); } protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) { - return $this->pDereferenceLhs($node->var) . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']'; + return $this->pDereferenceLhs($node->var) . '[' . ((null !== $node->dim) ? $this->p($node->dim) : '') . ']'; } protected function pExpr_ConstFetch(Expr\ConstFetch $node) { @@ -20306,7 +22881,7 @@ class Standard extends PrettyPrinterAbstract } protected function pExpr_Closure(Expr\Closure $node) { - return $this->pAttrGroups($node->attrGroups, \true) . ($node->static ? 'static ' : '') . 'function ' . ($node->byRef ? '&' : '') . '(' . $this->pCommaSeparated($node->params) . ')' . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '') . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; + return $this->pAttrGroups($node->attrGroups, \true) . ($node->static ? 'static ' : '') . 'function ' . ($node->byRef ? '&' : '') . '(' . $this->pCommaSeparated($node->params) . ')' . ((!empty($node->uses)) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '') . ((null !== $node->returnType) ? ' : ' . $this->p($node->returnType) : '') . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pExpr_Match(Expr\Match_ $node) { @@ -20318,7 +22893,7 @@ class Standard extends PrettyPrinterAbstract } protected function pExpr_ArrowFunction(Expr\ArrowFunction $node) { - return $this->pAttrGroups($node->attrGroups, \true) . ($node->static ? 'static ' : '') . 'fn' . ($node->byRef ? '&' : '') . '(' . $this->pCommaSeparated($node->params) . ')' . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') . ' => ' . $this->p($node->expr); + return $this->pAttrGroups($node->attrGroups, \true) . ($node->static ? 'static ' : '') . 'fn' . ($node->byRef ? '&' : '') . '(' . $this->pCommaSeparated($node->params) . ')' . ((null !== $node->returnType) ? ': ' . $this->p($node->returnType) : '') . ' => ' . $this->p($node->expr); } protected function pExpr_ClosureUse(Expr\ClosureUse $node) { @@ -20340,12 +22915,12 @@ class Standard extends PrettyPrinterAbstract { // a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator. // this is okay because the part between ? and : never needs parentheses. - return $this->pInfixOp(Expr\Ternary::class, $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else); + return $this->pInfixOp(Expr\Ternary::class, $node->cond, ' ?' . ((null !== $node->if) ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else); } protected function pExpr_Exit(Expr\Exit_ $node) { $kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE); - return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die') . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); + return (($kind === Expr\Exit_::KIND_EXIT) ? 'exit' : 'die') . ((null !== $node->expr) ? '(' . $this->p($node->expr) . ')' : ''); } protected function pExpr_Throw(Expr\Throw_ $node) { @@ -20357,7 +22932,7 @@ class Standard extends PrettyPrinterAbstract return 'yield'; } else { // this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary - return '(yield ' . ($node->key !== null ? $this->p($node->key) . ' => ' : '') . $this->p($node->value) . ')'; + return '(yield ' . (($node->key !== null) ? $this->p($node->key) . ' => ' : '') . $this->p($node->value) . ')'; } } // Declarations @@ -20366,7 +22941,7 @@ class Standard extends PrettyPrinterAbstract if ($this->canUseSemicolonNamespaces) { return 'namespace ' . $this->p($node->name) . ';' . $this->nl . $this->pStmts($node->stmts, \false); } else { - return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '') . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; + return 'namespace' . ((null !== $node->name) ? ' ' . $this->p($node->name) : '') . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; } } protected function pStmt_Use(Stmt\Use_ $node) @@ -20375,23 +22950,23 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_GroupUse(Stmt\GroupUse $node) { - return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix) . '\\{' . $this->pCommaSeparated($node->uses) . '};'; + return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix) . '\{' . $this->pCommaSeparated($node->uses) . '};'; } protected function pStmt_UseUse(Stmt\UseUse $node) { - return $this->pUseType($node->type) . $this->p($node->name) . (null !== $node->alias ? ' as ' . $node->alias : ''); + return $this->pUseType($node->type) . $this->p($node->name) . ((null !== $node->alias) ? ' as ' . $node->alias : ''); } protected function pUseType($type) { - return $type === Stmt\Use_::TYPE_FUNCTION ? 'function ' : ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : ''); + return ($type === Stmt\Use_::TYPE_FUNCTION) ? 'function ' : (($type === Stmt\Use_::TYPE_CONSTANT) ? 'const ' : ''); } protected function pStmt_Interface(Stmt\Interface_ $node) { - return $this->pAttrGroups($node->attrGroups) . 'interface ' . $node->name . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + return $this->pAttrGroups($node->attrGroups) . 'interface ' . $node->name . ((!empty($node->extends)) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Enum(Stmt\Enum_ $node) { - return $this->pAttrGroups($node->attrGroups) . 'enum ' . $node->name . ($node->scalarType ? " : {$node->scalarType}" : '') . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + return $this->pAttrGroups($node->attrGroups) . 'enum ' . $node->name . ($node->scalarType ? " : {$node->scalarType}" : '') . ((!empty($node->implements)) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Class(Stmt\Class_ $node) { @@ -20407,7 +22982,7 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_TraitUse(Stmt\TraitUse $node) { - return 'use ' . $this->pCommaSeparated($node->traits) . (empty($node->adaptations) ? ';' : ' {' . $this->pStmts($node->adaptations) . $this->nl . '}'); + return 'use ' . $this->pCommaSeparated($node->traits) . (empty($node->adaptations) ? ';' : (' {' . $this->pStmts($node->adaptations) . $this->nl . '}')); } protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) { @@ -20415,27 +22990,27 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) { - return (null !== $node->trait ? $this->p($node->trait) . '::' : '') . $node->method . ' as' . (null !== $node->newModifier ? ' ' . \rtrim($this->pModifiers($node->newModifier), ' ') : '') . (null !== $node->newName ? ' ' . $node->newName : '') . ';'; + return ((null !== $node->trait) ? $this->p($node->trait) . '::' : '') . $node->method . ' as' . ((null !== $node->newModifier) ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '') . ((null !== $node->newName) ? ' ' . $node->newName : '') . ';'; } protected function pStmt_Property(Stmt\Property $node) { - return $this->pAttrGroups($node->attrGroups) . (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) . ($node->type ? $this->p($node->type) . ' ' : '') . $this->pCommaSeparated($node->props) . ';'; + return $this->pAttrGroups($node->attrGroups) . ((0 === $node->flags) ? 'var ' : $this->pModifiers($node->flags)) . ($node->type ? $this->p($node->type) . ' ' : '') . $this->pCommaSeparated($node->props) . ';'; } protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) { - return '$' . $node->name . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); + return '$' . $node->name . ((null !== $node->default) ? ' = ' . $this->p($node->default) : ''); } protected function pStmt_ClassMethod(Stmt\ClassMethod $node) { - return $this->pAttrGroups($node->attrGroups) . $this->pModifiers($node->flags) . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pMaybeMultiline($node->params) . ')' . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') . (null !== $node->stmts ? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); + return $this->pAttrGroups($node->attrGroups) . $this->pModifiers($node->flags) . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pMaybeMultiline($node->params) . ')' . ((null !== $node->returnType) ? ' : ' . $this->p($node->returnType) : '') . ((null !== $node->stmts) ? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); } protected function pStmt_ClassConst(Stmt\ClassConst $node) { - return $this->pAttrGroups($node->attrGroups) . $this->pModifiers($node->flags) . 'const ' . (null !== $node->type ? $this->p($node->type) . ' ' : '') . $this->pCommaSeparated($node->consts) . ';'; + return $this->pAttrGroups($node->attrGroups) . $this->pModifiers($node->flags) . 'const ' . ((null !== $node->type) ? $this->p($node->type) . ' ' : '') . $this->pCommaSeparated($node->consts) . ';'; } protected function pStmt_Function(Stmt\Function_ $node) { - return $this->pAttrGroups($node->attrGroups) . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pCommaSeparated($node->params) . ')' . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + return $this->pAttrGroups($node->attrGroups) . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pCommaSeparated($node->params) . ')' . ((null !== $node->returnType) ? ' : ' . $this->p($node->returnType) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Const(Stmt\Const_ $node) { @@ -20443,7 +23018,7 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_Declare(Stmt\Declare_ $node) { - return 'declare (' . $this->pCommaSeparated($node->declares) . ')' . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); + return 'declare (' . $this->pCommaSeparated($node->declares) . ')' . ((null !== $node->stmts) ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); } protected function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) { @@ -20452,7 +23027,7 @@ class Standard extends PrettyPrinterAbstract // Control flow protected function pStmt_If(Stmt\If_ $node) { - return 'if (' . $this->p($node->cond) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}' . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '') . (null !== $node->else ? ' ' . $this->p($node->else) : ''); + return 'if (' . $this->p($node->cond) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}' . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '') . ((null !== $node->else) ? ' ' . $this->p($node->else) : ''); } protected function pStmt_ElseIf(Stmt\ElseIf_ $node) { @@ -20464,11 +23039,11 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_For(Stmt\For_ $node) { - return 'for (' . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '') . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '') . $this->pCommaSeparated($node->loop) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; + return 'for (' . $this->pCommaSeparated($node->init) . ';' . ((!empty($node->cond)) ? ' ' : '') . $this->pCommaSeparated($node->cond) . ';' . ((!empty($node->loop)) ? ' ' : '') . $this->pCommaSeparated($node->loop) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Foreach(Stmt\Foreach_ $node) { - return 'foreach (' . $this->p($node->expr) . ' as ' . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '') . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; + return 'foreach (' . $this->p($node->expr) . ' as ' . ((null !== $node->keyVar) ? $this->p($node->keyVar) . ' => ' : '') . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_While(Stmt\While_ $node) { @@ -20484,15 +23059,15 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_Case(Stmt\Case_ $node) { - return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':' . $this->pStmts($node->stmts); + return ((null !== $node->cond) ? 'case ' . $this->p($node->cond) : 'default') . ':' . $this->pStmts($node->stmts); } protected function pStmt_TryCatch(Stmt\TryCatch $node) { - return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}' . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '') . ($node->finally !== null ? ' ' . $this->p($node->finally) : ''); + return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}' . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '') . (($node->finally !== null) ? ' ' . $this->p($node->finally) : ''); } protected function pStmt_Catch(Stmt\Catch_ $node) { - return 'catch (' . $this->pImplode($node->types, '|') . ($node->var !== null ? ' ' . $this->p($node->var) : '') . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; + return 'catch (' . $this->pImplode($node->types, '|') . (($node->var !== null) ? ' ' . $this->p($node->var) : '') . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Finally(Stmt\Finally_ $node) { @@ -20500,15 +23075,15 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_Break(Stmt\Break_ $node) { - return 'break' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';'; + return 'break' . (($node->num !== null) ? ' ' . $this->p($node->num) : '') . ';'; } protected function pStmt_Continue(Stmt\Continue_ $node) { - return 'continue' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';'; + return 'continue' . (($node->num !== null) ? ' ' . $this->p($node->num) : '') . ';'; } protected function pStmt_Return(Stmt\Return_ $node) { - return 'return' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '') . ';'; + return 'return' . ((null !== $node->expr) ? ' ' . $this->p($node->expr) : '') . ';'; } protected function pStmt_Throw(Stmt\Throw_ $node) { @@ -20541,7 +23116,7 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_StaticVar(Stmt\StaticVar $node) { - return $this->p($node->var) . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); + return $this->p($node->var) . ((null !== $node->default) ? ' = ' . $this->p($node->default) : ''); } protected function pStmt_Unset(Stmt\Unset_ $node) { @@ -20563,7 +23138,7 @@ class Standard extends PrettyPrinterAbstract // Helpers protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) { - return $this->pAttrGroups($node->attrGroups, $node->name === null) . $this->pModifiers($node->flags) . 'class' . $afterClassToken . (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '') . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + return $this->pAttrGroups($node->attrGroups, $node->name === null) . $this->pModifiers($node->flags) . 'class' . $afterClassToken . ((null !== $node->extends) ? ' extends ' . $this->p($node->extends) : '') . ((!empty($node->implements)) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pObjectProperty($node) { @@ -20587,50 +23162,50 @@ class Standard extends PrettyPrinterAbstract } protected function pSingleQuotedString(string $string) { - return '\'' . \addcslashes($string, '\'\\') . '\''; + return '\'' . addcslashes($string, '\'\\') . '\''; } protected function escapeString($string, $quote) { if (null === $quote) { // For doc strings, don't escape newlines - $escaped = \addcslashes($string, "\t\f\v\$\\"); + $escaped = addcslashes($string, "\t\f\v\$\\"); } else { - $escaped = \addcslashes($string, "\n\r\t\f\v\$" . $quote . "\\"); + $escaped = addcslashes($string, "\n\r\t\f\v\$" . $quote . "\\"); } // Escape control characters and non-UTF-8 characters. // Regex based on https://stackoverflow.com/a/11709412/385378. $regex = '/( - [\\x00-\\x08\\x0E-\\x1F] # Control characters - | [\\xC0-\\xC1] # Invalid UTF-8 Bytes - | [\\xF5-\\xFF] # Invalid UTF-8 Bytes - | \\xE0(?=[\\x80-\\x9F]) # Overlong encoding of prior code point - | \\xF0(?=[\\x80-\\x8F]) # Overlong encoding of prior code point - | [\\xC2-\\xDF](?![\\x80-\\xBF]) # Invalid UTF-8 Sequence Start - | [\\xE0-\\xEF](?![\\x80-\\xBF]{2}) # Invalid UTF-8 Sequence Start - | [\\xF0-\\xF4](?![\\x80-\\xBF]{3}) # Invalid UTF-8 Sequence Start - | (?<=[\\x00-\\x7F\\xF5-\\xFF])[\\x80-\\xBF] # Invalid UTF-8 Sequence Middle - | (? $part) { $atStart = $i === 0; - $atEnd = $i === \count($parts) - 1; + $atEnd = $i === count($parts) - 1; if ($part instanceof Scalar\EncapsedStringPart && $this->containsEndLabel($part->value, $label, $atStart, $atEnd)) { return \true; } @@ -20661,7 +23236,7 @@ class Standard extends PrettyPrinterAbstract return '(' . $this->p($node) . ')'; } } - protected function pNewVariable(Node $node) : string + protected function pNewVariable(Node $node): string { if (!$this->newOperandRequiresParens($node)) { return $this->p($node); @@ -20690,7 +23265,7 @@ class Standard extends PrettyPrinterAbstract return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . $this->nl; } } - protected function pAttrGroups(array $nodes, bool $inline = \false) : string + protected function pAttrGroups(array $nodes, bool $inline = \false): string { $result = ''; $sep = $inline ? ' ' : $this->nl; @@ -20703,17 +23278,17 @@ class Standard extends PrettyPrinterAbstract docStringEndToken = '_DOC_STRING_END_' . \mt_rand(); + $this->docStringEndToken = '_DOC_STRING_END_' . mt_rand(); $defaultOptions = ['shortArraySyntax' => \false]; $this->options = $options + $defaultOptions; } @@ -20891,9 +23466,9 @@ abstract class PrettyPrinterAbstract */ protected function outdent() { - \assert($this->indentLevel >= 4); + assert($this->indentLevel >= 4); $this->indentLevel -= 4; - $this->nl = "\n" . \str_repeat(' ', $this->indentLevel); + $this->nl = "\n" . str_repeat(' ', $this->indentLevel); } /** * Pretty prints an array of statements. @@ -20902,11 +23477,11 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed statements */ - public function prettyPrint(array $stmts) : string + public function prettyPrint(array $stmts): string { $this->resetState(); $this->preprocessNodes($stmts); - return \ltrim($this->handleMagicTokens($this->pStmts($stmts, \false))); + return ltrim($this->handleMagicTokens($this->pStmts($stmts, \false))); } /** * Pretty prints an expression. @@ -20915,7 +23490,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed node */ - public function prettyPrintExpr(Expr $node) : string + public function prettyPrintExpr(Expr $node): string { $this->resetState(); return $this->handleMagicTokens($this->p($node)); @@ -20927,17 +23502,17 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed statements */ - public function prettyPrintFile(array $stmts) : string + public function prettyPrintFile(array $stmts): string { if (!$stmts) { return "prettyPrint($stmts); if ($stmts[0] instanceof Stmt\InlineHTML) { - $p = \preg_replace('/^<\\?php\\s+\\?>\\n?/', '', $p); + $p = preg_replace('/^<\?php\s+\?>\n?/', '', $p); } - if ($stmts[\count($stmts) - 1] instanceof Stmt\InlineHTML) { - $p = \preg_replace('/<\\?php$/', '', \rtrim($p)); + if ($stmts[count($stmts) - 1] instanceof Stmt\InlineHTML) { + $p = preg_replace('/<\?php$/', '', rtrim($p)); } return $p; } @@ -20963,11 +23538,11 @@ abstract class PrettyPrinterAbstract * @param string $str * @return string */ - protected function handleMagicTokens(string $str) : string + protected function handleMagicTokens(string $str): string { // Replace doc-string-end tokens with nothing or a newline - $str = \str_replace($this->docStringEndToken . ";\n", ";\n", $str); - $str = \str_replace($this->docStringEndToken, "\n", $str); + $str = str_replace($this->docStringEndToken . ";\n", ";\n", $str); + $str = str_replace($this->docStringEndToken, "\n", $str); return $str; } /** @@ -20978,7 +23553,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed statements */ - protected function pStmts(array $nodes, bool $indent = \true) : string + protected function pStmts(array $nodes, bool $indent = \true): string { if ($indent) { $this->indent(); @@ -21009,7 +23584,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed infix operation */ - protected function pInfixOp(string $class, Node $leftNode, string $operatorString, Node $rightNode) : string + protected function pInfixOp(string $class, Node $leftNode, string $operatorString, Node $rightNode): string { list($precedence, $associativity) = $this->precedenceMap[$class]; return $this->pPrec($leftNode, $precedence, $associativity, -1) . $operatorString . $this->pPrec($rightNode, $precedence, $associativity, 1); @@ -21023,7 +23598,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed prefix operation */ - protected function pPrefixOp(string $class, string $operatorString, Node $node) : string + protected function pPrefixOp(string $class, string $operatorString, Node $node): string { list($precedence, $associativity) = $this->precedenceMap[$class]; return $operatorString . $this->pPrec($node, $precedence, $associativity, 1); @@ -21037,7 +23612,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed postfix operation */ - protected function pPostfixOp(string $class, Node $node, string $operatorString) : string + protected function pPostfixOp(string $class, Node $node, string $operatorString): string { list($precedence, $associativity) = $this->precedenceMap[$class]; return $this->pPrec($node, $precedence, $associativity, -1) . $operatorString; @@ -21054,7 +23629,7 @@ abstract class PrettyPrinterAbstract * * @return string The pretty printed node */ - protected function pPrec(Node $node, int $parentPrecedence, int $parentAssociativity, int $childPosition) : string + protected function pPrec(Node $node, int $parentPrecedence, int $parentAssociativity, int $childPosition): string { $class = \get_class($node); if (isset($this->precedenceMap[$class])) { @@ -21073,7 +23648,7 @@ abstract class PrettyPrinterAbstract * * @return string Imploded pretty printed nodes */ - protected function pImplode(array $nodes, string $glue = '') : string + protected function pImplode(array $nodes, string $glue = ''): string { $pNodes = []; foreach ($nodes as $node) { @@ -21083,7 +23658,7 @@ abstract class PrettyPrinterAbstract $pNodes[] = $this->p($node); } } - return \implode($glue, $pNodes); + return implode($glue, $pNodes); } /** * Pretty prints an array of nodes and implodes the printed values with commas. @@ -21092,7 +23667,7 @@ abstract class PrettyPrinterAbstract * * @return string Comma separated pretty printed nodes */ - protected function pCommaSeparated(array $nodes) : string + protected function pCommaSeparated(array $nodes): string { return $this->pImplode($nodes, ', '); } @@ -21106,11 +23681,11 @@ abstract class PrettyPrinterAbstract * * @return string Comma separated pretty printed nodes in multiline style */ - protected function pCommaSeparatedMultiline(array $nodes, bool $trailingComma) : string + protected function pCommaSeparatedMultiline(array $nodes, bool $trailingComma): string { $this->indent(); $result = ''; - $lastIdx = \count($nodes) - 1; + $lastIdx = count($nodes) - 1; foreach ($nodes as $idx => $node) { if ($node !== null) { $comments = $node->getComments(); @@ -21135,13 +23710,13 @@ abstract class PrettyPrinterAbstract * * @return string Reformatted text of comments */ - protected function pComments(array $comments) : string + protected function pComments(array $comments): string { $formattedComments = []; foreach ($comments as $comment) { - $formattedComments[] = \str_replace("\n", $this->nl, $comment->getReformattedText()); + $formattedComments[] = str_replace("\n", $this->nl, $comment->getReformattedText()); } - return \implode($this->nl, $formattedComments); + return implode($this->nl, $formattedComments); } /** * Perform a format-preserving pretty print of an AST. @@ -21160,7 +23735,7 @@ abstract class PrettyPrinterAbstract * * @return string */ - public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens) : string + public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens): string { $this->initializeNodeListDiffer(); $this->initializeLabelCharMap(); @@ -21176,13 +23751,13 @@ abstract class PrettyPrinterAbstract $pos = 0; $result = $this->pArray($stmts, $origStmts, $pos, 0, 'File', 'stmts', null); if (null !== $result) { - $result .= $this->origTokens->getTokenCode($pos, \count($origTokens), 0); + $result .= $this->origTokens->getTokenCode($pos, count($origTokens), 0); } else { // Fallback // TODO Add pStmts($stmts, \false); } - return \ltrim($this->handleMagicTokens($result)); + return ltrim($this->handleMagicTokens($result)); } protected function pFallback(Node $node) { @@ -21198,7 +23773,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed node */ - protected function p(Node $node, $parentFormatPreserved = \false) : string + protected function p(Node $node, $parentFormatPreserved = \false): string { // No orig tokens means this is a normal pretty print without preservation of formatting if (!$this->origTokens) { @@ -21239,7 +23814,7 @@ abstract class PrettyPrinterAbstract // Unchanged, can reuse old code continue; } - if (\is_array($subNode) && \is_array($origSubNode)) { + if (is_array($subNode) && is_array($origSubNode)) { // Array subnode changed, we might be able to reconstruct it $listResult = $this->pArray($subNode, $origSubNode, $pos, $indentAdjustment, $type, $subNodeName, $fixupInfo[$subNodeName] ?? null); if (null === $listResult) { @@ -21248,7 +23823,7 @@ abstract class PrettyPrinterAbstract $result .= $listResult; continue; } - if (\is_int($subNode) && \is_int($origSubNode)) { + if (is_int($subNode) && is_int($origSubNode)) { // Check if this is a modifier change $key = $type . '->' . $subNodeName; if (!isset($this->modifierChangeMap[$key])) { @@ -21282,7 +23857,7 @@ abstract class PrettyPrinterAbstract } list($findToken, $beforeToken, $extraLeft, $extraRight) = $this->insertionMap[$key]; if (null !== $findToken) { - $subStartPos = $this->origTokens->findRight($pos, $findToken) + (int) (!$beforeToken); + $subStartPos = $this->origTokens->findRight($pos, $findToken) + (int) !$beforeToken; } else { $subStartPos = $pos; } @@ -21489,12 +24064,10 @@ abstract class PrettyPrinterAbstract // instead of the other way around. $result .= $this->origTokens->getTokenCode($pos, $itemStartPos, $indentAdjustment); $skipRemovedNode = \true; - } else { - if ($isStmtList && ($this->origTokens->haveBracesInRange($pos, $itemStartPos) || $this->origTokens->haveTagInRange($pos, $itemStartPos))) { - // We'd remove the brace of a code block. - // TODO: Preserve formatting. - return null; - } + } else if ($isStmtList && ($this->origTokens->haveBracesInRange($pos, $itemStartPos) || $this->origTokens->haveTagInRange($pos, $itemStartPos))) { + // We'd remove the brace of a code block. + // TODO: Preserve formatting. + return null; } $pos = $itemEndPos + 1; continue; @@ -21536,7 +24109,7 @@ abstract class PrettyPrinterAbstract $result .= $this->p($delayedAddNode, \true); $first = \false; } - $result .= $extraRight === "\n" ? $this->nl : $extraRight; + $result .= ($extraRight === "\n") ? $this->nl : $extraRight; } return $result; } @@ -21555,14 +24128,14 @@ abstract class PrettyPrinterAbstract * * @return string Result of fixed-up print of subnode */ - protected function pFixup(int $fixup, Node $subNode, $parentClass, int $subStartPos, int $subEndPos) : string + protected function pFixup(int $fixup, Node $subNode, $parentClass, int $subStartPos, int $subEndPos): string { switch ($fixup) { case self::FIXUP_PREC_LEFT: case self::FIXUP_PREC_RIGHT: if (!$this->origTokens->haveParens($subStartPos, $subEndPos)) { list($precedence, $associativity) = $this->precedenceMap[$parentClass]; - return $this->pPrec($subNode, $precedence, $associativity, $fixup === self::FIXUP_PREC_LEFT ? -1 : 1); + return $this->pPrec($subNode, $precedence, $associativity, ($fixup === self::FIXUP_PREC_LEFT) ? -1 : 1); } break; case self::FIXUP_CALL_LHS: @@ -21588,7 +24161,7 @@ abstract class PrettyPrinterAbstract case self::FIXUP_BRACED_NAME: case self::FIXUP_VAR_BRACED_NAME: if ($subNode instanceof Expr && !$this->origTokens->haveBraces($subStartPos, $subEndPos)) { - return ($fixup === self::FIXUP_VAR_BRACED_NAME ? '$' : '') . '{' . $this->p($subNode) . '}'; + return (($fixup === self::FIXUP_VAR_BRACED_NAME) ? '$' : '') . '{' . $this->p($subNode) . '}'; } break; case self::FIXUP_ENCAPSED: @@ -21633,7 +24206,7 @@ abstract class PrettyPrinterAbstract * * @return bool Whether parentheses are required */ - protected function callLhsRequiresParens(Node $node) : bool + protected function callLhsRequiresParens(Node $node): bool { return !($node instanceof Node\Name || $node instanceof Expr\Variable || $node instanceof Expr\ArrayDimFetch || $node instanceof Expr\FuncCall || $node instanceof Expr\MethodCall || $node instanceof Expr\NullsafeMethodCall || $node instanceof Expr\StaticCall || $node instanceof Expr\Array_); } @@ -21644,7 +24217,7 @@ abstract class PrettyPrinterAbstract * * @return bool Whether parentheses are required */ - protected function dereferenceLhsRequiresParens(Node $node) : bool + protected function dereferenceLhsRequiresParens(Node $node): bool { // A constant can occur on the LHS of an array/object deref, but not a static deref. return $this->staticDereferenceLhsRequiresParens($node) && !$node instanceof Expr\ConstFetch; @@ -21656,7 +24229,7 @@ abstract class PrettyPrinterAbstract * * @return bool Whether parentheses are required */ - protected function staticDereferenceLhsRequiresParens(Node $node) : bool + protected function staticDereferenceLhsRequiresParens(Node $node): bool { return !($node instanceof Expr\Variable || $node instanceof Node\Name || $node instanceof Expr\ArrayDimFetch || $node instanceof Expr\PropertyFetch || $node instanceof Expr\NullsafePropertyFetch || $node instanceof Expr\StaticPropertyFetch || $node instanceof Expr\FuncCall || $node instanceof Expr\MethodCall || $node instanceof Expr\NullsafeMethodCall || $node instanceof Expr\StaticCall || $node instanceof Expr\Array_ || $node instanceof Scalar\String_ || $node instanceof Expr\ClassConstFetch); } @@ -21667,7 +24240,7 @@ abstract class PrettyPrinterAbstract * * @return bool Whether parentheses are required */ - protected function newOperandRequiresParens(Node $node) : bool + protected function newOperandRequiresParens(Node $node): bool { if ($node instanceof Node\Name || $node instanceof Expr\Variable) { return \false; @@ -21689,7 +24262,7 @@ abstract class PrettyPrinterAbstract */ protected function pModifiers(int $modifiers) { - return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '') . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '') . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '') . ($modifiers & Stmt\Class_::MODIFIER_STATIC ? 'static ' : '') . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT ? 'abstract ' : '') . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : '') . ($modifiers & Stmt\Class_::MODIFIER_READONLY ? 'readonly ' : ''); + return (($modifiers & Stmt\Class_::MODIFIER_PUBLIC) ? 'public ' : '') . (($modifiers & Stmt\Class_::MODIFIER_PROTECTED) ? 'protected ' : '') . (($modifiers & Stmt\Class_::MODIFIER_PRIVATE) ? 'private ' : '') . (($modifiers & Stmt\Class_::MODIFIER_STATIC) ? 'static ' : '') . (($modifiers & Stmt\Class_::MODIFIER_ABSTRACT) ? 'abstract ' : '') . (($modifiers & Stmt\Class_::MODIFIER_FINAL) ? 'final ' : '') . (($modifiers & Stmt\Class_::MODIFIER_READONLY) ? 'readonly ' : ''); } /** * Determine whether a list of nodes uses multiline formatting. @@ -21698,7 +24271,7 @@ abstract class PrettyPrinterAbstract * * @return bool Whether multiline formatting is used */ - protected function isMultiline(array $nodes) : bool + protected function isMultiline(array $nodes): bool { if (\count($nodes) < 2) { return \false; @@ -21711,7 +24284,7 @@ abstract class PrettyPrinterAbstract $endPos = $node->getEndTokenPos() + 1; if ($pos >= 0) { $text = $this->origTokens->getTokenCode($pos, $endPos, 0); - if (\false === \strpos($text, "\n")) { + if (\false === strpos($text, "\n")) { // We require that a newline is present between *every* item. If the formatting // is inconsistent, with only some items having newlines, we don't consider it // as multiline @@ -21736,8 +24309,8 @@ abstract class PrettyPrinterAbstract for ($i = 0; $i < 256; $i++) { // Since PHP 7.1 The lower range is 0x80. However, we also want to support code for // older versions. - $chr = \chr($i); - $this->labelCharMap[$chr] = $i >= 0x7f || \ctype_alnum($chr); + $chr = chr($i); + $this->labelCharMap[$chr] = $i >= 0x7f || ctype_alnum($chr); } } /** @@ -22057,19 +24630,22 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -use PHPUnit\PharIo\Version\Exception as VersionException; -use PHPUnit\PharIo\Version\Version; -use PHPUnit\PharIo\Version\VersionConstraintParser; +use PHPUnitPHAR\PharIo\Version\Exception as VersionException; +use PHPUnitPHAR\PharIo\Version\Version; +use PHPUnitPHAR\PharIo\Version\VersionConstraintParser; +use Throwable; +use function sprintf; class ManifestDocumentMapper { - public function map(ManifestDocument $document) : Manifest + public function map(ManifestDocument $document): Manifest { try { $contains = $document->getContainsElement(); @@ -22078,13 +24654,11 @@ class ManifestDocumentMapper $requirements = $this->mapRequirements($document->getRequiresElement()); $bundledComponents = $this->mapBundledComponents($document); return new Manifest(new ApplicationName($contains->getName()), new Version($contains->getVersion()), $type, $copyright, $requirements, $bundledComponents); - } catch (VersionException $e) { - throw new ManifestDocumentMapperException($e->getMessage(), (int) $e->getCode(), $e); - } catch (Exception $e) { + } catch (Throwable $e) { throw new ManifestDocumentMapperException($e->getMessage(), (int) $e->getCode(), $e); } } - private function mapType(ContainsElement $contains) : Type + private function mapType(ContainsElement $contains): Type { switch ($contains->getType()) { case 'application': @@ -22094,19 +24668,19 @@ class ManifestDocumentMapper case 'extension': return $this->mapExtension($contains->getExtensionElement()); } - throw new ManifestDocumentMapperException(\sprintf('Unsupported type %s', $contains->getType())); + throw new ManifestDocumentMapperException(sprintf('Unsupported type %s', $contains->getType())); } - private function mapCopyright(CopyrightElement $copyright) : CopyrightInformation + private function mapCopyright(CopyrightElement $copyright): CopyrightInformation { $authors = new AuthorCollection(); foreach ($copyright->getAuthorElements() as $authorElement) { - $authors->add(new Author($authorElement->getName(), new Email($authorElement->getEmail()))); + $authors->add(new Author($authorElement->getName(), $authorElement->hasEMail() ? new Email($authorElement->getEmail()) : null)); } $licenseElement = $copyright->getLicenseElement(); $license = new License($licenseElement->getType(), new Url($licenseElement->getUrl())); return new CopyrightInformation($authors, $license); } - private function mapRequirements(RequiresElement $requires) : RequirementCollection + private function mapRequirements(RequiresElement $requires): RequirementCollection { $collection = new RequirementCollection(); $phpElement = $requires->getPHPElement(); @@ -22114,7 +24688,7 @@ class ManifestDocumentMapper try { $versionConstraint = $parser->parse($phpElement->getVersion()); } catch (VersionException $e) { - throw new ManifestDocumentMapperException(\sprintf('Unsupported version constraint - %s', $e->getMessage()), (int) $e->getCode(), $e); + throw new ManifestDocumentMapperException(sprintf('Unsupported version constraint - %s', $e->getMessage()), (int) $e->getCode(), $e); } $collection->add(new PhpVersionRequirement($versionConstraint)); if (!$phpElement->hasExtElements()) { @@ -22125,7 +24699,7 @@ class ManifestDocumentMapper } return $collection; } - private function mapBundledComponents(ManifestDocument $document) : BundledComponentCollection + private function mapBundledComponents(ManifestDocument $document): BundledComponentCollection { $collection = new BundledComponentCollection(); if (!$document->hasBundlesElement()) { @@ -22136,13 +24710,13 @@ class ManifestDocumentMapper } return $collection; } - private function mapExtension(ExtensionElement $extension) : Extension + private function mapExtension(ExtensionElement $extension): Extension { try { $versionConstraint = (new VersionConstraintParser())->parse($extension->getCompatible()); return Type::extension(new ApplicationName($extension->getFor()), $versionConstraint); } catch (VersionException $e) { - throw new ManifestDocumentMapperException(\sprintf('Unsupported version constraint - %s', $e->getMessage()), (int) $e->getCode(), $e); + throw new ManifestDocumentMapperException(sprintf('Unsupported version constraint - %s', $e->getMessage()), (int) $e->getCode(), $e); } } } @@ -22152,28 +24726,30 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; +use function sprintf; class ManifestLoader { - public static function fromFile(string $filename) : Manifest + public static function fromFile(string $filename): Manifest { try { return (new ManifestDocumentMapper())->map(ManifestDocument::fromFile($filename)); } catch (Exception $e) { - throw new ManifestLoaderException(\sprintf('Loading %s failed.', $filename), (int) $e->getCode(), $e); + throw new ManifestLoaderException(sprintf('Loading %s failed.', $filename), (int) $e->getCode(), $e); } } - public static function fromPhar(string $filename) : Manifest + public static function fromPhar(string $filename): Manifest { return self::fromFile('phar://' . $filename . '/manifest.xml'); } - public static function fromString(string $manifest) : Manifest + public static function fromString(string $manifest): Manifest { try { return (new ManifestDocumentMapper())->map(ManifestDocument::fromString($manifest)); @@ -22188,27 +24764,31 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -use PHPUnit\PharIo\Version\AnyVersionConstraint; -use PHPUnit\PharIo\Version\Version; -use PHPUnit\PharIo\Version\VersionConstraint; +use PHPUnitPHAR\PharIo\Version\AnyVersionConstraint; +use PHPUnitPHAR\PharIo\Version\Version; +use PHPUnitPHAR\PharIo\Version\VersionConstraint; use XMLWriter; +use function count; +use function file_put_contents; +use function str_repeat; /** @psalm-suppress MissingConstructor */ class ManifestSerializer { /** @var XMLWriter */ private $xmlWriter; - public function serializeToFile(Manifest $manifest, string $filename) : void + public function serializeToFile(Manifest $manifest, string $filename): void { - \file_put_contents($filename, $this->serializeToString($manifest)); + file_put_contents($filename, $this->serializeToString($manifest)); } - public function serializeToString(Manifest $manifest) : string + public function serializeToString(Manifest $manifest): string { $this->startDocument(); $this->addContains($manifest->getName(), $manifest->getVersion(), $manifest->getType()); @@ -22217,46 +24797,54 @@ class ManifestSerializer $this->addBundles($manifest->getBundledComponents()); return $this->finishDocument(); } - private function startDocument() : void + private function startDocument(): void { $xmlWriter = new XMLWriter(); $xmlWriter->openMemory(); $xmlWriter->setIndent(\true); - $xmlWriter->setIndentString(\str_repeat(' ', 4)); + $xmlWriter->setIndentString(str_repeat(' ', 4)); $xmlWriter->startDocument('1.0', 'UTF-8'); $xmlWriter->startElement('phar'); $xmlWriter->writeAttribute('xmlns', 'https://phar.io/xml/manifest/1.0'); $this->xmlWriter = $xmlWriter; } - private function finishDocument() : string + private function finishDocument(): string { $this->xmlWriter->endElement(); $this->xmlWriter->endDocument(); return $this->xmlWriter->outputMemory(); } - private function addContains(ApplicationName $name, Version $version, Type $type) : void + private function addContains(ApplicationName $name, Version $version, Type $type): void { $this->xmlWriter->startElement('contains'); $this->xmlWriter->writeAttribute('name', $name->asString()); $this->xmlWriter->writeAttribute('version', $version->getVersionString()); switch (\true) { case $type->isApplication(): - $this->xmlWriter->writeAttribute('type', 'application'); - break; + { + $this->xmlWriter->writeAttribute('type', 'application'); + break; + } case $type->isLibrary(): - $this->xmlWriter->writeAttribute('type', 'library'); - break; + { + $this->xmlWriter->writeAttribute('type', 'library'); + break; + } case $type->isExtension(): - $this->xmlWriter->writeAttribute('type', 'extension'); - /* @var $type Extension */ - $this->addExtension($type->getApplicationName(), $type->getVersionConstraint()); - break; + { + $this->xmlWriter->writeAttribute('type', 'extension'); + /* @var $type Extension */ + $this->addExtension($type->getApplicationName(), $type->getVersionConstraint()); + break; + } default: - $this->xmlWriter->writeAttribute('type', 'custom'); + { + $this->xmlWriter->writeAttribute('type', 'custom'); + } } $this->xmlWriter->endElement(); } - private function addCopyright(CopyrightInformation $copyrightInformation) : void + private function addCopyright(CopyrightInformation $copyrightInformation): void { $this->xmlWriter->startElement('copyright'); foreach ($copyrightInformation->getAuthors() as $author) { @@ -22272,7 +24860,7 @@ class ManifestSerializer $this->xmlWriter->endElement(); $this->xmlWriter->endElement(); } - private function addRequirements(RequirementCollection $requirementCollection) : void + private function addRequirements(RequirementCollection $requirementCollection): void { $phpRequirement = new AnyVersionConstraint(); $extensions = []; @@ -22296,9 +24884,9 @@ class ManifestSerializer $this->xmlWriter->endElement(); $this->xmlWriter->endElement(); } - private function addBundles(BundledComponentCollection $bundledComponentCollection) : void + private function addBundles(BundledComponentCollection $bundledComponentCollection): void { - if (\count($bundledComponentCollection) === 0) { + if (count($bundledComponentCollection) === 0) { return; } $this->xmlWriter->startElement('bundles'); @@ -22310,7 +24898,7 @@ class ManifestSerializer } $this->xmlWriter->endElement(); } - private function addExtension(ApplicationName $applicationName, VersionConstraint $versionConstraint) : void + private function addExtension(ApplicationName $applicationName, VersionConstraint $versionConstraint): void { $this->xmlWriter->startElement('extension'); $this->xmlWriter->writeAttribute('for', $applicationName->asString()); @@ -22324,14 +24912,16 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class ElementCollectionException extends \InvalidArgumentException implements Exception +use InvalidArgumentException; +class ElementCollectionException extends InvalidArgumentException implements Exception { } , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -interface Exception extends \Throwable +use Throwable; +interface Exception extends Throwable { } , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class InvalidApplicationNameException extends \InvalidArgumentException implements Exception +use InvalidArgumentException; +class InvalidApplicationNameException extends InvalidArgumentException implements Exception { public const InvalidFormat = 2; } @@ -22373,14 +24967,16 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class InvalidEmailException extends \InvalidArgumentException implements Exception +use InvalidArgumentException; +class InvalidEmailException extends InvalidArgumentException implements Exception { } , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class InvalidUrlException extends \InvalidArgumentException implements Exception +use InvalidArgumentException; +class InvalidUrlException extends InvalidArgumentException implements Exception { } , Sebastian Heuer , Sebastian Bergmann and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PHPUnitPHAR\PharIo\Manifest; -class ManifestDocumentException extends \RuntimeException implements Exception +use RuntimeException; +class ManifestDocumentException extends RuntimeException implements Exception { } , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; use LibXMLError; +use function sprintf; class ManifestDocumentLoadingException extends \Exception implements Exception { /** @var LibXMLError[] */ @@ -22434,12 +25044,12 @@ class ManifestDocumentLoadingException extends \Exception implements Exception { $this->libxmlErrors = $libxmlErrors; $first = $this->libxmlErrors[0]; - parent::__construct(\sprintf('%s (Line: %d / Column: %d / File: %s)', $first->message, $first->line, $first->column, $first->file), $first->code); + parent::__construct(sprintf('%s (Line: %d / Column: %d / File: %s)', $first->message, $first->line, $first->column, $first->file), $first->code); } /** * @return LibXMLError[] */ - public function getLibxmlErrors() : array + public function getLibxmlErrors(): array { return $this->libxmlErrors; } @@ -22447,23 +25057,52 @@ class ManifestDocumentLoadingException extends \Exception implements Exception , Sebastian Heuer , Sebastian Bergmann and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PHPUnitPHAR\PharIo\Manifest; -class ManifestDocumentMapperException extends \RuntimeException implements Exception +use RuntimeException; +class ManifestDocumentMapperException extends RuntimeException implements Exception { } , Sebastian Heuer , Sebastian Bergmann and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PHPUnitPHAR\PharIo\Manifest; -class ManifestElementException extends \RuntimeException implements Exception +use RuntimeException; +class ManifestElementException extends RuntimeException implements Exception { } , Sebastian Heuer , Sebastian Bergmann and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PHPUnitPHAR\PharIo\Manifest; class ManifestLoaderException extends \Exception implements Exception { @@ -22474,16 +25113,35 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; + +use InvalidArgumentException; +class NoEmailAddressException extends InvalidArgumentException implements Exception +{ +} +, Sebastian Heuer , Sebastian Bergmann and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PHPUnitPHAR\PharIo\Manifest; class Application extends Type { - public function isApplication() : bool + public function isApplication(): bool { return \true; } @@ -22494,13 +25152,16 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; +use function preg_match; +use function sprintf; class ApplicationName { /** @var string */ @@ -22510,18 +25171,18 @@ class ApplicationName $this->ensureValidFormat($name); $this->name = $name; } - public function asString() : string + public function asString(): string { return $this->name; } - public function isEqual(ApplicationName $name) : bool + public function isEqual(ApplicationName $name): bool { return $this->name === $name->name; } - private function ensureValidFormat(string $name) : void + private function ensureValidFormat(string $name): void { - if (!\preg_match('#\\w/\\w#', $name)) { - throw new InvalidApplicationNameException(\sprintf('Format of name "%s" is not valid - expected: vendor/packagename', $name), InvalidApplicationNameException::InvalidFormat); + if (!preg_match('#\w/\w#', $name)) { + throw new InvalidApplicationNameException(sprintf('Format of name "%s" is not valid - expected: vendor/packagename', $name), InvalidApplicationNameException::InvalidFormat); } } } @@ -22531,34 +25192,49 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; +use function sprintf; class Author { /** @var string */ private $name; - /** @var Email */ + /** @var null|Email */ private $email; - public function __construct(string $name, Email $email) + public function __construct(string $name, ?Email $email = null) { $this->name = $name; $this->email = $email; } - public function asString() : string + public function asString(): string { - return \sprintf('%s <%s>', $this->name, $this->email->asString()); + if (!$this->hasEmail()) { + return $this->name; + } + return sprintf('%s <%s>', $this->name, $this->email->asString()); } - public function getName() : string + public function getName(): string { return $this->name; } - public function getEmail() : Email + /** + * @psalm-assert-if-true Email $this->email + */ + public function hasEmail(): bool + { + return $this->email !== null; + } + public function getEmail(): Email { + if (!$this->hasEmail()) { + throw new NoEmailAddressException(); + } return $this->email; } } @@ -22568,33 +25244,38 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class AuthorCollection implements \Countable, \IteratorAggregate +use Countable; +use IteratorAggregate; +use function count; +/** @template-implements IteratorAggregate */ +class AuthorCollection implements Countable, IteratorAggregate { /** @var Author[] */ private $authors = []; - public function add(Author $author) : void + public function add(Author $author): void { $this->authors[] = $author; } /** * @return Author[] */ - public function getAuthors() : array + public function getAuthors(): array { return $this->authors; } - public function count() : int + public function count(): int { - return \count($this->authors); + return count($this->authors); } - public function getIterator() : AuthorCollectionIterator + public function getIterator(): AuthorCollectionIterator { return new AuthorCollectionIterator($this); } @@ -22605,14 +25286,18 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class AuthorCollectionIterator implements \Iterator +use Iterator; +use function count; +/** @template-implements Iterator */ +class AuthorCollectionIterator implements Iterator { /** @var Author[] */ private $authors; @@ -22622,23 +25307,23 @@ class AuthorCollectionIterator implements \Iterator { $this->authors = $authors->getAuthors(); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - public function valid() : bool + public function valid(): bool { - return $this->position < \count($this->authors); + return $this->position < count($this->authors); } - public function key() : int + public function key(): int { return $this->position; } - public function current() : Author + public function current(): Author { return $this->authors[$this->position]; } - public function next() : void + public function next(): void { $this->position++; } @@ -22649,14 +25334,15 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -use PHPUnit\PharIo\Version\Version; +use PHPUnitPHAR\PharIo\Version\Version; class BundledComponent { /** @var string */ @@ -22668,11 +25354,11 @@ class BundledComponent $this->name = $name; $this->version = $version; } - public function getName() : string + public function getName(): string { return $this->name; } - public function getVersion() : Version + public function getVersion(): Version { return $this->version; } @@ -22683,33 +25369,38 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class BundledComponentCollection implements \Countable, \IteratorAggregate +use Countable; +use IteratorAggregate; +use function count; +/** @template-implements IteratorAggregate */ +class BundledComponentCollection implements Countable, IteratorAggregate { /** @var BundledComponent[] */ private $bundledComponents = []; - public function add(BundledComponent $bundledComponent) : void + public function add(BundledComponent $bundledComponent): void { $this->bundledComponents[] = $bundledComponent; } /** * @return BundledComponent[] */ - public function getBundledComponents() : array + public function getBundledComponents(): array { return $this->bundledComponents; } - public function count() : int + public function count(): int { - return \count($this->bundledComponents); + return count($this->bundledComponents); } - public function getIterator() : BundledComponentCollectionIterator + public function getIterator(): BundledComponentCollectionIterator { return new BundledComponentCollectionIterator($this); } @@ -22720,14 +25411,18 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class BundledComponentCollectionIterator implements \Iterator +use Iterator; +use function count; +/** @template-implements Iterator */ +class BundledComponentCollectionIterator implements Iterator { /** @var BundledComponent[] */ private $bundledComponents; @@ -22737,23 +25432,23 @@ class BundledComponentCollectionIterator implements \Iterator { $this->bundledComponents = $bundledComponents->getBundledComponents(); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - public function valid() : bool + public function valid(): bool { - return $this->position < \count($this->bundledComponents); + return $this->position < count($this->bundledComponents); } - public function key() : int + public function key(): int { return $this->position; } - public function current() : BundledComponent + public function current(): BundledComponent { return $this->bundledComponents[$this->position]; } - public function next() : void + public function next(): void { $this->position++; } @@ -22764,12 +25459,13 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class CopyrightInformation { @@ -22782,11 +25478,11 @@ class CopyrightInformation $this->authors = $authors; $this->license = $license; } - public function getAuthors() : AuthorCollection + public function getAuthors(): AuthorCollection { return $this->authors; } - public function getLicense() : License + public function getLicense(): License { return $this->license; } @@ -22797,13 +25493,16 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; +use const FILTER_VALIDATE_EMAIL; +use function filter_var; class Email { /** @var string */ @@ -22813,13 +25512,13 @@ class Email $this->ensureEmailIsValid($email); $this->email = $email; } - public function asString() : string + public function asString(): string { return $this->email; } - private function ensureEmailIsValid(string $url) : void + private function ensureEmailIsValid(string $url): void { - if (\filter_var($url, \FILTER_VALIDATE_EMAIL) === \false) { + if (filter_var($url, FILTER_VALIDATE_EMAIL) === \false) { throw new InvalidEmailException(); } } @@ -22830,15 +25529,16 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -use PHPUnit\PharIo\Version\Version; -use PHPUnit\PharIo\Version\VersionConstraint; +use PHPUnitPHAR\PharIo\Version\Version; +use PHPUnitPHAR\PharIo\Version\VersionConstraint; class Extension extends Type { /** @var ApplicationName */ @@ -22850,23 +25550,23 @@ class Extension extends Type $this->application = $application; $this->versionConstraint = $versionConstraint; } - public function getApplicationName() : ApplicationName + public function getApplicationName(): ApplicationName { return $this->application; } - public function getVersionConstraint() : VersionConstraint + public function getVersionConstraint(): VersionConstraint { return $this->versionConstraint; } - public function isExtension() : bool + public function isExtension(): bool { return \true; } - public function isExtensionFor(ApplicationName $name) : bool + public function isExtensionFor(ApplicationName $name): bool { return $this->application->isEqual($name); } - public function isCompatibleWith(ApplicationName $name, Version $version) : bool + public function isCompatibleWith(ApplicationName $name, Version $version): bool { return $this->isExtensionFor($name) && $this->versionConstraint->complies($version); } @@ -22877,16 +25577,17 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class Library extends Type { - public function isLibrary() : bool + public function isLibrary(): bool { return \true; } @@ -22897,12 +25598,13 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class License { @@ -22915,11 +25617,11 @@ class License $this->name = $name; $this->url = $url; } - public function getName() : string + public function getName(): string { return $this->name; } - public function getUrl() : Url + public function getUrl(): Url { return $this->url; } @@ -22930,14 +25632,15 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -use PHPUnit\PharIo\Version\Version; +use PHPUnitPHAR\PharIo\Version\Version; class Manifest { /** @var ApplicationName */ @@ -22961,43 +25664,43 @@ class Manifest $this->requirements = $requirements; $this->bundledComponents = $bundledComponents; } - public function getName() : ApplicationName + public function getName(): ApplicationName { return $this->name; } - public function getVersion() : Version + public function getVersion(): Version { return $this->version; } - public function getType() : Type + public function getType(): Type { return $this->type; } - public function getCopyrightInformation() : CopyrightInformation + public function getCopyrightInformation(): CopyrightInformation { return $this->copyrightInformation; } - public function getRequirements() : RequirementCollection + public function getRequirements(): RequirementCollection { return $this->requirements; } - public function getBundledComponents() : BundledComponentCollection + public function getBundledComponents(): BundledComponentCollection { return $this->bundledComponents; } - public function isApplication() : bool + public function isApplication(): bool { return $this->type->isApplication(); } - public function isLibrary() : bool + public function isLibrary(): bool { return $this->type->isLibrary(); } - public function isExtension() : bool + public function isExtension(): bool { return $this->type->isExtension(); } - public function isExtensionFor(ApplicationName $application, Version $version = null) : bool + public function isExtensionFor(ApplicationName $application, ?Version $version = null): bool { if (!$this->isExtension()) { return \false; @@ -23016,12 +25719,13 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class PhpExtensionRequirement implements Requirement { @@ -23031,7 +25735,7 @@ class PhpExtensionRequirement implements Requirement { $this->extension = $extension; } - public function asString() : string + public function asString(): string { return $this->extension; } @@ -23042,14 +25746,15 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -use PHPUnit\PharIo\Version\VersionConstraint; +use PHPUnitPHAR\PharIo\Version\VersionConstraint; class PhpVersionRequirement implements Requirement { /** @var VersionConstraint */ @@ -23058,7 +25763,7 @@ class PhpVersionRequirement implements Requirement { $this->versionConstraint = $versionConstraint; } - public function getVersionConstraint() : VersionConstraint + public function getVersionConstraint(): VersionConstraint { return $this->versionConstraint; } @@ -23069,12 +25774,13 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; interface Requirement { @@ -23085,33 +25791,38 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class RequirementCollection implements \Countable, \IteratorAggregate +use Countable; +use IteratorAggregate; +use function count; +/** @template-implements IteratorAggregate */ +class RequirementCollection implements Countable, IteratorAggregate { /** @var Requirement[] */ private $requirements = []; - public function add(Requirement $requirement) : void + public function add(Requirement $requirement): void { $this->requirements[] = $requirement; } /** * @return Requirement[] */ - public function getRequirements() : array + public function getRequirements(): array { return $this->requirements; } - public function count() : int + public function count(): int { - return \count($this->requirements); + return count($this->requirements); } - public function getIterator() : RequirementCollectionIterator + public function getIterator(): RequirementCollectionIterator { return new RequirementCollectionIterator($this); } @@ -23122,14 +25833,18 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -class RequirementCollectionIterator implements \Iterator +use Iterator; +use function count; +/** @template-implements Iterator */ +class RequirementCollectionIterator implements Iterator { /** @var Requirement[] */ private $requirements; @@ -23139,23 +25854,23 @@ class RequirementCollectionIterator implements \Iterator { $this->requirements = $requirements->getRequirements(); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - public function valid() : bool + public function valid(): bool { - return $this->position < \count($this->requirements); + return $this->position < count($this->requirements); } - public function key() : int + public function key(): int { return $this->position; } - public function current() : Requirement + public function current(): Requirement { return $this->requirements[$this->position]; } - public function next() : void + public function next(): void { $this->position++; } @@ -23166,40 +25881,41 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; -use PHPUnit\PharIo\Version\VersionConstraint; +use PHPUnitPHAR\PharIo\Version\VersionConstraint; abstract class Type { - public static function application() : Application + public static function application(): Application { return new Application(); } - public static function library() : Library + public static function library(): Library { return new Library(); } - public static function extension(ApplicationName $application, VersionConstraint $versionConstraint) : Extension + public static function extension(ApplicationName $application, VersionConstraint $versionConstraint): Extension { return new Extension($application, $versionConstraint); } /** @psalm-assert-if-true Application $this */ - public function isApplication() : bool + public function isApplication(): bool { return \false; } /** @psalm-assert-if-true Library $this */ - public function isLibrary() : bool + public function isLibrary(): bool { return \false; } /** @psalm-assert-if-true Extension $this */ - public function isExtension() : bool + public function isExtension(): bool { return \false; } @@ -23210,13 +25926,16 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; +use const FILTER_VALIDATE_URL; +use function filter_var; class Url { /** @var string */ @@ -23226,18 +25945,16 @@ class Url $this->ensureUrlIsValid($url); $this->url = $url; } - public function asString() : string + public function asString(): string { return $this->url; } /** - * @param string $url - * * @throws InvalidUrlException */ - private function ensureUrlIsValid($url) : void + private function ensureUrlIsValid(string $url): void { - if (\filter_var($url, \FILTER_VALIDATE_URL) === \false) { + if (filter_var($url, FILTER_VALIDATE_URL) === \false) { throw new InvalidUrlException(); } } @@ -23248,23 +25965,28 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class AuthorElement extends ManifestElement { - public function getName() : string + public function getName(): string { return $this->getAttributeValue('name'); } - public function getEmail() : string + public function getEmail(): string { return $this->getAttributeValue('email'); } + public function hasEMail(): bool + { + return $this->hasAttribute('email'); + } } , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class AuthorElementCollection extends ElementCollection { - public function current() : AuthorElement + public function current(): AuthorElement { return new AuthorElement($this->getCurrentElement()); } @@ -23292,16 +26015,17 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class BundlesElement extends ManifestElement { - public function getComponentElements() : ComponentElementCollection + public function getComponentElements(): ComponentElementCollection { return new ComponentElementCollection($this->getChildrenByName('component')); } @@ -23312,20 +26036,21 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class ComponentElement extends ManifestElement { - public function getName() : string + public function getName(): string { return $this->getAttributeValue('name'); } - public function getVersion() : string + public function getVersion(): string { return $this->getAttributeValue('version'); } @@ -23336,16 +26061,17 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class ComponentElementCollection extends ElementCollection { - public function current() : ComponentElement + public function current(): ComponentElement { return new ComponentElement($this->getCurrentElement()); } @@ -23356,28 +26082,29 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class ContainsElement extends ManifestElement { - public function getName() : string + public function getName(): string { return $this->getAttributeValue('name'); } - public function getVersion() : string + public function getVersion(): string { return $this->getAttributeValue('version'); } - public function getType() : string + public function getType(): string { return $this->getAttributeValue('type'); } - public function getExtensionElement() : ExtensionElement + public function getExtensionElement(): ExtensionElement { return new ExtensionElement($this->getChildByName('extension')); } @@ -23388,20 +26115,21 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class CopyrightElement extends ManifestElement { - public function getAuthorElements() : AuthorElementCollection + public function getAuthorElements(): AuthorElementCollection { return new AuthorElementCollection($this->getChildrenByName('author')); } - public function getLicenseElement() : LicenseElement + public function getLicenseElement(): LicenseElement { return new LicenseElement($this->getChildByName('license')); } @@ -23412,16 +26140,23 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; use DOMElement; use DOMNodeList; -abstract class ElementCollection implements \Iterator +use Iterator; +use ReturnTypeWillChange; +use function count; +use function get_class; +use function sprintf; +/** @template-implements Iterator */ +abstract class ElementCollection implements Iterator { /** @var DOMElement[] */ private $nodes = []; @@ -23432,33 +26167,33 @@ abstract class ElementCollection implements \Iterator $this->position = 0; $this->importNodes($nodeList); } - #[\ReturnTypeWillChange] - public abstract function current(); - public function next() : void + #[ReturnTypeWillChange] + abstract public function current(); + public function next(): void { $this->position++; } - public function key() : int + public function key(): int { return $this->position; } - public function valid() : bool + public function valid(): bool { - return $this->position < \count($this->nodes); + return $this->position < count($this->nodes); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - protected function getCurrentElement() : DOMElement + protected function getCurrentElement(): DOMElement { return $this->nodes[$this->position]; } - private function importNodes(DOMNodeList $nodeList) : void + private function importNodes(DOMNodeList $nodeList): void { foreach ($nodeList as $node) { if (!$node instanceof DOMElement) { - throw new ElementCollectionException(\sprintf('\\DOMElement expected, got \\%s', \get_class($node))); + throw new ElementCollectionException(sprintf('\DOMElement expected, got \%s', get_class($node))); } $this->nodes[] = $node; } @@ -23470,16 +26205,17 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class ExtElement extends ManifestElement { - public function getName() : string + public function getName(): string { return $this->getAttributeValue('name'); } @@ -23490,16 +26226,17 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class ExtElementCollection extends ElementCollection { - public function current() : ExtElement + public function current(): ExtElement { return new ExtElement($this->getCurrentElement()); } @@ -23510,20 +26247,21 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class ExtensionElement extends ManifestElement { - public function getFor() : string + public function getFor(): string { return $this->getAttributeValue('for'); } - public function getCompatible() : string + public function getCompatible(): string { return $this->getAttributeValue('compatible'); } @@ -23534,20 +26272,21 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class LicenseElement extends ManifestElement { - public function getType() : string + public function getType(): string { return $this->getAttributeValue('type'); } - public function getUrl() : string + public function getUrl(): string { return $this->getAttributeValue('url'); } @@ -23558,36 +26297,49 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; use DOMDocument; use DOMElement; +use Throwable; +use function count; +use function file_get_contents; +use function is_file; +use function libxml_clear_errors; +use function libxml_get_errors; +use function libxml_use_internal_errors; +use function sprintf; class ManifestDocument { public const XMLNS = 'https://phar.io/xml/manifest/1.0'; /** @var DOMDocument */ private $dom; - public static function fromFile(string $filename) : ManifestDocument + public static function fromFile(string $filename): ManifestDocument { - if (!\file_exists($filename)) { - throw new ManifestDocumentException(\sprintf('File "%s" not found', $filename)); + if (!is_file($filename)) { + throw new ManifestDocumentException(sprintf('File "%s" not found', $filename)); } - return self::fromString(\file_get_contents($filename)); + return self::fromString(file_get_contents($filename)); } - public static function fromString(string $xmlString) : ManifestDocument + public static function fromString(string $xmlString): ManifestDocument { - $prev = \libxml_use_internal_errors(\true); - \libxml_clear_errors(); - $dom = new DOMDocument(); - $dom->loadXML($xmlString); - $errors = \libxml_get_errors(); - \libxml_use_internal_errors($prev); - if (\count($errors) !== 0) { + $prev = libxml_use_internal_errors(\true); + libxml_clear_errors(); + try { + $dom = new DOMDocument(); + $dom->loadXML($xmlString); + $errors = libxml_get_errors(); + libxml_use_internal_errors($prev); + } catch (Throwable $t) { + throw new ManifestDocumentException($t->getMessage(), 0, $t); + } + if (count($errors) !== 0) { throw new ManifestDocumentLoadingException($errors); } return new self($dom); @@ -23597,38 +26349,38 @@ class ManifestDocument $this->ensureCorrectDocumentType($dom); $this->dom = $dom; } - public function getContainsElement() : ContainsElement + public function getContainsElement(): ContainsElement { return new ContainsElement($this->fetchElementByName('contains')); } - public function getCopyrightElement() : CopyrightElement + public function getCopyrightElement(): CopyrightElement { return new CopyrightElement($this->fetchElementByName('copyright')); } - public function getRequiresElement() : RequiresElement + public function getRequiresElement(): RequiresElement { return new RequiresElement($this->fetchElementByName('requires')); } - public function hasBundlesElement() : bool + public function hasBundlesElement(): bool { return $this->dom->getElementsByTagNameNS(self::XMLNS, 'bundles')->length === 1; } - public function getBundlesElement() : BundlesElement + public function getBundlesElement(): BundlesElement { return new BundlesElement($this->fetchElementByName('bundles')); } - private function ensureCorrectDocumentType(DOMDocument $dom) : void + private function ensureCorrectDocumentType(DOMDocument $dom): void { $root = $dom->documentElement; if ($root->localName !== 'phar' || $root->namespaceURI !== self::XMLNS) { throw new ManifestDocumentException('Not a phar.io manifest document'); } } - private function fetchElementByName(string $elementName) : DOMElement + private function fetchElementByName(string $elementName): DOMElement { $element = $this->dom->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0); if (!$element instanceof DOMElement) { - throw new ManifestDocumentException(\sprintf('Element %s missing', $elementName)); + throw new ManifestDocumentException(sprintf('Element %s missing', $elementName)); } return $element; } @@ -23639,15 +26391,17 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; use DOMElement; use DOMNodeList; +use function sprintf; class ManifestElement { public const XMLNS = 'https://phar.io/xml/manifest/1.0'; @@ -23657,30 +26411,34 @@ class ManifestElement { $this->element = $element; } - protected function getAttributeValue(string $name) : string + protected function getAttributeValue(string $name): string { if (!$this->element->hasAttribute($name)) { - throw new ManifestElementException(\sprintf('Attribute %s not set on element %s', $name, $this->element->localName)); + throw new ManifestElementException(sprintf('Attribute %s not set on element %s', $name, $this->element->localName)); } return $this->element->getAttribute($name); } - protected function getChildByName(string $elementName) : DOMElement + protected function hasAttribute(string $name): bool + { + return $this->element->hasAttribute($name); + } + protected function getChildByName(string $elementName): DOMElement { $element = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0); if (!$element instanceof DOMElement) { - throw new ManifestElementException(\sprintf('Element %s missing', $elementName)); + throw new ManifestElementException(sprintf('Element %s missing', $elementName)); } return $element; } - protected function getChildrenByName(string $elementName) : DOMNodeList + protected function getChildrenByName(string $elementName): DOMNodeList { $elementList = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName); if ($elementList->length === 0) { - throw new ManifestElementException(\sprintf('Element(s) %s missing', $elementName)); + throw new ManifestElementException(sprintf('Element(s) %s missing', $elementName)); } return $elementList; } - protected function hasChild(string $elementName) : bool + protected function hasChild(string $elementName): bool { return $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->length !== 0; } @@ -23691,24 +26449,25 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class PhpElement extends ManifestElement { - public function getVersion() : string + public function getVersion(): string { return $this->getAttributeValue('version'); } - public function hasExtElements() : bool + public function hasExtElements(): bool { return $this->hasChild('ext'); } - public function getExtElements() : ExtElementCollection + public function getExtElements(): ExtElementCollection { return new ExtElementCollection($this->getChildrenByName('ext')); } @@ -23719,16 +26478,17 @@ declare (strict_types=1); /* * This file is part of PharIo\Manifest. * - * (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann + * Copyright (c) Arne Blankerts , Sebastian Heuer , Sebastian Bergmann and contributors * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. + * */ -namespace PHPUnit\PharIo\Manifest; +namespace PHPUnitPHAR\PharIo\Manifest; class RequiresElement extends ManifestElement { - public function getPHPElement() : PhpElement + public function getPHPElement(): PhpElement { return new PhpElement($this->getChildByName('php')); } @@ -23744,7 +26504,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class BuildMetaData { @@ -23754,11 +26514,11 @@ class BuildMetaData { $this->value = $value; } - public function asString() : string + public function asString(): string { return $this->value; } - public function equals(BuildMetaData $other) : bool + public function equals(BuildMetaData $other): bool { return $this->asString() === $other->asString(); } @@ -23795,7 +26555,7 @@ POSSIBILITY OF SUCH DAMAGE. parseValue($value); } - public function asString() : string + public function asString(): string { return $this->full; } - public function getValue() : string + public function getValue(): string { return $this->value; } - public function getNumber() : ?int + public function getNumber(): ?int { return $this->number; } - public function isGreaterThan(PreReleaseSuffix $suffix) : bool + public function isGreaterThan(PreReleaseSuffix $suffix): bool { if ($this->valueScore > $suffix->valueScore) { return \true; @@ -23837,14 +26597,14 @@ class PreReleaseSuffix } return $this->getNumber() > $suffix->getNumber(); } - private function mapValueToScore(string $value) : int + private function mapValueToScore(string $value): int { $value = \strtolower($value); return self::valueScoreMap[$value]; } - private function parseValue(string $value) : void + private function parseValue(string $value): void { - $regex = '/-?((dev|beta|b|rc|alpha|a|patch|p|pl)\\.?(\\d*)).*$/i'; + $regex = '/-?((dev|beta|b|rc|alpha|a|patch|p|pl)\.?(\d*)).*$/i'; if (\preg_match($regex, $value, $matches) !== 1) { throw new InvalidPreReleaseSuffixException(\sprintf('Invalid label %s', $value)); } @@ -23867,7 +26627,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class Version { @@ -23891,18 +26651,18 @@ class Version /** * @throws NoPreReleaseSuffixException */ - public function getPreReleaseSuffix() : PreReleaseSuffix + public function getPreReleaseSuffix(): PreReleaseSuffix { if ($this->preReleaseSuffix === null) { throw new NoPreReleaseSuffixException('No pre-release suffix set'); } return $this->preReleaseSuffix; } - public function getOriginalString() : string + public function getOriginalString(): string { return $this->originalVersionString; } - public function getVersionString() : string + public function getVersionString(): string { $str = \sprintf('%d.%d.%d', $this->getMajor()->getValue() ?? 0, $this->getMinor()->getValue() ?? 0, $this->getPatch()->getValue() ?? 0); if (!$this->hasPreReleaseSuffix()) { @@ -23910,11 +26670,11 @@ class Version } return $str . '-' . $this->getPreReleaseSuffix()->asString(); } - public function hasPreReleaseSuffix() : bool + public function hasPreReleaseSuffix(): bool { return $this->preReleaseSuffix !== null; } - public function equals(Version $other) : bool + public function equals(Version $other): bool { if ($this->getVersionString() !== $other->getVersionString()) { return \false; @@ -23927,7 +26687,7 @@ class Version } return \true; } - public function isGreaterThan(Version $version) : bool + public function isGreaterThan(Version $version): bool { if ($version->getMajor()->getValue() > $this->getMajor()->getValue()) { return \false; @@ -23958,15 +26718,15 @@ class Version } return $this->getPreReleaseSuffix()->isGreaterThan($version->getPreReleaseSuffix()); } - public function getMajor() : VersionNumber + public function getMajor(): VersionNumber { return $this->major; } - public function getMinor() : VersionNumber + public function getMinor(): VersionNumber { return $this->minor; } - public function getPatch() : VersionNumber + public function getPatch(): VersionNumber { return $this->patch; } @@ -23974,14 +26734,14 @@ class Version * @psalm-assert-if-true BuildMetaData $this->buildMetadata * @psalm-assert-if-true BuildMetaData $this->getBuildMetaData() */ - public function hasBuildMetaData() : bool + public function hasBuildMetaData(): bool { return $this->buildMetadata !== null; } /** * @throws NoBuildMetaDataException */ - public function getBuildMetaData() : BuildMetaData + public function getBuildMetaData(): BuildMetaData { if (!$this->hasBuildMetaData()) { throw new NoBuildMetaDataException('No build metadata set'); @@ -23993,7 +26753,7 @@ class Version * * @throws InvalidPreReleaseSuffixException */ - private function parseVersion(array $matches) : void + private function parseVersion(array $matches): void { $this->major = new VersionNumber((int) $matches['Major']); $this->minor = new VersionNumber((int) $matches['Minor']); @@ -24010,22 +26770,22 @@ class Version * * @throws InvalidVersionException */ - private function ensureVersionStringIsValid($version) : void + private function ensureVersionStringIsValid($version): void { $regex = '/^v? - (?P0|[1-9]\\d*) - \\. - (?P0|[1-9]\\d*) - (\\. - (?P0|[1-9]\\d*) + (?P0|[1-9]\d*) + \. + (?P0|[1-9]\d*) + (\. + (?P0|[1-9]\d*) )? (?: - - (?(?:(dev|beta|b|rc|alpha|a|patch|p|pl)\\.?\\d*)) + (?(?:(dev|beta|b|rc|alpha|a|patch|p|pl)\.?\d*)) )? (?: - \\+ - (?P[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-@]+)*) + \+ + (?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-@]+)*) )? $/xi'; if (\preg_match($regex, $version, $matches) !== 1) { @@ -24045,19 +26805,19 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class VersionConstraintParser { /** * @throws UnsupportedVersionConstraintException */ - public function parse(string $value) : VersionConstraint + public function parse(string $value): VersionConstraint { if (\strpos($value, '|') !== \false) { return $this->handleOrGroup($value); } - if (!\preg_match('/^[\\^~*]?v?[\\d.*]+(?:-.*)?$/i', $value)) { + if (!\preg_match('/^[\^~*]?v?[\d.*]+(?:-.*)?$/i', $value)) { throw new UnsupportedVersionConstraintException(\sprintf('Version constraint %s is not supported.', $value)); } switch ($value[0]) { @@ -24078,15 +26838,15 @@ class VersionConstraintParser } return new ExactVersionConstraint($constraint->getVersionString()); } - private function handleOrGroup(string $value) : OrVersionConstraintGroup + private function handleOrGroup(string $value): OrVersionConstraintGroup { $constraints = []; - foreach (\preg_split('{\\s*\\|\\|?\\s*}', \trim($value)) as $groupSegment) { + foreach (\preg_split('{\s*\|\|?\s*}', \trim($value)) as $groupSegment) { $constraints[] = $this->parse(\trim($groupSegment)); } return new OrVersionConstraintGroup($value, $constraints); } - private function handleTildeOperator(string $value) : AndVersionConstraintGroup + private function handleTildeOperator(string $value): AndVersionConstraintGroup { $constraintValue = new VersionConstraintValue(\substr($value, 1)); if ($constraintValue->getPatch()->isAny()) { @@ -24095,7 +26855,7 @@ class VersionConstraintParser $constraints = [new GreaterThanOrEqualToVersionConstraint($value, new Version(\substr($value, 1))), new SpecificMajorAndMinorVersionConstraint($value, $constraintValue->getMajor()->getValue() ?? 0, $constraintValue->getMinor()->getValue() ?? 0)]; return new AndVersionConstraintGroup($value, $constraints); } - private function handleCaretOperator(string $value) : AndVersionConstraintGroup + private function handleCaretOperator(string $value): AndVersionConstraintGroup { $constraintValue = new VersionConstraintValue(\substr($value, 1)); $constraints = [new GreaterThanOrEqualToVersionConstraint($value, new Version(\substr($value, 1)))]; @@ -24110,7 +26870,7 @@ class VersionConstraintParser versionString = $versionString; $this->parseVersion($versionString); } - public function getLabel() : string + public function getLabel(): string { return $this->label; } - public function getBuildMetaData() : string + public function getBuildMetaData(): string { return $this->buildMetaData; } - public function getVersionString() : string + public function getVersionString(): string { return $this->versionString; } - public function getMajor() : VersionNumber + public function getMajor(): VersionNumber { return $this->major; } - public function getMinor() : VersionNumber + public function getMinor(): VersionNumber { return $this->minor; } - public function getPatch() : VersionNumber + public function getPatch(): VersionNumber { return $this->patch; } - private function parseVersion(string $versionString) : void + private function parseVersion(string $versionString): void { $this->extractBuildMetaData($versionString); $this->extractLabel($versionString); $this->stripPotentialVPrefix($versionString); $versionSegments = \explode('.', $versionString); $this->major = new VersionNumber(\is_numeric($versionSegments[0]) ? (int) $versionSegments[0] : null); - $minorValue = isset($versionSegments[1]) && \is_numeric($versionSegments[1]) ? (int) $versionSegments[1] : null; - $patchValue = isset($versionSegments[2]) && \is_numeric($versionSegments[2]) ? (int) $versionSegments[2] : null; + $minorValue = (isset($versionSegments[1]) && \is_numeric($versionSegments[1])) ? (int) $versionSegments[1] : null; + $patchValue = (isset($versionSegments[2]) && \is_numeric($versionSegments[2])) ? (int) $versionSegments[2] : null; $this->minor = new VersionNumber($minorValue); $this->patch = new VersionNumber($patchValue); } - private function extractBuildMetaData(string &$versionString) : void + private function extractBuildMetaData(string &$versionString): void { - if (\preg_match('/\\+(.*)/', $versionString, $matches) === 1) { + if (\preg_match('/\+(.*)/', $versionString, $matches) === 1) { $this->buildMetaData = $matches[1]; $versionString = \str_replace($matches[0], '', $versionString); } } - private function extractLabel(string &$versionString) : void + private function extractLabel(string &$versionString): void { if (\preg_match('/-(.*)/', $versionString, $matches) === 1) { $this->label = $matches[1]; $versionString = \str_replace($matches[0], '', $versionString); } } - private function stripPotentialVPrefix(string &$versionString) : void + private function stripPotentialVPrefix(string &$versionString): void { if ($versionString[0] !== 'v') { return; @@ -24200,7 +26960,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class VersionNumber { @@ -24210,11 +26970,11 @@ class VersionNumber { $this->value = $value; } - public function isAny() : bool + public function isAny(): bool { return $this->value === null; } - public function getValue() : ?int + public function getValue(): ?int { return $this->value; } @@ -24230,7 +26990,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; abstract class AbstractVersionConstraint implements VersionConstraint { @@ -24240,7 +27000,7 @@ abstract class AbstractVersionConstraint implements VersionConstraint { $this->originalValue = $originalValue; } - public function asString() : string + public function asString(): string { return $this->originalValue; } @@ -24256,7 +27016,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class AndVersionConstraintGroup extends AbstractVersionConstraint { @@ -24270,7 +27030,7 @@ class AndVersionConstraintGroup extends AbstractVersionConstraint parent::__construct($originalValue); $this->constraints = $constraints; } - public function complies(Version $version) : bool + public function complies(Version $version): bool { foreach ($this->constraints as $constraint) { if (!$constraint->complies($version)) { @@ -24291,15 +27051,15 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class AnyVersionConstraint implements VersionConstraint { - public function complies(Version $version) : bool + public function complies(Version $version): bool { return \true; } - public function asString() : string + public function asString(): string { return '*'; } @@ -24315,11 +27075,11 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class ExactVersionConstraint extends AbstractVersionConstraint { - public function complies(Version $version) : bool + public function complies(Version $version): bool { $other = $version->getVersionString(); if ($version->hasBuildMetaData()) { @@ -24339,7 +27099,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint { @@ -24350,7 +27110,7 @@ class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint parent::__construct($originalValue); $this->minimalVersion = $minimalVersion; } - public function complies(Version $version) : bool + public function complies(Version $version): bool { return $version->getVersionString() === $this->minimalVersion->getVersionString() || $version->isGreaterThan($this->minimalVersion); } @@ -24366,7 +27126,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class OrVersionConstraintGroup extends AbstractVersionConstraint { @@ -24381,7 +27141,7 @@ class OrVersionConstraintGroup extends AbstractVersionConstraint parent::__construct($originalValue); $this->constraints = $constraints; } - public function complies(Version $version) : bool + public function complies(Version $version): bool { foreach ($this->constraints as $constraint) { if ($constraint->complies($version)) { @@ -24402,7 +27162,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint { @@ -24416,7 +27176,7 @@ class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint $this->major = $major; $this->minor = $minor; } - public function complies(Version $version) : bool + public function complies(Version $version): bool { if ($version->getMajor()->getValue() !== $this->major) { return \false; @@ -24435,7 +27195,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; class SpecificMajorVersionConstraint extends AbstractVersionConstraint { @@ -24446,7 +27206,7 @@ class SpecificMajorVersionConstraint extends AbstractVersionConstraint parent::__construct($originalValue); $this->major = $major; } - public function complies(Version $version) : bool + public function complies(Version $version): bool { return $version->getMajor()->getValue() === $this->major; } @@ -24462,12 +27222,12 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\PharIo\Version; +namespace PHPUnitPHAR\PharIo\Version; interface VersionConstraint { - public function complies(Version $version) : bool; - public function asString() : string; + public function complies(Version $version): bool; + public function asString(): string; } cachedReport === null) { $this->cachedReport = (new Builder($this->analyser()))->build($this); @@ -24660,7 +27420,7 @@ final class CodeCoverage /** * Clears collected code coverage data. */ - public function clear() : void + public function clear(): void { $this->currentId = null; $this->data = new ProcessedCodeCoverageData(); @@ -24670,21 +27430,21 @@ final class CodeCoverage /** * @internal */ - public function clearCache() : void + public function clearCache(): void { $this->cachedReport = null; } /** * Returns the filter object used. */ - public function filter() : Filter + public function filter(): Filter { return $this->filter; } /** * Returns the collected code coverage data. */ - public function getData(bool $raw = \false) : ProcessedCodeCoverageData + public function getData(bool $raw = \false): ProcessedCodeCoverageData { if (!$raw) { if ($this->processUncoveredFiles) { @@ -24698,21 +27458,21 @@ final class CodeCoverage /** * Sets the coverage data. */ - public function setData(ProcessedCodeCoverageData $data) : void + public function setData(ProcessedCodeCoverageData $data): void { $this->data = $data; } /** * Returns the test data. */ - public function getTests() : array + public function getTests(): array { return $this->tests; } /** * Sets the test data. */ - public function setTests(array $tests) : void + public function setTests(array $tests): void { $this->tests = $tests; } @@ -24721,7 +27481,7 @@ final class CodeCoverage * * @param PhptTestCase|string|TestCase $id */ - public function start($id, bool $clear = \false) : void + public function start($id, bool $clear = \false): void { if ($clear) { $this->clear(); @@ -24735,7 +27495,7 @@ final class CodeCoverage * * @param array|false $linesToBeCovered */ - public function stop(bool $append = \true, $linesToBeCovered = [], array $linesToBeUsed = []) : RawCodeCoverageData + public function stop(bool $append = \true, $linesToBeCovered = [], array $linesToBeUsed = []): RawCodeCoverageData { if (!is_array($linesToBeCovered) && $linesToBeCovered !== \false) { throw new InvalidArgumentException('$linesToBeCovered must be an array or false'); @@ -24756,7 +27516,7 @@ final class CodeCoverage * @throws TestIdMissingException * @throws UnintentionallyCoveredCodeException */ - public function append(RawCodeCoverageData $rawData, $id = null, bool $append = \true, $linesToBeCovered = [], array $linesToBeUsed = []) : void + public function append(RawCodeCoverageData $rawData, $id = null, bool $append = \true, $linesToBeCovered = [], array $linesToBeUsed = []): void { if ($id === null) { $id = $this->currentId; @@ -24806,72 +27566,72 @@ final class CodeCoverage /** * Merges the data from another instance. */ - public function merge(self $that) : void + public function merge(self $that): void { $this->filter->includeFiles($that->filter()->files()); $this->data->merge($that->data); $this->tests = array_merge($this->tests, $that->getTests()); $this->cachedReport = null; } - public function enableCheckForUnintentionallyCoveredCode() : void + public function enableCheckForUnintentionallyCoveredCode(): void { $this->checkForUnintentionallyCoveredCode = \true; } - public function disableCheckForUnintentionallyCoveredCode() : void + public function disableCheckForUnintentionallyCoveredCode(): void { $this->checkForUnintentionallyCoveredCode = \false; } - public function includeUncoveredFiles() : void + public function includeUncoveredFiles(): void { $this->includeUncoveredFiles = \true; } - public function excludeUncoveredFiles() : void + public function excludeUncoveredFiles(): void { $this->includeUncoveredFiles = \false; } - public function processUncoveredFiles() : void + public function processUncoveredFiles(): void { $this->processUncoveredFiles = \true; } - public function doNotProcessUncoveredFiles() : void + public function doNotProcessUncoveredFiles(): void { $this->processUncoveredFiles = \false; } - public function enableAnnotationsForIgnoringCode() : void + public function enableAnnotationsForIgnoringCode(): void { $this->useAnnotationsForIgnoringCode = \true; } - public function disableAnnotationsForIgnoringCode() : void + public function disableAnnotationsForIgnoringCode(): void { $this->useAnnotationsForIgnoringCode = \false; } - public function ignoreDeprecatedCode() : void + public function ignoreDeprecatedCode(): void { $this->ignoreDeprecatedCode = \true; } - public function doNotIgnoreDeprecatedCode() : void + public function doNotIgnoreDeprecatedCode(): void { $this->ignoreDeprecatedCode = \false; } /** * @psalm-assert-if-true !null $this->cacheDirectory */ - public function cachesStaticAnalysis() : bool + public function cachesStaticAnalysis(): bool { return $this->cacheDirectory !== null; } - public function cacheStaticAnalysis(string $directory) : void + public function cacheStaticAnalysis(string $directory): void { $this->cacheDirectory = $directory; } - public function doNotCacheStaticAnalysis() : void + public function doNotCacheStaticAnalysis(): void { $this->cacheDirectory = null; } /** * @throws StaticAnalysisCacheNotConfiguredException */ - public function cacheDirectory() : string + public function cacheDirectory(): string { if (!$this->cachesStaticAnalysis()) { throw new StaticAnalysisCacheNotConfiguredException('The static analysis cache is not configured'); @@ -24881,23 +27641,23 @@ final class CodeCoverage /** * @psalm-param class-string $className */ - public function excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck(string $className) : void + public function excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck(string $className): void { $this->parentClassesExcludedFromUnintentionallyCoveredCodeCheck[] = $className; } - public function enableBranchAndPathCoverage() : void + public function enableBranchAndPathCoverage(): void { $this->driver->enableBranchAndPathCoverage(); } - public function disableBranchAndPathCoverage() : void + public function disableBranchAndPathCoverage(): void { $this->driver->disableBranchAndPathCoverage(); } - public function collectsBranchAndPathCoverage() : bool + public function collectsBranchAndPathCoverage(): bool { return $this->driver->collectsBranchAndPathCoverage(); } - public function detectsDeadCode() : bool + public function detectsDeadCode(): bool { return $this->driver->detectsDeadCode(); } @@ -24909,7 +27669,7 @@ final class CodeCoverage * @throws ReflectionException * @throws UnintentionallyCoveredCodeException */ - private function applyCoversAnnotationFilter(RawCodeCoverageData $rawData, $linesToBeCovered, array $linesToBeUsed) : void + private function applyCoversAnnotationFilter(RawCodeCoverageData $rawData, $linesToBeCovered, array $linesToBeUsed): void { if ($linesToBeCovered === \false) { $rawData->clear(); @@ -24933,7 +27693,7 @@ final class CodeCoverage } } } - private function applyFilter(RawCodeCoverageData $data) : void + private function applyFilter(RawCodeCoverageData $data): void { if ($this->filter->isEmpty()) { return; @@ -24944,7 +27704,7 @@ final class CodeCoverage } } } - private function applyExecutableLinesFilter(RawCodeCoverageData $data) : void + private function applyExecutableLinesFilter(RawCodeCoverageData $data): void { foreach (array_keys($data->lineCoverage()) as $filename) { if (!$this->filter->isFile($filename)) { @@ -24955,7 +27715,7 @@ final class CodeCoverage $data->markExecutableLineByBranch($filename, $linesToBranchMap); } } - private function applyIgnoredLinesFilter(RawCodeCoverageData $data) : void + private function applyIgnoredLinesFilter(RawCodeCoverageData $data): void { foreach (array_keys($data->lineCoverage()) as $filename) { if (!$this->filter->isFile($filename)) { @@ -24967,7 +27727,7 @@ final class CodeCoverage /** * @throws UnintentionallyCoveredCodeException */ - private function addUncoveredFilesFromFilter() : void + private function addUncoveredFilesFromFilter(): void { $uncoveredFiles = array_diff($this->filter->files(), $this->data->coveredFiles()); foreach ($uncoveredFiles as $uncoveredFile) { @@ -24979,7 +27739,7 @@ final class CodeCoverage /** * @throws UnintentionallyCoveredCodeException */ - private function processUncoveredFilesFromFilter() : void + private function processUncoveredFilesFromFilter(): void { $uncoveredFiles = array_diff($this->filter->files(), $this->data->coveredFiles()); $this->driver->start(); @@ -24994,7 +27754,7 @@ final class CodeCoverage * @throws ReflectionException * @throws UnintentionallyCoveredCodeException */ - private function performUnintentionallyCoveredCodeCheck(RawCodeCoverageData $data, array $linesToBeCovered, array $linesToBeUsed) : void + private function performUnintentionallyCoveredCodeCheck(RawCodeCoverageData $data, array $linesToBeCovered, array $linesToBeUsed): void { $allowedLines = $this->getAllowedLines($linesToBeCovered, $linesToBeUsed); $unintentionallyCoveredUnits = []; @@ -25010,7 +27770,7 @@ final class CodeCoverage throw new UnintentionallyCoveredCodeException($unintentionallyCoveredUnits); } } - private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed) : array + private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed): array { $allowedLines = []; foreach (array_keys($linesToBeCovered) as $file) { @@ -25033,7 +27793,7 @@ final class CodeCoverage /** * @throws ReflectionException */ - private function processUnintentionallyCoveredUnits(array $unintentionallyCoveredUnits) : array + private function processUnintentionallyCoveredUnits(array $unintentionallyCoveredUnits): array { $unintentionallyCoveredUnits = array_unique($unintentionallyCoveredUnits); sort($unintentionallyCoveredUnits); @@ -25056,7 +27816,7 @@ final class CodeCoverage } return array_values($unintentionallyCoveredUnits); } - private function analyser() : FileAnalyser + private function analyser(): FileAnalyser { if ($this->analyser !== null) { return $this->analyser; @@ -25079,15 +27839,15 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use function sprintf; -use PHPUnit\SebastianBergmann\CodeCoverage\BranchAndPathCoverageNotSupportedException; -use PHPUnit\SebastianBergmann\CodeCoverage\DeadCodeDetectionNotSupportedException; -use PHPUnit\SebastianBergmann\CodeCoverage\Filter; -use PHPUnit\SebastianBergmann\CodeCoverage\NoCodeCoverageDriverAvailableException; -use PHPUnit\SebastianBergmann\CodeCoverage\NoCodeCoverageDriverWithPathCoverageSupportAvailableException; -use PHPUnit\SebastianBergmann\CodeCoverage\RawCodeCoverageData; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\BranchAndPathCoverageNotSupportedException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\DeadCodeDetectionNotSupportedException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Filter; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\NoCodeCoverageDriverAvailableException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\NoCodeCoverageDriverWithPathCoverageSupportAvailableException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\RawCodeCoverageData; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -25141,7 +27901,7 @@ abstract class Driver * * @deprecated Use DriverSelector::forLineCoverage() instead */ - public static function forLineCoverage(Filter $filter) : self + public static function forLineCoverage(Filter $filter): self { return (new Selector())->forLineCoverage($filter); } @@ -25153,57 +27913,57 @@ abstract class Driver * * @deprecated Use DriverSelector::forLineAndPathCoverage() instead */ - public static function forLineAndPathCoverage(Filter $filter) : self + public static function forLineAndPathCoverage(Filter $filter): self { return (new Selector())->forLineAndPathCoverage($filter); } - public function canCollectBranchAndPathCoverage() : bool + public function canCollectBranchAndPathCoverage(): bool { return \false; } - public function collectsBranchAndPathCoverage() : bool + public function collectsBranchAndPathCoverage(): bool { return $this->collectBranchAndPathCoverage; } /** * @throws BranchAndPathCoverageNotSupportedException */ - public function enableBranchAndPathCoverage() : void + public function enableBranchAndPathCoverage(): void { if (!$this->canCollectBranchAndPathCoverage()) { throw new BranchAndPathCoverageNotSupportedException(sprintf('%s does not support branch and path coverage', $this->nameAndVersion())); } $this->collectBranchAndPathCoverage = \true; } - public function disableBranchAndPathCoverage() : void + public function disableBranchAndPathCoverage(): void { $this->collectBranchAndPathCoverage = \false; } - public function canDetectDeadCode() : bool + public function canDetectDeadCode(): bool { return \false; } - public function detectsDeadCode() : bool + public function detectsDeadCode(): bool { return $this->detectDeadCode; } /** * @throws DeadCodeDetectionNotSupportedException */ - public function enableDeadCodeDetection() : void + public function enableDeadCodeDetection(): void { if (!$this->canDetectDeadCode()) { throw new DeadCodeDetectionNotSupportedException(sprintf('%s does not support dead code detection', $this->nameAndVersion())); } $this->detectDeadCode = \true; } - public function disableDeadCodeDetection() : void + public function disableDeadCodeDetection(): void { $this->detectDeadCode = \false; } - public abstract function nameAndVersion() : string; - public abstract function start() : void; - public abstract function stop() : RawCodeCoverageData; + abstract public function nameAndVersion(): string; + abstract public function start(): void; + abstract public function stop(): RawCodeCoverageData; } filter = $filter; } - public function start() : void + public function start(): void { start(); } - public function stop() : RawCodeCoverageData + public function stop(): RawCodeCoverageData { stop(); $filesToCollectCoverageFor = waiting(); @@ -25266,7 +28026,7 @@ final class PcovDriver extends Driver } return RawCodeCoverageData::fromXdebugWithoutPathCoverage($collected); } - public function nameAndVersion() : string + public function nameAndVersion(): string { return 'PCOV ' . phpversion('pcov'); } @@ -25282,7 +28042,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use const PHP_SAPI; use const PHP_VERSION; @@ -25293,7 +28053,7 @@ use function get_included_files; use function phpdbg_end_oplog; use function phpdbg_get_executable; use function phpdbg_start_oplog; -use PHPUnit\SebastianBergmann\CodeCoverage\RawCodeCoverageData; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\RawCodeCoverageData; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -25308,11 +28068,11 @@ final class PhpdbgDriver extends Driver throw new PhpdbgNotAvailableException(); } } - public function start() : void + public function start(): void { phpdbg_start_oplog(); } - public function stop() : RawCodeCoverageData + public function stop(): RawCodeCoverageData { static $fetchedLines = []; $dbgData = phpdbg_end_oplog(); @@ -25333,11 +28093,11 @@ final class PhpdbgDriver extends Driver $fetchedLines = array_merge($fetchedLines, $sourceLines); return RawCodeCoverageData::fromXdebugWithoutPathCoverage($this->detectExecutedLines($fetchedLines, $dbgData)); } - public function nameAndVersion() : string + public function nameAndVersion(): string { return 'PHPDBG ' . PHP_VERSION; } - private function detectExecutedLines(array $sourceLines, array $dbgData) : array + private function detectExecutedLines(array $sourceLines, array $dbgData): array { foreach ($dbgData as $file => $coveredLines) { foreach ($coveredLines as $lineNo => $numExecuted) { @@ -25362,14 +28122,14 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use function phpversion; use function version_compare; -use PHPUnit\SebastianBergmann\CodeCoverage\Filter; -use PHPUnit\SebastianBergmann\CodeCoverage\NoCodeCoverageDriverAvailableException; -use PHPUnit\SebastianBergmann\CodeCoverage\NoCodeCoverageDriverWithPathCoverageSupportAvailableException; -use PHPUnit\SebastianBergmann\Environment\Runtime; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Filter; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\NoCodeCoverageDriverAvailableException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\NoCodeCoverageDriverWithPathCoverageSupportAvailableException; +use PHPUnitPHAR\SebastianBergmann\Environment\Runtime; final class Selector { /** @@ -25380,7 +28140,7 @@ final class Selector * @throws Xdebug3NotEnabledException * @throws XdebugNotAvailableException */ - public function forLineCoverage(Filter $filter) : Driver + public function forLineCoverage(Filter $filter): Driver { $runtime = new Runtime(); if ($runtime->hasPHPDBGCodeCoverage()) { @@ -25406,7 +28166,7 @@ final class Selector * @throws Xdebug3NotEnabledException * @throws XdebugNotAvailableException */ - public function forLineAndPathCoverage(Filter $filter) : Driver + public function forLineAndPathCoverage(Filter $filter): Driver { if ((new Runtime())->hasXdebug()) { if (version_compare(phpversion('xdebug'), '3', '>=')) { @@ -25432,7 +28192,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use const XDEBUG_CC_BRANCH_CHECK; use const XDEBUG_CC_DEAD_CODE; @@ -25450,8 +28210,8 @@ use function xdebug_get_code_coverage; use function xdebug_set_filter; use function xdebug_start_code_coverage; use function xdebug_stop_code_coverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Filter; -use PHPUnit\SebastianBergmann\CodeCoverage\RawCodeCoverageData; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Filter; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\RawCodeCoverageData; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -25487,15 +28247,15 @@ final class Xdebug2Driver extends Driver } $this->pathCoverageIsMixedCoverage = version_compare(phpversion('xdebug'), '2.9.6', '<'); } - public function canCollectBranchAndPathCoverage() : bool + public function canCollectBranchAndPathCoverage(): bool { return \true; } - public function canDetectDeadCode() : bool + public function canDetectDeadCode(): bool { return \true; } - public function start() : void + public function start(): void { $flags = XDEBUG_CC_UNUSED; if ($this->detectsDeadCode() || $this->collectsBranchAndPathCoverage()) { @@ -25506,7 +28266,7 @@ final class Xdebug2Driver extends Driver } xdebug_start_code_coverage($flags); } - public function stop() : RawCodeCoverageData + public function stop(): RawCodeCoverageData { $data = xdebug_get_code_coverage(); xdebug_stop_code_coverage(); @@ -25518,7 +28278,7 @@ final class Xdebug2Driver extends Driver } return RawCodeCoverageData::fromXdebugWithoutPathCoverage($data); } - public function nameAndVersion() : string + public function nameAndVersion(): string { return 'Xdebug ' . phpversion('xdebug'); } @@ -25534,7 +28294,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use const XDEBUG_CC_BRANCH_CHECK; use const XDEBUG_CC_DEAD_CODE; @@ -25553,8 +28313,8 @@ use function xdebug_get_code_coverage; use function xdebug_set_filter; use function xdebug_start_code_coverage; use function xdebug_stop_code_coverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Filter; -use PHPUnit\SebastianBergmann\CodeCoverage\RawCodeCoverageData; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Filter; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\RawCodeCoverageData; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -25584,15 +28344,15 @@ final class Xdebug3Driver extends Driver xdebug_set_filter(XDEBUG_FILTER_CODE_COVERAGE, XDEBUG_PATH_INCLUDE, $filter->files()); } } - public function canCollectBranchAndPathCoverage() : bool + public function canCollectBranchAndPathCoverage(): bool { return \true; } - public function canDetectDeadCode() : bool + public function canDetectDeadCode(): bool { return \true; } - public function start() : void + public function start(): void { $flags = XDEBUG_CC_UNUSED; if ($this->detectsDeadCode() || $this->collectsBranchAndPathCoverage()) { @@ -25603,7 +28363,7 @@ final class Xdebug3Driver extends Driver } xdebug_start_code_coverage($flags); } - public function stop() : RawCodeCoverageData + public function stop(): RawCodeCoverageData { $data = xdebug_get_code_coverage(); xdebug_stop_code_coverage(); @@ -25612,7 +28372,7 @@ final class Xdebug3Driver extends Driver } return RawCodeCoverageData::fromXdebugWithoutPathCoverage($data); } - public function nameAndVersion() : string + public function nameAndVersion(): string { return 'Xdebug ' . phpversion('xdebug'); } @@ -25628,7 +28388,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class BranchAndPathCoverageNotSupportedException extends RuntimeException implements Exception @@ -25645,7 +28405,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class DeadCodeDetectionNotSupportedException extends RuntimeException implements Exception @@ -25662,10 +28422,10 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Util; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class DirectoryCouldNotBeCreatedException extends RuntimeException implements Exception { } @@ -25680,7 +28440,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use Throwable; interface Exception extends Throwable @@ -25697,7 +28457,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; final class InvalidArgumentException extends \InvalidArgumentException implements Exception { @@ -25713,7 +28473,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class NoCodeCoverageDriverAvailableException extends RuntimeException implements Exception @@ -25734,7 +28494,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class NoCodeCoverageDriverWithPathCoverageSupportAvailableException extends RuntimeException implements Exception @@ -25755,7 +28515,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class ParserException extends RuntimeException implements Exception @@ -25772,11 +28532,11 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use function sprintf; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class PathExistsButIsNotDirectoryException extends RuntimeException implements Exception { public function __construct(string $path) @@ -25795,10 +28555,10 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class PcovNotAvailableException extends RuntimeException implements Exception { public function __construct() @@ -25817,10 +28577,10 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class PhpdbgNotAvailableException extends RuntimeException implements Exception { public function __construct() @@ -25839,7 +28599,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class ReflectionException extends RuntimeException implements Exception @@ -25856,7 +28616,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class ReportAlreadyFinalizedException extends RuntimeException implements Exception @@ -25877,7 +28637,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class StaticAnalysisCacheNotConfiguredException extends RuntimeException implements Exception @@ -25894,7 +28654,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class TestIdMissingException extends RuntimeException implements Exception @@ -25915,7 +28675,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class UnintentionallyCoveredCodeException extends RuntimeException implements Exception @@ -25929,11 +28689,11 @@ final class UnintentionallyCoveredCodeException extends RuntimeException impleme $this->unintentionallyCoveredUnits = $unintentionallyCoveredUnits; parent::__construct($this->toString()); } - public function getUnintentionallyCoveredUnits() : array + public function getUnintentionallyCoveredUnits(): array { return $this->unintentionallyCoveredUnits; } - private function toString() : string + private function toString(): string { $message = ''; foreach ($this->unintentionallyCoveredUnits as $unit) { @@ -25953,11 +28713,11 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use function sprintf; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class WriteOperationFailedException extends RuntimeException implements Exception { public function __construct(string $path) @@ -25976,10 +28736,10 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class WrongXdebugVersionException extends RuntimeException implements Exception { } @@ -25994,10 +28754,10 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class Xdebug2NotEnabledException extends RuntimeException implements Exception { public function __construct() @@ -26016,10 +28776,10 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class Xdebug3NotEnabledException extends RuntimeException implements Exception { public function __construct() @@ -26038,10 +28798,10 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Driver; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver; use RuntimeException; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Exception; final class XdebugNotAvailableException extends RuntimeException implements Exception { public function __construct() @@ -26060,7 +28820,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use RuntimeException; final class XmlException extends RuntimeException implements Exception @@ -26077,13 +28837,13 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use function array_keys; use function is_file; use function realpath; use function strpos; -use PHPUnit\SebastianBergmann\FileIterator\Facade as FileIteratorFacade; +use PHPUnitPHAR\SebastianBergmann\FileIterator\Facade as FileIteratorFacade; final class Filter { /** @@ -26094,7 +28854,7 @@ final class Filter * @psalm-var array */ private $isFileCache = []; - public function includeDirectory(string $directory, string $suffix = '.php', string $prefix = '') : void + public function includeDirectory(string $directory, string $suffix = '.php', string $prefix = ''): void { foreach ((new FileIteratorFacade())->getFilesAsArray($directory, $suffix, $prefix) as $file) { $this->includeFile($file); @@ -26103,13 +28863,13 @@ final class Filter /** * @psalm-param list $files */ - public function includeFiles(array $filenames) : void + public function includeFiles(array $filenames): void { foreach ($filenames as $filename) { $this->includeFile($filename); } } - public function includeFile(string $filename) : void + public function includeFile(string $filename): void { $filename = realpath($filename); if (!$filename) { @@ -26117,13 +28877,13 @@ final class Filter } $this->files[$filename] = \true; } - public function excludeDirectory(string $directory, string $suffix = '.php', string $prefix = '') : void + public function excludeDirectory(string $directory, string $suffix = '.php', string $prefix = ''): void { foreach ((new FileIteratorFacade())->getFilesAsArray($directory, $suffix, $prefix) as $file) { $this->excludeFile($file); } } - public function excludeFile(string $filename) : void + public function excludeFile(string $filename): void { $filename = realpath($filename); if (!$filename || !isset($this->files[$filename])) { @@ -26131,7 +28891,7 @@ final class Filter } unset($this->files[$filename]); } - public function isFile(string $filename) : bool + public function isFile(string $filename): bool { if (isset($this->isFileCache[$filename])) { return $this->isFileCache[$filename]; @@ -26144,18 +28904,18 @@ final class Filter $this->isFileCache[$filename] = $isFile; return $isFile; } - public function isExcluded(string $filename) : bool + public function isExcluded(string $filename): bool { return !isset($this->files[$filename]) || !$this->isFile($filename); } /** * @psalm-return list */ - public function files() : array + public function files(): array { return array_keys($this->files); } - public function isEmpty() : bool + public function isEmpty(): bool { return empty($this->files); } @@ -26200,14 +28960,14 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Node; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node; use const DIRECTORY_SEPARATOR; use function array_merge; use function str_replace; use function substr; use Countable; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Percentage; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Percentage; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -26233,7 +28993,7 @@ abstract class AbstractNode implements Countable * @var string */ private $id; - public function __construct(string $name, self $parent = null) + public function __construct(string $name, ?self $parent = null) { if (substr($name, -1) === DIRECTORY_SEPARATOR) { $name = substr($name, 0, -1); @@ -26241,11 +29001,11 @@ abstract class AbstractNode implements Countable $this->name = $name; $this->parent = $parent; } - public function name() : string + public function name(): string { return $this->name; } - public function id() : string + public function id(): string { if ($this->id === null) { $parent = $this->parent(); @@ -26262,7 +29022,7 @@ abstract class AbstractNode implements Countable } return $this->id; } - public function pathAsString() : string + public function pathAsString(): string { if ($this->pathAsString === null) { if ($this->parent === null) { @@ -26273,7 +29033,7 @@ abstract class AbstractNode implements Countable } return $this->pathAsString; } - public function pathAsArray() : array + public function pathAsArray(): array { if ($this->pathAsArray === null) { if ($this->parent === null) { @@ -26285,87 +29045,87 @@ abstract class AbstractNode implements Countable } return $this->pathAsArray; } - public function parent() : ?self + public function parent(): ?self { return $this->parent; } - public function percentageOfTestedClasses() : Percentage + public function percentageOfTestedClasses(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfTestedClasses(), $this->numberOfClasses()); } - public function percentageOfTestedTraits() : Percentage + public function percentageOfTestedTraits(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfTestedTraits(), $this->numberOfTraits()); } - public function percentageOfTestedClassesAndTraits() : Percentage + public function percentageOfTestedClassesAndTraits(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfTestedClassesAndTraits(), $this->numberOfClassesAndTraits()); } - public function percentageOfTestedFunctions() : Percentage + public function percentageOfTestedFunctions(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfTestedFunctions(), $this->numberOfFunctions()); } - public function percentageOfTestedMethods() : Percentage + public function percentageOfTestedMethods(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfTestedMethods(), $this->numberOfMethods()); } - public function percentageOfTestedFunctionsAndMethods() : Percentage + public function percentageOfTestedFunctionsAndMethods(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfTestedFunctionsAndMethods(), $this->numberOfFunctionsAndMethods()); } - public function percentageOfExecutedLines() : Percentage + public function percentageOfExecutedLines(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfExecutedLines(), $this->numberOfExecutableLines()); } - public function percentageOfExecutedBranches() : Percentage + public function percentageOfExecutedBranches(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfExecutedBranches(), $this->numberOfExecutableBranches()); } - public function percentageOfExecutedPaths() : Percentage + public function percentageOfExecutedPaths(): Percentage { return Percentage::fromFractionAndTotal($this->numberOfExecutedPaths(), $this->numberOfExecutablePaths()); } - public function numberOfClassesAndTraits() : int + public function numberOfClassesAndTraits(): int { return $this->numberOfClasses() + $this->numberOfTraits(); } - public function numberOfTestedClassesAndTraits() : int + public function numberOfTestedClassesAndTraits(): int { return $this->numberOfTestedClasses() + $this->numberOfTestedTraits(); } - public function classesAndTraits() : array + public function classesAndTraits(): array { return array_merge($this->classes(), $this->traits()); } - public function numberOfFunctionsAndMethods() : int + public function numberOfFunctionsAndMethods(): int { return $this->numberOfFunctions() + $this->numberOfMethods(); } - public function numberOfTestedFunctionsAndMethods() : int + public function numberOfTestedFunctionsAndMethods(): int { return $this->numberOfTestedFunctions() + $this->numberOfTestedMethods(); } - public abstract function classes() : array; - public abstract function traits() : array; - public abstract function functions() : array; + abstract public function classes(): array; + abstract public function traits(): array; + abstract public function functions(): array; /** * @psalm-return array{linesOfCode: int, commentLinesOfCode: int, nonCommentLinesOfCode: int} */ - public abstract function linesOfCode() : array; - public abstract function numberOfExecutableLines() : int; - public abstract function numberOfExecutedLines() : int; - public abstract function numberOfExecutableBranches() : int; - public abstract function numberOfExecutedBranches() : int; - public abstract function numberOfExecutablePaths() : int; - public abstract function numberOfExecutedPaths() : int; - public abstract function numberOfClasses() : int; - public abstract function numberOfTestedClasses() : int; - public abstract function numberOfTraits() : int; - public abstract function numberOfTestedTraits() : int; - public abstract function numberOfMethods() : int; - public abstract function numberOfTestedMethods() : int; - public abstract function numberOfFunctions() : int; - public abstract function numberOfTestedFunctions() : int; + abstract public function linesOfCode(): array; + abstract public function numberOfExecutableLines(): int; + abstract public function numberOfExecutedLines(): int; + abstract public function numberOfExecutableBranches(): int; + abstract public function numberOfExecutedBranches(): int; + abstract public function numberOfExecutablePaths(): int; + abstract public function numberOfExecutedPaths(): int; + abstract public function numberOfClasses(): int; + abstract public function numberOfTestedClasses(): int; + abstract public function numberOfTraits(): int; + abstract public function numberOfTestedTraits(): int; + abstract public function numberOfMethods(): int; + abstract public function numberOfTestedMethods(): int; + abstract public function numberOfFunctions(): int; + abstract public function numberOfTestedFunctions(): int; } analyser = $analyser; } - public function build(CodeCoverage $coverage) : Directory + public function build(CodeCoverage $coverage): Directory { $data = clone $coverage->getData(); // clone because path munging is destructive to the original data @@ -26416,7 +29176,7 @@ final class Builder $this->addItems($root, $this->buildDirectoryStructure($data), $coverage->getTests()); return $root; } - private function addItems(Directory $root, array $items, array $tests) : void + private function addItems(Directory $root, array $items, array $tests): void { foreach ($items as $key => $value) { $key = (string) $key; @@ -26472,7 +29232,7 @@ final class Builder * ) * */ - private function buildDirectoryStructure(ProcessedCodeCoverageData $data) : array + private function buildDirectoryStructure(ProcessedCodeCoverageData $data): array { $result = []; foreach ($data->coveredFiles() as $originalPath) { @@ -26527,7 +29287,7 @@ final class Builder * ) * */ - private function reducePaths(ProcessedCodeCoverageData $coverage) : string + private function reducePaths(ProcessedCodeCoverageData $coverage): string { if (empty($coverage->coveredFiles())) { return '.'; @@ -26589,7 +29349,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Node; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node; use function sprintf; /** @@ -26610,7 +29370,7 @@ final class CrapIndex $this->cyclomaticComplexity = $cyclomaticComplexity; $this->codeCoverage = $codeCoverage; } - public function asString() : string + public function asString(): string { if ($this->codeCoverage === 0.0) { return (string) ($this->cyclomaticComplexity ** 2 + $this->cyclomaticComplexity); @@ -26632,7 +29392,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Node; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node; use function array_merge; use function count; @@ -26731,7 +29491,7 @@ final class Directory extends AbstractNode implements IteratorAggregate * @var int */ private $numTestedFunctions = -1; - public function count() : int + public function count(): int { if ($this->numFiles === -1) { $this->numFiles = 0; @@ -26741,37 +29501,37 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numFiles; } - public function getIterator() : RecursiveIteratorIterator + public function getIterator(): RecursiveIteratorIterator { return new RecursiveIteratorIterator(new Iterator($this), RecursiveIteratorIterator::SELF_FIRST); } - public function addDirectory(string $name) : self + public function addDirectory(string $name): self { $directory = new self($name, $this); $this->children[] = $directory; $this->directories[] =& $this->children[count($this->children) - 1]; return $directory; } - public function addFile(File $file) : void + public function addFile(File $file): void { $this->children[] = $file; $this->files[] =& $this->children[count($this->children) - 1]; $this->numExecutableLines = -1; $this->numExecutedLines = -1; } - public function directories() : array + public function directories(): array { return $this->directories; } - public function files() : array + public function files(): array { return $this->files; } - public function children() : array + public function children(): array { return $this->children; } - public function classes() : array + public function classes(): array { if ($this->classes === null) { $this->classes = []; @@ -26781,7 +29541,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->classes; } - public function traits() : array + public function traits(): array { if ($this->traits === null) { $this->traits = []; @@ -26791,7 +29551,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->traits; } - public function functions() : array + public function functions(): array { if ($this->functions === null) { $this->functions = []; @@ -26804,7 +29564,7 @@ final class Directory extends AbstractNode implements IteratorAggregate /** * @psalm-return array{linesOfCode: int, commentLinesOfCode: int, nonCommentLinesOfCode: int} */ - public function linesOfCode() : array + public function linesOfCode(): array { if ($this->linesOfCode === null) { $this->linesOfCode = ['linesOfCode' => 0, 'commentLinesOfCode' => 0, 'nonCommentLinesOfCode' => 0]; @@ -26817,7 +29577,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->linesOfCode; } - public function numberOfExecutableLines() : int + public function numberOfExecutableLines(): int { if ($this->numExecutableLines === -1) { $this->numExecutableLines = 0; @@ -26827,7 +29587,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numExecutableLines; } - public function numberOfExecutedLines() : int + public function numberOfExecutedLines(): int { if ($this->numExecutedLines === -1) { $this->numExecutedLines = 0; @@ -26837,7 +29597,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numExecutedLines; } - public function numberOfExecutableBranches() : int + public function numberOfExecutableBranches(): int { if ($this->numExecutableBranches === -1) { $this->numExecutableBranches = 0; @@ -26847,7 +29607,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numExecutableBranches; } - public function numberOfExecutedBranches() : int + public function numberOfExecutedBranches(): int { if ($this->numExecutedBranches === -1) { $this->numExecutedBranches = 0; @@ -26857,7 +29617,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numExecutedBranches; } - public function numberOfExecutablePaths() : int + public function numberOfExecutablePaths(): int { if ($this->numExecutablePaths === -1) { $this->numExecutablePaths = 0; @@ -26867,7 +29627,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numExecutablePaths; } - public function numberOfExecutedPaths() : int + public function numberOfExecutedPaths(): int { if ($this->numExecutedPaths === -1) { $this->numExecutedPaths = 0; @@ -26877,7 +29637,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numExecutedPaths; } - public function numberOfClasses() : int + public function numberOfClasses(): int { if ($this->numClasses === -1) { $this->numClasses = 0; @@ -26887,7 +29647,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numClasses; } - public function numberOfTestedClasses() : int + public function numberOfTestedClasses(): int { if ($this->numTestedClasses === -1) { $this->numTestedClasses = 0; @@ -26897,7 +29657,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numTestedClasses; } - public function numberOfTraits() : int + public function numberOfTraits(): int { if ($this->numTraits === -1) { $this->numTraits = 0; @@ -26907,7 +29667,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numTraits; } - public function numberOfTestedTraits() : int + public function numberOfTestedTraits(): int { if ($this->numTestedTraits === -1) { $this->numTestedTraits = 0; @@ -26917,7 +29677,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numTestedTraits; } - public function numberOfMethods() : int + public function numberOfMethods(): int { if ($this->numMethods === -1) { $this->numMethods = 0; @@ -26927,7 +29687,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numMethods; } - public function numberOfTestedMethods() : int + public function numberOfTestedMethods(): int { if ($this->numTestedMethods === -1) { $this->numTestedMethods = 0; @@ -26937,7 +29697,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numTestedMethods; } - public function numberOfFunctions() : int + public function numberOfFunctions(): int { if ($this->numFunctions === -1) { $this->numFunctions = 0; @@ -26947,7 +29707,7 @@ final class Directory extends AbstractNode implements IteratorAggregate } return $this->numFunctions; } - public function numberOfTestedFunctions() : int + public function numberOfTestedFunctions(): int { if ($this->numTestedFunctions === -1) { $this->numTestedFunctions = 0; @@ -26969,7 +29729,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Node; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node; use function array_filter; use function count; @@ -27075,66 +29835,66 @@ final class File extends AbstractNode $this->linesOfCode = $linesOfCode; $this->calculateStatistics($classes, $traits, $functions); } - public function count() : int + public function count(): int { return 1; } - public function lineCoverageData() : array + public function lineCoverageData(): array { return $this->lineCoverageData; } - public function functionCoverageData() : array + public function functionCoverageData(): array { return $this->functionCoverageData; } - public function testData() : array + public function testData(): array { return $this->testData; } - public function classes() : array + public function classes(): array { return $this->classes; } - public function traits() : array + public function traits(): array { return $this->traits; } - public function functions() : array + public function functions(): array { return $this->functions; } /** * @psalm-return array{linesOfCode: int, commentLinesOfCode: int, nonCommentLinesOfCode: int} */ - public function linesOfCode() : array + public function linesOfCode(): array { return $this->linesOfCode; } - public function numberOfExecutableLines() : int + public function numberOfExecutableLines(): int { return $this->numExecutableLines; } - public function numberOfExecutedLines() : int + public function numberOfExecutedLines(): int { return $this->numExecutedLines; } - public function numberOfExecutableBranches() : int + public function numberOfExecutableBranches(): int { return $this->numExecutableBranches; } - public function numberOfExecutedBranches() : int + public function numberOfExecutedBranches(): int { return $this->numExecutedBranches; } - public function numberOfExecutablePaths() : int + public function numberOfExecutablePaths(): int { return $this->numExecutablePaths; } - public function numberOfExecutedPaths() : int + public function numberOfExecutedPaths(): int { return $this->numExecutedPaths; } - public function numberOfClasses() : int + public function numberOfClasses(): int { if ($this->numClasses === null) { $this->numClasses = 0; @@ -27149,11 +29909,11 @@ final class File extends AbstractNode } return $this->numClasses; } - public function numberOfTestedClasses() : int + public function numberOfTestedClasses(): int { return $this->numTestedClasses; } - public function numberOfTraits() : int + public function numberOfTraits(): int { if ($this->numTraits === null) { $this->numTraits = 0; @@ -27168,11 +29928,11 @@ final class File extends AbstractNode } return $this->numTraits; } - public function numberOfTestedTraits() : int + public function numberOfTestedTraits(): int { return $this->numTestedTraits; } - public function numberOfMethods() : int + public function numberOfMethods(): int { if ($this->numMethods === null) { $this->numMethods = 0; @@ -27193,7 +29953,7 @@ final class File extends AbstractNode } return $this->numMethods; } - public function numberOfTestedMethods() : int + public function numberOfTestedMethods(): int { if ($this->numTestedMethods === null) { $this->numTestedMethods = 0; @@ -27214,11 +29974,11 @@ final class File extends AbstractNode } return $this->numTestedMethods; } - public function numberOfFunctions() : int + public function numberOfFunctions(): int { return count($this->functions); } - public function numberOfTestedFunctions() : int + public function numberOfTestedFunctions(): int { if ($this->numTestedFunctions === null) { $this->numTestedFunctions = 0; @@ -27230,7 +29990,7 @@ final class File extends AbstractNode } return $this->numTestedFunctions; } - private function calculateStatistics(array $classes, array $traits, array $functions) : void + private function calculateStatistics(array $classes, array $traits, array $functions): void { foreach (range(1, $this->linesOfCode['linesOfCode']) as $lineNumber) { $this->codeUnitsByLine[$lineNumber] = []; @@ -27305,7 +30065,7 @@ final class File extends AbstractNode } } } - private function processClasses(array $classes) : void + private function processClasses(array $classes): void { $link = $this->id() . '.html#'; foreach ($classes as $className => $class) { @@ -27327,7 +30087,7 @@ final class File extends AbstractNode } } } - private function processTraits(array $traits) : void + private function processTraits(array $traits): void { $link = $this->id() . '.html#'; foreach ($traits as $traitName => $trait) { @@ -27349,7 +30109,7 @@ final class File extends AbstractNode } } } - private function processFunctions(array $functions) : void + private function processFunctions(array $functions): void { $link = $this->id() . '.html#'; foreach ($functions as $functionName => $function) { @@ -27375,7 +30135,7 @@ final class File extends AbstractNode $this->numExecutedPaths += $this->functions[$functionName]['executedPaths']; } } - private function newMethod(string $className, string $methodName, array $method, string $link) : array + private function newMethod(string $className, string $methodName, array $method, string $link): array { $methodData = ['methodName' => $methodName, 'visibility' => $method['visibility'], 'signature' => $method['signature'], 'startLine' => $method['startLine'], 'endLine' => $method['endLine'], 'executableLines' => 0, 'executedLines' => 0, 'executableBranches' => 0, 'executedBranches' => 0, 'executablePaths' => 0, 'executedPaths' => 0, 'ccn' => $method['ccn'], 'coverage' => 0, 'crap' => 0, 'link' => $link . $method['startLine']]; $key = $className . '->' . $methodName; @@ -27405,7 +30165,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Node; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node; use function count; use RecursiveIterator; @@ -27429,49 +30189,49 @@ final class Iterator implements RecursiveIterator /** * Rewinds the Iterator to the first element. */ - public function rewind() : void + public function rewind(): void { $this->position = 0; } /** * Checks if there is a current element after calls to rewind() or next(). */ - public function valid() : bool + public function valid(): bool { return $this->position < count($this->nodes); } /** * Returns the key of the current element. */ - public function key() : int + public function key(): int { return $this->position; } /** * Returns the current element. */ - public function current() : ?AbstractNode + public function current(): ?AbstractNode { return $this->valid() ? $this->nodes[$this->position] : null; } /** * Moves forward to next element. */ - public function next() : void + public function next(): void { $this->position++; } /** * Returns the sub iterator for the current element. */ - public function getChildren() : self + public function getChildren(): self { return new self($this->nodes[$this->position]); } /** * Checks whether the current element has children. */ - public function hasChildren() : bool + public function hasChildren(): bool { return $this->nodes[$this->position] instanceof Directory; } @@ -27487,7 +30247,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use function array_key_exists; use function array_keys; @@ -27496,7 +30256,7 @@ use function array_unique; use function count; use function is_array; use function ksort; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\Driver; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\Driver; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -27517,13 +30277,13 @@ final class ProcessedCodeCoverageData * @var array */ private $functionCoverage = []; - public function initializeUnseenData(RawCodeCoverageData $rawData) : void + public function initializeUnseenData(RawCodeCoverageData $rawData): void { foreach ($rawData->lineCoverage() as $file => $lines) { if (!isset($this->lineCoverage[$file])) { $this->lineCoverage[$file] = []; foreach ($lines as $k => $v) { - $this->lineCoverage[$file][$k] = $v === Driver::LINE_NOT_EXECUTABLE ? null : []; + $this->lineCoverage[$file][$k] = ($v === Driver::LINE_NOT_EXECUTABLE) ? null : []; } } } @@ -27537,7 +30297,7 @@ final class ProcessedCodeCoverageData } } } - public function markCodeAsExecutedByTestCase(string $testCaseId, RawCodeCoverageData $executedCode) : void + public function markCodeAsExecutedByTestCase(string $testCaseId, RawCodeCoverageData $executedCode): void { foreach ($executedCode->lineCoverage() as $file => $lines) { foreach ($lines as $k => $v) { @@ -27561,30 +30321,30 @@ final class ProcessedCodeCoverageData } } } - public function setLineCoverage(array $lineCoverage) : void + public function setLineCoverage(array $lineCoverage): void { $this->lineCoverage = $lineCoverage; } - public function lineCoverage() : array + public function lineCoverage(): array { ksort($this->lineCoverage); return $this->lineCoverage; } - public function setFunctionCoverage(array $functionCoverage) : void + public function setFunctionCoverage(array $functionCoverage): void { $this->functionCoverage = $functionCoverage; } - public function functionCoverage() : array + public function functionCoverage(): array { ksort($this->functionCoverage); return $this->functionCoverage; } - public function coveredFiles() : array + public function coveredFiles(): array { ksort($this->lineCoverage); return array_keys($this->lineCoverage); } - public function renameFile(string $oldFile, string $newFile) : void + public function renameFile(string $oldFile, string $newFile): void { $this->lineCoverage[$newFile] = $this->lineCoverage[$oldFile]; if (isset($this->functionCoverage[$oldFile])) { @@ -27592,7 +30352,7 @@ final class ProcessedCodeCoverageData } unset($this->lineCoverage[$oldFile], $this->functionCoverage[$oldFile]); } - public function merge(self $newData) : void + public function merge(self $newData): void { foreach ($newData->lineCoverage as $file => $lines) { if (!isset($this->lineCoverage[$file])) { @@ -27641,7 +30401,7 @@ final class ProcessedCodeCoverageData * * During a merge, a higher number is better. */ - private function priorityForLine(array $data, int $line) : int + private function priorityForLine(array $data, int $line): int { if (!array_key_exists($line, $data)) { return 1; @@ -27657,7 +30417,7 @@ final class ProcessedCodeCoverageData /** * For a function we have never seen before, copy all data over and simply init the 'hit' array. */ - private function initPreviouslyUnseenFunction(string $file, string $functionName, array $functionData) : void + private function initPreviouslyUnseenFunction(string $file, string $functionName, array $functionData): void { $this->functionCoverage[$file][$functionName] = $functionData; foreach (array_keys($functionData['branches']) as $branchId) { @@ -27672,7 +30432,7 @@ final class ProcessedCodeCoverageData * Techniques such as mocking and where the contents of a file are different vary during tests (e.g. compiling * containers) mean that the functions inside a file cannot be relied upon to be static. */ - private function initPreviouslySeenFunction(string $file, string $functionName, array $functionData) : void + private function initPreviouslySeenFunction(string $file, string $functionName, array $functionData): void { foreach ($functionData['branches'] as $branchId => $branchData) { if (!isset($this->functionCoverage[$file][$functionName]['branches'][$branchId])) { @@ -27699,7 +30459,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use function array_diff; use function array_diff_key; @@ -27713,8 +30473,8 @@ use function in_array; use function is_file; use function range; use function trim; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\Driver; -use PHPUnit\SebastianBergmann\CodeCoverage\StaticAnalysis\FileAnalyser; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\Driver; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\StaticAnalysis\FileAnalyser; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -27736,11 +30496,11 @@ final class RawCodeCoverageData * @see https://xdebug.org/docs/code_coverage for format */ private $functionCoverage; - public static function fromXdebugWithoutPathCoverage(array $rawCoverage) : self + public static function fromXdebugWithoutPathCoverage(array $rawCoverage): self { return new self($rawCoverage, []); } - public static function fromXdebugWithPathCoverage(array $rawCoverage) : self + public static function fromXdebugWithPathCoverage(array $rawCoverage): self { $lineCoverage = []; $functionCoverage = []; @@ -27750,7 +30510,7 @@ final class RawCodeCoverageData } return new self($lineCoverage, $functionCoverage); } - public static function fromXdebugWithMixedCoverage(array $rawCoverage) : self + public static function fromXdebugWithMixedCoverage(array $rawCoverage): self { $lineCoverage = []; $functionCoverage = []; @@ -27766,7 +30526,7 @@ final class RawCodeCoverageData } return new self($lineCoverage, $functionCoverage); } - public static function fromUncoveredFile(string $filename, FileAnalyser $analyser) : self + public static function fromUncoveredFile(string $filename, FileAnalyser $analyser): self { $lineCoverage = []; foreach ($analyser->executableLinesIn($filename) as $line => $branch) { @@ -27780,26 +30540,26 @@ final class RawCodeCoverageData $this->functionCoverage = $functionCoverage; $this->skipEmptyLines(); } - public function clear() : void + public function clear(): void { $this->lineCoverage = $this->functionCoverage = []; } - public function lineCoverage() : array + public function lineCoverage(): array { return $this->lineCoverage; } - public function functionCoverage() : array + public function functionCoverage(): array { return $this->functionCoverage; } - public function removeCoverageDataForFile(string $filename) : void + public function removeCoverageDataForFile(string $filename): void { unset($this->lineCoverage[$filename], $this->functionCoverage[$filename]); } /** * @param int[] $lines */ - public function keepLineCoverageDataOnlyForLines(string $filename, array $lines) : void + public function keepLineCoverageDataOnlyForLines(string $filename, array $lines): void { if (!isset($this->lineCoverage[$filename])) { return; @@ -27809,7 +30569,7 @@ final class RawCodeCoverageData /** * @param int[] $linesToBranchMap */ - public function markExecutableLineByBranch(string $filename, array $linesToBranchMap) : void + public function markExecutableLineByBranch(string $filename, array $linesToBranchMap): void { if (!isset($this->lineCoverage[$filename])) { return; @@ -27837,7 +30597,7 @@ final class RawCodeCoverageData /** * @param int[] $lines */ - public function keepFunctionCoverageDataOnlyForLines(string $filename, array $lines) : void + public function keepFunctionCoverageDataOnlyForLines(string $filename, array $lines): void { if (!isset($this->functionCoverage[$filename])) { return; @@ -27858,7 +30618,7 @@ final class RawCodeCoverageData /** * @param int[] $lines */ - public function removeCoverageDataForLines(string $filename, array $lines) : void + public function removeCoverageDataForLines(string $filename, array $lines): void { if (empty($lines)) { return; @@ -27890,7 +30650,7 @@ final class RawCodeCoverageData * * @see https://github.com/sebastianbergmann/php-code-coverage/issues/799 */ - private function skipEmptyLines() : void + private function skipEmptyLines(): void { foreach ($this->lineCoverage as $filename => $coverage) { foreach ($this->getEmptyLinesForFile($filename) as $emptyLine) { @@ -27898,7 +30658,7 @@ final class RawCodeCoverageData } } } - private function getEmptyLinesForFile(string $filename) : array + private function getEmptyLinesForFile(string $filename): array { if (!isset(self::$emptyLineCache[$filename])) { self::$emptyLineCache[$filename] = []; @@ -27925,7 +30685,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report; use function count; use function dirname; @@ -27937,16 +30697,16 @@ use function range; use function strpos; use function time; use DOMDocument; -use PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\File; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Filesystem; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\File; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Filesystem; final class Clover { /** * @throws WriteOperationFailedException */ - public function process(CodeCoverage $coverage, ?string $target = null, ?string $name = null) : string + public function process(CodeCoverage $coverage, ?string $target = null, ?string $name = null): string { $time = (string) time(); $xmlDocument = new DOMDocument('1.0', 'UTF-8'); @@ -28116,7 +30876,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report; use function basename; use function count; @@ -28128,16 +30888,16 @@ use function str_replace; use function strpos; use function time; use DOMImplementation; -use PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\File; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Filesystem; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\File; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Filesystem; final class Cobertura { /** * @throws WriteOperationFailedException */ - public function process(CodeCoverage $coverage, ?string $target = null) : string + public function process(CodeCoverage $coverage, ?string $target = null): string { $time = (string) time(); $report = $coverage->getReport(); @@ -28150,11 +30910,11 @@ final class Cobertura $coverageElement = $document->createElement('coverage'); $linesValid = $report->numberOfExecutableLines(); $linesCovered = $report->numberOfExecutedLines(); - $lineRate = $linesValid === 0 ? 0 : $linesCovered / $linesValid; + $lineRate = ($linesValid === 0) ? 0 : ($linesCovered / $linesValid); $coverageElement->setAttribute('line-rate', (string) $lineRate); $branchesValid = $report->numberOfExecutableBranches(); $branchesCovered = $report->numberOfExecutedBranches(); - $branchRate = $branchesValid === 0 ? 0 : $branchesCovered / $branchesValid; + $branchRate = ($branchesValid === 0) ? 0 : ($branchesCovered / $branchesValid); $coverageElement->setAttribute('branch-rate', (string) $branchRate); $coverageElement->setAttribute('lines-covered', (string) $report->numberOfExecutedLines()); $coverageElement->setAttribute('lines-valid', (string) $report->numberOfExecutableLines()); @@ -28180,11 +30940,11 @@ final class Cobertura $packageElement->setAttribute('name', str_replace($report->pathAsString() . \DIRECTORY_SEPARATOR, '', $item->pathAsString())); $linesValid = $item->numberOfExecutableLines(); $linesCovered = $item->numberOfExecutedLines(); - $lineRate = $linesValid === 0 ? 0 : $linesCovered / $linesValid; + $lineRate = ($linesValid === 0) ? 0 : ($linesCovered / $linesValid); $packageElement->setAttribute('line-rate', (string) $lineRate); $branchesValid = $item->numberOfExecutableBranches(); $branchesCovered = $item->numberOfExecutedBranches(); - $branchRate = $branchesValid === 0 ? 0 : $branchesCovered / $branchesValid; + $branchRate = ($branchesValid === 0) ? 0 : ($branchesCovered / $branchesValid); $packageElement->setAttribute('branch-rate', (string) $branchRate); $packageElement->setAttribute('complexity', ''); $packagesElement->appendChild($packageElement); @@ -28200,10 +30960,10 @@ final class Cobertura } $linesValid = $class['executableLines']; $linesCovered = $class['executedLines']; - $lineRate = $linesValid === 0 ? 0 : $linesCovered / $linesValid; + $lineRate = ($linesValid === 0) ? 0 : ($linesCovered / $linesValid); $branchesValid = $class['executableBranches']; $branchesCovered = $class['executedBranches']; - $branchRate = $branchesValid === 0 ? 0 : $branchesCovered / $branchesValid; + $branchRate = ($branchesValid === 0) ? 0 : ($branchesCovered / $branchesValid); $classElement = $document->createElement('class'); $classElement->setAttribute('name', $className); $classElement->setAttribute('filename', str_replace($report->pathAsString() . \DIRECTORY_SEPARATOR, '', $item->pathAsString())); @@ -28222,10 +30982,10 @@ final class Cobertura preg_match("/\\((.*?)\\)/", $method['signature'], $signature); $linesValid = $method['executableLines']; $linesCovered = $method['executedLines']; - $lineRate = $linesValid === 0 ? 0 : $linesCovered / $linesValid; + $lineRate = ($linesValid === 0) ? 0 : ($linesCovered / $linesValid); $branchesValid = $method['executableBranches']; $branchesCovered = $method['executedBranches']; - $branchRate = $branchesValid === 0 ? 0 : $branchesCovered / $branchesValid; + $branchRate = ($branchesValid === 0) ? 0 : ($branchesCovered / $branchesValid); $methodElement = $document->createElement('method'); $methodElement->setAttribute('name', $methodName); $methodElement->setAttribute('signature', $signature[1]); @@ -28274,12 +31034,12 @@ final class Cobertura $functionsComplexity += $function['ccn']; $linesValid = $function['executableLines']; $linesCovered = $function['executedLines']; - $lineRate = $linesValid === 0 ? 0 : $linesCovered / $linesValid; + $lineRate = ($linesValid === 0) ? 0 : ($linesCovered / $linesValid); $functionsLinesValid += $linesValid; $functionsLinesCovered += $linesCovered; $branchesValid = $function['executableBranches']; $branchesCovered = $function['executedBranches']; - $branchRate = $branchesValid === 0 ? 0 : $branchesCovered / $branchesValid; + $branchRate = ($branchesValid === 0) ? 0 : ($branchesCovered / $branchesValid); $functionsBranchesValid += $branchesValid; $functionsBranchesCovered += $branchesValid; $methodElement = $document->createElement('method'); @@ -28308,7 +31068,7 @@ final class Cobertura continue; } $lineRate = $functionsLinesCovered / $functionsLinesValid; - $branchRate = $functionsBranchesValid === 0 ? 0 : $functionsBranchesCovered / $functionsBranchesValid; + $branchRate = ($functionsBranchesValid === 0) ? 0 : ($functionsBranchesCovered / $functionsBranchesValid); $classElement->setAttribute('line-rate', (string) $lineRate); $classElement->setAttribute('branch-rate', (string) $branchRate); $classElement->setAttribute('complexity', (string) $functionsComplexity); @@ -28338,7 +31098,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report; use function date; use function dirname; @@ -28348,10 +31108,10 @@ use function is_string; use function round; use function strpos; use DOMDocument; -use PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\File; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Filesystem; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\File; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Filesystem; final class Crap4j { /** @@ -28365,7 +31125,7 @@ final class Crap4j /** * @throws WriteOperationFailedException */ - public function process(CodeCoverage $coverage, ?string $target = null, ?string $name = null) : string + public function process(CodeCoverage $coverage, ?string $target = null, ?string $name = null): string { $document = new DOMDocument('1.0', 'UTF-8'); $document->formatOutput = \true; @@ -28439,7 +31199,7 @@ final class Crap4j } return $buffer; } - private function crapLoad(float $crapValue, int $cyclomaticComplexity, float $coveragePercent) : float + private function crapLoad(float $crapValue, int $cyclomaticComplexity, float $coveragePercent): float { $crapLoad = 0; if ($crapValue >= $this->threshold) { @@ -28448,7 +31208,7 @@ final class Crap4j } return $crapLoad; } - private function roundValue(float $value) : float + private function roundValue(float $value): float { return round($value, 2); } @@ -28464,17 +31224,17 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Html; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Html; use const DIRECTORY_SEPARATOR; use function copy; use function date; use function dirname; use function substr; -use PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage; -use PHPUnit\SebastianBergmann\CodeCoverage\InvalidArgumentException; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Filesystem; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\InvalidArgumentException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Filesystem; final class Facade { /** @@ -28503,7 +31263,7 @@ final class Facade $this->lowUpperBound = $lowUpperBound; $this->templatePath = __DIR__ . '/Renderer/Template/'; } - public function process(CodeCoverage $coverage, string $target) : void + public function process(CodeCoverage $coverage, string $target): void { $target = $this->directory($target); $report = $coverage->getReport(); @@ -28527,7 +31287,7 @@ final class Facade } $this->copyFiles($target); } - private function copyFiles(string $target) : void + private function copyFiles(string $target): void { $dir = $this->directory($target . '_css'); copy($this->templatePath . 'css/bootstrap.min.css', $dir . 'bootstrap.min.css'); @@ -28546,7 +31306,7 @@ final class Facade copy($this->templatePath . 'js/nv.d3.min.js', $dir . 'nv.d3.min.js'); copy($this->templatePath . 'js/file.js', $dir . 'file.js'); } - private function directory(string $directory) : string + private function directory(string $directory): string { if (substr($directory, -1, 1) != DIRECTORY_SEPARATOR) { $directory .= DIRECTORY_SEPARATOR; @@ -28566,19 +31326,19 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Html; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Html; use function array_pop; use function count; use function sprintf; use function str_repeat; use function substr_count; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\AbstractNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\File as FileNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Version; -use PHPUnit\SebastianBergmann\Environment\Runtime; -use PHPUnit\SebastianBergmann\Template\Template; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\AbstractNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\File as FileNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Version; +use PHPUnitPHAR\SebastianBergmann\Environment\Runtime; +use PHPUnitPHAR\SebastianBergmann\Template\Template; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -28622,7 +31382,7 @@ abstract class Renderer $this->version = Version::id(); $this->hasBranchCoverage = $hasBranchCoverage; } - protected function renderItemTemplate(Template $template, array $data) : string + protected function renderItemTemplate(Template $template, array $data): string { $numSeparator = ' / '; if (isset($data['numClasses']) && $data['numClasses'] > 0) { @@ -28678,11 +31438,11 @@ abstract class Renderer $template->setVar(['icon' => $data['icon'] ?? '', 'crap' => $data['crap'] ?? '', 'name' => $data['name'], 'lines_bar' => $linesBar, 'lines_executed_percent' => $data['linesExecutedPercentAsString'], 'lines_level' => $linesLevel, 'lines_number' => $linesNumber, 'paths_bar' => $pathsBar, 'paths_executed_percent' => $data['pathsExecutedPercentAsString'], 'paths_level' => $pathsLevel, 'paths_number' => $pathsNumber, 'branches_bar' => $branchesBar, 'branches_executed_percent' => $data['branchesExecutedPercentAsString'], 'branches_level' => $branchesLevel, 'branches_number' => $branchesNumber, 'methods_bar' => $methodsBar, 'methods_tested_percent' => $data['testedMethodsPercentAsString'], 'methods_level' => $methodsLevel, 'methods_number' => $methodsNumber, 'classes_bar' => $classesBar, 'classes_tested_percent' => $data['testedClassesPercentAsString'] ?? '', 'classes_level' => $classesLevel, 'classes_number' => $classesNumber]); return $template->render(); } - protected function setCommonTemplateVariables(Template $template, AbstractNode $node) : void + protected function setCommonTemplateVariables(Template $template, AbstractNode $node): void { $template->setVar(['id' => $node->id(), 'full_path' => $node->pathAsString(), 'path_to_root' => $this->pathToRoot($node), 'breadcrumbs' => $this->breadcrumbs($node), 'date' => $this->date, 'version' => $this->version, 'runtime' => $this->runtimeString(), 'generator' => $this->generator, 'low_upper_bound' => $this->lowUpperBound, 'high_lower_bound' => $this->highLowerBound]); } - protected function breadcrumbs(AbstractNode $node) : string + protected function breadcrumbs(AbstractNode $node): string { $breadcrumbs = ''; $path = $node->pathAsArray(); @@ -28703,7 +31463,7 @@ abstract class Renderer } return $breadcrumbs; } - protected function activeBreadcrumb(AbstractNode $node) : string + protected function activeBreadcrumb(AbstractNode $node): string { $buffer = sprintf(' ' . "\n", $node->name()); if ($node instanceof DirectoryNode) { @@ -28711,11 +31471,11 @@ abstract class Renderer } return $buffer; } - protected function inactiveBreadcrumb(AbstractNode $node, string $pathToRoot) : string + protected function inactiveBreadcrumb(AbstractNode $node, string $pathToRoot): string { return sprintf(' ' . "\n", $pathToRoot, $node->name()); } - protected function pathToRoot(AbstractNode $node) : string + protected function pathToRoot(AbstractNode $node): string { $id = $node->id(); $depth = substr_count($id, '/'); @@ -28724,7 +31484,7 @@ abstract class Renderer } return str_repeat('../', $depth); } - protected function coverageBar(float $percent) : string + protected function coverageBar(float $percent): string { $level = $this->colorLevel($percent); $templateName = $this->templatePath . ($this->hasBranchCoverage ? 'coverage_bar_branch.html' : 'coverage_bar.html'); @@ -28732,7 +31492,7 @@ abstract class Renderer $template->setVar(['level' => $level, 'percent' => sprintf('%.2F', $percent)]); return $template->render(); } - protected function colorLevel(float $percent) : string + protected function colorLevel(float $percent): string { if ($percent <= $this->lowUpperBound) { return 'danger'; @@ -28742,7 +31502,7 @@ abstract class Renderer } return 'success'; } - private function runtimeString() : string + private function runtimeString(): string { $runtime = new Runtime(); return sprintf('%s %s', $runtime->getVendorUrl(), $runtime->getName(), $runtime->getVersion()); @@ -28759,7 +31519,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Html; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Html; use function array_values; use function arsort; @@ -28770,15 +31530,15 @@ use function floor; use function json_encode; use function sprintf; use function str_replace; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\AbstractNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; -use PHPUnit\SebastianBergmann\Template\Template; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\AbstractNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use PHPUnitPHAR\SebastianBergmann\Template\Template; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ final class Dashboard extends Renderer { - public function render(DirectoryNode $node, string $file) : void + public function render(DirectoryNode $node, string $file): void { $classes = $node->classesAndTraits(); $templateName = $this->templatePath . ($this->hasBranchCoverage ? 'dashboard_branch.html' : 'dashboard.html'); @@ -28792,14 +31552,14 @@ final class Dashboard extends Renderer $template->setVar(['insufficient_coverage_classes' => $insufficientCoverage['class'], 'insufficient_coverage_methods' => $insufficientCoverage['method'], 'project_risks_classes' => $projectRisks['class'], 'project_risks_methods' => $projectRisks['method'], 'complexity_class' => $complexity['class'], 'complexity_method' => $complexity['method'], 'class_coverage_distribution' => $coverageDistribution['class'], 'method_coverage_distribution' => $coverageDistribution['method']]); $template->renderTo($file); } - protected function activeBreadcrumb(AbstractNode $node) : string + protected function activeBreadcrumb(AbstractNode $node): string { return sprintf(' ' . "\n" . ' ' . "\n", $node->name()); } /** * Returns the data for the Class/Method Complexity charts. */ - private function complexity(array $classes, string $baseLink) : array + private function complexity(array $classes, string $baseLink): array { $result = ['class' => [], 'method' => []]; foreach ($classes as $className => $class) { @@ -28816,7 +31576,7 @@ final class Dashboard extends Renderer /** * Returns the data for the Class / Method Coverage Distribution chart. */ - private function coverageDistribution(array $classes) : array + private function coverageDistribution(array $classes): array { $result = ['class' => ['0%' => 0, '0-10%' => 0, '10-20%' => 0, '20-30%' => 0, '30-40%' => 0, '40-50%' => 0, '50-60%' => 0, '60-70%' => 0, '70-80%' => 0, '80-90%' => 0, '90-100%' => 0, '100%' => 0], 'method' => ['0%' => 0, '0-10%' => 0, '10-20%' => 0, '20-30%' => 0, '30-40%' => 0, '40-50%' => 0, '50-60%' => 0, '60-70%' => 0, '70-80%' => 0, '80-90%' => 0, '90-100%' => 0, '100%' => 0]]; foreach ($classes as $class) { @@ -28846,7 +31606,7 @@ final class Dashboard extends Renderer /** * Returns the classes / methods with insufficient coverage. */ - private function insufficientCoverage(array $classes, string $baseLink) : array + private function insufficientCoverage(array $classes, string $baseLink): array { $leastTestedClasses = []; $leastTestedMethods = []; @@ -28879,7 +31639,7 @@ final class Dashboard extends Renderer /** * Returns the project risks according to the CRAP index. */ - private function projectRisks(array $classes, string $baseLink) : array + private function projectRisks(array $classes, string $baseLink): array { $classRisks = []; $methodRisks = []; @@ -28921,20 +31681,20 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Html; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Html; use function count; use function sprintf; use function str_repeat; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\AbstractNode as Node; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; -use PHPUnit\SebastianBergmann\Template\Template; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\AbstractNode as Node; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use PHPUnitPHAR\SebastianBergmann\Template\Template; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ final class Directory extends Renderer { - public function render(DirectoryNode $node, string $file) : void + public function render(DirectoryNode $node, string $file): void { $templateName = $this->templatePath . ($this->hasBranchCoverage ? 'directory_branch.html' : 'directory.html'); $template = new Template($templateName, '{{', '}}'); @@ -28949,7 +31709,7 @@ final class Directory extends Renderer $template->setVar(['id' => $node->id(), 'items' => $items]); $template->renderTo($file); } - private function renderItem(Node $node, bool $total = \false) : string + private function renderItem(Node $node, bool $total = \false): string { $data = ['numClasses' => $node->numberOfClassesAndTraits(), 'numTestedClasses' => $node->numberOfTestedClassesAndTraits(), 'numMethods' => $node->numberOfFunctionsAndMethods(), 'numTestedMethods' => $node->numberOfTestedFunctionsAndMethods(), 'linesExecutedPercent' => $node->percentageOfExecutedLines()->asFloat(), 'linesExecutedPercentAsString' => $node->percentageOfExecutedLines()->asString(), 'numExecutedLines' => $node->numberOfExecutedLines(), 'numExecutableLines' => $node->numberOfExecutableLines(), 'branchesExecutedPercent' => $node->percentageOfExecutedBranches()->asFloat(), 'branchesExecutedPercentAsString' => $node->percentageOfExecutedBranches()->asString(), 'numExecutedBranches' => $node->numberOfExecutedBranches(), 'numExecutableBranches' => $node->numberOfExecutableBranches(), 'pathsExecutedPercent' => $node->percentageOfExecutedPaths()->asFloat(), 'pathsExecutedPercentAsString' => $node->percentageOfExecutedPaths()->asString(), 'numExecutedPaths' => $node->numberOfExecutedPaths(), 'numExecutablePaths' => $node->numberOfExecutablePaths(), 'testedMethodsPercent' => $node->percentageOfTestedFunctionsAndMethods()->asFloat(), 'testedMethodsPercentAsString' => $node->percentageOfTestedFunctionsAndMethods()->asString(), 'testedClassesPercent' => $node->percentageOfTestedClassesAndTraits()->asFloat(), 'testedClassesPercentAsString' => $node->percentageOfTestedClassesAndTraits()->asString()]; if ($total) { @@ -28981,7 +31741,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Html; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Html; use const ENT_COMPAT; use const ENT_HTML401; @@ -29074,9 +31834,9 @@ use function substr; use function token_get_all; use function trim; use PHPUnit\Runner\BaseTestRunner; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\File as FileNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Percentage; -use PHPUnit\SebastianBergmann\Template\Template; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\File as FileNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Percentage; +use PHPUnitPHAR\SebastianBergmann\Template\Template; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -29094,7 +31854,7 @@ final class File extends Renderer * @var int */ private $htmlSpecialCharsFlags = ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE; - public function render(FileNode $node, string $file) : void + public function render(FileNode $node, string $file): void { $templateName = $this->templatePath . ($this->hasBranchCoverage ? 'file_branch.html' : 'file.html'); $template = new Template($templateName, '{{', '}}'); @@ -29108,7 +31868,7 @@ final class File extends Renderer $template->renderTo($file . '_path.html'); } } - private function renderItems(FileNode $node) : string + private function renderItems(FileNode $node): string { $templateName = $this->templatePath . ($this->hasBranchCoverage ? 'file_item_branch.html' : 'file_item.html'); $template = new Template($templateName, '{{', '}}'); @@ -29120,7 +31880,7 @@ final class File extends Renderer $items .= $this->renderTraitOrClassItems($node->classes(), $template, $methodItemTemplate); return $items; } - private function renderTraitOrClassItems(array $items, Template $template, Template $methodItemTemplate) : string + private function renderTraitOrClassItems(array $items, Template $template, Template $methodItemTemplate): string { $buffer = ''; if (empty($items)) { @@ -29139,7 +31899,7 @@ final class File extends Renderer } if ($item['executableLines'] > 0) { $numClasses = 1; - $numTestedClasses = $numTestedMethods === $numMethods ? 1 : 0; + $numTestedClasses = ($numTestedMethods === $numMethods) ? 1 : 0; $linesExecutedPercentAsString = Percentage::fromFractionAndTotal($item['executedLines'], $item['executableLines'])->asString(); $branchesExecutedPercentAsString = Percentage::fromFractionAndTotal($item['executedBranches'], $item['executableBranches'])->asString(); $pathsExecutedPercentAsString = Percentage::fromFractionAndTotal($item['executedPaths'], $item['executablePaths'])->asString(); @@ -29151,7 +31911,7 @@ final class File extends Renderer $pathsExecutedPercentAsString = 'n/a'; } $testedMethodsPercentage = Percentage::fromFractionAndTotal($numTestedMethods, $numMethods); - $testedClassesPercentage = Percentage::fromFractionAndTotal($numTestedMethods === $numMethods ? 1 : 0, 1); + $testedClassesPercentage = Percentage::fromFractionAndTotal(($numTestedMethods === $numMethods) ? 1 : 0, 1); $buffer .= $this->renderItemTemplate($template, ['name' => $this->abbreviateClassName($name), 'numClasses' => $numClasses, 'numTestedClasses' => $numTestedClasses, 'numMethods' => $numMethods, 'numTestedMethods' => $numTestedMethods, 'linesExecutedPercent' => Percentage::fromFractionAndTotal($item['executedLines'], $item['executableLines'])->asFloat(), 'linesExecutedPercentAsString' => $linesExecutedPercentAsString, 'numExecutedLines' => $item['executedLines'], 'numExecutableLines' => $item['executableLines'], 'branchesExecutedPercent' => Percentage::fromFractionAndTotal($item['executedBranches'], $item['executableBranches'])->asFloat(), 'branchesExecutedPercentAsString' => $branchesExecutedPercentAsString, 'numExecutedBranches' => $item['executedBranches'], 'numExecutableBranches' => $item['executableBranches'], 'pathsExecutedPercent' => Percentage::fromFractionAndTotal($item['executedPaths'], $item['executablePaths'])->asFloat(), 'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString, 'numExecutedPaths' => $item['executedPaths'], 'numExecutablePaths' => $item['executablePaths'], 'testedMethodsPercent' => $testedMethodsPercentage->asFloat(), 'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(), 'testedClassesPercent' => $testedClassesPercentage->asFloat(), 'testedClassesPercentAsString' => $testedClassesPercentage->asString(), 'crap' => $item['crap']]); foreach ($item['methods'] as $method) { $buffer .= $this->renderFunctionOrMethodItem($methodItemTemplate, $method, ' '); @@ -29159,7 +31919,7 @@ final class File extends Renderer } return $buffer; } - private function renderFunctionItems(array $functions, Template $template) : string + private function renderFunctionItems(array $functions, Template $template): string { if (empty($functions)) { return ''; @@ -29170,7 +31930,7 @@ final class File extends Renderer } return $buffer; } - private function renderFunctionOrMethodItem(Template $template, array $item, string $indent = '') : string + private function renderFunctionOrMethodItem(Template $template, array $item, string $indent = ''): string { $numMethods = 0; $numTestedMethods = 0; @@ -29186,7 +31946,7 @@ final class File extends Renderer $testedMethodsPercentage = Percentage::fromFractionAndTotal($numTestedMethods, 1); return $this->renderItemTemplate($template, ['name' => sprintf('%s%s', $indent, $item['startLine'], htmlspecialchars($item['signature'], $this->htmlSpecialCharsFlags), $item['functionName'] ?? $item['methodName']), 'numMethods' => $numMethods, 'numTestedMethods' => $numTestedMethods, 'linesExecutedPercent' => $executedLinesPercentage->asFloat(), 'linesExecutedPercentAsString' => $executedLinesPercentage->asString(), 'numExecutedLines' => $item['executedLines'], 'numExecutableLines' => $item['executableLines'], 'branchesExecutedPercent' => $executedBranchesPercentage->asFloat(), 'branchesExecutedPercentAsString' => $executedBranchesPercentage->asString(), 'numExecutedBranches' => $item['executedBranches'], 'numExecutableBranches' => $item['executableBranches'], 'pathsExecutedPercent' => $executedPathsPercentage->asFloat(), 'pathsExecutedPercentAsString' => $executedPathsPercentage->asString(), 'numExecutedPaths' => $item['executedPaths'], 'numExecutablePaths' => $item['executablePaths'], 'testedMethodsPercent' => $testedMethodsPercentage->asFloat(), 'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(), 'crap' => $item['crap']]); } - private function renderSourceWithLineCoverage(FileNode $node) : string + private function renderSourceWithLineCoverage(FileNode $node): string { $linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}'); $singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}'); @@ -29235,7 +31995,7 @@ final class File extends Renderer $linesTemplate->setVar(['lines' => $lines]); return $linesTemplate->render(); } - private function renderSourceWithBranchCoverage(FileNode $node) : string + private function renderSourceWithBranchCoverage(FileNode $node): string { $linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}'); $singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}'); @@ -29295,7 +32055,7 @@ final class File extends Renderer $linesTemplate->setVar(['lines' => $lines]); return $linesTemplate->render(); } - private function renderSourceWithPathCoverage(FileNode $node) : string + private function renderSourceWithPathCoverage(FileNode $node): string { $linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}'); $singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}'); @@ -29358,7 +32118,7 @@ final class File extends Renderer $linesTemplate->setVar(['lines' => $lines]); return $linesTemplate->render(); } - private function renderBranchStructure(FileNode $node) : string + private function renderBranchStructure(FileNode $node): string { $branchesTemplate = new Template($this->templatePath . 'branches.html.dist', '{{', '}}'); $coverageData = $node->functionCoverageData(); @@ -29383,7 +32143,7 @@ final class File extends Renderer $branchesTemplate->setVar(['branches' => $branches]); return $branchesTemplate->render(); } - private function renderBranchLines(array $branch, array $codeLines, array $testData) : string + private function renderBranchLines(array $branch, array $codeLines, array $testData): string { $linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}'); $singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}'); @@ -29432,7 +32192,7 @@ final class File extends Renderer $linesTemplate->setVar(['lines' => $lines]); return $linesTemplate->render(); } - private function renderPathStructure(FileNode $node) : string + private function renderPathStructure(FileNode $node): string { $pathsTemplate = new Template($this->templatePath . 'paths.html.dist', '{{', '}}'); $coverageData = $node->functionCoverageData(); @@ -29460,7 +32220,7 @@ final class File extends Renderer $pathsTemplate->setVar(['paths' => $paths]); return $pathsTemplate->render(); } - private function renderPathLines(array $path, array $branches, array $codeLines, array $testData) : string + private function renderPathLines(array $path, array $branches, array $codeLines, array $testData): string { $linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}'); $singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}'); @@ -29517,12 +32277,12 @@ final class File extends Renderer $linesTemplate->setVar(['lines' => $lines]); return $linesTemplate->render(); } - private function renderLine(Template $template, int $lineNumber, string $lineContent, string $class, string $popover) : string + private function renderLine(Template $template, int $lineNumber, string $lineContent, string $class, string $popover): string { $template->setVar(['lineNumber' => $lineNumber, 'lineContent' => $lineContent, 'class' => $class, 'popover' => $popover]); return $template->render(); } - private function loadFile(string $file) : array + private function loadFile(string $file): array { if (isset(self::$formattedSourceCache[$file])) { return self::$formattedSourceCache[$file]; @@ -29579,7 +32339,7 @@ final class File extends Renderer self::$formattedSourceCache[$file] = $result; return $result; } - private function abbreviateClassName(string $className) : string + private function abbreviateClassName(string $className): string { $tmp = explode('\\', $className); if (count($tmp) > 1) { @@ -29587,7 +32347,7 @@ final class File extends Renderer } return $className; } - private function abbreviateMethodName(string $methodName) : string + private function abbreviateMethodName(string $methodName): string { $parts = explode('->', $methodName); if (count($parts) === 2) { @@ -29595,7 +32355,7 @@ final class File extends Renderer } return $methodName; } - private function createPopoverContentForTest(string $test, array $testData) : string + private function createPopoverContentForTest(string $test, array $testData): string { $testCSS = ''; if ($testData['fromTestcase']) { @@ -29627,22 +32387,22 @@ final class File extends Renderer } return sprintf('%s', $testCSS, htmlspecialchars($test, $this->htmlSpecialCharsFlags)); } - private function isComment(int $token) : bool + private function isComment(int $token): bool { return $token === T_COMMENT || $token === T_DOC_COMMENT; } - private function isInlineHtml(int $token) : bool + private function isInlineHtml(int $token): bool { return $token === T_INLINE_HTML; } - private function isKeyword(int $token) : bool + private function isKeyword(int $token): bool { return isset(self::keywordTokens()[$token]); } /** * @psalm-return array */ - private static function keywordTokens() : array + private static function keywordTokens(): array { if (self::$keywordTokens !== []) { return self::$keywordTokens; @@ -29815,7 +32575,7 @@ svg text { .scrollbox { height:245px; - overflow-x:hidden; + overflow-x:scroll; overflow-y:scroll; } @@ -30875,18 +33635,18 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report; use function dirname; use function file_put_contents; use function serialize; use function strpos; -use PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Filesystem; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Filesystem; final class PHP { - public function process(CodeCoverage $coverage, ?string $target = null) : string + public function process(CodeCoverage $coverage, ?string $target = null): string { $coverage->clearCache(); $buffer = "showUncoveredFiles = $showUncoveredFiles; $this->showOnlySummary = $showOnlySummary; } - public function process(CodeCoverage $coverage, bool $showColors = \false) : string + public function process(CodeCoverage $coverage, bool $showColors = \false): string { $hasBranchCoverage = !empty($coverage->getData(\true)->functionCoverage()); $output = PHP_EOL . PHP_EOL; @@ -31079,7 +33839,7 @@ final class Text } return $output . PHP_EOL; } - private function coverageColor(int $numberOfCoveredElements, int $totalNumberOfElements) : string + private function coverageColor(int $numberOfCoveredElements, int $totalNumberOfElements): string { $coverage = Percentage::fromFractionAndTotal($numberOfCoveredElements, $totalNumberOfElements); if ($coverage->asFloat() >= $this->highLowerBound) { @@ -31090,7 +33850,7 @@ final class Text } return self::COLOR_RED; } - private function printCoverageCounts(int $numberOfCoveredElements, int $totalNumberOfElements, int $precision) : string + private function printCoverageCounts(int $numberOfCoveredElements, int $totalNumberOfElements, int $precision): string { $format = '%' . $precision . 's'; return Percentage::fromFractionAndTotal($numberOfCoveredElements, $totalNumberOfElements)->asFixedWidthString() . ' (' . sprintf($format, $numberOfCoveredElements) . '/' . sprintf($format, $totalNumberOfElements) . ')'; @@ -31098,7 +33858,7 @@ final class Text /** * @param false|string $string */ - private function format(string $color, int $padding, $string) : string + private function format(string $color, int $padding, $string): string { $reset = $color ? self::COLOR_RESET : ''; return $color . str_pad((string) $string, $padding) . $reset . PHP_EOL; @@ -31115,13 +33875,13 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use function constant; use function phpversion; use DateTimeImmutable; use DOMElement; -use PHPUnit\SebastianBergmann\Environment\Runtime; +use PHPUnitPHAR\SebastianBergmann\Environment\Runtime; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -31135,7 +33895,7 @@ final class BuildInformation { $this->contextNode = $contextNode; } - public function setRuntimeInformation(Runtime $runtime) : void + public function setRuntimeInformation(Runtime $runtime): void { $runtimeNode = $this->nodeByName('runtime'); $runtimeNode->setAttribute('name', $runtime->getName()); @@ -31155,16 +33915,16 @@ final class BuildInformation $driverNode->setAttribute('version', phpversion('pcov')); } } - public function setBuildTime(DateTimeImmutable $date) : void + public function setBuildTime(DateTimeImmutable $date): void { $this->contextNode->setAttribute('time', $date->format('D M j G:i:s T Y')); } - public function setGeneratorVersions(string $phpUnitVersion, string $coverageVersion) : void + public function setGeneratorVersions(string $phpUnitVersion, string $coverageVersion): void { $this->contextNode->setAttribute('phpunit', $phpUnitVersion); $this->contextNode->setAttribute('coverage', $coverageVersion); } - private function nodeByName(string $name) : DOMElement + private function nodeByName(string $name): DOMElement { $node = $this->contextNode->getElementsByTagNameNS('https://schema.phpunit.de/coverage/1.0', $name)->item(0); if (!$node) { @@ -31184,10 +33944,10 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use DOMElement; -use PHPUnit\SebastianBergmann\CodeCoverage\ReportAlreadyFinalizedException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\ReportAlreadyFinalizedException; use XMLWriter; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage @@ -31217,7 +33977,7 @@ final class Coverage /** * @throws ReportAlreadyFinalizedException */ - public function addTest(string $test) : void + public function addTest(string $test): void { if ($this->finalized) { throw new ReportAlreadyFinalizedException(); @@ -31226,7 +33986,7 @@ final class Coverage $this->writer->writeAttribute('by', $test); $this->writer->endElement(); } - public function finalize() : void + public function finalize(): void { $this->writer->endElement(); $fragment = $this->contextNode->ownerDocument->createDocumentFragment(); @@ -31246,7 +34006,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage @@ -31265,7 +34025,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use const DIRECTORY_SEPARATOR; use const PHP_EOL; @@ -31285,16 +34045,16 @@ use function strlen; use function substr; use DateTimeImmutable; use DOMDocument; -use PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\PathExistsButIsNotDirectoryException; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\AbstractNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Node\File as FileNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Filesystem as DirectoryUtil; -use PHPUnit\SebastianBergmann\CodeCoverage\Version; -use PHPUnit\SebastianBergmann\CodeCoverage\XmlException; -use PHPUnit\SebastianBergmann\Environment\Runtime; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\CodeCoverage; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\PathExistsButIsNotDirectoryException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\AbstractNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Node\File as FileNode; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Filesystem as DirectoryUtil; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Version; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\XmlException; +use PHPUnitPHAR\SebastianBergmann\Environment\Runtime; final class Facade { /** @@ -31316,7 +34076,7 @@ final class Facade /** * @throws XmlException */ - public function process(CodeCoverage $coverage, string $target) : void + public function process(CodeCoverage $coverage, string $target): void { if (substr($target, -1, 1) !== DIRECTORY_SEPARATOR) { $target .= DIRECTORY_SEPARATOR; @@ -31330,7 +34090,7 @@ final class Facade $this->processDirectory($report, $this->project); $this->saveDocument($this->project->asDom(), 'index'); } - private function setBuildInformation() : void + private function setBuildInformation(): void { $buildNode = $this->project->buildInformation(); $buildNode->setRuntimeInformation(new Runtime()); @@ -31341,7 +34101,7 @@ final class Facade * @throws PathExistsButIsNotDirectoryException * @throws WriteOperationFailedException */ - private function initTargetDirectory(string $directory) : void + private function initTargetDirectory(string $directory): void { if (is_file($directory)) { if (!is_dir($directory)) { @@ -31356,7 +34116,7 @@ final class Facade /** * @throws XmlException */ - private function processDirectory(DirectoryNode $directory, Node $context) : void + private function processDirectory(DirectoryNode $directory, Node $context): void { $directoryName = $directory->name(); if ($this->project->projectSourceDirectory() === $directoryName) { @@ -31374,7 +34134,7 @@ final class Facade /** * @throws XmlException */ - private function processFile(FileNode $file, Directory $context) : void + private function processFile(FileNode $file, Directory $context): void { $fileObject = $context->addFile($file->name(), $file->id() . '.xml'); $this->setTotals($file, $fileObject->totals()); @@ -31400,7 +34160,7 @@ final class Facade $fileReport->source()->setSourceCode(file_get_contents($file->pathAsString())); $this->saveDocument($fileReport->asDom(), $file->id()); } - private function processUnit(array $unit, Report $report) : void + private function processUnit(array $unit, Report $report): void { if (isset($unit['className'])) { $unitObject = $report->classObject($unit['className']); @@ -31418,7 +34178,7 @@ final class Facade $methodObject->setTotals((string) $method['executableLines'], (string) $method['executedLines'], (string) $method['coverage']); } } - private function processFunction(array $function, Report $report) : void + private function processFunction(array $function, Report $report): void { $functionObject = $report->functionObject($function['functionName']); $functionObject->setSignature($function['signature']); @@ -31426,14 +34186,14 @@ final class Facade $functionObject->setCrap($function['crap']); $functionObject->setTotals((string) $function['executableLines'], (string) $function['executedLines'], (string) $function['coverage']); } - private function processTests(array $tests) : void + private function processTests(array $tests): void { $testsObject = $this->project->tests(); foreach ($tests as $test => $result) { $testsObject->addTest($test, $result); } } - private function setTotals(AbstractNode $node, Totals $totals) : void + private function setTotals(AbstractNode $node, Totals $totals): void { $loc = $node->linesOfCode(); $totals->setNumLines($loc['linesOfCode'], $loc['commentLinesOfCode'], $loc['nonCommentLinesOfCode'], $node->numberOfExecutableLines(), $node->numberOfExecutedLines()); @@ -31442,14 +34202,14 @@ final class Facade $totals->setNumMethods($node->numberOfMethods(), $node->numberOfTestedMethods()); $totals->setNumFunctions($node->numberOfFunctions(), $node->numberOfTestedFunctions()); } - private function targetDirectory() : string + private function targetDirectory(): string { return $this->target; } /** * @throws XmlException */ - private function saveDocument(DOMDocument $document, string $name) : void + private function saveDocument(DOMDocument $document, string $name): void { $filename = sprintf('%s/%s.xml', $this->targetDirectory(), $name); $document->formatOutput = \true; @@ -31462,7 +34222,7 @@ final class Facade * * @see https://bugs.php.net/bug.php?id=79191 */ - private function documentAsString(DOMDocument $document) : string + private function documentAsString(DOMDocument $document): string { $xmlErrorHandling = libxml_use_internal_errors(\true); $xml = $document->saveXML(); @@ -31489,7 +34249,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use DOMDocument; use DOMElement; @@ -31511,7 +34271,7 @@ class File $this->dom = $context->ownerDocument; $this->contextNode = $context; } - public function totals() : Totals + public function totals(): Totals { $totalsContainer = $this->contextNode->firstChild; if (!$totalsContainer) { @@ -31519,7 +34279,7 @@ class File } return new Totals($totalsContainer); } - public function lineCoverage(string $line) : Coverage + public function lineCoverage(string $line): Coverage { $coverage = $this->contextNode->getElementsByTagNameNS('https://schema.phpunit.de/coverage/1.0', 'coverage')->item(0); if (!$coverage) { @@ -31528,11 +34288,11 @@ class File $lineNode = $coverage->appendChild($this->dom->createElementNS('https://schema.phpunit.de/coverage/1.0', 'line')); return new Coverage($lineNode, $line); } - protected function contextNode() : DOMElement + protected function contextNode(): DOMElement { return $this->contextNode; } - protected function dom() : DOMDocument + protected function dom(): DOMDocument { return $this->dom; } @@ -31548,7 +34308,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use DOMElement; /** @@ -31565,28 +34325,28 @@ final class Method $this->contextNode = $context; $this->setName($name); } - public function setSignature(string $signature) : void + public function setSignature(string $signature): void { $this->contextNode->setAttribute('signature', $signature); } - public function setLines(string $start, ?string $end = null) : void + public function setLines(string $start, ?string $end = null): void { $this->contextNode->setAttribute('start', $start); if ($end !== null) { $this->contextNode->setAttribute('end', $end); } } - public function setTotals(string $executable, string $executed, string $coverage) : void + public function setTotals(string $executable, string $executed, string $coverage): void { $this->contextNode->setAttribute('executable', $executable); $this->contextNode->setAttribute('executed', $executed); $this->contextNode->setAttribute('coverage', $coverage); } - public function setCrap(string $crap) : void + public function setCrap(string $crap): void { $this->contextNode->setAttribute('crap', $crap); } - private function setName(string $name) : void + private function setName(string $name): void { $this->contextNode->setAttribute('name', $name); } @@ -31602,7 +34362,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use DOMDocument; use DOMElement; @@ -31623,11 +34383,11 @@ abstract class Node { $this->setContextNode($context); } - public function dom() : DOMDocument + public function dom(): DOMDocument { return $this->dom; } - public function totals() : Totals + public function totals(): Totals { $totalsContainer = $this->contextNode()->firstChild; if (!$totalsContainer) { @@ -31635,14 +34395,14 @@ abstract class Node } return new Totals($totalsContainer); } - public function addDirectory(string $name) : Directory + public function addDirectory(string $name): Directory { $dirNode = $this->dom()->createElementNS('https://schema.phpunit.de/coverage/1.0', 'directory'); $dirNode->setAttribute('name', $name); $this->contextNode()->appendChild($dirNode); return new Directory($dirNode); } - public function addFile(string $name, string $href) : File + public function addFile(string $name, string $href): File { $fileNode = $this->dom()->createElementNS('https://schema.phpunit.de/coverage/1.0', 'file'); $fileNode->setAttribute('name', $name); @@ -31650,12 +34410,12 @@ abstract class Node $this->contextNode()->appendChild($fileNode); return new File($fileNode); } - protected function setContextNode(DOMElement $context) : void + protected function setContextNode(DOMElement $context): void { $this->dom = $context->ownerDocument; $this->contextNode = $context; } - protected function contextNode() : DOMElement + protected function contextNode(): DOMElement { return $this->contextNode; } @@ -31671,7 +34431,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use DOMDocument; /** @@ -31684,11 +34444,11 @@ final class Project extends Node $this->init(); $this->setProjectSourceDirectory($directory); } - public function projectSourceDirectory() : string + public function projectSourceDirectory(): string { return $this->contextNode()->getAttribute('source'); } - public function buildInformation() : BuildInformation + public function buildInformation(): BuildInformation { $buildNode = $this->dom()->getElementsByTagNameNS('https://schema.phpunit.de/coverage/1.0', 'build')->item(0); if (!$buildNode) { @@ -31696,7 +34456,7 @@ final class Project extends Node } return new BuildInformation($buildNode); } - public function tests() : Tests + public function tests(): Tests { $testsNode = $this->contextNode()->getElementsByTagNameNS('https://schema.phpunit.de/coverage/1.0', 'tests')->item(0); if (!$testsNode) { @@ -31704,17 +34464,17 @@ final class Project extends Node } return new Tests($testsNode); } - public function asDom() : DOMDocument + public function asDom(): DOMDocument { return $this->dom(); } - private function init() : void + private function init(): void { $dom = new DOMDocument(); $dom->loadXML(''); $this->setContextNode($dom->getElementsByTagNameNS('https://schema.phpunit.de/coverage/1.0', 'project')->item(0)); } - private function setProjectSourceDirectory(string $name) : void + private function setProjectSourceDirectory(string $name): void { $this->contextNode()->setAttribute('source', $name); } @@ -31730,7 +34490,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use function basename; use function dirname; @@ -31748,24 +34508,24 @@ final class Report extends File parent::__construct($contextNode); $this->setName($name); } - public function asDom() : DOMDocument + public function asDom(): DOMDocument { return $this->dom(); } - public function functionObject($name) : Method + public function functionObject($name): Method { $node = $this->contextNode()->appendChild($this->dom()->createElementNS('https://schema.phpunit.de/coverage/1.0', 'function')); return new Method($node, $name); } - public function classObject($name) : Unit + public function classObject($name): Unit { return $this->unitObject('class', $name); } - public function traitObject($name) : Unit + public function traitObject($name): Unit { return $this->unitObject('trait', $name); } - public function source() : Source + public function source(): Source { $source = $this->contextNode()->getElementsByTagNameNS('https://schema.phpunit.de/coverage/1.0', 'source')->item(0); if (!$source) { @@ -31773,12 +34533,12 @@ final class Report extends File } return new Source($source); } - private function setName(string $name) : void + private function setName(string $name): void { $this->contextNode()->setAttribute('name', basename($name)); $this->contextNode()->setAttribute('path', dirname($name)); } - private function unitObject(string $tagName, $name) : Unit + private function unitObject(string $tagName, $name): Unit { $node = $this->contextNode()->appendChild($this->dom()->createElementNS('https://schema.phpunit.de/coverage/1.0', $tagName)); return new Unit($node, $name); @@ -31795,12 +34555,12 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use DOMElement; -use PHPUnit\TheSeer\Tokenizer\NamespaceUri; -use PHPUnit\TheSeer\Tokenizer\Tokenizer; -use PHPUnit\TheSeer\Tokenizer\XMLSerializer; +use PHPUnitPHAR\TheSeer\Tokenizer\NamespaceUri; +use PHPUnitPHAR\TheSeer\Tokenizer\Tokenizer; +use PHPUnitPHAR\TheSeer\Tokenizer\XMLSerializer; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -31812,7 +34572,7 @@ final class Source { $this->context = $context; } - public function setSourceCode(string $source) : void + public function setSourceCode(string $source): void { $context = $this->context; $tokens = (new Tokenizer())->parse($source); @@ -31831,7 +34591,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use DOMElement; /** @@ -31861,7 +34621,7 @@ final class Tests { $this->contextNode = $context; } - public function addTest(string $test, array $result) : void + public function addTest(string $test, array $result): void { $node = $this->contextNode->appendChild($this->contextNode->ownerDocument->createElementNS('https://schema.phpunit.de/coverage/1.0', 'test')); $node->setAttribute('name', $test); @@ -31881,12 +34641,12 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Report\Xml; use function sprintf; use DOMElement; use DOMNode; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Percentage; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Percentage; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -31931,42 +34691,42 @@ final class Totals $container->appendChild($this->classesNode); $container->appendChild($this->traitsNode); } - public function container() : DOMNode + public function container(): DOMNode { return $this->container; } - public function setNumLines(int $loc, int $cloc, int $ncloc, int $executable, int $executed) : void + public function setNumLines(int $loc, int $cloc, int $ncloc, int $executable, int $executed): void { $this->linesNode->setAttribute('total', (string) $loc); $this->linesNode->setAttribute('comments', (string) $cloc); $this->linesNode->setAttribute('code', (string) $ncloc); $this->linesNode->setAttribute('executable', (string) $executable); $this->linesNode->setAttribute('executed', (string) $executed); - $this->linesNode->setAttribute('percent', $executable === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($executed, $executable)->asFloat())); + $this->linesNode->setAttribute('percent', ($executable === 0) ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($executed, $executable)->asFloat())); } - public function setNumClasses(int $count, int $tested) : void + public function setNumClasses(int $count, int $tested): void { $this->classesNode->setAttribute('count', (string) $count); $this->classesNode->setAttribute('tested', (string) $tested); - $this->classesNode->setAttribute('percent', $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())); + $this->classesNode->setAttribute('percent', ($count === 0) ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())); } - public function setNumTraits(int $count, int $tested) : void + public function setNumTraits(int $count, int $tested): void { $this->traitsNode->setAttribute('count', (string) $count); $this->traitsNode->setAttribute('tested', (string) $tested); - $this->traitsNode->setAttribute('percent', $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())); + $this->traitsNode->setAttribute('percent', ($count === 0) ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())); } - public function setNumMethods(int $count, int $tested) : void + public function setNumMethods(int $count, int $tested): void { $this->methodsNode->setAttribute('count', (string) $count); $this->methodsNode->setAttribute('tested', (string) $tested); - $this->methodsNode->setAttribute('percent', $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())); + $this->methodsNode->setAttribute('percent', ($count === 0) ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())); } - public function setNumFunctions(int $count, int $tested) : void + public function setNumFunctions(int $count, int $tested): void { $this->functionsNode->setAttribute('count', (string) $count); $this->functionsNode->setAttribute('tested', (string) $tested); - $this->functionsNode->setAttribute('percent', $count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())); + $this->functionsNode->setAttribute('percent', ($count === 0) ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())); } } contextNode = $context; $this->setName($name); } - public function setLines(int $start, int $executable, int $executed) : void + public function setLines(int $start, int $executable, int $executed): void { $this->contextNode->setAttribute('start', (string) $start); $this->contextNode->setAttribute('executable', (string) $executable); $this->contextNode->setAttribute('executed', (string) $executed); } - public function setCrap(float $crap) : void + public function setCrap(float $crap): void { $this->contextNode->setAttribute('crap', (string) $crap); } - public function setNamespace(string $namespace) : void + public function setNamespace(string $namespace): void { $node = $this->contextNode->getElementsByTagNameNS('https://schema.phpunit.de/coverage/1.0', 'namespace')->item(0); if (!$node) { @@ -32015,12 +34775,12 @@ final class Unit } $node->setAttribute('name', $namespace); } - public function addMethod(string $name) : Method + public function addMethod(string $name): Method { $node = $this->contextNode->appendChild($this->contextNode->ownerDocument->createElementNS('https://schema.phpunit.de/coverage/1.0', 'method')); return new Method($node, $name); } - private function setName(string $name) : void + private function setName(string $name): void { $this->contextNode->setAttribute('name', $name); } @@ -32036,12 +34796,12 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\StaticAnalysis; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\StaticAnalysis; -use PHPUnit\SebastianBergmann\CodeCoverage\Filter; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Filter; final class CacheWarmer { - public function warmCache(string $cacheDirectory, bool $useAnnotationsForIgnoringCode, bool $ignoreDeprecatedCode, Filter $filter) : void + public function warmCache(string $cacheDirectory, bool $useAnnotationsForIgnoringCode, bool $ignoreDeprecatedCode, Filter $filter): void { $analyser = new CachingFileAnalyser($cacheDirectory, new ParsingFileAnalyser($useAnnotationsForIgnoringCode, $ignoreDeprecatedCode), $useAnnotationsForIgnoringCode, $ignoreDeprecatedCode); foreach ($filter->files() as $file) { @@ -32060,7 +34820,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\StaticAnalysis; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\StaticAnalysis; use function file_get_contents; use function file_put_contents; @@ -32069,8 +34829,8 @@ use function is_file; use function md5; use function serialize; use function unserialize; -use PHPUnit\SebastianBergmann\CodeCoverage\Util\Filesystem; -use PHPUnit\SebastianBergmann\FileIterator\Facade as FileIteratorFacade; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util\Filesystem; +use PHPUnitPHAR\SebastianBergmann\FileIterator\Facade as FileIteratorFacade; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -32108,21 +34868,21 @@ final class CachingFileAnalyser implements FileAnalyser $this->useAnnotationsForIgnoringCode = $useAnnotationsForIgnoringCode; $this->ignoreDeprecatedCode = $ignoreDeprecatedCode; } - public function classesIn(string $filename) : array + public function classesIn(string $filename): array { if (!isset($this->cache[$filename])) { $this->process($filename); } return $this->cache[$filename]['classesIn']; } - public function traitsIn(string $filename) : array + public function traitsIn(string $filename): array { if (!isset($this->cache[$filename])) { $this->process($filename); } return $this->cache[$filename]['traitsIn']; } - public function functionsIn(string $filename) : array + public function functionsIn(string $filename): array { if (!isset($this->cache[$filename])) { $this->process($filename); @@ -32132,28 +34892,28 @@ final class CachingFileAnalyser implements FileAnalyser /** * @psalm-return array{linesOfCode: int, commentLinesOfCode: int, nonCommentLinesOfCode: int} */ - public function linesOfCodeFor(string $filename) : array + public function linesOfCodeFor(string $filename): array { if (!isset($this->cache[$filename])) { $this->process($filename); } return $this->cache[$filename]['linesOfCodeFor']; } - public function executableLinesIn(string $filename) : array + public function executableLinesIn(string $filename): array { if (!isset($this->cache[$filename])) { $this->process($filename); } return $this->cache[$filename]['executableLinesIn']; } - public function ignoredLinesFor(string $filename) : array + public function ignoredLinesFor(string $filename): array { if (!isset($this->cache[$filename])) { $this->process($filename); } return $this->cache[$filename]['ignoredLinesFor']; } - public function process(string $filename) : void + public function process(string $filename): void { $cache = $this->read($filename); if ($cache !== \false) { @@ -32177,16 +34937,16 @@ final class CachingFileAnalyser implements FileAnalyser /** * @param mixed $data */ - private function write(string $filename, $data) : void + private function write(string $filename, $data): void { file_put_contents($this->cacheFile($filename), serialize($data)); } - private function cacheFile(string $filename) : string + private function cacheFile(string $filename): string { $cacheKey = md5(implode("\x00", [$filename, file_get_contents($filename), self::cacheVersion(), $this->useAnnotationsForIgnoringCode, $this->ignoreDeprecatedCode])); return $this->directory . \DIRECTORY_SEPARATOR . $cacheKey; } - private static function cacheVersion() : string + private static function cacheVersion(): string { if (self::$cacheVersion !== null) { return self::$cacheVersion; @@ -32211,29 +34971,29 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\StaticAnalysis; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\StaticAnalysis; use function assert; use function implode; use function rtrim; use function trim; -use PHPUnit\PhpParser\Node; -use PHPUnit\PhpParser\Node\ComplexType; -use PHPUnit\PhpParser\Node\Identifier; -use PHPUnit\PhpParser\Node\IntersectionType; -use PHPUnit\PhpParser\Node\Name; -use PHPUnit\PhpParser\Node\NullableType; -use PHPUnit\PhpParser\Node\Stmt\Class_; -use PHPUnit\PhpParser\Node\Stmt\ClassMethod; -use PHPUnit\PhpParser\Node\Stmt\Enum_; -use PHPUnit\PhpParser\Node\Stmt\Function_; -use PHPUnit\PhpParser\Node\Stmt\Interface_; -use PHPUnit\PhpParser\Node\Stmt\Trait_; -use PHPUnit\PhpParser\Node\UnionType; -use PHPUnit\PhpParser\NodeAbstract; -use PHPUnit\PhpParser\NodeTraverser; -use PHPUnit\PhpParser\NodeVisitorAbstract; -use PHPUnit\SebastianBergmann\Complexity\CyclomaticComplexityCalculatingVisitor; +use PHPUnitPHAR\PhpParser\Node; +use PHPUnitPHAR\PhpParser\Node\ComplexType; +use PHPUnitPHAR\PhpParser\Node\Identifier; +use PHPUnitPHAR\PhpParser\Node\IntersectionType; +use PHPUnitPHAR\PhpParser\Node\Name; +use PHPUnitPHAR\PhpParser\Node\NullableType; +use PHPUnitPHAR\PhpParser\Node\Stmt\Class_; +use PHPUnitPHAR\PhpParser\Node\Stmt\ClassMethod; +use PHPUnitPHAR\PhpParser\Node\Stmt\Enum_; +use PHPUnitPHAR\PhpParser\Node\Stmt\Function_; +use PHPUnitPHAR\PhpParser\Node\Stmt\Interface_; +use PHPUnitPHAR\PhpParser\Node\Stmt\Trait_; +use PHPUnitPHAR\PhpParser\Node\UnionType; +use PHPUnitPHAR\PhpParser\NodeAbstract; +use PHPUnitPHAR\PhpParser\NodeTraverser; +use PHPUnitPHAR\PhpParser\NodeVisitorAbstract; +use PHPUnitPHAR\SebastianBergmann\Complexity\CyclomaticComplexityCalculatingVisitor; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -32251,7 +35011,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract * @psalm-var array */ private $functions = []; - public function enterNode(Node $node) : void + public function enterNode(Node $node): void { if ($node instanceof Class_) { if ($node->isAnonymous()) { @@ -32278,28 +35038,28 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract /** * @psalm-return array}> */ - public function classes() : array + public function classes(): array { return $this->classes; } /** * @psalm-return array}> */ - public function traits() : array + public function traits(): array { return $this->traits; } /** * @psalm-return array */ - public function functions() : array + public function functions(): array { return $this->functions; } /** * @psalm-param ClassMethod|Function_ $node */ - private function cyclomaticComplexity(Node $node) : int + private function cyclomaticComplexity(Node $node): int { assert($node instanceof ClassMethod || $node instanceof Function_); $nodes = $node->getStmts(); @@ -32316,7 +35076,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract /** * @psalm-param ClassMethod|Function_ $node */ - private function signature(Node $node) : string + private function signature(Node $node): string { assert($node instanceof ClassMethod || $node instanceof Function_); $signature = ($node->returnsByRef() ? '&' : '') . $node->name->toString() . '('; @@ -32341,7 +35101,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract /** * @psalm-param Identifier|Name|ComplexType $type */ - private function type(Node $type) : string + private function type(Node $type): string { assert($type instanceof Identifier || $type instanceof Name || $type instanceof ComplexType); if ($type instanceof NullableType) { @@ -32355,7 +35115,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract } return $type->toString(); } - private function visibility(ClassMethod $node) : string + private function visibility(ClassMethod $node): string { if ($node->isPrivate()) { return 'private'; @@ -32365,19 +35125,19 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract } return 'public'; } - private function processClass(Class_ $node) : void + private function processClass(Class_ $node): void { $name = $node->name->toString(); $namespacedName = $node->namespacedName->toString(); $this->classes[$namespacedName] = ['name' => $name, 'namespacedName' => $namespacedName, 'namespace' => $this->namespace($namespacedName, $name), 'startLine' => $node->getStartLine(), 'endLine' => $node->getEndLine(), 'methods' => []]; } - private function processTrait(Trait_ $node) : void + private function processTrait(Trait_ $node): void { $name = $node->name->toString(); $namespacedName = $node->namespacedName->toString(); $this->traits[$namespacedName] = ['name' => $name, 'namespacedName' => $namespacedName, 'namespace' => $this->namespace($namespacedName, $name), 'startLine' => $node->getStartLine(), 'endLine' => $node->getEndLine(), 'methods' => []]; } - private function processMethod(ClassMethod $node) : void + private function processMethod(ClassMethod $node): void { $parentNode = $node->getAttribute('parent'); if ($parentNode instanceof Interface_) { @@ -32399,7 +35159,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract } $storage[$parentNamespacedName]['methods'][$node->name->toString()] = ['methodName' => $node->name->toString(), 'signature' => $this->signature($node), 'visibility' => $this->visibility($node), 'startLine' => $node->getStartLine(), 'endLine' => $node->getEndLine(), 'ccn' => $this->cyclomaticComplexity($node)]; } - private function processFunction(Function_ $node) : void + private function processFunction(Function_ $node): void { assert(isset($node->name)); assert(isset($node->namespacedName)); @@ -32408,11 +35168,11 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract $namespacedName = $node->namespacedName->toString(); $this->functions[$namespacedName] = ['name' => $name, 'namespacedName' => $namespacedName, 'namespace' => $this->namespace($namespacedName, $name), 'signature' => $this->signature($node), 'startLine' => $node->getStartLine(), 'endLine' => $node->getEndLine(), 'ccn' => $this->cyclomaticComplexity($node)]; } - private function namespace(string $namespacedName, string $name) : string + private function namespace(string $namespacedName, string $name): string { return trim(rtrim($namespacedName, $name), '\\'); } - private function unionTypeAsString(UnionType $node) : string + private function unionTypeAsString(UnionType $node): string { $types = []; foreach ($node->types as $type) { @@ -32424,7 +35184,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract } return implode('|', $types); } - private function intersectionTypeAsString(IntersectionType $node) : string + private function intersectionTypeAsString(IntersectionType $node): string { $types = []; foreach ($node->types as $type) { @@ -32435,7 +35195,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract /** * @psalm-param Identifier|Name $node $node */ - private function typeAsString(NodeAbstract $node) : string + private function typeAsString(NodeAbstract $node): string { if ($node instanceof Name) { return $node->toCodeString(); @@ -32454,7 +35214,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\StaticAnalysis; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\StaticAnalysis; use function array_diff_key; use function assert; @@ -32468,8 +35228,8 @@ use function preg_quote; use function range; use function reset; use function sprintf; -use PHPUnit\PhpParser\Node; -use PHPUnit\PhpParser\NodeVisitorAbstract; +use PHPUnitPHAR\PhpParser\Node; +use PHPUnitPHAR\PhpParser\NodeVisitorAbstract; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -32499,7 +35259,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract { $this->source = $source; } - public function enterNode(Node $node) : void + public function enterNode(Node $node): void { foreach ($node->getComments() as $comment) { $commentLine = $comment->getStartLine(); @@ -32527,13 +35287,26 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract } return; } - if ($node instanceof Node\Stmt\Declare_ || $node instanceof Node\Stmt\DeclareDeclare || $node instanceof Node\Stmt\Else_ || $node instanceof Node\Stmt\EnumCase || $node instanceof Node\Stmt\Finally_ || $node instanceof Node\Stmt\GroupUse || $node instanceof Node\Stmt\Label || $node instanceof Node\Stmt\Namespace_ || $node instanceof Node\Stmt\Nop || $node instanceof Node\Stmt\Switch_ || $node instanceof Node\Stmt\TryCatch || $node instanceof Node\Stmt\Use_ || $node instanceof Node\Stmt\UseUse || $node instanceof Node\Expr\ConstFetch || $node instanceof Node\Expr\Match_ || $node instanceof Node\Expr\Variable || $node instanceof Node\ComplexType || $node instanceof Node\Const_ || $node instanceof Node\Identifier || $node instanceof Node\Name || $node instanceof Node\Param || $node instanceof Node\Scalar) { + if ($node instanceof Node\Stmt\Declare_ || $node instanceof Node\Stmt\DeclareDeclare || $node instanceof Node\Stmt\Else_ || $node instanceof Node\Stmt\EnumCase || $node instanceof Node\Stmt\Finally_ || $node instanceof Node\Stmt\GroupUse || $node instanceof Node\Stmt\Label || $node instanceof Node\Stmt\Namespace_ || $node instanceof Node\Stmt\Nop || $node instanceof Node\Stmt\Switch_ || $node instanceof Node\Stmt\TryCatch || $node instanceof Node\Stmt\Use_ || $node instanceof Node\Stmt\UseUse || $node instanceof Node\Expr\ConstFetch || $node instanceof Node\Expr\Match_ || $node instanceof Node\Expr\Variable || $node instanceof Node\Expr\Throw_ || $node instanceof Node\ComplexType || $node instanceof Node\Const_ || $node instanceof Node\Identifier || $node instanceof Node\Name || $node instanceof Node\Param || $node instanceof Node\Scalar) { return; } + /* + * nikic/php-parser ^4.18 represents throw statements + * as Stmt\Throw_ objects + */ if ($node instanceof Node\Stmt\Throw_) { $this->setLineBranch($node->expr->getEndLine(), $node->expr->getEndLine(), ++$this->nextBranch); return; } + /* + * nikic/php-parser ^5 represents throw statements + * as Stmt\Expression objects that contain an + * Expr\Throw_ object + */ + if ($node instanceof Node\Stmt\Expression && $node->expr instanceof Node\Expr\Throw_) { + $this->setLineBranch($node->expr->expr->getEndLine(), $node->expr->expr->getEndLine(), ++$this->nextBranch); + return; + } if ($node instanceof Node\Stmt\Enum_ || $node instanceof Node\Stmt\Function_ || $node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\ClassMethod || $node instanceof Node\Expr\Closure || $node instanceof Node\Stmt\Trait_) { $isConcreteClassLike = $node instanceof Node\Stmt\Enum_ || $node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Trait_; if (null !== $node->stmts) { @@ -32654,22 +35427,22 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract } $this->setLineBranch($node->getStartLine(), $node->getEndLine(), ++$this->nextBranch); } - public function afterTraverse(array $nodes) : void + public function afterTraverse(array $nodes): void { $lines = explode("\n", $this->source); foreach ($lines as $lineNumber => $line) { $lineNumber++; - if (1 === preg_match('/^\\s*$/', $line) || isset($this->commentsToCheckForUnset[$lineNumber]) && 1 === preg_match(sprintf('/^\\s*%s\\s*$/', preg_quote($this->commentsToCheckForUnset[$lineNumber], '/')), $line)) { + if (1 === preg_match('/^\s*$/', $line) || isset($this->commentsToCheckForUnset[$lineNumber]) && 1 === preg_match(sprintf('/^\s*%s\s*$/', preg_quote($this->commentsToCheckForUnset[$lineNumber], '/')), $line)) { unset($this->executableLinesGroupedByBranch[$lineNumber]); } } $this->executableLinesGroupedByBranch = array_diff_key($this->executableLinesGroupedByBranch, $this->unsets); } - public function executableLinesGroupedByBranch() : array + public function executableLinesGroupedByBranch(): array { return $this->executableLinesGroupedByBranch; } - private function setLineBranch(int $start, int $end, int $branch) : void + private function setLineBranch(int $start, int $end, int $branch): void { foreach (range($start, $end) as $line) { $this->executableLinesGroupedByBranch[$line] = $branch; @@ -32687,22 +35460,22 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\StaticAnalysis; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\StaticAnalysis; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ interface FileAnalyser { - public function classesIn(string $filename) : array; - public function traitsIn(string $filename) : array; - public function functionsIn(string $filename) : array; + public function classesIn(string $filename): array; + public function traitsIn(string $filename): array; + public function functionsIn(string $filename): array; /** * @psalm-return array{linesOfCode: int, commentLinesOfCode: int, nonCommentLinesOfCode: int} */ - public function linesOfCodeFor(string $filename) : array; - public function executableLinesIn(string $filename) : array; - public function ignoredLinesFor(string $filename) : array; + public function linesOfCodeFor(string $filename): array; + public function executableLinesIn(string $filename): array; + public function ignoredLinesFor(string $filename): array; } useAnnotationsForIgnoringCode = $useAnnotationsForIgnoringCode; $this->ignoreDeprecated = $ignoreDeprecated; } - public function enterNode(Node $node) : void + public function enterNode(Node $node): void { if (!$node instanceof Class_ && !$node instanceof Trait_ && !$node instanceof Interface_ && !$node instanceof ClassMethod && !$node instanceof Function_ && !$node instanceof Attribute) { return; @@ -32776,11 +35549,11 @@ final class IgnoredLinesFindingVisitor extends NodeVisitorAbstract /** * @psalm-return list */ - public function ignoredLines() : array + public function ignoredLines(): array { return $this->ignoredLines; } - private function processDocComment(Node $node) : void + private function processDocComment(Node $node): void { $docComment = $node->getDocComment(); if ($docComment === null) { @@ -32805,7 +35578,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\StaticAnalysis; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\StaticAnalysis; use function array_merge; use function array_unique; @@ -32819,14 +35592,13 @@ use function sprintf; use function substr_count; use function token_get_all; use function trim; -use PHPUnit\PhpParser\Error; -use PHPUnit\PhpParser\Lexer; -use PHPUnit\PhpParser\NodeTraverser; -use PHPUnit\PhpParser\NodeVisitor\NameResolver; -use PHPUnit\PhpParser\NodeVisitor\ParentConnectingVisitor; -use PHPUnit\PhpParser\ParserFactory; -use PHPUnit\SebastianBergmann\CodeCoverage\ParserException; -use PHPUnit\SebastianBergmann\LinesOfCode\LineCountingVisitor; +use PHPUnitPHAR\PhpParser\Error; +use PHPUnitPHAR\PhpParser\NodeTraverser; +use PHPUnitPHAR\PhpParser\NodeVisitor\NameResolver; +use PHPUnitPHAR\PhpParser\NodeVisitor\ParentConnectingVisitor; +use PHPUnitPHAR\PhpParser\ParserFactory; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\ParserException; +use PHPUnitPHAR\SebastianBergmann\LinesOfCode\LineCountingVisitor; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage */ @@ -32869,17 +35641,17 @@ final class ParsingFileAnalyser implements FileAnalyser $this->useAnnotationsForIgnoringCode = $useAnnotationsForIgnoringCode; $this->ignoreDeprecatedCode = $ignoreDeprecatedCode; } - public function classesIn(string $filename) : array + public function classesIn(string $filename): array { $this->analyse($filename); return $this->classes[$filename]; } - public function traitsIn(string $filename) : array + public function traitsIn(string $filename): array { $this->analyse($filename); return $this->traits[$filename]; } - public function functionsIn(string $filename) : array + public function functionsIn(string $filename): array { $this->analyse($filename); return $this->functions[$filename]; @@ -32887,17 +35659,17 @@ final class ParsingFileAnalyser implements FileAnalyser /** * @psalm-return array{linesOfCode: int, commentLinesOfCode: int, nonCommentLinesOfCode: int} */ - public function linesOfCodeFor(string $filename) : array + public function linesOfCodeFor(string $filename): array { $this->analyse($filename); return $this->linesOfCode[$filename]; } - public function executableLinesIn(string $filename) : array + public function executableLinesIn(string $filename): array { $this->analyse($filename); return $this->executableLines[$filename]; } - public function ignoredLinesFor(string $filename) : array + public function ignoredLinesFor(string $filename): array { $this->analyse($filename); return $this->ignoredLines[$filename]; @@ -32905,7 +35677,7 @@ final class ParsingFileAnalyser implements FileAnalyser /** * @throws ParserException */ - private function analyse(string $filename) : void + private function analyse(string $filename): void { if (isset($this->classes[$filename])) { return; @@ -32915,7 +35687,7 @@ final class ParsingFileAnalyser implements FileAnalyser if ($linesOfCode === 0 && !empty($source)) { $linesOfCode = 1; } - $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer()); + $parser = (new ParserFactory())->createForHostVersion(); try { $nodes = $parser->parse($source); assert($nodes !== null); @@ -32948,7 +35720,7 @@ final class ParsingFileAnalyser implements FileAnalyser $result = $lineCountingVisitor->result(); $this->linesOfCode[$filename] = ['linesOfCode' => $result->linesOfCode(), 'commentLinesOfCode' => $result->commentLinesOfCode(), 'nonCommentLinesOfCode' => $result->nonCommentLinesOfCode()]; } - private function findLinesIgnoredByLineBasedAnnotations(string $filename, string $source, bool $useAnnotationsForIgnoringCode) : void + private function findLinesIgnoredByLineBasedAnnotations(string $filename, string $source, bool $useAnnotationsForIgnoringCode): void { if (!$useAnnotationsForIgnoringCode) { return; @@ -32987,7 +35759,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Util; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util; use function is_dir; use function mkdir; @@ -33000,7 +35772,7 @@ final class Filesystem /** * @throws DirectoryCouldNotBeCreatedException */ - public static function createDirectory(string $directory) : void + public static function createDirectory(string $directory): void { $success = !(!is_dir($directory) && !@mkdir($directory, 0777, \true) && !is_dir($directory)); if (!$success) { @@ -33019,7 +35791,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage\Util; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage\Util; use function sprintf; /** @@ -33035,7 +35807,7 @@ final class Percentage * @var float */ private $total; - public static function fromFractionAndTotal(float $fraction, float $total) : self + public static function fromFractionAndTotal(float $fraction, float $total): self { return new self($fraction, $total); } @@ -33044,21 +35816,21 @@ final class Percentage $this->fraction = $fraction; $this->total = $total; } - public function asFloat() : float + public function asFloat(): float { if ($this->total > 0) { return $this->fraction / $this->total * 100; } return 100.0; } - public function asString() : string + public function asString(): string { if ($this->total > 0) { return sprintf('%01.2F%%', $this->asFloat()); } return ''; } - public function asFixedWidthString() : string + public function asFixedWidthString(): string { if ($this->total > 0) { return sprintf('%6.2F%%', $this->asFloat()); @@ -33077,20 +35849,20 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeCoverage; +namespace PHPUnitPHAR\SebastianBergmann\CodeCoverage; use function dirname; -use PHPUnit\SebastianBergmann\Version as VersionId; +use PHPUnitPHAR\SebastianBergmann\Version as VersionId; final class Version { /** * @var string */ private static $version; - public static function id() : string + public static function id(): string { if (self::$version === null) { - self::$version = (new VersionId('9.2.29', dirname(__DIR__)))->getVersion(); + self::$version = (new VersionId('9.2.31', dirname(__DIR__)))->getVersion(); } return self::$version; } @@ -33106,7 +35878,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\FileIterator; +namespace PHPUnitPHAR\SebastianBergmann\FileIterator; use const DIRECTORY_SEPARATOR; use function array_unique; @@ -33124,7 +35896,7 @@ class Facade * @param array|string $suffixes * @param array|string $prefixes */ - public function getFilesAsArray($paths, $suffixes = '', $prefixes = '', array $exclude = [], bool $commonPath = \false) : array + public function getFilesAsArray($paths, $suffixes = '', $prefixes = '', array $exclude = [], bool $commonPath = \false): array { if (is_string($paths)) { $paths = [$paths]; @@ -33149,7 +35921,7 @@ class Facade } return $files; } - protected function getCommonPath(array $files) : string + protected function getCommonPath(array $files): string { $count = count($files); if ($count === 0) { @@ -33198,7 +35970,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\FileIterator; +namespace PHPUnitPHAR\SebastianBergmann\FileIterator; use const GLOB_ONLYDIR; use function array_filter; @@ -33218,7 +35990,7 @@ class Factory * @param array|string $suffixes * @param array|string $prefixes */ - public function getFileIterator($paths, $suffixes = '', $prefixes = '', array $exclude = []) : AppendIterator + public function getFileIterator($paths, $suffixes = '', $prefixes = '', array $exclude = []): AppendIterator { if (is_string($paths)) { $paths = [$paths]; @@ -33247,12 +36019,12 @@ class Factory } return $iterator; } - protected function getPathsAfterResolvingWildcards(array $paths) : array + protected function getPathsAfterResolvingWildcards(array $paths): array { $_paths = [[]]; foreach ($paths as $path) { if ($locals = glob($path, GLOB_ONLYDIR)) { - $_paths[] = array_map('\\realpath', $locals); + $_paths[] = array_map('\realpath', $locals); } else { $_paths[] = [realpath($path)]; } @@ -33271,7 +36043,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\FileIterator; +namespace PHPUnitPHAR\SebastianBergmann\FileIterator; use function array_filter; use function array_map; @@ -33310,7 +36082,7 @@ class Iterator extends FilterIterator $this->exclude = array_filter(array_map('realpath', $exclude)); parent::__construct($iterator); } - public function accept() : bool + public function accept(): bool { $current = $this->getInnerIterator()->current(); $filename = $current->getFilename(); @@ -33320,10 +36092,10 @@ class Iterator extends FilterIterator } return $this->acceptPath($realPath) && $this->acceptPrefix($filename) && $this->acceptSuffix($filename); } - private function acceptPath(string $path) : bool + private function acceptPath(string $path): bool { // Filter files in hidden directories by checking path that is relative to the base path. - if (preg_match('=/\\.[^/]*/=', str_replace($this->basePath, '', $path))) { + if (preg_match('=/\.[^/]*/=', str_replace($this->basePath, '', $path))) { return \false; } foreach ($this->exclude as $exclude) { @@ -33333,15 +36105,15 @@ class Iterator extends FilterIterator } return \true; } - private function acceptPrefix(string $filename) : bool + private function acceptPrefix(string $filename): bool { return $this->acceptSubString($filename, $this->prefixes, self::PREFIX); } - private function acceptSuffix(string $filename) : bool + private function acceptSuffix(string $filename): bool { return $this->acceptSubString($filename, $this->suffixes, self::SUFFIX); } - private function acceptSubString(string $filename, array $subStrings, int $type) : bool + private function acceptSubString(string $filename, array $subStrings, int $type): bool { if (empty($subStrings)) { return \true; @@ -33400,7 +36172,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Invoker; +namespace PHPUnitPHAR\SebastianBergmann\Invoker; use const SIGALRM; use function call_user_func_array; @@ -33424,8 +36196,8 @@ final class Invoker if (!$this->canInvokeWithTimeout()) { throw new ProcessControlExtensionNotLoadedException('The pcntl (process control) extension for PHP is required'); } - pcntl_signal(SIGALRM, function () : void { - throw new TimeoutException(sprintf('Execution aborted after %d second%s', $this->timeout, $this->timeout === 1 ? '' : 's')); + pcntl_signal(SIGALRM, function (): void { + throw new TimeoutException(sprintf('Execution aborted after %d second%s', $this->timeout, ($this->timeout === 1) ? '' : 's')); }, \true); $this->timeout = $timeout; pcntl_async_signals(\true); @@ -33436,7 +36208,7 @@ final class Invoker pcntl_alarm(0); } } - public function canInvokeWithTimeout() : bool + public function canInvokeWithTimeout(): bool { return function_exists('pcntl_signal') && function_exists('pcntl_async_signals') && function_exists('pcntl_alarm'); } @@ -33452,7 +36224,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Invoker; +namespace PHPUnitPHAR\SebastianBergmann\Invoker; use Throwable; interface Exception extends Throwable @@ -33469,7 +36241,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Invoker; +namespace PHPUnitPHAR\SebastianBergmann\Invoker; use RuntimeException; final class ProcessControlExtensionNotLoadedException extends RuntimeException implements Exception @@ -33486,7 +36258,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Invoker; +namespace PHPUnitPHAR\SebastianBergmann\Invoker; use RuntimeException; final class TimeoutException extends RuntimeException implements Exception @@ -33536,7 +36308,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Template; +namespace PHPUnitPHAR\SebastianBergmann\Template; use function array_merge; use function file_exists; @@ -33574,7 +36346,7 @@ final class Template /** * @throws InvalidArgumentException */ - public function setFile(string $file) : void + public function setFile(string $file): void { $distFile = $file . '.dist'; if (file_exists($file)) { @@ -33585,7 +36357,7 @@ final class Template throw new InvalidArgumentException(sprintf('Failed to load template "%s"', $file)); } } - public function setVar(array $values, bool $merge = \true) : void + public function setVar(array $values, bool $merge = \true): void { if (!$merge || empty($this->values)) { $this->values = $values; @@ -33593,7 +36365,7 @@ final class Template $this->values = array_merge($this->values, $values); } } - public function render() : string + public function render(): string { $keys = []; foreach ($this->values as $key => $value) { @@ -33604,7 +36376,7 @@ final class Template /** * @codeCoverageIgnore */ - public function renderTo(string $target) : void + public function renderTo(string $target): void { if (!file_put_contents($target, $this->render())) { throw new RuntimeException(sprintf('Writing rendered result to "%s" failed', $target)); @@ -33622,7 +36394,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Template; +namespace PHPUnitPHAR\SebastianBergmann\Template; use Throwable; interface Exception extends Throwable @@ -33639,7 +36411,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Template; +namespace PHPUnitPHAR\SebastianBergmann\Template; final class InvalidArgumentException extends \InvalidArgumentException implements Exception { @@ -33655,7 +36427,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Template; +namespace PHPUnitPHAR\SebastianBergmann\Template; use InvalidArgumentException; final class RuntimeException extends InvalidArgumentException implements Exception @@ -33672,7 +36444,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Timer; +namespace PHPUnitPHAR\SebastianBergmann\Timer; use function floor; use function sprintf; @@ -33701,11 +36473,11 @@ final class Duration * @var int */ private $milliseconds; - public static function fromMicroseconds(float $microseconds) : self + public static function fromMicroseconds(float $microseconds): self { return new self($microseconds * 1000); } - public static function fromNanoseconds(float $nanoseconds) : self + public static function fromNanoseconds(float $nanoseconds): self { return new self($nanoseconds); } @@ -33725,23 +36497,23 @@ final class Duration $this->seconds = (int) $seconds; $this->milliseconds = (int) $milliseconds; } - public function asNanoseconds() : float + public function asNanoseconds(): float { return $this->nanoseconds; } - public function asMicroseconds() : float + public function asMicroseconds(): float { return $this->nanoseconds / 1000; } - public function asMilliseconds() : float + public function asMilliseconds(): float { return $this->nanoseconds / 1000000; } - public function asSeconds() : float + public function asSeconds(): float { return $this->nanoseconds / 1000000000; } - public function asString() : string + public function asString(): string { $result = ''; if ($this->hours > 0) { @@ -33799,7 +36571,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Timer; +namespace PHPUnitPHAR\SebastianBergmann\Timer; use function is_float; use function memory_get_peak_usage; @@ -33811,14 +36583,14 @@ final class ResourceUsageFormatter * @psalm-var array */ private const SIZES = ['GB' => 1073741824, 'MB' => 1048576, 'KB' => 1024]; - public function resourceUsage(Duration $duration) : string + public function resourceUsage(Duration $duration): string { return sprintf('Time: %s, Memory: %s', $duration->asString(), $this->bytesToString(memory_get_peak_usage(\true))); } /** * @throws TimeSinceStartOfRequestNotAvailableException */ - public function resourceUsageSinceStartOfRequest() : string + public function resourceUsageSinceStartOfRequest(): string { if (!isset($_SERVER['REQUEST_TIME_FLOAT'])) { throw new TimeSinceStartOfRequestNotAvailableException('Cannot determine time at which the request started because $_SERVER[\'REQUEST_TIME_FLOAT\'] is not available'); @@ -33828,15 +36600,15 @@ final class ResourceUsageFormatter } return $this->resourceUsage(Duration::fromMicroseconds(1000000 * (microtime(\true) - $_SERVER['REQUEST_TIME_FLOAT']))); } - private function bytesToString(int $bytes) : string + private function bytesToString(int $bytes): string { foreach (self::SIZES as $unit => $value) { if ($bytes >= $value) { - return sprintf('%.2f %s', $bytes >= 1024 ? $bytes / $value : $bytes, $unit); + return sprintf('%.2f %s', ($bytes >= 1024) ? $bytes / $value : $bytes, $unit); } } // @codeCoverageIgnoreStart - return $bytes . ' byte' . ($bytes !== 1 ? 's' : ''); + return $bytes . ' byte' . (($bytes !== 1) ? 's' : ''); // @codeCoverageIgnoreEnd } } @@ -33851,7 +36623,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Timer; +namespace PHPUnitPHAR\SebastianBergmann\Timer; use function array_pop; use function hrtime; @@ -33861,14 +36633,14 @@ final class Timer * @psalm-var list */ private $startTimes = []; - public function start() : void + public function start(): void { $this->startTimes[] = (float) hrtime(\true); } /** * @throws NoActiveTimerException */ - public function stop() : Duration + public function stop(): Duration { if (empty($this->startTimes)) { throw new NoActiveTimerException('Timer::start() has to be called before Timer::stop()'); @@ -33887,7 +36659,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Timer; +namespace PHPUnitPHAR\SebastianBergmann\Timer; use Throwable; interface Exception extends Throwable @@ -33904,7 +36676,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Timer; +namespace PHPUnitPHAR\SebastianBergmann\Timer; use LogicException; final class NoActiveTimerException extends LogicException implements Exception @@ -33921,7 +36693,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Timer; +namespace PHPUnitPHAR\SebastianBergmann\Timer; use RuntimeException; final class TimeSinceStartOfRequestNotAvailableException extends RuntimeException implements Exception @@ -33938,7 +36710,7 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection; +namespace PHPUnitPHAR\phpDocumentor\Reflection; /** * Interface for Api Elements @@ -33948,11 +36720,11 @@ interface Element /** * Returns the Fqsen of the element. */ - public function getFqsen() : Fqsen; + public function getFqsen(): Fqsen; /** * Returns the name of the element. */ - public function getName() : string; + public function getName(): string; } fqsen; } /** * Returns the name of the element without path. */ - public function getName() : string + public function getName(): string { return $this->name; } @@ -34094,7 +36866,7 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection; +namespace PHPUnitPHAR\phpDocumentor\Reflection; /** * The location where an element occurs within a file. @@ -34118,14 +36890,14 @@ final class Location /** * Returns the line number that is covered by this location. */ - public function getLineNumber() : int + public function getLineNumber(): int { return $this->lineNumber; } /** * Returns the column number (character position on a line) for this location object. */ - public function getColumnNumber() : int + public function getColumnNumber(): int { return $this->columnNumber; } @@ -34141,7 +36913,7 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection; +namespace PHPUnitPHAR\phpDocumentor\Reflection; /** * Interface for project. Since the definition of a project can be different per factory this interface will be small. @@ -34151,7 +36923,7 @@ interface Project /** * Returns the name of the project. */ - public function getName() : string; + public function getName(): string; } isTemplateEnd = $isTemplateEnd; $this->isTemplateStart = $isTemplateStart; } - public function getSummary() : string + public function getSummary(): string { return $this->summary; } - public function getDescription() : DocBlock\Description + public function getDescription(): DocBlock\Description { return $this->description; } /** * Returns the current context. */ - public function getContext() : ?Types\Context + public function getContext(): ?Types\Context { return $this->context; } /** * Returns the current location. */ - public function getLocation() : ?Location + public function getLocation(): ?Location { return $this->location; } @@ -34270,7 +37042,7 @@ final class DocBlock * * @see self::isTemplateEnd() for the check whether a closing marker was provided. */ - public function isTemplateStart() : bool + public function isTemplateStart(): bool { return $this->isTemplateStart; } @@ -34279,7 +37051,7 @@ final class DocBlock * * @see self::isTemplateStart() for a more complete description of the Docblock Template functionality. */ - public function isTemplateEnd() : bool + public function isTemplateEnd(): bool { return $this->isTemplateEnd; } @@ -34288,7 +37060,7 @@ final class DocBlock * * @return Tag[] */ - public function getTags() : array + public function getTags(): array { return $this->tags; } @@ -34300,7 +37072,7 @@ final class DocBlock * * @return Tag[] */ - public function getTagsByName(string $name) : array + public function getTagsByName(string $name): array { $result = []; foreach ($this->getTags() as $tag) { @@ -34319,7 +37091,7 @@ final class DocBlock * * @return TagWithType[] */ - public function getTagsWithTypeByName(string $name) : array + public function getTagsWithTypeByName(string $name): array { $result = []; foreach ($this->getTagsByName($name) as $tag) { @@ -34335,7 +37107,7 @@ final class DocBlock * * @param string $name Tag name to check for. */ - public function hasTag(string $name) : bool + public function hasTag(string $name): bool { foreach ($this->getTags() as $tag) { if ($tag->getName() === $name) { @@ -34349,7 +37121,7 @@ final class DocBlock * * @param Tag $tagToRemove The tag to remove. */ - public function removeTag(Tag $tagToRemove) : void + public function removeTag(Tag $tagToRemove): void { foreach ($this->tags as $key => $tag) { if ($tag === $tagToRemove) { @@ -34363,7 +37135,7 @@ final class DocBlock * * @param Tag $tag The tag to add. */ - private function addTag(Tag $tag) : void + private function addTag(Tag $tag): void { $this->tags[] = $tag; } @@ -34379,10 +37151,10 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Formatter; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Formatter; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; use function vsprintf; /** * Object representing to description for a DocBlock. @@ -34435,7 +37207,7 @@ class Description /** * Returns the body template. */ - public function getBodyTemplate() : string + public function getBodyTemplate(): string { return $this->bodyTemplate; } @@ -34444,7 +37216,7 @@ class Description * * @return Tag[] */ - public function getTags() : array + public function getTags(): array { return $this->tags; } @@ -34452,7 +37224,7 @@ class Description * Renders this description as a string where the provided formatter will format the tags in the expected string * format. */ - public function render(?Formatter $formatter = null) : string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new PassthroughFormatter(); @@ -34466,7 +37238,7 @@ class Description /** * Returns a plain string representation of this description. */ - public function __toString() : string + public function __toString(): string { return $this->render(); } @@ -34482,10 +37254,10 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; -use PHPUnit\phpDocumentor\Reflection\Utils; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\phpDocumentor\Reflection\Utils; use function count; use function implode; use function ltrim; @@ -34527,7 +37299,7 @@ class DescriptionFactory /** * Returns the parsed text of this description. */ - public function create(string $contents, ?TypeContext $context = null) : Description + public function create(string $contents, ?TypeContext $context = null): Description { $tokens = $this->lex($contents); $count = count($tokens); @@ -34551,18 +37323,18 @@ class DescriptionFactory * * @return string[] A series of tokens of which the description text is composed. */ - private function lex(string $contents) : array + private function lex(string $contents): array { $contents = $this->removeSuperfluousStartingWhitespace($contents); // performance optimalization; if there is no inline tag, don't bother splitting it up. if (strpos($contents, '{@') === \false) { return [$contents]; } - return Utils::pregSplit('/\\{ + return Utils::pregSplit('/\{ # "{@}" is not a valid inline tag. This ensures that we do not treat it as one, but treat it literally. - (?!@\\}) + (?!@\}) # We want to capture the whole tag line, but without the inline tag delimiters. - (\\@ + (\@ # Match everything up to the next delimiter. [^{}]* # Nested inline tag content should not be captured, or it will appear in the result separately. @@ -34571,17 +37343,17 @@ class DescriptionFactory (?: # Because we did not catch the tag delimiters earlier, we must be explicit with them here. # Notice that this also matches "{}", as a way to later introduce it as an escape sequence. - \\{(?1)?\\} + \{(?1)?\} | # Make sure we match hanging "{". - \\{ + \{ ) # Match content after the nested inline tag. [^{}]* )* # If there are more inline tags, match them as well. We use "*" since there may not be any # nested inline tags. ) - \\}/Sux', $contents, 0, PREG_SPLIT_DELIM_CAPTURE); + \}/Sux', $contents, 0, PREG_SPLIT_DELIM_CAPTURE); } /** * Removes the superfluous from a multi-line description. @@ -34597,7 +37369,7 @@ class DescriptionFactory * If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent * lines and this may cause rendering issues when, for example, using a Markdown converter. */ - private function removeSuperfluousStartingWhitespace(string $contents) : string + private function removeSuperfluousStartingWhitespace(string $contents): string { $lines = Utils::pregSplit("/\r\n?|\n/", $contents); // if there is only one line then we don't have lines with superfluous whitespace and @@ -34636,9 +37408,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Example; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Example; use function array_slice; use function file; use function getcwd; @@ -34660,7 +37432,7 @@ class ExampleFinder /** * Attempts to find the example contents for the given descriptor. */ - public function find(Example $example) : string + public function find(Example $example): string { $filename = $example->getFilePath(); $file = $this->getExampleFileContents($filename); @@ -34672,14 +37444,14 @@ class ExampleFinder /** * Registers the project's root directory where an 'examples' folder can be expected. */ - public function setSourceDirectory(string $directory = '') : void + public function setSourceDirectory(string $directory = ''): void { $this->sourceDirectory = $directory; } /** * Returns the project's root directory where an 'examples' folder can be expected. */ - public function getSourceDirectory() : string + public function getSourceDirectory(): string { return $this->sourceDirectory; } @@ -34688,7 +37460,7 @@ class ExampleFinder * * @param string[] $directories */ - public function setExampleDirectories(array $directories) : void + public function setExampleDirectories(array $directories): void { $this->exampleDirectories = $directories; } @@ -34697,7 +37469,7 @@ class ExampleFinder * * @return string[] */ - public function getExampleDirectories() : array + public function getExampleDirectories(): array { return $this->exampleDirectories; } @@ -34714,7 +37486,7 @@ class ExampleFinder * * @return string[] all lines of the example file */ - private function getExampleFileContents(string $filename) : ?array + private function getExampleFileContents(string $filename): ?array { $normalizedPath = null; foreach ($this->exampleDirectories as $directory) { @@ -34733,29 +37505,29 @@ class ExampleFinder $normalizedPath = $filename; } } - $lines = $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : \false; - return $lines !== \false ? $lines : null; + $lines = ($normalizedPath && is_readable($normalizedPath)) ? file($normalizedPath) : \false; + return ($lines !== \false) ? $lines : null; } /** * Get example filepath based on the example directory inside your project. */ - private function getExamplePathFromExampleDirectory(string $file) : string + private function getExamplePathFromExampleDirectory(string $file): string { return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file; } /** * Returns a path to the example file in the given directory.. */ - private function constructExamplePath(string $directory, string $file) : string + private function constructExamplePath(string $directory, string $file): string { - return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file; + return rtrim($directory, '\/') . DIRECTORY_SEPARATOR . $file; } /** * Get example filepath based on sourcecode. */ - private function getExamplePathFromSource(string $file) : string + private function getExamplePathFromSource(string $file): string { - return sprintf('%s%s%s', trim($this->getSourceDirectory(), '\\/'), DIRECTORY_SEPARATOR, trim($file, '"')); + return sprintf('%s%s%s', trim($this->getSourceDirectory(), '\/'), DIRECTORY_SEPARATOR, trim($file, '"')); } } indentString, $this->indent); $firstIndent = $this->isFirstLineIndented ? $indent : ''; @@ -34837,24 +37609,24 @@ class Serializer $comment = $this->addTagBlock($docblock, $wrapLength, $indent, $comment); return str_replace("\n", $this->lineEnding, $comment . $indent . ' */'); } - private function removeTrailingSpaces(string $indent, string $text) : string + private function removeTrailingSpaces(string $indent, string $text): string { return str_replace(sprintf("\n%s * \n", $indent), sprintf("\n%s *\n", $indent), $text); } - private function addAsterisksForEachLine(string $indent, string $text) : string + private function addAsterisksForEachLine(string $indent, string $text): string { return str_replace("\n", sprintf("\n%s * ", $indent), $text); } - private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength) : string + private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength): string { - $text = $docblock->getSummary() . ((string) $docblock->getDescription() ? "\n\n" . $docblock->getDescription() : ''); + $text = $docblock->getSummary() . (((string) $docblock->getDescription()) ? "\n\n" . $docblock->getDescription() : ''); if ($wrapLength !== null) { $text = wordwrap($text, $wrapLength); return $text; } return $text; } - private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment) : string + private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment): string { foreach ($docblock->getTags() as $tag) { $tagText = $this->tagFormatter->format($tag); @@ -34878,34 +37650,34 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock; use InvalidArgumentException; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Author; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Covers; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Deprecated; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Generic; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Method; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Param; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Property; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Return_; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\See as SeeTag; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Since; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Source; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Throws; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Uses; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Var_; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Version; -use PHPUnit\phpDocumentor\Reflection\FqsenResolver; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Author; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Covers; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Deprecated; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Generic; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Method; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Param; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Property; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Return_; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\See as SeeTag; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Since; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Source; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Throws; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Uses; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Var_; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Version; +use PHPUnitPHAR\phpDocumentor\Reflection\FqsenResolver; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; use ReflectionMethod; use ReflectionNamedType; use ReflectionParameter; -use PHPUnit\Webmozart\Assert\Assert; +use PHPUnitPHAR\Webmozart\Assert\Assert; use function array_merge; use function array_slice; use function call_user_func_array; @@ -34934,7 +37706,7 @@ use function trim; final class StandardTagFactory implements TagFactory { /** PCRE regular expression matching a tag name. */ - public const REGEX_TAGNAME = '[\\w\\-\\_\\\\:]+'; + public const REGEX_TAGNAME = '[\w\-\_\\\\:]+'; /** * @var array> An array with a tag as a key, and an * FQCN to a class that handles it as an array value. @@ -34995,7 +37767,7 @@ final class StandardTagFactory implements TagFactory } $this->addService($fqsenResolver, FqsenResolver::class); } - public function create(string $tagLine, ?TypeContext $context = null) : Tag + public function create(string $tagLine, ?TypeContext $context = null): Tag { if (!$context) { $context = new TypeContext(''); @@ -35006,15 +37778,15 @@ final class StandardTagFactory implements TagFactory /** * @param mixed $value */ - public function addParameter(string $name, $value) : void + public function addParameter(string $name, $value): void { $this->serviceLocator[$name] = $value; } - public function addService(object $service, ?string $alias = null) : void + public function addService(object $service, ?string $alias = null): void { $this->serviceLocator[$alias ?: get_class($service)] = $service; } - public function registerTagHandler(string $tagName, string $handler) : void + public function registerTagHandler(string $tagName, string $handler): void { Assert::stringNotEmpty($tagName); Assert::classExists($handler); @@ -35029,10 +37801,10 @@ final class StandardTagFactory implements TagFactory * * @return string[] */ - private function extractTagParts(string $tagLine) : array + private function extractTagParts(string $tagLine): array { $matches = []; - if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\\s\\(\\{])\\s*([^\\s].*)|$)/us', $tagLine, $matches)) { + if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{])\s*([^\s].*)|$)/us', $tagLine, $matches)) { throw new InvalidArgumentException('The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors'); } if (count($matches) < 3) { @@ -35044,7 +37816,7 @@ final class StandardTagFactory implements TagFactory * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the * body was invalid. */ - private function createTag(string $body, string $name, TypeContext $context) : Tag + private function createTag(string $body, string $name, TypeContext $context): Tag { $handlerClassName = $this->findHandlerClassName($name, $context); $arguments = $this->getArgumentsForParametersFromWiring($this->fetchParametersForHandlerFactoryMethod($handlerClassName), $this->getServiceLocatorWithDynamicParameters($context, $name, $body)); @@ -35063,7 +37835,7 @@ final class StandardTagFactory implements TagFactory * * @return class-string */ - private function findHandlerClassName(string $tagName, TypeContext $context) : string + private function findHandlerClassName(string $tagName, TypeContext $context): string { $handlerClassName = Generic::class; if (isset($this->tagHandlerMappings[$tagName])) { @@ -35086,7 +37858,7 @@ final class StandardTagFactory implements TagFactory * @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters * is provided with this method. */ - private function getArgumentsForParametersFromWiring(array $parameters, array $locator) : array + private function getArgumentsForParametersFromWiring(array $parameters, array $locator): array { $arguments = []; foreach ($parameters as $parameter) { @@ -35122,7 +37894,7 @@ final class StandardTagFactory implements TagFactory * * @return ReflectionParameter[] */ - private function fetchParametersForHandlerFactoryMethod(string $handlerClassName) : array + private function fetchParametersForHandlerFactoryMethod(string $handlerClassName): array { if (!isset($this->tagHandlerParameterCache[$handlerClassName])) { $methodReflection = new ReflectionMethod($handlerClassName, 'create'); @@ -35143,7 +37915,7 @@ final class StandardTagFactory implements TagFactory * * @return mixed[] */ - private function getServiceLocatorWithDynamicParameters(TypeContext $context, string $tagName, string $tagBody) : array + private function getServiceLocatorWithDynamicParameters(TypeContext $context, string $tagName, string $tagBody): array { return array_merge($this->serviceLocator, ['name' => $tagName, 'body' => $tagBody, TypeContext::class => $context]); } @@ -35152,7 +37924,7 @@ final class StandardTagFactory implements TagFactory * * @todo this method should be populated once we implement Annotation notation support. */ - private function isAnnotation(string $tagContent) : bool + private function isAnnotation(string $tagContent): bool { // 1. Contains a namespace separator // 2. Contains parenthesis @@ -35172,19 +37944,19 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Formatter; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Formatter; interface Tag { - public function getName() : string; + public function getName(): string; /** * @return Tag|mixed Class that implements Tag * @phpstan-return ?Tag */ public static function create(string $body); - public function render(?Formatter $formatter = null) : string; - public function __toString() : string; + public function render(?Formatter $formatter = null): string; + public function __toString(): string; } authorName; } @@ -35318,14 +38090,14 @@ final class Author extends BaseTag implements Factory\StaticMethod * * @return string The author's email. */ - public function getEmail() : string + public function getEmail(): string { return $this->authorEmail; } /** * Returns this tag in string form. */ - public function __toString() : string + public function __toString(): string { if ($this->authorEmail) { $authorEmail = '<' . $this->authorEmail . '>'; @@ -35333,14 +38105,14 @@ final class Author extends BaseTag implements Factory\StaticMethod $authorEmail = ''; } $authorName = $this->authorName; - return $authorName . ($authorEmail !== '' ? ($authorName !== '' ? ' ' : '') . $authorEmail : ''); + return $authorName . (($authorEmail !== '') ? (($authorName !== '') ? ' ' : '') . $authorEmail : ''); } /** * Attempts to create a new Author object based on the tag body. */ - public static function create(string $body) : ?self + public static function create(string $body): ?self { - $splitTagContent = preg_match('/^([^\\<]*)(?:\\<([^\\>]*)\\>)?$/u', $body, $matches); + $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches); if (!$splitTagContent) { return null; } @@ -35360,10 +38132,10 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; -use PHPUnit\phpDocumentor\Reflection\DocBlock; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Description; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Description; /** * Parses a tag definition for a DocBlock. */ @@ -35378,15 +38150,15 @@ abstract class BaseTag implements DocBlock\Tag * * @return string The name of this tag. */ - public function getName() : string + public function getName(): string { return $this->name; } - public function getDescription() : ?Description + public function getDescription(): ?Description { return $this->description; } - public function render(?Formatter $formatter = null) : string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new Formatter\PassthroughFormatter(); @@ -35405,15 +38177,15 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Description; -use PHPUnit\phpDocumentor\Reflection\DocBlock\DescriptionFactory; -use PHPUnit\phpDocumentor\Reflection\Fqsen; -use PHPUnit\phpDocumentor\Reflection\FqsenResolver; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; -use PHPUnit\phpDocumentor\Reflection\Utils; -use PHPUnit\Webmozart\Assert\Assert; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Description; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\Fqsen; +use PHPUnitPHAR\phpDocumentor\Reflection\FqsenResolver; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\phpDocumentor\Reflection\Utils; +use PHPUnitPHAR\Webmozart\Assert\Assert; use function array_key_exists; use function explode; /** @@ -35433,15 +38205,15 @@ final class Covers extends BaseTag implements Factory\StaticMethod $this->refers = $refers; $this->description = $description; } - public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?FqsenResolver $resolver = null, ?TypeContext $context = null) : self + public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?FqsenResolver $resolver = null, ?TypeContext $context = null): self { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); Assert::notNull($resolver); - $parts = Utils::pregSplit('/\\s+/Su', $body, 2); + $parts = Utils::pregSplit('/\s+/Su', $body, 2); return new static(self::resolveFqsen($parts[0], $resolver, $context), $descriptionFactory->create($parts[1] ?? '', $context)); } - private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen + private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen { Assert::notNull($fqsenResolver); $fqsenParts = explode('::', $parts); @@ -35454,14 +38226,14 @@ final class Covers extends BaseTag implements Factory\StaticMethod /** * Returns the structural element this tag refers to. */ - public function getReference() : Fqsen + public function getReference(): Fqsen { return $this->refers; } /** * Returns a string representation of this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -35469,7 +38241,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod $description = ''; } $refers = (string) $this->refers; - return $refers . ($description !== '' ? ($refers !== '' ? ' ' : '') . $description : ''); + return $refers . (($description !== '') ? (($refers !== '') ? ' ' : '') . $description : ''); } } create($body, $context) : null); + if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { + return new static(null, ($descriptionFactory !== null) ? $descriptionFactory->create($body, $context) : null); } Assert::notNull($descriptionFactory); return new static($matches[1], $descriptionFactory->create($matches[2] ?? '', $context)); @@ -35538,14 +38310,14 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod /** * Gets the version section of the tag. */ - public function getVersion() : ?string + public function getVersion(): ?string { return $this->version; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -35553,7 +38325,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod $description = ''; } $version = (string) $this->version; - return $version . ($description !== '' ? ($version !== '' ? ' ' : '') . $description : ''); + return $version . (($description !== '') ? (($version !== '') ? ' ' : '') . $description : ''); } } isURI = $isURI; } - public function getContent() : string + public function getContent(): string { if ($this->content === null || $this->content === '') { $filePath = $this->filePath; @@ -35619,14 +38391,14 @@ final class Example implements Tag, Factory\StaticMethod } return $this->content; } - public function getDescription() : ?string + public function getDescription(): ?string { return $this->content; } - public static function create(string $body) : ?Tag + public static function create(string $body): ?Tag { // File component: File path in quotes or File URI / Source information - if (!preg_match('/^\\s*(?:(\\"[^\\"]+\\")|(\\S+))(?:\\s+(.*))?$/sux', $body, $matches)) { + if (!preg_match('/^\s*(?:(\"[^\"]+\")|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { return null; } $filePath = null; @@ -35642,7 +38414,7 @@ final class Example implements Tag, Factory\StaticMethod if (array_key_exists(3, $matches)) { $description = $matches[3]; // Starting line / Number of lines / Description - if (preg_match('/^([1-9]\\d*)(?:\\s+((?1))\\s*)?(.*)$/sux', $matches[3], $contentMatches)) { + if (preg_match('/^([1-9]\d*)(?:\s+((?1))\s*)?(.*)$/sux', $matches[3], $contentMatches)) { $startingLine = (int) $contentMatches[1]; if (isset($contentMatches[2])) { $lineCount = (int) $contentMatches[2]; @@ -35660,42 +38432,42 @@ final class Example implements Tag, Factory\StaticMethod * @return string Path to a file to use as an example. * May also be an absolute URI. */ - public function getFilePath() : string + public function getFilePath(): string { return trim($this->filePath, '"'); } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { $filePath = $this->filePath; $isDefaultLine = $this->startingLine === 1 && $this->lineCount === 0; - $startingLine = !$isDefaultLine ? (string) $this->startingLine : ''; - $lineCount = !$isDefaultLine ? (string) $this->lineCount : ''; + $startingLine = (!$isDefaultLine) ? (string) $this->startingLine : ''; + $lineCount = (!$isDefaultLine) ? (string) $this->lineCount : ''; $content = (string) $this->content; - return $filePath . ($startingLine !== '' ? ($filePath !== '' ? ' ' : '') . $startingLine : '') . ($lineCount !== '' ? ($filePath !== '' || $startingLine !== '' ? ' ' : '') . $lineCount : '') . ($content !== '' ? ($filePath !== '' || $startingLine !== '' || $lineCount !== '' ? ' ' : '') . $content : ''); + return $filePath . (($startingLine !== '') ? (($filePath !== '') ? ' ' : '') . $startingLine : '') . (($lineCount !== '') ? (($filePath !== '' || $startingLine !== '') ? ' ' : '') . $lineCount : '') . (($content !== '') ? (($filePath !== '' || $startingLine !== '' || $lineCount !== '') ? ' ' : '') . $content : ''); } /** * Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute). */ - private function isUriRelative(string $uri) : bool + private function isUriRelative(string $uri): bool { return strpos($uri, ':') === \false; } - public function getStartingLine() : int + public function getStartingLine(): int { return $this->startingLine; } - public function getLineCount() : int + public function getLineCount(): int { return $this->lineCount; } - public function getName() : string + public function getName(): string { return 'example'; } - public function render(?Formatter $formatter = null) : string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new Formatter\PassthroughFormatter(); @@ -35714,7 +38486,7 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Factory; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Factory; /** * @deprecated This contract is totally covered by Tag contract. Every class using StaticMethod also use Tag @@ -35737,15 +38509,15 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tag; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tag; interface Formatter { /** * Formats a tag into a string representation according to a specific format, such as Markdown. */ - public function format(Tag $tag) : string; + public function format(Tag $tag): string; } getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . $tag; } @@ -35797,17 +38569,17 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Formatter; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Formatter; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tag; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Formatter; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tag; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Formatter; use function trim; class PassthroughFormatter implements Formatter { /** * Formats the given tag to return a simple plain text version. */ - public function format(Tag $tag) : string + public function format(Tag $tag): string { return trim('@' . $tag->getName() . ' ' . $tag); } @@ -35823,14 +38595,14 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; use InvalidArgumentException; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Description; -use PHPUnit\phpDocumentor\Reflection\DocBlock\DescriptionFactory; -use PHPUnit\phpDocumentor\Reflection\DocBlock\StandardTagFactory; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; -use PHPUnit\Webmozart\Assert\Assert; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Description; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\StandardTagFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\Webmozart\Assert\Assert; use function preg_match; /** * Parses a tag definition for a DocBlock. @@ -35854,17 +38626,17 @@ final class Generic extends BaseTag implements Factory\StaticMethod * * @return static */ - public static function create(string $body, string $name = '', ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, string $name = '', ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); - $description = $body !== '' ? $descriptionFactory->create($body, $context) : null; + $description = ($body !== '') ? $descriptionFactory->create($body, $context) : null; return new static($name, $description); } /** * Returns the tag as a serialized string */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -35876,7 +38648,7 @@ final class Generic extends BaseTag implements Factory\StaticMethod /** * Validates if the tag name matches the expected format, otherwise throws an exception. */ - private function validateTagName(string $name) : void + private function validateTagName(string $name): void { if (!preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) { throw new InvalidArgumentException('The tag name "' . $name . '" is not wellformed. Tags may only consist of letters, underscores, ' . 'hyphens and backslashes.'); @@ -35886,11 +38658,11 @@ final class Generic extends BaseTag implements Factory\StaticMethod name = $name; $this->body = $body; } - public function getException() : ?Throwable + public function getException(): ?Throwable { return $this->throwable; } - public function getName() : string + public function getName(): string { return $this->name; } - public static function create(string $body, string $name = '') : self + public static function create(string $body, string $name = ''): self { return new self($name, $body); } - public function withError(Throwable $exception) : self + public function withError(Throwable $exception): self { $this->flattenExceptionBacktrace($exception); $tag = new self($this->name, $this->body); @@ -35950,14 +38722,14 @@ final class InvalidTag implements Tag * Not all objects are serializable. So we need to remove them from the * stored exception to be sure that we do not break existing library usage. */ - private function flattenExceptionBacktrace(Throwable $exception) : void + private function flattenExceptionBacktrace(Throwable $exception): void { $traceProperty = (new ReflectionClass(Exception::class))->getProperty('trace'); $traceProperty->setAccessible(\true); do { $trace = $exception->getTrace(); if (isset($trace[0]['args'])) { - $trace = array_map(function (array $call) : array { + $trace = array_map(function (array $call): array { $call['args'] = array_map([$this, 'flattenArguments'], $call['args'] ?? []); return $call; }, $trace); @@ -35988,14 +38760,14 @@ final class InvalidTag implements Tag } return $value; } - public function render(?Formatter $formatter = null) : string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new Formatter\PassthroughFormatter(); } return $formatter->format($this); } - public function __toString() : string + public function __toString(): string { return $this->body; } @@ -36011,13 +38783,13 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Description; -use PHPUnit\phpDocumentor\Reflection\DocBlock\DescriptionFactory; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; -use PHPUnit\phpDocumentor\Reflection\Utils; -use PHPUnit\Webmozart\Assert\Assert; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Description; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\phpDocumentor\Reflection\Utils; +use PHPUnitPHAR\Webmozart\Assert\Assert; /** * Reflection class for a {@}link tag in a Docblock. */ @@ -36035,24 +38807,24 @@ final class Link extends BaseTag implements Factory\StaticMethod $this->link = $link; $this->description = $description; } - public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::notNull($descriptionFactory); - $parts = Utils::pregSplit('/\\s+/Su', $body, 2); + $parts = Utils::pregSplit('/\s+/Su', $body, 2); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; return new static($parts[0], $description); } /** * Gets the link */ - public function getLink() : string + public function getLink(): string { return $this->link; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -36060,7 +38832,7 @@ final class Link extends BaseTag implements Factory\StaticMethod $description = ''; } $link = $this->link; - return $link . ($description !== '' ? ($link !== '' ? ' ' : '') . $description : ''); + return $link . (($description !== '') ? (($link !== '') ? ' ' : '') . $description : ''); } } isStatic = $static; $this->description = $description; } - public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : ?self + public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): ?self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); @@ -36148,28 +38920,28 @@ final class Method extends BaseTag implements Factory\StaticMethod # Declares a static method ONLY if type is also present (?: (static) - \\s+ + \s+ )? # Return type (?: ( - (?:[\\w\\|_\\\\]*\\$this[\\w\\|_\\\\]*) + (?:[\w\|_\\\\]*\$this[\w\|_\\\\]*) | (?: - (?:[\\w\\|_\\\\]+) + (?:[\w\|_\\\\]+) # array notation - (?:\\[\\])* + (?:\[\])* )*+ ) - \\s+ + \s+ )? # Method name - ([\\w_]+) + ([\w_]+) # Arguments (?: - \\(([^\\)]*)\\) + \(([^\)]*)\) )? - \\s* + \s* # Description (.*) $/sux', $body, $matches)) { @@ -36207,7 +38979,7 @@ final class Method extends BaseTag implements Factory\StaticMethod /** * Retrieves the method name. */ - public function getMethodName() : string + public function getMethodName(): string { return $this->methodName; } @@ -36215,7 +38987,7 @@ final class Method extends BaseTag implements Factory\StaticMethod * @return array> * @phpstan-return array */ - public function getArguments() : array + public function getArguments(): array { return $this->arguments; } @@ -36224,15 +38996,15 @@ final class Method extends BaseTag implements Factory\StaticMethod * * @return bool TRUE if the method declaration is for a static method, FALSE otherwise. */ - public function isStatic() : bool + public function isStatic(): bool { return $this->isStatic; } - public function getReturnType() : Type + public function getReturnType(): Type { return $this->returnType; } - public function __toString() : string + public function __toString(): string { $arguments = []; foreach ($this->arguments as $argument) { @@ -36247,7 +39019,7 @@ final class Method extends BaseTag implements Factory\StaticMethod $static = $this->isStatic ? 'static' : ''; $returnType = (string) $this->returnType; $methodName = $this->methodName; - return $static . ($returnType !== '' ? ($static !== '' ? ' ' : '') . $returnType : '') . ($methodName !== '' ? ($static !== '' || $returnType !== '' ? ' ' : '') . $methodName : '') . $argumentStr . ($description !== '' ? ' ' . $description : ''); + return $static . (($returnType !== '') ? (($static !== '') ? ' ' : '') . $returnType : '') . (($methodName !== '') ? (($static !== '' || $returnType !== '') ? ' ' : '') . $methodName : '') . $argumentStr . (($description !== '') ? ' ' . $description : ''); } /** * @param mixed[][]|string[] $arguments @@ -36256,7 +39028,7 @@ final class Method extends BaseTag implements Factory\StaticMethod * @return mixed[][] * @phpstan-return array */ - private function filterArguments(array $arguments = []) : array + private function filterArguments(array $arguments = []): array { $result = []; foreach ($arguments as $argument) { @@ -36275,7 +39047,7 @@ final class Method extends BaseTag implements Factory\StaticMethod } return $result; } - private static function stripRestArg(string $argument) : string + private static function stripRestArg(string $argument): string { if (strpos($argument, '...') === 0) { $argument = trim(substr($argument, 3)); @@ -36294,15 +39066,15 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Description; -use PHPUnit\phpDocumentor\Reflection\DocBlock\DescriptionFactory; -use PHPUnit\phpDocumentor\Reflection\Type; -use PHPUnit\phpDocumentor\Reflection\TypeResolver; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; -use PHPUnit\phpDocumentor\Reflection\Utils; -use PHPUnit\Webmozart\Assert\Assert; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Description; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\TypeResolver; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\phpDocumentor\Reflection\Utils; +use PHPUnitPHAR\Webmozart\Assert\Assert; use function array_shift; use function array_unshift; use function implode; @@ -36329,14 +39101,14 @@ final class Param extends TagWithType implements Factory\StaticMethod $this->description = $description; $this->isReference = $isReference; } - public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); [$firstPart, $body] = self::extractTypeFromBody($body); $type = null; - $parts = Utils::pregSplit('/(\\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $parts = Utils::pregSplit('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; $isVariadic = \false; $isReference = \false; @@ -36374,28 +39146,28 @@ final class Param extends TagWithType implements Factory\StaticMethod /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } /** * Returns whether this tag is variadic. */ - public function isVariadic() : bool + public function isVariadic(): bool { return $this->isVariadic; } /** * Returns whether this tag is passed by reference. */ - public function isReference() : bool + public function isReference(): bool { return $this->isReference; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -36408,9 +39180,9 @@ final class Param extends TagWithType implements Factory\StaticMethod $variableName .= '$' . $this->variableName; } $type = (string) $this->type; - return $type . ($variableName !== '' ? ($type !== '' ? ' ' : '') . $variableName : '') . ($description !== '' ? ($type !== '' || $variableName !== '' ? ' ' : '') . $description : ''); + return $type . (($variableName !== '') ? (($type !== '') ? ' ' : '') . $variableName : '') . (($description !== '') ? (($type !== '' || $variableName !== '') ? ' ' : '') . $description : ''); } - private static function strStartsWithVariable(string $str) : bool + private static function strStartsWithVariable(string $str): bool { return strpos($str, '$') === 0 || strpos($str, '...$') === 0 || strpos($str, '&$') === 0 || strpos($str, '&...$') === 0; } @@ -36426,15 +39198,15 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Description; -use PHPUnit\phpDocumentor\Reflection\DocBlock\DescriptionFactory; -use PHPUnit\phpDocumentor\Reflection\Type; -use PHPUnit\phpDocumentor\Reflection\TypeResolver; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; -use PHPUnit\phpDocumentor\Reflection\Utils; -use PHPUnit\Webmozart\Assert\Assert; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Description; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\TypeResolver; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\phpDocumentor\Reflection\Utils; +use PHPUnitPHAR\Webmozart\Assert\Assert; use function array_shift; use function array_unshift; use function implode; @@ -36456,14 +39228,14 @@ final class Property extends TagWithType implements Factory\StaticMethod $this->type = $type; $this->description = $description; } - public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); [$firstPart, $body] = self::extractTypeFromBody($body); $type = null; - $parts = Utils::pregSplit('/(\\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $parts = Utils::pregSplit('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; // if the first item that is encountered is not a variable; it is a type if ($firstPart && $firstPart[0] !== '$') { @@ -36487,14 +39259,14 @@ final class Property extends TagWithType implements Factory\StaticMethod /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -36507,7 +39279,7 @@ final class Property extends TagWithType implements Factory\StaticMethod $variableName = ''; } $type = (string) $this->type; - return $type . ($variableName !== '' ? ($type !== '' ? ' ' : '') . $variableName : '') . ($description !== '' ? ($type !== '' || $variableName !== '' ? ' ' : '') . $description : ''); + return $type . (($variableName !== '') ? (($type !== '') ? ' ' : '') . $variableName : '') . (($description !== '') ? (($type !== '' || $variableName !== '') ? ' ' : '') . $description : ''); } } type = $type; $this->description = $description; } - public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); [$firstPart, $body] = self::extractTypeFromBody($body); $type = null; - $parts = Utils::pregSplit('/(\\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $parts = Utils::pregSplit('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; // if the first item that is encountered is not a variable; it is a type if ($firstPart && $firstPart[0] !== '$') { @@ -36582,14 +39354,14 @@ final class PropertyRead extends TagWithType implements Factory\StaticMethod /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -36602,7 +39374,7 @@ final class PropertyRead extends TagWithType implements Factory\StaticMethod $variableName = ''; } $type = (string) $this->type; - return $type . ($variableName !== '' ? ($type !== '' ? ' ' : '') . $variableName : '') . ($description !== '' ? ($type !== '' || $variableName !== '' ? ' ' : '') . $description : ''); + return $type . (($variableName !== '') ? (($type !== '') ? ' ' : '') . $variableName : '') . (($description !== '') ? (($type !== '' || $variableName !== '') ? ' ' : '') . $description : ''); } } type = $type; $this->description = $description; } - public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); [$firstPart, $body] = self::extractTypeFromBody($body); $type = null; - $parts = Utils::pregSplit('/(\\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $parts = Utils::pregSplit('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; // if the first item that is encountered is not a variable; it is a type if ($firstPart && $firstPart[0] !== '$') { @@ -36677,14 +39449,14 @@ final class PropertyWrite extends TagWithType implements Factory\StaticMethod /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -36697,7 +39469,7 @@ final class PropertyWrite extends TagWithType implements Factory\StaticMethod $variableName = ''; } $type = (string) $this->type; - return $type . ($variableName !== '' ? ($type !== '' ? ' ' : '') . $variableName : '') . ($description !== '' ? ($type !== '' || $variableName !== '' ? ' ' : '') . $description : ''); + return $type . (($variableName !== '') ? (($type !== '') ? ' ' : '') . $variableName : '') . (($description !== '') ? (($type !== '' || $variableName !== '') ? ' ' : '') . $description : ''); } } fqsen; } @@ -36744,14 +39516,14 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Reference; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Reference; /** * Interface for references in {@see \phpDocumentor\Reflection\DocBlock\Tags\See} */ interface Reference { - public function __toString() : string; + public function __toString(): string; } uri = $uri; } - public function __toString() : string + public function __toString(): string { return $this->uri; } @@ -36795,14 +39567,14 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Description; -use PHPUnit\phpDocumentor\Reflection\DocBlock\DescriptionFactory; -use PHPUnit\phpDocumentor\Reflection\Type; -use PHPUnit\phpDocumentor\Reflection\TypeResolver; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; -use PHPUnit\Webmozart\Assert\Assert; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Description; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\TypeResolver; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\Webmozart\Assert\Assert; /** * Reflection class for a {@}return tag in a Docblock. */ @@ -36814,7 +39586,7 @@ final class Return_ extends TagWithType implements Factory\StaticMethod $this->type = $type; $this->description = $description; } - public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -36823,7 +39595,7 @@ final class Return_ extends TagWithType implements Factory\StaticMethod $description = $descriptionFactory->create($description, $context); return new static($type, $description); } - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -36831,7 +39603,7 @@ final class Return_ extends TagWithType implements Factory\StaticMethod $description = ''; } $type = $this->type ? '' . $this->type : 'mixed'; - return $type . ($description !== '' ? ' ' . $description : ''); + return $type . (($description !== '') ? ' ' . $description : ''); } } refers = $refers; $this->description = $description; } - public static function create(string $body, ?FqsenResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?FqsenResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::notNull($descriptionFactory); - $parts = Utils::pregSplit('/\\s+/Su', $body, 2); + $parts = Utils::pregSplit('/\s+/Su', $body, 2); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; // https://tools.ietf.org/html/rfc2396#section-3 - if (preg_match('#\\w://\\w#', $parts[0])) { + if (preg_match('#\w://\w#', $parts[0])) { return new static(new Url($parts[0]), $description); } return new static(new FqsenRef(self::resolveFqsen($parts[0], $typeResolver, $context)), $description); } - private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen + private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen { Assert::notNull($fqsenResolver); $fqsenParts = explode('::', $parts); @@ -36901,14 +39673,14 @@ final class See extends BaseTag implements Factory\StaticMethod /** * Returns the ref of this tag. */ - public function getReference() : Reference + public function getReference(): Reference { return $this->refers; } /** * Returns a string representation of this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -36916,7 +39688,7 @@ final class See extends BaseTag implements Factory\StaticMethod $description = ''; } $refers = (string) $this->refers; - return $refers . ($description !== '' ? ($refers !== '' ? ' ' : '') . $description : ''); + return $refers . (($description !== '') ? (($refers !== '') ? ' ' : '') . $description : ''); } } version = $version; $this->description = $description; } - public static function create(?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : ?self + public static function create(?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): ?self { if (empty($body)) { return new static(); } $matches = []; - if (!preg_match('/^(' . self::REGEX_VECTOR . ')\\s*(.+)?$/sux', $body, $matches)) { + if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { return null; } Assert::notNull($descriptionFactory); @@ -36982,14 +39754,14 @@ final class Since extends BaseTag implements Factory\StaticMethod /** * Gets the version section of the tag. */ - public function getVersion() : ?string + public function getVersion(): ?string { return $this->version; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -36997,7 +39769,7 @@ final class Since extends BaseTag implements Factory\StaticMethod $description = ''; } $version = (string) $this->version; - return $version . ($description !== '' ? ($version !== '' ? ' ' : '') . $description : ''); + return $version . (($description !== '') ? (($version !== '') ? ' ' : '') . $description : ''); } } startingLine = (int) $startingLine; - $this->lineCount = $lineCount !== null ? (int) $lineCount : null; + $this->lineCount = ($lineCount !== null) ? (int) $lineCount : null; $this->description = $description; } - public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); @@ -37049,7 +39821,7 @@ final class Source extends BaseTag implements Factory\StaticMethod $lineCount = null; $description = null; // Starting line / Number of lines / Description - if (preg_match('/^([1-9]\\d*)\\s*(?:((?1))\\s+)?(.*)$/sux', $body, $matches)) { + if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $body, $matches)) { $startingLine = (int) $matches[1]; if (isset($matches[2]) && $matches[2] !== '') { $lineCount = (int) $matches[2]; @@ -37064,7 +39836,7 @@ final class Source extends BaseTag implements Factory\StaticMethod * @return int The starting line, relative to the structural element's * location. */ - public function getStartingLine() : int + public function getStartingLine(): int { return $this->startingLine; } @@ -37074,11 +39846,11 @@ final class Source extends BaseTag implements Factory\StaticMethod * @return int|null The number of lines, relative to the starting line. NULL * means "to the end". */ - public function getLineCount() : ?int + public function getLineCount(): ?int { return $this->lineCount; } - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -37086,8 +39858,8 @@ final class Source extends BaseTag implements Factory\StaticMethod $description = ''; } $startingLine = (string) $this->startingLine; - $lineCount = $this->lineCount !== null ? ' ' . $this->lineCount : ''; - return $startingLine . $lineCount . ($description !== '' ? ' ' . $description : ''); + $lineCount = ($this->lineCount !== null) ? ' ' . $this->lineCount : ''; + return $startingLine . $lineCount . (($description !== '') ? ' ' . $description : ''); } } type; } /** * @return string[] */ - protected static function extractTypeFromBody(string $body) : array + protected static function extractTypeFromBody(string $body): array { $type = ''; $nestingLevel = 0; @@ -37156,14 +39928,14 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\DocBlock\Tags; +namespace PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Description; -use PHPUnit\phpDocumentor\Reflection\DocBlock\DescriptionFactory; -use PHPUnit\phpDocumentor\Reflection\Type; -use PHPUnit\phpDocumentor\Reflection\TypeResolver; -use PHPUnit\phpDocumentor\Reflection\Types\Context as TypeContext; -use PHPUnit\Webmozart\Assert\Assert; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Description; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\TypeResolver; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Context as TypeContext; +use PHPUnitPHAR\Webmozart\Assert\Assert; /** * Reflection class for a {@}throws tag in a Docblock. */ @@ -37175,7 +39947,7 @@ final class Throws extends TagWithType implements Factory\StaticMethod $this->type = $type; $this->description = $description; } - public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); @@ -37184,7 +39956,7 @@ final class Throws extends TagWithType implements Factory\StaticMethod $description = $descriptionFactory->create($description, $context); return new static($type, $description); } - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -37192,7 +39964,7 @@ final class Throws extends TagWithType implements Factory\StaticMethod $description = ''; } $type = (string) $this->type; - return $type . ($description !== '' ? ($type !== '' ? ' ' : '') . $description : ''); + return $type . (($description !== '') ? (($type !== '') ? ' ' : '') . $description : ''); } } refers = $refers; $this->description = $description; } - public static function create(string $body, ?FqsenResolver $resolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?FqsenResolver $resolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::notNull($resolver); Assert::notNull($descriptionFactory); - $parts = Utils::pregSplit('/\\s+/Su', $body, 2); + $parts = Utils::pregSplit('/\s+/Su', $body, 2); return new static(self::resolveFqsen($parts[0], $resolver, $context), $descriptionFactory->create($parts[1] ?? '', $context)); } - private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context) : Fqsen + private static function resolveFqsen(string $parts, ?FqsenResolver $fqsenResolver, ?TypeContext $context): Fqsen { Assert::notNull($fqsenResolver); $fqsenParts = explode('::', $parts); @@ -37254,14 +40026,14 @@ final class Uses extends BaseTag implements Factory\StaticMethod /** * Returns the structural element this tag refers to. */ - public function getReference() : Fqsen + public function getReference(): Fqsen { return $this->refers; } /** * Returns a string representation of this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -37269,7 +40041,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod $description = ''; } $refers = (string) $this->refers; - return $refers . ($description !== '' ? ($refers !== '' ? ' ' : '') . $description : ''); + return $refers . (($description !== '') ? (($refers !== '') ? ' ' : '') . $description : ''); } } type = $type; $this->description = $description; } - public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : self + public static function create(string $body, ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::stringNotEmpty($body); Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); [$firstPart, $body] = self::extractTypeFromBody($body); - $parts = Utils::pregSplit('/(\\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $parts = Utils::pregSplit('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type @@ -37344,14 +40116,14 @@ final class Var_ extends TagWithType implements Factory\StaticMethod /** * Returns the variable's name. */ - public function getVariableName() : ?string + public function getVariableName(): ?string { return $this->variableName; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -37364,7 +40136,7 @@ final class Var_ extends TagWithType implements Factory\StaticMethod $variableName = ''; } $type = (string) $this->type; - return $type . ($variableName !== '' ? ($type !== '' ? ' ' : '') . $variableName : '') . ($description !== '' ? ($type !== '' || $variableName !== '' ? ' ' : '') . $description : ''); + return $type . (($variableName !== '') ? (($type !== '') ? ' ' : '') . $variableName : '') . (($description !== '') ? (($type !== '' || $variableName !== '') ? ' ' : '') . $description : ''); } } version = $version; $this->description = $description; } - public static function create(?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null) : ?self + public static function create(?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): ?self { if (empty($body)) { return new static(); } $matches = []; - if (!preg_match('/^(' . self::REGEX_VECTOR . ')\\s*(.+)?$/sux', $body, $matches)) { + if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { return null; } $description = null; @@ -37433,14 +40205,14 @@ final class Version extends BaseTag implements Factory\StaticMethod /** * Gets the version section of the tag. */ - public function getVersion() : ?string + public function getVersion(): ?string { return $this->version; } /** * Returns a string representation for this tag. */ - public function __toString() : string + public function __toString(): string { if ($this->description) { $description = $this->description->render(); @@ -37448,7 +40220,7 @@ final class Version extends BaseTag implements Factory\StaticMethod $description = ''; } $version = (string) $this->version; - return $version . ($description !== '' ? ($version !== '' ? ' ' : '') . $description : ''); + return $version . (($description !== '') ? (($version !== '') ? ' ' : '') . $description : ''); } } > $additionalTags */ - public static function createInstance(array $additionalTags = []) : self + public static function createInstance(array $additionalTags = []): self { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); @@ -37518,7 +40290,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface * @param object|string $docblock A string containing the DocBlock to parse or an object supporting the * getDocComment method (such as a ReflectionClass object). */ - public function create($docblock, ?Types\Context $context = null, ?Location $location = null) : DocBlock + public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock { if (is_object($docblock)) { if (!method_exists($docblock, 'getDocComment')) { @@ -37539,7 +40311,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface /** * @param class-string $handler */ - public function registerTagHandler(string $tagName, string $handler) : void + public function registerTagHandler(string $tagName, string $handler): void { $this->tagFactory->registerTagHandler($tagName, $handler); } @@ -37548,9 +40320,9 @@ final class DocBlockFactory implements DocBlockFactoryInterface * * @param string $comment String containing the comment text. */ - private function stripDocComment(string $comment) : string + private function stripDocComment(string $comment): string { - $comment = preg_replace('#[ \\t]*(?:\\/\\*\\*|\\*\\/|\\*)?[ \\t]?(.*)?#u', '$1', $comment); + $comment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]?(.*)?#u', '$1', $comment); Assert::string($comment); $comment = trim($comment); // reg ex above is not able to remove */ from a single line docblock @@ -37571,7 +40343,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface * * @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split. */ - private function splitDocBlock(string $comment) : array + private function splitDocBlock(string $comment): array { // phpcs:enable // Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This @@ -37581,7 +40353,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface return ['', '', '', $comment]; } // clears all extra horizontal whitespace from the line endings to prevent parsing issues - $comment = preg_replace('/\\h*$/Sum', '', $comment); + $comment = preg_replace('/\h*$/Sum', '', $comment); Assert::string($comment); /* * Splits the docblock into a template marker, summary, description and tags section. @@ -37598,39 +40370,39 @@ final class DocBlockFactory implements DocBlockFactoryInterface * Big thanks to RichardJ for contributing this Regular Expression */ preg_match('/ - \\A + \A # 1. Extract the template marker - (?:(\\#\\@\\+|\\#\\@\\-)\\n?)? + (?:(\#\@\+|\#\@\-)\n?)? # 2. Extract the summary (?: - (?! @\\pL ) # The summary may not start with an @ + (?! @\pL ) # The summary may not start with an @ ( - [^\\n.]+ + [^\n.]+ (?: - (?! \\. \\n | \\n{2} ) # End summary upon a dot followed by newline or two newlines - [\\n.]* (?! [ \\t]* @\\pL ) # End summary when an @ is found as first character on a new line - [^\\n.]+ # Include anything else + (?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines + [\n.]* (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line + [^\n.]+ # Include anything else )* - \\.? + \.? )? ) # 3. Extract the description (?: - \\s* # Some form of whitespace _must_ precede a description because a summary must be there - (?! @\\pL ) # The description may not start with an @ + \s* # Some form of whitespace _must_ precede a description because a summary must be there + (?! @\pL ) # The description may not start with an @ ( - [^\\n]+ - (?: \\n+ - (?! [ \\t]* @\\pL ) # End description when an @ is found as first character on a new line - [^\\n]+ # Include anything else + [^\n]+ + (?: \n+ + (?! [ \t]* @\pL ) # End description when an @ is found as first character on a new line + [^\n]+ # Include anything else )* ) )? # 4. Extract the tags (anything that follows) - (\\s+ [\\s\\S]*)? # everything that follows + (\s+ [\s\S]*)? # everything that follows /ux', $comment, $matches); array_shift($matches); while (count($matches) < 4) { @@ -37646,7 +40418,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface * * @return DocBlock\Tag[] */ - private function parseTagBlock(string $tags, Types\Context $context) : array + private function parseTagBlock(string $tags, Types\Context $context): array { $tags = $this->filterTagBlock($tags); if ($tags === null) { @@ -37662,7 +40434,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface /** * @return string[] */ - private function splitTagBlockIntoTagLines(string $tags) : array + private function splitTagBlockIntoTagLines(string $tags): array { $result = []; foreach (explode("\n", $tags) as $tagLine) { @@ -37674,7 +40446,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface } return $result; } - private function filterTagBlock(string $tags) : ?string + private function filterTagBlock(string $tags): ?string { $tags = trim($tags); if (!$tags) { @@ -37693,9 +40465,9 @@ final class DocBlockFactory implements DocBlockFactoryInterface > $additionalTags */ - public static function createInstance(array $additionalTags = []) : DocBlockFactory; + public static function createInstance(array $additionalTags = []): DocBlockFactory; /** * @param string|object $docblock */ - public function create($docblock, ?Types\Context $context = null, ?Location $location = null) : DocBlock; + public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock; } getNamespaceAliases(); @@ -37920,11 +40692,107 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection; +namespace PHPUnitPHAR\phpDocumentor\Reflection; interface PseudoType extends Type { - public function underlyingType() : Type; + public function underlyingType(): Type; +} +items = $items; + } + /** + * @return ArrayShapeItem[] + */ + public function getItems(): array + { + return $this->items; + } + public function underlyingType(): Type + { + return new Array_(new Mixed_(), new ArrayKey()); + } + public function __toString(): string + { + return 'array{' . implode(', ', $this->items) . '}'; + } +} +key = $key; + $this->value = $value ?? new Mixed_(); + $this->optional = $optional; + } + public function getKey(): ?string + { + return $this->key; + } + public function getValue(): Type + { + return $this->value; + } + public function isOptional(): bool + { + return $this->optional; + } + public function __toString(): string + { + if ($this->key !== null) { + return sprintf('%s%s: %s', $this->key, $this->optional ? '?' : '', (string) $this->value); + } + return (string) $this->value; + } } owner = $owner; + $this->expression = $expression; + } + public function getOwner(): Type + { + return $this->owner; + } + public function getExpression(): string + { + return $this->expression; + } + public function underlyingType(): Type + { + return new Mixed_(); + } + public function __toString(): string + { + return sprintf('%s::%s', (string) $this->owner, $this->expression); + } +} +value = $value; + } + public function getValue(): float + { + return $this->value; + } + public function underlyingType(): Type + { + return new Float_(); + } + public function __toString(): string + { + return (string) $this->value; + } +} minValue = $minValue; $this->maxValue = $maxValue; } - public function underlyingType() : Type + public function underlyingType(): Type { return new Integer(); } - public function getMinValue() : string + public function getMinValue(): string { return $this->minValue; } - public function getMaxValue() : string + public function getMaxValue(): string { return $this->maxValue; } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'int<' . $this->minValue . ', ' . $this->maxValue . '>'; } } value = $value; + } + public function getValue(): int + { + return $this->value; + } + public function underlyingType(): Type + { + return new Integer(); + } + public function __toString(): string + { + return (string) $this->value; + } +} +valueType instanceof Mixed_) { return 'list'; @@ -38137,11 +41130,11 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\PseudoTypes; +namespace PHPUnitPHAR\phpDocumentor\Reflection\PseudoTypes; -use PHPUnit\phpDocumentor\Reflection\PseudoType; -use PHPUnit\phpDocumentor\Reflection\Type; -use PHPUnit\phpDocumentor\Reflection\Types\String_; +use PHPUnitPHAR\phpDocumentor\Reflection\PseudoType; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\String_; /** * Value Object representing the type 'string'. * @@ -38149,14 +41142,14 @@ use PHPUnit\phpDocumentor\Reflection\Types\String_; */ final class LiteralString extends String_ implements PseudoType { - public function underlyingType() : Type + public function underlyingType(): Type { return new String_(); } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'literal-string'; } @@ -38172,11 +41165,11 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\PseudoTypes; +namespace PHPUnitPHAR\phpDocumentor\Reflection\PseudoTypes; -use PHPUnit\phpDocumentor\Reflection\PseudoType; -use PHPUnit\phpDocumentor\Reflection\Type; -use PHPUnit\phpDocumentor\Reflection\Types\String_; +use PHPUnitPHAR\phpDocumentor\Reflection\PseudoType; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\String_; /** * Value Object representing the type 'string'. * @@ -38184,14 +41177,14 @@ use PHPUnit\phpDocumentor\Reflection\Types\String_; */ final class LowercaseString extends String_ implements PseudoType { - public function underlyingType() : Type + public function underlyingType(): Type { return new String_(); } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'lowercase-string'; } @@ -38207,11 +41200,11 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\PseudoTypes; +namespace PHPUnitPHAR\phpDocumentor\Reflection\PseudoTypes; -use PHPUnit\phpDocumentor\Reflection\PseudoType; -use PHPUnit\phpDocumentor\Reflection\Type; -use PHPUnit\phpDocumentor\Reflection\Types\Integer; +use PHPUnitPHAR\phpDocumentor\Reflection\PseudoType; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Integer; /** * Value Object representing the type 'int'. * @@ -38219,14 +41212,14 @@ use PHPUnit\phpDocumentor\Reflection\Types\Integer; */ final class NegativeInteger extends Integer implements PseudoType { - public function underlyingType() : Type + public function underlyingType(): Type { return new Integer(); } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'negative-int'; } @@ -38242,11 +41235,55 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\PseudoTypes; +namespace PHPUnitPHAR\phpDocumentor\Reflection\PseudoTypes; + +use PHPUnitPHAR\phpDocumentor\Reflection\PseudoType; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Array_; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Integer; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\Mixed_; +/** + * Value Object representing the type 'non-empty-list'. + * + * @psalm-immutable + */ +final class NonEmptyList extends Array_ implements PseudoType +{ + public function underlyingType(): Type + { + return new Array_(); + } + public function __construct(?Type $valueType = null) + { + parent::__construct($valueType, new Integer()); + } + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + */ + public function __toString(): string + { + if ($this->valueType instanceof Mixed_) { + return 'non-empty-list'; + } + return 'non-empty-list<' . $this->valueType . '>'; + } +} +value = $value; + } + public function getValue(): string + { + return $this->value; + } + public function underlyingType(): Type + { + return new String_(); + } + public function __toString(): string + { + return sprintf('"%s"', $this->value); + } +} + List of recognized keywords and unto which Value Object they map * @psalm-var array> */ - private $keywords = ['string' => Types\String_::class, 'class-string' => Types\ClassString::class, 'interface-string' => Types\InterfaceString::class, 'html-escaped-string' => PseudoTypes\HtmlEscapedString::class, 'lowercase-string' => PseudoTypes\LowercaseString::class, 'non-empty-lowercase-string' => PseudoTypes\NonEmptyLowercaseString::class, 'non-empty-string' => PseudoTypes\NonEmptyString::class, 'numeric-string' => PseudoTypes\NumericString::class, 'numeric' => PseudoTypes\Numeric_::class, 'trait-string' => PseudoTypes\TraitString::class, 'int' => Types\Integer::class, 'integer' => Types\Integer::class, 'positive-int' => PseudoTypes\PositiveInteger::class, 'negative-int' => PseudoTypes\NegativeInteger::class, 'bool' => Types\Boolean::class, 'boolean' => Types\Boolean::class, 'real' => Types\Float_::class, 'float' => Types\Float_::class, 'double' => Types\Float_::class, 'object' => Types\Object_::class, 'mixed' => Types\Mixed_::class, 'array' => Types\Array_::class, 'array-key' => Types\ArrayKey::class, 'resource' => Types\Resource_::class, 'void' => Types\Void_::class, 'null' => Types\Null_::class, 'scalar' => Types\Scalar::class, 'callback' => Types\Callable_::class, 'callable' => Types\Callable_::class, 'callable-string' => PseudoTypes\CallableString::class, 'false' => PseudoTypes\False_::class, 'true' => PseudoTypes\True_::class, 'literal-string' => PseudoTypes\LiteralString::class, 'self' => Types\Self_::class, '$this' => Types\This::class, 'static' => Types\Static_::class, 'parent' => Types\Parent_::class, 'iterable' => Types\Iterable_::class, 'never' => Types\Never_::class, 'list' => PseudoTypes\List_::class]; + private $keywords = ['string' => String_::class, 'class-string' => ClassString::class, 'interface-string' => InterfaceString::class, 'html-escaped-string' => HtmlEscapedString::class, 'lowercase-string' => LowercaseString::class, 'non-empty-lowercase-string' => NonEmptyLowercaseString::class, 'non-empty-string' => NonEmptyString::class, 'numeric-string' => NumericString::class, 'numeric' => Numeric_::class, 'trait-string' => TraitString::class, 'int' => Integer::class, 'integer' => Integer::class, 'positive-int' => PositiveInteger::class, 'negative-int' => NegativeInteger::class, 'bool' => Boolean::class, 'boolean' => Boolean::class, 'real' => Float_::class, 'float' => Float_::class, 'double' => Float_::class, 'object' => Object_::class, 'mixed' => Mixed_::class, 'array' => Array_::class, 'array-key' => ArrayKey::class, 'resource' => Resource_::class, 'void' => Void_::class, 'null' => Null_::class, 'scalar' => Scalar::class, 'callback' => Callable_::class, 'callable' => Callable_::class, 'callable-string' => CallableString::class, 'false' => False_::class, 'true' => True_::class, 'literal-string' => LiteralString::class, 'self' => Self_::class, '$this' => This::class, 'static' => Static_::class, 'parent' => Parent_::class, 'iterable' => Iterable_::class, 'never' => Never_::class, 'list' => List_::class, 'non-empty-list' => NonEmptyList::class]; /** - * @var FqsenResolver * @psalm-readonly + * @var FqsenResolver */ private $fqsenResolver; + /** + * @psalm-readonly + * @var TypeParser + */ + private $typeParser; + /** + * @psalm-readonly + * @var Lexer + */ + private $lexer; /** * Initializes this TypeResolver with the means to create and resolve Fqsen objects. */ public function __construct(?FqsenResolver $fqsenResolver = null) { $this->fqsenResolver = $fqsenResolver ?: new FqsenResolver(); + $this->typeParser = new TypeParser(new ConstExprParser()); + $this->lexer = new Lexer(); } /** * Analyzes the given type and returns the FQCN variant. @@ -38595,13 +41729,13 @@ final class TypeResolver * This method only works as expected if the namespace and aliases are set; * no dynamic reflection is being performed here. * + * @uses Context::getNamespace() to determine with what to prefix the type name. * @uses Context::getNamespaceAliases() to check whether the first part of the relative type name should not be * replaced with another namespace. - * @uses Context::getNamespace() to determine with what to prefix the type name. * * @param string $type The relative or absolute type. */ - public function resolve(string $type, ?Context $context = null) : Type + public function resolve(string $type, ?Context $context = null): Type { $type = trim($type); if (!$type) { @@ -38610,121 +41744,120 @@ final class TypeResolver if ($context === null) { $context = new Context(''); } - // split the type string into tokens `|`, `?`, `<`, `>`, `,`, `(`, `)`, `[]`, '<', '>' and type names - $tokens = preg_split('/(\\||\\?|<|>|&|, ?|\\(|\\)|\\[\\]+)/', $type, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); - if ($tokens === \false) { - throw new InvalidArgumentException('Unable to split the type string "' . $type . '" into tokens'); + $tokens = $this->lexer->tokenize($type); + $tokenIterator = new TokenIterator($tokens); + $ast = $this->parse($tokenIterator); + $type = $this->createType($ast, $context); + return $this->tryParseRemainingCompoundTypes($tokenIterator, $context, $type); + } + public function createType(?TypeNode $type, Context $context): Type + { + if ($type === null) { + return new Mixed_(); + } + switch (get_class($type)) { + case ArrayTypeNode::class: + return new Array_($this->createType($type->type, $context)); + case ArrayShapeNode::class: + return new ArrayShape(...array_map(function (ArrayShapeItemNode $item) use ($context): ArrayShapeItem { + return new ArrayShapeItem((string) $item->keyName, $this->createType($item->valueType, $context), $item->optional); + }, $type->items)); + case CallableTypeNode::class: + return $this->createFromCallable($type, $context); + case ConstTypeNode::class: + return $this->createFromConst($type, $context); + case GenericTypeNode::class: + return $this->createFromGeneric($type, $context); + case IdentifierTypeNode::class: + return $this->resolveSingleType($type->name, $context); + case IntersectionTypeNode::class: + return new Intersection(array_filter(array_map(function (TypeNode $nestedType) use ($context): Type { + $type = $this->createType($nestedType, $context); + if ($type instanceof AggregatedType) { + return new Expression($type); + } + return $type; + }, $type->types))); + case NullableTypeNode::class: + $nestedType = $this->createType($type->type, $context); + return new Nullable($nestedType); + case UnionTypeNode::class: + return new Compound(array_filter(array_map(function (TypeNode $nestedType) use ($context): Type { + $type = $this->createType($nestedType, $context); + if ($type instanceof AggregatedType) { + return new Expression($type); + } + return $type; + }, $type->types))); + case ThisTypeNode::class: + return new This(); + case ConditionalTypeNode::class: + case ConditionalTypeForParameterNode::class: + case OffsetAccessTypeNode::class: + default: + return new Mixed_(); } - /** @var ArrayIterator $tokenIterator */ - $tokenIterator = new ArrayIterator($tokens); - return $this->parseTypes($tokenIterator, $context, self::PARSER_IN_COMPOUND); } - /** - * Analyse each tokens and creates types - * - * @param ArrayIterator $tokens the iterator on tokens - * @param int $parserContext on of self::PARSER_* constants, indicating - * the context where we are in the parsing - */ - private function parseTypes(ArrayIterator $tokens, Context $context, int $parserContext) : Type + private function createFromGeneric(GenericTypeNode $type, Context $context): Type { - $types = []; - $token = ''; - $compoundToken = '|'; - while ($tokens->valid()) { - $token = $tokens->current(); - if ($token === null) { - throw new RuntimeException('Unexpected nullable character'); - } - if ($token === '|' || $token === '&') { - if (count($types) === 0) { - throw new RuntimeException('A type is missing before a type separator'); - } - if (!in_array($parserContext, [self::PARSER_IN_COMPOUND, self::PARSER_IN_ARRAY_EXPRESSION, self::PARSER_IN_COLLECTION_EXPRESSION], \true)) { - throw new RuntimeException('Unexpected type separator'); - } - $compoundToken = $token; - $tokens->next(); - } elseif ($token === '?') { - if (!in_array($parserContext, [self::PARSER_IN_COMPOUND, self::PARSER_IN_ARRAY_EXPRESSION, self::PARSER_IN_COLLECTION_EXPRESSION], \true)) { - throw new RuntimeException('Unexpected nullable character'); - } - $tokens->next(); - $type = $this->parseTypes($tokens, $context, self::PARSER_IN_NULLABLE); - $types[] = new Nullable($type); - } elseif ($token === '(') { - $tokens->next(); - $type = $this->parseTypes($tokens, $context, self::PARSER_IN_ARRAY_EXPRESSION); - $token = $tokens->current(); - if ($token === null) { - // Someone did not properly close their array expression .. - break; - } - $tokens->next(); - $resolvedType = new Expression($type); - $types[] = $resolvedType; - } elseif ($parserContext === self::PARSER_IN_ARRAY_EXPRESSION && isset($token[0]) && $token[0] === ')') { - break; - } elseif ($token === '<') { - if (count($types) === 0) { - throw new RuntimeException('Unexpected collection operator "<", class name is missing'); - } - $classType = array_pop($types); - if ($classType !== null) { - if ((string) $classType === 'class-string') { - $types[] = $this->resolveClassString($tokens, $context); - } elseif ((string) $classType === 'int') { - $types[] = $this->resolveIntRange($tokens); - } elseif ((string) $classType === 'interface-string') { - $types[] = $this->resolveInterfaceString($tokens, $context); - } else { - $types[] = $this->resolveCollection($tokens, $classType, $context); - } + switch (strtolower($type->type->name)) { + case 'array': + return $this->createArray($type->genericTypes, $context); + case 'class-string': + $subType = $this->createType($type->genericTypes[0], $context); + if (!$subType instanceof Object_ || $subType->getFqsen() === null) { + throw new RuntimeException($subType . ' is not a class string'); } - $tokens->next(); - } elseif ($parserContext === self::PARSER_IN_COLLECTION_EXPRESSION && ($token === '>' || trim($token) === ',')) { - break; - } elseif ($token === self::OPERATOR_ARRAY) { - end($types); - $last = key($types); - if ($last === null) { - throw new InvalidArgumentException('Unexpected array operator'); + return new ClassString($subType->getFqsen()); + case 'interface-string': + $subType = $this->createType($type->genericTypes[0], $context); + if (!$subType instanceof Object_ || $subType->getFqsen() === null) { + throw new RuntimeException($subType . ' is not a class string'); } - $lastItem = $types[$last]; - if ($lastItem instanceof Expression) { - $lastItem = $lastItem->getValueType(); + return new InterfaceString($subType->getFqsen()); + case 'list': + return new List_($this->createType($type->genericTypes[0], $context)); + case 'non-empty-list': + return new NonEmptyList($this->createType($type->genericTypes[0], $context)); + case 'int': + if (isset($type->genericTypes[1]) === \false) { + throw new RuntimeException('int has not the correct format'); } - $types[$last] = new Array_($lastItem); - $tokens->next(); - } else { - $type = $this->resolveSingleType($token, $context); - $tokens->next(); - if ($parserContext === self::PARSER_IN_NULLABLE) { - return $type; + return new IntegerRange((string) $type->genericTypes[0], (string) $type->genericTypes[1]); + case 'iterable': + return new Iterable_(...array_reverse(array_map(function (TypeNode $genericType) use ($context): Type { + return $this->createType($genericType, $context); + }, $type->genericTypes))); + default: + $collectionType = $this->createType($type->type, $context); + if ($collectionType instanceof Object_ === \false) { + throw new RuntimeException(sprintf('%s is not a collection', (string) $collectionType)); } - $types[] = $type; - } + return new Collection($collectionType->getFqsen(), ...array_reverse(array_map(function (TypeNode $genericType) use ($context): Type { + return $this->createType($genericType, $context); + }, $type->genericTypes))); } - if ($token === '|' || $token === '&') { - throw new RuntimeException('A type is missing after a type separator'); - } - if (count($types) === 0) { - if ($parserContext === self::PARSER_IN_NULLABLE) { - throw new RuntimeException('A type is missing after a nullable character'); - } - if ($parserContext === self::PARSER_IN_ARRAY_EXPRESSION) { - throw new RuntimeException('A type is missing in an array expression'); - } - if ($parserContext === self::PARSER_IN_COLLECTION_EXPRESSION) { - throw new RuntimeException('A type is missing in a collection expression'); - } - } elseif (count($types) === 1) { - return current($types); - } - if ($compoundToken === '|') { - return new Compound(array_values($types)); + } + private function createFromCallable(CallableTypeNode $type, Context $context): Callable_ + { + return new Callable_(array_map(function (CallableTypeParameterNode $param) use ($context): CallableParameter { + return new CallableParameter($this->createType($param->type, $context), ($param->parameterName !== '') ? trim($param->parameterName, '$') : null, $param->isReference, $param->isVariadic, $param->isOptional); + }, $type->parameters), $this->createType($type->returnType, $context)); + } + private function createFromConst(ConstTypeNode $type, Context $context): Type + { + switch (\true) { + case $type->constExpr instanceof ConstExprIntegerNode: + return new IntegerValue((int) $type->constExpr->value); + case $type->constExpr instanceof ConstExprFloatNode: + return new FloatValue((float) $type->constExpr->value); + case $type->constExpr instanceof ConstExprStringNode: + return new StringValue($type->constExpr->value); + case $type->constExpr instanceof ConstFetchNode: + return new ConstExpression($this->resolve($type->constExpr->className, $context), $type->constExpr->name); + default: + throw new RuntimeException(sprintf('Unsupported constant type %s', get_class($type))); } - return new Intersection(array_values($types)); } /** * resolve the given type into a type object @@ -38735,7 +41868,7 @@ final class TypeResolver * * @psalm-mutation-free */ - private function resolveSingleType(string $type, Context $context) : object + private function resolveSingleType(string $type, Context $context): object { switch (\true) { case $this->isKeyword($type): @@ -38756,7 +41889,7 @@ final class TypeResolver * * @psalm-param class-string $typeClassName */ - public function addKeyword(string $keyword, string $typeClassName) : void + public function addKeyword(string $keyword, string $typeClassName): void { if (!class_exists($typeClassName)) { throw new InvalidArgumentException('The Value Object that needs to be created with a keyword "' . $keyword . '" must be an existing class' . ' but we could not find the class ' . $typeClassName); @@ -38766,7 +41899,7 @@ final class TypeResolver throw new InvalidArgumentException('The Value Object that needs to be created with a keyword "' . $keyword . '" must be an existing class' . ' but we could not find the class ' . $typeClassName); } if (!in_array(Type::class, $interfaces, \true)) { - throw new InvalidArgumentException('The class "' . $typeClassName . '" must implement the interface "phpDocumentor\\Reflection\\Type"'); + throw new InvalidArgumentException('The class "' . $typeClassName . '" must implement the interface "phpDocumentor\Reflection\Type"'); } $this->keywords[$keyword] = $typeClassName; } @@ -38777,7 +41910,7 @@ final class TypeResolver * * @psalm-mutation-free */ - private function isKeyword(string $type) : bool + private function isKeyword(string $type): bool { return array_key_exists(strtolower($type), $this->keywords); } @@ -38788,7 +41921,7 @@ final class TypeResolver * * @psalm-mutation-free */ - private function isPartialStructuralElementName(string $type) : bool + private function isPartialStructuralElementName(string $type): bool { return isset($type[0]) && $type[0] !== self::OPERATOR_NAMESPACE && !$this->isKeyword($type); } @@ -38797,7 +41930,7 @@ final class TypeResolver * * @psalm-mutation-free */ - private function isFqsen(string $type) : bool + private function isFqsen(string $type): bool { return strpos($type, self::OPERATOR_NAMESPACE) === 0; } @@ -38806,7 +41939,7 @@ final class TypeResolver * * @psalm-mutation-free */ - private function resolveKeyword(string $type) : Type + private function resolveKeyword(string $type): Type { $className = $this->keywords[strtolower($type)]; return new $className(); @@ -38816,169 +41949,71 @@ final class TypeResolver * * @psalm-mutation-free */ - private function resolveTypedObject(string $type, ?Context $context = null) : Object_ + private function resolveTypedObject(string $type, ?Context $context = null): Object_ { return new Object_($this->fqsenResolver->resolve($type, $context)); } - /** - * Resolves class string - * - * @param ArrayIterator $tokens - */ - private function resolveClassString(ArrayIterator $tokens, Context $context) : Type + /** @param TypeNode[] $typeNodes */ + private function createArray(array $typeNodes, Context $context): Array_ { - $tokens->next(); - $classType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION); - if (!$classType instanceof Object_ || $classType->getFqsen() === null) { - throw new RuntimeException($classType . ' is not a class string'); + $types = array_reverse(array_map(function (TypeNode $node) use ($context): Type { + return $this->createType($node, $context); + }, $typeNodes)); + if (isset($types[1]) === \false) { + return new Array_(...$types); } - $token = $tokens->current(); - if ($token !== '>') { - if (empty($token)) { - throw new RuntimeException('class-string: ">" is missing'); + if ($this->validArrayKeyType($types[1]) || $types[1] instanceof ArrayKey) { + return new Array_(...$types); + } + if ($types[1] instanceof Compound && $types[1]->getIterator()->count() === 2) { + if ($this->validArrayKeyType($types[1]->get(0)) && $this->validArrayKeyType($types[1]->get(1))) { + return new Array_(...$types); } - throw new RuntimeException('Unexpected character "' . $token . '", ">" is missing'); } - return new ClassString($classType->getFqsen()); + throw new RuntimeException('An array can have only integers or strings as keys'); } - /** - * Resolves integer ranges - * - * @param ArrayIterator $tokens - */ - private function resolveIntRange(ArrayIterator $tokens) : Type + private function validArrayKeyType(?Type $type): bool { - $tokens->next(); - $token = ''; - $minValue = null; - $maxValue = null; - $commaFound = \false; - $tokenCounter = 0; - while ($tokens->valid()) { - $tokenCounter++; - $token = $tokens->current(); - if ($token === null) { - throw new RuntimeException('Unexpected nullable character'); - } - $token = trim($token); - if ($token === '>') { - break; - } - if ($token === ',') { - $commaFound = \true; - } - if ($commaFound === \false && $minValue === null) { - if (is_numeric($token) || $token === 'max' || $token === 'min') { - $minValue = $token; - } - } - if ($commaFound === \true && $maxValue === null) { - if (is_numeric($token) || $token === 'max' || $token === 'min') { - $maxValue = $token; - } - } - $tokens->next(); - } - if ($token !== '>') { - if (empty($token)) { - throw new RuntimeException('interface-string: ">" is missing'); - } - throw new RuntimeException('Unexpected character "' . $token . '", ">" is missing'); - } - if ($minValue === null || $maxValue === null || $tokenCounter > 4) { - throw new RuntimeException('int has not the correct format'); - } - return new IntegerRange($minValue, $maxValue); + return $type instanceof String_ || $type instanceof Integer; } - /** - * Resolves class string - * - * @param ArrayIterator $tokens - */ - private function resolveInterfaceString(ArrayIterator $tokens, Context $context) : Type + private function parse(TokenIterator $tokenIterator): TypeNode { - $tokens->next(); - $classType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION); - if (!$classType instanceof Object_ || $classType->getFqsen() === null) { - throw new RuntimeException($classType . ' is not a interface string'); - } - $token = $tokens->current(); - if ($token !== '>') { - if (empty($token)) { - throw new RuntimeException('interface-string: ">" is missing'); - } - throw new RuntimeException('Unexpected character "' . $token . '", ">" is missing'); + try { + $ast = $this->typeParser->parse($tokenIterator); + } catch (ParserException $e) { + throw new RuntimeException($e->getMessage(), 0, $e); } - return new InterfaceString($classType->getFqsen()); + return $ast; } /** - * Resolves the collection values and keys + * Will try to parse unsupported type notations by phpstan * - * @param ArrayIterator $tokens - * - * @return Array_|Iterable_|Collection + * The phpstan parser doesn't support the illegal nullable combinations like this library does. + * This method will warn the user about those notations but for bc purposes we will still have it here. */ - private function resolveCollection(ArrayIterator $tokens, Type $classType, Context $context) : Type + private function tryParseRemainingCompoundTypes(TokenIterator $tokenIterator, Context $context, Type $type): Type { - $isArray = (string) $classType === 'array'; - $isIterable = (string) $classType === 'iterable'; - $isList = (string) $classType === 'list'; - // allow only "array", "iterable" or class name before "<" - if (!$isArray && !$isIterable && !$isList && (!$classType instanceof Object_ || $classType->getFqsen() === null)) { - throw new RuntimeException($classType . ' is not a collection'); + if ($tokenIterator->isCurrentTokenType(Lexer::TOKEN_UNION) || $tokenIterator->isCurrentTokenType(Lexer::TOKEN_INTERSECTION)) { + Deprecation::trigger('phpdocumentor/type-resolver', 'https://github.com/phpDocumentor/TypeResolver/issues/184', 'Legacy nullable type detected, please update your code as + you are using nullable types in a docblock. support will be removed in v2.0.0'); } - $tokens->next(); - $valueType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION); - $keyType = null; - $token = $tokens->current(); - if ($token !== null && trim($token) === ',' && !$isList) { - // if we have a comma, then we just parsed the key type, not the value type - $keyType = $valueType; - if ($isArray) { - // check the key type for an "array" collection. We allow only - // strings or integers. - if (!$keyType instanceof ArrayKey && !$keyType instanceof String_ && !$keyType instanceof Integer && !$keyType instanceof Compound) { - throw new RuntimeException('An array can have only integers or strings as keys'); - } - if ($keyType instanceof Compound) { - foreach ($keyType->getIterator() as $item) { - if (!$item instanceof ArrayKey && !$item instanceof String_ && !$item instanceof Integer) { - throw new RuntimeException('An array can have only integers or strings as keys'); - } - } - } + $continue = \true; + while ($continue) { + $continue = \false; + while ($tokenIterator->tryConsumeTokenType(Lexer::TOKEN_UNION)) { + $ast = $this->parse($tokenIterator); + $type2 = $this->createType($ast, $context); + $type = new Compound([$type, $type2]); + $continue = \true; } - $tokens->next(); - // now let's parse the value type - $valueType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION); - } - $token = $tokens->current(); - if ($token !== '>') { - if (empty($token)) { - throw new RuntimeException('Collection: ">" is missing'); + while ($tokenIterator->tryConsumeTokenType(Lexer::TOKEN_INTERSECTION)) { + $ast = $this->typeParser->parse($tokenIterator); + $type2 = $this->createType($ast, $context); + $type = new Intersection([$type, $type2]); + $continue = \true; } - throw new RuntimeException('Unexpected character "' . $token . '", ">" is missing'); - } - if ($isArray) { - return new Array_($valueType, $keyType); - } - if ($isIterable) { - return new Iterable_($valueType, $keyType); - } - if ($isList) { - return new List_($valueType); } - if ($classType instanceof Object_) { - return $this->makeCollectionFromObject($classType, $valueType, $keyType); - } - throw new RuntimeException('Invalid $classType provided'); - } - /** - * @psalm-pure - */ - private function makeCollectionFromObject(Object_ $object, Type $valueType, ?Type $keyType = null) : Collection - { - return new Collection($object->getFqsen(), $valueType, $keyType); + return $type; } } keyType ?? $this->defaultKeyType; } /** - * Returns the value for the keys of this array. + * Returns the type for the values of this array. */ - public function getValueType() : Type + public function getValueType(): Type { return $this->valueType; } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { if ($this->keyType) { return 'array<' . $this->keyType . ',' . $this->valueType . '>'; @@ -39062,11 +42097,11 @@ abstract class AbstractList implements Type * @link http://phpdoc.org */ declare (strict_types=1); -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; use ArrayIterator; use IteratorAggregate; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; use function array_key_exists; use function implode; /** @@ -39100,7 +42135,7 @@ abstract class AggregatedType implements Type, IteratorAggregate /** * Returns the type at the given index. */ - public function get(int $index) : ?Type + public function get(int $index): ?Type { if (!$this->has($index)) { return null; @@ -39110,14 +42145,14 @@ abstract class AggregatedType implements Type, IteratorAggregate /** * Tests if this compound type has a type with the given index. */ - public function has(int $index) : bool + public function has(int $index): bool { return array_key_exists($index, $this->types); } /** * Tests if this compound type contains the given type. */ - public function contains(Type $type) : bool + public function contains(Type $type): bool { foreach ($this->types as $typePart) { // if the type is duplicate; do not add it @@ -39130,23 +42165,23 @@ abstract class AggregatedType implements Type, IteratorAggregate /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return implode($this->token, $this->types); } /** * @return ArrayIterator */ - public function getIterator() : ArrayIterator + public function getIterator(): ArrayIterator { return new ArrayIterator($this->types); } /** * @psalm-suppress ImpureMethodCall */ - private function add(Type $type) : void + private function add(Type $type): void { - if ($type instanceof self) { + if ($type instanceof static) { foreach ($type->getIterator() as $subType) { $this->add($subType); } @@ -39170,10 +42205,10 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\PseudoType; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\PseudoType; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing a array-key Type. * @@ -39187,11 +42222,11 @@ final class ArrayKey extends AggregatedType implements PseudoType { parent::__construct([new String_(), new Integer()], '|'); } - public function underlyingType() : Type + public function underlyingType(): Type { return new Compound([new String_(), new Integer()]); } - public function __toString() : string + public function __toString(): string { return 'array-key'; } @@ -39207,7 +42242,7 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; /** * Represents an array type as described in the PSR-5, the PHPDoc Standard. @@ -39234,9 +42269,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing a Boolean type. * @@ -39247,13 +42282,73 @@ class Boolean implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'bool'; } } type = $type; + $this->isReference = $isReference; + $this->isVariadic = $isVariadic; + $this->isOptional = $isOptional; + $this->name = $name; + } + public function getName(): ?string + { + return $this->name; + } + public function getType(): Type + { + return $this->type; + } + public function isReference(): bool + { + return $this->isReference; + } + public function isVariadic(): bool + { + return $this->isVariadic; + } + public function isOptional(): bool + { + return $this->isOptional; + } +} +parameters = $parameters; + $this->returnType = $returnType; + } + /** @return CallableParameter[] */ + public function getParameters(): array + { + return $this->parameters; + } + public function getReturnType(): ?Type + { + return $this->returnType; + } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'callable'; } @@ -39292,11 +42408,11 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Fqsen; -use PHPUnit\phpDocumentor\Reflection\PseudoType; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Fqsen; +use PHPUnitPHAR\phpDocumentor\Reflection\PseudoType; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the type 'string'. * @@ -39313,21 +42429,21 @@ final class ClassString extends String_ implements PseudoType { $this->fqsen = $fqsen; } - public function underlyingType() : Type + public function underlyingType(): Type { return new String_(); } /** * Returns the FQSEN associated with this object. */ - public function getFqsen() : ?Fqsen + public function getFqsen(): ?Fqsen { return $this->fqsen; } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { if ($this->fqsen === null) { return 'class-string'; @@ -39346,10 +42462,10 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Fqsen; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Fqsen; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Represents a collection type as described in the PSR-5, the PHPDoc Standard. * @@ -39378,14 +42494,14 @@ final class Collection extends AbstractList /** * Returns the FQSEN associated with this object. */ - public function getFqsen() : ?Fqsen + public function getFqsen(): ?Fqsen { return $this->fqsen; } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { $objectType = (string) ($this->fqsen ?? 'object'); if ($this->keyType === null) { @@ -39405,9 +42521,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing a Compound Type. * @@ -39440,7 +42556,7 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; use function strlen; use function substr; @@ -39480,7 +42596,7 @@ final class Context */ public function __construct(string $namespace, array $namespaceAliases = []) { - $this->namespace = $namespace !== 'global' && $namespace !== 'default' ? trim($namespace, '\\') : ''; + $this->namespace = ($namespace !== 'global' && $namespace !== 'default') ? trim($namespace, '\\') : ''; foreach ($namespaceAliases as $alias => $fqnn) { if ($fqnn[0] === '\\') { $fqnn = substr($fqnn, 1); @@ -39495,7 +42611,7 @@ final class Context /** * Returns the Qualified Namespace Name (thus without `\` in front) where the associated element is in. */ - public function getNamespace() : string + public function getNamespace(): string { return $this->namespace; } @@ -39506,7 +42622,7 @@ final class Context * @return string[] * @psalm-return array */ - public function getNamespaceAliases() : array + public function getNamespaceAliases(): array { return $this->namespaceAliases; } @@ -39522,7 +42638,7 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; use ArrayIterator; use InvalidArgumentException; @@ -39554,12 +42670,13 @@ use const T_NAME_QUALIFIED; use const T_NAMESPACE; use const T_NS_SEPARATOR; use const T_STRING; +use const T_TRAIT; use const T_USE; if (!defined('T_NAME_QUALIFIED')) { - define('T_NAME_QUALIFIED', 'T_NAME_QUALIFIED'); + define('T_NAME_QUALIFIED', 10001); } if (!defined('T_NAME_FULLY_QUALIFIED')) { - define('T_NAME_FULLY_QUALIFIED', 'T_NAME_FULLY_QUALIFIED'); + define('T_NAME_FULLY_QUALIFIED', 10002); } /** * Convenience class to create a Context for DocBlocks when not using the Reflection Component of phpDocumentor. @@ -39581,7 +42698,7 @@ final class ContextFactory * * @see Context for more information on Contexts. */ - public function createFromReflector(Reflector $reflector) : Context + public function createFromReflector(Reflector $reflector): Context { if ($reflector instanceof ReflectionClass) { //phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable @@ -39600,9 +42717,9 @@ final class ContextFactory if ($reflector instanceof ReflectionClassConstant) { return $this->createFromReflectionClassConstant($reflector); } - throw new UnexpectedValueException('Unhandled \\Reflector instance given: ' . get_class($reflector)); + throw new UnexpectedValueException('Unhandled \Reflector instance given: ' . get_class($reflector)); } - private function createFromReflectionParameter(ReflectionParameter $parameter) : Context + private function createFromReflectionParameter(ReflectionParameter $parameter): Context { $class = $parameter->getDeclaringClass(); if (!$class) { @@ -39610,17 +42727,17 @@ final class ContextFactory } return $this->createFromReflectionClass($class); } - private function createFromReflectionMethod(ReflectionMethod $method) : Context + private function createFromReflectionMethod(ReflectionMethod $method): Context { $class = $method->getDeclaringClass(); return $this->createFromReflectionClass($class); } - private function createFromReflectionProperty(ReflectionProperty $property) : Context + private function createFromReflectionProperty(ReflectionProperty $property): Context { $class = $property->getDeclaringClass(); return $this->createFromReflectionClass($class); } - private function createFromReflectionClassConstant(ReflectionClassConstant $constant) : Context + private function createFromReflectionClassConstant(ReflectionClassConstant $constant): Context { //phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable /** @phpstan-var ReflectionClass $class */ @@ -39630,7 +42747,7 @@ final class ContextFactory /** * @phpstan-param ReflectionClass $class */ - private function createFromReflectionClass(ReflectionClass $class) : Context + private function createFromReflectionClass(ReflectionClass $class): Context { $fileName = $class->getFileName(); $namespace = $class->getNamespaceName(); @@ -39652,7 +42769,7 @@ final class ContextFactory * this method first normalizes. * @param string $fileContents The file's contents to retrieve the aliases from with the given namespace. */ - public function createForNamespace(string $namespace, string $fileContents) : Context + public function createForNamespace(string $namespace, string $fileContents): Context { $namespace = trim($namespace, '\\'); $useStatements = []; @@ -39665,6 +42782,7 @@ final class ContextFactory $currentNamespace = $this->parseNamespace($tokens); break; case T_CLASS: + case T_TRAIT: // Fast-forward the iterator through the class so that any // T_USE tokens found within are skipped - these are not // valid namespace use statements so should be ignored. @@ -39699,7 +42817,7 @@ final class ContextFactory * * @param ArrayIterator $tokens */ - private function parseNamespace(ArrayIterator $tokens) : string + private function parseNamespace(ArrayIterator $tokens): string { // skip to the first string or namespace separator $this->skipToNextStringOrNamespaceSeparator($tokens); @@ -39719,7 +42837,7 @@ final class ContextFactory * @return string[] * @psalm-return array */ - private function parseUseStatement(ArrayIterator $tokens) : array + private function parseUseStatement(ArrayIterator $tokens): array { $uses = []; while ($tokens->valid()) { @@ -39737,7 +42855,7 @@ final class ContextFactory * * @param ArrayIterator $tokens */ - private function skipToNextStringOrNamespaceSeparator(ArrayIterator $tokens) : void + private function skipToNextStringOrNamespaceSeparator(ArrayIterator $tokens): void { while ($tokens->valid()) { $currentToken = $tokens->current(); @@ -39764,7 +42882,7 @@ final class ContextFactory * * @psalm-suppress TypeDoesNotContainType */ - private function extractUseStatements(ArrayIterator $tokens) : array + private function extractUseStatements(ArrayIterator $tokens): array { $extractedUseStatements = []; $groupedNs = ''; @@ -39880,9 +42998,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Represents an expression type as described in the PSR-5, the PHPDoc Standard. * @@ -39902,14 +43020,14 @@ final class Expression implements Type /** * Returns the value for the keys of this array. */ - public function getValueType() : Type + public function getValueType(): Type { return $this->valueType; } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return '(' . $this->valueType . ')'; } @@ -39925,20 +43043,20 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing a Float. * * @psalm-immutable */ -final class Float_ implements Type +class Float_ implements Type { /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'float'; } @@ -39954,9 +43072,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value object representing Integer type * @@ -39967,7 +43085,7 @@ class Integer implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'int'; } @@ -39983,10 +43101,10 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Fqsen; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Fqsen; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the type 'string'. * @@ -40006,14 +43124,14 @@ final class InterfaceString implements Type /** * Returns the FQSEN associated with this object. */ - public function getFqsen() : ?Fqsen + public function getFqsen(): ?Fqsen { return $this->fqsen; } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { if ($this->fqsen === null) { return 'interface-string'; @@ -40032,9 +43150,9 @@ final class InterfaceString implements Type * @link http://phpdoc.org */ declare (strict_types=1); -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing a Compound Type. * @@ -40067,7 +43185,7 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; /** * Value Object representing iterable type @@ -40079,7 +43197,7 @@ final class Iterable_ extends AbstractList /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { if ($this->keyType) { return 'iterable<' . $this->keyType . ',' . $this->valueType . '>'; @@ -40101,9 +43219,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing an unknown, or mixed, type. * @@ -40114,7 +43232,7 @@ final class Mixed_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'mixed'; } @@ -40130,9 +43248,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the return-type 'never'. * @@ -40146,7 +43264,7 @@ final class Never_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'never'; } @@ -40162,9 +43280,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing a null value or type. * @@ -40175,7 +43293,7 @@ final class Null_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'null'; } @@ -40191,9 +43309,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing a nullable type. The real type is wrapped. * @@ -40213,14 +43331,14 @@ final class Nullable implements Type /** * Provide access to the actual type directly, if needed. */ - public function getActualType() : Type + public function getActualType(): Type { return $this->realType; } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return '?' . $this->realType->__toString(); } @@ -40236,11 +43354,11 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; use InvalidArgumentException; -use PHPUnit\phpDocumentor\Reflection\Fqsen; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Fqsen; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; use function strpos; /** * Value Object representing an object. @@ -40270,11 +43388,11 @@ final class Object_ implements Type /** * Returns the FQSEN associated with this object. */ - public function getFqsen() : ?Fqsen + public function getFqsen(): ?Fqsen { return $this->fqsen; } - public function __toString() : string + public function __toString(): string { if ($this->fqsen) { return (string) $this->fqsen; @@ -40293,9 +43411,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the 'parent' type. * @@ -40308,7 +43426,7 @@ final class Parent_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'parent'; } @@ -40324,9 +43442,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the 'resource' Type. * @@ -40337,7 +43455,7 @@ final class Resource_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'resource'; } @@ -40353,9 +43471,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the 'scalar' pseudo-type, which is either a string, integer, float or boolean. * @@ -40366,7 +43484,7 @@ final class Scalar implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'scalar'; } @@ -40382,9 +43500,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the 'self' type. * @@ -40397,7 +43515,7 @@ final class Self_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'self'; } @@ -40413,9 +43531,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the 'static' type. * @@ -40433,7 +43551,7 @@ final class Static_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'static'; } @@ -40449,9 +43567,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the type 'string'. * @@ -40462,7 +43580,7 @@ class String_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'string'; } @@ -40478,9 +43596,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the '$this' pseudo-type. * @@ -40494,7 +43612,7 @@ final class This implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return '$this'; } @@ -40510,9 +43628,9 @@ declare (strict_types=1); * * @link http://phpdoc.org */ -namespace PHPUnit\phpDocumentor\Reflection\Types; +namespace PHPUnitPHAR\phpDocumentor\Reflection\Types; -use PHPUnit\phpDocumentor\Reflection\Type; +use PHPUnitPHAR\phpDocumentor\Reflection\Type; /** * Value Object representing the return-type 'void'. * @@ -40526,7 +43644,7 @@ final class Void_ implements Type /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ - public function __toString() : string + public function __toString(): string { return 'void'; } @@ -40822,14 +43940,14 @@ class ArgumentsWildcard */ public function scoreArguments(array $arguments) { - if (0 == \count($arguments) && 0 == \count($this->tokens)) { + if (0 == count($arguments) && 0 == count($this->tokens)) { return 1; } - $arguments = \array_values($arguments); + $arguments = array_values($arguments); $totalScore = 0; foreach ($this->tokens as $i => $token) { $argument = isset($arguments[$i]) ? $arguments[$i] : null; - if (1 >= ($score = $token->scoreArgument($argument))) { + if (1 >= $score = $token->scoreArgument($argument)) { return \false; } $totalScore += $score; @@ -40837,7 +43955,7 @@ class ArgumentsWildcard return $totalScore; } } - if (\count($arguments) > \count($this->tokens)) { + if (count($arguments) > count($this->tokens)) { return \false; } return $totalScore; @@ -40850,7 +43968,7 @@ class ArgumentsWildcard public function __toString() { if (null === $this->string) { - $this->string = \implode(', ', \array_map(function ($token) { + $this->string = implode(', ', array_map(function ($token) { return (string) $token; }, $this->tokens)); } @@ -41000,7 +44118,7 @@ class ApproximateValueToken implements \Prophecy\Argument\Token\TokenInterface if (!\is_float($argument) && !\is_int($argument) && !\is_numeric($argument)) { return \false; } - return \round((float) $argument, $this->precision) === \round($this->value, $this->precision) ? 10 : \false; + return (round((float) $argument, $this->precision) === round($this->value, $this->precision)) ? 10 : \false; } /** * {@inheritdoc} @@ -41016,7 +44134,7 @@ class ApproximateValueToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('≅%s', \round($this->value, $this->precision)); + return sprintf('≅%s', round($this->value, $this->precision)); } } isCountable($argument) && $this->hasProperCount($argument) ? 6 : \false; + return ($this->isCountable($argument) && $this->hasProperCount($argument)) ? 6 : \false; } /** * Returns false. @@ -41073,7 +44191,7 @@ class ArrayCountToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('count(%s)', $this->count); + return sprintf('count(%s)', $this->count); } /** * Returns true if object is either array or instance of \Countable @@ -41085,7 +44203,7 @@ class ArrayCountToken implements \Prophecy\Argument\Token\TokenInterface */ private function isCountable($argument) { - return \is_array($argument) || $argument instanceof \Countable; + return is_array($argument) || $argument instanceof \Countable; } /** * Returns true if $argument has expected number of elements @@ -41096,7 +44214,7 @@ class ArrayCountToken implements \Prophecy\Argument\Token\TokenInterface */ private function hasProperCount($argument) { - return $this->count === \count($argument); + return $this->count === count($argument); } } convertArrayAccessToEntry($argument); } - if (!\is_array($argument) || empty($argument)) { + if (!is_array($argument) || empty($argument)) { return \false; } - $keyScores = \array_map(array($this->key, 'scoreArgument'), \array_keys($argument)); - $valueScores = \array_map(array($this->value, 'scoreArgument'), $argument); + $keyScores = array_map(array($this->key, 'scoreArgument'), array_keys($argument)); + $valueScores = array_map(array($this->value, 'scoreArgument'), $argument); /** @var callable(int|false, int|false): (int|false) $scoreEntry */ $scoreEntry = function ($value, $key) { - return $value && $key ? \min(8, ($key + $value) / 2) : \false; + return ($value && $key) ? min(8, ($key + $value) / 2) : \false; }; - return \max(\array_map($scoreEntry, $valueScores, $keyScores)); + return max(array_map($scoreEntry, $valueScores, $keyScores)); } /** * Returns false. @@ -41176,7 +44294,7 @@ class ArrayEntryToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('[..., %s => %s, ...]', $this->key, $this->value); + return sprintf('[..., %s => %s, ...]', $this->key, $this->value); } /** * Returns key @@ -41204,7 +44322,7 @@ class ArrayEntryToken implements \Prophecy\Argument\Token\TokenInterface */ private function wrapIntoExactValueToken($value) { - return $value instanceof \Prophecy\Argument\Token\TokenInterface ? $value : new \Prophecy\Argument\Token\ExactValueToken($value); + return ($value instanceof \Prophecy\Argument\Token\TokenInterface) ? $value : new \Prophecy\Argument\Token\ExactValueToken($value); } /** * Converts instance of \ArrayAccess to key => value array entry @@ -41217,11 +44335,11 @@ class ArrayEntryToken implements \Prophecy\Argument\Token\TokenInterface private function convertArrayAccessToEntry(\ArrayAccess $object) { if (!$this->key instanceof \Prophecy\Argument\Token\ExactValueToken) { - throw new InvalidArgumentException(\sprintf('You can only use exact value tokens to match key of ArrayAccess object' . \PHP_EOL . 'But you used `%s`.', $this->key)); + throw new InvalidArgumentException(sprintf('You can only use exact value tokens to match key of ArrayAccess object' . \PHP_EOL . 'But you used `%s`.', $this->key)); } $key = $this->key->getValue(); if (!\is_int($key) && !\is_string($key)) { - throw new InvalidArgumentException(\sprintf('You can only use integer or string keys to match key of ArrayAccess object' . \PHP_EOL . 'But you used `%s`.', $this->key)); + throw new InvalidArgumentException(sprintf('You can only use integer or string keys to match key of ArrayAccess object' . \PHP_EOL . 'But you used `%s`.', $this->key)); } return $object->offsetExists($key) ? array($key => $object[$key]) : array(); } @@ -41264,17 +44382,17 @@ class ArrayEveryEntryToken implements \Prophecy\Argument\Token\TokenInterface */ public function scoreArgument($argument) { - if (!$argument instanceof \Traversable && !\is_array($argument)) { + if (!$argument instanceof \Traversable && !is_array($argument)) { return \false; } $scores = array(); foreach ($argument as $key => $argumentEntry) { $scores[] = $this->value->scoreArgument($argumentEntry); } - if (empty($scores) || \in_array(\false, $scores, \true)) { + if (empty($scores) || in_array(\false, $scores, \true)) { return \false; } - return \array_sum($scores) / \count($scores); + return array_sum($scores) / count($scores); } /** * {@inheritdoc} @@ -41288,7 +44406,7 @@ class ArrayEveryEntryToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('[%s, ..., %s]', $this->value, $this->value); + return sprintf('[%s, ..., %s]', $this->value, $this->value); } /** * @return TokenInterface @@ -41333,8 +44451,8 @@ class CallbackToken implements \Prophecy\Argument\Token\TokenInterface */ public function __construct($callback, ?string $customStringRepresentation = null) { - if (!\is_callable($callback)) { - throw new InvalidArgumentException(\sprintf('Callable expected as an argument to CallbackToken, but got %s.', \gettype($callback))); + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf('Callable expected as an argument to CallbackToken, but got %s.', gettype($callback))); } $this->callback = $callback; $this->customStringRepresentation = $customStringRepresentation; @@ -41348,7 +44466,7 @@ class CallbackToken implements \Prophecy\Argument\Token\TokenInterface */ public function scoreArgument($argument) { - return \call_user_func($this->callback, $argument) ? 7 : \false; + return call_user_func($this->callback, $argument) ? 7 : \false; } /** * Returns false. @@ -41385,8 +44503,8 @@ class CallbackToken implements \Prophecy\Argument\Token\TokenInterface namespace Prophecy\Argument\Token; use Prophecy\Comparator\FactoryProvider; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -use PHPUnit\SebastianBergmann\Comparator\Factory as ComparatorFactory; +use PHPUnitPHAR\SebastianBergmann\Comparator\ComparisonFailure; +use PHPUnitPHAR\SebastianBergmann\Comparator\Factory as ComparatorFactory; use Prophecy\Util\StringUtil; /** * Exact value token. @@ -41422,7 +44540,7 @@ class ExactValueToken implements \Prophecy\Argument\Token\TokenInterface */ public function scoreArgument($argument) { - if (\is_object($argument) && \is_object($this->value)) { + if (is_object($argument) && is_object($this->value)) { $comparator = $this->comparatorFactory->getComparatorFor($argument, $this->value); try { $comparator->assertEquals($argument, $this->value); @@ -41432,19 +44550,22 @@ class ExactValueToken implements \Prophecy\Argument\Token\TokenInterface } } // If either one is an object it should be castable to a string - if (\is_object($argument) xor \is_object($this->value)) { - if (\is_object($argument) && !\method_exists($argument, '__toString')) { + if (is_object($argument) xor is_object($this->value)) { + if (is_object($argument) && !method_exists($argument, '__toString')) { return \false; } - if (\is_object($this->value) && !\method_exists($this->value, '__toString')) { + if (is_object($this->value) && !method_exists($this->value, '__toString')) { return \false; } - } elseif (\is_numeric($argument) && \is_numeric($this->value)) { + if (is_numeric($argument) xor is_numeric($this->value)) { + return (strval($argument) == strval($this->value)) ? 10 : \false; + } + } elseif (is_numeric($argument) && is_numeric($this->value)) { // noop - } elseif (\gettype($argument) !== \gettype($this->value)) { + } elseif (gettype($argument) !== gettype($this->value)) { return \false; } - return $argument == $this->value ? 10 : \false; + return ($argument == $this->value) ? 10 : \false; } /** * Returns preset value against which token checks arguments. @@ -41472,7 +44593,7 @@ class ExactValueToken implements \Prophecy\Argument\Token\TokenInterface public function __toString() { if (null === $this->string) { - $this->string = \sprintf('exact(%s)', $this->util->stringify($this->value)); + $this->string = sprintf('exact(%s)', $this->util->stringify($this->value)); } return $this->string; } @@ -41522,7 +44643,7 @@ class IdenticalValueToken implements \Prophecy\Argument\Token\TokenInterface */ public function scoreArgument($argument) { - return $argument === $this->value ? 11 : \false; + return ($argument === $this->value) ? 11 : \false; } /** * Returns false. @@ -41541,7 +44662,7 @@ class IdenticalValueToken implements \Prophecy\Argument\Token\TokenInterface public function __toString() { if (null === $this->string) { - $this->string = \sprintf('identical(%s)', $this->util->stringify($this->value)); + $this->string = sprintf('identical(%s)', $this->util->stringify($this->value)); } return $this->string; } @@ -41585,7 +44706,7 @@ class InArrayToken implements \Prophecy\Argument\Token\TokenInterface */ public function scoreArgument($argument) { - if (\count($this->token) === 0) { + if (count($this->token) === 0) { return \false; } if (\in_array($argument, $this->token, $this->strict)) { @@ -41609,7 +44730,7 @@ class InArrayToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - $arrayAsString = \implode(', ', $this->token); + $arrayAsString = implode(', ', $this->token); return "[{$arrayAsString}]"; } } @@ -41657,7 +44778,7 @@ class LogicalAndToken implements \Prophecy\Argument\Token\TokenInterface */ public function scoreArgument($argument) { - if (0 === \count($this->tokens)) { + if (0 === count($this->tokens)) { return \false; } $maxScore = 0; @@ -41666,7 +44787,7 @@ class LogicalAndToken implements \Prophecy\Argument\Token\TokenInterface if (\false === $score) { return \false; } - $maxScore = \max($score, $maxScore); + $maxScore = max($score, $maxScore); } return $maxScore; } @@ -41686,7 +44807,7 @@ class LogicalAndToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('bool(%s)', \implode(' AND ', $this->tokens)); + return sprintf('bool(%s)', implode(' AND ', $this->tokens)); } } token = $value instanceof \Prophecy\Argument\Token\TokenInterface ? $value : new \Prophecy\Argument\Token\ExactValueToken($value); + $this->token = ($value instanceof \Prophecy\Argument\Token\TokenInterface) ? $value : new \Prophecy\Argument\Token\ExactValueToken($value); } /** * Scores 4 when preset token does not match the argument. @@ -41726,7 +44847,7 @@ class LogicalNotToken implements \Prophecy\Argument\Token\TokenInterface */ public function scoreArgument($argument) { - return \false === $this->token->scoreArgument($argument) ? 4 : \false; + return (\false === $this->token->scoreArgument($argument)) ? 4 : \false; } /** * Returns true if preset token is last. @@ -41753,7 +44874,7 @@ class LogicalNotToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('not(%s)', $this->token); + return sprintf('not(%s)', $this->token); } } token) === 0) { + if (count($this->token) === 0) { return \false; } if (!\in_array($argument, $this->token, $this->strict)) { @@ -41819,7 +44940,7 @@ class NotInArrayToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - $arrayAsString = \implode(', ', $this->token); + $arrayAsString = implode(', ', $this->token); return "[{$arrayAsString}]"; } } @@ -41836,8 +44957,8 @@ class NotInArrayToken implements \Prophecy\Argument\Token\TokenInterface namespace Prophecy\Argument\Token; use Prophecy\Comparator\FactoryProvider; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -use PHPUnit\SebastianBergmann\Comparator\Factory as ComparatorFactory; +use PHPUnitPHAR\SebastianBergmann\Comparator\ComparisonFailure; +use PHPUnitPHAR\SebastianBergmann\Comparator\Factory as ComparatorFactory; use Prophecy\Util\StringUtil; /** * Object state-checker token. @@ -41873,8 +44994,8 @@ class ObjectStateToken implements \Prophecy\Argument\Token\TokenInterface public function scoreArgument($argument) { $methodCallable = array($argument, $this->name); - if (\is_object($argument) && \method_exists($argument, $this->name) && \is_callable($methodCallable)) { - $actual = \call_user_func($methodCallable); + if (is_object($argument) && method_exists($argument, $this->name) && is_callable($methodCallable)) { + $actual = call_user_func($methodCallable); $comparator = $this->comparatorFactory->getComparatorFor($this->value, $actual); try { $comparator->assertEquals($this->value, $actual); @@ -41883,8 +45004,8 @@ class ObjectStateToken implements \Prophecy\Argument\Token\TokenInterface return \false; } } - if (\is_object($argument) && \property_exists($argument, $this->name)) { - return $argument->{$this->name} === $this->value ? 8 : \false; + if (is_object($argument) && property_exists($argument, $this->name)) { + return ($argument->{$this->name} === $this->value) ? 8 : \false; } return \false; } @@ -41904,7 +45025,7 @@ class ObjectStateToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('state(%s(), %s)', $this->name, $this->util->stringify($this->value)); + return sprintf('state(%s(), %s)', $this->name, $this->util->stringify($this->value)); } } value) !== \false ? 6 : \false; + return (is_string($argument) && strpos($argument, $this->value) !== \false) ? 6 : \false; } /** * Returns preset value against which token checks arguments. @@ -41965,7 +45086,7 @@ class StringContainsToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('contains("%s")', $this->value); + return sprintf('contains("%s")', $this->value); } } type = $type; } @@ -42050,10 +45171,10 @@ class TypeToken implements \Prophecy\Argument\Token\TokenInterface public function scoreArgument($argument) { $checker = "is_{$this->type}"; - if (\function_exists($checker)) { - return \call_user_func($checker, $argument) ? 5 : \false; + if (function_exists($checker)) { + return call_user_func($checker, $argument) ? 5 : \false; } - return $argument instanceof $this->type ? 5 : \false; + return ($argument instanceof $this->type) ? 5 : \false; } /** * Returns false. @@ -42071,7 +45192,7 @@ class TypeToken implements \Prophecy\Argument\Token\TokenInterface */ public function __toString() { - return \sprintf('type(%s)', $this->type); + return sprintf('type(%s)', $this->type); } } scores = new \SplObjectStorage(); if ($file) { $this->file = $file; - $this->line = \intval($line); + $this->line = intval($line); } } /** @@ -42197,7 +45318,7 @@ class Call if (null === $this->file) { return 'unknown'; } - return \sprintf('%s:%d', $this->file, $this->line); + return sprintf('%s:%d', $this->file, $this->line); } /** * Adds the wildcard match score for the provided wildcard. @@ -42288,27 +45409,27 @@ class CallCenter { // For efficiency exclude 'args' from the generated backtrace // Limit backtrace to last 3 calls as we don't use the rest - $backtrace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 3); + $backtrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 3); $file = $line = null; if (isset($backtrace[2]) && isset($backtrace[2]['file']) && isset($backtrace[2]['line'])) { $file = $backtrace[2]['file']; $line = $backtrace[2]['line']; } // If no method prophecies defined, then it's a dummy, so we'll just return null - if ('__destruct' === \strtolower($methodName) || 0 == \count($prophecy->getMethodProphecies())) { + if ('__destruct' === strtolower($methodName) || 0 == count($prophecy->getMethodProphecies())) { $this->recordedCalls[] = new \Prophecy\Call\Call($methodName, $arguments, null, null, $file, $line); return null; } // There are method prophecies, so it's a fake/stub. Searching prophecy for this call $matches = $this->findMethodProphecies($prophecy, $methodName, $arguments); // If fake/stub doesn't have method prophecy for this call - throw exception - if (!\count($matches)) { + if (!count($matches)) { $this->unexpectedCalls->attach(new \Prophecy\Call\Call($methodName, $arguments, null, null, $file, $line), $prophecy); $this->recordedCalls[] = new \Prophecy\Call\Call($methodName, $arguments, null, null, $file, $line); return null; } // Sort matches by their score value - @\usort($matches, function ($match1, $match2) { + @usort($matches, function ($match1, $match2) { return $match2[0] - $match1[0]; }); $score = $matches[0][0]; @@ -42343,9 +45464,9 @@ class CallCenter */ public function findCalls($methodName, ArgumentsWildcard $wildcard) { - $methodName = \strtolower($methodName); - return \array_values(\array_filter($this->recordedCalls, function (\Prophecy\Call\Call $call) use($methodName, $wildcard) { - return $methodName === \strtolower($call->getMethodName()) && 0 < $call->getScore($wildcard); + $methodName = strtolower($methodName); + return array_values(array_filter($this->recordedCalls, function (\Prophecy\Call\Call $call) use ($methodName, $wildcard) { + return $methodName === strtolower($call->getMethodName()) && 0 < $call->getScore($wildcard); })); } /** @@ -42357,7 +45478,7 @@ class CallCenter foreach ($this->unexpectedCalls as $call) { $prophecy = $this->unexpectedCalls[$call]; // If fake/stub doesn't have method prophecy for this call - throw exception - if (!\count($this->findMethodProphecies($prophecy, $call->getMethodName(), $call->getArguments()))) { + if (!count($this->findMethodProphecies($prophecy, $call->getMethodName(), $call->getArguments()))) { throw $this->createUnexpectedCallException($prophecy, $call->getMethodName(), $call->getArguments()); } } @@ -42371,15 +45492,15 @@ class CallCenter */ private function createUnexpectedCallException(ObjectProphecy $prophecy, $methodName, array $arguments) { - $classname = \get_class($prophecy->reveal()); + $classname = get_class($prophecy->reveal()); $indentationLength = 8; // looks good - $argstring = \implode(",\n", $this->indentArguments(\array_map(array($this->util, 'stringify'), $arguments), $indentationLength)); + $argstring = implode(",\n", $this->indentArguments(array_map(array($this->util, 'stringify'), $arguments), $indentationLength)); $expected = array(); - foreach (\array_merge(...\array_values($prophecy->getMethodProphecies())) as $methodProphecy) { - $expected[] = \sprintf(" - %s(\n" . "%s\n" . " )", $methodProphecy->getMethodName(), \implode(",\n", $this->indentArguments(\array_map('strval', $methodProphecy->getArgumentsWildcard()->getTokens()), $indentationLength))); + foreach (array_merge(...array_values($prophecy->getMethodProphecies())) as $methodProphecy) { + $expected[] = sprintf(" - %s(\n" . "%s\n" . " )", $methodProphecy->getMethodName(), implode(",\n", $this->indentArguments(array_map('strval', $methodProphecy->getArgumentsWildcard()->getTokens()), $indentationLength))); } - return new UnexpectedCallException(\sprintf("Unexpected method call on %s:\n" . " - %s(\n" . "%s\n" . " )\n" . "expected calls were:\n" . "%s", $classname, $methodName, $argstring, \implode("\n", $expected)), $prophecy, $methodName, $arguments); + return new UnexpectedCallException(sprintf("Unexpected method call on %s:\n" . " - %s(\n" . "%s\n" . " )\n" . "expected calls were:\n" . "%s", $classname, $methodName, $argstring, implode("\n", $expected)), $prophecy, $methodName, $arguments); } /** * @param string[] $arguments @@ -42389,8 +45510,8 @@ class CallCenter */ private function indentArguments(array $arguments, $indentationLength) { - return \preg_replace_callback('/^/m', function () use($indentationLength) { - return \str_repeat(' ', $indentationLength); + return preg_replace_callback('/^/m', function () use ($indentationLength) { + return str_repeat(' ', $indentationLength); }, $arguments); } /** @@ -42406,7 +45527,7 @@ class CallCenter { $matches = array(); foreach ($prophecy->getMethodProphecies($methodName) as $methodProphecy) { - if (0 < ($score = $methodProphecy->getArgumentsWildcard()->scoreArguments($arguments))) { + if (0 < $score = $methodProphecy->getArgumentsWildcard()->scoreArguments($arguments)) { $matches[] = array($score, $methodProphecy); } } @@ -42425,8 +45546,8 @@ class CallCenter */ namespace Prophecy\Comparator; -use PHPUnit\SebastianBergmann\Comparator\Comparator; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; +use PHPUnitPHAR\SebastianBergmann\Comparator\Comparator; +use PHPUnitPHAR\SebastianBergmann\Comparator\ComparisonFailure; /** * Closure comparator. * @@ -42434,20 +45555,35 @@ use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; */ final class ClosureComparator extends Comparator { - public function accepts($expected, $actual) : bool + /** + * @param mixed $expected + * @param mixed $actual + */ + public function accepts($expected, $actual): bool { - return \is_object($expected) && $expected instanceof \Closure && \is_object($actual) && $actual instanceof \Closure; + return is_object($expected) && $expected instanceof \Closure && is_object($actual) && $actual instanceof \Closure; } - public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = \false, $ignoreCase = \false) : void + /** + * @param mixed $expected + * @param mixed $actual + * @param float $delta + * @param bool $canonicalize + * @param bool $ignoreCase + */ + public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = \false, $ignoreCase = \false): void { if ($expected !== $actual) { + // Support for sebastian/comparator < 5 + if ((new \ReflectionMethod(ComparisonFailure::class, '__construct'))->getNumberOfParameters() >= 6) { + // @phpstan-ignore-next-line + throw new ComparisonFailure($expected, $actual, '', '', \false, 'all closures are different if not identical'); + } throw new ComparisonFailure( $expected, $actual, // we don't need a diff '', '', - \false, 'all closures are different if not identical' ); } @@ -42465,7 +45601,7 @@ final class ClosureComparator extends Comparator */ namespace Prophecy\Comparator; -use PHPUnit\SebastianBergmann\Comparator\Factory as BaseFactory; +use PHPUnitPHAR\SebastianBergmann\Comparator\Factory as BaseFactory; /** * Prophecy comparator factory. * @@ -42508,7 +45644,7 @@ final class Factory extends BaseFactory */ namespace Prophecy\Comparator; -use PHPUnit\SebastianBergmann\Comparator\Factory; +use PHPUnitPHAR\SebastianBergmann\Comparator\Factory; /** * Prophecy comparator factory. * @@ -42523,7 +45659,7 @@ final class FactoryProvider private function __construct() { } - public static function getInstance() : Factory + public static function getInstance(): Factory { if (self::$instance === null) { self::$instance = new Factory(); @@ -42546,20 +45682,31 @@ final class FactoryProvider namespace Prophecy\Comparator; use Prophecy\Prophecy\ProphecyInterface; -use PHPUnit\SebastianBergmann\Comparator\ObjectComparator; +use PHPUnitPHAR\SebastianBergmann\Comparator\ObjectComparator; /** * @final */ class ProphecyComparator extends ObjectComparator { - public function accepts($expected, $actual) : bool + /** + * @param mixed $expected + * @param mixed $actual + */ + public function accepts($expected, $actual): bool { - return \is_object($expected) && \is_object($actual) && $actual instanceof ProphecyInterface; + return is_object($expected) && is_object($actual) && $actual instanceof ProphecyInterface; } /** + * @param mixed $expected + * @param mixed $actual + * @param float $delta + * @param bool $canonicalize + * @param bool $ignoreCase + * @param array $processed + * * @phpstan-param list $processed */ - public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = \false, $ignoreCase = \false, array &$processed = array()) : void + public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = \false, $ignoreCase = \false, array &$processed = array()): void { \assert($actual instanceof ProphecyInterface); parent::assertEquals($expected, $actual->reveal(), $delta, $canonicalize, $ignoreCase, $processed); @@ -42587,7 +45734,7 @@ use ReflectionClass; class CachedDoubler extends \Prophecy\Doubler\Doubler { /** - * @var array + * @var array */ private static $classes = array(); protected function createDoubleClass(ReflectionClass $class = null, array $interfaces) @@ -42599,8 +45746,8 @@ class CachedDoubler extends \Prophecy\Doubler\Doubler return self::$classes[$classId] = parent::createDoubleClass($class, $interfaces); } /** - * @param ReflectionClass $class - * @param ReflectionClass[] $interfaces + * @param ReflectionClass|null $class + * @param ReflectionClass[] $interfaces * * @return string */ @@ -42614,10 +45761,10 @@ class CachedDoubler extends \Prophecy\Doubler\Doubler $parts[] = $interface->getName(); } foreach ($this->getClassPatches() as $patch) { - $parts[] = \get_class($patch); + $parts[] = get_class($patch); } - \sort($parts); - return \md5(\implode('', $parts)); + sort($parts); + return md5(implode('', $parts)); } /** * @return void @@ -42778,8 +45925,8 @@ class KeywordPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterface */ public function apply(ClassNode $node) { - $methodNames = \array_keys($node->getMethods()); - $methodsToRemove = \array_intersect($methodNames, $this->getKeywords()); + $methodNames = array_keys($node->getMethods()); + $methodsToRemove = array_intersect($methodNames, $this->getKeywords()); foreach ($methodsToRemove as $methodName) { $node->removeMethod($methodName); } @@ -42833,7 +45980,7 @@ class MagicCallPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterface private $tagRetriever; public function __construct(MethodTagRetrieverInterface $tagRetriever = null) { - $this->tagRetriever = null === $tagRetriever ? new ClassAndInterfaceTagRetriever() : $tagRetriever; + $this->tagRetriever = (null === $tagRetriever) ? new ClassAndInterfaceTagRetriever() : $tagRetriever; } /** * Support any class @@ -42853,8 +46000,8 @@ class MagicCallPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterface */ public function apply(ClassNode $node) { - $types = \array_filter($node->getInterfaces(), function ($interface) { - return 0 !== \strpos($interface, 'Prophecy\\'); + $types = array_filter($node->getInterfaces(), function ($interface) { + return 0 !== strpos($interface, 'Prophecy\\'); }); $types[] = $node->getParentClass(); foreach ($types as $type) { @@ -42869,7 +46016,7 @@ class MagicCallPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterface if (!$reflectionClass->hasMethod($methodName)) { $methodNode = new MethodNode($methodName); // only magic methods can have a contract that needs to be enforced - if (\in_array($methodName, self::MAGIC_METHODS_WITH_ARGUMENTS)) { + if (in_array($methodName, self::MAGIC_METHODS_WITH_ARGUMENTS)) { foreach ($tag->getArguments() as $argument) { $argumentNode = new ArgumentNode($argument['name']); $methodNode->addArgument($argumentNode); @@ -42936,10 +46083,10 @@ class ProphecySubjectPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInt */ public function apply(ClassNode $node) { - $node->addInterface('Prophecy\\Prophecy\\ProphecySubjectInterface'); + $node->addInterface('Prophecy\Prophecy\ProphecySubjectInterface'); $node->addProperty('objectProphecyClosure', 'private'); foreach ($node->getMethods() as $name => $method) { - if ('__construct' === \strtolower($name)) { + if ('__construct' === strtolower($name)) { continue; } if (!$method->getReturnTypeNode()->hasReturnStatement()) { @@ -42950,7 +46097,7 @@ class ProphecySubjectPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInt } $prophecySetter = new MethodNode('setProphecy'); $prophecyArgument = new ArgumentNode('prophecy'); - $prophecyArgument->setTypeNode(new ArgumentTypeNode('Prophecy\\Prophecy\\ProphecyInterface')); + $prophecyArgument->setTypeNode(new ArgumentTypeNode('Prophecy\Prophecy\ProphecyInterface')); $prophecySetter->addArgument($prophecyArgument); $prophecySetter->setCode(<<objectProphecyClosure) { @@ -42961,7 +46108,7 @@ if (null === \$this->objectProphecyClosure) { PHP ); $prophecyGetter = new MethodNode('getProphecy'); - $prophecyGetter->setCode('return \\call_user_func($this->objectProphecyClosure);'); + $prophecyGetter->setCode('return \call_user_func($this->objectProphecyClosure);'); if ($node->hasMethod('__call')) { $__call = $node->getMethod('__call'); \assert($__call !== null); @@ -43077,7 +46224,7 @@ class SplFileInfoPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterfa */ public function supports(ClassNode $node) { - return 'SplFileInfo' === $node->getParentClass() || \is_subclass_of($node->getParentClass(), 'SplFileInfo'); + return 'SplFileInfo' === $node->getParentClass() || is_subclass_of($node->getParentClass(), 'SplFileInfo'); } /** * Updated constructor code to call parent one with dummy file argument. @@ -43098,12 +46245,12 @@ class SplFileInfoPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterfa return; } if ($this->nodeIsSplFileObject($node)) { - $filePath = \str_replace('\\', '\\\\', __FILE__); + $filePath = str_replace('\\', '\\\\', __FILE__); $constructor->setCode('return parent::__construct("' . $filePath . '");'); return; } if ($this->nodeIsSymfonySplFileInfo($node)) { - $filePath = \str_replace('\\', '\\\\', __FILE__); + $filePath = str_replace('\\', '\\\\', __FILE__); $constructor->setCode('return parent::__construct("' . $filePath . '", "", "");'); return; } @@ -43125,7 +46272,7 @@ class SplFileInfoPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterfa private function nodeIsDirectoryIterator(ClassNode $node) { $parent = $node->getParentClass(); - return 'DirectoryIterator' === $parent || \is_subclass_of($parent, 'DirectoryIterator'); + return 'DirectoryIterator' === $parent || is_subclass_of($parent, 'DirectoryIterator'); } /** * @param ClassNode $node @@ -43134,7 +46281,7 @@ class SplFileInfoPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterfa private function nodeIsSplFileObject(ClassNode $node) { $parent = $node->getParentClass(); - return 'SplFileObject' === $parent || \is_subclass_of($parent, 'SplFileObject'); + return 'SplFileObject' === $parent || is_subclass_of($parent, 'SplFileObject'); } /** * @param ClassNode $node @@ -43143,7 +46290,7 @@ class SplFileInfoPatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterfa private function nodeIsSymfonySplFileInfo(ClassNode $node) { $parent = $node->getParentClass(); - return 'Symfony\\Component\\Finder\\SplFileInfo' === $parent; + return 'Symfony\Component\Finder\SplFileInfo' === $parent; } } getInterfaces() as $type) { - if (\is_a($type, 'Throwable', \true)) { + if (is_a($type, 'Throwable', \true)) { return \true; } } @@ -43183,7 +46330,7 @@ class ThrowablePatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterface */ private function doesNotExtendAThrowableClass(ClassNode $node) { - return !\is_a($node->getParentClass(), 'Throwable', \true); + return !is_a($node->getParentClass(), 'Throwable', \true); } /** * Applies patch to the specific class node. @@ -43197,14 +46344,14 @@ class ThrowablePatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterface $this->checkItCanBeDoubled($node); $this->setParentClassToException($node); } - private function checkItCanBeDoubled(ClassNode $node) : void + private function checkItCanBeDoubled(ClassNode $node): void { $className = $node->getParentClass(); if ($className !== 'stdClass') { - throw new ClassCreatorException(\sprintf('Cannot double concrete class %s as well as implement Traversable', $className), $node); + throw new ClassCreatorException(sprintf('Cannot double concrete class %s as well as implement Traversable', $className), $node); } } - private function setParentClassToException(ClassNode $node) : void + private function setParentClassToException(ClassNode $node): void { $node->setParentClass('Exception'); $node->removeMethod('getMessage'); @@ -43258,20 +46405,20 @@ class TraversablePatch implements \Prophecy\Doubler\ClassPatch\ClassPatchInterfa */ public function supports(ClassNode $node) { - if (\in_array('Iterator', $node->getInterfaces())) { + if (in_array('Iterator', $node->getInterfaces())) { return \false; } - if (\in_array('IteratorAggregate', $node->getInterfaces())) { + if (in_array('IteratorAggregate', $node->getInterfaces())) { return \false; } foreach ($node->getInterfaces() as $interface) { - if ('Traversable' !== $interface && !\is_subclass_of($interface, 'Traversable')) { + if ('Traversable' !== $interface && !is_subclass_of($interface, 'Traversable')) { continue; } - if ('Iterator' === $interface || \is_subclass_of($interface, 'Iterator')) { + if ('Iterator' === $interface || is_subclass_of($interface, 'Iterator')) { continue; } - if ('IteratorAggregate' === $interface || \is_subclass_of($interface, 'IteratorAggregate')) { + if ('IteratorAggregate' === $interface || is_subclass_of($interface, 'IteratorAggregate')) { continue; } return \true; @@ -43345,7 +46492,7 @@ interface DoubleInterface */ namespace Prophecy\Doubler; -use PHPUnit\Doctrine\Instantiator\Instantiator; +use PHPUnitPHAR\Doctrine\Instantiator\Instantiator; use Prophecy\Doubler\ClassPatch\ClassPatchInterface; use Prophecy\Doubler\Generator\ClassMirror; use Prophecy\Doubler\Generator\ClassCreator; @@ -43395,18 +46542,20 @@ class Doubler public function registerClassPatch(ClassPatchInterface $patch) { $this->patches[] = $patch; - @\usort($this->patches, function (ClassPatchInterface $patch1, ClassPatchInterface $patch2) { + @usort($this->patches, function (ClassPatchInterface $patch1, ClassPatchInterface $patch2) { return $patch2->getPriority() - $patch1->getPriority(); }); } /** * Creates double from specific class or/and list of interfaces. * - * @param ReflectionClass|null $class - * @param ReflectionClass[] $interfaces Array of ReflectionClass instances - * @param array|null $args Constructor arguments + * @template T of object * - * @return DoubleInterface + * @param ReflectionClass|null $class + * @param ReflectionClass[] $interfaces Array of ReflectionClass instances + * @param array|null $args Constructor arguments + * + * @return T&DoubleInterface * * @throws \Prophecy\Exception\InvalidArgumentException */ @@ -43414,7 +46563,7 @@ class Doubler { foreach ($interfaces as $interface) { if (!$interface instanceof ReflectionClass) { - throw new InvalidArgumentException(\sprintf("[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n" . "a second argument to `Doubler::double(...)`, but got %s.", \is_object($interface) ? \get_class($interface) . ' class' : \gettype($interface))); + throw new InvalidArgumentException(sprintf("[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n" . "a second argument to `Doubler::double(...)`, but got %s.", is_object($interface) ? get_class($interface) . ' class' : gettype($interface))); } } $classname = $this->createDoubleClass($class, $interfaces); @@ -43433,10 +46582,12 @@ class Doubler /** * Creates double class and returns its FQN. * - * @param ReflectionClass|null $class - * @param ReflectionClass[] $interfaces + * @template T of object * - * @return string + * @param ReflectionClass|null $class + * @param ReflectionClass[] $interfaces + * + * @return class-string */ protected function createDoubleClass(ReflectionClass $class = null, array $interfaces) { @@ -43447,7 +46598,9 @@ class Doubler $patch->apply($node); } } + $node->addInterface(\Prophecy\Doubler\DoubleInterface::class); $this->creator->create($name, $node); + \assert(class_exists($name, \false)); return $name; } } @@ -43487,38 +46640,38 @@ class ClassCodeGenerator */ public function generate($classname, \Prophecy\Doubler\Generator\Node\ClassNode $class) { - $parts = \explode('\\', $classname); - $classname = \array_pop($parts); - $namespace = \implode('\\', $parts); - $code = \sprintf("%sclass %s extends \\%s implements %s {\n", $class->isReadOnly() ? 'readonly ' : '', $classname, $class->getParentClass(), \implode(', ', \array_map(function ($interface) { + $parts = explode('\\', $classname); + $classname = array_pop($parts); + $namespace = implode('\\', $parts); + $code = sprintf("%sclass %s extends \\%s implements %s {\n", $class->isReadOnly() ? 'readonly ' : '', $classname, $class->getParentClass(), implode(', ', array_map(function ($interface) { return '\\' . $interface; }, $class->getInterfaces()))); foreach ($class->getProperties() as $name => $visibility) { - $code .= \sprintf("%s \$%s;\n", $visibility, $name); + $code .= sprintf("%s \$%s;\n", $visibility, $name); } $code .= "\n"; foreach ($class->getMethods() as $method) { $code .= $this->generateMethod($method) . "\n"; } $code .= "\n}"; - return \sprintf("namespace %s {\n%s\n}", $namespace, $code); + return sprintf("namespace %s {\n%s\n}", $namespace, $code); } - private function generateMethod(\Prophecy\Doubler\Generator\Node\MethodNode $method) : string + private function generateMethod(\Prophecy\Doubler\Generator\Node\MethodNode $method): string { - $php = \sprintf("%s %s function %s%s(%s)%s {\n", $method->getVisibility(), $method->isStatic() ? 'static' : '', $method->returnsReference() ? '&' : '', $method->getName(), \implode(', ', $this->generateArguments($method->getArguments())), ($ret = $this->generateTypes($method->getReturnTypeNode())) ? ': ' . $ret : ''); + $php = sprintf("%s %s function %s%s(%s)%s {\n", $method->getVisibility(), $method->isStatic() ? 'static' : '', $method->returnsReference() ? '&' : '', $method->getName(), implode(', ', $this->generateArguments($method->getArguments())), ($ret = $this->generateTypes($method->getReturnTypeNode())) ? ': ' . $ret : ''); $php .= $method->getCode() . "\n"; return $php . '}'; } - private function generateTypes(TypeNodeAbstract $typeNode) : string + private function generateTypes(TypeNodeAbstract $typeNode): string { if (!$typeNode->getTypes()) { return ''; } // When we require PHP 8 we can stop generating ?foo nullables and remove this first block if ($typeNode->canUseNullShorthand()) { - return \sprintf('?%s', $typeNode->getNonNullTypes()[0]); + return sprintf('?%s', $typeNode->getNonNullTypes()[0]); } else { - return \join('|', $typeNode->getTypes()); + return join('|', $typeNode->getTypes()); } } /** @@ -43526,15 +46679,15 @@ class ClassCodeGenerator * * @return list */ - private function generateArguments(array $arguments) : array + private function generateArguments(array $arguments): array { - return \array_map(function (\Prophecy\Doubler\Generator\Node\ArgumentNode $argument) { + return array_map(function (\Prophecy\Doubler\Generator\Node\ArgumentNode $argument) { $php = $this->generateTypes($argument->getTypeNode()); $php .= ' ' . ($argument->isPassedByReference() ? '&' : ''); $php .= $argument->isVariadic() ? '...' : ''; $php .= '$' . $argument->getName(); if ($argument->isOptional() && !$argument->isVariadic()) { - $php .= ' = ' . \var_export($argument->getDefault(), \true); + $php .= ' = ' . var_export($argument->getDefault(), \true); } return $php; }, $arguments); @@ -43580,11 +46733,11 @@ class ClassCreator { $code = $this->generator->generate($classname, $class); $return = eval($code); - if (!\class_exists($classname, \false)) { - if (\count($class->getInterfaces())) { - throw new ClassCreatorException(\sprintf('Could not double `%s` and implement interfaces: [%s].', $class->getParentClass(), \implode(', ', $class->getInterfaces())), $class); + if (!class_exists($classname, \false)) { + if (count($class->getInterfaces())) { + throw new ClassCreatorException(sprintf('Could not double `%s` and implement interfaces: [%s].', $class->getParentClass(), implode(', ', $class->getInterfaces())), $class); } - throw new ClassCreatorException(\sprintf('Could not double `%s`.', $class->getParentClass()), $class); + throw new ClassCreatorException(sprintf('Could not double `%s`.', $class->getParentClass()), $class); } return $return; } @@ -43635,31 +46788,31 @@ class ClassMirror $node = new \Prophecy\Doubler\Generator\Node\ClassNode(); if (null !== $class) { if (\true === $class->isInterface()) { - throw new InvalidArgumentException(\sprintf("Could not reflect %s as a class, because it\n" . "is interface - use the second argument instead.", $class->getName())); + throw new InvalidArgumentException(sprintf("Could not reflect %s as a class, because it\n" . "is interface - use the second argument instead.", $class->getName())); } $this->reflectClassToNode($class, $node); } foreach ($interfaces as $interface) { if (!$interface instanceof ReflectionClass) { - throw new InvalidArgumentException(\sprintf("[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n" . "a second argument to `ClassMirror::reflect(...)`, but got %s.", \is_object($interface) ? \get_class($interface) . ' class' : \gettype($interface))); + throw new InvalidArgumentException(sprintf("[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n" . "a second argument to `ClassMirror::reflect(...)`, but got %s.", is_object($interface) ? get_class($interface) . ' class' : gettype($interface))); } if (\false === $interface->isInterface()) { - throw new InvalidArgumentException(\sprintf("Could not reflect %s as an interface, because it\n" . "is class - use the first argument instead.", $interface->getName())); + throw new InvalidArgumentException(sprintf("Could not reflect %s as an interface, because it\n" . "is class - use the first argument instead.", $interface->getName())); } $this->reflectInterfaceToNode($interface, $node); } - $node->addInterface('Prophecy\\Doubler\\Generator\\ReflectionInterface'); + $node->addInterface('Prophecy\Doubler\Generator\ReflectionInterface'); return $node; } /** * @param ReflectionClass $class */ - private function reflectClassToNode(ReflectionClass $class, \Prophecy\Doubler\Generator\Node\ClassNode $node) : void + private function reflectClassToNode(ReflectionClass $class, \Prophecy\Doubler\Generator\Node\ClassNode $node): void { if (\true === $class->isFinal()) { - throw new ClassMirrorException(\sprintf('Could not reflect class %s as it is marked final.', $class->getName()), $class); + throw new ClassMirrorException(sprintf('Could not reflect class %s as it is marked final.', $class->getName()), $class); } - if (\method_exists(ReflectionClass::class, 'isReadOnly')) { + if (method_exists(ReflectionClass::class, 'isReadOnly')) { $node->setReadOnly($class->isReadOnly()); } $node->setParentClass($class->getName()); @@ -43670,7 +46823,7 @@ class ClassMirror $this->reflectMethodToNode($method, $node); } foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { - if (0 === \strpos($method->getName(), '_') && !\in_array($method->getName(), self::REFLECTABLE_METHODS)) { + if (0 === strpos($method->getName(), '_') && !in_array($method->getName(), self::REFLECTABLE_METHODS)) { continue; } if (\true === $method->isFinal()) { @@ -43683,14 +46836,14 @@ class ClassMirror /** * @param ReflectionClass $interface */ - private function reflectInterfaceToNode(ReflectionClass $interface, \Prophecy\Doubler\Generator\Node\ClassNode $node) : void + private function reflectInterfaceToNode(ReflectionClass $interface, \Prophecy\Doubler\Generator\Node\ClassNode $node): void { $node->addInterface($interface->getName()); foreach ($interface->getMethods() as $method) { $this->reflectMethodToNode($method, $node); } } - private function reflectMethodToNode(ReflectionMethod $method, \Prophecy\Doubler\Generator\Node\ClassNode $classNode) : void + private function reflectMethodToNode(ReflectionMethod $method, \Prophecy\Doubler\Generator\Node\ClassNode $classNode): void { $node = new \Prophecy\Doubler\Generator\Node\MethodNode($method->getName()); if (\true === $method->isProtected()) { @@ -43706,12 +46859,12 @@ class ClassMirror \assert($method->getReturnType() !== null); $returnTypes = $this->getTypeHints($method->getReturnType(), $method->getDeclaringClass(), $method->getReturnType()->allowsNull()); $node->setReturnTypeNode(new ReturnTypeNode(...$returnTypes)); - } elseif (\method_exists($method, 'hasTentativeReturnType') && $method->hasTentativeReturnType()) { + } elseif (method_exists($method, 'hasTentativeReturnType') && $method->hasTentativeReturnType()) { \assert($method->getTentativeReturnType() !== null); $returnTypes = $this->getTypeHints($method->getTentativeReturnType(), $method->getDeclaringClass(), $method->getTentativeReturnType()->allowsNull()); $node->setReturnTypeNode(new ReturnTypeNode(...$returnTypes)); } - if (\is_array($params = $method->getParameters()) && \count($params)) { + if (is_array($params = $method->getParameters()) && count($params)) { foreach ($params as $param) { $this->reflectArgumentToNode($param, $method->getDeclaringClass(), $node); } @@ -43723,9 +46876,9 @@ class ClassMirror * * @return void */ - private function reflectArgumentToNode(ReflectionParameter $parameter, ReflectionClass $declaringClass, \Prophecy\Doubler\Generator\Node\MethodNode $methodNode) : void + private function reflectArgumentToNode(ReflectionParameter $parameter, ReflectionClass $declaringClass, \Prophecy\Doubler\Generator\Node\MethodNode $methodNode): void { - $name = $parameter->getName() == '...' ? '__dot_dot_dot__' : $parameter->getName(); + $name = ($parameter->getName() == '...') ? '__dot_dot_dot__' : $parameter->getName(); $node = new \Prophecy\Doubler\Generator\Node\ArgumentNode($name); $typeHints = $this->getTypeHints($parameter->getType(), $declaringClass, $parameter->allowsNull()); $node->setTypeNode(new ArgumentTypeNode(...$typeHints)); @@ -43740,7 +46893,7 @@ class ClassMirror } $methodNode->addArgument($node); } - private function hasDefaultValue(ReflectionParameter $parameter) : bool + private function hasDefaultValue(ReflectionParameter $parameter): bool { if ($parameter->isVariadic()) { return \false; @@ -43765,7 +46918,7 @@ class ClassMirror * * @return list */ - private function getTypeHints(?ReflectionType $type, ReflectionClass $class, bool $allowsNull) : array + private function getTypeHints(?ReflectionType $type, ReflectionClass $class, bool $allowsNull): array { $types = []; if ($type instanceof ReflectionNamedType) { @@ -43781,16 +46934,16 @@ class ClassMirror } } elseif ($type instanceof ReflectionIntersectionType) { throw new ClassMirrorException('Doubling intersection types is not supported', $class); - } elseif (\is_object($type)) { - throw new ClassMirrorException('Unknown reflection type ' . \get_class($type), $class); + } elseif (is_object($type)) { + throw new ClassMirrorException('Unknown reflection type ' . get_class($type), $class); } - $types = \array_map(function (string $type) use($class) { + $types = array_map(function (string $type) use ($class) { if ($type === 'self') { return $class->getName(); } if ($type === 'parent') { if (\false === $class->getParentClass()) { - throw new ClassMirrorException(\sprintf('Invalid type "parent" in class "%s" without a parent', $class->getName()), $class); + throw new ClassMirrorException(sprintf('Invalid type "parent" in class "%s" without a parent', $class->getName()), $class); } return $class->getParentClass()->getName(); } @@ -43862,7 +47015,7 @@ class ArgumentNode { $this->typeNode = $typeNode; } - public function getTypeNode() : \Prophecy\Doubler\Generator\Node\ArgumentTypeNode + public function getTypeNode(): \Prophecy\Doubler\Generator\Node\ArgumentTypeNode { return $this->typeNode; } @@ -43936,7 +47089,7 @@ class ArgumentNode public function getTypeHint() { $type = $this->typeNode->getNonNullTypes() ? $this->typeNode->getNonNullTypes()[0] : null; - return $type ? \ltrim($type, '\\') : null; + return $type ? ltrim($type, '\\') : null; } /** * @deprecated use setArgumentTypeNode instead @@ -43946,7 +47099,7 @@ class ArgumentNode */ public function setTypeHint($typeHint = null) { - $this->typeNode = $typeHint === null ? new \Prophecy\Doubler\Generator\Node\ArgumentTypeNode() : new \Prophecy\Doubler\Generator\Node\ArgumentTypeNode($typeHint); + $this->typeNode = ($typeHint === null) ? new \Prophecy\Doubler\Generator\Node\ArgumentTypeNode() : new \Prophecy\Doubler\Generator\Node\ArgumentTypeNode($typeHint); } /** * @deprecated use getArgumentTypeNode instead @@ -43998,11 +47151,11 @@ use Prophecy\Exception\InvalidArgumentException; class ClassNode { /** - * @var string + * @var class-string */ private $parentClass = 'stdClass'; /** - * @var list + * @var list */ private $interfaces = array(); /** @@ -44024,14 +47177,14 @@ class ClassNode */ private $methods = array(); /** - * @return string + * @return class-string */ public function getParentClass() { return $this->parentClass; } /** - * @param string $class + * @param class-string|null $class * * @return void */ @@ -44040,14 +47193,14 @@ class ClassNode $this->parentClass = $class ?: 'stdClass'; } /** - * @return list + * @return list */ public function getInterfaces() { return $this->interfaces; } /** - * @param string $interface + * @param class-string $interface * * @return void */ @@ -44056,16 +47209,16 @@ class ClassNode if ($this->hasInterface($interface)) { return; } - \array_unshift($this->interfaces, $interface); + array_unshift($this->interfaces, $interface); } /** - * @param string $interface + * @param class-string $interface * * @return bool */ public function hasInterface($interface) { - return \in_array($interface, $this->interfaces); + return in_array($interface, $this->interfaces); } /** * @return array @@ -44086,9 +47239,9 @@ class ClassNode */ public function addProperty($name, $visibility = 'public') { - $visibility = \strtolower($visibility); + $visibility = strtolower($visibility); if (!\in_array($visibility, array('public', 'private', 'protected'), \true)) { - throw new InvalidArgumentException(\sprintf('`%s` property visibility is not supported.', $visibility)); + throw new InvalidArgumentException(sprintf('`%s` property visibility is not supported.', $visibility)); } $this->properties[$name] = $visibility; } @@ -44108,7 +47261,7 @@ class ClassNode public function addMethod(\Prophecy\Doubler\Generator\Node\MethodNode $method, $force = \false) { if (!$this->isExtendable($method->getName())) { - $message = \sprintf('Method `%s` is not extendable, so can not be added.', $method->getName()); + $message = sprintf('Method `%s` is not extendable, so can not be added.', $method->getName()); throw new MethodNotExtendableException($message, $this->getParentClass(), $method->getName()); } if ($force || !isset($this->methods[$method->getName()])) { @@ -44168,7 +47321,7 @@ class ClassNode */ public function isExtendable($method) { - return !\in_array($method, $this->unextendableMethods); + return !in_array($method, $this->unextendableMethods); } /** * @return bool @@ -44256,9 +47409,9 @@ class MethodNode */ public function setVisibility($visibility) { - $visibility = \strtolower($visibility); + $visibility = strtolower($visibility); if (!\in_array($visibility, array('public', 'private', 'protected'), \true)) { - throw new InvalidArgumentException(\sprintf('`%s` method visibility is not supported.', $visibility)); + throw new InvalidArgumentException(sprintf('`%s` method visibility is not supported.', $visibility)); } $this->visibility = $visibility; } @@ -44321,7 +47474,7 @@ class MethodNode { return (bool) $this->returnTypeNode->getNonNullTypes(); } - public function setReturnTypeNode(\Prophecy\Doubler\Generator\Node\ReturnTypeNode $returnTypeNode) : void + public function setReturnTypeNode(\Prophecy\Doubler\Generator\Node\ReturnTypeNode $returnTypeNode): void { $this->returnTypeNode = $returnTypeNode; } @@ -44333,7 +47486,7 @@ class MethodNode */ public function setReturnType($type = null) { - $this->returnTypeNode = $type === '' || $type === null ? new \Prophecy\Doubler\Generator\Node\ReturnTypeNode() : new \Prophecy\Doubler\Generator\Node\ReturnTypeNode($type); + $this->returnTypeNode = ($type === '' || $type === null) ? new \Prophecy\Doubler\Generator\Node\ReturnTypeNode() : new \Prophecy\Doubler\Generator\Node\ReturnTypeNode($type); } /** * @deprecated use setReturnTypeNode instead @@ -44360,7 +47513,7 @@ class MethodNode } return null; } - public function getReturnTypeNode() : \Prophecy\Doubler\Generator\Node\ReturnTypeNode + public function getReturnTypeNode(): \Prophecy\Doubler\Generator\Node\ReturnTypeNode { return $this->returnTypeNode; } @@ -44396,7 +47549,7 @@ class MethodNode */ public function useParentCode() { - $this->code = \sprintf('return parent::%s(%s);', $this->getName(), \implode(', ', \array_map(array($this, 'generateArgument'), $this->arguments))); + $this->code = sprintf('return parent::%s(%s);', $this->getName(), implode(', ', array_map(array($this, 'generateArgument'), $this->arguments))); } /** * @return string @@ -44417,7 +47570,7 @@ namespace Prophecy\Doubler\Generator\Node; use Prophecy\Exception\Doubler\DoubleException; final class ReturnTypeNode extends \Prophecy\Doubler\Generator\Node\TypeNodeAbstract { - protected function getRealType(string $type) : string + protected function getRealType(string $type): string { switch ($type) { case 'void': @@ -44429,10 +47582,10 @@ final class ReturnTypeNode extends \Prophecy\Doubler\Generator\Node\TypeNodeAbst } protected function guardIsValidType() { - if (isset($this->types['void']) && \count($this->types) !== 1) { + if (isset($this->types['void']) && count($this->types) !== 1) { throw new DoubleException('void cannot be part of a union'); } - if (isset($this->types['never']) && \count($this->types) !== 1) { + if (isset($this->types['never']) && count($this->types) !== 1) { throw new DoubleException('never cannot be part of a union'); } parent::guardIsValidType(); @@ -44446,7 +47599,7 @@ final class ReturnTypeNode extends \Prophecy\Doubler\Generator\Node\TypeNodeAbst { return $this->types == ['void' => 'void']; } - public function hasReturnStatement() : bool + public function hasReturnStatement(): bool { return $this->types !== ['void' => 'void'] && $this->types !== ['never' => 'never']; } @@ -44468,31 +47621,31 @@ abstract class TypeNodeAbstract } $this->guardIsValidType(); } - public function canUseNullShorthand() : bool + public function canUseNullShorthand(): bool { - return isset($this->types['null']) && \count($this->types) <= 2; + return isset($this->types['null']) && count($this->types) === 2; } /** * @return list */ - public function getTypes() : array + public function getTypes(): array { - return \array_values($this->types); + return array_values($this->types); } /** * @return list */ - public function getNonNullTypes() : array + public function getNonNullTypes(): array { $nonNullTypes = $this->types; unset($nonNullTypes['null']); - return \array_values($nonNullTypes); + return array_values($nonNullTypes); } - protected function prefixWithNsSeparator(string $type) : string + protected function prefixWithNsSeparator(string $type): string { - return '\\' . \ltrim($type, '\\'); + return '\\' . ltrim($type, '\\'); } - protected function getRealType(string $type) : string + protected function getRealType(string $type): string { switch ($type) { // type aliases @@ -44519,7 +47672,7 @@ abstract class TypeNodeAbstract case 'null': return $type; case 'mixed': - return \PHP_VERSION_ID < 80000 ? $this->prefixWithNsSeparator($type) : $type; + return (\PHP_VERSION_ID < 80000) ? $this->prefixWithNsSeparator($type) : $type; default: return $this->prefixWithNsSeparator($type); } @@ -44546,7 +47699,7 @@ abstract class TypeNodeAbstract throw new DoubleException('Type cannot be nullable true'); } } - if (\PHP_VERSION_ID >= 80000 && isset($this->types['mixed']) && \count($this->types) !== 1) { + if (\PHP_VERSION_ID >= 80000 && isset($this->types['mixed']) && count($this->types) !== 1) { throw new DoubleException('mixed cannot be part of a union'); } } @@ -44641,13 +47794,15 @@ use ReflectionClass; * Lazy double. * Gives simple interface to describe double before creating it. * + * @template T of object + * * @author Konstantin Kudryashov */ class LazyDouble { private $doubler; /** - * @var ReflectionClass|null + * @var ReflectionClass|null */ private $class; /** @@ -44659,7 +47814,7 @@ class LazyDouble */ private $arguments = null; /** - * @var DoubleInterface|null + * @var (T&DoubleInterface)|null */ private $double; public function __construct(\Prophecy\Doubler\Doubler $doubler) @@ -44669,12 +47824,16 @@ class LazyDouble /** * Tells doubler to use specific class as parent one for double. * - * @param string|ReflectionClass $class + * @param class-string|ReflectionClass $class * * @return void * - * @throws \Prophecy\Exception\Doubler\ClassNotFoundException - * @throws \Prophecy\Exception\Doubler\DoubleException + * @template U of object + * @phpstan-param class-string|ReflectionClass $class + * @phpstan-this-out static + * + * @throws ClassNotFoundException + * @throws DoubleException */ public function setParentClass($class) { @@ -44682,22 +47841,27 @@ class LazyDouble throw new DoubleException('Can not extend class with already instantiated double.'); } if (!$class instanceof ReflectionClass) { - if (!\class_exists($class)) { - throw new ClassNotFoundException(\sprintf('Class %s not found.', $class), $class); + if (!class_exists($class)) { + throw new ClassNotFoundException(sprintf('Class %s not found.', $class), $class); } $class = new ReflectionClass($class); } + /** @var static $this */ $this->class = $class; } /** * Tells doubler to implement specific interface with double. * - * @param string|ReflectionClass $interface + * @param class-string|ReflectionClass $interface * * @return void * - * @throws \Prophecy\Exception\Doubler\InterfaceNotFoundException - * @throws \Prophecy\Exception\Doubler\DoubleException + * @template U of object + * @phpstan-param class-string|ReflectionClass $interface + * @phpstan-this-out static + * + * @throws InterfaceNotFoundException + * @throws DoubleException */ public function addInterface($interface) { @@ -44705,8 +47869,8 @@ class LazyDouble throw new DoubleException('Can not implement interface with already instantiated double.'); } if (!$interface instanceof ReflectionClass) { - if (!\interface_exists($interface)) { - throw new InterfaceNotFoundException(\sprintf('Interface %s not found.', $interface), $interface); + if (!interface_exists($interface)) { + throw new InterfaceNotFoundException(sprintf('Interface %s not found.', $interface), $interface); } $interface = new ReflectionClass($interface); } @@ -44726,7 +47890,7 @@ class LazyDouble /** * Creates double instance or returns already created one. * - * @return DoubleInterface + * @return T&DoubleInterface */ public function getInstance() { @@ -44782,10 +47946,10 @@ class NameGenerator $parts[] = $interface->getShortName(); } } - if (!\count($parts)) { + if (!count($parts)) { $parts[] = 'stdClass'; } - return \sprintf('Double\\%s\\P%d', \implode('\\', $parts), self::$counter++); + return sprintf('Double\%s\P%d', implode('\\', $parts), self::$counter++); } } getMessage(); - $message = \strtr($message, array("\n" => "\n ")) . "\n"; - $message = empty($this->exceptions) ? $message : "\n" . $message; - $this->message = \rtrim($this->message . $message); + $message = strtr($message, array("\n" => "\n ")) . "\n"; + $message = empty($this->exceptions) ? $message : ("\n" . $message); + $this->message = rtrim($this->message . $message); $this->exceptions[] = $exception; } /** @@ -45297,7 +48461,7 @@ class UnexpectedCallsCountException extends \Prophecy\Exception\Prediction\Unexp public function __construct($message, MethodProphecy $methodProphecy, $count, array $calls) { parent::__construct($message, $methodProphecy, $calls); - $this->expectedCount = \intval($count); + $this->expectedCount = intval($count); } /** * @return int @@ -45436,7 +48600,7 @@ interface ProphecyException extends Exception */ namespace Prophecy\PhpDocumentor; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Method; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Method; /** * @author Théo FIDRY * @@ -45458,7 +48622,7 @@ final class ClassAndInterfaceTagRetriever implements \Prophecy\PhpDocumentor\Met } public function getTagList(\ReflectionClass $reflectionClass) { - return \array_merge($this->classRetriever->getTagList($reflectionClass), $this->getInterfacesTagList($reflectionClass)); + return array_merge($this->classRetriever->getTagList($reflectionClass), $this->getInterfacesTagList($reflectionClass)); } /** * @param \ReflectionClass $reflectionClass @@ -45470,7 +48634,7 @@ final class ClassAndInterfaceTagRetriever implements \Prophecy\PhpDocumentor\Met $interfaces = $reflectionClass->getInterfaces(); $tagList = array(); foreach ($interfaces as $interface) { - $tagList = \array_merge($tagList, $this->classRetriever->getTagList($interface)); + $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface)); } return $tagList; } @@ -45487,9 +48651,9 @@ final class ClassAndInterfaceTagRetriever implements \Prophecy\PhpDocumentor\Met */ namespace Prophecy\PhpDocumentor; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Method; -use PHPUnit\phpDocumentor\Reflection\DocBlockFactory; -use PHPUnit\phpDocumentor\Reflection\Types\ContextFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Method; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlockFactory; +use PHPUnitPHAR\phpDocumentor\Reflection\Types\ContextFactory; /** * @author Théo FIDRY * @@ -45532,7 +48696,7 @@ final class ClassTagRetriever implements \Prophecy\PhpDocumentor\MethodTagRetrie */ namespace Prophecy\PhpDocumentor; -use PHPUnit\phpDocumentor\Reflection\DocBlock\Tags\Method; +use PHPUnitPHAR\phpDocumentor\Reflection\DocBlock\Tags\Method; /** * @author Théo FIDRY * @@ -45580,14 +48744,14 @@ class CallPrediction implements \Prophecy\Prediction\PredictionInterface } public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) { - if (\count($calls)) { + if (count($calls)) { return; } $methodCalls = $object->findProphecyMethodCalls($method->getMethodName(), new ArgumentsWildcard(array(new AnyValuesToken()))); - if (\count($methodCalls)) { - throw new NoCallsException(\sprintf("No calls have been made that match:\n" . " %s->%s(%s)\n" . "but expected at least one.\n" . "Recorded `%s(...)` calls:\n%s", \get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), $method->getMethodName(), $this->util->stringifyCalls($methodCalls)), $method); + if (count($methodCalls)) { + throw new NoCallsException(sprintf("No calls have been made that match:\n" . " %s->%s(%s)\n" . "but expected at least one.\n" . "Recorded `%s(...)` calls:\n%s", get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), $method->getMethodName(), $this->util->stringifyCalls($methodCalls)), $method); } - throw new NoCallsException(\sprintf("No calls have been made that match:\n" . " %s->%s(%s)\n" . "but expected at least one.", \get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard()), $method); + throw new NoCallsException(sprintf("No calls have been made that match:\n" . " %s->%s(%s)\n" . "but expected at least one.", get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard()), $method); } } times = \intval($times); + $this->times = intval($times); $this->util = $util ?: new StringUtil(); } public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) { - if ($this->times == \count($calls)) { + if ($this->times == count($calls)) { return; } $methodCalls = $object->findProphecyMethodCalls($method->getMethodName(), new ArgumentsWildcard(array(new AnyValuesToken()))); - if (\count($calls)) { - $message = \sprintf("Expected exactly %d calls that match:\n" . " %s->%s(%s)\n" . "but %d were made:\n%s", $this->times, \get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), \count($calls), $this->util->stringifyCalls($calls)); - } elseif (\count($methodCalls)) { - $message = \sprintf("Expected exactly %d calls that match:\n" . " %s->%s(%s)\n" . "but none were made.\n" . "Recorded `%s(...)` calls:\n%s", $this->times, \get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), $method->getMethodName(), $this->util->stringifyCalls($methodCalls)); + if (count($calls)) { + $message = sprintf("Expected exactly %d calls that match:\n" . " %s->%s(%s)\n" . "but %d were made:\n%s", $this->times, get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), count($calls), $this->util->stringifyCalls($calls)); + } elseif (count($methodCalls)) { + $message = sprintf("Expected exactly %d calls that match:\n" . " %s->%s(%s)\n" . "but none were made.\n" . "Recorded `%s(...)` calls:\n%s", $this->times, get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), $method->getMethodName(), $this->util->stringifyCalls($methodCalls)); } else { - $message = \sprintf("Expected exactly %d calls that match:\n" . " %s->%s(%s)\n" . "but none were made.", $this->times, \get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard()); + $message = sprintf("Expected exactly %d calls that match:\n" . " %s->%s(%s)\n" . "but none were made.", $this->times, get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard()); } throw new UnexpectedCallsCountException($message, $method, $this->times, $calls); } @@ -45675,18 +48839,18 @@ class CallbackPrediction implements \Prophecy\Prediction\PredictionInterface */ public function __construct($callback) { - if (!\is_callable($callback)) { - throw new InvalidArgumentException(\sprintf('Callable expected as an argument to CallbackPrediction, but got %s.', \gettype($callback))); + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf('Callable expected as an argument to CallbackPrediction, but got %s.', gettype($callback))); } $this->callback = $callback; } public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) { $callback = $this->callback; - if ($callback instanceof Closure && \method_exists('Closure', 'bind') && (new ReflectionFunction($callback))->getClosureThis() !== null) { + if ($callback instanceof Closure && method_exists('Closure', 'bind') && (new ReflectionFunction($callback))->getClosureThis() !== null) { $callback = Closure::bind($callback, $object) ?? $this->callback; } - \call_user_func($callback, $calls, $object, $method); + call_user_func($callback, $calls, $object, $method); } } %s(%s)\n" . "but %d %s made:\n%s", \get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), \count($calls), $verb, $this->util->stringifyCalls($calls)), $method, $calls); + $verb = (count($calls) === 1) ? 'was' : 'were'; + throw new UnexpectedCallsException(sprintf("No calls expected that match:\n" . " %s->%s(%s)\n" . "but %d %s made:\n%s", get_class($object->reveal()), $method->getMethodName(), $method->getArgumentsWildcard(), count($calls), $verb, $this->util->stringifyCalls($calls)), $method, $calls); } } callback = $callback; } public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) { $callback = $this->callback; - if ($callback instanceof Closure && \method_exists('Closure', 'bind') && (new ReflectionFunction($callback))->getClosureThis() !== null) { + if ($callback instanceof Closure && method_exists('Closure', 'bind') && (new ReflectionFunction($callback))->getClosureThis() !== null) { $callback = Closure::bind($callback, $object) ?? $this->callback; } - return \call_user_func($callback, $args, $object, $method); + return call_user_func($callback, $args, $object, $method); } } index = $index; } public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) { - return \count($args) > $this->index ? $args[$this->index] : null; + return (count($args) > $this->index) ? $args[$this->index] : null; } } returnValues); - if (!\count($this->returnValues)) { + $value = array_shift($this->returnValues); + if (!count($this->returnValues)) { $this->returnValues[] = $value; } return $value; @@ -45941,7 +49105,7 @@ class ReturnPromise implements \Prophecy\Promise\PromiseInterface */ namespace Prophecy\Promise; -use PHPUnit\Doctrine\Instantiator\Instantiator; +use PHPUnitPHAR\Doctrine\Instantiator\Instantiator; use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\MethodProphecy; use Prophecy\Exception\InvalidArgumentException; @@ -45969,18 +49133,18 @@ class ThrowPromise implements \Prophecy\Promise\PromiseInterface */ public function __construct($exception) { - if (\is_string($exception)) { - if (!\class_exists($exception) && !\interface_exists($exception) || !$this->isAValidThrowable($exception)) { - throw new InvalidArgumentException(\sprintf('Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', $exception)); + if (is_string($exception)) { + if (!class_exists($exception) && !interface_exists($exception) || !$this->isAValidThrowable($exception)) { + throw new InvalidArgumentException(sprintf('Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', $exception)); } } elseif (!$exception instanceof \Exception && !$exception instanceof \Throwable) { - throw new InvalidArgumentException(\sprintf('Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', \is_object($exception) ? \get_class($exception) : \gettype($exception))); + throw new InvalidArgumentException(sprintf('Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', is_object($exception) ? get_class($exception) : gettype($exception))); } $this->exception = $exception; } public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) { - if (\is_string($this->exception)) { + if (is_string($this->exception)) { $classname = $this->exception; $reflection = new ReflectionClass($classname); $constructor = $reflection->getConstructor(); @@ -46001,7 +49165,7 @@ class ThrowPromise implements \Prophecy\Promise\PromiseInterface */ private function isAValidThrowable($exception) { - return \is_a($exception, 'Exception', \true) || \is_a($exception, 'Throwable', \true); + return is_a($exception, 'Exception', \true) || is_a($exception, 'Throwable', \true); } } reveal(); - if (!\method_exists($double, $methodName)) { - throw new MethodNotFoundException(\sprintf('Method `%s::%s()` is not defined.', \get_class($double), $methodName), \get_class($double), $methodName, $arguments); + if (!method_exists($double, $methodName)) { + throw new MethodNotFoundException(sprintf('Method `%s::%s()` is not defined.', get_class($double), $methodName), get_class($double), $methodName, $arguments); } $this->objectProphecy = $objectProphecy; $this->methodName = $methodName; $reflectedMethod = new \ReflectionMethod($double, $methodName); if ($reflectedMethod->isFinal()) { - throw new MethodProphecyException(\sprintf("Can not add prophecy for a method `%s::%s()`\n" . "as it is a final method.", \get_class($double), $methodName), $this); + throw new MethodProphecyException(sprintf("Can not add prophecy for a method `%s::%s()`\n" . "as it is a final method.", get_class($double), $methodName), $this); } $this->withArguments($arguments); - $hasTentativeReturnType = \method_exists($reflectedMethod, 'hasTentativeReturnType') && $reflectedMethod->hasTentativeReturnType(); + $hasTentativeReturnType = method_exists($reflectedMethod, 'hasTentativeReturnType') && $reflectedMethod->hasTentativeReturnType(); if (\true === $reflectedMethod->hasReturnType() || $hasTentativeReturnType) { if ($hasTentativeReturnType) { $reflectionType = $reflectedMethod->getTentativeReturnType(); @@ -46093,12 +49257,12 @@ class MethodProphecy } elseif ($reflectionType instanceof ReflectionUnionType) { $types = $reflectionType->getTypes(); } else { - throw new MethodProphecyException(\sprintf("Can not add prophecy for a method `%s::%s()`\nas its return type is not supported by Prophecy yet.", \get_class($double), $methodName), $this); + throw new MethodProphecyException(sprintf("Can not add prophecy for a method `%s::%s()`\nas its return type is not supported by Prophecy yet.", get_class($double), $methodName), $this); } - $types = \array_map(function (ReflectionNamedType $type) { + $types = array_map(function (ReflectionNamedType $type) { return $type->getName(); }, $types); - \usort($types, static function (string $type1, string $type2) { + usort($types, static function (string $type1, string $type2) { // null is lowest priority if ($type2 == 'null') { return -1; @@ -46107,7 +49271,7 @@ class MethodProphecy } // objects are higher priority than scalars $isObject = static function ($type) { - return \class_exists($type) || \interface_exists($type); + return class_exists($type) || interface_exists($type); }; if ($isObject($type1) && !$isObject($type2)) { return -1; @@ -46121,7 +49285,7 @@ class MethodProphecy if ('void' === $defaultType) { $this->voidReturnType = \true; } - $this->will(function () use($defaultType) { + $this->will(function ($args, \Prophecy\Prophecy\ObjectProphecy $object, \Prophecy\Prophecy\MethodProphecy $method) use ($defaultType) { switch ($defaultType) { case 'void': return; @@ -46135,6 +49299,12 @@ class MethodProphecy return \false; case 'array': return array(); + case 'true': + return \true; + case 'false': + return \false; + case 'null': + return null; case 'callable': case 'Closure': return function () { @@ -46144,7 +49314,13 @@ class MethodProphecy return (function () { yield; })(); + case 'object': + $prophet = new Prophet(); + return $prophet->prophesize()->reveal(); default: + if (!class_exists($defaultType) && !interface_exists($defaultType)) { + throw new MethodProphecyException(sprintf('Cannot create a return value for the method as the type "%s" is not supported. Configure an explicit return value instead.', $defaultType), $method); + } $prophet = new Prophet(); return $prophet->prophesize($defaultType)->reveal(); } @@ -46162,11 +49338,11 @@ class MethodProphecy */ public function withArguments($arguments) { - if (\is_array($arguments)) { + if (is_array($arguments)) { $arguments = new Argument\ArgumentsWildcard($arguments); } if (!$arguments instanceof Argument\ArgumentsWildcard) { - throw new InvalidArgumentException(\sprintf("Either an array or an instance of ArgumentsWildcard expected as\n" . 'a `MethodProphecy::withArguments()` argument, but got %s.', \gettype($arguments))); + throw new InvalidArgumentException(sprintf("Either an array or an instance of ArgumentsWildcard expected as\n" . 'a `MethodProphecy::withArguments()` argument, but got %s.', gettype($arguments))); } $this->argumentsWildcard = $arguments; return $this; @@ -46182,11 +49358,11 @@ class MethodProphecy */ public function will($promise) { - if (\is_callable($promise)) { + if (is_callable($promise)) { $promise = new Promise\CallbackPromise($promise); } if (!$promise instanceof Promise\PromiseInterface) { - throw new InvalidArgumentException(\sprintf('Expected callable or instance of PromiseInterface, but got %s.', \gettype($promise))); + throw new InvalidArgumentException(sprintf('Expected callable or instance of PromiseInterface, but got %s.', gettype($promise))); } $this->bindToObjectProphecy(); $this->promise = $promise; @@ -46197,14 +49373,16 @@ class MethodProphecy * * @see \Prophecy\Promise\ReturnPromise * + * @param mixed ...$return a list of return values + * * @return $this */ - public function willReturn() + public function willReturn(...$return) { if ($this->voidReturnType) { throw new MethodProphecyException("The method \"{$this->methodName}\" has a void return type, and so cannot return anything", $this); } - return $this->will(new Promise\ReturnPromise(\func_get_args())); + return $this->will(new Promise\ReturnPromise($return)); } /** * @param array $items @@ -46219,10 +49397,10 @@ class MethodProphecy if ($this->voidReturnType) { throw new MethodProphecyException("The method \"{$this->methodName}\" has a void return type, and so cannot yield anything", $this); } - if (!\is_array($items)) { - throw new InvalidArgumentException(\sprintf('Expected array, but got %s.', \gettype($items))); + if (!is_array($items)) { + throw new InvalidArgumentException(sprintf('Expected array, but got %s.', gettype($items))); } - $generator = function () use($items, $return) { + $generator = function () use ($items, $return) { yield from $items; return $return; }; @@ -46270,11 +49448,11 @@ class MethodProphecy */ public function should($prediction) { - if (\is_callable($prediction)) { + if (is_callable($prediction)) { $prediction = new Prediction\CallbackPrediction($prediction); } if (!$prediction instanceof Prediction\PredictionInterface) { - throw new InvalidArgumentException(\sprintf('Expected callable or instance of PredictionInterface, but got %s.', \gettype($prediction))); + throw new InvalidArgumentException(sprintf('Expected callable or instance of PredictionInterface, but got %s.', gettype($prediction))); } $this->bindToObjectProphecy(); $this->prediction = $prediction; @@ -46338,11 +49516,11 @@ class MethodProphecy */ public function shouldHave($prediction) { - if (\is_callable($prediction)) { + if (is_callable($prediction)) { $prediction = new Prediction\CallbackPrediction($prediction); } if (!$prediction instanceof Prediction\PredictionInterface) { - throw new InvalidArgumentException(\sprintf('Expected callable or instance of PredictionInterface, but got %s.', \gettype($prediction))); + throw new InvalidArgumentException(sprintf('Expected callable or instance of PredictionInterface, but got %s.', gettype($prediction))); } if (null === $this->promise && !$this->voidReturnType) { $this->willReturn(); @@ -46519,8 +49697,8 @@ class MethodProphecy namespace Prophecy\Prophecy; use Prophecy\Comparator\FactoryProvider; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -use PHPUnit\SebastianBergmann\Comparator\Factory as ComparatorFactory; +use PHPUnitPHAR\SebastianBergmann\Comparator\ComparisonFailure; +use PHPUnitPHAR\SebastianBergmann\Comparator\Factory as ComparatorFactory; use Prophecy\Call\Call; use Prophecy\Doubler\LazyDouble; use Prophecy\Argument\ArgumentsWildcard; @@ -46537,6 +49715,9 @@ use Prophecy\Exception\Prediction\PredictionException; */ class ObjectProphecy implements \Prophecy\Prophecy\ProphecyInterface { + /** + * @var LazyDouble + */ private $lazyDouble; private $callCenter; private $revealer; @@ -46545,6 +49726,9 @@ class ObjectProphecy implements \Prophecy\Prophecy\ProphecyInterface * @var array> */ private $methodProphecies = array(); + /** + * @param LazyDouble $lazyDouble + */ public function __construct(LazyDouble $lazyDouble, CallCenter $callCenter = null, \Prophecy\Prophecy\RevealerInterface $revealer = null, ComparatorFactory $comparatorFactory = null) { $this->lazyDouble = $lazyDouble; @@ -46559,7 +49743,7 @@ class ObjectProphecy implements \Prophecy\Prophecy\ProphecyInterface * * @return $this * - * @template U + * @template U of object * @phpstan-param class-string $class * @phpstan-this-out static */ @@ -46575,7 +49759,7 @@ class ObjectProphecy implements \Prophecy\Prophecy\ProphecyInterface * * @return $this * - * @template U + * @template U of object * @phpstan-param class-string $interface * @phpstan-this-out static */ @@ -46623,7 +49807,7 @@ class ObjectProphecy implements \Prophecy\Prophecy\ProphecyInterface */ public function addMethodProphecy(\Prophecy\Prophecy\MethodProphecy $methodProphecy) { - $methodName = \strtolower($methodProphecy->getMethodName()); + $methodName = strtolower($methodProphecy->getMethodName()); if (!isset($this->methodProphecies[$methodName])) { $this->methodProphecies[$methodName] = array(); } @@ -46643,7 +49827,7 @@ class ObjectProphecy implements \Prophecy\Prophecy\ProphecyInterface if (null === $methodName) { return $this->methodProphecies; } - $methodName = \strtolower($methodName); + $methodName = strtolower($methodName); if (!isset($this->methodProphecies[$methodName])) { return array(); } @@ -46686,7 +49870,7 @@ class ObjectProphecy implements \Prophecy\Prophecy\ProphecyInterface */ public function checkProphecyMethodsPredictions() { - $exception = new AggregateException(\sprintf("%s:\n", \get_class($this->reveal()))); + $exception = new AggregateException(sprintf("%s:\n", get_class($this->reveal()))); $exception->setObjectProphecy($this); $this->callCenter->checkUnexpectedCalls(); foreach ($this->methodProphecies as $prophecies) { @@ -46698,7 +49882,7 @@ class ObjectProphecy implements \Prophecy\Prophecy\ProphecyInterface } } } - if (\count($exception->getExceptions())) { + if (count($exception->getExceptions())) { throw $exception; } } @@ -46842,10 +50026,10 @@ class Revealer implements \Prophecy\Prophecy\RevealerInterface */ public function reveal($value) { - if (\is_array($value)) { - return \array_map(array($this, __FUNCTION__), $value); + if (is_array($value)) { + return array_map(array($this, __FUNCTION__), $value); } - if (!\is_object($value)) { + if (!is_object($value)) { return $value; } if ($value instanceof \Prophecy\Prophecy\ProphecyInterface) { @@ -46898,6 +50082,7 @@ use Prophecy\Doubler\CachedDoubler; use Prophecy\Doubler\Doubler; use Prophecy\Doubler\LazyDouble; use Prophecy\Doubler\ClassPatch; +use Prophecy\Exception\Doubler\ClassNotFoundException; use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\RevealerInterface; use Prophecy\Prophecy\Revealer; @@ -46948,16 +50133,19 @@ class Prophet * * @template T of object * @phpstan-param class-string|null $classOrInterface - * @phpstan-return ObjectProphecy + * @phpstan-return ($classOrInterface is null ? ObjectProphecy : ObjectProphecy) */ public function prophesize($classOrInterface = null) { $this->prophecies[] = $prophecy = new ObjectProphecy(new LazyDouble($this->doubler), new CallCenter($this->util), $this->revealer); - if ($classOrInterface && \class_exists($classOrInterface)) { - return $prophecy->willExtend($classOrInterface); - } - if ($classOrInterface && \interface_exists($classOrInterface)) { - return $prophecy->willImplement($classOrInterface); + if ($classOrInterface) { + if (class_exists($classOrInterface)) { + return $prophecy->willExtend($classOrInterface); + } + if (interface_exists($classOrInterface)) { + return $prophecy->willImplement($classOrInterface); + } + throw new ClassNotFoundException(sprintf('Cannot prophesize class %s, because it cannot be found.', $classOrInterface), $classOrInterface); } return $prophecy; } @@ -46996,7 +50184,7 @@ class Prophet $exception->append($e); } } - if (\count($exception->getExceptions())) { + if (count($exception->getExceptions())) { throw $exception; } } @@ -47006,7 +50194,7 @@ class Prophet namespace Prophecy\Util; use Prophecy\Prophecy\ProphecyInterface; -use PHPUnit\SebastianBergmann\RecursionContext\Context; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\Context; /* * This file is part of the Prophecy. * (c) Konstantin Kudryashov @@ -47051,7 +50239,7 @@ class ExportUtil */ public static function toArray($value) { - if (!\is_object($value)) { + if (!is_object($value)) { return (array) $value; } $array = array(); @@ -47060,7 +50248,7 @@ class ExportUtil // private $property => "\0Classname\0property" // protected $property => "\0*\0property" // public $property => "property" - if (\preg_match('/^\\0.+\\0(.+)$/', $key, $matches)) { + if (preg_match('/^\0.+\0(.+)$/', $key, $matches)) { $key = $matches[1]; } // See https://github.com/php/php-src/commit/5721132 @@ -47075,7 +50263,7 @@ class ExportUtil if ($value instanceof \SplObjectStorage) { foreach ($value as $key => $val) { // Use the same identifier that would be printed alongside the object's representation elsewhere. - $array[\spl_object_id($val)] = array('obj' => $val, 'inf' => $value->getInfo()); + $array[spl_object_id($val)] = array('obj' => $val, 'inf' => $value->getInfo()); } } return $array; @@ -47100,55 +50288,58 @@ class ExportUtil if ($value === \false) { return 'false'; } - if (\is_float($value) && \floatval(\intval($value)) === $value) { + if (is_float($value) && floatval(intval($value)) === $value) { return "{$value}.0"; } - if (\is_resource($value)) { - return \sprintf('resource(%d) of type (%s)', (int) $value, \get_resource_type($value)); + if (is_resource($value)) { + return sprintf('resource(%d) of type (%s)', (int) $value, get_resource_type($value)); } - if (\is_string($value)) { + if (is_string($value)) { // Match for most non printable chars somewhat taking multibyte chars into account - if (\preg_match('/[^\\x09-\\x0d\\x20-\\xff]/', $value)) { - return 'Binary String: 0x' . \bin2hex($value); + if (preg_match('/[^\x09-\x0d\x20-\xff]/', $value)) { + return 'Binary String: 0x' . bin2hex($value); } - return "'" . \str_replace(array("\r\n", "\n\r", "\r"), array("\n", "\n", "\n"), $value) . "'"; + return "'" . str_replace(array("\r\n", "\n\r", "\r"), array("\n", "\n", "\n"), $value) . "'"; } - $whitespace = \str_repeat(' ', 4 * $indentation); + $whitespace = str_repeat(' ', 4 * $indentation); if (!$processed) { $processed = new Context(); } - if (\is_array($value)) { + if (is_array($value)) { if (($key = $processed->contains($value)) !== \false) { return 'Array &' . $key; } + \assert(\is_array($value)); $array = $value; $key = $processed->add($value); $values = ''; - if (\count($array) > 0) { + if (count($array) > 0) { foreach ($array as $k => $v) { - $values .= \sprintf('%s %s => %s' . "\n", $whitespace, self::recursiveExport($k, $indentation), self::recursiveExport($value[$k], $indentation + 1, $processed)); + $values .= sprintf('%s %s => %s' . "\n", $whitespace, self::recursiveExport($k, $indentation), self::recursiveExport($value[$k], $indentation + 1, $processed)); } $values = "\n" . $values . $whitespace; } - return \sprintf('Array &%s (%s)', $key, $values); + return sprintf('Array &%s (%s)', $key, $values); } - if (\is_object($value)) { - $class = \get_class($value); + if (is_object($value)) { + $class = get_class($value); if ($processed->contains($value)) { - return \sprintf('%s#%d Object', $class, \spl_object_id($value)); + \assert(\is_object($value)); + return sprintf('%s#%d Object', $class, spl_object_id($value)); } $processed->add($value); + \assert(\is_object($value)); $values = ''; $array = self::toArray($value); - if (\count($array) > 0) { + if (count($array) > 0) { foreach ($array as $k => $v) { - $values .= \sprintf('%s %s => %s' . "\n", $whitespace, self::recursiveExport($k, $indentation), self::recursiveExport($v, $indentation + 1, $processed)); + $values .= sprintf('%s %s => %s' . "\n", $whitespace, self::recursiveExport($k, $indentation), self::recursiveExport($v, $indentation + 1, $processed)); } $values = "\n" . $values . $whitespace; } - return \sprintf('%s#%d Object (%s)', $class, \spl_object_id($value), $values); + return sprintf('%s#%d Object (%s)', $class, spl_object_id($value), $values); } - return \var_export($value, \true); + return var_export($value, \true); } } ' . \call_user_func($stringify, $item); - }, $value, \array_keys($value))) . ']'; + return '[' . implode(', ', array_map(function ($item, $key) use ($stringify) { + return (is_integer($key) ? $key : ('"' . $key . '"')) . ' => ' . call_user_func($stringify, $item); + }, $value, array_keys($value))) . ']'; } if (\is_resource($value)) { - return \get_resource_type($value) . ':' . $value; + return get_resource_type($value) . ':' . $value; } if (\is_object($value)) { - return $exportObject ? \Prophecy\Util\ExportUtil::export($value) : \sprintf('%s#%s', \get_class($value), \spl_object_id($value)); + return $exportObject ? \Prophecy\Util\ExportUtil::export($value) : sprintf('%s#%s', get_class($value), spl_object_id($value)); } if (\is_bool($value)) { return $value ? 'true' : 'false'; } if (\is_string($value)) { - $str = \sprintf('"%s"', \str_replace("\n", '\\n', $value)); - if (!$this->verbose && 50 <= \strlen($str)) { - return \substr($str, 0, 50) . '"...'; + $str = sprintf('"%s"', str_replace("\n", '\n', $value)); + if (!$this->verbose && 50 <= strlen($str)) { + return substr($str, 0, 50) . '"...'; } return $str; } @@ -47230,5794 +50421,8482 @@ class StringUtil public function stringifyCalls(array $calls) { $self = $this; - return \implode(\PHP_EOL, \array_map(function (Call $call) use($self) { - return \sprintf(' - %s(%s) @ %s', $call->getMethodName(), \implode(', ', \array_map(array($self, 'stringify'), $call->getArguments())), \str_replace(\GETCWD() . \DIRECTORY_SEPARATOR, '', $call->getCallPlace())); + return implode(\PHP_EOL, array_map(function (Call $call) use ($self) { + return sprintf(' - %s(%s) @ %s', $call->getMethodName(), implode(', ', array_map(array($self, 'stringify'), $call->getArguments())), str_replace(GETCWD() . \DIRECTORY_SEPARATOR, '', $call->getCallPlace())); }, $calls)); } } - - - - - This Schema file defines the rules by which the XML configuration file of PHPUnit 9.6 may be structured. - - - - - - Root Element - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The main type specifying the document structure - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit; +namespace PHPUnitPHAR\PHPStan\PhpDocParser\Ast; -use Throwable; /** - * @internal This class is not covered by the backward compatibility promise for PHPUnit + * Inspired by https://github.com/nikic/PHP-Parser/tree/36a6dcd04e7b0285e8f0868f44bd4927802f7df1 + * + * Copyright (c) 2011, Nikita Popov + * All rights reserved. */ -interface Exception extends Throwable +abstract class AbstractNodeVisitor implements NodeVisitor { + public function beforeTraverse(array $nodes): ?array + { + return null; + } + public function enterNode(Node $node) + { + return null; + } + public function leaveNode(Node $node) + { + return null; + } + public function afterTraverse(array $nodes): ?array + { + return null; + } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; +namespace PHPUnitPHAR\PHPStan\PhpDocParser\Ast; -use const DEBUG_BACKTRACE_IGNORE_ARGS; -use const PHP_EOL; -use function array_shift; -use function array_unshift; -use function assert; -use function class_exists; -use function count; -use function debug_backtrace; -use function explode; -use function file_get_contents; -use function func_get_args; -use function implode; -use function interface_exists; -use function is_array; -use function is_bool; -use function is_int; -use function is_iterable; -use function is_object; -use function is_string; -use function preg_match; -use function preg_split; +final class Attribute +{ + public const START_LINE = 'startLine'; + public const END_LINE = 'endLine'; + public const START_INDEX = 'startIndex'; + public const END_INDEX = 'endIndex'; + public const ORIGINAL_NODE = 'originalNode'; +} +key = $key; + $this->value = $value; } - /** - * Asserts that an array does not have a specified key. - * - * @param int|string $key - * @param array|ArrayAccess $array - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - */ - public static function assertArrayNotHasKey($key, $array, string $message = '') : void + public function __toString(): string { - if (!(is_int($key) || is_string($key))) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'integer or string'); - } - if (!(is_array($array) || $array instanceof ArrayAccess)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'array or ArrayAccess'); + if ($this->key !== null) { + return sprintf('%s => %s', $this->key, $this->value); } - $constraint = new LogicalNot(new ArrayHasKey($key)); - static::assertThat($array, $constraint, $message); + return (string) $this->value; } +} +items = $items; } - public static function assertContainsEquals($needle, iterable $haystack, string $message = '') : void + public function __toString(): string { - $constraint = new TraversableContainsEqual($needle); - static::assertThat($haystack, $constraint, $message); + return '[' . implode(', ', $this->items) . ']'; } - /** - * Asserts that a haystack does not contain a needle. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - */ - public static function assertNotContains($needle, iterable $haystack, string $message = '') : void +} +value = $value; } - /** - * Asserts that a haystack contains only values of a given type. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = '') : void + public function __toString(): string { - if ($isNativeType === null) { - $isNativeType = Type::isType($type); - } - static::assertThat($haystack, new TraversableContainsOnly($type, $isNativeType), $message); + return $this->value; } - /** - * Asserts that a haystack contains only instances of a given class name. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = '') : void +} +value = $value; } - /** - * Asserts that a haystack does not contain only values of a given type. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = '') : void + public function __toString(): string { - if ($isNativeType === null) { - $isNativeType = Type::isType($type); - } - static::assertThat($haystack, new LogicalNot(new TraversableContainsOnly($type, $isNativeType)), $message); + return $this->value; } - /** - * Asserts the number of elements of an array, Countable or Traversable. - * - * @param Countable|iterable $haystack - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - */ - public static function assertCount(int $expectedCount, $haystack, string $message = '') : void +} +value = $value; + } + public function __toString(): string + { + return $this->value; + } +} +className = $className; + $this->name = $name; + } + public function __toString(): string + { + if ($this->className === '') { + return $this->name; } - static::assertThat($haystack, new Count($expectedCount), $message); + return "{$this->className}::{$this->name}"; + } +} +value = $value; + } + public function __toString(): string + { + return self::escape($this->value); + } + public static function unescape(string $value): string + { + // from https://github.com/doctrine/annotations/blob/a9ec7af212302a75d1f92fa65d3abfbd16245a2a/lib/Doctrine/Common/Annotations/DocLexer.php#L103-L107 + return str_replace('""', '"', substr($value, 1, strlen($value) - 2)); + } + private static function escape(string $value): string + { + // from https://github.com/phpstan/phpdoc-parser/issues/205#issuecomment-1662323656 + return sprintf('"%s"', str_replace('"', '""', $value)); } +} +quoteType = $quoteType; + } + public function __toString(): string + { + if ($this->quoteType === self::SINGLE_QUOTED) { + // from https://github.com/nikic/PHP-Parser/blob/0ffddce52d816f72d0efc4d9b02e276d3309ef01/lib/PhpParser/PrettyPrinter/Standard.php#L1007 + return sprintf("'%s'", addcslashes($this->value, '\'\\')); } - $constraint = new LogicalNot(new Count($expectedCount)); - static::assertThat($haystack, $constraint, $message); + // from https://github.com/nikic/PHP-Parser/blob/0ffddce52d816f72d0efc4d9b02e276d3309ef01/lib/PhpParser/PrettyPrinter/Standard.php#L1010-L1040 + return sprintf('"%s"', $this->escapeDoubleQuotedString()); } - /** - * Asserts that two variables are equal. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertEquals($expected, $actual, string $message = '') : void + private function escapeDoubleQuotedString(): string { - $constraint = new IsEqual($expected); - static::assertThat($actual, $constraint, $message); + $quote = '"'; + $escaped = addcslashes($this->value, "\n\r\t\f\v\$" . $quote . '\\'); + // Escape control characters and non-UTF-8 characters. + // Regex based on https://stackoverflow.com/a/11709412/385378. + $regex = '/( + [\x00-\x08\x0E-\x1F] # Control characters + | [\xC0-\xC1] # Invalid UTF-8 Bytes + | [\xF5-\xFF] # Invalid UTF-8 Bytes + | \xE0(?=[\x80-\x9F]) # Overlong encoding of prior code point + | \xF0(?=[\x80-\x8F]) # Overlong encoding of prior code point + | [\xC2-\xDF](?![\x80-\xBF]) # Invalid UTF-8 Sequence Start + | [\xE0-\xEF](?![\x80-\xBF]{2}) # Invalid UTF-8 Sequence Start + | [\xF0-\xF4](?![\x80-\xBF]{3}) # Invalid UTF-8 Sequence Start + | (?<=[\x00-\x7F\xF5-\xFF])[\x80-\xBF] # Invalid UTF-8 Sequence Middle + | (? */ + private $attributes = []; + /** + * @param mixed $value + */ + public function setAttribute(string $key, $value): void { - $constraint = new IsEqualIgnoringCase($expected); - static::assertThat($actual, $constraint, $message); + $this->attributes[$key] = $value; + } + public function hasAttribute(string $key): bool + { + return array_key_exists($key, $this->attributes); } /** - * Asserts that two variables are equal (with delta). - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return mixed */ - public static function assertEqualsWithDelta($expected, $actual, float $delta, string $message = '') : void + public function getAttribute(string $key) { - $constraint = new IsEqualWithDelta($expected, $delta); - static::assertThat($actual, $constraint, $message); + if ($this->hasAttribute($key)) { + return $this->attributes[$key]; + } + return null; } +} + Visitors */ + private $visitors = []; + /** @var bool Whether traversal should be stopped */ + private $stopTraversal; /** - * @throws ExpectationFailedException + * @param list $visitors */ - public static function assertObjectEquals(object $expected, object $actual, string $method = 'equals', string $message = '') : void + public function __construct(array $visitors) { - static::assertThat($actual, static::objectEquals($expected, $method), $message); + $this->visitors = $visitors; } /** - * Asserts that a variable is empty. + * Traverses an array of nodes using the registered visitors. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @param Node[] $nodes Array of nodes * - * @psalm-assert empty $actual + * @return Node[] Traversed array of nodes */ - public static function assertEmpty($actual, string $message = '') : void + public function traverse(array $nodes): array { - if ($actual instanceof Generator) { - self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + $this->stopTraversal = \false; + foreach ($this->visitors as $visitor) { + $return = $visitor->beforeTraverse($nodes); + if ($return === null) { + continue; + } + $nodes = $return; } - static::assertThat($actual, static::isEmpty(), $message); + $nodes = $this->traverseArray($nodes); + foreach ($this->visitors as $visitor) { + $return = $visitor->afterTraverse($nodes); + if ($return === null) { + continue; + } + $nodes = $return; + } + return $nodes; } /** - * Asserts that a variable is not empty. + * Recursively traverse a node. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @param Node $node Node to traverse. * - * @psalm-assert !empty $actual + * @return Node Result of traversal (may be original node or new one) */ - public static function assertNotEmpty($actual, string $message = '') : void + private function traverseNode(Node $node): Node { - if ($actual instanceof Generator) { - self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + $subNodeNames = array_keys(get_object_vars($node)); + foreach ($subNodeNames as $name) { + $subNode =& $node->{$name}; + if (is_array($subNode)) { + $subNode = $this->traverseArray($subNode); + if ($this->stopTraversal) { + break; + } + } elseif ($subNode instanceof Node) { + $traverseChildren = \true; + $breakVisitorIndex = null; + foreach ($this->visitors as $visitorIndex => $visitor) { + $return = $visitor->enterNode($subNode); + if ($return === null) { + continue; + } + if ($return instanceof Node) { + $this->ensureReplacementReasonable($subNode, $return); + $subNode = $return; + } elseif ($return === self::DONT_TRAVERSE_CHILDREN) { + $traverseChildren = \false; + } elseif ($return === self::DONT_TRAVERSE_CURRENT_AND_CHILDREN) { + $traverseChildren = \false; + $breakVisitorIndex = $visitorIndex; + break; + } elseif ($return === self::STOP_TRAVERSAL) { + $this->stopTraversal = \true; + break 2; + } else { + throw new LogicException('enterNode() returned invalid value of type ' . gettype($return)); + } + } + if ($traverseChildren) { + $subNode = $this->traverseNode($subNode); + if ($this->stopTraversal) { + break; + } + } + foreach ($this->visitors as $visitorIndex => $visitor) { + $return = $visitor->leaveNode($subNode); + if ($return !== null) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($subNode, $return); + $subNode = $return; + } elseif ($return === self::STOP_TRAVERSAL) { + $this->stopTraversal = \true; + break 2; + } elseif (is_array($return)) { + throw new LogicException('leaveNode() may only return an array ' . 'if the parent structure is an array'); + } else { + throw new LogicException('leaveNode() returned invalid value of type ' . gettype($return)); + } + } + if ($breakVisitorIndex === $visitorIndex) { + break; + } + } + } } - static::assertThat($actual, static::logicalNot(static::isEmpty()), $message); + return $node; } /** - * Asserts that a value is greater than another value. + * Recursively traverse array (usually of nodes). * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertGreaterThan($expected, $actual, string $message = '') : void - { - static::assertThat($actual, static::greaterThan($expected), $message); - } - /** - * Asserts that a value is greater than or equal to another value. + * @param mixed[] $nodes Array to traverse * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return mixed[] Result of traversal (may be original array or changed one) */ - public static function assertGreaterThanOrEqual($expected, $actual, string $message = '') : void + private function traverseArray(array $nodes): array { - static::assertThat($actual, static::greaterThanOrEqual($expected), $message); + $doNodes = []; + foreach ($nodes as $i => &$node) { + if ($node instanceof Node) { + $traverseChildren = \true; + $breakVisitorIndex = null; + foreach ($this->visitors as $visitorIndex => $visitor) { + $return = $visitor->enterNode($node); + if ($return === null) { + continue; + } + if ($return instanceof Node) { + $this->ensureReplacementReasonable($node, $return); + $node = $return; + } elseif (is_array($return)) { + $doNodes[] = [$i, $return]; + continue 2; + } elseif ($return === self::REMOVE_NODE) { + $doNodes[] = [$i, []]; + continue 2; + } elseif ($return === self::DONT_TRAVERSE_CHILDREN) { + $traverseChildren = \false; + } elseif ($return === self::DONT_TRAVERSE_CURRENT_AND_CHILDREN) { + $traverseChildren = \false; + $breakVisitorIndex = $visitorIndex; + break; + } elseif ($return === self::STOP_TRAVERSAL) { + $this->stopTraversal = \true; + break 2; + } else { + throw new LogicException('enterNode() returned invalid value of type ' . gettype($return)); + } + } + if ($traverseChildren) { + $node = $this->traverseNode($node); + if ($this->stopTraversal) { + break; + } + } + foreach ($this->visitors as $visitorIndex => $visitor) { + $return = $visitor->leaveNode($node); + if ($return !== null) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($node, $return); + $node = $return; + } elseif (is_array($return)) { + $doNodes[] = [$i, $return]; + break; + } elseif ($return === self::REMOVE_NODE) { + $doNodes[] = [$i, []]; + break; + } elseif ($return === self::STOP_TRAVERSAL) { + $this->stopTraversal = \true; + break 2; + } else { + throw new LogicException('leaveNode() returned invalid value of type ' . gettype($return)); + } + } + if ($breakVisitorIndex === $visitorIndex) { + break; + } + } + } elseif (is_array($node)) { + throw new LogicException('Invalid node structure: Contains nested arrays'); + } + } + if (count($doNodes) > 0) { + while ([$i, $replace] = array_pop($doNodes)) { + array_splice($nodes, $i, 1, $replace); + } + } + return $nodes; } - /** - * Asserts that a value is smaller than another value. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertLessThan($expected, $actual, string $message = '') : void + private function ensureReplacementReasonable(Node $old, Node $new): void { - static::assertThat($actual, static::lessThan($expected), $message); + if ($old instanceof TypeNode && !$new instanceof TypeNode) { + throw new LogicException(sprintf('Trying to replace TypeNode with %s', get_class($new))); + } + if ($old instanceof ConstExprNode && !$new instanceof ConstExprNode) { + throw new LogicException(sprintf('Trying to replace ConstExprNode with %s', get_class($new))); + } + if ($old instanceof PhpDocChildNode && !$new instanceof PhpDocChildNode) { + throw new LogicException(sprintf('Trying to replace PhpDocChildNode with %s', get_class($new))); + } + if ($old instanceof PhpDocTagValueNode && !$new instanceof PhpDocTagValueNode) { + throw new LogicException(sprintf('Trying to replace PhpDocTagValueNode with %s', get_class($new))); + } } +} + $node stays as-is + * * array (of Nodes) + * => The return value is merged into the parent array (at the position of the $node) + * * NodeTraverser::REMOVE_NODE + * => $node is removed from the parent array + * * NodeTraverser::DONT_TRAVERSE_CHILDREN + * => Children of $node are not traversed. $node stays as-is + * * NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN + * => Further visitors for the current node are skipped, and its children are not + * traversed. $node stays as-is. + * * NodeTraverser::STOP_TRAVERSAL + * => Traversal is aborted. $node stays as-is + * * otherwise + * => $node is set to the return value + * + * @param Node $node Node + * + * @return Node|Node[]|NodeTraverser::*|null Replacement node (or special return value) */ - public static function assertFileEquals(string $expected, string $actual, string $message = '') : void - { - static::assertFileExists($expected, $message); - static::assertFileExists($actual, $message); - $constraint = new IsEqual(file_get_contents($expected)); - static::assertThat(file_get_contents($actual), $constraint, $message); - } + public function enterNode(Node $node); /** - * Asserts that the contents of one file is equal to the contents of another - * file (canonicalizing). + * Called when leaving a node. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * Return value semantics: + * * null + * => $node stays as-is + * * NodeTraverser::REMOVE_NODE + * => $node is removed from the parent array + * * NodeTraverser::STOP_TRAVERSAL + * => Traversal is aborted. $node stays as-is + * * array (of Nodes) + * => The return value is merged into the parent array (at the position of the $node) + * * otherwise + * => $node is set to the return value + * + * @param Node $node Node + * + * @return Node|Node[]|NodeTraverser::REMOVE_NODE|NodeTraverser::STOP_TRAVERSAL|null Replacement node (or special return value) */ - public static function assertFileEqualsCanonicalizing(string $expected, string $actual, string $message = '') : void - { - static::assertFileExists($expected, $message); - static::assertFileExists($actual, $message); - $constraint = new IsEqualCanonicalizing(file_get_contents($expected)); - static::assertThat(file_get_contents($actual), $constraint, $message); - } + public function leaveNode(Node $node); /** - * Asserts that the contents of one file is equal to the contents of another - * file (ignoring case). + * Called once after traversal. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * Return value semantics: + * * null: $nodes stays as-is + * * otherwise: $nodes is set to the return value + * + * @param Node[] $nodes Array of nodes + * + * @return Node[]|null Array of nodes */ - public static function assertFileEqualsIgnoringCase(string $expected, string $actual, string $message = '') : void + public function afterTraverse(array $nodes): ?array; +} +setAttribute(Attribute::ORIGINAL_NODE, $originalNode); + return $node; } - /** - * Asserts that the contents of one file is not equal to the contents of - * another file. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertFileNotEquals(string $expected, string $actual, string $message = '') : void +} +type = $type; + $this->parameter = $parameter; + $this->method = $method; + $this->isNegated = $isNegated; + $this->isEquality = $isEquality; + $this->description = $description; } - /** - * Asserts that the contents of one file is not equal to the contents of another - * file (canonicalizing). - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertFileNotEqualsCanonicalizing(string $expected, string $actual, string $message = '') : void + public function __toString(): string { - static::assertFileExists($expected, $message); - static::assertFileExists($actual, $message); - $constraint = new LogicalNot(new IsEqualCanonicalizing(file_get_contents($expected))); - static::assertThat(file_get_contents($actual), $constraint, $message); + $isNegated = $this->isNegated ? '!' : ''; + $isEquality = $this->isEquality ? '=' : ''; + return trim("{$isNegated}{$isEquality}{$this->type} {$this->parameter}->{$this->method}() {$this->description}"); } - /** - * Asserts that the contents of one file is not equal to the contents of another - * file (ignoring case). - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertFileNotEqualsIgnoringCase(string $expected, string $actual, string $message = '') : void +} +type = $type; + $this->parameter = $parameter; + $this->property = $property; + $this->isNegated = $isNegated; + $this->isEquality = $isEquality; + $this->description = $description; } - /** - * Asserts that the contents of a string is equal - * to the contents of a file. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '') : void + public function __toString(): string { - static::assertFileExists($expectedFile, $message); - $constraint = new IsEqual(file_get_contents($expectedFile)); - static::assertThat($actualString, $constraint, $message); + $isNegated = $this->isNegated ? '!' : ''; + $isEquality = $this->isEquality ? '=' : ''; + return trim("{$isNegated}{$isEquality}{$this->type} {$this->parameter}->{$this->property} {$this->description}"); } - /** - * Asserts that the contents of a string is equal - * to the contents of a file (canonicalizing). - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = '') : void +} +type = $type; + $this->parameter = $parameter; + $this->isNegated = $isNegated; + $this->isEquality = $isEquality; + $this->description = $description; } - /** - * Asserts that the contents of a string is equal - * to the contents of a file (ignoring case). - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = '') : void + public function __toString(): string { - static::assertFileExists($expectedFile, $message); - $constraint = new IsEqualIgnoringCase(file_get_contents($expectedFile)); - static::assertThat($actualString, $constraint, $message); + $isNegated = $this->isNegated ? '!' : ''; + $isEquality = $this->isEquality ? '=' : ''; + return trim("{$isNegated}{$isEquality}{$this->type} {$this->parameter} {$this->description}"); } - /** - * Asserts that the contents of a string is not equal - * to the contents of a file. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '') : void +} +description = $description; } - /** - * Asserts that the contents of a string is not equal - * to the contents of a file (canonicalizing). - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = '') : void + public function __toString(): string { - static::assertFileExists($expectedFile, $message); - $constraint = new LogicalNot(new IsEqualCanonicalizing(file_get_contents($expectedFile))); - static::assertThat($actualString, $constraint, $message); + return trim($this->description); } +} + */ + public $arguments; /** - * Asserts that the contents of a string is not equal - * to the contents of a file (ignoring case). - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @param list $arguments */ - public static function assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = '') : void + public function __construct(string $name, array $arguments) { - static::assertFileExists($expectedFile, $message); - $constraint = new LogicalNot(new IsEqualIgnoringCase(file_get_contents($expectedFile))); - static::assertThat($actualString, $constraint, $message); + $this->name = $name; + $this->arguments = $arguments; } - /** - * Asserts that a file/dir is readable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertIsReadable(string $filename, string $message = '') : void + public function __toString(): string { - static::assertThat($filename, new IsReadable(), $message); + $arguments = implode(', ', $this->arguments); + return $this->name . '(' . $arguments . ')'; } +} +key = $key; + $this->value = $value; } - /** - * Asserts that a file/dir exists and is not readable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4062 - */ - public static function assertNotIsReadable(string $filename, string $message = '') : void + public function __toString(): string { - self::createWarning('assertNotIsReadable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertIsNotReadable() instead.'); - static::assertThat($filename, new LogicalNot(new IsReadable()), $message); + if ($this->key === null) { + return (string) $this->value; + } + return $this->key . '=' . $this->value; } +} + */ + public $items; /** - * Asserts that a file/dir exists and is writable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @param list $items */ - public static function assertIsWritable(string $filename, string $message = '') : void + public function __construct(array $items) { - static::assertThat($filename, new IsWritable(), $message); + $this->items = $items; } - /** - * Asserts that a file/dir exists and is not writable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertIsNotWritable(string $filename, string $message = '') : void + public function __toString(): string { - static::assertThat($filename, new LogicalNot(new IsWritable()), $message); + $items = implode(', ', $this->items); + return '{' . $items . '}'; } +} +key = $key; + $this->value = $value; } - /** - * Asserts that a directory exists. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertDirectoryExists(string $directory, string $message = '') : void + public function __toString(): string { - static::assertThat($directory, new DirectoryExists(), $message); + if ($this->key === null) { + return (string) $this->value; + } + return $this->key . '=' . $this->value; } - /** - * Asserts that a directory does not exist. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertDirectoryDoesNotExist(string $directory, string $message = '') : void +} +annotation = $annotation; + $this->description = $description; } - /** - * Asserts that a directory does not exist. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4068 - */ - public static function assertDirectoryNotExists(string $directory, string $message = '') : void + public function __toString(): string { - self::createWarning('assertDirectoryNotExists() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDirectoryDoesNotExist() instead.'); - static::assertThat($directory, new LogicalNot(new DirectoryExists()), $message); + return trim("{$this->annotation} {$this->description}"); } - /** - * Asserts that a directory exists and is readable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertDirectoryIsReadable(string $directory, string $message = '') : void +} +type = $type; + $this->description = $description; } - /** - * Asserts that a directory exists and is not readable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertDirectoryIsNotReadable(string $directory, string $message = '') : void + public function __toString(): string { - self::assertDirectoryExists($directory, $message); - self::assertIsNotReadable($directory, $message); + return trim("{$this->type} {$this->description}"); } - /** - * Asserts that a directory exists and is not readable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4071 - */ - public static function assertDirectoryNotIsReadable(string $directory, string $message = '') : void +} +value = $value; } - /** - * Asserts that a directory exists and is writable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertDirectoryIsWritable(string $directory, string $message = '') : void + public function __toString(): string { - self::assertDirectoryExists($directory, $message); - self::assertIsWritable($directory, $message); + return $this->value; + } +} +type = $type; + $this->description = $description; + } + public function __toString(): string + { + return trim("{$this->type} {$this->description}"); + } +} +value = $value; + $this->exceptionArgs = [$exception->getCurrentTokenValue(), $exception->getCurrentTokenType(), $exception->getCurrentOffset(), $exception->getExpectedTokenType(), $exception->getExpectedTokenValue(), $exception->getCurrentTokenLine()]; } + public function __get(string $name): ?ParserException + { + if ($name !== 'exception') { + trigger_error(sprintf('Undefined property: %s::$%s', self::class, $name), E_USER_WARNING); + return null; + } + return new ParserException(...$this->exceptionArgs); + } + public function __toString(): string + { + return $this->value; + } +} +isStatic = $isStatic; + $this->returnType = $returnType; + $this->methodName = $methodName; + $this->parameters = $parameters; + $this->description = $description; + $this->templateTypes = $templateTypes; + } + public function __toString(): string + { + $static = $this->isStatic ? 'static ' : ''; + $returnType = ($this->returnType !== null) ? "{$this->returnType} " : ''; + $parameters = implode(', ', $this->parameters); + $description = ($this->description !== '') ? " {$this->description}" : ''; + $templateTypes = (count($this->templateTypes) > 0) ? '<' . implode(', ', $this->templateTypes) . '>' : ''; + return "{$static}{$returnType}{$this->methodName}{$templateTypes}({$parameters}){$description}"; + } +} +type = $type; + $this->isReference = $isReference; + $this->isVariadic = $isVariadic; + $this->parameterName = $parameterName; + $this->defaultValue = $defaultValue; + } + public function __toString(): string + { + $type = ($this->type !== null) ? "{$this->type} " : ''; + $isReference = $this->isReference ? '&' : ''; + $isVariadic = $this->isVariadic ? '...' : ''; + $default = ($this->defaultValue !== null) ? " = {$this->defaultValue}" : ''; + return "{$type}{$isReference}{$isVariadic}{$this->parameterName}{$default}"; + } +} +type = $type; + $this->description = $description; + } + public function __toString(): string + { + return trim("{$this->type} {$this->description}"); + } +} +type = $type; + $this->parameterName = $parameterName; + $this->description = $description; + } + public function __toString(): string + { + return trim("{$this->type} {$this->parameterName} {$this->description}"); + } +} +parameterName = $parameterName; + $this->description = $description; + } + public function __toString(): string + { + return trim("{$this->parameterName} {$this->description}"); + } +} +parameterName = $parameterName; + $this->description = $description; + } + public function __toString(): string + { + return trim("{$this->parameterName} {$this->description}"); + } +} +type = $type; + $this->parameterName = $parameterName; + $this->description = $description; + } + public function __toString(): string + { + return trim("{$this->type} {$this->parameterName} {$this->description}"); + } +} +type = $type; + $this->isReference = $isReference; + $this->isVariadic = $isVariadic; + $this->parameterName = $parameterName; + $this->description = $description; + } + public function __toString(): string + { + $reference = $this->isReference ? '&' : ''; + $variadic = $this->isVariadic ? '...' : ''; + return trim("{$this->type} {$reference}{$variadic}{$this->parameterName} {$this->description}"); } +} +children = $children; } /** - * Asserts that a file exists. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return PhpDocTagNode[] */ - public static function assertFileExists(string $filename, string $message = '') : void + public function getTags(): array { - static::assertThat($filename, new FileExists(), $message); + return array_filter($this->children, static function (PhpDocChildNode $child): bool { + return $child instanceof PhpDocTagNode; + }); } /** - * Asserts that a file does not exist. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return PhpDocTagNode[] */ - public static function assertFileDoesNotExist(string $filename, string $message = '') : void + public function getTagsByName(string $tagName): array { - static::assertThat($filename, new LogicalNot(new FileExists()), $message); + return array_filter($this->getTags(), static function (PhpDocTagNode $tag) use ($tagName): bool { + return $tag->name === $tagName; + }); } /** - * Asserts that a file does not exist. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4077 + * @return VarTagValueNode[] */ - public static function assertFileNotExists(string $filename, string $message = '') : void + public function getVarTagValues(string $tagName = '@var'): array { - self::createWarning('assertFileNotExists() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileDoesNotExist() instead.'); - static::assertThat($filename, new LogicalNot(new FileExists()), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof VarTagValueNode; + }); } /** - * Asserts that a file exists and is readable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return ParamTagValueNode[] */ - public static function assertFileIsReadable(string $file, string $message = '') : void + public function getParamTagValues(string $tagName = '@param'): array { - self::assertFileExists($file, $message); - self::assertIsReadable($file, $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ParamTagValueNode; + }); } /** - * Asserts that a file exists and is not readable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return TypelessParamTagValueNode[] */ - public static function assertFileIsNotReadable(string $file, string $message = '') : void + public function getTypelessParamTagValues(string $tagName = '@param'): array { - self::assertFileExists($file, $message); - self::assertIsNotReadable($file, $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof TypelessParamTagValueNode; + }); } /** - * Asserts that a file exists and is not readable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4080 + * @return ParamImmediatelyInvokedCallableTagValueNode[] */ - public static function assertFileNotIsReadable(string $file, string $message = '') : void + public function getParamImmediatelyInvokedCallableTagValues(string $tagName = '@param-immediately-invoked-callable'): array { - self::createWarning('assertFileNotIsReadable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileIsNotReadable() instead.'); - self::assertFileExists($file, $message); - self::assertIsNotReadable($file, $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ParamImmediatelyInvokedCallableTagValueNode; + }); } /** - * Asserts that a file exists and is writable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return ParamLaterInvokedCallableTagValueNode[] */ - public static function assertFileIsWritable(string $file, string $message = '') : void + public function getParamLaterInvokedCallableTagValues(string $tagName = '@param-later-invoked-callable'): array { - self::assertFileExists($file, $message); - self::assertIsWritable($file, $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ParamLaterInvokedCallableTagValueNode; + }); } /** - * Asserts that a file exists and is not writable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return ParamClosureThisTagValueNode[] */ - public static function assertFileIsNotWritable(string $file, string $message = '') : void + public function getParamClosureThisTagValues(string $tagName = '@param-closure-this'): array { - self::assertFileExists($file, $message); - self::assertIsNotWritable($file, $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ParamClosureThisTagValueNode; + }); } /** - * Asserts that a file exists and is not writable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4083 + * @return TemplateTagValueNode[] */ - public static function assertFileNotIsWritable(string $file, string $message = '') : void + public function getTemplateTagValues(string $tagName = '@template'): array { - self::createWarning('assertFileNotIsWritable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileIsNotWritable() instead.'); - self::assertFileExists($file, $message); - self::assertIsNotWritable($file, $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof TemplateTagValueNode; + }); } /** - * Asserts that a condition is true. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert true $condition + * @return ExtendsTagValueNode[] */ - public static function assertTrue($condition, string $message = '') : void + public function getExtendsTagValues(string $tagName = '@extends'): array { - static::assertThat($condition, static::isTrue(), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ExtendsTagValueNode; + }); } /** - * Asserts that a condition is not true. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !true $condition + * @return ImplementsTagValueNode[] */ - public static function assertNotTrue($condition, string $message = '') : void + public function getImplementsTagValues(string $tagName = '@implements'): array { - static::assertThat($condition, static::logicalNot(static::isTrue()), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ImplementsTagValueNode; + }); } /** - * Asserts that a condition is false. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert false $condition + * @return UsesTagValueNode[] */ - public static function assertFalse($condition, string $message = '') : void + public function getUsesTagValues(string $tagName = '@use'): array { - static::assertThat($condition, static::isFalse(), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof UsesTagValueNode; + }); } /** - * Asserts that a condition is not false. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !false $condition + * @return ReturnTagValueNode[] */ - public static function assertNotFalse($condition, string $message = '') : void + public function getReturnTagValues(string $tagName = '@return'): array { - static::assertThat($condition, static::logicalNot(static::isFalse()), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ReturnTagValueNode; + }); } /** - * Asserts that a variable is null. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert null $actual + * @return ThrowsTagValueNode[] */ - public static function assertNull($actual, string $message = '') : void + public function getThrowsTagValues(string $tagName = '@throws'): array { - static::assertThat($actual, static::isNull(), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ThrowsTagValueNode; + }); } /** - * Asserts that a variable is not null. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !null $actual + * @return MixinTagValueNode[] */ - public static function assertNotNull($actual, string $message = '') : void + public function getMixinTagValues(string $tagName = '@mixin'): array { - static::assertThat($actual, static::logicalNot(static::isNull()), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof MixinTagValueNode; + }); } /** - * Asserts that a variable is finite. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return RequireExtendsTagValueNode[] */ - public static function assertFinite($actual, string $message = '') : void + public function getRequireExtendsTagValues(string $tagName = '@phpstan-require-extends'): array { - static::assertThat($actual, static::isFinite(), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof RequireExtendsTagValueNode; + }); } /** - * Asserts that a variable is infinite. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return RequireImplementsTagValueNode[] */ - public static function assertInfinite($actual, string $message = '') : void + public function getRequireImplementsTagValues(string $tagName = '@phpstan-require-implements'): array { - static::assertThat($actual, static::isInfinite(), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof RequireImplementsTagValueNode; + }); } /** - * Asserts that a variable is nan. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return DeprecatedTagValueNode[] */ - public static function assertNan($actual, string $message = '') : void + public function getDeprecatedTagValues(): array { - static::assertThat($actual, static::isNan(), $message); + return array_filter(array_column($this->getTagsByName('@deprecated'), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof DeprecatedTagValueNode; + }); } /** - * Asserts that a class has a specified attribute. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return PropertyTagValueNode[] */ - public static function assertClassHasAttribute(string $attributeName, string $className, string $message = '') : void + public function getPropertyTagValues(string $tagName = '@property'): array { - self::createWarning('assertClassHasAttribute() is deprecated and will be removed in PHPUnit 10.'); - if (!self::isValidClassAttributeName($attributeName)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); - } - if (!class_exists($className)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'class name'); - } - static::assertThat($className, new ClassHasAttribute($attributeName), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof PropertyTagValueNode; + }); } /** - * Asserts that a class does not have a specified attribute. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return PropertyTagValueNode[] */ - public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = '') : void + public function getPropertyReadTagValues(string $tagName = '@property-read'): array { - self::createWarning('assertClassNotHasAttribute() is deprecated and will be removed in PHPUnit 10.'); - if (!self::isValidClassAttributeName($attributeName)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); - } - if (!class_exists($className)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'class name'); - } - static::assertThat($className, new LogicalNot(new ClassHasAttribute($attributeName)), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof PropertyTagValueNode; + }); } /** - * Asserts that a class has a specified static attribute. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return PropertyTagValueNode[] */ - public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = '') : void + public function getPropertyWriteTagValues(string $tagName = '@property-write'): array { - self::createWarning('assertClassHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.'); - if (!self::isValidClassAttributeName($attributeName)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); - } - if (!class_exists($className)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'class name'); - } - static::assertThat($className, new ClassHasStaticAttribute($attributeName), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof PropertyTagValueNode; + }); } /** - * Asserts that a class does not have a specified static attribute. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return MethodTagValueNode[] */ - public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = '') : void + public function getMethodTagValues(string $tagName = '@method'): array { - self::createWarning('assertClassNotHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.'); - if (!self::isValidClassAttributeName($attributeName)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); - } - if (!class_exists($className)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'class name'); - } - static::assertThat($className, new LogicalNot(new ClassHasStaticAttribute($attributeName)), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof MethodTagValueNode; + }); } /** - * Asserts that an object has a specified attribute. - * - * @param object $object - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return TypeAliasTagValueNode[] */ - public static function assertObjectHasAttribute(string $attributeName, $object, string $message = '') : void + public function getTypeAliasTagValues(string $tagName = '@phpstan-type'): array { - self::createWarning('assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() instead.'); - if (!self::isValidObjectAttributeName($attributeName)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); - } - if (!is_object($object)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'object'); - } - static::assertThat($object, new ObjectHasAttribute($attributeName), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof TypeAliasTagValueNode; + }); } /** - * Asserts that an object does not have a specified attribute. - * - * @param object $object - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return TypeAliasImportTagValueNode[] */ - public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = '') : void + public function getTypeAliasImportTagValues(string $tagName = '@phpstan-import-type'): array { - self::createWarning('assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectNotHasProperty() instead.'); - if (!self::isValidObjectAttributeName($attributeName)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); - } - if (!is_object($object)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'object'); - } - static::assertThat($object, new LogicalNot(new ObjectHasAttribute($attributeName)), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof TypeAliasImportTagValueNode; + }); } /** - * Asserts that an object has a specified property. - * - * @throws ExpectationFailedException + * @return AssertTagValueNode[] */ - public static final function assertObjectHasProperty(string $propertyName, object $object, string $message = '') : void + public function getAssertTagValues(string $tagName = '@phpstan-assert'): array { - static::assertThat($object, new ObjectHasProperty($propertyName), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof AssertTagValueNode; + }); } /** - * Asserts that an object does not have a specified property. - * - * @throws ExpectationFailedException + * @return AssertTagPropertyValueNode[] */ - public static final function assertObjectNotHasProperty(string $propertyName, object $object, string $message = '') : void + public function getAssertPropertyTagValues(string $tagName = '@phpstan-assert'): array { - static::assertThat($object, new LogicalNot(new ObjectHasProperty($propertyName)), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof AssertTagPropertyValueNode; + }); } /** - * Asserts that two variables have the same type and value. - * Used on objects, it asserts that two variables reference - * the same object. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-template ExpectedType - * - * @psalm-param ExpectedType $expected - * - * @psalm-assert =ExpectedType $actual + * @return AssertTagMethodValueNode[] */ - public static function assertSame($expected, $actual, string $message = '') : void + public function getAssertMethodTagValues(string $tagName = '@phpstan-assert'): array { - static::assertThat($actual, new IsIdentical($expected), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof AssertTagMethodValueNode; + }); } /** - * Asserts that two variables do not have the same type and value. - * Used on objects, it asserts that two variables do not reference - * the same object. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException + * @return SelfOutTagValueNode[] */ - public static function assertNotSame($expected, $actual, string $message = '') : void + public function getSelfOutTypeTagValues(string $tagName = '@phpstan-this-out'): array { - if (is_bool($expected) && is_bool($actual)) { - static::assertNotEquals($expected, $actual, $message); - } - static::assertThat($actual, new LogicalNot(new IsIdentical($expected)), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof SelfOutTagValueNode; + }); } /** - * Asserts that a variable is of a given type. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - * - * @psalm-template ExpectedType of object - * - * @psalm-param class-string $expected - * - * @psalm-assert =ExpectedType $actual + * @return ParamOutTagValueNode[] */ - public static function assertInstanceOf(string $expected, $actual, string $message = '') : void + public function getParamOutTypeTagValues(string $tagName = '@param-out'): array { - if (!class_exists($expected) && !interface_exists($expected)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'class or interface name'); - } - static::assertThat($actual, new IsInstanceOf($expected), $message); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (PhpDocTagValueNode $value): bool { + return $value instanceof ParamOutTagValueNode; + }); } - /** - * Asserts that a variable is not of a given type. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - * - * @psalm-template ExpectedType of object - * - * @psalm-param class-string $expected - * - * @psalm-assert !ExpectedType $actual - */ - public static function assertNotInstanceOf(string $expected, $actual, string $message = '') : void + public function __toString(): string { - if (!class_exists($expected) && !interface_exists($expected)) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'class or interface name'); - } - static::assertThat($actual, new LogicalNot(new IsInstanceOf($expected)), $message); + $children = array_map(static function (PhpDocChildNode $child): string { + $s = (string) $child; + return ($s === '') ? '' : (' ' . $s); + }, $this->children); + return "/**\n *" . implode("\n *", $children) . "\n */"; } - /** - * Asserts that a variable is of type array. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert array $actual - */ - public static function assertIsArray($actual, string $message = '') : void +} +name = $name; + $this->value = $value; } - /** - * Asserts that a variable is of type bool. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert bool $actual - */ - public static function assertIsBool($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new IsType(IsType::TYPE_BOOL), $message); + if ($this->value instanceof DoctrineTagValueNode) { + return (string) $this->value; + } + return trim("{$this->name} {$this->value}"); } - /** - * Asserts that a variable is of type float. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert float $actual - */ - public static function assertIsFloat($actual, string $message = '') : void +} +text = $text; } - /** - * Asserts that a variable is of type int. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert int $actual - */ - public static function assertIsInt($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new IsType(IsType::TYPE_INT), $message); + return $this->text; } - /** - * Asserts that a variable is of type numeric. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert numeric $actual - */ - public static function assertIsNumeric($actual, string $message = '') : void +} +type = $type; + $this->propertyName = $propertyName; + $this->description = $description; } - /** - * Asserts that a variable is of type object. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert object $actual - */ - public static function assertIsObject($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new IsType(IsType::TYPE_OBJECT), $message); + return trim("{$this->type} {$this->propertyName} {$this->description}"); } - /** - * Asserts that a variable is of type resource. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert resource $actual - */ - public static function assertIsResource($actual, string $message = '') : void +} +type = $type; + $this->description = $description; } - /** - * Asserts that a variable is of type resource and is closed. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert resource $actual - */ - public static function assertIsClosedResource($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new IsType(IsType::TYPE_CLOSED_RESOURCE), $message); + return trim("{$this->type} {$this->description}"); } - /** - * Asserts that a variable is of type string. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert string $actual - */ - public static function assertIsString($actual, string $message = '') : void +} +type = $type; + $this->description = $description; } - /** - * Asserts that a variable is of type scalar. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert scalar $actual - */ - public static function assertIsScalar($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new IsType(IsType::TYPE_SCALAR), $message); + return trim("{$this->type} {$this->description}"); } - /** - * Asserts that a variable is of type callable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert callable $actual - */ - public static function assertIsCallable($actual, string $message = '') : void +} +type = $type; + $this->description = $description; } - /** - * Asserts that a variable is of type iterable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert iterable $actual - */ - public static function assertIsIterable($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new IsType(IsType::TYPE_ITERABLE), $message); + return trim("{$this->type} {$this->description}"); } - /** - * Asserts that a variable is not of type array. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !array $actual - */ - public static function assertIsNotArray($actual, string $message = '') : void +} +type = $type; + $this->description = $description; } - /** - * Asserts that a variable is not of type bool. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !bool $actual - */ - public static function assertIsNotBool($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_BOOL)), $message); + return trim($this->type . ' ' . $this->description); } +} +name = $name; + $this->bound = $bound; + $this->default = $default; + $this->description = $description; } - /** - * Asserts that a variable is not of type int. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !int $actual - */ - public static function assertIsNotInt($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_INT)), $message); + $bound = ($this->bound !== null) ? " of {$this->bound}" : ''; + $default = ($this->default !== null) ? " = {$this->default}" : ''; + return trim("{$this->name}{$bound}{$default} {$this->description}"); } - /** - * Asserts that a variable is not of type numeric. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !numeric $actual - */ - public static function assertIsNotNumeric($actual, string $message = '') : void +} +type = $type; + $this->description = $description; } - /** - * Asserts that a variable is not of type object. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !object $actual - */ - public static function assertIsNotObject($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_OBJECT)), $message); + return trim("{$this->type} {$this->description}"); } - /** - * Asserts that a variable is not of type resource. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !resource $actual - */ - public static function assertIsNotResource($actual, string $message = '') : void +} +importedAlias = $importedAlias; + $this->importedFrom = $importedFrom; + $this->importedAs = $importedAs; } - /** - * Asserts that a variable is not of type resource. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !resource $actual - */ - public static function assertIsNotClosedResource($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_CLOSED_RESOURCE)), $message); + return trim("{$this->importedAlias} from {$this->importedFrom}" . (($this->importedAs !== null) ? " as {$this->importedAs}" : '')); } - /** - * Asserts that a variable is not of type string. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !string $actual - */ - public static function assertIsNotString($actual, string $message = '') : void +} +alias = $alias; + $this->type = $type; } - /** - * Asserts that a variable is not of type scalar. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !scalar $actual - */ - public static function assertIsNotScalar($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_SCALAR)), $message); + return trim("{$this->alias} {$this->type}"); } - /** - * Asserts that a variable is not of type callable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !callable $actual - */ - public static function assertIsNotCallable($actual, string $message = '') : void +} +isReference = $isReference; + $this->isVariadic = $isVariadic; + $this->parameterName = $parameterName; + $this->description = $description; } - /** - * Asserts that a variable is not of type iterable. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @psalm-assert !iterable $actual - */ - public static function assertIsNotIterable($actual, string $message = '') : void + public function __toString(): string { - static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_ITERABLE)), $message); + $reference = $this->isReference ? '&' : ''; + $variadic = $this->isVariadic ? '...' : ''; + return trim("{$reference}{$variadic}{$this->parameterName} {$this->description}"); } - /** - * Asserts that a string matches a given regular expression. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = '') : void +} +type = $type; + $this->description = $description; } - /** - * Asserts that a string matches a given regular expression. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4086 - */ - public static function assertRegExp(string $pattern, string $string, string $message = '') : void + public function __toString(): string { - self::createWarning('assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.'); - static::assertThat($string, new RegularExpression($pattern), $message); + return trim("{$this->type} {$this->description}"); } - /** - * Asserts that a string does not match a given regular expression. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = '') : void +} +type = $type; + $this->variableName = $variableName; + $this->description = $description; } - /** - * Asserts that a string does not match a given regular expression. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4089 - */ - public static function assertNotRegExp(string $pattern, string $string, string $message = '') : void + public function __toString(): string { - self::createWarning('assertNotRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDoesNotMatchRegularExpression() instead.'); - static::assertThat($string, new LogicalNot(new RegularExpression($pattern)), $message); + return trim("{$this->type} " . trim("{$this->variableName} {$this->description}")); } +} +keyName = $keyName; + $this->optional = $optional; + $this->valueType = $valueType; + } + public function __toString(): string + { + if ($this->keyName !== null) { + return sprintf('%s%s: %s', (string) $this->keyName, $this->optional ? '?' : '', (string) $this->valueType); } - static::assertThat($actual, new SameSize($expected), $message); + return (string) $this->valueType; } +} +items = $items; + $this->sealed = $sealed; + $this->kind = $kind; + } + public function __toString(): string + { + $items = $this->items; + if (!$this->sealed) { + $items[] = '...'; } - static::assertThat($actual, new LogicalNot(new SameSize($expected)), $message); + return $this->kind . '{' . implode(', ', $items) . '}'; } - /** - * Asserts that a string matches a given format string. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringMatchesFormat(string $format, string $string, string $message = '') : void +} +type = $type; } - /** - * Asserts that a string does not match a given format string. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringNotMatchesFormat(string $format, string $string, string $message = '') : void + public function __toString(): string { - static::assertThat($string, new LogicalNot(new StringMatchesFormatDescription($format)), $message); - } - /** - * Asserts that a string matches a given format file. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = '') : void - { - static::assertFileExists($formatFile, $message); - static::assertThat($string, new StringMatchesFormatDescription(file_get_contents($formatFile)), $message); - } - /** - * Asserts that a string does not match a given format string. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = '') : void - { - static::assertFileExists($formatFile, $message); - static::assertThat($string, new LogicalNot(new StringMatchesFormatDescription(file_get_contents($formatFile))), $message); + if ($this->type instanceof CallableTypeNode || $this->type instanceof ConstTypeNode || $this->type instanceof NullableTypeNode) { + return '(' . $this->type . ')[]'; + } + return $this->type . '[]'; } +} +identifier = $identifier; + $this->parameters = $parameters; + $this->returnType = $returnType; + $this->templateTypes = $templateTypes; } - /** - * Asserts that a string starts not with a given prefix. - * - * @param string $prefix - * @param string $string - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringStartsNotWith($prefix, $string, string $message = '') : void + public function __toString(): string { - static::assertThat($string, new LogicalNot(new StringStartsWith($prefix)), $message); + $returnType = $this->returnType; + if ($returnType instanceof self) { + $returnType = "({$returnType})"; + } + $template = ($this->templateTypes !== []) ? '<' . implode(', ', $this->templateTypes) . '>' : ''; + $parameters = implode(', ', $this->parameters); + return "{$this->identifier}{$template}({$parameters}): {$returnType}"; } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringContainsString(string $needle, string $haystack, string $message = '') : void +} +type = $type; + $this->isReference = $isReference; + $this->isVariadic = $isVariadic; + $this->parameterName = $parameterName; + $this->isOptional = $isOptional; } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = '') : void + public function __toString(): string { - $constraint = new StringContains($needle, \true); - static::assertThat($haystack, $constraint, $message); + $type = "{$this->type} "; + $isReference = $this->isReference ? '&' : ''; + $isVariadic = $this->isVariadic ? '...' : ''; + $isOptional = $this->isOptional ? '=' : ''; + return trim("{$type}{$isReference}{$isVariadic}{$this->parameterName}") . $isOptional; } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringNotContainsString(string $needle, string $haystack, string $message = '') : void +} +parameterName = $parameterName; + $this->targetType = $targetType; + $this->if = $if; + $this->else = $else; + $this->negated = $negated; } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = '') : void + public function __toString(): string { - $constraint = new LogicalNot(new StringContains($needle, \true)); - static::assertThat($haystack, $constraint, $message); + return sprintf('(%s %s %s ? %s : %s)', $this->parameterName, $this->negated ? 'is not' : 'is', $this->targetType, $this->if, $this->else); } - /** - * Asserts that a string ends with a given suffix. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringEndsWith(string $suffix, string $string, string $message = '') : void +} +subjectType = $subjectType; + $this->targetType = $targetType; + $this->if = $if; + $this->else = $else; + $this->negated = $negated; } - /** - * Asserts that a string ends not with a given suffix. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertStringEndsNotWith(string $suffix, string $string, string $message = '') : void + public function __toString(): string { - static::assertThat($string, new LogicalNot(new StringEndsWith($suffix)), $message); + return sprintf('(%s %s %s ? %s : %s)', $this->subjectType, $this->negated ? 'is not' : 'is', $this->targetType, $this->if, $this->else); } - /** - * Asserts that two XML files are equal. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException - */ - public static function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '') : void +} +loadFile($expectedFile); - $actual = (new XmlLoader())->loadFile($actualFile); - static::assertEquals($expected, $actual, $message); + $this->constExpr = $constExpr; } - /** - * Asserts that two XML files are not equal. - * - * @throws \PHPUnit\Util\Exception - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '') : void + public function __toString(): string { - $expected = (new XmlLoader())->loadFile($expectedFile); - $actual = (new XmlLoader())->loadFile($actualFile); - static::assertNotEquals($expected, $actual, $message); + return $this->constExpr->__toString(); } +} +load($actualXml); + $this->type = $type; + $this->genericTypes = $genericTypes; + $this->variances = $variances; + } + public function __toString(): string + { + $genericTypes = []; + foreach ($this->genericTypes as $index => $type) { + $variance = $this->variances[$index] ?? self::VARIANCE_INVARIANT; + if ($variance === self::VARIANCE_INVARIANT) { + $genericTypes[] = (string) $type; + } elseif ($variance === self::VARIANCE_BIVARIANT) { + $genericTypes[] = '*'; + } else { + $genericTypes[] = sprintf('%s %s', $variance, $type); + } } - $expected = (new XmlLoader())->loadFile($expectedFile); - static::assertEquals($expected, $actual, $message); + return $this->type . '<' . implode(', ', $genericTypes) . '>'; } - /** - * Asserts that two XML documents are not equal. - * - * @param DOMDocument|string $actualXml - * - * @throws \PHPUnit\Util\Xml\Exception - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = '') : void +} +load($actualXml); - } - $expected = (new XmlLoader())->loadFile($expectedFile); - static::assertNotEquals($expected, $actual, $message); + $this->name = $name; } - /** - * Asserts that two XML documents are equal. - * - * @param DOMDocument|string $expectedXml - * @param DOMDocument|string $actualXml - * - * @throws \PHPUnit\Util\Xml\Exception - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = '') : void + public function __toString(): string { - if (!is_string($expectedXml)) { - self::createWarning('Passing an argument of type DOMDocument for the $expectedXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); - $expected = $expectedXml; - } else { - $expected = (new XmlLoader())->load($expectedXml); - } - if (!is_string($actualXml)) { - self::createWarning('Passing an argument of type DOMDocument for the $actualXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); - $actual = $actualXml; - } else { - $actual = (new XmlLoader())->load($actualXml); - } - static::assertEquals($expected, $actual, $message); + return $this->name; } +} +load($expectedXml); - } - if (!is_string($actualXml)) { - self::createWarning('Passing an argument of type DOMDocument for the $actualXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); - $actual = $actualXml; - } else { - $actual = (new XmlLoader())->load($actualXml); - } - static::assertNotEquals($expected, $actual, $message); + $this->types = $types; } - /** - * Asserts that a hierarchy of DOMElements matches. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws AssertionFailedError - * @throws ExpectationFailedException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4091 - */ - public static function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = \false, string $message = '') : void + public function __toString(): string { - self::createWarning('assertEqualXMLStructure() is deprecated and will be removed in PHPUnit 10.'); - $expectedElement = Xml::import($expectedElement); - $actualElement = Xml::import($actualElement); - static::assertSame($expectedElement->tagName, $actualElement->tagName, $message); - if ($checkAttributes) { - static::assertSame($expectedElement->attributes->length, $actualElement->attributes->length, sprintf('%s%sNumber of attributes on node "%s" does not match', $message, !empty($message) ? "\n" : '', $expectedElement->tagName)); - for ($i = 0; $i < $expectedElement->attributes->length; $i++) { - $expectedAttribute = $expectedElement->attributes->item($i); - $actualAttribute = $actualElement->attributes->getNamedItem($expectedAttribute->name); - assert($expectedAttribute instanceof DOMAttr); - if (!$actualAttribute) { - static::fail(sprintf('%s%sCould not find attribute "%s" on node "%s"', $message, !empty($message) ? "\n" : '', $expectedAttribute->name, $expectedElement->tagName)); - } + return '(' . implode(' & ', array_map(static function (TypeNode $type): string { + if ($type instanceof NullableTypeNode) { + return '(' . $type . ')'; } - } - Xml::removeCharacterDataNodes($expectedElement); - Xml::removeCharacterDataNodes($actualElement); - static::assertSame($expectedElement->childNodes->length, $actualElement->childNodes->length, sprintf('%s%sNumber of child nodes of "%s" differs', $message, !empty($message) ? "\n" : '', $expectedElement->tagName)); - for ($i = 0; $i < $expectedElement->childNodes->length; $i++) { - static::assertEqualXMLStructure($expectedElement->childNodes->item($i), $actualElement->childNodes->item($i), $checkAttributes, $message); - } - } - /** - * Evaluates a PHPUnit\Framework\Constraint matcher object. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertThat($value, Constraint $constraint, string $message = '') : void - { - self::$count += count($constraint); - $constraint->evaluate($value, $message); + return (string) $type; + }, $this->types)) . ')'; } - /** - * Asserts that a string is a valid JSON string. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertJson(string $actualJson, string $message = '') : void +} +exceptionArgs = [$exception->getCurrentTokenValue(), $exception->getCurrentTokenType(), $exception->getCurrentOffset(), $exception->getExpectedTokenType(), $exception->getExpectedTokenValue(), $exception->getCurrentTokenLine()]; } - /** - * Asserts that two given JSON encoded objects or arrays are equal. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = '') : void + public function getException(): ParserException { - static::assertJson($expectedJson, $message); - static::assertJson($actualJson, $message); - static::assertThat($actualJson, new JsonMatches($expectedJson), $message); + return new ParserException(...$this->exceptionArgs); } - /** - * Asserts that two given JSON encoded objects or arrays are not equal. - * - * @param string $expectedJson - * @param string $actualJson - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, string $message = '') : void + public function __toString(): string { - static::assertJson($expectedJson, $message); - static::assertJson($actualJson, $message); - static::assertThat($actualJson, new LogicalNot(new JsonMatches($expectedJson)), $message); + return '*Invalid type*'; } - /** - * Asserts that the generated JSON encoded object and the content of the given file are equal. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '') : void +} +type = $type; } - /** - * Asserts that the generated JSON encoded object and the content of the given file are not equal. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '') : void + public function __toString(): string { - static::assertFileExists($expectedFile, $message); - $expectedJson = file_get_contents($expectedFile); - static::assertJson($expectedJson, $message); - static::assertJson($actualJson, $message); - static::assertThat($actualJson, new LogicalNot(new JsonMatches($expectedJson)), $message); + return '?' . $this->type; } +} +keyName = $keyName; + $this->optional = $optional; + $this->valueType = $valueType; } - /** - * Asserts that two JSON files are not equal. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public static function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '') : void + public function __toString(): string { - static::assertFileExists($expectedFile, $message); - static::assertFileExists($actualFile, $message); - $actualJson = file_get_contents($actualFile); - $expectedJson = file_get_contents($expectedFile); - static::assertJson($expectedJson, $message); - static::assertJson($actualJson, $message); - $constraintExpected = new JsonMatches($expectedJson); - $constraintActual = new JsonMatches($actualJson); - static::assertThat($expectedJson, new LogicalNot($constraintActual), $message); - static::assertThat($actualJson, new LogicalNot($constraintExpected), $message); + if ($this->keyName !== null) { + return sprintf('%s%s: %s', (string) $this->keyName, $this->optional ? '?' : '', (string) $this->valueType); + } + return (string) $this->valueType; } +} +setConstraints($constraints); - return $constraint; - } - public static function logicalOr() : LogicalOr + public function __construct(array $items) { - $constraints = func_get_args(); - $constraint = new LogicalOr(); - $constraint->setConstraints($constraints); - return $constraint; + $this->items = $items; } - public static function logicalNot(Constraint $constraint) : LogicalNot + public function __toString(): string { - return new LogicalNot($constraint); + $items = $this->items; + return 'object{' . implode(', ', $items) . '}'; } - public static function logicalXor() : LogicalXor +} +setConstraints($constraints); - return $constraint; + $this->type = $type; + $this->offset = $offset; } - public static function anything() : IsAnything + public function __toString(): string { - return new IsAnything(); + if ($this->type instanceof CallableTypeNode || $this->type instanceof NullableTypeNode) { + return '(' . $this->type . ')[' . $this->offset . ']'; + } + return $this->type . '[' . $this->offset . ']'; } - public static function isTrue() : IsTrue +} + + * @param TypeNode[] $types */ - public static function callback(callable $callback) : Callback + public function __construct(array $types) { - return new Callback($callback); + $this->types = $types; } - public static function isFalse() : IsFalse + public function __toString(): string { - return new IsFalse(); + return '(' . implode(' | ', array_map(static function (TypeNode $type): string { + if ($type instanceof NullableTypeNode) { + return '(' . $type . ')'; + } + return (string) $type; + }, $this->types)) . ')'; } - public static function isJson() : IsJson +} +MIT License + +Copyright (c) 2016 Ondřej Mirtes + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. '\'&\'', self::TOKEN_UNION => '\'|\'', self::TOKEN_INTERSECTION => '\'&\'', self::TOKEN_NULLABLE => '\'?\'', self::TOKEN_NEGATED => '\'!\'', self::TOKEN_OPEN_PARENTHESES => '\'(\'', self::TOKEN_CLOSE_PARENTHESES => '\')\'', self::TOKEN_OPEN_ANGLE_BRACKET => '\'<\'', self::TOKEN_CLOSE_ANGLE_BRACKET => '\'>\'', self::TOKEN_OPEN_SQUARE_BRACKET => '\'[\'', self::TOKEN_CLOSE_SQUARE_BRACKET => '\']\'', self::TOKEN_OPEN_CURLY_BRACKET => '\'{\'', self::TOKEN_CLOSE_CURLY_BRACKET => '\'}\'', self::TOKEN_COMMA => '\',\'', self::TOKEN_COLON => '\':\'', self::TOKEN_VARIADIC => '\'...\'', self::TOKEN_DOUBLE_COLON => '\'::\'', self::TOKEN_DOUBLE_ARROW => '\'=>\'', self::TOKEN_ARROW => '\'->\'', self::TOKEN_EQUAL => '\'=\'', self::TOKEN_OPEN_PHPDOC => '\'/**\'', self::TOKEN_CLOSE_PHPDOC => '\'*/\'', self::TOKEN_PHPDOC_TAG => 'TOKEN_PHPDOC_TAG', self::TOKEN_DOCTRINE_TAG => 'TOKEN_DOCTRINE_TAG', self::TOKEN_PHPDOC_EOL => 'TOKEN_PHPDOC_EOL', self::TOKEN_FLOAT => 'TOKEN_FLOAT', self::TOKEN_INTEGER => 'TOKEN_INTEGER', self::TOKEN_SINGLE_QUOTED_STRING => 'TOKEN_SINGLE_QUOTED_STRING', self::TOKEN_DOUBLE_QUOTED_STRING => 'TOKEN_DOUBLE_QUOTED_STRING', self::TOKEN_DOCTRINE_ANNOTATION_STRING => 'TOKEN_DOCTRINE_ANNOTATION_STRING', self::TOKEN_IDENTIFIER => 'type', self::TOKEN_THIS_VARIABLE => '\'$this\'', self::TOKEN_VARIABLE => 'variable', self::TOKEN_HORIZONTAL_WS => 'TOKEN_HORIZONTAL_WS', self::TOKEN_OTHER => 'TOKEN_OTHER', self::TOKEN_END => 'TOKEN_END', self::TOKEN_WILDCARD => '*']; + public const VALUE_OFFSET = 0; + public const TYPE_OFFSET = 1; + public const LINE_OFFSET = 2; + /** @var bool */ + private $parseDoctrineAnnotations; + /** @var string|null */ + private $regexp; + public function __construct(bool $parseDoctrineAnnotations = \false) { - return new IsJson(); + $this->parseDoctrineAnnotations = $parseDoctrineAnnotations; } - public static function isNull() : IsNull + /** + * @return list + */ + public function tokenize(string $s): array { - return new IsNull(); + if ($this->regexp === null) { + $this->regexp = $this->generateRegexp(); + } + preg_match_all($this->regexp, $s, $matches, PREG_SET_ORDER); + $tokens = []; + $line = 1; + foreach ($matches as $match) { + $type = (int) $match['MARK']; + $tokens[] = [$match[0], $type, $line]; + if ($type !== self::TOKEN_PHPDOC_EOL) { + continue; + } + $line++; + } + $tokens[] = ['', self::TOKEN_END, $line]; + return $tokens; } - public static function isFinite() : IsFinite - { - return new IsFinite(); + private function generateRegexp(): string + { + $patterns = [ + self::TOKEN_HORIZONTAL_WS => '[\x09\x20]++', + self::TOKEN_IDENTIFIER => '(?:[\\\\]?+[a-z_\x80-\xFF][0-9a-z_\x80-\xFF-]*+)++', + self::TOKEN_THIS_VARIABLE => '\$this(?![0-9a-z_\x80-\xFF])', + self::TOKEN_VARIABLE => '\$[a-z_\x80-\xFF][0-9a-z_\x80-\xFF]*+', + // '&' followed by TOKEN_VARIADIC, TOKEN_VARIABLE, TOKEN_EQUAL, TOKEN_EQUAL or TOKEN_CLOSE_PARENTHESES + self::TOKEN_REFERENCE => '&(?=\s*+(?:[.,=)]|(?:\$(?!this(?![0-9a-z_\x80-\xFF])))))', + self::TOKEN_UNION => '\|', + self::TOKEN_INTERSECTION => '&', + self::TOKEN_NULLABLE => '\?', + self::TOKEN_NEGATED => '!', + self::TOKEN_OPEN_PARENTHESES => '\(', + self::TOKEN_CLOSE_PARENTHESES => '\)', + self::TOKEN_OPEN_ANGLE_BRACKET => '<', + self::TOKEN_CLOSE_ANGLE_BRACKET => '>', + self::TOKEN_OPEN_SQUARE_BRACKET => '\[', + self::TOKEN_CLOSE_SQUARE_BRACKET => '\]', + self::TOKEN_OPEN_CURLY_BRACKET => '\{', + self::TOKEN_CLOSE_CURLY_BRACKET => '\}', + self::TOKEN_COMMA => ',', + self::TOKEN_VARIADIC => '\.\.\.', + self::TOKEN_DOUBLE_COLON => '::', + self::TOKEN_DOUBLE_ARROW => '=>', + self::TOKEN_ARROW => '->', + self::TOKEN_EQUAL => '=', + self::TOKEN_COLON => ':', + self::TOKEN_OPEN_PHPDOC => '/\*\*(?=\s)\x20?+', + self::TOKEN_CLOSE_PHPDOC => '\*/', + self::TOKEN_PHPDOC_TAG => '@(?:[a-z][a-z0-9-\\\\]+:)?[a-z][a-z0-9-\\\\]*+', + self::TOKEN_PHPDOC_EOL => '\r?+\n[\x09\x20]*+(?:\*(?!/)\x20?+)?', + self::TOKEN_FLOAT => '[+\-]?(?:(?:[0-9]++(_[0-9]++)*\.[0-9]*+(_[0-9]++)*(?:e[+\-]?[0-9]++(_[0-9]++)*)?)|(?:[0-9]*+(_[0-9]++)*\.[0-9]++(_[0-9]++)*(?:e[+\-]?[0-9]++(_[0-9]++)*)?)|(?:[0-9]++(_[0-9]++)*e[+\-]?[0-9]++(_[0-9]++)*))', + self::TOKEN_INTEGER => '[+\-]?(?:(?:0b[0-1]++(_[0-1]++)*)|(?:0o[0-7]++(_[0-7]++)*)|(?:0x[0-9a-f]++(_[0-9a-f]++)*)|(?:[0-9]++(_[0-9]++)*))', + self::TOKEN_SINGLE_QUOTED_STRING => '\'(?:\\\\[^\r\n]|[^\'\r\n\\\\])*+\'', + self::TOKEN_DOUBLE_QUOTED_STRING => '"(?:\\\\[^\r\n]|[^"\r\n\\\\])*+"', + self::TOKEN_WILDCARD => '\*', + ]; + if ($this->parseDoctrineAnnotations) { + $patterns[self::TOKEN_DOCTRINE_TAG] = '@[a-z_\\\\][a-z0-9_\:\\\\]*[a-z_][a-z0-9_]*'; + $patterns[self::TOKEN_DOCTRINE_ANNOTATION_STRING] = '"(?:""|[^"])*+"'; + } + // anything but TOKEN_CLOSE_PHPDOC or TOKEN_HORIZONTAL_WS or TOKEN_EOL + $patterns[self::TOKEN_OTHER] = '(?:(?!\*/)[^\s])++'; + foreach ($patterns as $type => &$pattern) { + $pattern = '(?:' . $pattern . ')(*MARK:' . $type . ')'; + } + return '~' . implode('|', $patterns) . '~Asi'; } - public static function isInfinite() : IsInfinite +} +unescapeStrings = $unescapeStrings; + $this->quoteAwareConstExprString = $quoteAwareConstExprString; + $this->useLinesAttributes = $usedAttributes['lines'] ?? \false; + $this->useIndexAttributes = $usedAttributes['indexes'] ?? \false; + $this->parseDoctrineStrings = \false; } - public static function isNan() : IsNan + /** + * @internal + */ + public function toDoctrine(): self { - return new IsNan(); + $self = new self($this->unescapeStrings, $this->quoteAwareConstExprString, ['lines' => $this->useLinesAttributes, 'indexes' => $this->useIndexAttributes]); + $self->parseDoctrineStrings = \true; + return $self; } - public static function containsEqual($value) : TraversableContainsEqual + public function parse(TokenIterator $tokens, bool $trimStrings = \false): Ast\ConstExpr\ConstExprNode { - return new TraversableContainsEqual($value); + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_FLOAT)) { + $value = $tokens->currentTokenValue(); + $tokens->next(); + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprFloatNode(str_replace('_', '', $value)), $startLine, $startIndex); + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_INTEGER)) { + $value = $tokens->currentTokenValue(); + $tokens->next(); + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprIntegerNode(str_replace('_', '', $value)), $startLine, $startIndex); + } + if ($this->parseDoctrineStrings && $tokens->isCurrentTokenType(Lexer::TOKEN_DOCTRINE_ANNOTATION_STRING)) { + $value = $tokens->currentTokenValue(); + $tokens->next(); + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\DoctrineConstExprStringNode(Ast\ConstExpr\DoctrineConstExprStringNode::unescape($value)), $startLine, $startIndex); + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING, Lexer::TOKEN_DOUBLE_QUOTED_STRING)) { + if ($this->parseDoctrineStrings) { + if ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING)) { + throw new ParserException($tokens->currentTokenValue(), $tokens->currentTokenType(), $tokens->currentTokenOffset(), Lexer::TOKEN_DOUBLE_QUOTED_STRING, null, $tokens->currentTokenLine()); + } + $value = $tokens->currentTokenValue(); + $tokens->next(); + return $this->enrichWithAttributes($tokens, $this->parseDoctrineString($value, $tokens), $startLine, $startIndex); + } + $value = $tokens->currentTokenValue(); + $type = $tokens->currentTokenType(); + if ($trimStrings) { + if ($this->unescapeStrings) { + $value = StringUnescaper::unescapeString($value); + } else { + $value = substr($value, 1, -1); + } + } + $tokens->next(); + if ($this->quoteAwareConstExprString) { + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\QuoteAwareConstExprStringNode($value, ($type === Lexer::TOKEN_SINGLE_QUOTED_STRING) ? Ast\ConstExpr\QuoteAwareConstExprStringNode::SINGLE_QUOTED : Ast\ConstExpr\QuoteAwareConstExprStringNode::DOUBLE_QUOTED), $startLine, $startIndex); + } + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprStringNode($value), $startLine, $startIndex); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_IDENTIFIER)) { + $identifier = $tokens->currentTokenValue(); + $tokens->next(); + switch (strtolower($identifier)) { + case 'true': + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprTrueNode(), $startLine, $startIndex); + case 'false': + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprFalseNode(), $startLine, $startIndex); + case 'null': + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprNullNode(), $startLine, $startIndex); + case 'array': + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES); + return $this->parseArray($tokens, Lexer::TOKEN_CLOSE_PARENTHESES, $startIndex); + } + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_DOUBLE_COLON)) { + $classConstantName = ''; + $lastType = null; + while (\true) { + if ($lastType !== Lexer::TOKEN_IDENTIFIER && $tokens->currentTokenType() === Lexer::TOKEN_IDENTIFIER) { + $classConstantName .= $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + $lastType = Lexer::TOKEN_IDENTIFIER; + continue; + } + if ($lastType !== Lexer::TOKEN_WILDCARD && $tokens->tryConsumeTokenType(Lexer::TOKEN_WILDCARD)) { + $classConstantName .= '*'; + $lastType = Lexer::TOKEN_WILDCARD; + if ($tokens->getSkippedHorizontalWhiteSpaceIfAny() !== '') { + break; + } + continue; + } + if ($lastType === null) { + // trigger parse error if nothing valid was consumed + $tokens->consumeTokenType(Lexer::TOKEN_WILDCARD); + } + break; + } + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstFetchNode($identifier, $classConstantName), $startLine, $startIndex); + } + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstFetchNode('', $identifier), $startLine, $startIndex); + } elseif ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + return $this->parseArray($tokens, Lexer::TOKEN_CLOSE_SQUARE_BRACKET, $startIndex); + } + throw new ParserException($tokens->currentTokenValue(), $tokens->currentTokenType(), $tokens->currentTokenOffset(), Lexer::TOKEN_IDENTIFIER, null, $tokens->currentTokenLine()); } - public static function containsIdentical($value) : TraversableContainsIdentical + private function parseArray(TokenIterator $tokens, int $endToken, int $startIndex): Ast\ConstExpr\ConstExprArrayNode { - return new TraversableContainsIdentical($value); + $items = []; + $startLine = $tokens->currentTokenLine(); + if (!$tokens->tryConsumeTokenType($endToken)) { + do { + $items[] = $this->parseArrayItem($tokens); + } while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA) && !$tokens->isCurrentTokenType($endToken)); + $tokens->consumeTokenType($endToken); + } + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprArrayNode($items), $startLine, $startIndex); } - public static function containsOnly(string $type) : TraversableContainsOnly + /** + * This method is supposed to be called with TokenIterator after reading TOKEN_DOUBLE_QUOTED_STRING and shifting + * to the next token. + */ + public function parseDoctrineString(string $text, TokenIterator $tokens): Ast\ConstExpr\DoctrineConstExprStringNode { - return new TraversableContainsOnly($type); + // Because of how Lexer works, a valid Doctrine string + // can consist of a sequence of TOKEN_DOUBLE_QUOTED_STRING and TOKEN_DOCTRINE_ANNOTATION_STRING + while ($tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_QUOTED_STRING, Lexer::TOKEN_DOCTRINE_ANNOTATION_STRING)) { + $text .= $tokens->currentTokenValue(); + $tokens->next(); + } + return new Ast\ConstExpr\DoctrineConstExprStringNode(Ast\ConstExpr\DoctrineConstExprStringNode::unescape($text)); } - public static function containsOnlyInstancesOf(string $className) : TraversableContainsOnly + private function parseArrayItem(TokenIterator $tokens): Ast\ConstExpr\ConstExprArrayItemNode { - return new TraversableContainsOnly($className, \false); + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + $expr = $this->parse($tokens); + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_DOUBLE_ARROW)) { + $key = $expr; + $value = $this->parse($tokens); + } else { + $key = null; + $value = $expr; + } + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprArrayItemNode($key, $value), $startLine, $startIndex); } /** - * @param int|string $key + * @template T of Ast\ConstExpr\ConstExprNode + * @param T $node + * @return T */ - public static function arrayHasKey($key) : ArrayHasKey + private function enrichWithAttributes(TokenIterator $tokens, Ast\ConstExpr\ConstExprNode $node, int $startLine, int $startIndex): Ast\ConstExpr\ConstExprNode { - return new ArrayHasKey($key); + if ($this->useLinesAttributes) { + $node->setAttribute(Ast\Attribute::START_LINE, $startLine); + $node->setAttribute(Ast\Attribute::END_LINE, $tokens->currentTokenLine()); + } + if ($this->useIndexAttributes) { + $node->setAttribute(Ast\Attribute::START_INDEX, $startIndex); + $node->setAttribute(Ast\Attribute::END_INDEX, $tokens->endIndexOfLastRelevantToken()); + } + return $node; } - public static function equalTo($value) : IsEqual +} +currentTokenValue = $currentTokenValue; + $this->currentTokenType = $currentTokenType; + $this->currentOffset = $currentOffset; + $this->expectedTokenType = $expectedTokenType; + $this->expectedTokenValue = $expectedTokenValue; + $this->currentTokenLine = $currentTokenLine; + parent::__construct(sprintf('Unexpected token %s, expected %s%s at offset %d%s', $this->formatValue($currentTokenValue), Lexer::TOKEN_LABELS[$expectedTokenType], ($expectedTokenValue !== null) ? sprintf(' (%s)', $this->formatValue($expectedTokenValue)) : '', $currentOffset, ($currentTokenLine === null) ? '' : sprintf(' on line %d', $currentTokenLine))); } - public static function equalToCanonicalizing($value) : IsEqualCanonicalizing + public function getCurrentTokenValue(): string { - return new IsEqualCanonicalizing($value); + return $this->currentTokenValue; } - public static function equalToIgnoringCase($value) : IsEqualIgnoringCase + public function getCurrentTokenType(): int { - return new IsEqualIgnoringCase($value); + return $this->currentTokenType; } - public static function equalToWithDelta($value, float $delta) : IsEqualWithDelta + public function getCurrentOffset(): int { - return new IsEqualWithDelta($value, $delta); + return $this->currentOffset; } - public static function isEmpty() : IsEmpty + public function getExpectedTokenType(): int { - return new IsEmpty(); + return $this->expectedTokenType; } - public static function isWritable() : IsWritable + public function getExpectedTokenValue(): ?string { - return new IsWritable(); + return $this->expectedTokenValue; } - public static function isReadable() : IsReadable + public function getCurrentTokenLine(): ?int { - return new IsReadable(); + return $this->currentTokenLine; } - public static function directoryExists() : DirectoryExists + private function formatValue(string $value): string { - return new DirectoryExists(); + $json = json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE); + assert($json !== \false); + return $json; + } +} +typeParser = $typeParser; + $this->constantExprParser = $constantExprParser; + $this->doctrineConstantExprParser = $constantExprParser->toDoctrine(); + $this->requireWhitespaceBeforeDescription = $requireWhitespaceBeforeDescription; + $this->preserveTypeAliasesWithInvalidTypes = $preserveTypeAliasesWithInvalidTypes; + $this->parseDoctrineAnnotations = $parseDoctrineAnnotations; + $this->useLinesAttributes = $usedAttributes['lines'] ?? \false; + $this->useIndexAttributes = $usedAttributes['indexes'] ?? \false; + $this->textBetweenTagsBelongsToDescription = $textBetweenTagsBelongsToDescription; + } + public function parse(TokenIterator $tokens): Ast\PhpDoc\PhpDocNode + { + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_PHPDOC); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $children = []; + if ($this->parseDoctrineAnnotations) { + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + $lastChild = $this->parseChild($tokens); + $children[] = $lastChild; + while (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + if ($lastChild instanceof Ast\PhpDoc\PhpDocTagNode && ($lastChild->value instanceof Doctrine\DoctrineTagValueNode || $lastChild->value instanceof Ast\PhpDoc\GenericTagValueNode)) { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + break; + } + $lastChild = $this->parseChild($tokens); + $children[] = $lastChild; + continue; + } + if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + break; + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + break; + } + $lastChild = $this->parseChild($tokens); + $children[] = $lastChild; + } + } + } else if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + $children[] = $this->parseChild($tokens); + while ($tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL) && !$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + $children[] = $this->parseChild($tokens); + } + } + try { + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PHPDOC); + } catch (ParserException $e) { + $name = ''; + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if (count($children) > 0) { + $lastChild = $children[count($children) - 1]; + if ($lastChild instanceof Ast\PhpDoc\PhpDocTagNode) { + $name = $lastChild->name; + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + } + } + $tag = new Ast\PhpDoc\PhpDocTagNode($name, $this->enrichWithAttributes($tokens, new Ast\PhpDoc\InvalidTagValueNode($e->getMessage(), $e), $startLine, $startIndex)); + $tokens->forwardToTheEnd(); + return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\PhpDocNode([$this->enrichWithAttributes($tokens, $tag, $startLine, $startIndex)]), 1, 0); + } + return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\PhpDocNode(array_values($children)), 1, 0); } - public static function fileExists() : FileExists + /** @phpstan-impure */ + private function parseChild(TokenIterator $tokens): Ast\PhpDoc\PhpDocChildNode { - return new FileExists(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_TAG)) { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + return $this->enrichWithAttributes($tokens, $this->parseTag($tokens), $startLine, $startIndex); + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_DOCTRINE_TAG)) { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + $tag = $tokens->currentTokenValue(); + $tokens->next(); + $tagStartLine = $tokens->currentTokenLine(); + $tagStartIndex = $tokens->currentTokenIndex(); + return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\PhpDocTagNode($tag, $this->enrichWithAttributes($tokens, $this->parseDoctrineTagValue($tokens, $tag), $tagStartLine, $tagStartIndex)), $startLine, $startIndex); + } + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + $text = $this->parseText($tokens); + return $this->enrichWithAttributes($tokens, $text, $startLine, $startIndex); } - public static function greaterThan($value) : GreaterThan + /** + * @template T of Ast\Node + * @param T $tag + * @return T + */ + private function enrichWithAttributes(TokenIterator $tokens, Ast\Node $tag, int $startLine, int $startIndex): Ast\Node { - return new GreaterThan($value); + if ($this->useLinesAttributes) { + $tag->setAttribute(Ast\Attribute::START_LINE, $startLine); + $tag->setAttribute(Ast\Attribute::END_LINE, $tokens->currentTokenLine()); + } + if ($this->useIndexAttributes) { + $tag->setAttribute(Ast\Attribute::START_INDEX, $startIndex); + $tag->setAttribute(Ast\Attribute::END_INDEX, $tokens->endIndexOfLastRelevantToken()); + } + return $tag; } - public static function greaterThanOrEqual($value) : LogicalOr + private function parseText(TokenIterator $tokens): Ast\PhpDoc\PhpDocTextNode { - return static::logicalOr(new IsEqual($value), new GreaterThan($value)); + $text = ''; + $endTokens = [Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; + if ($this->textBetweenTagsBelongsToDescription) { + $endTokens = [Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; + } + $savepoint = \false; + // if the next token is EOL, everything below is skipped and empty string is returned + while ($this->textBetweenTagsBelongsToDescription || !$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + $tmpText = $tokens->getSkippedHorizontalWhiteSpaceIfAny() . $tokens->joinUntil(Lexer::TOKEN_PHPDOC_EOL, ...$endTokens); + $text .= $tmpText; + // stop if we're not at EOL - meaning it's the end of PHPDoc + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + break; + } + if ($this->textBetweenTagsBelongsToDescription) { + if (!$savepoint) { + $tokens->pushSavePoint(); + $savepoint = \true; + } elseif ($tmpText !== '') { + $tokens->dropSavePoint(); + $tokens->pushSavePoint(); + } + } + $tokens->pushSavePoint(); + $tokens->next(); + // if we're at EOL, check what's next + // if next is a PHPDoc tag, EOL, or end of PHPDoc, stop + if ($tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_TAG, Lexer::TOKEN_DOCTRINE_TAG, ...$endTokens)) { + $tokens->rollback(); + break; + } + // otherwise if the next is text, continue building the description string + $tokens->dropSavePoint(); + $text .= $tokens->getDetectedNewline() ?? "\n"; + } + if ($savepoint) { + $tokens->rollback(); + $text = rtrim($text, $tokens->getDetectedNewline() ?? "\n"); + } + return new Ast\PhpDoc\PhpDocTextNode(trim($text, " \t")); + } + private function parseOptionalDescriptionAfterDoctrineTag(TokenIterator $tokens): string + { + $text = ''; + $endTokens = [Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; + if ($this->textBetweenTagsBelongsToDescription) { + $endTokens = [Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; + } + $savepoint = \false; + // if the next token is EOL, everything below is skipped and empty string is returned + while ($this->textBetweenTagsBelongsToDescription || !$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + $tmpText = $tokens->getSkippedHorizontalWhiteSpaceIfAny() . $tokens->joinUntil(Lexer::TOKEN_PHPDOC_TAG, Lexer::TOKEN_DOCTRINE_TAG, Lexer::TOKEN_PHPDOC_EOL, ...$endTokens); + $text .= $tmpText; + // stop if we're not at EOL - meaning it's the end of PHPDoc + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + if (!$tokens->isPrecededByHorizontalWhitespace()) { + return trim($text . $this->parseText($tokens)->text, " \t"); + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_TAG)) { + $tokens->pushSavePoint(); + $child = $this->parseChild($tokens); + if ($child instanceof Ast\PhpDoc\PhpDocTagNode) { + if ($child->value instanceof Ast\PhpDoc\GenericTagValueNode || $child->value instanceof Doctrine\DoctrineTagValueNode) { + $tokens->rollback(); + break; + } + if ($child->value instanceof Ast\PhpDoc\InvalidTagValueNode) { + $tokens->rollback(); + $tokens->pushSavePoint(); + $tokens->next(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { + $tokens->rollback(); + break; + } + $tokens->rollback(); + return trim($text . $this->parseText($tokens)->text, " \t"); + } + } + $tokens->rollback(); + return trim($text . $this->parseText($tokens)->text, " \t"); + } + break; + } + if ($this->textBetweenTagsBelongsToDescription) { + if (!$savepoint) { + $tokens->pushSavePoint(); + $savepoint = \true; + } elseif ($tmpText !== '') { + $tokens->dropSavePoint(); + $tokens->pushSavePoint(); + } + } + $tokens->pushSavePoint(); + $tokens->next(); + // if we're at EOL, check what's next + // if next is a PHPDoc tag, EOL, or end of PHPDoc, stop + if ($tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_TAG, Lexer::TOKEN_DOCTRINE_TAG, ...$endTokens)) { + $tokens->rollback(); + break; + } + // otherwise if the next is text, continue building the description string + $tokens->dropSavePoint(); + $text .= $tokens->getDetectedNewline() ?? "\n"; + } + if ($savepoint) { + $tokens->rollback(); + $text = rtrim($text, $tokens->getDetectedNewline() ?? "\n"); + } + return trim($text, " \t"); + } + public function parseTag(TokenIterator $tokens): Ast\PhpDoc\PhpDocTagNode + { + $tag = $tokens->currentTokenValue(); + $tokens->next(); + $value = $this->parseTagValue($tokens, $tag); + return new Ast\PhpDoc\PhpDocTagNode($tag, $value); + } + public function parseTagValue(TokenIterator $tokens, string $tag): Ast\PhpDoc\PhpDocTagValueNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + try { + $tokens->pushSavePoint(); + switch ($tag) { + case '@param': + case '@phpstan-param': + case '@psalm-param': + case '@phan-param': + $tagValue = $this->parseParamTagValue($tokens); + break; + case '@param-immediately-invoked-callable': + case '@phpstan-param-immediately-invoked-callable': + $tagValue = $this->parseParamImmediatelyInvokedCallableTagValue($tokens); + break; + case '@param-later-invoked-callable': + case '@phpstan-param-later-invoked-callable': + $tagValue = $this->parseParamLaterInvokedCallableTagValue($tokens); + break; + case '@param-closure-this': + case '@phpstan-param-closure-this': + $tagValue = $this->parseParamClosureThisTagValue($tokens); + break; + case '@var': + case '@phpstan-var': + case '@psalm-var': + case '@phan-var': + $tagValue = $this->parseVarTagValue($tokens); + break; + case '@return': + case '@phpstan-return': + case '@psalm-return': + case '@phan-return': + case '@phan-real-return': + $tagValue = $this->parseReturnTagValue($tokens); + break; + case '@throws': + case '@phpstan-throws': + $tagValue = $this->parseThrowsTagValue($tokens); + break; + case '@mixin': + case '@phan-mixin': + $tagValue = $this->parseMixinTagValue($tokens); + break; + case '@psalm-require-extends': + case '@phpstan-require-extends': + $tagValue = $this->parseRequireExtendsTagValue($tokens); + break; + case '@psalm-require-implements': + case '@phpstan-require-implements': + $tagValue = $this->parseRequireImplementsTagValue($tokens); + break; + case '@deprecated': + $tagValue = $this->parseDeprecatedTagValue($tokens); + break; + case '@property': + case '@property-read': + case '@property-write': + case '@phpstan-property': + case '@phpstan-property-read': + case '@phpstan-property-write': + case '@psalm-property': + case '@psalm-property-read': + case '@psalm-property-write': + case '@phan-property': + case '@phan-property-read': + case '@phan-property-write': + $tagValue = $this->parsePropertyTagValue($tokens); + break; + case '@method': + case '@phpstan-method': + case '@psalm-method': + case '@phan-method': + $tagValue = $this->parseMethodTagValue($tokens); + break; + case '@template': + case '@phpstan-template': + case '@psalm-template': + case '@phan-template': + case '@template-covariant': + case '@phpstan-template-covariant': + case '@psalm-template-covariant': + case '@template-contravariant': + case '@phpstan-template-contravariant': + case '@psalm-template-contravariant': + $tagValue = $this->typeParser->parseTemplateTagValue($tokens, function ($tokens) { + return $this->parseOptionalDescription($tokens); + }); + break; + case '@extends': + case '@phpstan-extends': + case '@phan-extends': + case '@phan-inherits': + case '@template-extends': + $tagValue = $this->parseExtendsTagValue('@extends', $tokens); + break; + case '@implements': + case '@phpstan-implements': + case '@template-implements': + $tagValue = $this->parseExtendsTagValue('@implements', $tokens); + break; + case '@use': + case '@phpstan-use': + case '@template-use': + $tagValue = $this->parseExtendsTagValue('@use', $tokens); + break; + case '@phpstan-type': + case '@psalm-type': + case '@phan-type': + $tagValue = $this->parseTypeAliasTagValue($tokens); + break; + case '@phpstan-import-type': + case '@psalm-import-type': + $tagValue = $this->parseTypeAliasImportTagValue($tokens); + break; + case '@phpstan-assert': + case '@phpstan-assert-if-true': + case '@phpstan-assert-if-false': + case '@psalm-assert': + case '@psalm-assert-if-true': + case '@psalm-assert-if-false': + case '@phan-assert': + case '@phan-assert-if-true': + case '@phan-assert-if-false': + $tagValue = $this->parseAssertTagValue($tokens); + break; + case '@phpstan-this-out': + case '@phpstan-self-out': + case '@psalm-this-out': + case '@psalm-self-out': + $tagValue = $this->parseSelfOutTagValue($tokens); + break; + case '@param-out': + case '@phpstan-param-out': + case '@psalm-param-out': + $tagValue = $this->parseParamOutTagValue($tokens); + break; + default: + if ($this->parseDoctrineAnnotations) { + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { + $tagValue = $this->parseDoctrineTagValue($tokens, $tag); + } else { + $tagValue = new Ast\PhpDoc\GenericTagValueNode($this->parseOptionalDescriptionAfterDoctrineTag($tokens)); + } + break; + } + $tagValue = new Ast\PhpDoc\GenericTagValueNode($this->parseOptionalDescription($tokens)); + break; + } + $tokens->dropSavePoint(); + } catch (ParserException $e) { + $tokens->rollback(); + $tagValue = new Ast\PhpDoc\InvalidTagValueNode($this->parseOptionalDescription($tokens), $e); + } + return $this->enrichWithAttributes($tokens, $tagValue, $startLine, $startIndex); + } + private function parseDoctrineTagValue(TokenIterator $tokens, string $tag): Ast\PhpDoc\PhpDocTagValueNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + return new Doctrine\DoctrineTagValueNode($this->enrichWithAttributes($tokens, new Doctrine\DoctrineAnnotation($tag, $this->parseDoctrineArguments($tokens, \false)), $startLine, $startIndex), $this->parseOptionalDescriptionAfterDoctrineTag($tokens)); } /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return list */ - public static function classHasAttribute(string $attributeName) : ClassHasAttribute + private function parseDoctrineArguments(TokenIterator $tokens, bool $deep): array { - self::createWarning('classHasAttribute() is deprecated and will be removed in PHPUnit 10.'); - return new ClassHasAttribute($attributeName); + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { + return []; + } + if (!$deep) { + $tokens->addEndOfLineToSkippedTokens(); + } + $arguments = []; + try { + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES); + do { + if ($tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PARENTHESES)) { + break; + } + $arguments[] = $this->parseDoctrineArgument($tokens); + } while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)); + } finally { + if (!$deep) { + $tokens->removeEndOfLineFromSkippedTokens(); + } + } + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES); + return $arguments; + } + private function parseDoctrineArgument(TokenIterator $tokens): Doctrine\DoctrineArgument + { + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_IDENTIFIER)) { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineArgument(null, $this->parseDoctrineArgumentValue($tokens)), $startLine, $startIndex); + } + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + try { + $tokens->pushSavePoint(); + $currentValue = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + $key = $this->enrichWithAttributes($tokens, new IdentifierTypeNode($currentValue), $startLine, $startIndex); + $tokens->consumeTokenType(Lexer::TOKEN_EQUAL); + $value = $this->parseDoctrineArgumentValue($tokens); + $tokens->dropSavePoint(); + return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineArgument($key, $value), $startLine, $startIndex); + } catch (ParserException $e) { + $tokens->rollback(); + return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineArgument(null, $this->parseDoctrineArgumentValue($tokens)), $startLine, $startIndex); + } } /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return DoctrineValueType */ - public static function classHasStaticAttribute(string $attributeName) : ClassHasStaticAttribute + private function parseDoctrineArgumentValue(TokenIterator $tokens) { - self::createWarning('classHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.'); - return new ClassHasStaticAttribute($attributeName); + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_TAG, Lexer::TOKEN_DOCTRINE_TAG)) { + $name = $tokens->currentTokenValue(); + $tokens->next(); + return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineAnnotation($name, $this->parseDoctrineArguments($tokens, \true)), $startLine, $startIndex); + } + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_CURLY_BRACKET)) { + $items = []; + do { + if ($tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET)) { + break; + } + $items[] = $this->parseDoctrineArrayItem($tokens); + } while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)); + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET); + return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineArray($items), $startLine, $startIndex); + } + $currentTokenValue = $tokens->currentTokenValue(); + $tokens->pushSavePoint(); + // because of ConstFetchNode + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_IDENTIFIER)) { + $identifier = $this->enrichWithAttributes($tokens, new Ast\Type\IdentifierTypeNode($currentTokenValue), $startLine, $startIndex); + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_COLON)) { + $tokens->dropSavePoint(); + return $identifier; + } + $tokens->rollback(); + // because of ConstFetchNode + } else { + $tokens->dropSavePoint(); + // because of ConstFetchNode + } + $currentTokenValue = $tokens->currentTokenValue(); + $currentTokenType = $tokens->currentTokenType(); + $currentTokenOffset = $tokens->currentTokenOffset(); + $currentTokenLine = $tokens->currentTokenLine(); + try { + $constExpr = $this->doctrineConstantExprParser->parse($tokens, \true); + if ($constExpr instanceof Ast\ConstExpr\ConstExprArrayNode) { + throw new ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); + } + return $constExpr; + } catch (LogicException $e) { + throw new ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); + } + } + private function parseDoctrineArrayItem(TokenIterator $tokens): Doctrine\DoctrineArrayItem + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + try { + $tokens->pushSavePoint(); + $key = $this->parseDoctrineArrayKey($tokens); + if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL)) { + if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_COLON)) { + $tokens->consumeTokenType(Lexer::TOKEN_EQUAL); + // will throw exception + } + } + $value = $this->parseDoctrineArgumentValue($tokens); + $tokens->dropSavePoint(); + return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineArrayItem($key, $value), $startLine, $startIndex); + } catch (ParserException $e) { + $tokens->rollback(); + return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineArrayItem(null, $this->parseDoctrineArgumentValue($tokens)), $startLine, $startIndex); + } } /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 + * @return ConstExprIntegerNode|ConstExprStringNode|IdentifierTypeNode|ConstFetchNode */ - public static function objectHasAttribute($attributeName) : ObjectHasAttribute + private function parseDoctrineArrayKey(TokenIterator $tokens) { - self::createWarning('objectHasAttribute() is deprecated and will be removed in PHPUnit 10.'); - return new ObjectHasAttribute($attributeName); + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_INTEGER)) { + $key = new Ast\ConstExpr\ConstExprIntegerNode(str_replace('_', '', $tokens->currentTokenValue())); + $tokens->next(); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_DOCTRINE_ANNOTATION_STRING)) { + $key = new Ast\ConstExpr\DoctrineConstExprStringNode(Ast\ConstExpr\DoctrineConstExprStringNode::unescape($tokens->currentTokenValue())); + $tokens->next(); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_QUOTED_STRING)) { + $value = $tokens->currentTokenValue(); + $tokens->next(); + $key = $this->doctrineConstantExprParser->parseDoctrineString($value, $tokens); + } else { + $currentTokenValue = $tokens->currentTokenValue(); + $tokens->pushSavePoint(); + // because of ConstFetchNode + if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_IDENTIFIER)) { + $tokens->dropSavePoint(); + throw new ParserException($tokens->currentTokenValue(), $tokens->currentTokenType(), $tokens->currentTokenOffset(), Lexer::TOKEN_IDENTIFIER, null, $tokens->currentTokenLine()); + } + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_COLON)) { + $tokens->dropSavePoint(); + return $this->enrichWithAttributes($tokens, new IdentifierTypeNode($currentTokenValue), $startLine, $startIndex); + } + $tokens->rollback(); + $constExpr = $this->doctrineConstantExprParser->parse($tokens, \true); + if (!$constExpr instanceof Ast\ConstExpr\ConstFetchNode) { + throw new ParserException($tokens->currentTokenValue(), $tokens->currentTokenType(), $tokens->currentTokenOffset(), Lexer::TOKEN_IDENTIFIER, null, $tokens->currentTokenLine()); + } + return $constExpr; + } + return $this->enrichWithAttributes($tokens, $key, $startLine, $startIndex); } - public static function identicalTo($value) : IsIdentical + /** + * @return Ast\PhpDoc\ParamTagValueNode|Ast\PhpDoc\TypelessParamTagValueNode + */ + private function parseParamTagValue(TokenIterator $tokens): Ast\PhpDoc\PhpDocTagValueNode { - return new IsIdentical($value); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_REFERENCE, Lexer::TOKEN_VARIADIC, Lexer::TOKEN_VARIABLE)) { + $type = null; + } else { + $type = $this->typeParser->parse($tokens); + } + $isReference = $tokens->tryConsumeTokenType(Lexer::TOKEN_REFERENCE); + $isVariadic = $tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC); + $parameterName = $this->parseRequiredVariableName($tokens); + $description = $this->parseOptionalDescription($tokens); + if ($type !== null) { + return new Ast\PhpDoc\ParamTagValueNode($type, $isVariadic, $parameterName, $description, $isReference); + } + return new Ast\PhpDoc\TypelessParamTagValueNode($isVariadic, $parameterName, $description, $isReference); } - public static function isInstanceOf(string $className) : IsInstanceOf + private function parseParamImmediatelyInvokedCallableTagValue(TokenIterator $tokens): Ast\PhpDoc\ParamImmediatelyInvokedCallableTagValueNode { - return new IsInstanceOf($className); + $parameterName = $this->parseRequiredVariableName($tokens); + $description = $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\ParamImmediatelyInvokedCallableTagValueNode($parameterName, $description); } - public static function isType(string $type) : IsType + private function parseParamLaterInvokedCallableTagValue(TokenIterator $tokens): Ast\PhpDoc\ParamLaterInvokedCallableTagValueNode { - return new IsType($type); + $parameterName = $this->parseRequiredVariableName($tokens); + $description = $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\ParamLaterInvokedCallableTagValueNode($parameterName, $description); } - public static function lessThan($value) : LessThan + private function parseParamClosureThisTagValue(TokenIterator $tokens): Ast\PhpDoc\ParamClosureThisTagValueNode { - return new LessThan($value); + $type = $this->typeParser->parse($tokens); + $parameterName = $this->parseRequiredVariableName($tokens); + $description = $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\ParamClosureThisTagValueNode($type, $parameterName, $description); } - public static function lessThanOrEqual($value) : LogicalOr + private function parseVarTagValue(TokenIterator $tokens): Ast\PhpDoc\VarTagValueNode { - return static::logicalOr(new IsEqual($value), new LessThan($value)); + $type = $this->typeParser->parse($tokens); + $variableName = $this->parseOptionalVariableName($tokens); + $description = $this->parseOptionalDescription($tokens, $variableName === ''); + return new Ast\PhpDoc\VarTagValueNode($type, $variableName, $description); } - public static function matchesRegularExpression(string $pattern) : RegularExpression + private function parseReturnTagValue(TokenIterator $tokens): Ast\PhpDoc\ReturnTagValueNode { - return new RegularExpression($pattern); + $type = $this->typeParser->parse($tokens); + $description = $this->parseOptionalDescription($tokens, \true); + return new Ast\PhpDoc\ReturnTagValueNode($type, $description); } - public static function matches(string $string) : StringMatchesFormatDescription + private function parseThrowsTagValue(TokenIterator $tokens): Ast\PhpDoc\ThrowsTagValueNode { - return new StringMatchesFormatDescription($string); + $type = $this->typeParser->parse($tokens); + $description = $this->parseOptionalDescription($tokens, \true); + return new Ast\PhpDoc\ThrowsTagValueNode($type, $description); } - public static function stringStartsWith($prefix) : StringStartsWith + private function parseMixinTagValue(TokenIterator $tokens): Ast\PhpDoc\MixinTagValueNode { - return new StringStartsWith($prefix); + $type = $this->typeParser->parse($tokens); + $description = $this->parseOptionalDescription($tokens, \true); + return new Ast\PhpDoc\MixinTagValueNode($type, $description); } - public static function stringContains(string $string, bool $case = \true) : StringContains + private function parseRequireExtendsTagValue(TokenIterator $tokens): Ast\PhpDoc\RequireExtendsTagValueNode { - return new StringContains($string, $case); + $type = $this->typeParser->parse($tokens); + $description = $this->parseOptionalDescription($tokens, \true); + return new Ast\PhpDoc\RequireExtendsTagValueNode($type, $description); } - public static function stringEndsWith(string $suffix) : StringEndsWith + private function parseRequireImplementsTagValue(TokenIterator $tokens): Ast\PhpDoc\RequireImplementsTagValueNode { - return new StringEndsWith($suffix); + $type = $this->typeParser->parse($tokens); + $description = $this->parseOptionalDescription($tokens, \true); + return new Ast\PhpDoc\RequireImplementsTagValueNode($type, $description); } - public static function countOf(int $count) : Count + private function parseDeprecatedTagValue(TokenIterator $tokens): Ast\PhpDoc\DeprecatedTagValueNode { - return new Count($count); + $description = $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\DeprecatedTagValueNode($description); } - public static function objectEquals(object $object, string $method = 'equals') : ObjectEquals + private function parsePropertyTagValue(TokenIterator $tokens): Ast\PhpDoc\PropertyTagValueNode { - return new ObjectEquals($object, $method); + $type = $this->typeParser->parse($tokens); + $parameterName = $this->parseRequiredVariableName($tokens); + $description = $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\PropertyTagValueNode($type, $parameterName, $description); } - /** - * Fails a test with the given message. - * - * @throws AssertionFailedError - * - * @psalm-return never-return - */ - public static function fail(string $message = '') : void + private function parseMethodTagValue(TokenIterator $tokens): Ast\PhpDoc\MethodTagValueNode { - self::$count++; - throw new \PHPUnit\Framework\AssertionFailedError($message); + $staticKeywordOrReturnTypeOrMethodName = $this->typeParser->parse($tokens); + if ($staticKeywordOrReturnTypeOrMethodName instanceof Ast\Type\IdentifierTypeNode && $staticKeywordOrReturnTypeOrMethodName->name === 'static') { + $isStatic = \true; + $returnTypeOrMethodName = $this->typeParser->parse($tokens); + } else { + $isStatic = \false; + $returnTypeOrMethodName = $staticKeywordOrReturnTypeOrMethodName; + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_IDENTIFIER)) { + $returnType = $returnTypeOrMethodName; + $methodName = $tokens->currentTokenValue(); + $tokens->next(); + } elseif ($returnTypeOrMethodName instanceof Ast\Type\IdentifierTypeNode) { + $returnType = $isStatic ? $staticKeywordOrReturnTypeOrMethodName : null; + $methodName = $returnTypeOrMethodName->name; + $isStatic = \false; + } else { + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + // will throw exception + exit; + } + $templateTypes = []; + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET)) { + do { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + $templateTypes[] = $this->enrichWithAttributes($tokens, $this->typeParser->parseTemplateTagValue($tokens), $startLine, $startIndex); + } while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)); + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET); + } + $parameters = []; + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES); + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PARENTHESES)) { + $parameters[] = $this->parseMethodTagValueParameter($tokens); + while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) { + $parameters[] = $this->parseMethodTagValueParameter($tokens); + } + } + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES); + $description = $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\MethodTagValueNode($isStatic, $returnType, $methodName, $parameters, $description, $templateTypes); + } + private function parseMethodTagValueParameter(TokenIterator $tokens): Ast\PhpDoc\MethodTagValueParameterNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + switch ($tokens->currentTokenType()) { + case Lexer::TOKEN_IDENTIFIER: + case Lexer::TOKEN_OPEN_PARENTHESES: + case Lexer::TOKEN_NULLABLE: + $parameterType = $this->typeParser->parse($tokens); + break; + default: + $parameterType = null; + } + $isReference = $tokens->tryConsumeTokenType(Lexer::TOKEN_REFERENCE); + $isVariadic = $tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC); + $parameterName = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_VARIABLE); + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL)) { + $defaultValue = $this->constantExprParser->parse($tokens); + } else { + $defaultValue = null; + } + return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\MethodTagValueParameterNode($parameterType, $isReference, $isVariadic, $parameterName, $defaultValue), $startLine, $startIndex); + } + private function parseExtendsTagValue(string $tagName, TokenIterator $tokens): Ast\PhpDoc\PhpDocTagValueNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + $baseType = new IdentifierTypeNode($tokens->currentTokenValue()); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + $type = $this->typeParser->parseGeneric($tokens, $this->typeParser->enrichWithAttributes($tokens, $baseType, $startLine, $startIndex)); + $description = $this->parseOptionalDescription($tokens); + switch ($tagName) { + case '@extends': + return new Ast\PhpDoc\ExtendsTagValueNode($type, $description); + case '@implements': + return new Ast\PhpDoc\ImplementsTagValueNode($type, $description); + case '@use': + return new Ast\PhpDoc\UsesTagValueNode($type, $description); + } + throw new ShouldNotHappenException(); + } + private function parseTypeAliasTagValue(TokenIterator $tokens): Ast\PhpDoc\TypeAliasTagValueNode + { + $alias = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + // support phan-type/psalm-type syntax + $tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL); + if ($this->preserveTypeAliasesWithInvalidTypes) { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + try { + $type = $this->typeParser->parse($tokens); + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + throw new ParserException($tokens->currentTokenValue(), $tokens->currentTokenType(), $tokens->currentTokenOffset(), Lexer::TOKEN_PHPDOC_EOL, null, $tokens->currentTokenLine()); + } + } + return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $type); + } catch (ParserException $e) { + $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $this->enrichWithAttributes($tokens, new Ast\Type\InvalidTypeNode($e), $startLine, $startIndex)); + } + } + $type = $this->typeParser->parse($tokens); + return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $type); } - /** - * Mark the test as incomplete. - * - * @throws IncompleteTestError - * - * @psalm-return never-return - */ - public static function markTestIncomplete(string $message = '') : void + private function parseTypeAliasImportTagValue(TokenIterator $tokens): Ast\PhpDoc\TypeAliasImportTagValueNode { - throw new \PHPUnit\Framework\IncompleteTestError($message); + $importedAlias = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + $tokens->consumeTokenValue(Lexer::TOKEN_IDENTIFIER, 'from'); + $identifierStartLine = $tokens->currentTokenLine(); + $identifierStartIndex = $tokens->currentTokenIndex(); + $importedFrom = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + $importedFromType = $this->enrichWithAttributes($tokens, new IdentifierTypeNode($importedFrom), $identifierStartLine, $identifierStartIndex); + $importedAs = null; + if ($tokens->tryConsumeTokenValue('as')) { + $importedAs = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + } + return new Ast\PhpDoc\TypeAliasImportTagValueNode($importedAlias, $importedFromType, $importedAs); } /** - * Mark the test as skipped. - * - * @throws SkippedTestError - * @throws SyntheticSkippedError - * - * @psalm-return never-return + * @return Ast\PhpDoc\AssertTagValueNode|Ast\PhpDoc\AssertTagPropertyValueNode|Ast\PhpDoc\AssertTagMethodValueNode */ - public static function markTestSkipped(string $message = '') : void + private function parseAssertTagValue(TokenIterator $tokens): Ast\PhpDoc\PhpDocTagValueNode { - if ($hint = self::detectLocationHint($message)) { - $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - array_unshift($trace, $hint); - throw new \PHPUnit\Framework\SyntheticSkippedError($hint['message'], 0, $hint['file'], (int) $hint['line'], $trace); + $isNegated = $tokens->tryConsumeTokenType(Lexer::TOKEN_NEGATED); + $isEquality = $tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL); + $type = $this->typeParser->parse($tokens); + $parameter = $this->parseAssertParameter($tokens); + $description = $this->parseOptionalDescription($tokens); + if (array_key_exists('method', $parameter)) { + return new Ast\PhpDoc\AssertTagMethodValueNode($type, $parameter['parameter'], $parameter['method'], $isNegated, $description, $isEquality); + } elseif (array_key_exists('property', $parameter)) { + return new Ast\PhpDoc\AssertTagPropertyValueNode($type, $parameter['parameter'], $parameter['property'], $isNegated, $description, $isEquality); } - throw new \PHPUnit\Framework\SkippedTestError($message); + return new Ast\PhpDoc\AssertTagValueNode($type, $parameter['parameter'], $isNegated, $description, $isEquality); } /** - * Return the current assertion count. + * @return array{parameter: string}|array{parameter: string, property: string}|array{parameter: string, method: string} */ - public static function getCount() : int + private function parseAssertParameter(TokenIterator $tokens): array { - return self::$count; + if ($tokens->isCurrentTokenType(Lexer::TOKEN_THIS_VARIABLE)) { + $parameter = '$this'; + $tokens->next(); + } else { + $parameter = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_VARIABLE); + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_ARROW)) { + $tokens->consumeTokenType(Lexer::TOKEN_ARROW); + $propertyOrMethod = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES); + return ['parameter' => $parameter, 'method' => $propertyOrMethod]; + } + return ['parameter' => $parameter, 'property' => $propertyOrMethod]; + } + return ['parameter' => $parameter]; } - /** - * Reset the assertion counter. - */ - public static function resetCount() : void + private function parseSelfOutTagValue(TokenIterator $tokens): Ast\PhpDoc\SelfOutTagValueNode { - self::$count = 0; + $type = $this->typeParser->parse($tokens); + $description = $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\SelfOutTagValueNode($type, $description); } - private static function detectLocationHint(string $message) : ?array + private function parseParamOutTagValue(TokenIterator $tokens): Ast\PhpDoc\ParamOutTagValueNode { - $hint = null; - $lines = preg_split('/\\r\\n|\\r|\\n/', $message); - while (strpos($lines[0], '__OFFSET') !== \false) { - $offset = explode('=', array_shift($lines)); - if ($offset[0] === '__OFFSET_FILE') { - $hint['file'] = $offset[1]; - } - if ($offset[0] === '__OFFSET_LINE') { - $hint['line'] = $offset[1]; - } - } - if ($hint) { - $hint['message'] = implode(PHP_EOL, $lines); - } - return $hint; + $type = $this->typeParser->parse($tokens); + $parameterName = $this->parseRequiredVariableName($tokens); + $description = $this->parseOptionalDescription($tokens); + return new Ast\PhpDoc\ParamOutTagValueNode($type, $parameterName, $description); } - private static function isValidObjectAttributeName(string $attributeName) : bool + private function parseOptionalVariableName(TokenIterator $tokens): string { - return (bool) preg_match('/[^\\x00-\\x1f\\x7f-\\x9f]+/', $attributeName); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_VARIABLE)) { + $parameterName = $tokens->currentTokenValue(); + $tokens->next(); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_THIS_VARIABLE)) { + $parameterName = '$this'; + $tokens->next(); + } else { + $parameterName = ''; + } + return $parameterName; } - private static function isValidClassAttributeName(string $attributeName) : bool + private function parseRequiredVariableName(TokenIterator $tokens): string { - return (bool) preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/', $attributeName); + $parameterName = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_VARIABLE); + return $parameterName; } - /** - * @codeCoverageIgnore - */ - private static function createWarning(string $warning) : void + private function parseOptionalDescription(TokenIterator $tokens, bool $limitStartToken = \false): string { - foreach (debug_backtrace() as $step) { - if (isset($step['object']) && $step['object'] instanceof \PHPUnit\Framework\TestCase) { - assert($step['object'] instanceof \PHPUnit\Framework\TestCase); - $step['object']->addWarning($warning); - break; + if ($limitStartToken) { + foreach (self::DISALLOWED_DESCRIPTION_START_TOKENS as $disallowedStartToken) { + if (!$tokens->isCurrentTokenType($disallowedStartToken)) { + continue; + } + $tokens->consumeTokenType(Lexer::TOKEN_OTHER); + // will throw exception + } + if ($this->requireWhitespaceBeforeDescription && !$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END) && !$tokens->isPrecededByHorizontalWhitespace()) { + $tokens->consumeTokenType(Lexer::TOKEN_HORIZONTAL_WS); + // will throw exception } } + return $this->parseText($tokens)->text; } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; +namespace PHPUnitPHAR\PHPStan\PhpDocParser\Parser; -use function func_get_args; -use function function_exists; -use ArrayAccess; -use Countable; -use DOMDocument; -use DOMElement; -use PHPUnit\Framework\Constraint\ArrayHasKey; -use PHPUnit\Framework\Constraint\Callback; -use PHPUnit\Framework\Constraint\ClassHasAttribute; -use PHPUnit\Framework\Constraint\ClassHasStaticAttribute; -use PHPUnit\Framework\Constraint\Constraint; -use PHPUnit\Framework\Constraint\Count; -use PHPUnit\Framework\Constraint\DirectoryExists; -use PHPUnit\Framework\Constraint\FileExists; -use PHPUnit\Framework\Constraint\GreaterThan; -use PHPUnit\Framework\Constraint\IsAnything; -use PHPUnit\Framework\Constraint\IsEmpty; -use PHPUnit\Framework\Constraint\IsEqual; -use PHPUnit\Framework\Constraint\IsEqualCanonicalizing; -use PHPUnit\Framework\Constraint\IsEqualIgnoringCase; -use PHPUnit\Framework\Constraint\IsEqualWithDelta; -use PHPUnit\Framework\Constraint\IsFalse; -use PHPUnit\Framework\Constraint\IsFinite; -use PHPUnit\Framework\Constraint\IsIdentical; -use PHPUnit\Framework\Constraint\IsInfinite; -use PHPUnit\Framework\Constraint\IsInstanceOf; -use PHPUnit\Framework\Constraint\IsJson; -use PHPUnit\Framework\Constraint\IsNan; -use PHPUnit\Framework\Constraint\IsNull; -use PHPUnit\Framework\Constraint\IsReadable; -use PHPUnit\Framework\Constraint\IsTrue; -use PHPUnit\Framework\Constraint\IsType; -use PHPUnit\Framework\Constraint\IsWritable; -use PHPUnit\Framework\Constraint\LessThan; -use PHPUnit\Framework\Constraint\LogicalAnd; -use PHPUnit\Framework\Constraint\LogicalNot; -use PHPUnit\Framework\Constraint\LogicalOr; -use PHPUnit\Framework\Constraint\LogicalXor; -use PHPUnit\Framework\Constraint\ObjectEquals; -use PHPUnit\Framework\Constraint\ObjectHasAttribute; -use PHPUnit\Framework\Constraint\RegularExpression; -use PHPUnit\Framework\Constraint\StringContains; -use PHPUnit\Framework\Constraint\StringEndsWith; -use PHPUnit\Framework\Constraint\StringMatchesFormatDescription; -use PHPUnit\Framework\Constraint\StringStartsWith; -use PHPUnit\Framework\Constraint\TraversableContainsEqual; -use PHPUnit\Framework\Constraint\TraversableContainsIdentical; -use PHPUnit\Framework\Constraint\TraversableContainsOnly; -use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount as AnyInvokedCountMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedAtIndex as InvokedAtIndexMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastCount as InvokedAtLeastCountMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastOnce as InvokedAtLeastOnceMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedAtMostCount as InvokedAtMostCountMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedCount as InvokedCountMatcher; -use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls as ConsecutiveCallsStub; -use PHPUnit\Framework\MockObject\Stub\Exception as ExceptionStub; -use PHPUnit\Framework\MockObject\Stub\ReturnArgument as ReturnArgumentStub; -use PHPUnit\Framework\MockObject\Stub\ReturnCallback as ReturnCallbackStub; -use PHPUnit\Framework\MockObject\Stub\ReturnSelf as ReturnSelfStub; -use PHPUnit\Framework\MockObject\Stub\ReturnStub; -use PHPUnit\Framework\MockObject\Stub\ReturnValueMap as ReturnValueMapStub; -use Throwable; -if (!function_exists('PHPUnit\\Framework\\assertArrayHasKey')) { +use function chr; +use function hexdec; +use function octdec; +use function preg_replace_callback; +use function str_replace; +use function substr; +class StringUnescaper +{ + private const REPLACEMENTS = ['\\' => '\\', 'n' => "\n", 'r' => "\r", 't' => "\t", 'f' => "\f", 'v' => "\v", 'e' => "\x1b"]; + public static function unescapeString(string $string): string + { + $quote = $string[0]; + if ($quote === '\'') { + return str_replace(['\\\\', '\\\''], ['\\', '\''], substr($string, 1, -1)); + } + return self::parseEscapeSequences(substr($string, 1, -1), '"'); + } /** - * Asserts that an array has a specified key. - * - * @param int|string $key - * @param array|ArrayAccess $array - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertArrayHasKey + * Implementation based on https://github.com/nikic/PHP-Parser/blob/b0edd4c41111042d43bb45c6c657b2e0db367d9e/lib/PhpParser/Node/Scalar/String_.php#L90-L130 */ - function assertArrayHasKey($key, $array, string $message = '') : void + private static function parseEscapeSequences(string $str, string $quote): string { - \PHPUnit\Framework\Assert::assertArrayHasKey(...func_get_args()); + $str = str_replace('\\' . $quote, $quote, $str); + return preg_replace_callback('~\\\\([\\\\nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}|u\{([0-9a-fA-F]+)\})~', static function ($matches) { + $str = $matches[1]; + if (isset(self::REPLACEMENTS[$str])) { + return self::REPLACEMENTS[$str]; + } + if ($str[0] === 'x' || $str[0] === 'X') { + return chr((int) hexdec(substr($str, 1))); + } + if ($str[0] === 'u') { + return self::codePointToUtf8((int) hexdec($matches[2])); + } + return chr((int) octdec($str)); + }, $str); } -} -if (!function_exists('PHPUnit\\Framework\\assertArrayNotHasKey')) { /** - * Asserts that an array does not have a specified key. - * - * @param int|string $key - * @param array|ArrayAccess $array - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertArrayNotHasKey + * Implementation based on https://github.com/nikic/PHP-Parser/blob/b0edd4c41111042d43bb45c6c657b2e0db367d9e/lib/PhpParser/Node/Scalar/String_.php#L132-L154 */ - function assertArrayNotHasKey($key, $array, string $message = '') : void + private static function codePointToUtf8(int $num): string { - \PHPUnit\Framework\Assert::assertArrayNotHasKey(...func_get_args()); + if ($num <= 0x7f) { + return chr($num); + } + if ($num <= 0x7ff) { + return chr(($num >> 6) + 0xc0) . chr(($num & 0x3f) + 0x80); + } + if ($num <= 0xffff) { + return chr(($num >> 12) + 0xe0) . chr(($num >> 6 & 0x3f) + 0x80) . chr(($num & 0x3f) + 0x80); + } + if ($num <= 0x1fffff) { + return chr(($num >> 18) + 0xf0) . chr(($num >> 12 & 0x3f) + 0x80) . chr(($num >> 6 & 0x3f) + 0x80) . chr(($num & 0x3f) + 0x80); + } + // Invalid UTF-8 codepoint escape sequence: Codepoint too large + return "�"; } } -if (!function_exists('PHPUnit\\Framework\\assertContains')) { + */ + private $tokens; + /** @var int */ + private $index; + /** @var int[] */ + private $savePoints = []; + /** @var list */ + private $skippedTokenTypes = [Lexer::TOKEN_HORIZONTAL_WS]; + /** @var string|null */ + private $newline = null; /** - * Asserts that a haystack contains a needle. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertContains + * @param list $tokens */ - function assertContains($needle, iterable $haystack, string $message = '') : void + public function __construct(array $tokens, int $index = 0) { - \PHPUnit\Framework\Assert::assertContains(...func_get_args()); + $this->tokens = $tokens; + $this->index = $index; + $this->skipIrrelevantTokens(); } -} -if (!function_exists('PHPUnit\\Framework\\assertContainsEquals')) { - function assertContainsEquals($needle, iterable $haystack, string $message = '') : void + /** + * @return list + */ + public function getTokens(): array { - \PHPUnit\Framework\Assert::assertContainsEquals(...func_get_args()); + return $this->tokens; } -} -if (!function_exists('PHPUnit\\Framework\\assertNotContains')) { - /** - * Asserts that a haystack does not contain a needle. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotContains - */ - function assertNotContains($needle, iterable $haystack, string $message = '') : void + public function getContentBetween(int $startPos, int $endPos): string { - \PHPUnit\Framework\Assert::assertNotContains(...func_get_args()); + if ($startPos < 0 || $endPos > count($this->tokens)) { + throw new LogicException(); + } + $content = ''; + for ($i = $startPos; $i < $endPos; $i++) { + $content .= $this->tokens[$i][Lexer::VALUE_OFFSET]; + } + return $content; } -} -if (!function_exists('PHPUnit\\Framework\\assertNotContainsEquals')) { - function assertNotContainsEquals($needle, iterable $haystack, string $message = '') : void + public function getTokenCount(): int { - \PHPUnit\Framework\Assert::assertNotContainsEquals(...func_get_args()); + return count($this->tokens); } -} -if (!function_exists('PHPUnit\\Framework\\assertContainsOnly')) { - /** - * Asserts that a haystack contains only values of a given type. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertContainsOnly - */ - function assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = '') : void + public function currentTokenValue(): string { - \PHPUnit\Framework\Assert::assertContainsOnly(...func_get_args()); + return $this->tokens[$this->index][Lexer::VALUE_OFFSET]; + } + public function currentTokenType(): int + { + return $this->tokens[$this->index][Lexer::TYPE_OFFSET]; + } + public function currentTokenOffset(): int + { + $offset = 0; + for ($i = 0; $i < $this->index; $i++) { + $offset += strlen($this->tokens[$i][Lexer::VALUE_OFFSET]); + } + return $offset; + } + public function currentTokenLine(): int + { + return $this->tokens[$this->index][Lexer::LINE_OFFSET]; + } + public function currentTokenIndex(): int + { + return $this->index; + } + public function endIndexOfLastRelevantToken(): int + { + $endIndex = $this->currentTokenIndex(); + $endIndex--; + while (in_array($this->tokens[$endIndex][Lexer::TYPE_OFFSET], $this->skippedTokenTypes, \true)) { + if (!isset($this->tokens[$endIndex - 1])) { + break; + } + $endIndex--; + } + return $endIndex; + } + public function isCurrentTokenValue(string $tokenValue): bool + { + return $this->tokens[$this->index][Lexer::VALUE_OFFSET] === $tokenValue; + } + public function isCurrentTokenType(int ...$tokenType): bool + { + return in_array($this->tokens[$this->index][Lexer::TYPE_OFFSET], $tokenType, \true); + } + public function isPrecededByHorizontalWhitespace(): bool + { + return ($this->tokens[$this->index - 1][Lexer::TYPE_OFFSET] ?? -1) === Lexer::TOKEN_HORIZONTAL_WS; } -} -if (!function_exists('PHPUnit\\Framework\\assertContainsOnlyInstancesOf')) { /** - * Asserts that a haystack contains only instances of a given class name. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertContainsOnlyInstancesOf + * @throws ParserException */ - function assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = '') : void + public function consumeTokenType(int $tokenType): void { - \PHPUnit\Framework\Assert::assertContainsOnlyInstancesOf(...func_get_args()); + if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] !== $tokenType) { + $this->throwError($tokenType); + } + if ($tokenType === Lexer::TOKEN_PHPDOC_EOL) { + if ($this->newline === null) { + $this->detectNewline(); + } + } + $this->index++; + $this->skipIrrelevantTokens(); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotContainsOnly')) { /** - * Asserts that a haystack does not contain only values of a given type. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotContainsOnly + * @throws ParserException */ - function assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = '') : void + public function consumeTokenValue(int $tokenType, string $tokenValue): void { - \PHPUnit\Framework\Assert::assertNotContainsOnly(...func_get_args()); + if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] !== $tokenType || $this->tokens[$this->index][Lexer::VALUE_OFFSET] !== $tokenValue) { + $this->throwError($tokenType, $tokenValue); + } + $this->index++; + $this->skipIrrelevantTokens(); + } + /** @phpstan-impure */ + public function tryConsumeTokenValue(string $tokenValue): bool + { + if ($this->tokens[$this->index][Lexer::VALUE_OFFSET] !== $tokenValue) { + return \false; + } + $this->index++; + $this->skipIrrelevantTokens(); + return \true; + } + /** @phpstan-impure */ + public function tryConsumeTokenType(int $tokenType): bool + { + if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] !== $tokenType) { + return \false; + } + if ($tokenType === Lexer::TOKEN_PHPDOC_EOL) { + if ($this->newline === null) { + $this->detectNewline(); + } + } + $this->index++; + $this->skipIrrelevantTokens(); + return \true; + } + private function detectNewline(): void + { + $value = $this->currentTokenValue(); + if (substr($value, 0, 2) === "\r\n") { + $this->newline = "\r\n"; + } elseif (substr($value, 0, 1) === "\n") { + $this->newline = "\n"; + } + } + public function getSkippedHorizontalWhiteSpaceIfAny(): string + { + if ($this->index > 0 && $this->tokens[$this->index - 1][Lexer::TYPE_OFFSET] === Lexer::TOKEN_HORIZONTAL_WS) { + return $this->tokens[$this->index - 1][Lexer::VALUE_OFFSET]; + } + return ''; + } + /** @phpstan-impure */ + public function joinUntil(int ...$tokenType): string + { + $s = ''; + while (!in_array($this->tokens[$this->index][Lexer::TYPE_OFFSET], $tokenType, \true)) { + $s .= $this->tokens[$this->index++][Lexer::VALUE_OFFSET]; + } + return $s; + } + public function next(): void + { + $this->index++; + $this->skipIrrelevantTokens(); + } + private function skipIrrelevantTokens(): void + { + if (!isset($this->tokens[$this->index])) { + return; + } + while (in_array($this->tokens[$this->index][Lexer::TYPE_OFFSET], $this->skippedTokenTypes, \true)) { + if (!isset($this->tokens[$this->index + 1])) { + break; + } + $this->index++; + } + } + public function addEndOfLineToSkippedTokens(): void + { + $this->skippedTokenTypes = [Lexer::TOKEN_HORIZONTAL_WS, Lexer::TOKEN_PHPDOC_EOL]; + } + public function removeEndOfLineFromSkippedTokens(): void + { + $this->skippedTokenTypes = [Lexer::TOKEN_HORIZONTAL_WS]; + } + /** @phpstan-impure */ + public function forwardToTheEnd(): void + { + $lastToken = count($this->tokens) - 1; + $this->index = $lastToken; + } + public function pushSavePoint(): void + { + $this->savePoints[] = $this->index; + } + public function dropSavePoint(): void + { + array_pop($this->savePoints); + } + public function rollback(): void + { + $index = array_pop($this->savePoints); + assert($index !== null); + $this->index = $index; } -} -if (!function_exists('PHPUnit\\Framework\\assertCount')) { /** - * Asserts the number of elements of an array, Countable or Traversable. - * - * @param Countable|iterable $haystack - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertCount + * @throws ParserException */ - function assertCount(int $expectedCount, $haystack, string $message = '') : void + private function throwError(int $expectedTokenType, ?string $expectedTokenValue = null): void { - \PHPUnit\Framework\Assert::assertCount(...func_get_args()); + throw new ParserException($this->currentTokenValue(), $this->currentTokenType(), $this->currentTokenOffset(), $expectedTokenType, $expectedTokenValue, $this->currentTokenLine()); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotCount')) { /** - * Asserts the number of elements of an array, Countable or Traversable. - * - * @param Countable|iterable $haystack - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * Check whether the position is directly preceded by a certain token type. * - * @see Assert::assertNotCount + * During this check TOKEN_HORIZONTAL_WS and TOKEN_PHPDOC_EOL are skipped */ - function assertNotCount(int $expectedCount, $haystack, string $message = '') : void + public function hasTokenImmediatelyBefore(int $pos, int $expectedTokenType): bool { - \PHPUnit\Framework\Assert::assertNotCount(...func_get_args()); + $tokens = $this->tokens; + $pos--; + for (; $pos >= 0; $pos--) { + $token = $tokens[$pos]; + $type = $token[Lexer::TYPE_OFFSET]; + if ($type === $expectedTokenType) { + return \true; + } + if (!in_array($type, [Lexer::TOKEN_HORIZONTAL_WS, Lexer::TOKEN_PHPDOC_EOL], \true)) { + break; + } + } + return \false; } -} -if (!function_exists('PHPUnit\\Framework\\assertEquals')) { /** - * Asserts that two variables are equal. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * Check whether the position is directly followed by a certain token type. * - * @see Assert::assertEquals + * During this check TOKEN_HORIZONTAL_WS and TOKEN_PHPDOC_EOL are skipped */ - function assertEquals($expected, $actual, string $message = '') : void + public function hasTokenImmediatelyAfter(int $pos, int $expectedTokenType): bool { - \PHPUnit\Framework\Assert::assertEquals(...func_get_args()); + $tokens = $this->tokens; + $pos++; + for ($c = count($tokens); $pos < $c; $pos++) { + $token = $tokens[$pos]; + $type = $token[Lexer::TYPE_OFFSET]; + if ($type === $expectedTokenType) { + return \true; + } + if (!in_array($type, [Lexer::TOKEN_HORIZONTAL_WS, Lexer::TOKEN_PHPDOC_EOL], \true)) { + break; + } + } + return \false; + } + public function getDetectedNewline(): ?string + { + return $this->newline; } -} -if (!function_exists('PHPUnit\\Framework\\assertEqualsCanonicalizing')) { /** - * Asserts that two variables are equal (canonicalizing). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertEqualsCanonicalizing + * Whether the given position is immediately surrounded by parenthesis. */ - function assertEqualsCanonicalizing($expected, $actual, string $message = '') : void + public function hasParentheses(int $startPos, int $endPos): bool { - \PHPUnit\Framework\Assert::assertEqualsCanonicalizing(...func_get_args()); + return $this->hasTokenImmediatelyBefore($startPos, Lexer::TOKEN_OPEN_PARENTHESES) && $this->hasTokenImmediatelyAfter($endPos, Lexer::TOKEN_CLOSE_PARENTHESES); } } -if (!function_exists('PHPUnit\\Framework\\assertEqualsIgnoringCase')) { +constExprParser = $constExprParser; + $this->quoteAwareConstExprString = $quoteAwareConstExprString; + $this->useLinesAttributes = $usedAttributes['lines'] ?? \false; + $this->useIndexAttributes = $usedAttributes['indexes'] ?? \false; + } + /** @phpstan-impure */ + public function parse(TokenIterator $tokens): Ast\Type\TypeNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_NULLABLE)) { + $type = $this->parseNullable($tokens); + } else { + $type = $this->parseAtomic($tokens); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_UNION)) { + $type = $this->parseUnion($tokens, $type); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_INTERSECTION)) { + $type = $this->parseIntersection($tokens, $type); + } + } + return $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); } -} -if (!function_exists('PHPUnit\\Framework\\assertEqualsWithDelta')) { /** - * Asserts that two variables are equal (with delta). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertEqualsWithDelta + * @internal + * @template T of Ast\Node + * @param T $type + * @return T */ - function assertEqualsWithDelta($expected, $actual, float $delta, string $message = '') : void + public function enrichWithAttributes(TokenIterator $tokens, Ast\Node $type, int $startLine, int $startIndex): Ast\Node { - \PHPUnit\Framework\Assert::assertEqualsWithDelta(...func_get_args()); + if ($this->useLinesAttributes) { + $type->setAttribute(Ast\Attribute::START_LINE, $startLine); + $type->setAttribute(Ast\Attribute::END_LINE, $tokens->currentTokenLine()); + } + if ($this->useIndexAttributes) { + $type->setAttribute(Ast\Attribute::START_INDEX, $startIndex); + $type->setAttribute(Ast\Attribute::END_INDEX, $tokens->endIndexOfLastRelevantToken()); + } + return $type; + } + /** @phpstan-impure */ + private function subParse(TokenIterator $tokens): Ast\Type\TypeNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_NULLABLE)) { + $type = $this->parseNullable($tokens); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_VARIABLE)) { + $type = $this->parseConditionalForParameter($tokens, $tokens->currentTokenValue()); + } else { + $type = $this->parseAtomic($tokens); + if ($tokens->isCurrentTokenValue('is')) { + $type = $this->parseConditional($tokens, $type); + } else { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_UNION)) { + $type = $this->subParseUnion($tokens, $type); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_INTERSECTION)) { + $type = $this->subParseIntersection($tokens, $type); + } + } + } + return $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); + } + /** @phpstan-impure */ + private function parseAtomic(TokenIterator $tokens): Ast\Type\TypeNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $type = $this->subParse($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $type); + } + return $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); + } + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_THIS_VARIABLE)) { + $type = $this->enrichWithAttributes($tokens, new Ast\Type\ThisTypeNode(), $startLine, $startIndex); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $type); + } + return $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); + } + $currentTokenValue = $tokens->currentTokenValue(); + $tokens->pushSavePoint(); + // because of ConstFetchNode + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_IDENTIFIER)) { + $type = $this->enrichWithAttributes($tokens, new Ast\Type\IdentifierTypeNode($currentTokenValue), $startLine, $startIndex); + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_COLON)) { + $tokens->dropSavePoint(); + // because of ConstFetchNode + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET)) { + $tokens->pushSavePoint(); + $isHtml = $this->isHtml($tokens); + $tokens->rollback(); + if ($isHtml) { + return $type; + } + $origType = $type; + $type = $this->tryParseCallable($tokens, $type, \true); + if ($type === $origType) { + $type = $this->parseGeneric($tokens, $type); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $type); + } + } + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { + $type = $this->tryParseCallable($tokens, $type, \false); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $type); + } elseif (in_array($type->name, ['array', 'list', 'object'], \true) && $tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_CURLY_BRACKET) && !$tokens->isPrecededByHorizontalWhitespace()) { + if ($type->name === 'object') { + $type = $this->parseObjectShape($tokens); + } else { + $type = $this->parseArrayShape($tokens, $type, $type->name); + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex)); + } + } + return $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); + } else { + $tokens->rollback(); + // because of ConstFetchNode + } + } else { + $tokens->dropSavePoint(); + // because of ConstFetchNode + } + $currentTokenValue = $tokens->currentTokenValue(); + $currentTokenType = $tokens->currentTokenType(); + $currentTokenOffset = $tokens->currentTokenOffset(); + $currentTokenLine = $tokens->currentTokenLine(); + if ($this->constExprParser === null) { + throw new ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); + } + try { + $constExpr = $this->constExprParser->parse($tokens, \true); + if ($constExpr instanceof Ast\ConstExpr\ConstExprArrayNode) { + throw new ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); + } + $type = $this->enrichWithAttributes($tokens, new Ast\Type\ConstTypeNode($constExpr), $startLine, $startIndex); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $type); + } + return $type; + } catch (LogicException $e) { + throw new ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); + } + } + /** @phpstan-impure */ + private function parseUnion(TokenIterator $tokens, Ast\Type\TypeNode $type): Ast\Type\TypeNode + { + $types = [$type]; + while ($tokens->tryConsumeTokenType(Lexer::TOKEN_UNION)) { + $types[] = $this->parseAtomic($tokens); + } + return new Ast\Type\UnionTypeNode($types); + } + /** @phpstan-impure */ + private function subParseUnion(TokenIterator $tokens, Ast\Type\TypeNode $type): Ast\Type\TypeNode + { + $types = [$type]; + while ($tokens->tryConsumeTokenType(Lexer::TOKEN_UNION)) { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $types[] = $this->parseAtomic($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + } + return new Ast\Type\UnionTypeNode($types); + } + /** @phpstan-impure */ + private function parseIntersection(TokenIterator $tokens, Ast\Type\TypeNode $type): Ast\Type\TypeNode + { + $types = [$type]; + while ($tokens->tryConsumeTokenType(Lexer::TOKEN_INTERSECTION)) { + $types[] = $this->parseAtomic($tokens); + } + return new Ast\Type\IntersectionTypeNode($types); + } + /** @phpstan-impure */ + private function subParseIntersection(TokenIterator $tokens, Ast\Type\TypeNode $type): Ast\Type\TypeNode + { + $types = [$type]; + while ($tokens->tryConsumeTokenType(Lexer::TOKEN_INTERSECTION)) { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $types[] = $this->parseAtomic($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + } + return new Ast\Type\IntersectionTypeNode($types); + } + /** @phpstan-impure */ + private function parseConditional(TokenIterator $tokens, Ast\Type\TypeNode $subjectType): Ast\Type\TypeNode + { + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + $negated = \false; + if ($tokens->isCurrentTokenValue('not')) { + $negated = \true; + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + } + $targetType = $this->parse($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $tokens->consumeTokenType(Lexer::TOKEN_NULLABLE); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $ifType = $this->parse($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $tokens->consumeTokenType(Lexer::TOKEN_COLON); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $elseType = $this->subParse($tokens); + return new Ast\Type\ConditionalTypeNode($subjectType, $targetType, $ifType, $elseType, $negated); + } + /** @phpstan-impure */ + private function parseConditionalForParameter(TokenIterator $tokens, string $parameterName): Ast\Type\TypeNode + { + $tokens->consumeTokenType(Lexer::TOKEN_VARIABLE); + $tokens->consumeTokenValue(Lexer::TOKEN_IDENTIFIER, 'is'); + $negated = \false; + if ($tokens->isCurrentTokenValue('not')) { + $negated = \true; + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + } + $targetType = $this->parse($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $tokens->consumeTokenType(Lexer::TOKEN_NULLABLE); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $ifType = $this->parse($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $tokens->consumeTokenType(Lexer::TOKEN_COLON); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $elseType = $this->subParse($tokens); + return new Ast\Type\ConditionalTypeForParameterNode($parameterName, $targetType, $ifType, $elseType, $negated); + } + /** @phpstan-impure */ + private function parseNullable(TokenIterator $tokens): Ast\Type\TypeNode + { + $tokens->consumeTokenType(Lexer::TOKEN_NULLABLE); + $type = $this->parseAtomic($tokens); + return new Ast\Type\NullableTypeNode($type); + } + /** @phpstan-impure */ + public function isHtml(TokenIterator $tokens): bool + { + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET); + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_IDENTIFIER)) { + return \false; + } + $htmlTagName = $tokens->currentTokenValue(); + $tokens->next(); + if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) { + return \false; + } + $endTag = ''; + $endTagSearchOffset = -strlen($endTag); + while (!$tokens->isCurrentTokenType(Lexer::TOKEN_END)) { + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET) && strpos($tokens->currentTokenValue(), '/' . $htmlTagName . '>') !== \false || substr_compare($tokens->currentTokenValue(), $endTag, $endTagSearchOffset) === 0) { + return \true; + } + $tokens->next(); + } + return \false; + } + /** @phpstan-impure */ + public function parseGeneric(TokenIterator $tokens, Ast\Type\IdentifierTypeNode $baseType): Ast\Type\GenericTypeNode + { + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET); + $startLine = $baseType->getAttribute(Ast\Attribute::START_LINE); + $startIndex = $baseType->getAttribute(Ast\Attribute::START_INDEX); + $genericTypes = []; + $variances = []; + $isFirst = \true; + while ($isFirst || $tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + // trailing comma case + if (!$isFirst && $tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) { + break; + } + $isFirst = \false; + [$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + } + $type = new Ast\Type\GenericTypeNode($baseType, $genericTypes, $variances); + if ($startLine !== null && $startIndex !== null) { + $type = $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); + } + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET); + return $type; } -} -if (!function_exists('PHPUnit\\Framework\\assertNotEquals')) { /** - * Asserts that two variables are not equal. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotEquals + * @phpstan-impure + * @return array{Ast\Type\TypeNode, Ast\Type\GenericTypeNode::VARIANCE_*} */ - function assertNotEquals($expected, $actual, string $message = '') : void + public function parseGenericTypeArgument(TokenIterator $tokens): array { - \PHPUnit\Framework\Assert::assertNotEquals(...func_get_args()); + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_WILDCARD)) { + return [$this->enrichWithAttributes($tokens, new Ast\Type\IdentifierTypeNode('mixed'), $startLine, $startIndex), Ast\Type\GenericTypeNode::VARIANCE_BIVARIANT]; + } + if ($tokens->tryConsumeTokenValue('contravariant')) { + $variance = Ast\Type\GenericTypeNode::VARIANCE_CONTRAVARIANT; + } elseif ($tokens->tryConsumeTokenValue('covariant')) { + $variance = Ast\Type\GenericTypeNode::VARIANCE_COVARIANT; + } else { + $variance = Ast\Type\GenericTypeNode::VARIANCE_INVARIANT; + } + $type = $this->parse($tokens); + return [$type, $variance]; } -} -if (!function_exists('PHPUnit\\Framework\\assertNotEqualsCanonicalizing')) { /** - * Asserts that two variables are not equal (canonicalizing). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotEqualsCanonicalizing + * @throws ParserException + * @param ?callable(TokenIterator): string $parseDescription */ - function assertNotEqualsCanonicalizing($expected, $actual, string $message = '') : void + public function parseTemplateTagValue(TokenIterator $tokens, ?callable $parseDescription = null): TemplateTagValueNode { - \PHPUnit\Framework\Assert::assertNotEqualsCanonicalizing(...func_get_args()); + $name = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + if ($tokens->tryConsumeTokenValue('of') || $tokens->tryConsumeTokenValue('as')) { + $bound = $this->parse($tokens); + } else { + $bound = null; + } + if ($tokens->tryConsumeTokenValue('=')) { + $default = $this->parse($tokens); + } else { + $default = null; + } + if ($parseDescription !== null) { + $description = $parseDescription($tokens); + } else { + $description = ''; + } + if ($name === '') { + throw new LogicException('Template tag name cannot be empty.'); + } + return new Ast\PhpDoc\TemplateTagValueNode($name, $bound, $description, $default); + } + /** @phpstan-impure */ + private function parseCallable(TokenIterator $tokens, Ast\Type\IdentifierTypeNode $identifier, bool $hasTemplate): Ast\Type\TypeNode + { + $templates = $hasTemplate ? $this->parseCallableTemplates($tokens) : []; + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $parameters = []; + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PARENTHESES)) { + $parameters[] = $this->parseCallableParameter($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PARENTHESES)) { + break; + } + $parameters[] = $this->parseCallableParameter($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + } + } + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES); + $tokens->consumeTokenType(Lexer::TOKEN_COLON); + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + $returnType = $this->enrichWithAttributes($tokens, $this->parseCallableReturnType($tokens), $startLine, $startIndex); + return new Ast\Type\CallableTypeNode($identifier, $parameters, $returnType, $templates); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotEqualsIgnoringCase')) { /** - * Asserts that two variables are not equal (ignoring case). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @return Ast\PhpDoc\TemplateTagValueNode[] * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotEqualsIgnoringCase + * @phpstan-impure */ - function assertNotEqualsIgnoringCase($expected, $actual, string $message = '') : void + private function parseCallableTemplates(TokenIterator $tokens): array { - \PHPUnit\Framework\Assert::assertNotEqualsIgnoringCase(...func_get_args()); + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET); + $templates = []; + $isFirst = \true; + while ($isFirst || $tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + // trailing comma case + if (!$isFirst && $tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) { + break; + } + $isFirst = \false; + $templates[] = $this->parseCallableTemplateArgument($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + } + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET); + return $templates; + } + private function parseCallableTemplateArgument(TokenIterator $tokens): Ast\PhpDoc\TemplateTagValueNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + return $this->enrichWithAttributes($tokens, $this->parseTemplateTagValue($tokens), $startLine, $startIndex); + } + /** @phpstan-impure */ + private function parseCallableParameter(TokenIterator $tokens): Ast\Type\CallableTypeParameterNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + $type = $this->parse($tokens); + $isReference = $tokens->tryConsumeTokenType(Lexer::TOKEN_REFERENCE); + $isVariadic = $tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_VARIABLE)) { + $parameterName = $tokens->currentTokenValue(); + $tokens->consumeTokenType(Lexer::TOKEN_VARIABLE); + } else { + $parameterName = ''; + } + $isOptional = $tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL); + return $this->enrichWithAttributes($tokens, new Ast\Type\CallableTypeParameterNode($type, $isReference, $isVariadic, $parameterName, $isOptional), $startLine, $startIndex); + } + /** @phpstan-impure */ + private function parseCallableReturnType(TokenIterator $tokens): Ast\Type\TypeNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_NULLABLE)) { + return $this->parseNullable($tokens); + } elseif ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { + $type = $this->subParse($tokens); + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $type); + } + return $type; + } elseif ($tokens->tryConsumeTokenType(Lexer::TOKEN_THIS_VARIABLE)) { + $type = new Ast\Type\ThisTypeNode(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex)); + } + return $type; + } else { + $currentTokenValue = $tokens->currentTokenValue(); + $tokens->pushSavePoint(); + // because of ConstFetchNode + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_IDENTIFIER)) { + $type = new Ast\Type\IdentifierTypeNode($currentTokenValue); + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_COLON)) { + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET)) { + $type = $this->parseGeneric($tokens, $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex)); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex)); + } + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex)); + } elseif (in_array($type->name, ['array', 'list', 'object'], \true) && $tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_CURLY_BRACKET) && !$tokens->isPrecededByHorizontalWhitespace()) { + if ($type->name === 'object') { + $type = $this->parseObjectShape($tokens); + } else { + $type = $this->parseArrayShape($tokens, $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex), $type->name); + } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex)); + } + } + return $type; + } else { + $tokens->rollback(); + // because of ConstFetchNode + } + } else { + $tokens->dropSavePoint(); + // because of ConstFetchNode + } + } + $currentTokenValue = $tokens->currentTokenValue(); + $currentTokenType = $tokens->currentTokenType(); + $currentTokenOffset = $tokens->currentTokenOffset(); + $currentTokenLine = $tokens->currentTokenLine(); + if ($this->constExprParser === null) { + throw new ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); + } + try { + $constExpr = $this->constExprParser->parse($tokens, \true); + if ($constExpr instanceof Ast\ConstExpr\ConstExprArrayNode) { + throw new ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); + } + $type = $this->enrichWithAttributes($tokens, new Ast\Type\ConstTypeNode($constExpr), $startLine, $startIndex); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $type = $this->tryParseArrayOrOffsetAccess($tokens, $type); + } + return $type; + } catch (LogicException $e) { + throw new ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); + } + } + /** @phpstan-impure */ + private function tryParseCallable(TokenIterator $tokens, Ast\Type\IdentifierTypeNode $identifier, bool $hasTemplate): Ast\Type\TypeNode + { + try { + $tokens->pushSavePoint(); + $type = $this->parseCallable($tokens, $identifier, $hasTemplate); + $tokens->dropSavePoint(); + } catch (ParserException $e) { + $tokens->rollback(); + $type = $identifier; + } + return $type; + } + /** @phpstan-impure */ + private function tryParseArrayOrOffsetAccess(TokenIterator $tokens, Ast\Type\TypeNode $type): Ast\Type\TypeNode + { + $startLine = $type->getAttribute(Ast\Attribute::START_LINE); + $startIndex = $type->getAttribute(Ast\Attribute::START_INDEX); + try { + while ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { + $tokens->pushSavePoint(); + $canBeOffsetAccessType = !$tokens->isPrecededByHorizontalWhitespace(); + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET); + if ($canBeOffsetAccessType && !$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_SQUARE_BRACKET)) { + $offset = $this->parse($tokens); + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_SQUARE_BRACKET); + $tokens->dropSavePoint(); + $type = new Ast\Type\OffsetAccessTypeNode($type, $offset); + if ($startLine !== null && $startIndex !== null) { + $type = $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); + } + } else { + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_SQUARE_BRACKET); + $tokens->dropSavePoint(); + $type = new Ast\Type\ArrayTypeNode($type); + if ($startLine !== null && $startIndex !== null) { + $type = $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); + } + } + } + } catch (ParserException $e) { + $tokens->rollback(); + } + return $type; } -} -if (!function_exists('PHPUnit\\Framework\\assertNotEqualsWithDelta')) { /** - * Asserts that two variables are not equal (with delta). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotEqualsWithDelta + * @phpstan-impure + * @param Ast\Type\ArrayShapeNode::KIND_* $kind */ - function assertNotEqualsWithDelta($expected, $actual, float $delta, string $message = '') : void + private function parseArrayShape(TokenIterator $tokens, Ast\Type\TypeNode $type, string $kind): Ast\Type\ArrayShapeNode { - \PHPUnit\Framework\Assert::assertNotEqualsWithDelta(...func_get_args()); + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_CURLY_BRACKET); + $items = []; + $sealed = \true; + do { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET)) { + return new Ast\Type\ArrayShapeNode($items, \true, $kind); + } + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC)) { + $sealed = \false; + $tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA); + break; + } + $items[] = $this->parseArrayShapeItem($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + } while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET); + return new Ast\Type\ArrayShapeNode($items, $sealed, $kind); + } + /** @phpstan-impure */ + private function parseArrayShapeItem(TokenIterator $tokens): Ast\Type\ArrayShapeItemNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + try { + $tokens->pushSavePoint(); + $key = $this->parseArrayShapeKey($tokens); + $optional = $tokens->tryConsumeTokenType(Lexer::TOKEN_NULLABLE); + $tokens->consumeTokenType(Lexer::TOKEN_COLON); + $value = $this->parse($tokens); + $tokens->dropSavePoint(); + return $this->enrichWithAttributes($tokens, new Ast\Type\ArrayShapeItemNode($key, $optional, $value), $startLine, $startIndex); + } catch (ParserException $e) { + $tokens->rollback(); + $value = $this->parse($tokens); + return $this->enrichWithAttributes($tokens, new Ast\Type\ArrayShapeItemNode(null, \false, $value), $startLine, $startIndex); + } } -} -if (!function_exists('PHPUnit\\Framework\\assertObjectEquals')) { /** - * @throws ExpectationFailedException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertObjectEquals + * @phpstan-impure + * @return Ast\ConstExpr\ConstExprIntegerNode|Ast\ConstExpr\ConstExprStringNode|Ast\Type\IdentifierTypeNode */ - function assertObjectEquals(object $expected, object $actual, string $method = 'equals', string $message = '') : void + private function parseArrayShapeKey(TokenIterator $tokens) { - \PHPUnit\Framework\Assert::assertObjectEquals(...func_get_args()); + $startIndex = $tokens->currentTokenIndex(); + $startLine = $tokens->currentTokenLine(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_INTEGER)) { + $key = new Ast\ConstExpr\ConstExprIntegerNode(str_replace('_', '', $tokens->currentTokenValue())); + $tokens->next(); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING)) { + if ($this->quoteAwareConstExprString) { + $key = new Ast\ConstExpr\QuoteAwareConstExprStringNode(StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\QuoteAwareConstExprStringNode::SINGLE_QUOTED); + } else { + $key = new Ast\ConstExpr\ConstExprStringNode(trim($tokens->currentTokenValue(), "'")); + } + $tokens->next(); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_QUOTED_STRING)) { + if ($this->quoteAwareConstExprString) { + $key = new Ast\ConstExpr\QuoteAwareConstExprStringNode(StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\QuoteAwareConstExprStringNode::DOUBLE_QUOTED); + } else { + $key = new Ast\ConstExpr\ConstExprStringNode(trim($tokens->currentTokenValue(), '"')); + } + $tokens->next(); + } else { + $key = new Ast\Type\IdentifierTypeNode($tokens->currentTokenValue()); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + } + return $this->enrichWithAttributes($tokens, $key, $startLine, $startIndex); } -} -if (!function_exists('PHPUnit\\Framework\\assertEmpty')) { /** - * Asserts that a variable is empty. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert empty $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertEmpty + * @phpstan-impure */ - function assertEmpty($actual, string $message = '') : void + private function parseObjectShape(TokenIterator $tokens): Ast\Type\ObjectShapeNode { - \PHPUnit\Framework\Assert::assertEmpty(...func_get_args()); + $tokens->consumeTokenType(Lexer::TOKEN_OPEN_CURLY_BRACKET); + $items = []; + do { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET)) { + return new Ast\Type\ObjectShapeNode($items); + } + $items[] = $this->parseObjectShapeItem($tokens); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + } while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)); + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); + $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET); + return new Ast\Type\ObjectShapeNode($items); + } + /** @phpstan-impure */ + private function parseObjectShapeItem(TokenIterator $tokens): Ast\Type\ObjectShapeItemNode + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + $key = $this->parseObjectShapeKey($tokens); + $optional = $tokens->tryConsumeTokenType(Lexer::TOKEN_NULLABLE); + $tokens->consumeTokenType(Lexer::TOKEN_COLON); + $value = $this->parse($tokens); + return $this->enrichWithAttributes($tokens, new Ast\Type\ObjectShapeItemNode($key, $optional, $value), $startLine, $startIndex); + } + /** + * @phpstan-impure + * @return Ast\ConstExpr\ConstExprStringNode|Ast\Type\IdentifierTypeNode + */ + private function parseObjectShapeKey(TokenIterator $tokens) + { + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + if ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING)) { + if ($this->quoteAwareConstExprString) { + $key = new Ast\ConstExpr\QuoteAwareConstExprStringNode(StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\QuoteAwareConstExprStringNode::SINGLE_QUOTED); + } else { + $key = new Ast\ConstExpr\ConstExprStringNode(trim($tokens->currentTokenValue(), "'")); + } + $tokens->next(); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_QUOTED_STRING)) { + if ($this->quoteAwareConstExprString) { + $key = new Ast\ConstExpr\QuoteAwareConstExprStringNode(StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\QuoteAwareConstExprStringNode::DOUBLE_QUOTED); + } else { + $key = new Ast\ConstExpr\ConstExprStringNode(trim($tokens->currentTokenValue(), '"')); + } + $tokens->next(); + } else { + $key = new Ast\Type\IdentifierTypeNode($tokens->currentTokenValue()); + $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); + } + return $this->enrichWithAttributes($tokens, $key, $startLine, $startIndex); } } -if (!function_exists('PHPUnit\\Framework\\assertNotEmpty')) { +type = $type; + $this->old = $old; + $this->new = $new; } } -if (!function_exists('PHPUnit\\Framework\\assertGreaterThan')) { +isEqual = $isEqual; } -} -if (!function_exists('PHPUnit\\Framework\\assertGreaterThanOrEqual')) { /** - * Asserts that a value is greater than or equal to another value. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Calculate diff (edit script) from $old to $new. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @param T[] $old Original array + * @param T[] $new New array * - * @see Assert::assertGreaterThanOrEqual + * @return DiffElem[] Diff (edit script) */ - function assertGreaterThanOrEqual($expected, $actual, string $message = '') : void + public function diff(array $old, array $new): array { - \PHPUnit\Framework\Assert::assertGreaterThanOrEqual(...func_get_args()); + [$trace, $x, $y] = $this->calculateTrace($old, $new); + return $this->extractDiff($trace, $x, $y, $old, $new); } -} -if (!function_exists('PHPUnit\\Framework\\assertLessThan')) { /** - * Asserts that a value is smaller than another value. + * Calculate diff, including "replace" operations. * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * If a sequence of remove operations is followed by the same number of add operations, these + * will be coalesced into replace operations. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @param T[] $old Original array + * @param T[] $new New array * - * @see Assert::assertLessThan + * @return DiffElem[] Diff (edit script), including replace operations */ - function assertLessThan($expected, $actual, string $message = '') : void + public function diffWithReplacements(array $old, array $new): array { - \PHPUnit\Framework\Assert::assertLessThan(...func_get_args()); + return $this->coalesceReplacements($this->diff($old, $new)); } -} -if (!function_exists('PHPUnit\\Framework\\assertLessThanOrEqual')) { /** - * Asserts that a value is smaller than or equal to another value. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertLessThanOrEqual - */ - function assertLessThanOrEqual($expected, $actual, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertLessThanOrEqual(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertFileEquals')) { - /** - * Asserts that the contents of one file is equal to the contents of another - * file. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileEquals - */ - function assertFileEquals(string $expected, string $actual, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertFileEquals(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertFileEqualsCanonicalizing')) { - /** - * Asserts that the contents of one file is equal to the contents of another - * file (canonicalizing). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileEqualsCanonicalizing - */ - function assertFileEqualsCanonicalizing(string $expected, string $actual, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertFileEqualsCanonicalizing(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertFileEqualsIgnoringCase')) { - /** - * Asserts that the contents of one file is equal to the contents of another - * file (ignoring case). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileEqualsIgnoringCase - */ - function assertFileEqualsIgnoringCase(string $expected, string $actual, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertFileEqualsIgnoringCase(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertFileNotEquals')) { - /** - * Asserts that the contents of one file is not equal to the contents of - * another file. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileNotEquals - */ - function assertFileNotEquals(string $expected, string $actual, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertFileNotEquals(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertFileNotEqualsCanonicalizing')) { - /** - * Asserts that the contents of one file is not equal to the contents of another - * file (canonicalizing). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileNotEqualsCanonicalizing - */ - function assertFileNotEqualsCanonicalizing(string $expected, string $actual, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertFileNotEqualsCanonicalizing(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertFileNotEqualsIgnoringCase')) { - /** - * Asserts that the contents of one file is not equal to the contents of another - * file (ignoring case). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileNotEqualsIgnoringCase - */ - function assertFileNotEqualsIgnoringCase(string $expected, string $actual, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertFileNotEqualsIgnoringCase(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertStringEqualsFile')) { - /** - * Asserts that the contents of a string is equal - * to the contents of a file. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringEqualsFile - */ - function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertStringEqualsFile(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertStringEqualsFileCanonicalizing')) { - /** - * Asserts that the contents of a string is equal - * to the contents of a file (canonicalizing). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringEqualsFileCanonicalizing - */ - function assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertStringEqualsFileCanonicalizing(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertStringEqualsFileIgnoringCase')) { - /** - * Asserts that the contents of a string is equal - * to the contents of a file (ignoring case). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringEqualsFileIgnoringCase + * @param T[] $old + * @param T[] $new + * @return array{array>, int, int} */ - function assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = '') : void + private function calculateTrace(array $old, array $new): array { - \PHPUnit\Framework\Assert::assertStringEqualsFileIgnoringCase(...func_get_args()); + $n = count($old); + $m = count($new); + $max = $n + $m; + $v = [1 => 0]; + $trace = []; + for ($d = 0; $d <= $max; $d++) { + $trace[] = $v; + for ($k = -$d; $k <= $d; $k += 2) { + if ($k === -$d || $k !== $d && $v[$k - 1] < $v[$k + 1]) { + $x = $v[$k + 1]; + } else { + $x = $v[$k - 1] + 1; + } + $y = $x - $k; + while ($x < $n && $y < $m && ($this->isEqual)($old[$x], $new[$y])) { + $x++; + $y++; + } + $v[$k] = $x; + if ($x >= $n && $y >= $m) { + return [$trace, $x, $y]; + } + } + } + throw new Exception('Should not happen'); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringNotEqualsFile')) { /** - * Asserts that the contents of a string is not equal - * to the contents of a file. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringNotEqualsFile + * @param array> $trace + * @param T[] $old + * @param T[] $new + * @return DiffElem[] */ - function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '') : void + private function extractDiff(array $trace, int $x, int $y, array $old, array $new): array { - \PHPUnit\Framework\Assert::assertStringNotEqualsFile(...func_get_args()); + $result = []; + for ($d = count($trace) - 1; $d >= 0; $d--) { + $v = $trace[$d]; + $k = $x - $y; + if ($k === -$d || $k !== $d && $v[$k - 1] < $v[$k + 1]) { + $prevK = $k + 1; + } else { + $prevK = $k - 1; + } + $prevX = $v[$prevK]; + $prevY = $prevX - $prevK; + while ($x > $prevX && $y > $prevY) { + $result[] = new DiffElem(DiffElem::TYPE_KEEP, $old[$x - 1], $new[$y - 1]); + $x--; + $y--; + } + if ($d === 0) { + break; + } + while ($x > $prevX) { + $result[] = new DiffElem(DiffElem::TYPE_REMOVE, $old[$x - 1], null); + $x--; + } + while ($y > $prevY) { + $result[] = new DiffElem(DiffElem::TYPE_ADD, null, $new[$y - 1]); + $y--; + } + } + return array_reverse($result); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringNotEqualsFileCanonicalizing')) { /** - * Asserts that the contents of a string is not equal - * to the contents of a file (canonicalizing). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * Coalesce equal-length sequences of remove+add into a replace operation. * - * @see Assert::assertStringNotEqualsFileCanonicalizing + * @param DiffElem[] $diff + * @return DiffElem[] */ - function assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = '') : void + private function coalesceReplacements(array $diff): array { - \PHPUnit\Framework\Assert::assertStringNotEqualsFileCanonicalizing(...func_get_args()); + $newDiff = []; + $c = count($diff); + for ($i = 0; $i < $c; $i++) { + $diffType = $diff[$i]->type; + if ($diffType !== DiffElem::TYPE_REMOVE) { + $newDiff[] = $diff[$i]; + continue; + } + $j = $i; + while ($j < $c && $diff[$j]->type === DiffElem::TYPE_REMOVE) { + $j++; + } + $k = $j; + while ($k < $c && $diff[$k]->type === DiffElem::TYPE_ADD) { + $k++; + } + if ($j - $i === $k - $j) { + $len = $j - $i; + for ($n = 0; $n < $len; $n++) { + $newDiff[] = new DiffElem(DiffElem::TYPE_REPLACE, $diff[$i + $n]->old, $diff[$j + $n]->new); + } + } else { + for (; $i < $k; $i++) { + $newDiff[] = $diff[$i]; + } + } + $i = $k - 1; + } + return $newDiff; } } -if (!function_exists('PHPUnit\\Framework\\assertStringNotEqualsFileIgnoringCase')) { + */ + private $differ; /** - * Asserts that the contents of a string is not equal - * to the contents of a file (ignoring case). - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Map From "{$class}->{$subNode}" to string that should be inserted + * between elements of this list subnode * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringNotEqualsFileIgnoringCase + * @var array */ - function assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = '') : void - { - \PHPUnit\Framework\Assert::assertStringNotEqualsFileIgnoringCase(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertIsReadable')) { + private $listInsertionMap = [PhpDocNode::class . '->children' => "\n * ", UnionTypeNode::class . '->types' => '|', IntersectionTypeNode::class . '->types' => '&', ArrayShapeNode::class . '->items' => ', ', ObjectShapeNode::class . '->items' => ', ', CallableTypeNode::class . '->parameters' => ', ', CallableTypeNode::class . '->templateTypes' => ', ', GenericTypeNode::class . '->genericTypes' => ', ', ConstExprArrayNode::class . '->items' => ', ', MethodTagValueNode::class . '->parameters' => ', ', DoctrineArray::class . '->items' => ', ', DoctrineAnnotation::class . '->arguments' => ', ']; /** - * Asserts that a file/dir is readable. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * [$find, $extraLeft, $extraRight] * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsReadable + * @var array */ - function assertIsReadable(string $filename, string $message = '') : void + private $emptyListInsertionMap = [CallableTypeNode::class . '->parameters' => ['(', '', ''], ArrayShapeNode::class . '->items' => ['{', '', ''], ObjectShapeNode::class . '->items' => ['{', '', ''], DoctrineArray::class . '->items' => ['{', '', ''], DoctrineAnnotation::class . '->arguments' => ['(', '', '']]; + /** @var array>> */ + private $parenthesesMap = [CallableTypeNode::class . '->returnType' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class], ArrayTypeNode::class . '->type' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class, ConstTypeNode::class, NullableTypeNode::class], OffsetAccessTypeNode::class . '->type' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class, NullableTypeNode::class]]; + /** @var array>> */ + private $parenthesesListMap = [IntersectionTypeNode::class . '->types' => [IntersectionTypeNode::class, UnionTypeNode::class, NullableTypeNode::class], UnionTypeNode::class . '->types' => [IntersectionTypeNode::class, UnionTypeNode::class, NullableTypeNode::class]]; + public function printFormatPreserving(PhpDocNode $node, PhpDocNode $originalNode, TokenIterator $originalTokens): string { - \PHPUnit\Framework\Assert::assertIsReadable(...func_get_args()); + $this->differ = new Differ(static function ($a, $b) { + if ($a instanceof Node && $b instanceof Node) { + return $a === $b->getAttribute(Attribute::ORIGINAL_NODE); + } + return \false; + }); + $tokenIndex = 0; + $result = $this->printArrayFormatPreserving($node->children, $originalNode->children, $originalTokens, $tokenIndex, PhpDocNode::class, 'children'); + if ($result !== null) { + return $result . $originalTokens->getContentBetween($tokenIndex, $originalTokens->getTokenCount()); + } + return $this->print($node); + } + public function print(Node $node): string + { + if ($node instanceof PhpDocNode) { + return "/**\n *" . implode("\n *", array_map(function (PhpDocChildNode $child): string { + $s = $this->print($child); + return ($s === '') ? '' : (' ' . $s); + }, $node->children)) . "\n */"; + } + if ($node instanceof PhpDocTextNode) { + return $node->text; + } + if ($node instanceof PhpDocTagNode) { + if ($node->value instanceof DoctrineTagValueNode) { + return $this->print($node->value); + } + return trim(sprintf('%s %s', $node->name, $this->print($node->value))); + } + if ($node instanceof PhpDocTagValueNode) { + return $this->printTagValue($node); + } + if ($node instanceof TypeNode) { + return $this->printType($node); + } + if ($node instanceof ConstExprNode) { + return $this->printConstExpr($node); + } + if ($node instanceof MethodTagValueParameterNode) { + $type = ($node->type !== null) ? $this->print($node->type) . ' ' : ''; + $isReference = $node->isReference ? '&' : ''; + $isVariadic = $node->isVariadic ? '...' : ''; + $default = ($node->defaultValue !== null) ? ' = ' . $this->print($node->defaultValue) : ''; + return "{$type}{$isReference}{$isVariadic}{$node->parameterName}{$default}"; + } + if ($node instanceof CallableTypeParameterNode) { + $type = $this->print($node->type) . ' '; + $isReference = $node->isReference ? '&' : ''; + $isVariadic = $node->isVariadic ? '...' : ''; + $isOptional = $node->isOptional ? '=' : ''; + return trim("{$type}{$isReference}{$isVariadic}{$node->parameterName}") . $isOptional; + } + if ($node instanceof DoctrineAnnotation) { + return (string) $node; + } + if ($node instanceof DoctrineArgument) { + return (string) $node; + } + if ($node instanceof DoctrineArray) { + return (string) $node; + } + if ($node instanceof DoctrineArrayItem) { + return (string) $node; + } + throw new LogicException(sprintf('Unknown node type %s', get_class($node))); + } + private function printTagValue(PhpDocTagValueNode $node): string + { + // only nodes that contain another node are handled here + // the rest falls back on (string) $node + if ($node instanceof AssertTagMethodValueNode) { + $isNegated = $node->isNegated ? '!' : ''; + $isEquality = $node->isEquality ? '=' : ''; + $type = $this->printType($node->type); + return trim("{$isNegated}{$isEquality}{$type} {$node->parameter}->{$node->method}() {$node->description}"); + } + if ($node instanceof AssertTagPropertyValueNode) { + $isNegated = $node->isNegated ? '!' : ''; + $isEquality = $node->isEquality ? '=' : ''; + $type = $this->printType($node->type); + return trim("{$isNegated}{$isEquality}{$type} {$node->parameter}->{$node->property} {$node->description}"); + } + if ($node instanceof AssertTagValueNode) { + $isNegated = $node->isNegated ? '!' : ''; + $isEquality = $node->isEquality ? '=' : ''; + $type = $this->printType($node->type); + return trim("{$isNegated}{$isEquality}{$type} {$node->parameter} {$node->description}"); + } + if ($node instanceof ExtendsTagValueNode || $node instanceof ImplementsTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->description}"); + } + if ($node instanceof MethodTagValueNode) { + $static = $node->isStatic ? 'static ' : ''; + $returnType = ($node->returnType !== null) ? $this->printType($node->returnType) . ' ' : ''; + $parameters = implode(', ', array_map(function (MethodTagValueParameterNode $parameter): string { + return $this->print($parameter); + }, $node->parameters)); + $description = ($node->description !== '') ? " {$node->description}" : ''; + $templateTypes = (count($node->templateTypes) > 0) ? '<' . implode(', ', array_map(function (TemplateTagValueNode $templateTag): string { + return $this->print($templateTag); + }, $node->templateTypes)) . '>' : ''; + return "{$static}{$returnType}{$node->methodName}{$templateTypes}({$parameters}){$description}"; + } + if ($node instanceof MixinTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->description}"); + } + if ($node instanceof RequireExtendsTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->description}"); + } + if ($node instanceof RequireImplementsTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->description}"); + } + if ($node instanceof ParamOutTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->parameterName} {$node->description}"); + } + if ($node instanceof ParamTagValueNode) { + $reference = $node->isReference ? '&' : ''; + $variadic = $node->isVariadic ? '...' : ''; + $type = $this->printType($node->type); + return trim("{$type} {$reference}{$variadic}{$node->parameterName} {$node->description}"); + } + if ($node instanceof ParamImmediatelyInvokedCallableTagValueNode) { + return trim("{$node->parameterName} {$node->description}"); + } + if ($node instanceof ParamLaterInvokedCallableTagValueNode) { + return trim("{$node->parameterName} {$node->description}"); + } + if ($node instanceof ParamClosureThisTagValueNode) { + return trim("{$node->type} {$node->parameterName} {$node->description}"); + } + if ($node instanceof PropertyTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->propertyName} {$node->description}"); + } + if ($node instanceof ReturnTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->description}"); + } + if ($node instanceof SelfOutTagValueNode) { + $type = $this->printType($node->type); + return trim($type . ' ' . $node->description); + } + if ($node instanceof TemplateTagValueNode) { + $bound = ($node->bound !== null) ? ' of ' . $this->printType($node->bound) : ''; + $default = ($node->default !== null) ? ' = ' . $this->printType($node->default) : ''; + return trim("{$node->name}{$bound}{$default} {$node->description}"); + } + if ($node instanceof ThrowsTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->description}"); + } + if ($node instanceof TypeAliasImportTagValueNode) { + return trim("{$node->importedAlias} from " . $this->printType($node->importedFrom) . (($node->importedAs !== null) ? " as {$node->importedAs}" : '')); + } + if ($node instanceof TypeAliasTagValueNode) { + $type = $this->printType($node->type); + return trim("{$node->alias} {$type}"); + } + if ($node instanceof UsesTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} {$node->description}"); + } + if ($node instanceof VarTagValueNode) { + $type = $this->printType($node->type); + return trim("{$type} " . trim("{$node->variableName} {$node->description}")); + } + return (string) $node; + } + private function printType(TypeNode $node): string + { + if ($node instanceof ArrayShapeNode) { + $items = array_map(function (ArrayShapeItemNode $item): string { + return $this->printType($item); + }, $node->items); + if (!$node->sealed) { + $items[] = '...'; + } + return $node->kind . '{' . implode(', ', $items) . '}'; + } + if ($node instanceof ArrayShapeItemNode) { + if ($node->keyName !== null) { + return sprintf('%s%s: %s', $this->print($node->keyName), $node->optional ? '?' : '', $this->printType($node->valueType)); + } + return $this->printType($node->valueType); + } + if ($node instanceof ArrayTypeNode) { + return $this->printOffsetAccessType($node->type) . '[]'; + } + if ($node instanceof CallableTypeNode) { + if ($node->returnType instanceof CallableTypeNode || $node->returnType instanceof UnionTypeNode || $node->returnType instanceof IntersectionTypeNode) { + $returnType = $this->wrapInParentheses($node->returnType); + } else { + $returnType = $this->printType($node->returnType); + } + $template = ($node->templateTypes !== []) ? '<' . implode(', ', array_map(function (TemplateTagValueNode $templateNode): string { + return $this->print($templateNode); + }, $node->templateTypes)) . '>' : ''; + $parameters = implode(', ', array_map(function (CallableTypeParameterNode $parameterNode): string { + return $this->print($parameterNode); + }, $node->parameters)); + return "{$node->identifier}{$template}({$parameters}): {$returnType}"; + } + if ($node instanceof ConditionalTypeForParameterNode) { + return sprintf('(%s %s %s ? %s : %s)', $node->parameterName, $node->negated ? 'is not' : 'is', $this->printType($node->targetType), $this->printType($node->if), $this->printType($node->else)); + } + if ($node instanceof ConditionalTypeNode) { + return sprintf('(%s %s %s ? %s : %s)', $this->printType($node->subjectType), $node->negated ? 'is not' : 'is', $this->printType($node->targetType), $this->printType($node->if), $this->printType($node->else)); + } + if ($node instanceof ConstTypeNode) { + return $this->printConstExpr($node->constExpr); + } + if ($node instanceof GenericTypeNode) { + $genericTypes = []; + foreach ($node->genericTypes as $index => $type) { + $variance = $node->variances[$index] ?? GenericTypeNode::VARIANCE_INVARIANT; + if ($variance === GenericTypeNode::VARIANCE_INVARIANT) { + $genericTypes[] = $this->printType($type); + } elseif ($variance === GenericTypeNode::VARIANCE_BIVARIANT) { + $genericTypes[] = '*'; + } else { + $genericTypes[] = sprintf('%s %s', $variance, $this->print($type)); + } + } + return $node->type . '<' . implode(', ', $genericTypes) . '>'; + } + if ($node instanceof IdentifierTypeNode) { + return $node->name; + } + if ($node instanceof IntersectionTypeNode || $node instanceof UnionTypeNode) { + $items = []; + foreach ($node->types as $type) { + if ($type instanceof IntersectionTypeNode || $type instanceof UnionTypeNode || $type instanceof NullableTypeNode) { + $items[] = $this->wrapInParentheses($type); + continue; + } + $items[] = $this->printType($type); + } + return implode(($node instanceof IntersectionTypeNode) ? '&' : '|', $items); + } + if ($node instanceof InvalidTypeNode) { + return (string) $node; + } + if ($node instanceof NullableTypeNode) { + if ($node->type instanceof IntersectionTypeNode || $node->type instanceof UnionTypeNode) { + return '?(' . $this->printType($node->type) . ')'; + } + return '?' . $this->printType($node->type); + } + if ($node instanceof ObjectShapeNode) { + $items = array_map(function (ObjectShapeItemNode $item): string { + return $this->printType($item); + }, $node->items); + return 'object{' . implode(', ', $items) . '}'; + } + if ($node instanceof ObjectShapeItemNode) { + if ($node->keyName !== null) { + return sprintf('%s%s: %s', $this->print($node->keyName), $node->optional ? '?' : '', $this->printType($node->valueType)); + } + return $this->printType($node->valueType); + } + if ($node instanceof OffsetAccessTypeNode) { + return $this->printOffsetAccessType($node->type) . '[' . $this->printType($node->offset) . ']'; + } + if ($node instanceof ThisTypeNode) { + return (string) $node; + } + throw new LogicException(sprintf('Unknown node type %s', get_class($node))); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotReadable')) { - /** - * Asserts that a file/dir exists and is not readable. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotReadable - */ - function assertIsNotReadable(string $filename, string $message = '') : void + private function wrapInParentheses(TypeNode $node): string { - \PHPUnit\Framework\Assert::assertIsNotReadable(...func_get_args()); + return '(' . $this->printType($node) . ')'; } -} -if (!function_exists('PHPUnit\\Framework\\assertNotIsReadable')) { - /** - * Asserts that a file/dir exists and is not readable. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4062 - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotIsReadable - */ - function assertNotIsReadable(string $filename, string $message = '') : void + private function printOffsetAccessType(TypeNode $type): string { - \PHPUnit\Framework\Assert::assertNotIsReadable(...func_get_args()); + if ($type instanceof CallableTypeNode || $type instanceof UnionTypeNode || $type instanceof IntersectionTypeNode || $type instanceof NullableTypeNode) { + return $this->wrapInParentheses($type); + } + return $this->printType($type); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsWritable')) { - /** - * Asserts that a file/dir exists and is writable. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsWritable - */ - function assertIsWritable(string $filename, string $message = '') : void + private function printConstExpr(ConstExprNode $node): string { - \PHPUnit\Framework\Assert::assertIsWritable(...func_get_args()); + // this is fine - ConstExprNode classes do not contain nodes that need smart printer logic + return (string) $node; } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotWritable')) { /** - * Asserts that a file/dir exists and is not writable. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotWritable + * @param Node[] $nodes + * @param Node[] $originalNodes */ - function assertIsNotWritable(string $filename, string $message = '') : void + private function printArrayFormatPreserving(array $nodes, array $originalNodes, TokenIterator $originalTokens, int &$tokenIndex, string $parentNodeClass, string $subNodeName): ?string { - \PHPUnit\Framework\Assert::assertIsNotWritable(...func_get_args()); + $diff = $this->differ->diffWithReplacements($originalNodes, $nodes); + $mapKey = $parentNodeClass . '->' . $subNodeName; + $insertStr = $this->listInsertionMap[$mapKey] ?? null; + $result = ''; + $beforeFirstKeepOrReplace = \true; + $delayedAdd = []; + $insertNewline = \false; + [$isMultiline, $beforeAsteriskIndent, $afterAsteriskIndent] = $this->isMultiline($tokenIndex, $originalNodes, $originalTokens); + if ($insertStr === "\n * ") { + $insertStr = sprintf('%s%s*%s', $originalTokens->getDetectedNewline() ?? "\n", $beforeAsteriskIndent, $afterAsteriskIndent); + } + foreach ($diff as $i => $diffElem) { + $diffType = $diffElem->type; + $newNode = $diffElem->new; + $originalNode = $diffElem->old; + if ($diffType === DiffElem::TYPE_KEEP || $diffType === DiffElem::TYPE_REPLACE) { + $beforeFirstKeepOrReplace = \false; + if (!$newNode instanceof Node || !$originalNode instanceof Node) { + return null; + } + $itemStartPos = $originalNode->getAttribute(Attribute::START_INDEX); + $itemEndPos = $originalNode->getAttribute(Attribute::END_INDEX); + if ($itemStartPos < 0 || $itemEndPos < 0 || $itemStartPos < $tokenIndex) { + throw new LogicException(); + } + $result .= $originalTokens->getContentBetween($tokenIndex, $itemStartPos); + if (count($delayedAdd) > 0) { + foreach ($delayedAdd as $delayedAddNode) { + $parenthesesNeeded = isset($this->parenthesesListMap[$mapKey]) && in_array(get_class($delayedAddNode), $this->parenthesesListMap[$mapKey], \true); + if ($parenthesesNeeded) { + $result .= '('; + } + $result .= $this->printNodeFormatPreserving($delayedAddNode, $originalTokens); + if ($parenthesesNeeded) { + $result .= ')'; + } + if ($insertNewline) { + $result .= $insertStr . sprintf('%s%s*%s', $originalTokens->getDetectedNewline() ?? "\n", $beforeAsteriskIndent, $afterAsteriskIndent); + } else { + $result .= $insertStr; + } + } + $delayedAdd = []; + } + $parenthesesNeeded = isset($this->parenthesesListMap[$mapKey]) && in_array(get_class($newNode), $this->parenthesesListMap[$mapKey], \true) && !in_array(get_class($originalNode), $this->parenthesesListMap[$mapKey], \true); + $addParentheses = $parenthesesNeeded && !$originalTokens->hasParentheses($itemStartPos, $itemEndPos); + if ($addParentheses) { + $result .= '('; + } + $result .= $this->printNodeFormatPreserving($newNode, $originalTokens); + if ($addParentheses) { + $result .= ')'; + } + $tokenIndex = $itemEndPos + 1; + } elseif ($diffType === DiffElem::TYPE_ADD) { + if ($insertStr === null) { + return null; + } + if (!$newNode instanceof Node) { + return null; + } + if ($insertStr === ', ' && $isMultiline) { + $insertStr = ','; + $insertNewline = \true; + } + if ($beforeFirstKeepOrReplace) { + // Will be inserted at the next "replace" or "keep" element + $delayedAdd[] = $newNode; + continue; + } + $itemEndPos = $tokenIndex - 1; + if ($insertNewline) { + $result .= $insertStr . sprintf('%s%s*%s', $originalTokens->getDetectedNewline() ?? "\n", $beforeAsteriskIndent, $afterAsteriskIndent); + } else { + $result .= $insertStr; + } + $parenthesesNeeded = isset($this->parenthesesListMap[$mapKey]) && in_array(get_class($newNode), $this->parenthesesListMap[$mapKey], \true); + if ($parenthesesNeeded) { + $result .= '('; + } + $result .= $this->printNodeFormatPreserving($newNode, $originalTokens); + if ($parenthesesNeeded) { + $result .= ')'; + } + $tokenIndex = $itemEndPos + 1; + } elseif ($diffType === DiffElem::TYPE_REMOVE) { + if (!$originalNode instanceof Node) { + return null; + } + $itemStartPos = $originalNode->getAttribute(Attribute::START_INDEX); + $itemEndPos = $originalNode->getAttribute(Attribute::END_INDEX); + if ($itemStartPos < 0 || $itemEndPos < 0) { + throw new LogicException(); + } + if ($i === 0) { + // If we're removing from the start, keep the tokens before the node and drop those after it, + // instead of the other way around. + $originalTokensArray = $originalTokens->getTokens(); + for ($j = $tokenIndex; $j < $itemStartPos; $j++) { + if ($originalTokensArray[$j][Lexer::TYPE_OFFSET] === Lexer::TOKEN_PHPDOC_EOL) { + break; + } + $result .= $originalTokensArray[$j][Lexer::VALUE_OFFSET]; + } + } + $tokenIndex = $itemEndPos + 1; + } + } + if (count($delayedAdd) > 0) { + if (!isset($this->emptyListInsertionMap[$mapKey])) { + return null; + } + [$findToken, $extraLeft, $extraRight] = $this->emptyListInsertionMap[$mapKey]; + if ($findToken !== null) { + $originalTokensArray = $originalTokens->getTokens(); + for (; $tokenIndex < count($originalTokensArray); $tokenIndex++) { + $result .= $originalTokensArray[$tokenIndex][Lexer::VALUE_OFFSET]; + if ($originalTokensArray[$tokenIndex][Lexer::VALUE_OFFSET] !== $findToken) { + continue; + } + $tokenIndex++; + break; + } + } + $first = \true; + $result .= $extraLeft; + foreach ($delayedAdd as $delayedAddNode) { + if (!$first) { + $result .= $insertStr; + if ($insertNewline) { + $result .= sprintf('%s%s*%s', $originalTokens->getDetectedNewline() ?? "\n", $beforeAsteriskIndent, $afterAsteriskIndent); + } + } + $result .= $this->printNodeFormatPreserving($delayedAddNode, $originalTokens); + $first = \false; + } + $result .= $extraRight; + } + return $result; } -} -if (!function_exists('PHPUnit\\Framework\\assertNotIsWritable')) { /** - * Asserts that a file/dir exists and is not writable. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4065 - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotIsWritable + * @param Node[] $nodes + * @return array{bool, string, string} */ - function assertNotIsWritable(string $filename, string $message = '') : void + private function isMultiline(int $initialIndex, array $nodes, TokenIterator $originalTokens): array { - \PHPUnit\Framework\Assert::assertNotIsWritable(...func_get_args()); + $isMultiline = count($nodes) > 1; + $pos = $initialIndex; + $allText = ''; + /** @var Node|null $node */ + foreach ($nodes as $node) { + if (!$node instanceof Node) { + continue; + } + $endPos = $node->getAttribute(Attribute::END_INDEX) + 1; + $text = $originalTokens->getContentBetween($pos, $endPos); + $allText .= $text; + if (strpos($text, "\n") === \false) { + // We require that a newline is present between *every* item. If the formatting + // is inconsistent, with only some items having newlines, we don't consider it + // as multiline + $isMultiline = \false; + } + $pos = $endPos; + } + $c = preg_match_all('~\n(?[\x09\x20]*)\*(?\x20*)~', $allText, $matches, PREG_SET_ORDER); + if ($c === 0) { + return [$isMultiline, '', '']; + } + $before = ''; + $after = ''; + foreach ($matches as $match) { + if (strlen($match['before']) > strlen($before)) { + $before = $match['before']; + } + if (strlen($match['after']) <= strlen($after)) { + continue; + } + $after = $match['after']; + } + return [$isMultiline, $before, $after]; } -} -if (!function_exists('PHPUnit\\Framework\\assertDirectoryExists')) { - /** - * Asserts that a directory exists. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertDirectoryExists - */ - function assertDirectoryExists(string $directory, string $message = '') : void + private function printNodeFormatPreserving(Node $node, TokenIterator $originalTokens): string { - \PHPUnit\Framework\Assert::assertDirectoryExists(...func_get_args()); + /** @var Node|null $originalNode */ + $originalNode = $node->getAttribute(Attribute::ORIGINAL_NODE); + if ($originalNode === null) { + return $this->print($node); + } + $class = get_class($node); + if ($class !== get_class($originalNode)) { + throw new LogicException(); + } + $startPos = $originalNode->getAttribute(Attribute::START_INDEX); + $endPos = $originalNode->getAttribute(Attribute::END_INDEX); + if ($startPos < 0 || $endPos < 0) { + throw new LogicException(); + } + $result = ''; + $pos = $startPos; + $subNodeNames = array_keys(get_object_vars($node)); + foreach ($subNodeNames as $subNodeName) { + $subNode = $node->{$subNodeName}; + $origSubNode = $originalNode->{$subNodeName}; + if (!$subNode instanceof Node && $subNode !== null || !$origSubNode instanceof Node && $origSubNode !== null) { + if ($subNode === $origSubNode) { + // Unchanged, can reuse old code + continue; + } + if (is_array($subNode) && is_array($origSubNode)) { + // Array subnode changed, we might be able to reconstruct it + $listResult = $this->printArrayFormatPreserving($subNode, $origSubNode, $originalTokens, $pos, $class, $subNodeName); + if ($listResult === null) { + return $this->print($node); + } + $result .= $listResult; + continue; + } + return $this->print($node); + } + if ($origSubNode === null) { + if ($subNode === null) { + // Both null, nothing to do + continue; + } + return $this->print($node); + } + $subStartPos = $origSubNode->getAttribute(Attribute::START_INDEX); + $subEndPos = $origSubNode->getAttribute(Attribute::END_INDEX); + if ($subStartPos < 0 || $subEndPos < 0) { + throw new LogicException(); + } + if ($subEndPos < $subStartPos) { + return $this->print($node); + } + if ($subNode === null) { + return $this->print($node); + } + $result .= $originalTokens->getContentBetween($pos, $subStartPos); + $mapKey = get_class($node) . '->' . $subNodeName; + $parenthesesNeeded = isset($this->parenthesesMap[$mapKey]) && in_array(get_class($subNode), $this->parenthesesMap[$mapKey], \true); + if ($subNode->getAttribute(Attribute::ORIGINAL_NODE) !== null) { + $parenthesesNeeded = $parenthesesNeeded && !in_array(get_class($subNode->getAttribute(Attribute::ORIGINAL_NODE)), $this->parenthesesMap[$mapKey], \true); + } + $addParentheses = $parenthesesNeeded && !$originalTokens->hasParentheses($subStartPos, $subEndPos); + if ($addParentheses) { + $result .= '('; + } + $result .= $this->printNodeFormatPreserving($subNode, $originalTokens); + if ($addParentheses) { + $result .= ')'; + } + $pos = $subEndPos + 1; + } + return $result . $originalTokens->getContentBetween($pos, $endPos + 1); } } -if (!function_exists('PHPUnit\\Framework\\assertDirectoryDoesNotExist')) { + + + + + This Schema file defines the rules by which the XML configuration file of PHPUnit 9.6 may be structured. + + + + + + Root Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The main type specifying the document structure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit; + +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +interface Exception extends Throwable +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use const DEBUG_BACKTRACE_IGNORE_ARGS; +use const PHP_EOL; +use function array_shift; +use function array_unshift; +use function assert; +use function class_exists; +use function count; +use function debug_backtrace; +use function explode; +use function file_get_contents; +use function func_get_args; +use function implode; +use function interface_exists; +use function is_array; +use function is_bool; +use function is_int; +use function is_iterable; +use function is_object; +use function is_string; +use function preg_match; +use function preg_split; +use function sprintf; +use function strpos; +use ArrayAccess; +use Countable; +use DOMAttr; +use DOMDocument; +use DOMElement; +use Generator; +use PHPUnit\Framework\Constraint\ArrayHasKey; +use PHPUnit\Framework\Constraint\Callback; +use PHPUnit\Framework\Constraint\ClassHasAttribute; +use PHPUnit\Framework\Constraint\ClassHasStaticAttribute; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\Count; +use PHPUnit\Framework\Constraint\DirectoryExists; +use PHPUnit\Framework\Constraint\FileExists; +use PHPUnit\Framework\Constraint\GreaterThan; +use PHPUnit\Framework\Constraint\IsAnything; +use PHPUnit\Framework\Constraint\IsEmpty; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\Constraint\IsEqualCanonicalizing; +use PHPUnit\Framework\Constraint\IsEqualIgnoringCase; +use PHPUnit\Framework\Constraint\IsEqualWithDelta; +use PHPUnit\Framework\Constraint\IsFalse; +use PHPUnit\Framework\Constraint\IsFinite; +use PHPUnit\Framework\Constraint\IsIdentical; +use PHPUnit\Framework\Constraint\IsInfinite; +use PHPUnit\Framework\Constraint\IsInstanceOf; +use PHPUnit\Framework\Constraint\IsJson; +use PHPUnit\Framework\Constraint\IsNan; +use PHPUnit\Framework\Constraint\IsNull; +use PHPUnit\Framework\Constraint\IsReadable; +use PHPUnit\Framework\Constraint\IsTrue; +use PHPUnit\Framework\Constraint\IsType; +use PHPUnit\Framework\Constraint\IsWritable; +use PHPUnit\Framework\Constraint\JsonMatches; +use PHPUnit\Framework\Constraint\LessThan; +use PHPUnit\Framework\Constraint\LogicalAnd; +use PHPUnit\Framework\Constraint\LogicalNot; +use PHPUnit\Framework\Constraint\LogicalOr; +use PHPUnit\Framework\Constraint\LogicalXor; +use PHPUnit\Framework\Constraint\ObjectEquals; +use PHPUnit\Framework\Constraint\ObjectHasAttribute; +use PHPUnit\Framework\Constraint\ObjectHasProperty; +use PHPUnit\Framework\Constraint\RegularExpression; +use PHPUnit\Framework\Constraint\SameSize; +use PHPUnit\Framework\Constraint\StringContains; +use PHPUnit\Framework\Constraint\StringEndsWith; +use PHPUnit\Framework\Constraint\StringMatchesFormatDescription; +use PHPUnit\Framework\Constraint\StringStartsWith; +use PHPUnit\Framework\Constraint\TraversableContainsEqual; +use PHPUnit\Framework\Constraint\TraversableContainsIdentical; +use PHPUnit\Framework\Constraint\TraversableContainsOnly; +use PHPUnit\Util\Type; +use PHPUnit\Util\Xml; +use PHPUnit\Util\Xml\Loader as XmlLoader; +/** + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +abstract class Assert +{ /** - * Asserts that a directory does not exist. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @var int + */ + private static $count = 0; + /** + * Asserts that an array has a specified key. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @param int|string $key + * @param array|ArrayAccess $array * - * @see Assert::assertDirectoryDoesNotExist + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException */ - function assertDirectoryDoesNotExist(string $directory, string $message = '') : void + public static function assertArrayHasKey($key, $array, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDirectoryDoesNotExist(...func_get_args()); + if (!(is_int($key) || is_string($key))) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'integer or string'); + } + if (!(is_array($array) || $array instanceof ArrayAccess)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'array or ArrayAccess'); + } + $constraint = new ArrayHasKey($key); + static::assertThat($array, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertDirectoryNotExists')) { /** - * Asserts that a directory does not exist. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4068 + * Asserts that an array does not have a specified key. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @param int|string $key + * @param array|ArrayAccess $array * - * @see Assert::assertDirectoryNotExists + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException */ - function assertDirectoryNotExists(string $directory, string $message = '') : void + public static function assertArrayNotHasKey($key, $array, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDirectoryNotExists(...func_get_args()); + if (!(is_int($key) || is_string($key))) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'integer or string'); + } + if (!(is_array($array) || $array instanceof ArrayAccess)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'array or ArrayAccess'); + } + $constraint = new LogicalNot(new ArrayHasKey($key)); + static::assertThat($array, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertDirectoryIsReadable')) { /** - * Asserts that a directory exists and is readable. + * Asserts that a haystack contains a needle. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertDirectoryIsReadable + * @throws Exception + * @throws ExpectationFailedException */ - function assertDirectoryIsReadable(string $directory, string $message = '') : void + public static function assertContains($needle, iterable $haystack, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDirectoryIsReadable(...func_get_args()); + $constraint = new TraversableContainsIdentical($needle); + static::assertThat($haystack, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertDirectoryIsNotReadable')) { - /** - * Asserts that a directory exists and is not readable. + public static function assertContainsEquals($needle, iterable $haystack, string $message = ''): void + { + $constraint = new TraversableContainsEqual($needle); + static::assertThat($haystack, $constraint, $message); + } + /** + * Asserts that a haystack does not contain a needle. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertDirectoryIsNotReadable + * @throws Exception + * @throws ExpectationFailedException */ - function assertDirectoryIsNotReadable(string $directory, string $message = '') : void + public static function assertNotContains($needle, iterable $haystack, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDirectoryIsNotReadable(...func_get_args()); + $constraint = new LogicalNot(new TraversableContainsIdentical($needle)); + static::assertThat($haystack, $constraint, $message); + } + public static function assertNotContainsEquals($needle, iterable $haystack, string $message = ''): void + { + $constraint = new LogicalNot(new TraversableContainsEqual($needle)); + static::assertThat($haystack, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertDirectoryNotIsReadable')) { /** - * Asserts that a directory exists and is not readable. + * Asserts that a haystack contains only values of a given type. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4071 - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertDirectoryNotIsReadable + * @throws ExpectationFailedException */ - function assertDirectoryNotIsReadable(string $directory, string $message = '') : void + public static function assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDirectoryNotIsReadable(...func_get_args()); + if ($isNativeType === null) { + $isNativeType = Type::isType($type); + } + static::assertThat($haystack, new TraversableContainsOnly($type, $isNativeType), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertDirectoryIsWritable')) { /** - * Asserts that a directory exists and is writable. + * Asserts that a haystack contains only instances of a given class name. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertDirectoryIsWritable + * @throws ExpectationFailedException */ - function assertDirectoryIsWritable(string $directory, string $message = '') : void + public static function assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDirectoryIsWritable(...func_get_args()); + static::assertThat($haystack, new TraversableContainsOnly($className, \false), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertDirectoryIsNotWritable')) { /** - * Asserts that a directory exists and is not writable. + * Asserts that a haystack does not contain only values of a given type. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertDirectoryIsNotWritable + * @throws ExpectationFailedException */ - function assertDirectoryIsNotWritable(string $directory, string $message = '') : void + public static function assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDirectoryIsNotWritable(...func_get_args()); + if ($isNativeType === null) { + $isNativeType = Type::isType($type); + } + static::assertThat($haystack, new LogicalNot(new TraversableContainsOnly($type, $isNativeType)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertDirectoryNotIsWritable')) { /** - * Asserts that a directory exists and is not writable. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4074 + * Asserts the number of elements of an array, Countable or Traversable. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @param Countable|iterable $haystack * - * @see Assert::assertDirectoryNotIsWritable + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException */ - function assertDirectoryNotIsWritable(string $directory, string $message = '') : void + public static function assertCount(int $expectedCount, $haystack, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDirectoryNotIsWritable(...func_get_args()); + if ($haystack instanceof Generator) { + self::createWarning('Passing an argument of type Generator for the $haystack parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + } + if (!$haystack instanceof Countable && !is_iterable($haystack)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'countable or iterable'); + } + static::assertThat($haystack, new Count($expectedCount), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileExists')) { /** - * Asserts that a file exists. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Asserts the number of elements of an array, Countable or Traversable. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @param Countable|iterable $haystack * - * @see Assert::assertFileExists + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException */ - function assertFileExists(string $filename, string $message = '') : void + public static function assertNotCount(int $expectedCount, $haystack, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileExists(...func_get_args()); + if ($haystack instanceof Generator) { + self::createWarning('Passing an argument of type Generator for the $haystack parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + } + if (!$haystack instanceof Countable && !is_iterable($haystack)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'countable or iterable'); + } + $constraint = new LogicalNot(new Count($expectedCount)); + static::assertThat($haystack, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileDoesNotExist')) { /** - * Asserts that a file does not exist. + * Asserts that two variables are equal. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileDoesNotExist + * @throws ExpectationFailedException */ - function assertFileDoesNotExist(string $filename, string $message = '') : void + public static function assertEquals($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileDoesNotExist(...func_get_args()); + $constraint = new IsEqual($expected); + static::assertThat($actual, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileNotExists')) { /** - * Asserts that a file does not exist. + * Asserts that two variables are equal (canonicalizing). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4077 - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileNotExists + * @throws ExpectationFailedException */ - function assertFileNotExists(string $filename, string $message = '') : void + public static function assertEqualsCanonicalizing($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileNotExists(...func_get_args()); + $constraint = new IsEqualCanonicalizing($expected); + static::assertThat($actual, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileIsReadable')) { /** - * Asserts that a file exists and is readable. + * Asserts that two variables are equal (ignoring case). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileIsReadable + * @throws ExpectationFailedException */ - function assertFileIsReadable(string $file, string $message = '') : void + public static function assertEqualsIgnoringCase($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileIsReadable(...func_get_args()); + $constraint = new IsEqualIgnoringCase($expected); + static::assertThat($actual, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileIsNotReadable')) { /** - * Asserts that a file exists and is not readable. + * Asserts that two variables are equal (with delta). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileIsNotReadable + * @throws ExpectationFailedException */ - function assertFileIsNotReadable(string $file, string $message = '') : void + public static function assertEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileIsNotReadable(...func_get_args()); + $constraint = new IsEqualWithDelta($expected, $delta); + static::assertThat($actual, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileNotIsReadable')) { /** - * Asserts that a file exists and is not readable. + * Asserts that two variables are not equal. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4080 - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileNotIsReadable + * @throws ExpectationFailedException */ - function assertFileNotIsReadable(string $file, string $message = '') : void + public static function assertNotEquals($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileNotIsReadable(...func_get_args()); + $constraint = new LogicalNot(new IsEqual($expected)); + static::assertThat($actual, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileIsWritable')) { /** - * Asserts that a file exists and is writable. + * Asserts that two variables are not equal (canonicalizing). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileIsWritable + * @throws ExpectationFailedException */ - function assertFileIsWritable(string $file, string $message = '') : void + public static function assertNotEqualsCanonicalizing($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileIsWritable(...func_get_args()); + $constraint = new LogicalNot(new IsEqualCanonicalizing($expected)); + static::assertThat($actual, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileIsNotWritable')) { /** - * Asserts that a file exists and is not writable. + * Asserts that two variables are not equal (ignoring case). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileIsNotWritable + * @throws ExpectationFailedException */ - function assertFileIsNotWritable(string $file, string $message = '') : void + public static function assertNotEqualsIgnoringCase($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileIsNotWritable(...func_get_args()); + $constraint = new LogicalNot(new IsEqualIgnoringCase($expected)); + static::assertThat($actual, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFileNotIsWritable')) { /** - * Asserts that a file exists and is not writable. + * Asserts that two variables are not equal (with delta). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4083 - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFileNotIsWritable + * @throws ExpectationFailedException */ - function assertFileNotIsWritable(string $file, string $message = '') : void + public static function assertNotEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFileNotIsWritable(...func_get_args()); + $constraint = new LogicalNot(new IsEqualWithDelta($expected, $delta)); + static::assertThat($actual, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertTrue')) { /** - * Asserts that a condition is true. - * * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert true $condition - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertTrue */ - function assertTrue($condition, string $message = '') : void + public static function assertObjectEquals(object $expected, object $actual, string $method = 'equals', string $message = ''): void { - \PHPUnit\Framework\Assert::assertTrue(...func_get_args()); + static::assertThat($actual, static::objectEquals($expected, $method), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotTrue')) { /** - * Asserts that a condition is not true. + * Asserts that a variable is empty. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert !true $condition - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotTrue + * @psalm-assert empty $actual */ - function assertNotTrue($condition, string $message = '') : void + public static function assertEmpty($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNotTrue(...func_get_args()); + if ($actual instanceof Generator) { + self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + } + static::assertThat($actual, static::isEmpty(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFalse')) { /** - * Asserts that a condition is false. + * Asserts that a variable is not empty. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert false $condition - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFalse + * @psalm-assert !empty $actual */ - function assertFalse($condition, string $message = '') : void + public static function assertNotEmpty($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFalse(...func_get_args()); + if ($actual instanceof Generator) { + self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + } + static::assertThat($actual, static::logicalNot(static::isEmpty()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotFalse')) { /** - * Asserts that a condition is not false. + * Asserts that a value is greater than another value. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert !false $condition - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotFalse + * @throws ExpectationFailedException */ - function assertNotFalse($condition, string $message = '') : void + public static function assertGreaterThan($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNotFalse(...func_get_args()); + static::assertThat($actual, static::greaterThan($expected), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNull')) { /** - * Asserts that a variable is null. + * Asserts that a value is greater than or equal to another value. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert null $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNull + * @throws ExpectationFailedException */ - function assertNull($actual, string $message = '') : void + public static function assertGreaterThanOrEqual($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNull(...func_get_args()); + static::assertThat($actual, static::greaterThanOrEqual($expected), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotNull')) { /** - * Asserts that a variable is not null. + * Asserts that a value is smaller than another value. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert !null $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotNull + * @throws ExpectationFailedException */ - function assertNotNull($actual, string $message = '') : void + public static function assertLessThan($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNotNull(...func_get_args()); + static::assertThat($actual, static::lessThan($expected), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertFinite')) { /** - * Asserts that a variable is finite. + * Asserts that a value is smaller than or equal to another value. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertFinite + * @throws ExpectationFailedException */ - function assertFinite($actual, string $message = '') : void + public static function assertLessThanOrEqual($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertFinite(...func_get_args()); + static::assertThat($actual, static::lessThanOrEqual($expected), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertInfinite')) { /** - * Asserts that a variable is infinite. + * Asserts that the contents of one file is equal to the contents of another + * file. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertInfinite + * @throws ExpectationFailedException */ - function assertInfinite($actual, string $message = '') : void + public static function assertFileEquals(string $expected, string $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertInfinite(...func_get_args()); + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + $constraint = new IsEqual(file_get_contents($expected)); + static::assertThat(file_get_contents($actual), $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNan')) { /** - * Asserts that a variable is nan. + * Asserts that the contents of one file is equal to the contents of another + * file (canonicalizing). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNan + * @throws ExpectationFailedException */ - function assertNan($actual, string $message = '') : void + public static function assertFileEqualsCanonicalizing(string $expected, string $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNan(...func_get_args()); + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + $constraint = new IsEqualCanonicalizing(file_get_contents($expected)); + static::assertThat(file_get_contents($actual), $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertClassHasAttribute')) { /** - * Asserts that a class has a specified attribute. + * Asserts that the contents of one file is equal to the contents of another + * file (ignoring case). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertClassHasAttribute + * @throws ExpectationFailedException */ - function assertClassHasAttribute(string $attributeName, string $className, string $message = '') : void + public static function assertFileEqualsIgnoringCase(string $expected, string $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertClassHasAttribute(...func_get_args()); + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + $constraint = new IsEqualIgnoringCase(file_get_contents($expected)); + static::assertThat(file_get_contents($actual), $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertClassNotHasAttribute')) { /** - * Asserts that a class does not have a specified attribute. + * Asserts that the contents of one file is not equal to the contents of + * another file. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertClassNotHasAttribute + * @throws ExpectationFailedException */ - function assertClassNotHasAttribute(string $attributeName, string $className, string $message = '') : void + public static function assertFileNotEquals(string $expected, string $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertClassNotHasAttribute(...func_get_args()); + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + $constraint = new LogicalNot(new IsEqual(file_get_contents($expected))); + static::assertThat(file_get_contents($actual), $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertClassHasStaticAttribute')) { /** - * Asserts that a class has a specified static attribute. + * Asserts that the contents of one file is not equal to the contents of another + * file (canonicalizing). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertClassHasStaticAttribute + * @throws ExpectationFailedException */ - function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = '') : void + public static function assertFileNotEqualsCanonicalizing(string $expected, string $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertClassHasStaticAttribute(...func_get_args()); + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + $constraint = new LogicalNot(new IsEqualCanonicalizing(file_get_contents($expected))); + static::assertThat(file_get_contents($actual), $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertClassNotHasStaticAttribute')) { /** - * Asserts that a class does not have a specified static attribute. + * Asserts that the contents of one file is not equal to the contents of another + * file (ignoring case). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertClassNotHasStaticAttribute + * @throws ExpectationFailedException */ - function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = '') : void + public static function assertFileNotEqualsIgnoringCase(string $expected, string $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertClassNotHasStaticAttribute(...func_get_args()); + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + $constraint = new LogicalNot(new IsEqualIgnoringCase(file_get_contents($expected))); + static::assertThat(file_get_contents($actual), $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertObjectHasAttribute')) { /** - * Asserts that an object has a specified attribute. - * - * @param object $object + * Asserts that the contents of a string is equal + * to the contents of a file. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertObjectHasAttribute + * @throws ExpectationFailedException */ - function assertObjectHasAttribute(string $attributeName, $object, string $message = '') : void + public static function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = ''): void { - \PHPUnit\Framework\Assert::assertObjectHasAttribute(...func_get_args()); + static::assertFileExists($expectedFile, $message); + $constraint = new IsEqual(file_get_contents($expectedFile)); + static::assertThat($actualString, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertObjectNotHasAttribute')) { /** - * Asserts that an object does not have a specified attribute. - * - * @param object $object + * Asserts that the contents of a string is equal + * to the contents of a file (canonicalizing). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertObjectNotHasAttribute + * @throws ExpectationFailedException */ - function assertObjectNotHasAttribute(string $attributeName, $object, string $message = '') : void + public static function assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = ''): void { - \PHPUnit\Framework\Assert::assertObjectNotHasAttribute(...func_get_args()); + static::assertFileExists($expectedFile, $message); + $constraint = new IsEqualCanonicalizing(file_get_contents($expectedFile)); + static::assertThat($actualString, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertObjectHasProperty')) { /** - * Asserts that an object has a specified property. + * Asserts that the contents of a string is equal + * to the contents of a file (ignoring case). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertObjectHasProperty + * @throws ExpectationFailedException */ - function assertObjectHasProperty(string $attributeName, object $object, string $message = '') : void + public static function assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = ''): void { - \PHPUnit\Framework\Assert::assertObjectHasProperty(...func_get_args()); + static::assertFileExists($expectedFile, $message); + $constraint = new IsEqualIgnoringCase(file_get_contents($expectedFile)); + static::assertThat($actualString, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertObjectNotHasProperty')) { /** - * Asserts that an object does not have a specified property. + * Asserts that the contents of a string is not equal + * to the contents of a file. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertObjectNotHasProperty + * @throws ExpectationFailedException */ - function assertObjectNotHasProperty(string $attributeName, object $object, string $message = '') : void + public static function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = ''): void { - \PHPUnit\Framework\Assert::assertObjectNotHasProperty(...func_get_args()); + static::assertFileExists($expectedFile, $message); + $constraint = new LogicalNot(new IsEqual(file_get_contents($expectedFile))); + static::assertThat($actualString, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertSame')) { /** - * Asserts that two variables have the same type and value. - * Used on objects, it asserts that two variables reference - * the same object. + * Asserts that the contents of a string is not equal + * to the contents of a file (canonicalizing). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-template ExpectedType - * - * @psalm-param ExpectedType $expected - * - * @psalm-assert =ExpectedType $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertSame + * @throws ExpectationFailedException */ - function assertSame($expected, $actual, string $message = '') : void + public static function assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = ''): void { - \PHPUnit\Framework\Assert::assertSame(...func_get_args()); + static::assertFileExists($expectedFile, $message); + $constraint = new LogicalNot(new IsEqualCanonicalizing(file_get_contents($expectedFile))); + static::assertThat($actualString, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotSame')) { /** - * Asserts that two variables do not have the same type and value. - * Used on objects, it asserts that two variables do not reference - * the same object. + * Asserts that the contents of a string is not equal + * to the contents of a file (ignoring case). * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotSame + * @throws ExpectationFailedException */ - function assertNotSame($expected, $actual, string $message = '') : void + public static function assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNotSame(...func_get_args()); + static::assertFileExists($expectedFile, $message); + $constraint = new LogicalNot(new IsEqualIgnoringCase(file_get_contents($expectedFile))); + static::assertThat($actualString, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertInstanceOf')) { /** - * Asserts that a variable is of a given type. + * Asserts that a file/dir is readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @psalm-template ExpectedType of object - * - * @psalm-param class-string $expected - * - * @psalm-assert =ExpectedType $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertInstanceOf + * @throws ExpectationFailedException */ - function assertInstanceOf(string $expected, $actual, string $message = '') : void + public static function assertIsReadable(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertInstanceOf(...func_get_args()); + static::assertThat($filename, new IsReadable(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotInstanceOf')) { /** - * Asserts that a variable is not of a given type. + * Asserts that a file/dir exists and is not readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @psalm-template ExpectedType of object - * - * @psalm-param class-string $expected - * - * @psalm-assert !ExpectedType $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotInstanceOf + * @throws ExpectationFailedException */ - function assertNotInstanceOf(string $expected, $actual, string $message = '') : void + public static function assertIsNotReadable(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNotInstanceOf(...func_get_args()); + static::assertThat($filename, new LogicalNot(new IsReadable()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsArray')) { /** - * Asserts that a variable is of type array. + * Asserts that a file/dir exists and is not readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert array $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @codeCoverageIgnore * - * @see Assert::assertIsArray + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4062 */ - function assertIsArray($actual, string $message = '') : void + public static function assertNotIsReadable(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsArray(...func_get_args()); + self::createWarning('assertNotIsReadable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertIsNotReadable() instead.'); + static::assertThat($filename, new LogicalNot(new IsReadable()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsBool')) { /** - * Asserts that a variable is of type bool. + * Asserts that a file/dir exists and is writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert bool $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsBool + * @throws ExpectationFailedException */ - function assertIsBool($actual, string $message = '') : void + public static function assertIsWritable(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsBool(...func_get_args()); + static::assertThat($filename, new IsWritable(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsFloat')) { /** - * Asserts that a variable is of type float. + * Asserts that a file/dir exists and is not writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert float $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsFloat + * @throws ExpectationFailedException */ - function assertIsFloat($actual, string $message = '') : void + public static function assertIsNotWritable(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsFloat(...func_get_args()); + static::assertThat($filename, new LogicalNot(new IsWritable()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsInt')) { /** - * Asserts that a variable is of type int. + * Asserts that a file/dir exists and is not writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert int $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @codeCoverageIgnore * - * @see Assert::assertIsInt + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4065 */ - function assertIsInt($actual, string $message = '') : void + public static function assertNotIsWritable(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsInt(...func_get_args()); + self::createWarning('assertNotIsWritable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertIsNotWritable() instead.'); + static::assertThat($filename, new LogicalNot(new IsWritable()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNumeric')) { /** - * Asserts that a variable is of type numeric. + * Asserts that a directory exists. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert numeric $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNumeric + * @throws ExpectationFailedException */ - function assertIsNumeric($actual, string $message = '') : void + public static function assertDirectoryExists(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNumeric(...func_get_args()); + static::assertThat($directory, new DirectoryExists(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsObject')) { /** - * Asserts that a variable is of type object. + * Asserts that a directory does not exist. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert object $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsObject + * @throws ExpectationFailedException */ - function assertIsObject($actual, string $message = '') : void + public static function assertDirectoryDoesNotExist(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsObject(...func_get_args()); + static::assertThat($directory, new LogicalNot(new DirectoryExists()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsResource')) { /** - * Asserts that a variable is of type resource. + * Asserts that a directory does not exist. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert resource $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @codeCoverageIgnore * - * @see Assert::assertIsResource + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4068 */ - function assertIsResource($actual, string $message = '') : void + public static function assertDirectoryNotExists(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsResource(...func_get_args()); + self::createWarning('assertDirectoryNotExists() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDirectoryDoesNotExist() instead.'); + static::assertThat($directory, new LogicalNot(new DirectoryExists()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsClosedResource')) { /** - * Asserts that a variable is of type resource and is closed. + * Asserts that a directory exists and is readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert resource $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsClosedResource + * @throws ExpectationFailedException */ - function assertIsClosedResource($actual, string $message = '') : void + public static function assertDirectoryIsReadable(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsClosedResource(...func_get_args()); + self::assertDirectoryExists($directory, $message); + self::assertIsReadable($directory, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsString')) { /** - * Asserts that a variable is of type string. + * Asserts that a directory exists and is not readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert string $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsString + * @throws ExpectationFailedException */ - function assertIsString($actual, string $message = '') : void + public static function assertDirectoryIsNotReadable(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsString(...func_get_args()); + self::assertDirectoryExists($directory, $message); + self::assertIsNotReadable($directory, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsScalar')) { /** - * Asserts that a variable is of type scalar. + * Asserts that a directory exists and is not readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert scalar $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @codeCoverageIgnore * - * @see Assert::assertIsScalar + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4071 */ - function assertIsScalar($actual, string $message = '') : void + public static function assertDirectoryNotIsReadable(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsScalar(...func_get_args()); + self::createWarning('assertDirectoryNotIsReadable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDirectoryIsNotReadable() instead.'); + self::assertDirectoryExists($directory, $message); + self::assertIsNotReadable($directory, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsCallable')) { /** - * Asserts that a variable is of type callable. + * Asserts that a directory exists and is writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert callable $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsCallable + * @throws ExpectationFailedException */ - function assertIsCallable($actual, string $message = '') : void + public static function assertDirectoryIsWritable(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsCallable(...func_get_args()); + self::assertDirectoryExists($directory, $message); + self::assertIsWritable($directory, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsIterable')) { /** - * Asserts that a variable is of type iterable. + * Asserts that a directory exists and is not writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert iterable $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsIterable + * @throws ExpectationFailedException */ - function assertIsIterable($actual, string $message = '') : void + public static function assertDirectoryIsNotWritable(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsIterable(...func_get_args()); + self::assertDirectoryExists($directory, $message); + self::assertIsNotWritable($directory, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotArray')) { /** - * Asserts that a variable is not of type array. + * Asserts that a directory exists and is not writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert !array $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @codeCoverageIgnore * - * @see Assert::assertIsNotArray + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4074 */ - function assertIsNotArray($actual, string $message = '') : void + public static function assertDirectoryNotIsWritable(string $directory, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotArray(...func_get_args()); + self::createWarning('assertDirectoryNotIsWritable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDirectoryIsNotWritable() instead.'); + self::assertDirectoryExists($directory, $message); + self::assertIsNotWritable($directory, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotBool')) { /** - * Asserts that a variable is not of type bool. + * Asserts that a file exists. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert !bool $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotBool + * @throws ExpectationFailedException */ - function assertIsNotBool($actual, string $message = '') : void + public static function assertFileExists(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotBool(...func_get_args()); + static::assertThat($filename, new FileExists(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotFloat')) { /** - * Asserts that a variable is not of type float. + * Asserts that a file does not exist. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert !float $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotFloat + * @throws ExpectationFailedException */ - function assertIsNotFloat($actual, string $message = '') : void + public static function assertFileDoesNotExist(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotFloat(...func_get_args()); + static::assertThat($filename, new LogicalNot(new FileExists()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotInt')) { /** - * Asserts that a variable is not of type int. + * Asserts that a file does not exist. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert !int $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @codeCoverageIgnore * - * @see Assert::assertIsNotInt + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4077 */ - function assertIsNotInt($actual, string $message = '') : void + public static function assertFileNotExists(string $filename, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotInt(...func_get_args()); + self::createWarning('assertFileNotExists() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileDoesNotExist() instead.'); + static::assertThat($filename, new LogicalNot(new FileExists()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotNumeric')) { /** - * Asserts that a variable is not of type numeric. + * Asserts that a file exists and is readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert !numeric $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotNumeric + * @throws ExpectationFailedException */ - function assertIsNotNumeric($actual, string $message = '') : void + public static function assertFileIsReadable(string $file, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotNumeric(...func_get_args()); + self::assertFileExists($file, $message); + self::assertIsReadable($file, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotObject')) { /** - * Asserts that a variable is not of type object. + * Asserts that a file exists and is not readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert !object $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotObject + * @throws ExpectationFailedException */ - function assertIsNotObject($actual, string $message = '') : void + public static function assertFileIsNotReadable(string $file, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotObject(...func_get_args()); + self::assertFileExists($file, $message); + self::assertIsNotReadable($file, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotResource')) { /** - * Asserts that a variable is not of type resource. + * Asserts that a file exists and is not readable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert !resource $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @codeCoverageIgnore * - * @see Assert::assertIsNotResource + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4080 */ - function assertIsNotResource($actual, string $message = '') : void + public static function assertFileNotIsReadable(string $file, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotResource(...func_get_args()); + self::createWarning('assertFileNotIsReadable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileIsNotReadable() instead.'); + self::assertFileExists($file, $message); + self::assertIsNotReadable($file, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotClosedResource')) { /** - * Asserts that a variable is not of type resource. + * Asserts that a file exists and is writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert !resource $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotClosedResource + * @throws ExpectationFailedException */ - function assertIsNotClosedResource($actual, string $message = '') : void + public static function assertFileIsWritable(string $file, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotClosedResource(...func_get_args()); + self::assertFileExists($file, $message); + self::assertIsWritable($file, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotString')) { /** - * Asserts that a variable is not of type string. + * Asserts that a file exists and is not writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @psalm-assert !string $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotString + * @throws ExpectationFailedException */ - function assertIsNotString($actual, string $message = '') : void + public static function assertFileIsNotWritable(string $file, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotString(...func_get_args()); + self::assertFileExists($file, $message); + self::assertIsNotWritable($file, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotScalar')) { /** - * Asserts that a variable is not of type scalar. + * Asserts that a file exists and is not writable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert !scalar $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @codeCoverageIgnore * - * @see Assert::assertIsNotScalar + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4083 */ - function assertIsNotScalar($actual, string $message = '') : void + public static function assertFileNotIsWritable(string $file, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotScalar(...func_get_args()); + self::createWarning('assertFileNotIsWritable() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileIsNotWritable() instead.'); + self::assertFileExists($file, $message); + self::assertIsNotWritable($file, $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotCallable')) { /** - * Asserts that a variable is not of type callable. + * Asserts that a condition is true. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert !callable $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotCallable + * @psalm-assert true $condition */ - function assertIsNotCallable($actual, string $message = '') : void + public static function assertTrue($condition, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotCallable(...func_get_args()); + static::assertThat($condition, static::isTrue(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertIsNotIterable')) { /** - * Asserts that a variable is not of type iterable. + * Asserts that a condition is not true. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @psalm-assert !iterable $actual - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertIsNotIterable + * @psalm-assert !true $condition */ - function assertIsNotIterable($actual, string $message = '') : void + public static function assertNotTrue($condition, string $message = ''): void { - \PHPUnit\Framework\Assert::assertIsNotIterable(...func_get_args()); + static::assertThat($condition, static::logicalNot(static::isTrue()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertMatchesRegularExpression')) { /** - * Asserts that a string matches a given regular expression. + * Asserts that a condition is false. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertMatchesRegularExpression + * @psalm-assert false $condition */ - function assertMatchesRegularExpression(string $pattern, string $string, string $message = '') : void + public static function assertFalse($condition, string $message = ''): void { - \PHPUnit\Framework\Assert::assertMatchesRegularExpression(...func_get_args()); + static::assertThat($condition, static::isFalse(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertRegExp')) { /** - * Asserts that a string matches a given regular expression. + * Asserts that a condition is not false. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4086 - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertRegExp + * @psalm-assert !false $condition */ - function assertRegExp(string $pattern, string $string, string $message = '') : void + public static function assertNotFalse($condition, string $message = ''): void { - \PHPUnit\Framework\Assert::assertRegExp(...func_get_args()); + static::assertThat($condition, static::logicalNot(static::isFalse()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertDoesNotMatchRegularExpression')) { /** - * Asserts that a string does not match a given regular expression. + * Asserts that a variable is null. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertDoesNotMatchRegularExpression + * @psalm-assert null $actual */ - function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = '') : void + public static function assertNull($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertDoesNotMatchRegularExpression(...func_get_args()); + static::assertThat($actual, static::isNull(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotRegExp')) { /** - * Asserts that a string does not match a given regular expression. + * Asserts that a variable is not null. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4089 - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotRegExp + * @psalm-assert !null $actual */ - function assertNotRegExp(string $pattern, string $string, string $message = '') : void + public static function assertNotNull($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNotRegExp(...func_get_args()); + static::assertThat($actual, static::logicalNot(static::isNull()), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertSameSize')) { /** - * Assert that the size of two arrays (or `Countable` or `Traversable` objects) - * is the same. - * - * @param Countable|iterable $expected - * @param Countable|iterable $actual + * Asserts that a variable is finite. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertSameSize + * @throws ExpectationFailedException */ - function assertSameSize($expected, $actual, string $message = '') : void + public static function assertFinite($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertSameSize(...func_get_args()); + static::assertThat($actual, static::isFinite(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertNotSameSize')) { /** - * Assert that the size of two arrays (or `Countable` or `Traversable` objects) - * is not the same. - * - * @param Countable|iterable $expected - * @param Countable|iterable $actual + * Asserts that a variable is infinite. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertNotSameSize + * @throws ExpectationFailedException */ - function assertNotSameSize($expected, $actual, string $message = '') : void + public static function assertInfinite($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertNotSameSize(...func_get_args()); + static::assertThat($actual, static::isInfinite(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringMatchesFormat')) { /** - * Asserts that a string matches a given format string. + * Asserts that a variable is nan. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringMatchesFormat + * @throws ExpectationFailedException */ - function assertStringMatchesFormat(string $format, string $string, string $message = '') : void + public static function assertNan($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringMatchesFormat(...func_get_args()); + static::assertThat($actual, static::isNan(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringNotMatchesFormat')) { /** - * Asserts that a string does not match a given format string. + * Asserts that a class has a specified attribute. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringNotMatchesFormat + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - function assertStringNotMatchesFormat(string $format, string $string, string $message = '') : void + public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringNotMatchesFormat(...func_get_args()); + self::createWarning('assertClassHasAttribute() is deprecated and will be removed in PHPUnit 10.'); + if (!self::isValidClassAttributeName($attributeName)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); + } + if (!class_exists($className)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'class name'); + } + static::assertThat($className, new ClassHasAttribute($attributeName), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringMatchesFormatFile')) { /** - * Asserts that a string matches a given format file. + * Asserts that a class does not have a specified attribute. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringMatchesFormatFile + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = '') : void + public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringMatchesFormatFile(...func_get_args()); + self::createWarning('assertClassNotHasAttribute() is deprecated and will be removed in PHPUnit 10.'); + if (!self::isValidClassAttributeName($attributeName)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); + } + if (!class_exists($className)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'class name'); + } + static::assertThat($className, new LogicalNot(new ClassHasAttribute($attributeName)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringNotMatchesFormatFile')) { /** - * Asserts that a string does not match a given format string. + * Asserts that a class has a specified static attribute. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringNotMatchesFormatFile + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = '') : void + public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringNotMatchesFormatFile(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\assertStringStartsWith')) { - /** - * Asserts that a string starts with a given prefix. - * - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + self::createWarning('assertClassHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.'); + if (!self::isValidClassAttributeName($attributeName)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); + } + if (!class_exists($className)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'class name'); + } + static::assertThat($className, new ClassHasStaticAttribute($attributeName), $message); + } + /** + * Asserts that a class does not have a specified static attribute. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException * - * @see Assert::assertStringStartsWith + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - function assertStringStartsWith(string $prefix, string $string, string $message = '') : void + public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringStartsWith(...func_get_args()); + self::createWarning('assertClassNotHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.'); + if (!self::isValidClassAttributeName($attributeName)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); + } + if (!class_exists($className)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'class name'); + } + static::assertThat($className, new LogicalNot(new ClassHasStaticAttribute($attributeName)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringStartsNotWith')) { /** - * Asserts that a string starts not with a given prefix. + * Asserts that an object has a specified attribute. * - * @param string $prefix - * @param string $string + * @param object $object * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringStartsNotWith + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - function assertStringStartsNotWith($prefix, $string, string $message = '') : void + public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringStartsNotWith(...func_get_args()); + self::createWarning('assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() instead.'); + if (!self::isValidObjectAttributeName($attributeName)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); + } + if (!is_object($object)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'object'); + } + static::assertThat($object, new ObjectHasAttribute($attributeName), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringContainsString')) { /** - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Asserts that an object does not have a specified attribute. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @param object $object * - * @see Assert::assertStringContainsString + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - function assertStringContainsString(string $needle, string $haystack, string $message = '') : void + public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringContainsString(...func_get_args()); + self::createWarning('assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectNotHasProperty() instead.'); + if (!self::isValidObjectAttributeName($attributeName)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'valid attribute name'); + } + if (!is_object($object)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'object'); + } + static::assertThat($object, new LogicalNot(new ObjectHasAttribute($attributeName)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringContainsStringIgnoringCase')) { /** - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * Asserts that an object has a specified property. * - * @see Assert::assertStringContainsStringIgnoringCase + * @throws ExpectationFailedException */ - function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = '') : void + final public static function assertObjectHasProperty(string $propertyName, object $object, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringContainsStringIgnoringCase(...func_get_args()); + static::assertThat($object, new ObjectHasProperty($propertyName), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringNotContainsString')) { /** - * @throws ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * Asserts that an object does not have a specified property. * - * @see Assert::assertStringNotContainsString + * @throws ExpectationFailedException */ - function assertStringNotContainsString(string $needle, string $haystack, string $message = '') : void + final public static function assertObjectNotHasProperty(string $propertyName, object $object, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringNotContainsString(...func_get_args()); + static::assertThat($object, new LogicalNot(new ObjectHasProperty($propertyName)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringNotContainsStringIgnoringCase')) { /** - * @throws ExpectationFailedException + * Asserts that two variables have the same type and value. + * Used on objects, it asserts that two variables reference + * the same object. + * * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @psalm-template ExpectedType * - * @see Assert::assertStringNotContainsStringIgnoringCase + * @psalm-param ExpectedType $expected + * + * @psalm-assert =ExpectedType $actual */ - function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = '') : void + public static function assertSame($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringNotContainsStringIgnoringCase(...func_get_args()); + static::assertThat($actual, new IsIdentical($expected), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringEndsWith')) { /** - * Asserts that a string ends with a given suffix. + * Asserts that two variables do not have the same type and value. + * Used on objects, it asserts that two variables do not reference + * the same object. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertStringEndsWith + * @throws ExpectationFailedException */ - function assertStringEndsWith(string $suffix, string $string, string $message = '') : void + public static function assertNotSame($expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringEndsWith(...func_get_args()); + if (is_bool($expected) && is_bool($actual)) { + static::assertNotEquals($expected, $actual, $message); + } + static::assertThat($actual, new LogicalNot(new IsIdentical($expected)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertStringEndsNotWith')) { /** - * Asserts that a string ends not with a given suffix. + * Asserts that a variable is of a given type. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @psalm-template ExpectedType of object * - * @see Assert::assertStringEndsNotWith + * @psalm-param class-string $expected + * + * @psalm-assert =ExpectedType $actual */ - function assertStringEndsNotWith(string $suffix, string $string, string $message = '') : void + public static function assertInstanceOf(string $expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertStringEndsNotWith(...func_get_args()); + if (!class_exists($expected) && !interface_exists($expected)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'class or interface name'); + } + static::assertThat($actual, new IsInstanceOf($expected), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertXmlFileEqualsXmlFile')) { /** - * Asserts that two XML files are equal. + * Asserts that a variable is not of a given type. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException * @throws Exception + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @psalm-template ExpectedType of object * - * @see Assert::assertXmlFileEqualsXmlFile + * @psalm-param class-string $expected + * + * @psalm-assert !ExpectedType $actual */ - function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '') : void + public static function assertNotInstanceOf(string $expected, $actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertXmlFileEqualsXmlFile(...func_get_args()); + if (!class_exists($expected) && !interface_exists($expected)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'class or interface name'); + } + static::assertThat($actual, new LogicalNot(new IsInstanceOf($expected)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertXmlFileNotEqualsXmlFile')) { /** - * Asserts that two XML files are not equal. + * Asserts that a variable is of type array. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws \PHPUnit\Util\Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @throws ExpectationFailedException * - * @see Assert::assertXmlFileNotEqualsXmlFile + * @psalm-assert array $actual */ - function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '') : void + public static function assertIsArray($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertXmlFileNotEqualsXmlFile(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_ARRAY), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertXmlStringEqualsXmlFile')) { /** - * Asserts that two XML documents are equal. - * - * @param DOMDocument|string $actualXml + * Asserts that a variable is of type bool. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws \PHPUnit\Util\Xml\Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @throws ExpectationFailedException * - * @see Assert::assertXmlStringEqualsXmlFile + * @psalm-assert bool $actual */ - function assertXmlStringEqualsXmlFile(string $expectedFile, $actualXml, string $message = '') : void + public static function assertIsBool($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertXmlStringEqualsXmlFile(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_BOOL), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertXmlStringNotEqualsXmlFile')) { /** - * Asserts that two XML documents are not equal. - * - * @param DOMDocument|string $actualXml + * Asserts that a variable is of type float. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws \PHPUnit\Util\Xml\Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @throws ExpectationFailedException * - * @see Assert::assertXmlStringNotEqualsXmlFile + * @psalm-assert float $actual */ - function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = '') : void + public static function assertIsFloat($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertXmlStringNotEqualsXmlFile(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_FLOAT), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertXmlStringEqualsXmlString')) { /** - * Asserts that two XML documents are equal. - * - * @param DOMDocument|string $expectedXml - * @param DOMDocument|string $actualXml + * Asserts that a variable is of type int. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws \PHPUnit\Util\Xml\Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @throws ExpectationFailedException * - * @see Assert::assertXmlStringEqualsXmlString + * @psalm-assert int $actual */ - function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = '') : void + public static function assertIsInt($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertXmlStringEqualsXmlString(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_INT), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertXmlStringNotEqualsXmlString')) { /** - * Asserts that two XML documents are not equal. - * - * @param DOMDocument|string $expectedXml - * @param DOMDocument|string $actualXml + * Asserts that a variable is of type numeric. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws \PHPUnit\Util\Xml\Exception - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @throws ExpectationFailedException * - * @see Assert::assertXmlStringNotEqualsXmlString + * @psalm-assert numeric $actual */ - function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, string $message = '') : void + public static function assertIsNumeric($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertXmlStringNotEqualsXmlString(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_NUMERIC), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertEqualXMLStructure')) { /** - * Asserts that a hierarchy of DOMElements matches. + * Asserts that a variable is of type object. * - * @throws AssertionFailedError - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4091 + * @psalm-assert object $actual + */ + public static function assertIsObject($actual, string $message = ''): void + { + static::assertThat($actual, new IsType(IsType::TYPE_OBJECT), $message); + } + /** + * Asserts that a variable is of type resource. * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @see Assert::assertEqualXMLStructure + * @psalm-assert resource $actual */ - function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = \false, string $message = '') : void + public static function assertIsResource($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertEqualXMLStructure(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_RESOURCE), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertThat')) { /** - * Evaluates a PHPUnit\Framework\Constraint matcher object. + * Asserts that a variable is of type resource and is closed. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertThat + * @psalm-assert resource $actual */ - function assertThat($value, Constraint $constraint, string $message = '') : void + public static function assertIsClosedResource($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertThat(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_CLOSED_RESOURCE), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertJson')) { /** - * Asserts that a string is a valid JSON string. + * Asserts that a variable is of type string. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertJson + * @psalm-assert string $actual */ - function assertJson(string $actualJson, string $message = '') : void + public static function assertIsString($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertJson(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_STRING), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertJsonStringEqualsJsonString')) { /** - * Asserts that two given JSON encoded objects or arrays are equal. + * Asserts that a variable is of type scalar. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertJsonStringEqualsJsonString + * @psalm-assert scalar $actual */ - function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = '') : void + public static function assertIsScalar($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertJsonStringEqualsJsonString(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_SCALAR), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertJsonStringNotEqualsJsonString')) { /** - * Asserts that two given JSON encoded objects or arrays are not equal. - * - * @param string $expectedJson - * @param string $actualJson + * Asserts that a variable is of type callable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertJsonStringNotEqualsJsonString + * @psalm-assert callable $actual */ - function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, string $message = '') : void + public static function assertIsCallable($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertJsonStringNotEqualsJsonString(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_CALLABLE), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertJsonStringEqualsJsonFile')) { /** - * Asserts that the generated JSON encoded object and the content of the given file are equal. + * Asserts that a variable is of type iterable. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertJsonStringEqualsJsonFile + * @psalm-assert iterable $actual */ - function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '') : void + public static function assertIsIterable($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertJsonStringEqualsJsonFile(...func_get_args()); + static::assertThat($actual, new IsType(IsType::TYPE_ITERABLE), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertJsonStringNotEqualsJsonFile')) { /** - * Asserts that the generated JSON encoded object and the content of the given file are not equal. + * Asserts that a variable is not of type array. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertJsonStringNotEqualsJsonFile + * @psalm-assert !array $actual */ - function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '') : void + public static function assertIsNotArray($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertJsonStringNotEqualsJsonFile(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_ARRAY)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertJsonFileEqualsJsonFile')) { /** - * Asserts that two JSON files are equal. + * Asserts that a variable is not of type bool. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertJsonFileEqualsJsonFile + * @psalm-assert !bool $actual */ - function assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '') : void + public static function assertIsNotBool($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertJsonFileEqualsJsonFile(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_BOOL)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\assertJsonFileNotEqualsJsonFile')) { /** - * Asserts that two JSON files are not equal. + * Asserts that a variable is not of type float. * - * @throws ExpectationFailedException * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see Assert::assertJsonFileNotEqualsJsonFile + * @psalm-assert !float $actual */ - function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '') : void + public static function assertIsNotFloat($actual, string $message = ''): void { - \PHPUnit\Framework\Assert::assertJsonFileNotEqualsJsonFile(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_FLOAT)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\logicalAnd')) { - function logicalAnd() : LogicalAnd + /** + * Asserts that a variable is not of type int. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !int $actual + */ + public static function assertIsNotInt($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::logicalAnd(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_INT)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\logicalOr')) { - function logicalOr() : LogicalOr + /** + * Asserts that a variable is not of type numeric. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !numeric $actual + */ + public static function assertIsNotNumeric($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::logicalOr(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_NUMERIC)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\logicalNot')) { - function logicalNot(Constraint $constraint) : LogicalNot + /** + * Asserts that a variable is not of type object. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !object $actual + */ + public static function assertIsNotObject($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::logicalNot(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_OBJECT)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\logicalXor')) { - function logicalXor() : LogicalXor + /** + * Asserts that a variable is not of type resource. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !resource $actual + */ + public static function assertIsNotResource($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::logicalXor(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_RESOURCE)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\anything')) { - function anything() : IsAnything + /** + * Asserts that a variable is not of type resource. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !resource $actual + */ + public static function assertIsNotClosedResource($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::anything(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_CLOSED_RESOURCE)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\isTrue')) { - function isTrue() : IsTrue + /** + * Asserts that a variable is not of type string. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !string $actual + */ + public static function assertIsNotString($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::isTrue(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_STRING)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\callback')) { - function callback(callable $callback) : Callback + /** + * Asserts that a variable is not of type scalar. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !scalar $actual + */ + public static function assertIsNotScalar($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::callback(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_SCALAR)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\isFalse')) { - function isFalse() : IsFalse + /** + * Asserts that a variable is not of type callable. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !callable $actual + */ + public static function assertIsNotCallable($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::isFalse(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_CALLABLE)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\isJson')) { - function isJson() : IsJson + /** + * Asserts that a variable is not of type iterable. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @psalm-assert !iterable $actual + */ + public static function assertIsNotIterable($actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::isJson(...func_get_args()); + static::assertThat($actual, new LogicalNot(new IsType(IsType::TYPE_ITERABLE)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\isNull')) { - function isNull() : IsNull + /** + * Asserts that a string matches a given regular expression. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::isNull(...func_get_args()); + static::assertThat($string, new RegularExpression($pattern), $message); } -} -if (!function_exists('PHPUnit\\Framework\\isFinite')) { - function isFinite() : IsFinite + /** + * Asserts that a string matches a given regular expression. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4086 + */ + public static function assertRegExp(string $pattern, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::isFinite(...func_get_args()); + self::createWarning('assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.'); + static::assertThat($string, new RegularExpression($pattern), $message); } -} -if (!function_exists('PHPUnit\\Framework\\isInfinite')) { - function isInfinite() : IsInfinite + /** + * Asserts that a string does not match a given regular expression. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::isInfinite(...func_get_args()); + static::assertThat($string, new LogicalNot(new RegularExpression($pattern)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\isNan')) { - function isNan() : IsNan + /** + * Asserts that a string does not match a given regular expression. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4089 + */ + public static function assertNotRegExp(string $pattern, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::isNan(...func_get_args()); + self::createWarning('assertNotRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDoesNotMatchRegularExpression() instead.'); + static::assertThat($string, new LogicalNot(new RegularExpression($pattern)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\containsEqual')) { - function containsEqual($value) : TraversableContainsEqual + /** + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException + */ + public static function assertSameSize($expected, $actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::containsEqual(...func_get_args()); + if ($expected instanceof Generator) { + self::createWarning('Passing an argument of type Generator for the $expected parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + } + if ($actual instanceof Generator) { + self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + } + if (!$expected instanceof Countable && !is_iterable($expected)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'countable or iterable'); + } + if (!$actual instanceof Countable && !is_iterable($actual)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'countable or iterable'); + } + static::assertThat($actual, new SameSize($expected), $message); } -} -if (!function_exists('PHPUnit\\Framework\\containsIdentical')) { - function containsIdentical($value) : TraversableContainsIdentical - { - return \PHPUnit\Framework\Assert::containsIdentical(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\containsOnly')) { - function containsOnly(string $type) : TraversableContainsOnly - { - return \PHPUnit\Framework\Assert::containsOnly(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\containsOnlyInstancesOf')) { - function containsOnlyInstancesOf(string $className) : TraversableContainsOnly - { - return \PHPUnit\Framework\Assert::containsOnlyInstancesOf(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\arrayHasKey')) { - function arrayHasKey($key) : ArrayHasKey - { - return \PHPUnit\Framework\Assert::arrayHasKey(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\equalTo')) { - function equalTo($value) : IsEqual - { - return \PHPUnit\Framework\Assert::equalTo(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\equalToCanonicalizing')) { - function equalToCanonicalizing($value) : IsEqualCanonicalizing - { - return \PHPUnit\Framework\Assert::equalToCanonicalizing(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\equalToIgnoringCase')) { - function equalToIgnoringCase($value) : IsEqualIgnoringCase - { - return \PHPUnit\Framework\Assert::equalToIgnoringCase(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\equalToWithDelta')) { - function equalToWithDelta($value, float $delta) : IsEqualWithDelta - { - return \PHPUnit\Framework\Assert::equalToWithDelta(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\isEmpty')) { - function isEmpty() : IsEmpty - { - return \PHPUnit\Framework\Assert::isEmpty(...func_get_args()); - } -} -if (!function_exists('PHPUnit\\Framework\\isWritable')) { - function isWritable() : IsWritable + /** + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is not the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException + */ + public static function assertNotSameSize($expected, $actual, string $message = ''): void { - return \PHPUnit\Framework\Assert::isWritable(...func_get_args()); + if ($expected instanceof Generator) { + self::createWarning('Passing an argument of type Generator for the $expected parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + } + if ($actual instanceof Generator) { + self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + } + if (!$expected instanceof Countable && !is_iterable($expected)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'countable or iterable'); + } + if (!$actual instanceof Countable && !is_iterable($actual)) { + throw \PHPUnit\Framework\InvalidArgumentException::create(2, 'countable or iterable'); + } + static::assertThat($actual, new LogicalNot(new SameSize($expected)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\isReadable')) { - function isReadable() : IsReadable + /** + * Asserts that a string matches a given format string. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringMatchesFormat(string $format, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::isReadable(...func_get_args()); + static::assertThat($string, new StringMatchesFormatDescription($format), $message); } -} -if (!function_exists('PHPUnit\\Framework\\directoryExists')) { - function directoryExists() : DirectoryExists + /** + * Asserts that a string does not match a given format string. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::directoryExists(...func_get_args()); + static::assertThat($string, new LogicalNot(new StringMatchesFormatDescription($format)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\fileExists')) { - function fileExists() : FileExists + /** + * Asserts that a string matches a given format file. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::fileExists(...func_get_args()); + static::assertFileExists($formatFile, $message); + static::assertThat($string, new StringMatchesFormatDescription(file_get_contents($formatFile)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\greaterThan')) { - function greaterThan($value) : GreaterThan + /** + * Asserts that a string does not match a given format string. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::greaterThan(...func_get_args()); + static::assertFileExists($formatFile, $message); + static::assertThat($string, new LogicalNot(new StringMatchesFormatDescription(file_get_contents($formatFile))), $message); } -} -if (!function_exists('PHPUnit\\Framework\\greaterThanOrEqual')) { - function greaterThanOrEqual($value) : LogicalOr + /** + * Asserts that a string starts with a given prefix. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringStartsWith(string $prefix, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::greaterThanOrEqual(...func_get_args()); + static::assertThat($string, new StringStartsWith($prefix), $message); } -} -if (!function_exists('PHPUnit\\Framework\\classHasAttribute')) { - function classHasAttribute(string $attributeName) : ClassHasAttribute + /** + * Asserts that a string starts not with a given prefix. + * + * @param string $prefix + * @param string $string + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringStartsNotWith($prefix, $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::classHasAttribute(...func_get_args()); + static::assertThat($string, new LogicalNot(new StringStartsWith($prefix)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\classHasStaticAttribute')) { - function classHasStaticAttribute(string $attributeName) : ClassHasStaticAttribute + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringContainsString(string $needle, string $haystack, string $message = ''): void { - return \PHPUnit\Framework\Assert::classHasStaticAttribute(...func_get_args()); + $constraint = new StringContains($needle, \false); + static::assertThat($haystack, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\objectHasAttribute')) { - function objectHasAttribute($attributeName) : ObjectHasAttribute + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void { - return \PHPUnit\Framework\Assert::objectHasAttribute(...func_get_args()); + $constraint = new StringContains($needle, \true); + static::assertThat($haystack, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\identicalTo')) { - function identicalTo($value) : IsIdentical + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void { - return \PHPUnit\Framework\Assert::identicalTo(...func_get_args()); + $constraint = new LogicalNot(new StringContains($needle)); + static::assertThat($haystack, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\isInstanceOf')) { - function isInstanceOf(string $className) : IsInstanceOf + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void { - return \PHPUnit\Framework\Assert::isInstanceOf(...func_get_args()); + $constraint = new LogicalNot(new StringContains($needle, \true)); + static::assertThat($haystack, $constraint, $message); } -} -if (!function_exists('PHPUnit\\Framework\\isType')) { - function isType(string $type) : IsType + /** + * Asserts that a string ends with a given suffix. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringEndsWith(string $suffix, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::isType(...func_get_args()); + static::assertThat($string, new StringEndsWith($suffix), $message); } -} -if (!function_exists('PHPUnit\\Framework\\lessThan')) { - function lessThan($value) : LessThan + /** + * Asserts that a string ends not with a given suffix. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertStringEndsNotWith(string $suffix, string $string, string $message = ''): void { - return \PHPUnit\Framework\Assert::lessThan(...func_get_args()); + static::assertThat($string, new LogicalNot(new StringEndsWith($suffix)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\lessThanOrEqual')) { - function lessThanOrEqual($value) : LogicalOr + /** + * Asserts that two XML files are equal. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * @throws ExpectationFailedException + */ + public static function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void { - return \PHPUnit\Framework\Assert::lessThanOrEqual(...func_get_args()); + $expected = (new XmlLoader())->loadFile($expectedFile); + $actual = (new XmlLoader())->loadFile($actualFile); + static::assertEquals($expected, $actual, $message); } -} -if (!function_exists('PHPUnit\\Framework\\matchesRegularExpression')) { - function matchesRegularExpression(string $pattern) : RegularExpression + /** + * Asserts that two XML files are not equal. + * + * @throws \PHPUnit\Util\Exception + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void { - return \PHPUnit\Framework\Assert::matchesRegularExpression(...func_get_args()); + $expected = (new XmlLoader())->loadFile($expectedFile); + $actual = (new XmlLoader())->loadFile($actualFile); + static::assertNotEquals($expected, $actual, $message); } -} -if (!function_exists('PHPUnit\\Framework\\matches')) { - function matches(string $string) : StringMatchesFormatDescription + /** + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $actualXml + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws Xml\Exception + */ + public static function assertXmlStringEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void { - return \PHPUnit\Framework\Assert::matches(...func_get_args()); + if (!is_string($actualXml)) { + self::createWarning('Passing an argument of type DOMDocument for the $actualXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + $actual = $actualXml; + } else { + $actual = (new XmlLoader())->load($actualXml); + } + $expected = (new XmlLoader())->loadFile($expectedFile); + static::assertEquals($expected, $actual, $message); } -} -if (!function_exists('PHPUnit\\Framework\\stringStartsWith')) { - function stringStartsWith($prefix) : StringStartsWith + /** + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $actualXml + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws Xml\Exception + */ + public static function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void { - return \PHPUnit\Framework\Assert::stringStartsWith(...func_get_args()); + if (!is_string($actualXml)) { + self::createWarning('Passing an argument of type DOMDocument for the $actualXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + $actual = $actualXml; + } else { + $actual = (new XmlLoader())->load($actualXml); + } + $expected = (new XmlLoader())->loadFile($expectedFile); + static::assertNotEquals($expected, $actual, $message); } -} -if (!function_exists('PHPUnit\\Framework\\stringContains')) { - function stringContains(string $string, bool $case = \true) : StringContains + /** + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws Xml\Exception + */ + public static function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = ''): void { - return \PHPUnit\Framework\Assert::stringContains(...func_get_args()); + if (!is_string($expectedXml)) { + self::createWarning('Passing an argument of type DOMDocument for the $expectedXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + $expected = $expectedXml; + } else { + $expected = (new XmlLoader())->load($expectedXml); + } + if (!is_string($actualXml)) { + self::createWarning('Passing an argument of type DOMDocument for the $actualXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + $actual = $actualXml; + } else { + $actual = (new XmlLoader())->load($actualXml); + } + static::assertEquals($expected, $actual, $message); } -} -if (!function_exists('PHPUnit\\Framework\\stringEndsWith')) { - function stringEndsWith(string $suffix) : StringEndsWith + /** + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws Xml\Exception + */ + public static function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, string $message = ''): void { - return \PHPUnit\Framework\Assert::stringEndsWith(...func_get_args()); + if (!is_string($expectedXml)) { + self::createWarning('Passing an argument of type DOMDocument for the $expectedXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + $expected = $expectedXml; + } else { + $expected = (new XmlLoader())->load($expectedXml); + } + if (!is_string($actualXml)) { + self::createWarning('Passing an argument of type DOMDocument for the $actualXml parameter is deprecated. Support for this will be removed in PHPUnit 10.'); + $actual = $actualXml; + } else { + $actual = (new XmlLoader())->load($actualXml); + } + static::assertNotEquals($expected, $actual, $message); } -} -if (!function_exists('PHPUnit\\Framework\\countOf')) { - function countOf(int $count) : Count + /** + * Asserts that a hierarchy of DOMElements matches. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws AssertionFailedError + * @throws ExpectationFailedException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4091 + */ + public static function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = \false, string $message = ''): void { - return \PHPUnit\Framework\Assert::countOf(...func_get_args()); + self::createWarning('assertEqualXMLStructure() is deprecated and will be removed in PHPUnit 10.'); + $expectedElement = Xml::import($expectedElement); + $actualElement = Xml::import($actualElement); + static::assertSame($expectedElement->tagName, $actualElement->tagName, $message); + if ($checkAttributes) { + static::assertSame($expectedElement->attributes->length, $actualElement->attributes->length, sprintf('%s%sNumber of attributes on node "%s" does not match', $message, (!empty($message)) ? "\n" : '', $expectedElement->tagName)); + for ($i = 0; $i < $expectedElement->attributes->length; $i++) { + $expectedAttribute = $expectedElement->attributes->item($i); + $actualAttribute = $actualElement->attributes->getNamedItem($expectedAttribute->name); + assert($expectedAttribute instanceof DOMAttr); + if (!$actualAttribute) { + static::fail(sprintf('%s%sCould not find attribute "%s" on node "%s"', $message, (!empty($message)) ? "\n" : '', $expectedAttribute->name, $expectedElement->tagName)); + } + } + } + Xml::removeCharacterDataNodes($expectedElement); + Xml::removeCharacterDataNodes($actualElement); + static::assertSame($expectedElement->childNodes->length, $actualElement->childNodes->length, sprintf('%s%sNumber of child nodes of "%s" differs', $message, (!empty($message)) ? "\n" : '', $expectedElement->tagName)); + for ($i = 0; $i < $expectedElement->childNodes->length; $i++) { + static::assertEqualXMLStructure($expectedElement->childNodes->item($i), $actualElement->childNodes->item($i), $checkAttributes, $message); + } } -} -if (!function_exists('PHPUnit\\Framework\\objectEquals')) { - function objectEquals(object $object, string $method = 'equals') : ObjectEquals + /** + * Evaluates a PHPUnit\Framework\Constraint matcher object. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + */ + public static function assertThat($value, Constraint $constraint, string $message = ''): void { - return \PHPUnit\Framework\Assert::objectEquals(...func_get_args()); + self::$count += count($constraint); + $constraint->evaluate($value, $message); } -} -if (!function_exists('PHPUnit\\Framework\\any')) { /** - * Returns a matcher that matches when the method is executed - * zero or more times. + * Asserts that a string is a valid JSON string. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - function any() : AnyInvokedCountMatcher + public static function assertJson(string $actualJson, string $message = ''): void { - return new AnyInvokedCountMatcher(); + static::assertThat($actualJson, static::isJson(), $message); } -} -if (!function_exists('PHPUnit\\Framework\\never')) { /** - * Returns a matcher that matches when the method is never executed. + * Asserts that two given JSON encoded objects or arrays are equal. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - function never() : InvokedCountMatcher + public static function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void { - return new InvokedCountMatcher(0); + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + static::assertThat($actualJson, new JsonMatches($expectedJson), $message); } -} -if (!function_exists('PHPUnit\\Framework\\atLeast')) { /** - * Returns a matcher that matches when the method is executed - * at least N times. + * Asserts that two given JSON encoded objects or arrays are not equal. + * + * @param string $expectedJson + * @param string $actualJson + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - function atLeast(int $requiredInvocations) : InvokedAtLeastCountMatcher + public static function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, string $message = ''): void { - return new InvokedAtLeastCountMatcher($requiredInvocations); + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + static::assertThat($actualJson, new LogicalNot(new JsonMatches($expectedJson)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\atLeastOnce')) { /** - * Returns a matcher that matches when the method is executed at least once. + * Asserts that the generated JSON encoded object and the content of the given file are equal. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - function atLeastOnce() : InvokedAtLeastOnceMatcher + public static function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void { - return new InvokedAtLeastOnceMatcher(); + static::assertFileExists($expectedFile, $message); + $expectedJson = file_get_contents($expectedFile); + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + static::assertThat($actualJson, new JsonMatches($expectedJson), $message); } -} -if (!function_exists('PHPUnit\\Framework\\once')) { /** - * Returns a matcher that matches when the method is executed exactly once. + * Asserts that the generated JSON encoded object and the content of the given file are not equal. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - function once() : InvokedCountMatcher + public static function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void { - return new InvokedCountMatcher(1); + static::assertFileExists($expectedFile, $message); + $expectedJson = file_get_contents($expectedFile); + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + static::assertThat($actualJson, new LogicalNot(new JsonMatches($expectedJson)), $message); } -} -if (!function_exists('PHPUnit\\Framework\\exactly')) { /** - * Returns a matcher that matches when the method is executed - * exactly $count times. + * Asserts that two JSON files are equal. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - function exactly(int $count) : InvokedCountMatcher + public static function assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void { - return new InvokedCountMatcher($count); + static::assertFileExists($expectedFile, $message); + static::assertFileExists($actualFile, $message); + $actualJson = file_get_contents($actualFile); + $expectedJson = file_get_contents($expectedFile); + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + $constraintExpected = new JsonMatches($expectedJson); + $constraintActual = new JsonMatches($actualJson); + static::assertThat($expectedJson, $constraintActual, $message); + static::assertThat($actualJson, $constraintExpected, $message); } -} -if (!function_exists('PHPUnit\\Framework\\atMost')) { /** - * Returns a matcher that matches when the method is executed - * at most N times. + * Asserts that two JSON files are not equal. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - function atMost(int $allowedInvocations) : InvokedAtMostCountMatcher + public static function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void { - return new InvokedAtMostCountMatcher($allowedInvocations); + static::assertFileExists($expectedFile, $message); + static::assertFileExists($actualFile, $message); + $actualJson = file_get_contents($actualFile); + $expectedJson = file_get_contents($expectedFile); + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + $constraintExpected = new JsonMatches($expectedJson); + $constraintActual = new JsonMatches($actualJson); + static::assertThat($expectedJson, new LogicalNot($constraintActual), $message); + static::assertThat($actualJson, new LogicalNot($constraintExpected), $message); } -} -if (!function_exists('PHPUnit\\Framework\\at')) { /** - * Returns a matcher that matches when the method is executed - * at the given index. + * @throws Exception */ - function at(int $index) : InvokedAtIndexMatcher + public static function logicalAnd(): LogicalAnd { - return new InvokedAtIndexMatcher($index); + $constraints = func_get_args(); + $constraint = new LogicalAnd(); + $constraint->setConstraints($constraints); + return $constraint; } -} -if (!function_exists('PHPUnit\\Framework\\returnValue')) { - function returnValue($value) : ReturnStub + public static function logicalOr(): LogicalOr { - return new ReturnStub($value); + $constraints = func_get_args(); + $constraint = new LogicalOr(); + $constraint->setConstraints($constraints); + return $constraint; } -} -if (!function_exists('PHPUnit\\Framework\\returnValueMap')) { - function returnValueMap(array $valueMap) : ReturnValueMapStub + public static function logicalNot(Constraint $constraint): LogicalNot { - return new ReturnValueMapStub($valueMap); + return new LogicalNot($constraint); } -} -if (!function_exists('PHPUnit\\Framework\\returnArgument')) { - function returnArgument(int $argumentIndex) : ReturnArgumentStub + public static function logicalXor(): LogicalXor { - return new ReturnArgumentStub($argumentIndex); + $constraints = func_get_args(); + $constraint = new LogicalXor(); + $constraint->setConstraints($constraints); + return $constraint; } -} -if (!function_exists('PHPUnit\\Framework\\returnCallback')) { - function returnCallback($callback) : ReturnCallbackStub + public static function anything(): IsAnything { - return new ReturnCallbackStub($callback); + return new IsAnything(); + } + public static function isTrue(): IsTrue + { + return new IsTrue(); } -} -if (!function_exists('PHPUnit\\Framework\\returnSelf')) { /** - * Returns the current object. + * @psalm-template CallbackInput of mixed * - * This method is useful when mocking a fluent interface. + * @psalm-param callable(CallbackInput $callback): bool $callback + * + * @psalm-return Callback */ - function returnSelf() : ReturnSelfStub + public static function callback(callable $callback): Callback { - return new ReturnSelfStub(); + return new Callback($callback); } -} -if (!function_exists('PHPUnit\\Framework\\throwException')) { - function throwException(Throwable $exception) : ExceptionStub + public static function isFalse(): IsFalse { - return new ExceptionStub($exception); + return new IsFalse(); } -} -if (!function_exists('PHPUnit\\Framework\\onConsecutiveCalls')) { - function onConsecutiveCalls() : ConsecutiveCallsStub + public static function isJson(): IsJson { - $args = func_get_args(); - return new ConsecutiveCallsStub($args); + return new IsJson(); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsFalse extends \PHPUnit\Framework\Constraint\Constraint -{ - /** - * Returns a string representation of the constraint. - */ - public function toString() : string + public static function isNull(): IsNull { - return 'is false'; + return new IsNull(); } - /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. - * - * @param mixed $other value or object to evaluate - */ - protected function matches($other) : bool + public static function isFinite(): IsFinite { - return $other === \false; + return new IsFinite(); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsTrue extends \PHPUnit\Framework\Constraint\Constraint -{ - /** - * Returns a string representation of the constraint. - */ - public function toString() : string + public static function isInfinite(): IsInfinite { - return 'is true'; + return new IsInfinite(); } - /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. - * - * @param mixed $other value or object to evaluate - */ - protected function matches($other) : bool + public static function isNan(): IsNan { - return $other === \true; + return new IsNan(); + } + public static function containsEqual($value): TraversableContainsEqual + { + return new TraversableContainsEqual($value); + } + public static function containsIdentical($value): TraversableContainsIdentical + { + return new TraversableContainsIdentical($value); + } + public static function containsOnly(string $type): TraversableContainsOnly + { + return new TraversableContainsOnly($type); + } + public static function containsOnlyInstancesOf(string $className): TraversableContainsOnly + { + return new TraversableContainsOnly($className, \false); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @psalm-template CallbackInput of mixed - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class Callback extends \PHPUnit\Framework\Constraint\Constraint -{ /** - * @var callable - * - * @psalm-var callable(CallbackInput $input): bool + * @param int|string $key */ - private $callback; - /** @psalm-param callable(CallbackInput $input): bool $callback */ - public function __construct(callable $callback) + public static function arrayHasKey($key): ArrayHasKey { - $this->callback = $callback; + return new ArrayHasKey($key); + } + public static function equalTo($value): IsEqual + { + return new IsEqual($value, 0.0, \false, \false); + } + public static function equalToCanonicalizing($value): IsEqualCanonicalizing + { + return new IsEqualCanonicalizing($value); + } + public static function equalToIgnoringCase($value): IsEqualIgnoringCase + { + return new IsEqualIgnoringCase($value); + } + public static function equalToWithDelta($value, float $delta): IsEqualWithDelta + { + return new IsEqualWithDelta($value, $delta); + } + public static function isEmpty(): IsEmpty + { + return new IsEmpty(); + } + public static function isWritable(): IsWritable + { + return new IsWritable(); + } + public static function isReadable(): IsReadable + { + return new IsReadable(); + } + public static function directoryExists(): DirectoryExists + { + return new DirectoryExists(); + } + public static function fileExists(): FileExists + { + return new FileExists(); + } + public static function greaterThan($value): GreaterThan + { + return new GreaterThan($value); + } + public static function greaterThanOrEqual($value): LogicalOr + { + return static::logicalOr(new IsEqual($value), new GreaterThan($value)); } /** - * Returns a string representation of the constraint. + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - public function toString() : string + public static function classHasAttribute(string $attributeName): ClassHasAttribute { - return 'is accepted by specified callback'; + self::createWarning('classHasAttribute() is deprecated and will be removed in PHPUnit 10.'); + return new ClassHasAttribute($attributeName); } /** - * Evaluates the constraint for parameter $value. Returns true if the - * constraint is met, false otherwise. - * - * @param mixed $other value or object to evaluate - * - * @psalm-param CallbackInput $other + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - protected function matches($other) : bool + public static function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute { - return ($this->callback)($other); + self::createWarning('classHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.'); + return new ClassHasStaticAttribute($attributeName); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function count; -use function is_array; -use function iterator_count; -use function sprintf; -use Countable; -use EmptyIterator; -use Generator; -use Iterator; -use IteratorAggregate; -use PHPUnit\Framework\Exception; -use Traversable; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -class Count extends \PHPUnit\Framework\Constraint\Constraint -{ /** - * @var int + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ - private $expectedCount; - public function __construct(int $expected) + public static function objectHasAttribute($attributeName): ObjectHasAttribute { - $this->expectedCount = $expected; + self::createWarning('objectHasAttribute() is deprecated and will be removed in PHPUnit 10.'); + return new ObjectHasAttribute($attributeName); } - public function toString() : string + public static function identicalTo($value): IsIdentical { - return sprintf('count matches %d', $this->expectedCount); + return new IsIdentical($value); } - /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. - * - * @throws Exception - */ - protected function matches($other) : bool + public static function isInstanceOf(string $className): IsInstanceOf { - return $this->expectedCount === $this->getCountOf($other); + return new IsInstanceOf($className); } - /** - * @throws Exception - */ - protected function getCountOf($other) : ?int + public static function isType(string $type): IsType { - if ($other instanceof Countable || is_array($other)) { - return count($other); - } - if ($other instanceof EmptyIterator) { - return 0; - } - if ($other instanceof Traversable) { - while ($other instanceof IteratorAggregate) { - try { - $other = $other->getIterator(); - } catch (\Exception $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - } - $iterator = $other; - if ($iterator instanceof Generator) { - return $this->getCountOfGenerator($iterator); - } - if (!$iterator instanceof Iterator) { - return iterator_count($iterator); - } - $key = $iterator->key(); - $count = iterator_count($iterator); - // Manually rewind $iterator to previous key, since iterator_count - // moves pointer. - if ($key !== null) { - $iterator->rewind(); - while ($iterator->valid() && $key !== $iterator->key()) { - $iterator->next(); - } - } - return $count; - } - return null; + return new IsType($type); + } + public static function lessThan($value): LessThan + { + return new LessThan($value); + } + public static function lessThanOrEqual($value): LogicalOr + { + return static::logicalOr(new IsEqual($value), new LessThan($value)); + } + public static function matchesRegularExpression(string $pattern): RegularExpression + { + return new RegularExpression($pattern); + } + public static function matches(string $string): StringMatchesFormatDescription + { + return new StringMatchesFormatDescription($string); + } + public static function stringStartsWith($prefix): StringStartsWith + { + return new StringStartsWith($prefix); + } + public static function stringContains(string $string, bool $case = \true): StringContains + { + return new StringContains($string, $case); + } + public static function stringEndsWith(string $suffix): StringEndsWith + { + return new StringEndsWith($suffix); + } + public static function countOf(int $count): Count + { + return new Count($count); + } + public static function objectEquals(object $object, string $method = 'equals'): ObjectEquals + { + return new ObjectEquals($object, $method); } /** - * Returns the total number of iterations from a generator. - * This will fully exhaust the generator. + * Fails a test with the given message. + * + * @throws AssertionFailedError + * + * @psalm-return never-return */ - protected function getCountOfGenerator(Generator $generator) : int + public static function fail(string $message = ''): void { - for ($count = 0; $generator->valid(); $generator->next()) { - $count++; - } - return $count; + self::$count++; + throw new \PHPUnit\Framework\AssertionFailedError($message); } /** - * Returns the description of the failure. + * Mark the test as incomplete. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws IncompleteTestError * - * @param mixed $other evaluated value or object + * @psalm-return never-return */ - protected function failureDescription($other) : string + public static function markTestIncomplete(string $message = ''): void { - return sprintf('actual size %d matches expected size %d', (int) $this->getCountOf($other), $this->expectedCount); + throw new \PHPUnit\Framework\IncompleteTestError($message); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class GreaterThan extends \PHPUnit\Framework\Constraint\Constraint -{ /** - * @var float|int + * Mark the test as skipped. + * + * @throws SkippedTestError + * @throws SyntheticSkippedError + * + * @psalm-return never-return */ - private $value; + public static function markTestSkipped(string $message = ''): void + { + if ($hint = self::detectLocationHint($message)) { + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + array_unshift($trace, $hint); + throw new \PHPUnit\Framework\SyntheticSkippedError($hint['message'], 0, $hint['file'], (int) $hint['line'], $trace); + } + throw new \PHPUnit\Framework\SkippedTestError($message); + } /** - * @param float|int $value + * Return the current assertion count. */ - public function __construct($value) + public static function getCount(): int { - $this->value = $value; + return self::$count; } /** - * Returns a string representation of the constraint. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Reset the assertion counter. */ - public function toString() : string + public static function resetCount(): void { - return 'is greater than ' . $this->exporter()->export($this->value); + self::$count = 0; + } + private static function detectLocationHint(string $message): ?array + { + $hint = null; + $lines = preg_split('/\r\n|\r|\n/', $message); + while (strpos($lines[0], '__OFFSET') !== \false) { + $offset = explode('=', array_shift($lines)); + if ($offset[0] === '__OFFSET_FILE') { + $hint['file'] = $offset[1]; + } + if ($offset[0] === '__OFFSET_LINE') { + $hint['line'] = $offset[1]; + } + } + if ($hint) { + $hint['message'] = implode(PHP_EOL, $lines); + } + return $hint; + } + private static function isValidObjectAttributeName(string $attributeName): bool + { + return (bool) preg_match('/[^\x00-\x1f\x7f-\x9f]+/', $attributeName); + } + private static function isValidClassAttributeName(string $attributeName): bool + { + return (bool) preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/', $attributeName); } /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. - * - * @param mixed $other value or object to evaluate + * @codeCoverageIgnore */ - protected function matches($other) : bool + private static function createWarning(string $warning): void { - return $this->value < $other; + foreach (debug_backtrace() as $step) { + if (isset($step['object']) && $step['object'] instanceof \PHPUnit\Framework\TestCase) { + assert($step['object'] instanceof \PHPUnit\Framework\TestCase); + $step['object']->addWarning($warning); + break; + } + } } } toString()); + \PHPUnit\Framework\Assert::assertContains(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class LessThan extends \PHPUnit\Framework\Constraint\Constraint -{ - /** - * @var float|int - */ - private $value; +if (!function_exists('PHPUnit\Framework\assertContainsEquals')) { + function assertContainsEquals($needle, iterable $haystack, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertContainsEquals(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertNotContains')) { /** - * @param float|int $value + * Asserts that a haystack does not contain a needle. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotContains */ - public function __construct($value) + function assertNotContains($needle, iterable $haystack, string $message = ''): void { - $this->value = $value; + \PHPUnit\Framework\Assert::assertNotContains(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertNotContainsEquals')) { + function assertNotContainsEquals($needle, iterable $haystack, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertNotContainsEquals(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertContainsOnly')) { /** - * Returns a string representation of the constraint. + * Asserts that a haystack contains only values of a given type. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertContainsOnly */ - public function toString() : string + function assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void { - return 'is less than ' . $this->exporter()->export($this->value); + \PHPUnit\Framework\Assert::assertContainsOnly(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertContainsOnlyInstancesOf')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a haystack contains only instances of a given class name. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertContainsOnlyInstancesOf */ - protected function matches($other) : bool + function assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = ''): void { - return $this->value > $other; + \PHPUnit\Framework\Assert::assertContainsOnlyInstancesOf(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class SameSize extends \PHPUnit\Framework\Constraint\Count -{ - public function __construct(iterable $expected) +if (!function_exists('PHPUnit\Framework\assertNotContainsOnly')) { + /** + * Asserts that a haystack does not contain only values of a given type. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotContainsOnly + */ + function assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void { - parent::__construct((int) $this->getCountOf($expected)); + \PHPUnit\Framework\Assert::assertNotContainsOnly(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function sprintf; -use Countable; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Framework\SelfDescribing; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -use PHPUnit\SebastianBergmann\Exporter\Exporter; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -abstract class Constraint implements Countable, SelfDescribing -{ - /** - * @var ?Exporter - */ - private $exporter; +if (!function_exists('PHPUnit\Framework\assertCount')) { /** - * Evaluates the constraint for parameter $other. - * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. + * Asserts the number of elements of an array, Countable or Traversable. * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. + * @param Countable|iterable $haystack * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertCount */ - public function evaluate($other, string $description = '', bool $returnResult = \false) : ?bool + function assertCount(int $expectedCount, $haystack, string $message = ''): void { - $success = \false; - if ($this->matches($other)) { - $success = \true; - } - if ($returnResult) { - return $success; - } - if (!$success) { - $this->fail($other, $description); - } - return null; + \PHPUnit\Framework\Assert::assertCount(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotCount')) { /** - * Counts the number of constraint elements. + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param Countable|iterable $haystack + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotCount */ - public function count() : int + function assertNotCount(int $expectedCount, $haystack, string $message = ''): void { - return 1; + \PHPUnit\Framework\Assert::assertNotCount(...func_get_args()); } - protected function exporter() : Exporter +} +if (!function_exists('PHPUnit\Framework\assertEquals')) { + /** + * Asserts that two variables are equal. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertEquals + */ + function assertEquals($expected, $actual, string $message = ''): void { - if ($this->exporter === null) { - $this->exporter = new Exporter(); - } - return $this->exporter; + \PHPUnit\Framework\Assert::assertEquals(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertEqualsCanonicalizing')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that two variables are equal (canonicalizing). * - * This method can be overridden to implement the evaluation algorithm. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other value or object to evaluate + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @codeCoverageIgnore + * @see Assert::assertEqualsCanonicalizing */ - protected function matches($other) : bool + function assertEqualsCanonicalizing($expected, $actual, string $message = ''): void { - return \false; + \PHPUnit\Framework\Assert::assertEqualsCanonicalizing(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertEqualsIgnoringCase')) { /** - * Throws an exception for the given compared value and test description. - * - * @param mixed $other evaluated value or object - * @param string $description Additional information about the test + * Asserts that two variables are equal (ignoring case). * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @psalm-return never-return + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertEqualsIgnoringCase */ - protected function fail($other, $description, ComparisonFailure $comparisonFailure = null) : void + function assertEqualsIgnoringCase($expected, $actual, string $message = ''): void { - $failureDescription = sprintf('Failed asserting that %s.', $this->failureDescription($other)); - $additionalFailureDescription = $this->additionalFailureDescription($other); - if ($additionalFailureDescription) { - $failureDescription .= "\n" . $additionalFailureDescription; - } - if (!empty($description)) { - $failureDescription = $description . "\n" . $failureDescription; - } - throw new ExpectationFailedException($failureDescription, $comparisonFailure); + \PHPUnit\Framework\Assert::assertEqualsIgnoringCase(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertEqualsWithDelta')) { /** - * Return additional failure description where needed. + * Asserts that two variables are equal (with delta). * - * The function can be overridden to provide additional failure - * information like a diff + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertEqualsWithDelta */ - protected function additionalFailureDescription($other) : string + function assertEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void { - return ''; + \PHPUnit\Framework\Assert::assertEqualsWithDelta(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotEquals')) { /** - * Returns the description of the failure. - * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * Asserts that two variables are not equal. * - * To provide additional failure information additionalFailureDescription - * can be used. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @see Assert::assertNotEquals */ - protected function failureDescription($other) : string + function assertNotEquals($expected, $actual, string $message = ''): void { - return $this->exporter()->export($other) . ' ' . $this->toString(); + \PHPUnit\Framework\Assert::assertNotEquals(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotEqualsCanonicalizing')) { /** - * Returns a custom string representation of the constraint object when it - * appears in context of an $operator expression. + * Asserts that two variables are not equal (canonicalizing). * - * The purpose of this method is to provide meaningful descriptive string - * in context of operators such as LogicalNot. Native PHPUnit constraints - * are supported out of the box by LogicalNot, but externally developed - * ones had no way to provide correct strings in this context. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * The method shall return empty string, when it does not handle - * customization by itself. + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @param Operator $operator the $operator of the expression - * @param mixed $role role of $this constraint in the $operator expression + * @see Assert::assertNotEqualsCanonicalizing */ - protected function toStringInContext(\PHPUnit\Framework\Constraint\Operator $operator, $role) : string + function assertNotEqualsCanonicalizing($expected, $actual, string $message = ''): void { - return ''; + \PHPUnit\Framework\Assert::assertNotEqualsCanonicalizing(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotEqualsIgnoringCase')) { /** - * Returns the description of the failure when this constraint appears in - * context of an $operator expression. + * Asserts that two variables are not equal (ignoring case). * - * The purpose of this method is to provide meaningful failure description - * in context of operators such as LogicalNot. Native PHPUnit constraints - * are supported out of the box by LogicalNot, but externally developed - * ones had no way to provide correct messages in this context. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * The method shall return empty string, when it does not handle - * customization by itself. + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @param Operator $operator the $operator of the expression - * @param mixed $role role of $this constraint in the $operator expression - * @param mixed $other evaluated value or object + * @see Assert::assertNotEqualsIgnoringCase */ - protected function failureDescriptionInContext(\PHPUnit\Framework\Constraint\Operator $operator, $role, $other) : string + function assertNotEqualsIgnoringCase($expected, $actual, string $message = ''): void { - $string = $this->toStringInContext($operator, $role); - if ($string === '') { - return ''; - } - return $this->exporter()->export($other) . ' ' . $string; + \PHPUnit\Framework\Assert::assertNotEqualsIgnoringCase(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotEqualsWithDelta')) { /** - * Reduces the sub-expression starting at $this by skipping degenerate - * sub-expression and returns first descendant constraint that starts - * a non-reducible sub-expression. - * - * Returns $this for terminal constraints and for operators that start - * non-reducible sub-expression, or the nearest descendant of $this that - * starts a non-reducible sub-expression. + * Asserts that two variables are not equal (with delta). * - * A constraint expression may be modelled as a tree with non-terminal - * nodes (operators) and terminal nodes. For example: + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * LogicalOr (operator, non-terminal) - * + LogicalAnd (operator, non-terminal) - * | + IsType('int') (terminal) - * | + GreaterThan(10) (terminal) - * + LogicalNot (operator, non-terminal) - * + IsType('array') (terminal) + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * A degenerate sub-expression is a part of the tree, that effectively does - * not contribute to the evaluation of the expression it appears in. An example - * of degenerate sub-expression is a BinaryOperator constructed with single - * operand or nested BinaryOperators, each with single operand. An - * expression involving a degenerate sub-expression is equivalent to a - * reduced expression with the degenerate sub-expression removed, for example + * @see Assert::assertNotEqualsWithDelta + */ + function assertNotEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertNotEqualsWithDelta(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertObjectEquals')) { + /** + * @throws ExpectationFailedException * - * LogicalAnd (operator) - * + LogicalOr (degenerate operator) - * | + LogicalAnd (degenerate operator) - * | + IsType('int') (terminal) - * + GreaterThan(10) (terminal) + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * is equivalent to + * @see Assert::assertObjectEquals + */ + function assertObjectEquals(object $expected, object $actual, string $method = 'equals', string $message = ''): void + { + \PHPUnit\Framework\Assert::assertObjectEquals(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertEmpty')) { + /** + * Asserts that a variable is empty. * - * LogicalAnd (operator) - * + IsType('int') (terminal) - * + GreaterThan(10) (terminal) + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * because the subexpression + * @psalm-assert empty $actual * - * + LogicalOr - * + LogicalAnd - * + - + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * is degenerate. Calling reduce() on the LogicalOr object above, as well - * as on LogicalAnd, shall return the IsType('int') instance. + * @see Assert::assertEmpty + */ + function assertEmpty($actual, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertEmpty(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertNotEmpty')) { + /** + * Asserts that a variable is not empty. * - * Other specific reductions can be implemented, for example cascade of - * LogicalNot operators + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * + LogicalNot - * + LogicalNot - * +LogicalNot - * + IsTrue + * @psalm-assert !empty $actual * - * can be reduced to + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * LogicalNot - * + IsTrue + * @see Assert::assertNotEmpty */ - protected function reduce() : self + function assertNotEmpty($actual, string $message = ''): void { - return $this; + \PHPUnit\Framework\Assert::assertNotEmpty(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_string; -use function sprintf; -use function strpos; -use function trim; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -use PHPUnit\SebastianBergmann\Comparator\Factory as ComparatorFactory; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsEqual extends \PHPUnit\Framework\Constraint\Constraint -{ - /** - * @var mixed - */ - private $value; +if (!function_exists('PHPUnit\Framework\assertGreaterThan')) { /** - * @var float + * Asserts that a value is greater than another value. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertGreaterThan */ - private $delta; + function assertGreaterThan($expected, $actual, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertGreaterThan(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertGreaterThanOrEqual')) { /** - * @var bool + * Asserts that a value is greater than or equal to another value. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertGreaterThanOrEqual */ - private $canonicalize; + function assertGreaterThanOrEqual($expected, $actual, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertGreaterThanOrEqual(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertLessThan')) { /** - * @var bool + * Asserts that a value is smaller than another value. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertLessThan */ - private $ignoreCase; - public function __construct($value, float $delta = 0.0, bool $canonicalize = \false, bool $ignoreCase = \false) + function assertLessThan($expected, $actual, string $message = ''): void { - $this->value = $value; - $this->delta = $delta; - $this->canonicalize = $canonicalize; - $this->ignoreCase = $ignoreCase; + \PHPUnit\Framework\Assert::assertLessThan(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertLessThanOrEqual')) { /** - * Evaluates the constraint for parameter $other. + * Asserts that a value is smaller than or equal to another value. * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @throws ExpectationFailedException + * @see Assert::assertLessThanOrEqual */ - public function evaluate($other, string $description = '', bool $returnResult = \false) : ?bool + function assertLessThanOrEqual($expected, $actual, string $message = ''): void { - // If $this->value and $other are identical, they are also equal. - // This is the most common path and will allow us to skip - // initialization of all the comparators. - if ($this->value === $other) { - return \true; - } - $comparatorFactory = ComparatorFactory::getInstance(); - try { - $comparator = $comparatorFactory->getComparatorFor($this->value, $other); - $comparator->assertEquals($this->value, $other, $this->delta, $this->canonicalize, $this->ignoreCase); - } catch (ComparisonFailure $f) { - if ($returnResult) { - return \false; - } - throw new ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f); - } - return \true; + \PHPUnit\Framework\Assert::assertLessThanOrEqual(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileEquals')) { /** - * Returns a string representation of the constraint. + * Asserts that the contents of one file is equal to the contents of another + * file. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileEquals */ - public function toString() : string + function assertFileEquals(string $expected, string $actual, string $message = ''): void { - $delta = ''; - if (is_string($this->value)) { - if (strpos($this->value, "\n") !== \false) { - return 'is equal to '; - } - return sprintf("is equal to '%s'", $this->value); - } - if ($this->delta != 0) { - $delta = sprintf(' with delta <%F>', $this->delta); - } - return sprintf('is equal to %s%s', $this->exporter()->export($this->value), $delta); + \PHPUnit\Framework\Assert::assertFileEquals(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_string; -use function sprintf; -use function strpos; -use function trim; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -use PHPUnit\SebastianBergmann\Comparator\Factory as ComparatorFactory; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsEqualCanonicalizing extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertFileEqualsCanonicalizing')) { /** - * @var mixed + * Asserts that the contents of one file is equal to the contents of another + * file (canonicalizing). + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileEqualsCanonicalizing */ - private $value; - public function __construct($value) + function assertFileEqualsCanonicalizing(string $expected, string $actual, string $message = ''): void { - $this->value = $value; + \PHPUnit\Framework\Assert::assertFileEqualsCanonicalizing(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileEqualsIgnoringCase')) { /** - * Evaluates the constraint for parameter $other. + * Asserts that the contents of one file is equal to the contents of another + * file (ignoring case). * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @throws ExpectationFailedException + * @see Assert::assertFileEqualsIgnoringCase */ - public function evaluate($other, string $description = '', bool $returnResult = \false) : ?bool + function assertFileEqualsIgnoringCase(string $expected, string $actual, string $message = ''): void { - // If $this->value and $other are identical, they are also equal. - // This is the most common path and will allow us to skip - // initialization of all the comparators. - if ($this->value === $other) { - return \true; - } - $comparatorFactory = ComparatorFactory::getInstance(); - try { - $comparator = $comparatorFactory->getComparatorFor($this->value, $other); - $comparator->assertEquals($this->value, $other, 0.0, \true, \false); - } catch (ComparisonFailure $f) { - if ($returnResult) { - return \false; - } - throw new ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f); - } - return \true; + \PHPUnit\Framework\Assert::assertFileEqualsIgnoringCase(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileNotEquals')) { /** - * Returns a string representation of the constraint. + * Asserts that the contents of one file is not equal to the contents of + * another file. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileNotEquals */ - public function toString() : string + function assertFileNotEquals(string $expected, string $actual, string $message = ''): void { - if (is_string($this->value)) { - if (strpos($this->value, "\n") !== \false) { - return 'is equal to '; - } - return sprintf("is equal to '%s'", $this->value); - } - return sprintf('is equal to %s', $this->exporter()->export($this->value)); + \PHPUnit\Framework\Assert::assertFileNotEquals(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_string; -use function sprintf; -use function strpos; -use function trim; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -use PHPUnit\SebastianBergmann\Comparator\Factory as ComparatorFactory; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsEqualIgnoringCase extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertFileNotEqualsCanonicalizing')) { /** - * @var mixed + * Asserts that the contents of one file is not equal to the contents of another + * file (canonicalizing). + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileNotEqualsCanonicalizing */ - private $value; - public function __construct($value) + function assertFileNotEqualsCanonicalizing(string $expected, string $actual, string $message = ''): void { - $this->value = $value; + \PHPUnit\Framework\Assert::assertFileNotEqualsCanonicalizing(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileNotEqualsIgnoringCase')) { /** - * Evaluates the constraint for parameter $other. + * Asserts that the contents of one file is not equal to the contents of another + * file (ignoring case). * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @throws ExpectationFailedException + * @see Assert::assertFileNotEqualsIgnoringCase */ - public function evaluate($other, string $description = '', bool $returnResult = \false) : ?bool + function assertFileNotEqualsIgnoringCase(string $expected, string $actual, string $message = ''): void { - // If $this->value and $other are identical, they are also equal. - // This is the most common path and will allow us to skip - // initialization of all the comparators. - if ($this->value === $other) { - return \true; - } - $comparatorFactory = ComparatorFactory::getInstance(); - try { - $comparator = $comparatorFactory->getComparatorFor($this->value, $other); - $comparator->assertEquals($this->value, $other, 0.0, \false, \true); - } catch (ComparisonFailure $f) { - if ($returnResult) { - return \false; - } - throw new ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f); - } - return \true; + \PHPUnit\Framework\Assert::assertFileNotEqualsIgnoringCase(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringEqualsFile')) { /** - * Returns a string representation of the constraint. + * Asserts that the contents of a string is equal + * to the contents of a file. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringEqualsFile */ - public function toString() : string + function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = ''): void { - if (is_string($this->value)) { - if (strpos($this->value, "\n") !== \false) { - return 'is equal to '; - } - return sprintf("is equal to '%s'", $this->value); - } - return sprintf('is equal to %s', $this->exporter()->export($this->value)); + \PHPUnit\Framework\Assert::assertStringEqualsFile(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function sprintf; -use function trim; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -use PHPUnit\SebastianBergmann\Comparator\Factory as ComparatorFactory; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsEqualWithDelta extends \PHPUnit\Framework\Constraint\Constraint -{ - /** - * @var mixed - */ - private $value; +if (!function_exists('PHPUnit\Framework\assertStringEqualsFileCanonicalizing')) { /** - * @var float + * Asserts that the contents of a string is equal + * to the contents of a file (canonicalizing). + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringEqualsFileCanonicalizing */ - private $delta; - public function __construct($value, float $delta) + function assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = ''): void { - $this->value = $value; - $this->delta = $delta; + \PHPUnit\Framework\Assert::assertStringEqualsFileCanonicalizing(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringEqualsFileIgnoringCase')) { /** - * Evaluates the constraint for parameter $other. + * Asserts that the contents of a string is equal + * to the contents of a file (ignoring case). * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @throws ExpectationFailedException + * @see Assert::assertStringEqualsFileIgnoringCase */ - public function evaluate($other, string $description = '', bool $returnResult = \false) : ?bool + function assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = ''): void { - // If $this->value and $other are identical, they are also equal. - // This is the most common path and will allow us to skip - // initialization of all the comparators. - if ($this->value === $other) { - return \true; - } - $comparatorFactory = ComparatorFactory::getInstance(); - try { - $comparator = $comparatorFactory->getComparatorFor($this->value, $other); - $comparator->assertEquals($this->value, $other, $this->delta); - } catch (ComparisonFailure $f) { - if ($returnResult) { - return \false; - } - throw new ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f); - } - return \true; + \PHPUnit\Framework\Assert::assertStringEqualsFileIgnoringCase(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringNotEqualsFile')) { /** - * Returns a string representation of the constraint. + * Asserts that the contents of a string is not equal + * to the contents of a file. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringNotEqualsFile */ - public function toString() : string + function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = ''): void { - return sprintf('is equal to %s with delta <%F>', $this->exporter()->export($this->value), $this->delta); + \PHPUnit\Framework\Assert::assertStringNotEqualsFile(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function get_class; -use function sprintf; -use PHPUnit\Util\Filter; -use Throwable; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class Exception extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertStringNotEqualsFileCanonicalizing')) { /** - * @var string + * Asserts that the contents of a string is not equal + * to the contents of a file (canonicalizing). + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringNotEqualsFileCanonicalizing */ - private $className; - public function __construct(string $className) + function assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = ''): void { - $this->className = $className; + \PHPUnit\Framework\Assert::assertStringNotEqualsFileCanonicalizing(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringNotEqualsFileIgnoringCase')) { /** - * Returns a string representation of the constraint. + * Asserts that the contents of a string is not equal + * to the contents of a file (ignoring case). + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringNotEqualsFileIgnoringCase */ - public function toString() : string + function assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = ''): void { - return sprintf('exception of type "%s"', $this->className); + \PHPUnit\Framework\Assert::assertStringNotEqualsFileIgnoringCase(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsReadable')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a file/dir is readable. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsReadable */ - protected function matches($other) : bool + function assertIsReadable(string $filename, string $message = ''): void { - return $other instanceof $this->className; + \PHPUnit\Framework\Assert::assertIsReadable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotReadable')) { /** - * Returns the description of the failure. + * Asserts that a file/dir exists and is not readable. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotReadable */ - protected function failureDescription($other) : string + function assertIsNotReadable(string $filename, string $message = ''): void { - if ($other !== null) { - $message = ''; - if ($other instanceof Throwable) { - $message = '. Message was: "' . $other->getMessage() . '" at' . "\n" . Filter::getFilteredStacktrace($other); - } - return sprintf('exception of type "%s" matches expected exception "%s"%s', get_class($other), $this->className, $message); - } - return sprintf('exception of type "%s" is thrown', $this->className); + \PHPUnit\Framework\Assert::assertIsNotReadable(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function sprintf; -use Throwable; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class ExceptionCode extends \PHPUnit\Framework\Constraint\Constraint -{ - /** - * @var int|string - */ - private $expectedCode; +if (!function_exists('PHPUnit\Framework\assertNotIsReadable')) { /** - * @param int|string $expected + * Asserts that a file/dir exists and is not readable. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4062 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotIsReadable */ - public function __construct($expected) - { - $this->expectedCode = $expected; - } - public function toString() : string + function assertNotIsReadable(string $filename, string $message = ''): void { - return 'exception code is '; + \PHPUnit\Framework\Assert::assertNotIsReadable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsWritable')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a file/dir exists and is writable. * - * @param Throwable $other + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsWritable */ - protected function matches($other) : bool + function assertIsWritable(string $filename, string $message = ''): void { - return (string) $other->getCode() === (string) $this->expectedCode; + \PHPUnit\Framework\Assert::assertIsWritable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotWritable')) { /** - * Returns the description of the failure. + * Asserts that a file/dir exists and is not writable. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @see Assert::assertIsNotWritable */ - protected function failureDescription($other) : string + function assertIsNotWritable(string $filename, string $message = ''): void { - return sprintf('%s is equal to expected exception code %s', $this->exporter()->export($other->getCode()), $this->exporter()->export($this->expectedCode)); + \PHPUnit\Framework\Assert::assertIsNotWritable(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function sprintf; -use function strpos; -use Throwable; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class ExceptionMessage extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertNotIsWritable')) { /** - * @var string + * Asserts that a file/dir exists and is not writable. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4065 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotIsWritable */ - private $expectedMessage; - public function __construct(string $expected) + function assertNotIsWritable(string $filename, string $message = ''): void { - $this->expectedMessage = $expected; - } - public function toString() : string - { - if ($this->expectedMessage === '') { - return 'exception message is empty'; - } - return 'exception message contains '; + \PHPUnit\Framework\Assert::assertNotIsWritable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertDirectoryExists')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a directory exists. * - * @param Throwable $other + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryExists */ - protected function matches($other) : bool + function assertDirectoryExists(string $directory, string $message = ''): void { - if ($this->expectedMessage === '') { - return $other->getMessage() === ''; - } - return strpos((string) $other->getMessage(), $this->expectedMessage) !== \false; + \PHPUnit\Framework\Assert::assertDirectoryExists(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertDirectoryDoesNotExist')) { /** - * Returns the description of the failure. + * Asserts that a directory does not exist. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryDoesNotExist */ - protected function failureDescription($other) : string + function assertDirectoryDoesNotExist(string $directory, string $message = ''): void { - if ($this->expectedMessage === '') { - return sprintf("exception message is empty but is '%s'", $other->getMessage()); - } - return sprintf("exception message '%s' contains '%s'", $other->getMessage(), $this->expectedMessage); + \PHPUnit\Framework\Assert::assertDirectoryDoesNotExist(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function sprintf; -use Exception; -use PHPUnit\Util\RegularExpression as RegularExpressionUtil; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class ExceptionMessageRegularExpression extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertDirectoryNotExists')) { /** - * @var string + * Asserts that a directory does not exist. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4068 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryNotExists */ - private $expectedMessageRegExp; - public function __construct(string $expected) + function assertDirectoryNotExists(string $directory, string $message = ''): void { - $this->expectedMessageRegExp = $expected; - } - public function toString() : string - { - return 'exception message matches '; + \PHPUnit\Framework\Assert::assertDirectoryNotExists(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertDirectoryIsReadable')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a directory exists and is readable. * - * @param \PHPUnit\Framework\Exception $other + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @throws \PHPUnit\Framework\Exception - * @throws Exception + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryIsReadable */ - protected function matches($other) : bool + function assertDirectoryIsReadable(string $directory, string $message = ''): void { - $match = RegularExpressionUtil::safeMatch($this->expectedMessageRegExp, $other->getMessage()); - if ($match === \false) { - throw new \PHPUnit\Framework\Exception("Invalid expected exception message regex given: '{$this->expectedMessageRegExp}'"); - } - return $match === 1; + \PHPUnit\Framework\Assert::assertDirectoryIsReadable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertDirectoryIsNotReadable')) { /** - * Returns the description of the failure. + * Asserts that a directory exists and is not readable. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryIsNotReadable */ - protected function failureDescription($other) : string + function assertDirectoryIsNotReadable(string $directory, string $message = ''): void { - return sprintf("exception message '%s' matches '%s'", $other->getMessage(), $this->expectedMessageRegExp); + \PHPUnit\Framework\Assert::assertDirectoryIsNotReadable(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_dir; -use function sprintf; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class DirectoryExists extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertDirectoryNotIsReadable')) { /** - * Returns a string representation of the constraint. + * Asserts that a directory exists and is not readable. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4071 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryNotIsReadable */ - public function toString() : string + function assertDirectoryNotIsReadable(string $directory, string $message = ''): void { - return 'directory exists'; + \PHPUnit\Framework\Assert::assertDirectoryNotIsReadable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertDirectoryIsWritable')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a directory exists and is writable. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryIsWritable */ - protected function matches($other) : bool + function assertDirectoryIsWritable(string $directory, string $message = ''): void { - return is_dir($other); + \PHPUnit\Framework\Assert::assertDirectoryIsWritable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertDirectoryIsNotWritable')) { /** - * Returns the description of the failure. + * Asserts that a directory exists and is not writable. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryIsNotWritable */ - protected function failureDescription($other) : string + function assertDirectoryIsNotWritable(string $directory, string $message = ''): void { - return sprintf('directory "%s" exists', $other); + \PHPUnit\Framework\Assert::assertDirectoryIsNotWritable(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function file_exists; -use function sprintf; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class FileExists extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertDirectoryNotIsWritable')) { /** - * Returns a string representation of the constraint. + * Asserts that a directory exists and is not writable. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4074 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDirectoryNotIsWritable */ - public function toString() : string + function assertDirectoryNotIsWritable(string $directory, string $message = ''): void { - return 'file exists'; + \PHPUnit\Framework\Assert::assertDirectoryNotIsWritable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileExists')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a file exists. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileExists */ - protected function matches($other) : bool + function assertFileExists(string $filename, string $message = ''): void { - return file_exists($other); + \PHPUnit\Framework\Assert::assertFileExists(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileDoesNotExist')) { /** - * Returns the description of the failure. + * Asserts that a file does not exist. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileDoesNotExist */ - protected function failureDescription($other) : string + function assertFileDoesNotExist(string $filename, string $message = ''): void { - return sprintf('file "%s" exists', $other); + \PHPUnit\Framework\Assert::assertFileDoesNotExist(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_readable; -use function sprintf; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsReadable extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertFileNotExists')) { /** - * Returns a string representation of the constraint. + * Asserts that a file does not exist. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4077 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileNotExists */ - public function toString() : string + function assertFileNotExists(string $filename, string $message = ''): void { - return 'is readable'; + \PHPUnit\Framework\Assert::assertFileNotExists(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileIsReadable')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a file exists and is readable. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileIsReadable */ - protected function matches($other) : bool + function assertFileIsReadable(string $file, string $message = ''): void { - return is_readable($other); + \PHPUnit\Framework\Assert::assertFileIsReadable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileIsNotReadable')) { /** - * Returns the description of the failure. + * Asserts that a file exists and is not readable. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileIsNotReadable */ - protected function failureDescription($other) : string + function assertFileIsNotReadable(string $file, string $message = ''): void { - return sprintf('"%s" is readable', $other); + \PHPUnit\Framework\Assert::assertFileIsNotReadable(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_writable; -use function sprintf; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsWritable extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertFileNotIsReadable')) { /** - * Returns a string representation of the constraint. + * Asserts that a file exists and is not readable. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4080 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileNotIsReadable */ - public function toString() : string + function assertFileNotIsReadable(string $file, string $message = ''): void { - return 'is writable'; + \PHPUnit\Framework\Assert::assertFileNotIsReadable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileIsWritable')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a file exists and is writable. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileIsWritable */ - protected function matches($other) : bool + function assertFileIsWritable(string $file, string $message = ''): void { - return is_writable($other); + \PHPUnit\Framework\Assert::assertFileIsWritable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFileIsNotWritable')) { /** - * Returns the description of the failure. + * Asserts that a file exists and is not writable. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileIsNotWritable */ - protected function failureDescription($other) : string + function assertFileIsNotWritable(string $file, string $message = ''): void { - return sprintf('"%s" is writable', $other); + \PHPUnit\Framework\Assert::assertFileIsNotWritable(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use PHPUnit\Framework\ExpectationFailedException; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsAnything extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertFileNotIsWritable')) { /** - * Evaluates the constraint for parameter $other. + * Asserts that a file exists and is not writable. * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. + * @codeCoverageIgnore * - * @throws ExpectationFailedException + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4083 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFileNotIsWritable */ - public function evaluate($other, string $description = '', bool $returnResult = \false) : ?bool + function assertFileNotIsWritable(string $file, string $message = ''): void { - return $returnResult ? \true : null; + \PHPUnit\Framework\Assert::assertFileNotIsWritable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertTrue')) { /** - * Returns a string representation of the constraint. + * Asserts that a condition is true. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert true $condition + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertTrue */ - public function toString() : string + function assertTrue($condition, string $message = ''): void { - return 'is anything'; + \PHPUnit\Framework\Assert::assertTrue(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotTrue')) { /** - * Counts the number of constraint elements. + * Asserts that a condition is not true. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !true $condition + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotTrue */ - public function count() : int + function assertNotTrue($condition, string $message = ''): void { - return 0; + \PHPUnit\Framework\Assert::assertNotTrue(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function get_class; -use function is_array; -use function is_object; -use function is_string; -use function sprintf; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsIdentical extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertFalse')) { /** - * @var mixed + * Asserts that a condition is false. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert false $condition + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertFalse */ - private $value; - public function __construct($value) + function assertFalse($condition, string $message = ''): void { - $this->value = $value; + \PHPUnit\Framework\Assert::assertFalse(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotFalse')) { /** - * Evaluates the constraint for parameter $other. + * Asserts that a condition is not false. * - * If $returnResult is set to false (the default), an exception is thrown - * in case of a failure. null is returned otherwise. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * If $returnResult is true, the result of the evaluation is returned as - * a boolean value instead: true in case of success, false in case of a - * failure. + * @psalm-assert !false $condition + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotFalse + */ + function assertNotFalse($condition, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertNotFalse(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertNull')) { + /** + * Asserts that a variable is null. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert null $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNull */ - public function evaluate($other, string $description = '', bool $returnResult = \false) : ?bool + function assertNull($actual, string $message = ''): void { - $success = $this->value === $other; - if ($returnResult) { - return $success; - } - if (!$success) { - $f = null; - // if both values are strings, make sure a diff is generated - if (is_string($this->value) && is_string($other)) { - $f = new ComparisonFailure($this->value, $other, sprintf("'%s'", $this->value), sprintf("'%s'", $other)); - } - // if both values are array, make sure a diff is generated - if (is_array($this->value) && is_array($other)) { - $f = new ComparisonFailure($this->value, $other, $this->exporter()->export($this->value), $this->exporter()->export($other)); - } - $this->fail($other, $description, $f); - } - return null; + \PHPUnit\Framework\Assert::assertNull(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotNull')) { /** - * Returns a string representation of the constraint. + * Asserts that a variable is not null. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !null $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotNull */ - public function toString() : string + function assertNotNull($actual, string $message = ''): void { - if (is_object($this->value)) { - return 'is identical to an object of class "' . get_class($this->value) . '"'; - } - return 'is identical to ' . $this->exporter()->export($this->value); + \PHPUnit\Framework\Assert::assertNotNull(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertFinite')) { /** - * Returns the description of the failure. + * Asserts that a variable is finite. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @see Assert::assertFinite */ - protected function failureDescription($other) : string + function assertFinite($actual, string $message = ''): void { - if (is_object($this->value) && is_object($other)) { - return 'two variables reference the same object'; - } - if (is_string($this->value) && is_string($other)) { - return 'two strings are identical'; - } - if (is_array($this->value) && is_array($other)) { - return 'two arrays are identical'; - } - return parent::failureDescription($other); + \PHPUnit\Framework\Assert::assertFinite(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function json_decode; -use function sprintf; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Util\Json; -use PHPUnit\SebastianBergmann\Comparator\ComparisonFailure; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class JsonMatches extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertInfinite')) { /** - * @var string + * Asserts that a variable is infinite. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertInfinite */ - private $value; - public function __construct(string $value) + function assertInfinite($actual, string $message = ''): void { - $this->value = $value; + \PHPUnit\Framework\Assert::assertInfinite(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNan')) { /** - * Returns a string representation of the object. + * Asserts that a variable is nan. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNan */ - public function toString() : string + function assertNan($actual, string $message = ''): void { - return sprintf('matches JSON string "%s"', $this->value); + \PHPUnit\Framework\Assert::assertNan(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertClassHasAttribute')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a class has a specified attribute. * - * This method can be overridden to implement the evaluation algorithm. + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception * - * @param mixed $other value or object to evaluate + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertClassHasAttribute */ - protected function matches($other) : bool + function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void { - [$error, $recodedOther] = Json::canonicalize($other); - if ($error) { - return \false; - } - [$error, $recodedValue] = Json::canonicalize($this->value); - if ($error) { - return \false; - } - return $recodedOther == $recodedValue; + \PHPUnit\Framework\Assert::assertClassHasAttribute(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertClassNotHasAttribute')) { /** - * Throws an exception for the given compared value and test description. + * Asserts that a class does not have a specified attribute. * - * @param mixed $other evaluated value or object - * @param string $description Additional information about the test + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertClassNotHasAttribute + */ + function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertClassNotHasAttribute(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertClassHasStaticAttribute')) { + /** + * Asserts that a class has a specified static attribute. * - * @throws \PHPUnit\Framework\Exception - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception * - * @psalm-return never-return + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertClassHasStaticAttribute */ - protected function fail($other, $description, ComparisonFailure $comparisonFailure = null) : void + function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void { - if ($comparisonFailure === null) { - [$error, $recodedOther] = Json::canonicalize($other); - if ($error) { - parent::fail($other, $description); - } - [$error, $recodedValue] = Json::canonicalize($this->value); - if ($error) { - parent::fail($other, $description); - } - $comparisonFailure = new ComparisonFailure(json_decode($this->value), json_decode($other), Json::prettify($recodedValue), Json::prettify($recodedOther), \false, 'Failed asserting that two json values are equal.'); - } - parent::fail($other, $description, $comparisonFailure); + \PHPUnit\Framework\Assert::assertClassHasStaticAttribute(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use const JSON_ERROR_CTRL_CHAR; -use const JSON_ERROR_DEPTH; -use const JSON_ERROR_NONE; -use const JSON_ERROR_STATE_MISMATCH; -use const JSON_ERROR_SYNTAX; -use const JSON_ERROR_UTF8; -use function strtolower; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class JsonMatchesErrorMessageProvider -{ +if (!function_exists('PHPUnit\Framework\assertClassNotHasStaticAttribute')) { /** - * Translates JSON error to a human readable string. + * Asserts that a class does not have a specified static attribute. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertClassNotHasStaticAttribute */ - public static function determineJsonError(string $error, string $prefix = '') : ?string + function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void { - switch ($error) { - case JSON_ERROR_NONE: - return null; - case JSON_ERROR_DEPTH: - return $prefix . 'Maximum stack depth exceeded'; - case JSON_ERROR_STATE_MISMATCH: - return $prefix . 'Underflow or the modes mismatch'; - case JSON_ERROR_CTRL_CHAR: - return $prefix . 'Unexpected control character found'; - case JSON_ERROR_SYNTAX: - return $prefix . 'Syntax error, malformed JSON'; - case JSON_ERROR_UTF8: - return $prefix . 'Malformed UTF-8 characters, possibly incorrectly encoded'; - default: - return $prefix . 'Unknown error'; - } + \PHPUnit\Framework\Assert::assertClassNotHasStaticAttribute(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertObjectHasAttribute')) { /** - * Translates a given type to a human readable message prefix. + * Asserts that an object has a specified attribute. + * + * @param object $object + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertObjectHasAttribute */ - public static function translateTypeToPrefix(string $type) : string + function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void { - switch (strtolower($type)) { - case 'expected': - $prefix = 'Expected value JSON decode error - '; - break; - case 'actual': - $prefix = 'Actual value JSON decode error - '; - break; - default: - $prefix = ''; - break; - } - return $prefix; + \PHPUnit\Framework\Assert::assertObjectHasAttribute(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_finite; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsFinite extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertObjectNotHasAttribute')) { /** - * Returns a string representation of the constraint. + * Asserts that an object does not have a specified attribute. + * + * @param object $object + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertObjectNotHasAttribute */ - public function toString() : string + function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void { - return 'is finite'; + \PHPUnit\Framework\Assert::assertObjectNotHasAttribute(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertObjectHasProperty')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that an object has a specified property. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertObjectHasProperty */ - protected function matches($other) : bool + function assertObjectHasProperty(string $attributeName, object $object, string $message = ''): void { - return is_finite($other); + \PHPUnit\Framework\Assert::assertObjectHasProperty(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_infinite; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsInfinite extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertObjectNotHasProperty')) { /** - * Returns a string representation of the constraint. + * Asserts that an object does not have a specified property. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertObjectNotHasProperty */ - public function toString() : string + function assertObjectNotHasProperty(string $attributeName, object $object, string $message = ''): void { - return 'is infinite'; + \PHPUnit\Framework\Assert::assertObjectNotHasProperty(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertSame')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that two variables have the same type and value. + * Used on objects, it asserts that two variables reference + * the same object. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-template ExpectedType + * + * @psalm-param ExpectedType $expected + * + * @psalm-assert =ExpectedType $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertSame */ - protected function matches($other) : bool + function assertSame($expected, $actual, string $message = ''): void { - return is_infinite($other); + \PHPUnit\Framework\Assert::assertSame(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function is_nan; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsNan extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertNotSame')) { /** - * Returns a string representation of the constraint. + * Asserts that two variables do not have the same type and value. + * Used on objects, it asserts that two variables do not reference + * the same object. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotSame */ - public function toString() : string + function assertNotSame($expected, $actual, string $message = ''): void { - return 'is nan'; + \PHPUnit\Framework\Assert::assertNotSame(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertInstanceOf')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a variable is of a given type. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @psalm-template ExpectedType of object + * + * @psalm-param class-string $expected + * + * @psalm-assert =ExpectedType $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertInstanceOf */ - protected function matches($other) : bool + function assertInstanceOf(string $expected, $actual, string $message = ''): void { - return is_nan($other); + \PHPUnit\Framework\Assert::assertInstanceOf(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function get_class; -use function is_object; -use function sprintf; -use PHPUnit\Framework\Exception; -use ReflectionClass; -use ReflectionException; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 - */ -class ClassHasAttribute extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertNotInstanceOf')) { /** - * @var string + * Asserts that a variable is not of a given type. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @psalm-template ExpectedType of object + * + * @psalm-param class-string $expected + * + * @psalm-assert !ExpectedType $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotInstanceOf */ - private $attributeName; - public function __construct(string $attributeName) + function assertNotInstanceOf(string $expected, $actual, string $message = ''): void { - $this->attributeName = $attributeName; + \PHPUnit\Framework\Assert::assertNotInstanceOf(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsArray')) { /** - * Returns a string representation of the constraint. + * Asserts that a variable is of type array. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert array $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsArray */ - public function toString() : string + function assertIsArray($actual, string $message = ''): void { - return sprintf('has attribute "%s"', $this->attributeName); + \PHPUnit\Framework\Assert::assertIsArray(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsBool')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a variable is of type bool. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert bool $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsBool */ - protected function matches($other) : bool + function assertIsBool($actual, string $message = ''): void { - try { - return (new ReflectionClass($other))->hasProperty($this->attributeName); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd + \PHPUnit\Framework\Assert::assertIsBool(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsFloat')) { /** - * Returns the description of the failure. + * Asserts that a variable is of type float. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @psalm-assert float $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsFloat */ - protected function failureDescription($other) : string + function assertIsFloat($actual, string $message = ''): void { - return sprintf('%sclass "%s" %s', is_object($other) ? 'object of ' : '', is_object($other) ? get_class($other) : $other, $this->toString()); + \PHPUnit\Framework\Assert::assertIsFloat(...func_get_args()); } - protected function attributeName() : string +} +if (!function_exists('PHPUnit\Framework\assertIsInt')) { + /** + * Asserts that a variable is of type int. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert int $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsInt + */ + function assertIsInt($actual, string $message = ''): void { - return $this->attributeName; + \PHPUnit\Framework\Assert::assertIsInt(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function sprintf; -use PHPUnit\Framework\Exception; -use ReflectionClass; -use ReflectionException; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 - */ -final class ClassHasStaticAttribute extends \PHPUnit\Framework\Constraint\ClassHasAttribute -{ +if (!function_exists('PHPUnit\Framework\assertIsNumeric')) { /** - * Returns a string representation of the constraint. + * Asserts that a variable is of type numeric. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert numeric $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNumeric */ - public function toString() : string + function assertIsNumeric($actual, string $message = ''): void { - return sprintf('has static attribute "%s"', $this->attributeName()); + \PHPUnit\Framework\Assert::assertIsNumeric(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsObject')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a variable is of type object. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert object $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsObject */ - protected function matches($other) : bool + function assertIsObject($actual, string $message = ''): void { - try { - $class = new ReflectionClass($other); - if ($class->hasProperty($this->attributeName())) { - return $class->getProperty($this->attributeName())->isStatic(); - } - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - return \false; + \PHPUnit\Framework\Assert::assertIsObject(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function get_class; -use function is_object; -use PHPUnit\Framework\ActualValueIsNotAnObjectException; -use PHPUnit\Framework\ComparisonMethodDoesNotAcceptParameterTypeException; -use PHPUnit\Framework\ComparisonMethodDoesNotDeclareBoolReturnTypeException; -use PHPUnit\Framework\ComparisonMethodDoesNotDeclareExactlyOneParameterException; -use PHPUnit\Framework\ComparisonMethodDoesNotDeclareParameterTypeException; -use PHPUnit\Framework\ComparisonMethodDoesNotExistException; -use ReflectionNamedType; -use ReflectionObject; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class ObjectEquals extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertIsResource')) { /** - * @var object + * Asserts that a variable is of type resource. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert resource $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsResource */ - private $expected; + function assertIsResource($actual, string $message = ''): void + { + \PHPUnit\Framework\Assert::assertIsResource(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\assertIsClosedResource')) { /** - * @var string + * Asserts that a variable is of type resource and is closed. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert resource $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsClosedResource */ - private $method; - public function __construct(object $object, string $method = 'equals') + function assertIsClosedResource($actual, string $message = ''): void { - $this->expected = $object; - $this->method = $method; + \PHPUnit\Framework\Assert::assertIsClosedResource(...func_get_args()); } - public function toString() : string +} +if (!function_exists('PHPUnit\Framework\assertIsString')) { + /** + * Asserts that a variable is of type string. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert string $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsString + */ + function assertIsString($actual, string $message = ''): void { - return 'two objects are equal'; + \PHPUnit\Framework\Assert::assertIsString(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsScalar')) { /** - * @throws ActualValueIsNotAnObjectException - * @throws ComparisonMethodDoesNotAcceptParameterTypeException - * @throws ComparisonMethodDoesNotDeclareBoolReturnTypeException - * @throws ComparisonMethodDoesNotDeclareExactlyOneParameterException - * @throws ComparisonMethodDoesNotDeclareParameterTypeException - * @throws ComparisonMethodDoesNotExistException + * Asserts that a variable is of type scalar. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert scalar $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsScalar */ - protected function matches($other) : bool + function assertIsScalar($actual, string $message = ''): void { - if (!is_object($other)) { - throw new ActualValueIsNotAnObjectException(); - } - $object = new ReflectionObject($other); - if (!$object->hasMethod($this->method)) { - throw new ComparisonMethodDoesNotExistException(get_class($other), $this->method); - } - /** @noinspection PhpUnhandledExceptionInspection */ - $method = $object->getMethod($this->method); - if (!$method->hasReturnType()) { - throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(get_class($other), $this->method); - } - $returnType = $method->getReturnType(); - if (!$returnType instanceof ReflectionNamedType) { - throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(get_class($other), $this->method); - } - if ($returnType->allowsNull()) { - throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(get_class($other), $this->method); - } - if ($returnType->getName() !== 'bool') { - throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(get_class($other), $this->method); - } - if ($method->getNumberOfParameters() !== 1 || $method->getNumberOfRequiredParameters() !== 1) { - throw new ComparisonMethodDoesNotDeclareExactlyOneParameterException(get_class($other), $this->method); - } - $parameter = $method->getParameters()[0]; - if (!$parameter->hasType()) { - throw new ComparisonMethodDoesNotDeclareParameterTypeException(get_class($other), $this->method); - } - $type = $parameter->getType(); - if (!$type instanceof ReflectionNamedType) { - throw new ComparisonMethodDoesNotDeclareParameterTypeException(get_class($other), $this->method); - } - $typeName = $type->getName(); - if ($typeName === 'self') { - $typeName = get_class($other); - } - if (!$this->expected instanceof $typeName) { - throw new ComparisonMethodDoesNotAcceptParameterTypeException(get_class($other), $this->method, get_class($this->expected)); - } - return $other->{$this->method}($this->expected); - } - protected function failureDescription($other) : string - { - return $this->toString(); + \PHPUnit\Framework\Assert::assertIsScalar(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use ReflectionObject; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 - */ -final class ObjectHasAttribute extends \PHPUnit\Framework\Constraint\ClassHasAttribute -{ +if (!function_exists('PHPUnit\Framework\assertIsCallable')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a variable is of type callable. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert callable $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsCallable */ - protected function matches($other) : bool + function assertIsCallable($actual, string $message = ''): void { - return (new ReflectionObject($other))->hasProperty($this->attributeName()); + \PHPUnit\Framework\Assert::assertIsCallable(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function get_class; -use function gettype; -use function is_object; -use function sprintf; -use ReflectionObject; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class ObjectHasProperty extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertIsIterable')) { /** - * @var string + * Asserts that a variable is of type iterable. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert iterable $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsIterable */ - private $propertyName; - public function __construct(string $propertyName) + function assertIsIterable($actual, string $message = ''): void { - $this->propertyName = $propertyName; + \PHPUnit\Framework\Assert::assertIsIterable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotArray')) { /** - * Returns a string representation of the constraint. + * Asserts that a variable is not of type array. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !array $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotArray */ - public function toString() : string + function assertIsNotArray($actual, string $message = ''): void { - return sprintf('has property "%s"', $this->propertyName); + \PHPUnit\Framework\Assert::assertIsNotArray(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotBool')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a variable is not of type bool. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !bool $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotBool */ - protected function matches($other) : bool + function assertIsNotBool($actual, string $message = ''): void { - if (!is_object($other)) { - return \false; - } - return (new ReflectionObject($other))->hasProperty($this->propertyName); + \PHPUnit\Framework\Assert::assertIsNotBool(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotFloat')) { /** - * Returns the description of the failure. + * Asserts that a variable is not of type float. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @psalm-assert !float $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotFloat */ - protected function failureDescription($other) : string + function assertIsNotFloat($actual, string $message = ''): void { - if (is_object($other)) { - return sprintf('object of class "%s" %s', get_class($other), $this->toString()); - } - return sprintf('"%s" (%s) %s', $other, gettype($other), $this->toString()); + \PHPUnit\Framework\Assert::assertIsNotFloat(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function array_map; -use function array_values; -use function count; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -abstract class BinaryOperator extends \PHPUnit\Framework\Constraint\Operator -{ +if (!function_exists('PHPUnit\Framework\assertIsNotInt')) { /** - * @var Constraint[] + * Asserts that a variable is not of type int. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !int $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotInt */ - private $constraints = []; - public static function fromConstraints(\PHPUnit\Framework\Constraint\Constraint ...$constraints) : self + function assertIsNotInt($actual, string $message = ''): void { - $constraint = new static(); - $constraint->constraints = $constraints; - return $constraint; + \PHPUnit\Framework\Assert::assertIsNotInt(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotNumeric')) { /** - * @param mixed[] $constraints + * Asserts that a variable is not of type numeric. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !numeric $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotNumeric */ - public function setConstraints(array $constraints) : void + function assertIsNotNumeric($actual, string $message = ''): void { - $this->constraints = array_map(function ($constraint) : \PHPUnit\Framework\Constraint\Constraint { - return $this->checkConstraint($constraint); - }, array_values($constraints)); + \PHPUnit\Framework\Assert::assertIsNotNumeric(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotObject')) { /** - * Returns the number of operands (constraints). + * Asserts that a variable is not of type object. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !object $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotObject */ - public final function arity() : int + function assertIsNotObject($actual, string $message = ''): void { - return count($this->constraints); + \PHPUnit\Framework\Assert::assertIsNotObject(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotResource')) { /** - * Returns a string representation of the constraint. + * Asserts that a variable is not of type resource. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !resource $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotResource */ - public function toString() : string + function assertIsNotResource($actual, string $message = ''): void { - $reduced = $this->reduce(); - if ($reduced !== $this) { - return $reduced->toString(); - } - $text = ''; - foreach ($this->constraints as $key => $constraint) { - $constraint = $constraint->reduce(); - $text .= $this->constraintToString($constraint, $key); - } - return $text; + \PHPUnit\Framework\Assert::assertIsNotResource(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotClosedResource')) { /** - * Counts the number of constraint elements. + * Asserts that a variable is not of type resource. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !resource $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotClosedResource */ - public function count() : int + function assertIsNotClosedResource($actual, string $message = ''): void { - $count = 0; - foreach ($this->constraints as $constraint) { - $count += count($constraint); - } - return $count; + \PHPUnit\Framework\Assert::assertIsNotClosedResource(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotString')) { /** - * Returns the nested constraints. + * Asserts that a variable is not of type string. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !string $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotString */ - protected final function constraints() : array + function assertIsNotString($actual, string $message = ''): void { - return $this->constraints; + \PHPUnit\Framework\Assert::assertIsNotString(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotScalar')) { /** - * Returns true if the $constraint needs to be wrapped with braces. + * Asserts that a variable is not of type scalar. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !scalar $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotScalar */ - protected final function constraintNeedsParentheses(\PHPUnit\Framework\Constraint\Constraint $constraint) : bool + function assertIsNotScalar($actual, string $message = ''): void { - return $this->arity() > 1 && parent::constraintNeedsParentheses($constraint); + \PHPUnit\Framework\Assert::assertIsNotScalar(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotCallable')) { /** - * Reduces the sub-expression starting at $this by skipping degenerate - * sub-expression and returns first descendant constraint that starts - * a non-reducible sub-expression. + * Asserts that a variable is not of type callable. * - * See Constraint::reduce() for more. + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !callable $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotCallable */ - protected function reduce() : \PHPUnit\Framework\Constraint\Constraint + function assertIsNotCallable($actual, string $message = ''): void { - if ($this->arity() === 1 && $this->constraints[0] instanceof \PHPUnit\Framework\Constraint\Operator) { - return $this->constraints[0]->reduce(); - } - return parent::reduce(); + \PHPUnit\Framework\Assert::assertIsNotCallable(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertIsNotIterable')) { /** - * Returns string representation of given operand in context of this operator. + * Asserts that a variable is not of type iterable. * - * @param Constraint $constraint operand constraint - * @param int $position position of $constraint in this expression + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-assert !iterable $actual + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertIsNotIterable */ - private function constraintToString(\PHPUnit\Framework\Constraint\Constraint $constraint, int $position) : string + function assertIsNotIterable($actual, string $message = ''): void { - $prefix = ''; - if ($position > 0) { - $prefix = ' ' . $this->operator() . ' '; - } - if ($this->constraintNeedsParentheses($constraint)) { - return $prefix . '( ' . $constraint->toString() . ' )'; - } - $string = $constraint->toStringInContext($this, $position); - if ($string === '') { - $string = $constraint->toString(); - } - return $prefix . $string; + \PHPUnit\Framework\Assert::assertIsNotIterable(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class LogicalAnd extends \PHPUnit\Framework\Constraint\BinaryOperator -{ +if (!function_exists('PHPUnit\Framework\assertMatchesRegularExpression')) { /** - * Returns the name of this operator. + * Asserts that a string matches a given regular expression. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertMatchesRegularExpression */ - public function operator() : string + function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void { - return 'and'; + \PHPUnit\Framework\Assert::assertMatchesRegularExpression(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertRegExp')) { /** - * Returns this operator's precedence. + * Asserts that a string matches a given regular expression. * - * @see https://www.php.net/manual/en/language.operators.precedence.php + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4086 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertRegExp */ - public function precedence() : int + function assertRegExp(string $pattern, string $string, string $message = ''): void { - return 22; + \PHPUnit\Framework\Assert::assertRegExp(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertDoesNotMatchRegularExpression')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a string does not match a given regular expression. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertDoesNotMatchRegularExpression */ - protected function matches($other) : bool + function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = ''): void { - foreach ($this->constraints() as $constraint) { - if (!$constraint->evaluate($other, '', \true)) { - return \false; - } - } - return [] !== $this->constraints(); + \PHPUnit\Framework\Assert::assertDoesNotMatchRegularExpression(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function array_map; -use function count; -use function preg_match; -use function preg_quote; -use function preg_replace; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class LogicalNot extends \PHPUnit\Framework\Constraint\UnaryOperator -{ - public static function negate(string $string) : string +if (!function_exists('PHPUnit\Framework\assertNotRegExp')) { + /** + * Asserts that a string does not match a given regular expression. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4089 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotRegExp + */ + function assertNotRegExp(string $pattern, string $string, string $message = ''): void { - $positives = ['contains ', 'exists', 'has ', 'is ', 'are ', 'matches ', 'starts with ', 'ends with ', 'reference ', 'not not ']; - $negatives = ['does not contain ', 'does not exist', 'does not have ', 'is not ', 'are not ', 'does not match ', 'starts not with ', 'ends not with ', 'don\'t reference ', 'not ']; - preg_match('/(\'[\\w\\W]*\')([\\w\\W]*)("[\\w\\W]*")/i', $string, $matches); - $positives = array_map(static function (string $s) { - return '/\\b' . preg_quote($s, '/') . '/'; - }, $positives); - if (count($matches) > 0) { - $nonInput = $matches[2]; - $negatedString = preg_replace('/' . preg_quote($nonInput, '/') . '/', preg_replace($positives, $negatives, $nonInput), $string); - } else { - $negatedString = preg_replace($positives, $negatives, $string); - } - return $negatedString; + \PHPUnit\Framework\Assert::assertNotRegExp(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertSameSize')) { /** - * Returns the name of this operator. + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertSameSize */ - public function operator() : string + function assertSameSize($expected, $actual, string $message = ''): void { - return 'not'; + \PHPUnit\Framework\Assert::assertSameSize(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertNotSameSize')) { /** - * Returns this operator's precedence. + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is not the same. * - * @see https://www.php.net/manual/en/language.operators.precedence.php + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertNotSameSize */ - public function precedence() : int + function assertNotSameSize($expected, $actual, string $message = ''): void { - return 5; + \PHPUnit\Framework\Assert::assertNotSameSize(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringMatchesFormat')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a string matches a given format string. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringMatchesFormat */ - protected function matches($other) : bool + function assertStringMatchesFormat(string $format, string $string, string $message = ''): void { - return !$this->constraint()->evaluate($other, '', \true); + \PHPUnit\Framework\Assert::assertStringMatchesFormat(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringNotMatchesFormat')) { /** - * Applies additional transformation to strings returned by toString() or - * failureDescription(). + * Asserts that a string does not match a given format string. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringNotMatchesFormat */ - protected function transformString(string $string) : string + function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void { - return self::negate($string); + \PHPUnit\Framework\Assert::assertStringNotMatchesFormat(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringMatchesFormatFile')) { /** - * Reduces the sub-expression starting at $this by skipping degenerate - * sub-expression and returns first descendant constraint that starts - * a non-reducible sub-expression. + * Asserts that a string matches a given format file. * - * See Constraint::reduce() for more. + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringMatchesFormatFile */ - protected function reduce() : \PHPUnit\Framework\Constraint\Constraint + function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = ''): void { - $constraint = $this->constraint(); - if ($constraint instanceof self) { - return $constraint->constraint()->reduce(); - } - return parent::reduce(); + \PHPUnit\Framework\Assert::assertStringMatchesFormatFile(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class LogicalOr extends \PHPUnit\Framework\Constraint\BinaryOperator -{ +if (!function_exists('PHPUnit\Framework\assertStringNotMatchesFormatFile')) { /** - * Returns the name of this operator. + * Asserts that a string does not match a given format string. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringNotMatchesFormatFile */ - public function operator() : string + function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void { - return 'or'; + \PHPUnit\Framework\Assert::assertStringNotMatchesFormatFile(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringStartsWith')) { /** - * Returns this operator's precedence. + * Asserts that a string starts with a given prefix. * - * @see https://www.php.net/manual/en/language.operators.precedence.php + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringStartsWith */ - public function precedence() : int + function assertStringStartsWith(string $prefix, string $string, string $message = ''): void { - return 24; + \PHPUnit\Framework\Assert::assertStringStartsWith(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringStartsNotWith')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a string starts not with a given prefix. * - * @param mixed $other value or object to evaluate + * @param string $prefix + * @param string $string + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringStartsNotWith */ - public function matches($other) : bool + function assertStringStartsNotWith($prefix, $string, string $message = ''): void { - foreach ($this->constraints() as $constraint) { - if ($constraint->evaluate($other, '', \true)) { - return \true; - } - } - return \false; + \PHPUnit\Framework\Assert::assertStringStartsNotWith(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function array_reduce; -use function array_shift; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class LogicalXor extends \PHPUnit\Framework\Constraint\BinaryOperator -{ +if (!function_exists('PHPUnit\Framework\assertStringContainsString')) { /** - * Returns the name of this operator. + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringContainsString */ - public function operator() : string + function assertStringContainsString(string $needle, string $haystack, string $message = ''): void { - return 'xor'; + \PHPUnit\Framework\Assert::assertStringContainsString(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringContainsStringIgnoringCase')) { /** - * Returns this operator's precedence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @see https://www.php.net/manual/en/language.operators.precedence.php. + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringContainsStringIgnoringCase */ - public function precedence() : int + function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void { - return 23; + \PHPUnit\Framework\Assert::assertStringContainsStringIgnoringCase(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringNotContainsString')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other value or object to evaluate + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringNotContainsString */ - public function matches($other) : bool + function assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void { - $constraints = $this->constraints(); - $initial = array_shift($constraints); - if ($initial === null) { - return \false; - } - return array_reduce($constraints, static function (bool $matches, \PHPUnit\Framework\Constraint\Constraint $constraint) use($other) : bool { - return $matches xor $constraint->evaluate($other, '', \true); - }, $initial->evaluate($other, '', \true)); + \PHPUnit\Framework\Assert::assertStringNotContainsString(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -abstract class Operator extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertStringNotContainsStringIgnoringCase')) { /** - * Returns the name of this operator. - */ - public abstract function operator() : string; - /** - * Returns this operator's precedence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @see https://www.php.net/manual/en/language.operators.precedence.php - */ - public abstract function precedence() : int; - /** - * Returns the number of operands. - */ - public abstract function arity() : int; - /** - * Validates $constraint argument. + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringNotContainsStringIgnoringCase */ - protected function checkConstraint($constraint) : \PHPUnit\Framework\Constraint\Constraint + function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void { - if (!$constraint instanceof \PHPUnit\Framework\Constraint\Constraint) { - return new \PHPUnit\Framework\Constraint\IsEqual($constraint); - } - return $constraint; + \PHPUnit\Framework\Assert::assertStringNotContainsStringIgnoringCase(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertStringEndsWith')) { /** - * Returns true if the $constraint needs to be wrapped with braces. + * Asserts that a string ends with a given suffix. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringEndsWith */ - protected function constraintNeedsParentheses(\PHPUnit\Framework\Constraint\Constraint $constraint) : bool + function assertStringEndsWith(string $suffix, string $string, string $message = ''): void { - return $constraint instanceof self && $constraint->arity() > 1 && $this->precedence() <= $constraint->precedence(); + \PHPUnit\Framework\Assert::assertStringEndsWith(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function count; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -abstract class UnaryOperator extends \PHPUnit\Framework\Constraint\Operator -{ - /** - * @var Constraint - */ - private $constraint; +if (!function_exists('PHPUnit\Framework\assertStringEndsNotWith')) { /** - * @param Constraint|mixed $constraint + * Asserts that a string ends not with a given suffix. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertStringEndsNotWith */ - public function __construct($constraint) + function assertStringEndsNotWith(string $suffix, string $string, string $message = ''): void { - $this->constraint = $this->checkConstraint($constraint); + \PHPUnit\Framework\Assert::assertStringEndsNotWith(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertXmlFileEqualsXmlFile')) { /** - * Returns the number of operands (constraints). + * Asserts that two XML files are equal. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertXmlFileEqualsXmlFile */ - public function arity() : int + function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void { - return 1; + \PHPUnit\Framework\Assert::assertXmlFileEqualsXmlFile(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertXmlFileNotEqualsXmlFile')) { /** - * Returns a string representation of the constraint. + * Asserts that two XML files are not equal. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws \PHPUnit\Util\Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertXmlFileNotEqualsXmlFile */ - public function toString() : string + function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void { - $reduced = $this->reduce(); - if ($reduced !== $this) { - return $reduced->toString(); - } - $constraint = $this->constraint->reduce(); - if ($this->constraintNeedsParentheses($constraint)) { - return $this->operator() . '( ' . $constraint->toString() . ' )'; - } - $string = $constraint->toStringInContext($this, 0); - if ($string === '') { - return $this->transformString($constraint->toString()); - } - return $string; + \PHPUnit\Framework\Assert::assertXmlFileNotEqualsXmlFile(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertXmlStringEqualsXmlFile')) { /** - * Counts the number of constraint elements. + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws \PHPUnit\Util\Xml\Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertXmlStringEqualsXmlFile */ - public function count() : int + function assertXmlStringEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void { - return count($this->constraint); + \PHPUnit\Framework\Assert::assertXmlStringEqualsXmlFile(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertXmlStringNotEqualsXmlFile')) { /** - * Returns the description of the failure. + * Asserts that two XML documents are not equal. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @param DOMDocument|string $actualXml * - * @param mixed $other evaluated value or object + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws \PHPUnit\Util\Xml\Exception * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertXmlStringNotEqualsXmlFile */ - protected function failureDescription($other) : string + function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void { - $reduced = $this->reduce(); - if ($reduced !== $this) { - return $reduced->failureDescription($other); - } - $constraint = $this->constraint->reduce(); - if ($this->constraintNeedsParentheses($constraint)) { - return $this->operator() . '( ' . $constraint->failureDescription($other) . ' )'; - } - $string = $constraint->failureDescriptionInContext($this, 0, $other); - if ($string === '') { - return $this->transformString($constraint->failureDescription($other)); - } - return $string; + \PHPUnit\Framework\Assert::assertXmlStringNotEqualsXmlFile(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertXmlStringEqualsXmlString')) { /** - * Transforms string returned by the memeber constraint's toString() or - * failureDescription() such that it reflects constraint's participation in - * this expression. + * Asserts that two XML documents are equal. * - * The method may be overwritten in a subclass to apply default - * transformation in case the operand constraint does not provide its own - * custom strings via toStringInContext() or failureDescriptionInContext(). + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml * - * @param string $string the string to be transformed + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws \PHPUnit\Util\Xml\Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertXmlStringEqualsXmlString */ - protected function transformString(string $string) : string + function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = ''): void { - return $string; + \PHPUnit\Framework\Assert::assertXmlStringEqualsXmlString(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertXmlStringNotEqualsXmlString')) { /** - * Provides access to $this->constraint for subclasses. + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws \PHPUnit\Util\Xml\Exception + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertXmlStringNotEqualsXmlString */ - protected final function constraint() : \PHPUnit\Framework\Constraint\Constraint + function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, string $message = ''): void { - return $this->constraint; + \PHPUnit\Framework\Assert::assertXmlStringNotEqualsXmlString(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertEqualXMLStructure')) { /** - * Returns true if the $constraint needs to be wrapped with parentheses. + * Asserts that a hierarchy of DOMElements matches. + * + * @throws AssertionFailedError + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4091 + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertEqualXMLStructure */ - protected function constraintNeedsParentheses(\PHPUnit\Framework\Constraint\Constraint $constraint) : bool + function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = \false, string $message = ''): void { - $constraint = $constraint->reduce(); - return $constraint instanceof self || parent::constraintNeedsParentheses($constraint); + \PHPUnit\Framework\Assert::assertEqualXMLStructure(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function json_decode; -use function json_last_error; -use function sprintf; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class IsJson extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertThat')) { /** - * Returns a string representation of the constraint. + * Evaluates a PHPUnit\Framework\Constraint matcher object. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertThat */ - public function toString() : string + function assertThat($value, Constraint $constraint, string $message = ''): void { - return 'is valid JSON'; + \PHPUnit\Framework\Assert::assertThat(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertJson')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that a string is a valid JSON string. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertJson */ - protected function matches($other) : bool + function assertJson(string $actualJson, string $message = ''): void { - if ($other === '') { - return \false; - } - json_decode($other); - if (json_last_error()) { - return \false; - } - return \true; + \PHPUnit\Framework\Assert::assertJson(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertJsonStringEqualsJsonString')) { /** - * Returns the description of the failure. + * Asserts that two given JSON encoded objects or arrays are equal. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * @throws ExpectationFailedException + * @throws InvalidArgumentException * - * @param mixed $other evaluated value or object + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @see Assert::assertJsonStringEqualsJsonString */ - protected function failureDescription($other) : string + function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void { - if ($other === '') { - return 'an empty string is valid JSON'; - } - json_decode($other); - $error = (string) \PHPUnit\Framework\Constraint\JsonMatchesErrorMessageProvider::determineJsonError((string) json_last_error()); - return sprintf('%s is valid JSON (%s)', $this->exporter()->shortenedExport($other), $error); + \PHPUnit\Framework\Assert::assertJsonStringEqualsJsonString(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function preg_match; -use function sprintf; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -class RegularExpression extends \PHPUnit\Framework\Constraint\Constraint -{ +if (!function_exists('PHPUnit\Framework\assertJsonStringNotEqualsJsonString')) { /** - * @var string + * Asserts that two given JSON encoded objects or arrays are not equal. + * + * @param string $expectedJson + * @param string $actualJson + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertJsonStringNotEqualsJsonString */ - private $pattern; - public function __construct(string $pattern) + function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, string $message = ''): void { - $this->pattern = $pattern; + \PHPUnit\Framework\Assert::assertJsonStringNotEqualsJsonString(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertJsonStringEqualsJsonFile')) { /** - * Returns a string representation of the constraint. + * Asserts that the generated JSON encoded object and the content of the given file are equal. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertJsonStringEqualsJsonFile */ - public function toString() : string + function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void { - return sprintf('matches PCRE pattern "%s"', $this->pattern); + \PHPUnit\Framework\Assert::assertJsonStringEqualsJsonFile(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertJsonStringNotEqualsJsonFile')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Asserts that the generated JSON encoded object and the content of the given file are not equal. * - * @param mixed $other value or object to evaluate + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertJsonStringNotEqualsJsonFile */ - protected function matches($other) : bool + function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void { - return preg_match($this->pattern, $other) > 0; + \PHPUnit\Framework\Assert::assertJsonStringNotEqualsJsonFile(...func_get_args()); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Constraint; - -use function mb_stripos; -use function mb_strtolower; -use function sprintf; -use function strpos; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class StringContains extends \PHPUnit\Framework\Constraint\Constraint -{ - /** - * @var string - */ - private $string; +if (!function_exists('PHPUnit\Framework\assertJsonFileEqualsJsonFile')) { /** - * @var bool + * Asserts that two JSON files are equal. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertJsonFileEqualsJsonFile */ - private $ignoreCase; - public function __construct(string $string, bool $ignoreCase = \false) + function assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void { - $this->string = $string; - $this->ignoreCase = $ignoreCase; + \PHPUnit\Framework\Assert::assertJsonFileEqualsJsonFile(...func_get_args()); } +} +if (!function_exists('PHPUnit\Framework\assertJsonFileNotEqualsJsonFile')) { /** - * Returns a string representation of the constraint. + * Asserts that two JSON files are not equal. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see Assert::assertJsonFileNotEqualsJsonFile */ - public function toString() : string + function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void { - if ($this->ignoreCase) { - $string = mb_strtolower($this->string, 'UTF-8'); - } else { - $string = $this->string; - } - return sprintf('contains "%s"', $string); + \PHPUnit\Framework\Assert::assertJsonFileNotEqualsJsonFile(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\logicalAnd')) { + function logicalAnd(): LogicalAnd + { + return \PHPUnit\Framework\Assert::logicalAnd(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\logicalOr')) { + function logicalOr(): LogicalOr + { + return \PHPUnit\Framework\Assert::logicalOr(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\logicalNot')) { + function logicalNot(Constraint $constraint): LogicalNot + { + return \PHPUnit\Framework\Assert::logicalNot(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\logicalXor')) { + function logicalXor(): LogicalXor + { + return \PHPUnit\Framework\Assert::logicalXor(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\anything')) { + function anything(): IsAnything + { + return \PHPUnit\Framework\Assert::anything(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isTrue')) { + function isTrue(): IsTrue + { + return \PHPUnit\Framework\Assert::isTrue(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\callback')) { + function callback(callable $callback): Callback + { + return \PHPUnit\Framework\Assert::callback(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isFalse')) { + function isFalse(): IsFalse + { + return \PHPUnit\Framework\Assert::isFalse(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isJson')) { + function isJson(): IsJson + { + return \PHPUnit\Framework\Assert::isJson(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isNull')) { + function isNull(): IsNull + { + return \PHPUnit\Framework\Assert::isNull(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isFinite')) { + function isFinite(): IsFinite + { + return \PHPUnit\Framework\Assert::isFinite(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isInfinite')) { + function isInfinite(): IsInfinite + { + return \PHPUnit\Framework\Assert::isInfinite(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isNan')) { + function isNan(): IsNan + { + return \PHPUnit\Framework\Assert::isNan(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\containsEqual')) { + function containsEqual($value): TraversableContainsEqual + { + return \PHPUnit\Framework\Assert::containsEqual(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\containsIdentical')) { + function containsIdentical($value): TraversableContainsIdentical + { + return \PHPUnit\Framework\Assert::containsIdentical(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\containsOnly')) { + function containsOnly(string $type): TraversableContainsOnly + { + return \PHPUnit\Framework\Assert::containsOnly(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\containsOnlyInstancesOf')) { + function containsOnlyInstancesOf(string $className): TraversableContainsOnly + { + return \PHPUnit\Framework\Assert::containsOnlyInstancesOf(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\arrayHasKey')) { + function arrayHasKey($key): ArrayHasKey + { + return \PHPUnit\Framework\Assert::arrayHasKey(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\equalTo')) { + function equalTo($value): IsEqual + { + return \PHPUnit\Framework\Assert::equalTo(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\equalToCanonicalizing')) { + function equalToCanonicalizing($value): IsEqualCanonicalizing + { + return \PHPUnit\Framework\Assert::equalToCanonicalizing(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\equalToIgnoringCase')) { + function equalToIgnoringCase($value): IsEqualIgnoringCase + { + return \PHPUnit\Framework\Assert::equalToIgnoringCase(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\equalToWithDelta')) { + function equalToWithDelta($value, float $delta): IsEqualWithDelta + { + return \PHPUnit\Framework\Assert::equalToWithDelta(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isEmpty')) { + function isEmpty(): IsEmpty + { + return \PHPUnit\Framework\Assert::isEmpty(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isWritable')) { + function isWritable(): IsWritable + { + return \PHPUnit\Framework\Assert::isWritable(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isReadable')) { + function isReadable(): IsReadable + { + return \PHPUnit\Framework\Assert::isReadable(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\directoryExists')) { + function directoryExists(): DirectoryExists + { + return \PHPUnit\Framework\Assert::directoryExists(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\fileExists')) { + function fileExists(): FileExists + { + return \PHPUnit\Framework\Assert::fileExists(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\greaterThan')) { + function greaterThan($value): GreaterThan + { + return \PHPUnit\Framework\Assert::greaterThan(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\greaterThanOrEqual')) { + function greaterThanOrEqual($value): LogicalOr + { + return \PHPUnit\Framework\Assert::greaterThanOrEqual(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\classHasAttribute')) { + function classHasAttribute(string $attributeName): ClassHasAttribute + { + return \PHPUnit\Framework\Assert::classHasAttribute(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\classHasStaticAttribute')) { + function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute + { + return \PHPUnit\Framework\Assert::classHasStaticAttribute(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\objectHasAttribute')) { + function objectHasAttribute($attributeName): ObjectHasAttribute + { + return \PHPUnit\Framework\Assert::objectHasAttribute(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\identicalTo')) { + function identicalTo($value): IsIdentical + { + return \PHPUnit\Framework\Assert::identicalTo(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isInstanceOf')) { + function isInstanceOf(string $className): IsInstanceOf + { + return \PHPUnit\Framework\Assert::isInstanceOf(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\isType')) { + function isType(string $type): IsType + { + return \PHPUnit\Framework\Assert::isType(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\lessThan')) { + function lessThan($value): LessThan + { + return \PHPUnit\Framework\Assert::lessThan(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\lessThanOrEqual')) { + function lessThanOrEqual($value): LogicalOr + { + return \PHPUnit\Framework\Assert::lessThanOrEqual(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\matchesRegularExpression')) { + function matchesRegularExpression(string $pattern): RegularExpression + { + return \PHPUnit\Framework\Assert::matchesRegularExpression(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\matches')) { + function matches(string $string): StringMatchesFormatDescription + { + return \PHPUnit\Framework\Assert::matches(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\stringStartsWith')) { + function stringStartsWith($prefix): StringStartsWith + { + return \PHPUnit\Framework\Assert::stringStartsWith(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\stringContains')) { + function stringContains(string $string, bool $case = \true): StringContains + { + return \PHPUnit\Framework\Assert::stringContains(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\stringEndsWith')) { + function stringEndsWith(string $suffix): StringEndsWith + { + return \PHPUnit\Framework\Assert::stringEndsWith(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\countOf')) { + function countOf(int $count): Count + { + return \PHPUnit\Framework\Assert::countOf(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\objectEquals')) { + function objectEquals(object $object, string $method = 'equals'): ObjectEquals + { + return \PHPUnit\Framework\Assert::objectEquals(...func_get_args()); + } +} +if (!function_exists('PHPUnit\Framework\any')) { + /** + * Returns a matcher that matches when the method is executed + * zero or more times. + */ + function any(): AnyInvokedCountMatcher + { + return new AnyInvokedCountMatcher(); } +} +if (!function_exists('PHPUnit\Framework\never')) { /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Returns a matcher that matches when the method is never executed. + */ + function never(): InvokedCountMatcher + { + return new InvokedCountMatcher(0); + } +} +if (!function_exists('PHPUnit\Framework\atLeast')) { + /** + * Returns a matcher that matches when the method is executed + * at least N times. + */ + function atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher + { + return new InvokedAtLeastCountMatcher($requiredInvocations); + } +} +if (!function_exists('PHPUnit\Framework\atLeastOnce')) { + /** + * Returns a matcher that matches when the method is executed at least once. + */ + function atLeastOnce(): InvokedAtLeastOnceMatcher + { + return new InvokedAtLeastOnceMatcher(); + } +} +if (!function_exists('PHPUnit\Framework\once')) { + /** + * Returns a matcher that matches when the method is executed exactly once. + */ + function once(): InvokedCountMatcher + { + return new InvokedCountMatcher(1); + } +} +if (!function_exists('PHPUnit\Framework\exactly')) { + /** + * Returns a matcher that matches when the method is executed + * exactly $count times. + */ + function exactly(int $count): InvokedCountMatcher + { + return new InvokedCountMatcher($count); + } +} +if (!function_exists('PHPUnit\Framework\atMost')) { + /** + * Returns a matcher that matches when the method is executed + * at most N times. + */ + function atMost(int $allowedInvocations): InvokedAtMostCountMatcher + { + return new InvokedAtMostCountMatcher($allowedInvocations); + } +} +if (!function_exists('PHPUnit\Framework\at')) { + /** + * Returns a matcher that matches when the method is executed + * at the given index. + */ + function at(int $index): InvokedAtIndexMatcher + { + return new InvokedAtIndexMatcher($index); + } +} +if (!function_exists('PHPUnit\Framework\returnValue')) { + function returnValue($value): ReturnStub + { + return new ReturnStub($value); + } +} +if (!function_exists('PHPUnit\Framework\returnValueMap')) { + function returnValueMap(array $valueMap): ReturnValueMapStub + { + return new ReturnValueMapStub($valueMap); + } +} +if (!function_exists('PHPUnit\Framework\returnArgument')) { + function returnArgument(int $argumentIndex): ReturnArgumentStub + { + return new ReturnArgumentStub($argumentIndex); + } +} +if (!function_exists('PHPUnit\Framework\returnCallback')) { + function returnCallback($callback): ReturnCallbackStub + { + return new ReturnCallbackStub($callback); + } +} +if (!function_exists('PHPUnit\Framework\returnSelf')) { + /** + * Returns the current object. * - * @param mixed $other value or object to evaluate + * This method is useful when mocking a fluent interface. */ - protected function matches($other) : bool + function returnSelf(): ReturnSelfStub { - if ('' === $this->string) { - return \true; - } - if ($this->ignoreCase) { - /* - * We must use the multi byte safe version so we can accurately compare non latin upper characters with - * their lowercase equivalents. - */ - return mb_stripos($other, $this->string, 0, 'UTF-8') !== \false; - } - /* - * Use the non multi byte safe functions to see if the string is contained in $other. - * - * This function is very fast and we don't care about the character position in the string. - * - * Additionally, we want this method to be binary safe so we can check if some binary data is in other binary - * data. - */ - return strpos($other, $this->string) !== \false; + return new ReturnSelfStub(); + } +} +if (!function_exists('PHPUnit\Framework\throwException')) { + function throwException(Throwable $exception): ExceptionStub + { + return new ExceptionStub($exception); + } +} +if (!function_exists('PHPUnit\Framework\onConsecutiveCalls')) { + function onConsecutiveCalls(): ConsecutiveCallsStub + { + $args = func_get_args(); + return new ConsecutiveCallsStub($args); } } suffix = $suffix; - } /** * Returns a string representation of the constraint. */ - public function toString() : string + public function toString(): string { - return 'ends with "' . $this->suffix . '"'; + return 'is false'; } /** * Evaluates the constraint for parameter $other. Returns true if the @@ -55698,9 +61809,9 @@ final class StringEndsWith extends \PHPUnit\Framework\Constraint\Constraint * * @param mixed $other value or object to evaluate */ - protected function matches($other) : bool + protected function matches($other): bool { - return substr($other, 0 - strlen($this->suffix)) === $this->suffix; + return $other === \false; } } createPatternFromFormat($this->convertNewlines($string))); - $this->string = $string; + return 'is true'; } /** * Evaluates the constraint for parameter $other. Returns true if the @@ -55745,38 +61845,9 @@ final class StringMatchesFormatDescription extends \PHPUnit\Framework\Constraint * * @param mixed $other value or object to evaluate */ - protected function matches($other) : bool - { - return parent::matches($this->convertNewlines($other)); - } - protected function failureDescription($other) : string - { - return 'string matches format description'; - } - protected function additionalFailureDescription($other) : string - { - $from = explode("\n", $this->string); - $to = explode("\n", $this->convertNewlines($other)); - foreach ($from as $index => $line) { - if (isset($to[$index]) && $line !== $to[$index]) { - $line = $this->createPatternFromFormat($line); - if (preg_match($line, $to[$index]) > 0) { - $from[$index] = $to[$index]; - } - } - } - $this->string = implode("\n", $from); - $other = implode("\n", $to); - return (new Differ(new UnifiedDiffOutputBuilder("--- Expected\n+++ Actual\n")))->diff($this->string, $other); - } - private function createPatternFromFormat(string $string) : string + protected function matches($other): bool { - $string = strtr(preg_quote($string, '/'), ['%%' => '%', '%e' => '\\' . DIRECTORY_SEPARATOR, '%s' => '[^\\r\\n]+', '%S' => '[^\\r\\n]*', '%a' => '.+', '%A' => '.*', '%w' => '\\s*', '%i' => '[+-]?\\d+', '%d' => '\\d+', '%x' => '[0-9a-fA-F]+', '%f' => '[+-]?\\.?\\d+\\.?\\d*(?:[Ee][+-]?\\d+)?', '%c' => '.']); - return '/^' . $string . '$/s'; - } - private function convertNewlines(string $text) : string - { - return preg_replace('/\\r\\n/', "\n", $text); + return $other === \true; } } prefix = $prefix; + $this->callback = $callback; } /** * Returns a string representation of the constraint. */ - public function toString() : string + public function toString(): string { - return 'starts with "' . $this->prefix . '"'; + return 'is accepted by specified callback'; } /** - * Evaluates the constraint for parameter $other. Returns true if the + * Evaluates the constraint for parameter $value. Returns true if the * constraint is met, false otherwise. * * @param mixed $other value or object to evaluate + * + * @psalm-param CallbackInput $other */ - protected function matches($other) : bool + protected function matches($other): bool { - return strpos((string) $other, $this->prefix) === 0; + return ($this->callback)($other); } } key = $key; + $this->expectedCount = $expected; } - /** - * Returns a string representation of the constraint. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function toString() : string + public function toString(): string { - return 'has the key ' . $this->exporter()->export($this->key); + return sprintf('count matches %d', $this->expectedCount); } /** * Evaluates the constraint for parameter $other. Returns true if the * constraint is met, false otherwise. * - * @param mixed $other value or object to evaluate + * @throws Exception */ - protected function matches($other) : bool + protected function matches($other): bool { - if (is_array($other)) { - return array_key_exists($this->key, $other); + return $this->expectedCount === $this->getCountOf($other); + } + /** + * @throws Exception + */ + protected function getCountOf($other): ?int + { + if ($other instanceof Countable || is_array($other)) { + return count($other); } - if ($other instanceof ArrayAccess) { - return $other->offsetExists($this->key); + if ($other instanceof EmptyIterator) { + return 0; } - return \false; + if ($other instanceof Traversable) { + while ($other instanceof IteratorAggregate) { + try { + $other = $other->getIterator(); + } catch (\Exception $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + } + $iterator = $other; + if ($iterator instanceof Generator) { + return $this->getCountOfGenerator($iterator); + } + if (!$iterator instanceof Iterator) { + return iterator_count($iterator); + } + $key = $iterator->key(); + $count = iterator_count($iterator); + // Manually rewind $iterator to previous key, since iterator_count + // moves pointer. + if ($key !== null) { + $iterator->rewind(); + while ($iterator->valid() && $key !== $iterator->key()) { + $iterator->next(); + } + } + return $count; + } + return null; + } + /** + * Returns the total number of iterations from a generator. + * This will fully exhaust the generator. + */ + protected function getCountOfGenerator(Generator $generator): int + { + for ($count = 0; $generator->valid(); $generator->next()) { + $count++; + } + return $count; } /** * Returns the description of the failure. @@ -55892,12 +62010,10 @@ final class ArrayHasKey extends \PHPUnit\Framework\Constraint\Constraint * cases. This method should return the second part of that sentence. * * @param mixed $other evaluated value or object - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ - protected function failureDescription($other) : string + protected function failureDescription($other): string { - return 'an array ' . $this->toString(); + return sprintf('actual size %d matches expected size %d', (int) $this->getCountOf($other), $this->expectedCount); } } value = $value; @@ -55931,29 +62049,21 @@ abstract class TraversableContains extends \PHPUnit\Framework\Constraint\Constra /** * Returns a string representation of the constraint. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws InvalidArgumentException */ - public function toString() : string + public function toString(): string { - return 'contains ' . $this->exporter()->export($this->value); + return 'is greater than ' . $this->exporter()->export($this->value); } /** - * Returns the description of the failure. - * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. - * - * @param mixed $other evaluated value or object + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @param mixed $other value or object to evaluate */ - protected function failureDescription($other) : string - { - return sprintf('%s %s', is_array($other) ? 'an array' : 'a traversable', $this->toString()); - } - protected function value() + protected function matches($other): bool { - return $this->value; + return $this->value < $other; } } contains($this->value()); + if ($other instanceof EmptyIterator) { + return \true; } - foreach ($other as $element) { - /* @noinspection TypeUnsafeComparisonInspection */ - if ($this->value() == $element) { - return \true; - } + if ($other instanceof Countable) { + return count($other) === 0; } - return \false; + return empty($other); + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + $type = gettype($other); + return sprintf('%s %s %s', (strpos($type, 'a') === 0 || strpos($type, 'o') === 0) ? 'an' : 'a', $type, $this->toString()); } } value = $value; + } + /** + * Returns a string representation of the constraint. + * + * @throws InvalidArgumentException + */ + public function toString(): string + { + return 'is less than ' . $this->exporter()->export($this->value); + } /** * Evaluates the constraint for parameter $other. Returns true if the * constraint is met, false otherwise. * * @param mixed $other value or object to evaluate */ - protected function matches($other) : bool + protected function matches($other): bool { - if ($other instanceof SplObjectStorage) { - return $other->contains($this->value()); - } - foreach ($other as $element) { - if ($this->value() === $element) { - return \true; - } - } - return \false; + return $this->value > $other; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +final class SameSize extends \PHPUnit\Framework\Constraint\Count +{ + public function __construct(iterable $expected) + { + parent::__construct((int) $this->getCountOf($expected)); } } constraint = new \PHPUnit\Framework\Constraint\IsType($type); - } else { - $this->constraint = new \PHPUnit\Framework\Constraint\IsInstanceOf($type); - } - $this->type = $type; - } + private $exporter; /** * Evaluates the constraint for parameter $other. * @@ -56083,19 +62239,14 @@ final class TraversableContainsOnly extends \PHPUnit\Framework\Constraint\Constr * a boolean value instead: true in case of success, false in case of a * failure. * - * @param mixed|Traversable $other - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException * @throws ExpectationFailedException + * @throws InvalidArgumentException */ - public function evaluate($other, string $description = '', bool $returnResult = \false) : ?bool + public function evaluate($other, string $description = '', bool $returnResult = \false): ?bool { - $success = \true; - foreach ($other as $item) { - if (!$this->constraint->evaluate($item, '', \true)) { - $success = \false; - break; - } + $success = \false; + if ($this->matches($other)) { + $success = \true; } if ($returnResult) { return $success; @@ -56106,11 +62257,191 @@ final class TraversableContainsOnly extends \PHPUnit\Framework\Constraint\Constr return null; } /** - * Returns a string representation of the constraint. + * Counts the number of constraint elements. */ - public function toString() : string + public function count(): int { - return 'contains only values of type "' . $this->type . '"'; + return 1; + } + protected function exporter(): Exporter + { + if ($this->exporter === null) { + $this->exporter = new Exporter(); + } + return $this->exporter; + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * This method can be overridden to implement the evaluation algorithm. + * + * @param mixed $other value or object to evaluate + * + * @codeCoverageIgnore + */ + protected function matches($other): bool + { + return \false; + } + /** + * Throws an exception for the given compared value and test description. + * + * @param mixed $other evaluated value or object + * @param string $description Additional information about the test + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-return never-return + */ + protected function fail($other, $description, ?ComparisonFailure $comparisonFailure = null): void + { + $failureDescription = sprintf('Failed asserting that %s.', $this->failureDescription($other)); + $additionalFailureDescription = $this->additionalFailureDescription($other); + if ($additionalFailureDescription) { + $failureDescription .= "\n" . $additionalFailureDescription; + } + if (!empty($description)) { + $failureDescription = $description . "\n" . $failureDescription; + } + throw new ExpectationFailedException($failureDescription, $comparisonFailure); + } + /** + * Return additional failure description where needed. + * + * The function can be overridden to provide additional failure + * information like a diff + * + * @param mixed $other evaluated value or object + */ + protected function additionalFailureDescription($other): string + { + return ''; + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * To provide additional failure information additionalFailureDescription + * can be used. + * + * @param mixed $other evaluated value or object + * + * @throws InvalidArgumentException + */ + protected function failureDescription($other): string + { + return $this->exporter()->export($other) . ' ' . $this->toString(); + } + /** + * Returns a custom string representation of the constraint object when it + * appears in context of an $operator expression. + * + * The purpose of this method is to provide meaningful descriptive string + * in context of operators such as LogicalNot. Native PHPUnit constraints + * are supported out of the box by LogicalNot, but externally developed + * ones had no way to provide correct strings in this context. + * + * The method shall return empty string, when it does not handle + * customization by itself. + * + * @param Operator $operator the $operator of the expression + * @param mixed $role role of $this constraint in the $operator expression + */ + protected function toStringInContext(\PHPUnit\Framework\Constraint\Operator $operator, $role): string + { + return ''; + } + /** + * Returns the description of the failure when this constraint appears in + * context of an $operator expression. + * + * The purpose of this method is to provide meaningful failure description + * in context of operators such as LogicalNot. Native PHPUnit constraints + * are supported out of the box by LogicalNot, but externally developed + * ones had no way to provide correct messages in this context. + * + * The method shall return empty string, when it does not handle + * customization by itself. + * + * @param Operator $operator the $operator of the expression + * @param mixed $role role of $this constraint in the $operator expression + * @param mixed $other evaluated value or object + */ + protected function failureDescriptionInContext(\PHPUnit\Framework\Constraint\Operator $operator, $role, $other): string + { + $string = $this->toStringInContext($operator, $role); + if ($string === '') { + return ''; + } + return $this->exporter()->export($other) . ' ' . $string; + } + /** + * Reduces the sub-expression starting at $this by skipping degenerate + * sub-expression and returns first descendant constraint that starts + * a non-reducible sub-expression. + * + * Returns $this for terminal constraints and for operators that start + * non-reducible sub-expression, or the nearest descendant of $this that + * starts a non-reducible sub-expression. + * + * A constraint expression may be modelled as a tree with non-terminal + * nodes (operators) and terminal nodes. For example: + * + * LogicalOr (operator, non-terminal) + * + LogicalAnd (operator, non-terminal) + * | + IsType('int') (terminal) + * | + GreaterThan(10) (terminal) + * + LogicalNot (operator, non-terminal) + * + IsType('array') (terminal) + * + * A degenerate sub-expression is a part of the tree, that effectively does + * not contribute to the evaluation of the expression it appears in. An example + * of degenerate sub-expression is a BinaryOperator constructed with single + * operand or nested BinaryOperators, each with single operand. An + * expression involving a degenerate sub-expression is equivalent to a + * reduced expression with the degenerate sub-expression removed, for example + * + * LogicalAnd (operator) + * + LogicalOr (degenerate operator) + * | + LogicalAnd (degenerate operator) + * | + IsType('int') (terminal) + * + GreaterThan(10) (terminal) + * + * is equivalent to + * + * LogicalAnd (operator) + * + IsType('int') (terminal) + * + GreaterThan(10) (terminal) + * + * because the subexpression + * + * + LogicalOr + * + LogicalAnd + * + - + * + * is degenerate. Calling reduce() on the LogicalOr object above, as well + * as on LogicalAnd, shall return the IsType('int') instance. + * + * Other specific reductions can be implemented, for example cascade of + * LogicalNot operators + * + * + LogicalNot + * + LogicalNot + * +LogicalNot + * + IsTrue + * + * can be reduced to + * + * LogicalNot + * + IsTrue + */ + protected function reduce(): self + { + return $this; } } className = $className; - } + private $value; /** - * Returns a string representation of the constraint. + * @var float */ - public function toString() : string - { - return sprintf('is instance of %s "%s"', $this->getType(), $this->className); - } + private $delta; /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. - * - * @param mixed $other value or object to evaluate + * @var bool + */ + private $canonicalize; + /** + * @var bool */ - protected function matches($other) : bool + private $ignoreCase; + public function __construct($value, float $delta = 0.0, bool $canonicalize = \false, bool $ignoreCase = \false) { - return $other instanceof $this->className; + $this->value = $value; + $this->delta = $delta; + $this->canonicalize = $canonicalize; + $this->ignoreCase = $ignoreCase; } /** - * Returns the description of the failure. + * Evaluates the constraint for parameter $other. * - * The beginning of failure messages is "Failed asserting that" in most - * cases. This method should return the second part of that sentence. + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. * - * @param mixed $other evaluated value or object + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - protected function failureDescription($other) : string + public function evaluate($other, string $description = '', bool $returnResult = \false): ?bool { - return sprintf('%s is an instance of %s "%s"', $this->exporter()->shortenedExport($other), $this->getType(), $this->className); + // If $this->value and $other are identical, they are also equal. + // This is the most common path and will allow us to skip + // initialization of all the comparators. + if ($this->value === $other) { + return \true; + } + $comparatorFactory = ComparatorFactory::getInstance(); + try { + $comparator = $comparatorFactory->getComparatorFor($this->value, $other); + $comparator->assertEquals($this->value, $other, $this->delta, $this->canonicalize, $this->ignoreCase); + } catch (ComparisonFailure $f) { + if ($returnResult) { + return \false; + } + throw new ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f); + } + return \true; } - private function getType() : string + /** + * Returns a string representation of the constraint. + * + * @throws InvalidArgumentException + */ + public function toString(): string { - try { - $reflection = new ReflectionClass($this->className); - if ($reflection->isInterface()) { - return 'interface'; + $delta = ''; + if (is_string($this->value)) { + if (strpos($this->value, "\n") !== \false) { + return 'is equal to '; } - } catch (ReflectionException $e) { + return sprintf("is equal to '%s'", $this->value); } - return 'class'; + if ($this->delta != 0) { + $delta = sprintf(' with delta <%F>', $this->delta); + } + return sprintf('is equal to %s%s', $this->exporter()->export($this->value), $delta); } } value = $value; } /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. + * Evaluates the constraint for parameter $other. * - * @param mixed $other value or object to evaluate + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @throws ExpectationFailedException */ - protected function matches($other) : bool + public function evaluate($other, string $description = '', bool $returnResult = \false): ?bool { - return $other === null; + // If $this->value and $other are identical, they are also equal. + // This is the most common path and will allow us to skip + // initialization of all the comparators. + if ($this->value === $other) { + return \true; + } + $comparatorFactory = ComparatorFactory::getInstance(); + try { + $comparator = $comparatorFactory->getComparatorFor($this->value, $other); + $comparator->assertEquals($this->value, $other, 0.0, \true, \false); + } catch (ComparisonFailure $f) { + if ($returnResult) { + return \false; + } + throw new ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f); + } + return \true; + } + /** + * Returns a string representation of the constraint. + * + * @throws InvalidArgumentException + */ + public function toString(): string + { + if (is_string($this->value)) { + if (strpos($this->value, "\n") !== \false) { + return 'is equal to '; + } + return sprintf("is equal to '%s'", $this->value); + } + return sprintf('is equal to %s', $this->exporter()->export($this->value)); } } value = $value; + } /** - * @var string + * Evaluates the constraint for parameter $other. + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @throws ExpectationFailedException */ - public const TYPE_BOOL = 'bool'; - /** - * @var string - */ - public const TYPE_FLOAT = 'float'; - /** - * @var string - */ - public const TYPE_INT = 'int'; - /** - * @var string - */ - public const TYPE_NULL = 'null'; - /** - * @var string - */ - public const TYPE_NUMERIC = 'numeric'; - /** - * @var string - */ - public const TYPE_OBJECT = 'object'; - /** - * @var string - */ - public const TYPE_RESOURCE = 'resource'; - /** - * @var string - */ - public const TYPE_CLOSED_RESOURCE = 'resource (closed)'; - /** - * @var string - */ - public const TYPE_STRING = 'string'; - /** - * @var string - */ - public const TYPE_SCALAR = 'scalar'; - /** - * @var string - */ - public const TYPE_CALLABLE = 'callable'; - /** - * @var string - */ - public const TYPE_ITERABLE = 'iterable'; - /** - * @var array - */ - private const KNOWN_TYPES = ['array' => \true, 'boolean' => \true, 'bool' => \true, 'double' => \true, 'float' => \true, 'integer' => \true, 'int' => \true, 'null' => \true, 'numeric' => \true, 'object' => \true, 'real' => \true, 'resource' => \true, 'resource (closed)' => \true, 'string' => \true, 'scalar' => \true, 'callable' => \true, 'iterable' => \true]; - /** - * @var string - */ - private $type; - /** - * @throws \PHPUnit\Framework\Exception - */ - public function __construct(string $type) - { - if (!isset(self::KNOWN_TYPES[$type])) { - throw new \PHPUnit\Framework\Exception(sprintf('Type specified for PHPUnit\\Framework\\Constraint\\IsType <%s> ' . 'is not a valid type.', $type)); - } - $this->type = $type; - } + public function evaluate($other, string $description = '', bool $returnResult = \false): ?bool + { + // If $this->value and $other are identical, they are also equal. + // This is the most common path and will allow us to skip + // initialization of all the comparators. + if ($this->value === $other) { + return \true; + } + $comparatorFactory = ComparatorFactory::getInstance(); + try { + $comparator = $comparatorFactory->getComparatorFor($this->value, $other); + $comparator->assertEquals($this->value, $other, 0.0, \false, \true); + } catch (ComparisonFailure $f) { + if ($returnResult) { + return \false; + } + throw new ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f); + } + return \true; + } /** * Returns a string representation of the constraint. - */ - public function toString() : string - { - return sprintf('is of type "%s"', $this->type); - } - /** - * Evaluates the constraint for parameter $other. Returns true if the - * constraint is met, false otherwise. * - * @param mixed $other value or object to evaluate + * @throws InvalidArgumentException */ - protected function matches($other) : bool + public function toString(): string { - switch ($this->type) { - case 'numeric': - return is_numeric($other); - case 'integer': - case 'int': - return is_int($other); - case 'double': - case 'float': - case 'real': - return is_float($other); - case 'string': - return is_string($other); - case 'boolean': - case 'bool': - return is_bool($other); - case 'null': - return null === $other; - case 'array': - return is_array($other); - case 'object': - return is_object($other); - case 'resource': - $type = gettype($other); - return $type === 'resource' || $type === 'resource (closed)'; - case 'resource (closed)': - return gettype($other) === 'resource (closed)'; - case 'scalar': - return is_scalar($other); - case 'callable': - return is_callable($other); - case 'iterable': - return is_iterable($other); - default: - return \false; + if (is_string($this->value)) { + if (strpos($this->value, "\n") !== \false) { + return 'is equal to '; + } + return sprintf("is equal to '%s'", $this->value); } + return sprintf('is equal to %s', $this->exporter()->export($this->value)); } } + * @var mixed */ - private $dependencies = []; + private $value; /** - * @param list $dependencies + * @var float */ - public function setDependencies(array $dependencies) : void + private $delta; + public function __construct($value, float $delta) { - $this->dependencies = $dependencies; - foreach ($this->tests as $test) { - if (!$test instanceof \PHPUnit\Framework\TestCase) { - // @codeCoverageIgnoreStart - continue; - // @codeCoverageIgnoreStart - } - $test->setDependencies($dependencies); - } + $this->value = $value; + $this->delta = $delta; } /** - * @return list + * Evaluates the constraint for parameter $other. + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @throws ExpectationFailedException */ - public function provides() : array + public function evaluate($other, string $description = '', bool $returnResult = \false): ?bool { - if ($this->providedTests === null) { - $this->providedTests = [new \PHPUnit\Framework\ExecutionOrderDependency($this->getName())]; + // If $this->value and $other are identical, they are also equal. + // This is the most common path and will allow us to skip + // initialization of all the comparators. + if ($this->value === $other) { + return \true; } - return $this->providedTests; - } - /** - * @return list - */ - public function requires() : array - { - // A DataProviderTestSuite does not have to traverse its child tests - // as these are inherited and cannot reference dataProvider rows directly - return $this->dependencies; + $comparatorFactory = ComparatorFactory::getInstance(); + try { + $comparator = $comparatorFactory->getComparatorFor($this->value, $other); + $comparator->assertEquals($this->value, $other, $this->delta); + } catch (ComparisonFailure $f) { + if ($returnResult) { + return \false; + } + throw new ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f); + } + return \true; } /** - * Returns the size of the each test created using the data provider(s). + * Returns a string representation of the constraint. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws InvalidArgumentException */ - public function getSize() : int + public function toString(): string { - [$className, $methodName] = explode('::', $this->getName()); - return TestUtil::getSize($className, $methodName); + return sprintf('is equal to %s with delta <%F>', $this->exporter()->export($this->value), $this->delta); } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\Error; +namespace PHPUnit\Framework\Constraint; -use PHPUnit\Framework\Exception; +use function get_class; +use function sprintf; +use PHPUnit\Util\Filter; +use Throwable; /** - * @internal + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -class Error extends Exception +final class Exception extends \PHPUnit\Framework\Constraint\Constraint { - public function __construct(string $message, int $code, string $file, int $line, \Exception $previous = null) + /** + * @var string + */ + private $className; + public function __construct(string $className) { - parent::__construct($message, $code, $previous); - $this->file = $file; - $this->line = $line; + $this->className = $className; + } + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return sprintf('exception of type "%s"', $this->className); + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $other instanceof $this->className; + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + if ($other !== null) { + $message = ''; + if ($other instanceof Throwable) { + $message = '. Message was: "' . $other->getMessage() . '" at' . "\n" . Filter::getFilteredStacktrace($other); + } + return sprintf('exception of type "%s" matches expected exception "%s"%s', get_class($other), $this->className, $message); + } + return sprintf('exception of type "%s" is thrown', $this->className); } } expectedCode = $expected; + } + public function toString(): string + { + return 'exception code is '; + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param Throwable $other + */ + protected function matches($other): bool + { + return (string) $other->getCode() === (string) $this->expectedCode; + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws InvalidArgumentException + */ + protected function failureDescription($other): string + { + return sprintf('%s is equal to expected exception code %s', $this->exporter()->export($other->getCode()), $this->exporter()->export($this->expectedCode)); + } } expectedMessage = $expected; + } + public function toString(): string + { + if ($this->expectedMessage === '') { + return 'exception message is empty'; + } + return 'exception message contains '; + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param Throwable $other + */ + protected function matches($other): bool + { + if ($this->expectedMessage === '') { + return $other->getMessage() === ''; + } + return strpos((string) $other->getMessage(), $this->expectedMessage) !== \false; + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + if ($this->expectedMessage === '') { + return sprintf("exception message is empty but is '%s'", $other->getMessage()); + } + return sprintf("exception message '%s' contains '%s'", $other->getMessage(), $this->expectedMessage); + } } message = $message; - parent::__construct('Error'); + $this->expectedMessageRegExp = $expected; } - public function getMessage() : string + public function toString(): string { - return $this->message; + return 'exception message matches '; } /** - * Returns a string representation of the test case. + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param \PHPUnit\Framework\Exception $other + * + * @throws \PHPUnit\Framework\Exception + * @throws Exception */ - public function toString() : string + protected function matches($other): bool { - return 'Error'; + $match = RegularExpressionUtil::safeMatch($this->expectedMessageRegExp, $other->getMessage()); + if ($match === \false) { + throw new \PHPUnit\Framework\Exception("Invalid expected exception message regex given: '{$this->expectedMessageRegExp}'"); + } + return $match === 1; } /** - * @throws Exception + * Returns the description of the failure. * - * @psalm-return never-return + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object */ - protected function runTest() : void + protected function failureDescription($other): string { - throw new \PHPUnit\Framework\Error($this->message); + return sprintf("exception message '%s' matches '%s'", $other->getMessage(), $this->expectedMessageRegExp); } } getMessage() . PHP_EOL; + return is_dir($other); + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return sprintf('directory "%s" exists', $other); } } getMessage(); + return 'file exists'; + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return file_exists($other); + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return sprintf('file "%s" exists', $other); } } getMessage() . PHP_EOL; + return is_writable($other); + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return sprintf('"%s" is writable', $other); } } getMessage() . PHP_EOL; + return 'is anything'; + } + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + return 0; } } value = $value; } - public function __toString() : string + /** + * Evaluates the constraint for parameter $other. + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + */ + public function evaluate($other, string $description = '', bool $returnResult = \false): ?bool { - return $this->getMessage() . PHP_EOL; + $success = $this->value === $other; + if ($returnResult) { + return $success; + } + if (!$success) { + $f = null; + // if both values are strings, make sure a diff is generated + if (is_string($this->value) && is_string($other)) { + $f = new ComparisonFailure($this->value, $other, sprintf("'%s'", $this->value), sprintf("'%s'", $other)); + } + // if both values are array, make sure a diff is generated + if (is_array($this->value) && is_array($other)) { + $f = new ComparisonFailure($this->value, $other, $this->exporter()->export($this->value), $this->exporter()->export($other)); + } + $this->fail($other, $description, $f); + } + return null; + } + /** + * Returns a string representation of the constraint. + * + * @throws InvalidArgumentException + */ + public function toString(): string + { + if (is_object($this->value)) { + return 'is identical to an object of class "' . get_class($this->value) . '"'; + } + return 'is identical to ' . $this->exporter()->export($this->value); + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws InvalidArgumentException + */ + protected function failureDescription($other): string + { + if (is_object($this->value) && is_object($other)) { + return 'two variables reference the same object'; + } + if (is_string($this->value) && is_string($other)) { + return 'two strings are identical'; + } + if (is_array($this->value) && is_array($other)) { + return 'two arrays are identical'; + } + return parent::failureDescription($other); } } value = $value; } - public function __toString() : string + /** + * Returns a string representation of the object. + */ + public function toString(): string { - return $this->getMessage() . PHP_EOL; + return sprintf('matches JSON string "%s"', $this->value); + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * This method can be overridden to implement the evaluation algorithm. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + [$error, $recodedOther] = Json::canonicalize($other); + if ($error) { + return \false; + } + [$error, $recodedValue] = Json::canonicalize($this->value); + if ($error) { + return \false; + } + return $recodedOther == $recodedValue; + } + /** + * Throws an exception for the given compared value and test description. + * + * @param mixed $other evaluated value or object + * @param string $description Additional information about the test + * + * @throws Exception + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * + * @psalm-return never-return + */ + protected function fail($other, $description, ?ComparisonFailure $comparisonFailure = null): void + { + if ($comparisonFailure === null) { + [$error, $recodedOther] = Json::canonicalize($other); + if ($error) { + parent::fail($other, $description); + } + [$error, $recodedValue] = Json::canonicalize($this->value); + if ($error) { + parent::fail($other, $description); + } + $comparisonFailure = new ComparisonFailure(json_decode($this->value), json_decode($other), Json::prettify($recodedValue), Json::prettify($recodedOther), \false, 'Failed asserting that two json values are equal.'); + } + parent::fail($other, $description, $comparisonFailure); } } getMessage() . PHP_EOL; + switch (strtolower($type)) { + case 'expected': + $prefix = 'Expected value JSON decode error - '; + break; + case 'actual': + $prefix = 'Actual value JSON decode error - '; + break; + default: + $prefix = ''; + break; + } + return $prefix; } } getMessage(); + return 'is infinite'; + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return is_infinite($other); } } serializableTrace = $this->getTrace(); - foreach (array_keys($this->serializableTrace) as $key) { - unset($this->serializableTrace[$key]['args']); - } - } - public function __toString() : string - { - $string = \PHPUnit\Framework\TestFailure::exceptionToString($this); - if ($trace = Filter::getFilteredStacktrace($this)) { - $string .= "\n" . $trace; - } - return $string; - } - public function __sleep() : array + public function toString(): string { - return array_keys(get_object_vars($this)); + return 'is nan'; } /** - * Returns the serializable trace (without 'args'). + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate */ - public function getSerializableTrace() : array + protected function matches($other): bool { - return $this->serializableTrace; + return is_nan($other); } } comparisonFailure = $comparisonFailure; - parent::__construct($message, 0, $previous); + $this->attributeName = $attributeName; } - public function getComparisonFailure() : ?ComparisonFailure + /** + * Returns a string representation of the constraint. + */ + public function toString(): string { - return $this->comparisonFailure; + return sprintf('has attribute "%s"', $this->attributeName); + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + try { + return (new ReflectionClass($other))->hasProperty($this->attributeName); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return sprintf('%sclass "%s" %s', is_object($other) ? 'object of ' : '', is_object($other) ? get_class($other) : $other, $this->toString()); + } + protected function attributeName(): string + { + return $this->attributeName; } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; +namespace PHPUnit\Framework\Constraint; -use function debug_backtrace; -use function in_array; -use function lcfirst; use function sprintf; +use PHPUnit\Framework\Exception; +use ReflectionClass; +use ReflectionException; /** - * @internal This class is not covered by the backward compatibility promise for PHPUnit + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ -final class InvalidArgumentException extends \PHPUnit\Framework\Exception +final class ClassHasStaticAttribute extends \PHPUnit\Framework\Constraint\ClassHasAttribute { - public static function create(int $argument, string $type) : self + /** + * Returns a string representation of the constraint. + */ + public function toString(): string { - $stack = debug_backtrace(); - $function = $stack[1]['function']; - if (isset($stack[1]['class'])) { - $function = sprintf('%s::%s', $stack[1]['class'], $stack[1]['function']); - } - return new self(sprintf('Argument #%d of %s() must be %s %s', $argument, $function, in_array(lcfirst($type)[0], ['a', 'e', 'i', 'o', 'u'], \true) ? 'an' : 'a', $type)); + return sprintf('has static attribute "%s"', $this->attributeName()); } - private function __construct(string $message = '', int $code = 0, \Exception $previous = null) + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool { - parent::__construct($message, $code, $previous); + try { + $class = new ReflectionClass($other); + if ($class->hasProperty($this->attributeName())) { + return $class->getProperty($this->attributeName())->isStatic(); + } + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + return \false; } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class InvalidDataProviderException extends \PHPUnit\Framework\Exception -{ -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class MissingCoversAnnotationException extends \PHPUnit\Framework\RiskyTestError +final class ObjectEquals extends \PHPUnit\Framework\Constraint\Constraint { + /** + * @var object + */ + private $expected; + /** + * @var string + */ + private $method; + public function __construct(object $object, string $method = 'equals') + { + $this->expected = $object; + $this->method = $method; + } + public function toString(): string + { + return 'two objects are equal'; + } + /** + * @throws ActualValueIsNotAnObjectException + * @throws ComparisonMethodDoesNotAcceptParameterTypeException + * @throws ComparisonMethodDoesNotDeclareBoolReturnTypeException + * @throws ComparisonMethodDoesNotDeclareExactlyOneParameterException + * @throws ComparisonMethodDoesNotDeclareParameterTypeException + * @throws ComparisonMethodDoesNotExistException + */ + protected function matches($other): bool + { + if (!is_object($other)) { + throw new ActualValueIsNotAnObjectException(); + } + $object = new ReflectionObject($other); + if (!$object->hasMethod($this->method)) { + throw new ComparisonMethodDoesNotExistException(get_class($other), $this->method); + } + /** @noinspection PhpUnhandledExceptionInspection */ + $method = $object->getMethod($this->method); + if (!$method->hasReturnType()) { + throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(get_class($other), $this->method); + } + $returnType = $method->getReturnType(); + if (!$returnType instanceof ReflectionNamedType) { + throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(get_class($other), $this->method); + } + if ($returnType->allowsNull()) { + throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(get_class($other), $this->method); + } + if ($returnType->getName() !== 'bool') { + throw new ComparisonMethodDoesNotDeclareBoolReturnTypeException(get_class($other), $this->method); + } + if ($method->getNumberOfParameters() !== 1 || $method->getNumberOfRequiredParameters() !== 1) { + throw new ComparisonMethodDoesNotDeclareExactlyOneParameterException(get_class($other), $this->method); + } + $parameter = $method->getParameters()[0]; + if (!$parameter->hasType()) { + throw new ComparisonMethodDoesNotDeclareParameterTypeException(get_class($other), $this->method); + } + $type = $parameter->getType(); + if (!$type instanceof ReflectionNamedType) { + throw new ComparisonMethodDoesNotDeclareParameterTypeException(get_class($other), $this->method); + } + $typeName = $type->getName(); + if ($typeName === 'self') { + $typeName = get_class($other); + } + if (!$this->expected instanceof $typeName) { + throw new ComparisonMethodDoesNotAcceptParameterTypeException(get_class($other), $this->method, get_class($this->expected)); + } + return $other->{$this->method}($this->expected); + } + protected function failureDescription($other): string + { + return $this->toString(); + } } + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601 */ -final class OutputError extends \PHPUnit\Framework\AssertionFailedError +final class ObjectHasAttribute extends \PHPUnit\Framework\Constraint\ClassHasAttribute { + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return (new ReflectionObject($other))->hasProperty($this->attributeName()); + } } diff = $diff; + $this->propertyName = $propertyName; } - public function getDiff() : string + /** + * Returns a string representation of the constraint. + */ + public function toString(): string { - return $this->diff; + return sprintf('has property "%s"', $this->propertyName); + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + if (!is_object($other)) { + return \false; + } + return (new ReflectionObject($other))->hasProperty($this->propertyName); + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + if (is_object($other)) { + return sprintf('object of class "%s" %s', get_class($other), $this->toString()); + } + return sprintf('"%s" (%s) %s', $other, gettype($other), $this->toString()); } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; +namespace PHPUnit\Framework\Constraint; +use function array_map; +use function array_values; +use function count; /** - * @internal This class is not covered by the backward compatibility promise for PHPUnit + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit */ -final class SkippedTestError extends \PHPUnit\Framework\AssertionFailedError implements \PHPUnit\Framework\SkippedTest +abstract class BinaryOperator extends \PHPUnit\Framework\Constraint\Operator { + /** + * @var Constraint[] + */ + private $constraints = []; + public static function fromConstraints(\PHPUnit\Framework\Constraint\Constraint ...$constraints): self + { + $constraint = new static(); + $constraint->constraints = $constraints; + return $constraint; + } + /** + * @param mixed[] $constraints + */ + public function setConstraints(array $constraints): void + { + $this->constraints = array_map(function ($constraint): \PHPUnit\Framework\Constraint\Constraint { + return $this->checkConstraint($constraint); + }, array_values($constraints)); + } + /** + * Returns the number of operands (constraints). + */ + final public function arity(): int + { + return count($this->constraints); + } + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + $reduced = $this->reduce(); + if ($reduced !== $this) { + return $reduced->toString(); + } + $text = ''; + foreach ($this->constraints as $key => $constraint) { + $constraint = $constraint->reduce(); + $text .= $this->constraintToString($constraint, $key); + } + return $text; + } + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + $count = 0; + foreach ($this->constraints as $constraint) { + $count += count($constraint); + } + return $count; + } + /** + * Returns the nested constraints. + */ + final protected function constraints(): array + { + return $this->constraints; + } + /** + * Returns true if the $constraint needs to be wrapped with braces. + */ + final protected function constraintNeedsParentheses(\PHPUnit\Framework\Constraint\Constraint $constraint): bool + { + return $this->arity() > 1 && parent::constraintNeedsParentheses($constraint); + } + /** + * Reduces the sub-expression starting at $this by skipping degenerate + * sub-expression and returns first descendant constraint that starts + * a non-reducible sub-expression. + * + * See Constraint::reduce() for more. + */ + protected function reduce(): \PHPUnit\Framework\Constraint\Constraint + { + if ($this->arity() === 1 && $this->constraints[0] instanceof \PHPUnit\Framework\Constraint\Operator) { + return $this->constraints[0]->reduce(); + } + return parent::reduce(); + } + /** + * Returns string representation of given operand in context of this operator. + * + * @param Constraint $constraint operand constraint + * @param int $position position of $constraint in this expression + */ + private function constraintToString(\PHPUnit\Framework\Constraint\Constraint $constraint, int $position): string + { + $prefix = ''; + if ($position > 0) { + $prefix = ' ' . $this->operator() . ' '; + } + if ($this->constraintNeedsParentheses($constraint)) { + return $prefix . '( ' . $constraint->toString() . ' )'; + } + $string = $constraint->toStringInContext($this, $position); + if ($string === '') { + $string = $constraint->toString(); + } + return $prefix . $string; + } } constraints() as $constraint) { + if (!$constraint->evaluate($other, '', \true)) { + return \false; + } + } + return [] !== $this->constraints(); + } } 0) { + $nonInput = $matches[2]; + $negatedString = preg_replace('/' . preg_quote($nonInput, '/') . '/', preg_replace($positives, $negatives, $nonInput), $string); + } else { + $negatedString = preg_replace($positives, $negatives, $string); + } + return $negatedString; + } /** - * The synthetic file. - * - * @var string + * Returns the name of this operator. */ - protected $syntheticFile = ''; + public function operator(): string + { + return 'not'; + } /** - * The synthetic line number. + * Returns this operator's precedence. * - * @var int + * @see https://www.php.net/manual/en/language.operators.precedence.php */ - protected $syntheticLine = 0; + public function precedence(): int + { + return 5; + } /** - * The synthetic trace. + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. * - * @var array + * @param mixed $other value or object to evaluate */ - protected $syntheticTrace = []; - public function __construct(string $message, int $code, string $file, int $line, array $trace) - { - parent::__construct($message, $code); - $this->syntheticFile = $file; - $this->syntheticLine = $line; - $this->syntheticTrace = $trace; - } - public function getSyntheticFile() : string + protected function matches($other): bool { - return $this->syntheticFile; + return !$this->constraint()->evaluate($other, '', \true); } - public function getSyntheticLine() : int + /** + * Applies additional transformation to strings returned by toString() or + * failureDescription(). + */ + protected function transformString(string $string): string { - return $this->syntheticLine; + return self::negate($string); } - public function getSyntheticTrace() : array + /** + * Reduces the sub-expression starting at $this by skipping degenerate + * sub-expression and returns first descendant constraint that starts + * a non-reducible sub-expression. + * + * See Constraint::reduce() for more. + */ + protected function reduce(): \PHPUnit\Framework\Constraint\Constraint { - return $this->syntheticTrace; + $constraint = $this->constraint(); + if ($constraint instanceof self) { + return $constraint->constraint()->reduce(); + } + return parent::reduce(); } } constraints() as $constraint) { + if ($constraint->evaluate($other, '', \true)) { + return \true; + } + } + return \false; + } } constraints(); + $initial = array_shift($constraints); + if ($initial === null) { + return \false; + } + return array_reduce($constraints, static function (bool $matches, \PHPUnit\Framework\Constraint\Constraint $constraint) use ($other): bool { + return $matches xor $constraint->evaluate($other, '', \true); + }, $initial->evaluate($other, '', \true)); + } } getMessage(); + if (!$constraint instanceof \PHPUnit\Framework\Constraint\Constraint) { + return new \PHPUnit\Framework\Constraint\IsEqual($constraint); + } + return $constraint; + } + /** + * Returns true if the $constraint needs to be wrapped with braces. + */ + protected function constraintNeedsParentheses(\PHPUnit\Framework\Constraint\Constraint $constraint): bool + { + return $constraint instanceof self && $constraint->arity() > 1 && $this->precedence() <= $constraint->precedence(); } } constraint = $this->checkConstraint($constraint); + } /** - * @var null|WeakReference + * Returns the number of operands (constraints). */ - private $originalException; - public function __construct(Throwable $t) + public function arity(): int { - // PDOException::getCode() is a string. - // @see https://php.net/manual/en/class.pdoexception.php#95812 - parent::__construct($t->getMessage(), (int) $t->getCode()); - $this->setOriginalException($t); + return 1; } - public function __toString() : string + /** + * Returns a string representation of the constraint. + */ + public function toString(): string { - $string = \PHPUnit\Framework\TestFailure::exceptionToString($this); - if ($trace = Filter::getFilteredStacktrace($this)) { - $string .= "\n" . $trace; + $reduced = $this->reduce(); + if ($reduced !== $this) { + return $reduced->toString(); } - if ($this->previous) { - $string .= "\nCaused by\n" . $this->previous; + $constraint = $this->constraint->reduce(); + if ($this->constraintNeedsParentheses($constraint)) { + return $this->operator() . '( ' . $constraint->toString() . ' )'; + } + $string = $constraint->toStringInContext($this, 0); + if ($string === '') { + return $this->transformString($constraint->toString()); } return $string; } - public function getClassName() : string - { - return $this->className; - } - public function getPreviousWrapped() : ?self - { - return $this->previous; - } - public function setClassName(string $className) : void + /** + * Counts the number of constraint elements. + */ + public function count(): int { - $this->className = $className; + return count($this->constraint); } - public function setOriginalException(Throwable $t) : void + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws InvalidArgumentException + */ + protected function failureDescription($other): string { - $this->originalException($t); - $this->className = get_class($t); - $this->file = $t->getFile(); - $this->line = $t->getLine(); - $this->serializableTrace = $t->getTrace(); - foreach (array_keys($this->serializableTrace) as $key) { - unset($this->serializableTrace[$key]['args']); + $reduced = $this->reduce(); + if ($reduced !== $this) { + return $reduced->failureDescription($other); } - if ($t->getPrevious()) { - $this->previous = new self($t->getPrevious()); + $constraint = $this->constraint->reduce(); + if ($this->constraintNeedsParentheses($constraint)) { + return $this->operator() . '( ' . $constraint->failureDescription($other) . ' )'; + } + $string = $constraint->failureDescriptionInContext($this, 0, $other); + if ($string === '') { + return $this->transformString($constraint->failureDescription($other)); } + return $string; } - public function getOriginalException() : ?Throwable + /** + * Transforms string returned by the memeber constraint's toString() or + * failureDescription() such that it reflects constraint's participation in + * this expression. + * + * The method may be overwritten in a subclass to apply default + * transformation in case the operand constraint does not provide its own + * custom strings via toStringInContext() or failureDescriptionInContext(). + * + * @param string $string the string to be transformed + */ + protected function transformString(string $string): string { - return $this->originalException(); + return $string; } /** - * Method to contain static originalException to exclude it from stacktrace to prevent the stacktrace contents, - * which can be quite big, from being garbage-collected, thus blocking memory until shutdown. - * - * Approach works both for var_dump() and var_export() and print_r(). + * Provides access to $this->constraint for subclasses. */ - private function originalException(Throwable $exceptionToStore = null) : ?Throwable + final protected function constraint(): \PHPUnit\Framework\Constraint\Constraint { - // drop once PHP 7.3 support is removed - if (PHP_VERSION_ID < 70400) { - static $originalExceptions; - $instanceId = spl_object_hash($this); - if ($exceptionToStore) { - $originalExceptions[$instanceId] = $exceptionToStore; - } - return $originalExceptions[$instanceId] ?? null; - } - if ($exceptionToStore) { - $this->originalException = WeakReference::create($exceptionToStore); - } - return $this->originalException !== null ? $this->originalException->get() : null; + return $this->constraint; + } + /** + * Returns true if the $constraint needs to be wrapped with parentheses. + */ + protected function constraintNeedsParentheses(\PHPUnit\Framework\Constraint\Constraint $constraint): bool + { + $constraint = $constraint->reduce(); + return $constraint instanceof self || parent::constraintNeedsParentheses($constraint); } } $dependencies - * - * @psalm-return list + * Returns a string representation of the constraint. */ - public static function filterInvalid(array $dependencies) : array + public function toString(): string { - return array_values(array_filter($dependencies, static function (self $d) { - return $d->isValid(); - })); + return 'is valid JSON'; } /** - * @psalm-param list $existing - * @psalm-param list $additional + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. * - * @psalm-return list + * @param mixed $other value or object to evaluate */ - public static function mergeUnique(array $existing, array $additional) : array + protected function matches($other): bool { - $existingTargets = array_map(static function ($dependency) { - return $dependency->getTarget(); - }, $existing); - foreach ($additional as $dependency) { - if (in_array($dependency->getTarget(), $existingTargets, \true)) { - continue; - } - $existingTargets[] = $dependency->getTarget(); - $existing[] = $dependency; + if ($other === '') { + return \false; } - return $existing; + json_decode($other); + if (json_last_error()) { + return \false; + } + return \true; } /** - * @psalm-param list $left - * @psalm-param list $right + * Returns the description of the failure. * - * @psalm-return list + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws InvalidArgumentException */ - public static function diff(array $left, array $right) : array - { - if ($right === []) { - return $left; - } - if ($left === []) { - return []; - } - $diff = []; - $rightTargets = array_map(static function ($dependency) { - return $dependency->getTarget(); - }, $right); - foreach ($left as $dependency) { - if (in_array($dependency->getTarget(), $rightTargets, \true)) { - continue; - } - $diff[] = $dependency; - } - return $diff; - } - public function __construct(string $classOrCallableName, ?string $methodName = null, ?string $option = null) + protected function failureDescription($other): string { - if ($classOrCallableName === '') { - return; - } - if (strpos($classOrCallableName, '::') !== \false) { - [$this->className, $this->methodName] = explode('::', $classOrCallableName); - } else { - $this->className = $classOrCallableName; - $this->methodName = !empty($methodName) ? $methodName : 'class'; - } - if ($option === 'clone') { - $this->useDeepClone = \true; - } elseif ($option === 'shallowClone') { - $this->useShallowClone = \true; + if ($other === '') { + return 'an empty string is valid JSON'; } - } - public function __toString() : string - { - return $this->getTarget(); - } - public function isValid() : bool - { - // Invalid dependencies can be declared and are skipped by the runner - return $this->className !== '' && $this->methodName !== ''; - } - public function useShallowClone() : bool - { - return $this->useShallowClone; - } - public function useDeepClone() : bool - { - return $this->useDeepClone; - } - public function targetIsClass() : bool - { - return $this->methodName === 'class'; - } - public function getTarget() : string - { - return $this->isValid() ? $this->className . '::' . $this->methodName : ''; - } - public function getTargetClassName() : string - { - return $this->className; + json_decode($other); + $error = (string) \PHPUnit\Framework\Constraint\JsonMatchesErrorMessageProvider::determineJsonError((string) json_last_error()); + return sprintf('%s is valid JSON (%s)', $this->exporter()->shortenedExport($other), $error); } } pattern = $pattern; + } + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return sprintf('matches PCRE pattern "%s"', $this->pattern); + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return preg_match($this->pattern, $other) > 0; + } } message = $message; - } - public function getMessage() : string + private $ignoreCase; + public function __construct(string $string, bool $ignoreCase = \false) { - return $this->message; + $this->string = $string; + $this->ignoreCase = $ignoreCase; } /** - * Returns a string representation of the test case. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Returns a string representation of the constraint. */ - public function toString() : string + public function toString(): string { - return $this->getName(); + if ($this->ignoreCase) { + $string = mb_strtolower($this->string, 'UTF-8'); + } else { + $string = $this->string; + } + return sprintf('contains "%s"', $string); } /** - * @throws Exception + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate */ - protected function runTest() : void + protected function matches($other): bool { - $this->markTestIncomplete($this->message); + if ('' === $this->string) { + return \true; + } + if ($this->ignoreCase) { + /* + * We must use the multi byte safe version so we can accurately compare non latin upper characters with + * their lowercase equivalents. + */ + return mb_stripos($other, $this->string, 0, 'UTF-8') !== \false; + } + /* + * Use the non multi byte safe functions to see if the string is contained in $other. + * + * This function is very fast and we don't care about the character position in the string. + * + * Additionally, we want this method to be binary safe so we can check if some binary data is in other binary + * data. + */ + return strpos($other, $this->string) !== \false; } } suffix = $suffix; + } + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'ends with "' . $this->suffix . '"'; + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return substr($other, 0 - strlen($this->suffix)) === $this->suffix; + } } createPatternFromFormat($this->convertNewlines($string))); + $this->string = $string; } - /** @noinspection MagicMethodsValidityInspection */ - public function __phpunit_setOriginalObject($originalObject) : void + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool { - $this->__phpunit_originalObject = $originalObject; + return parent::matches($this->convertNewlines($other)); } - /** @noinspection MagicMethodsValidityInspection */ - public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration) : void + protected function failureDescription($other): string { - $this->__phpunit_returnValueGeneration = $returnValueGeneration; + return 'string matches format description'; } - /** @noinspection MagicMethodsValidityInspection */ - public function __phpunit_getInvocationHandler() : \PHPUnit\Framework\MockObject\InvocationHandler + protected function additionalFailureDescription($other): string { - if ($this->__phpunit_invocationMocker === null) { - $this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationHandler(static::$__phpunit_configurableMethods, $this->__phpunit_returnValueGeneration); + $from = explode("\n", $this->string); + $to = explode("\n", $this->convertNewlines($other)); + foreach ($from as $index => $line) { + if (isset($to[$index]) && $line !== $to[$index]) { + $line = $this->createPatternFromFormat($line); + if (preg_match($line, $to[$index]) > 0) { + $from[$index] = $to[$index]; + } + } } - return $this->__phpunit_invocationMocker; - } - /** @noinspection MagicMethodsValidityInspection */ - public function __phpunit_hasMatchers() : bool - { - return $this->__phpunit_getInvocationHandler()->hasMatchers(); + $this->string = implode("\n", $from); + $other = implode("\n", $to); + return (new Differ(new UnifiedDiffOutputBuilder("--- Expected\n+++ Actual\n")))->diff($this->string, $other); } - /** @noinspection MagicMethodsValidityInspection */ - public function __phpunit_verify(bool $unsetInvocationMocker = \true) : void + private function createPatternFromFormat(string $string): string { - $this->__phpunit_getInvocationHandler()->verify(); - if ($unsetInvocationMocker) { - $this->__phpunit_invocationMocker = null; - } + $string = strtr(preg_quote($string, '/'), ['%%' => '%', '%e' => '\\' . DIRECTORY_SEPARATOR, '%s' => '[^\r\n]+', '%S' => '[^\r\n]*', '%a' => '.+', '%A' => '.*', '%w' => '\s*', '%i' => '[+-]?\d+', '%d' => '\d+', '%x' => '[0-9a-fA-F]+', '%f' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?', '%c' => '.']); + return '/^' . $string . '$/s'; } - public function expects(InvocationOrder $matcher) : InvocationMockerBuilder + private function convertNewlines(string $text): string { - return $this->__phpunit_getInvocationHandler()->expects($matcher); + return preg_replace('/\r\n/', "\n", $text); } } expects(new AnyInvokedCount()); - return call_user_func_array([$expects, 'method'], func_get_args()); + /** + * @var string + */ + private $prefix; + public function __construct(string $prefix) + { + if ($prefix === '') { + throw InvalidArgumentException::create(1, 'non-empty string'); + } + $this->prefix = $prefix; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject\Builder; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -interface Identity -{ /** - * Sets the identification of the expectation to $id. - * - * @note The identifier is unique per mock object. + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'starts with "' . $this->prefix . '"'; + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. * - * @param string $id unique identification of expectation + * @param mixed $other value or object to evaluate */ - public function id($id); + protected function matches($other): bool + { + return strpos((string) $other, $this->prefix) === 0; + } } invocationHandler = $handler; - $this->matcher = $matcher; - $this->configurableMethods = $configurableMethods; + $this->key = $key; } /** - * @throws MatcherAlreadyRegisteredException + * Returns a string representation of the constraint. * - * @return $this - */ - public function id($id) : self - { - $this->invocationHandler->registerMatcher($id, $this->matcher); - return $this; - } - /** - * @return $this + * @throws InvalidArgumentException */ - public function will(Stub $stub) : \PHPUnit\Framework\MockObject\Builder\Identity + public function toString(): string { - $this->matcher->setStub($stub); - return $this; + return 'has the key ' . $this->exporter()->export($this->key); } /** - * @param mixed $value - * @param mixed[] $nextValues + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. * - * @throws IncompatibleReturnValueException + * @param mixed $other value or object to evaluate */ - public function willReturn($value, ...$nextValues) : self + protected function matches($other): bool { - if (count($nextValues) === 0) { - $this->ensureTypeOfReturnValues([$value]); - $stub = $value instanceof Stub ? $value : new ReturnStub($value); - } else { - $values = array_merge([$value], $nextValues); - $this->ensureTypeOfReturnValues($values); - $stub = new ConsecutiveCalls($values); + if (is_array($other)) { + return array_key_exists($this->key, $other); } - return $this->will($stub); - } - public function willReturnReference(&$reference) : self - { - $stub = new ReturnReference($reference); - return $this->will($stub); - } - public function willReturnMap(array $valueMap) : self - { - $stub = new ReturnValueMap($valueMap); - return $this->will($stub); - } - public function willReturnArgument($argumentIndex) : self - { - $stub = new ReturnArgument($argumentIndex); - return $this->will($stub); - } - public function willReturnCallback($callback) : self - { - $stub = new ReturnCallback($callback); - return $this->will($stub); - } - public function willReturnSelf() : self - { - $stub = new ReturnSelf(); - return $this->will($stub); - } - public function willReturnOnConsecutiveCalls(...$values) : self - { - $stub = new ConsecutiveCalls($values); - return $this->will($stub); - } - public function willThrowException(Throwable $exception) : self - { - $stub = new Exception($exception); - return $this->will($stub); - } - /** - * @return $this - */ - public function after($id) : self - { - $this->matcher->setAfterMatchBuilderId($id); - return $this; - } - /** - * @param mixed[] $arguments - * - * @throws \PHPUnit\Framework\Exception - * @throws MethodNameNotConfiguredException - * @throws MethodParametersAlreadyConfiguredException - * - * @return $this - */ - public function with(...$arguments) : self - { - $this->ensureParametersCanBeConfigured(); - $this->matcher->setParametersRule(new Rule\Parameters($arguments)); - return $this; - } - /** - * @param array ...$arguments - * - * @throws \PHPUnit\Framework\Exception - * @throws MethodNameNotConfiguredException - * @throws MethodParametersAlreadyConfiguredException - * - * @return $this - * - * @deprecated - */ - public function withConsecutive(...$arguments) : self - { - $this->ensureParametersCanBeConfigured(); - $this->matcher->setParametersRule(new Rule\ConsecutiveParameters($arguments)); - return $this; + if ($other instanceof ArrayAccess) { + return $other->offsetExists($this->key); + } + return \false; } /** - * @throws MethodNameNotConfiguredException - * @throws MethodParametersAlreadyConfiguredException + * Returns the description of the failure. * - * @return $this - */ - public function withAnyParameters() : self - { - $this->ensureParametersCanBeConfigured(); - $this->matcher->setParametersRule(new Rule\AnyParameters()); - return $this; - } - /** - * @param Constraint|string $constraint + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. * - * @throws \PHPUnit\Framework\InvalidArgumentException - * @throws MethodCannotBeConfiguredException - * @throws MethodNameAlreadyConfiguredException + * @param mixed $other evaluated value or object * - * @return $this - */ - public function method($constraint) : self - { - if ($this->matcher->hasMethodNameRule()) { - throw new MethodNameAlreadyConfiguredException(); - } - $configurableMethodNames = array_map(static function (ConfigurableMethod $configurable) { - return strtolower($configurable->getName()); - }, $this->configurableMethods); - if (is_string($constraint) && !in_array(strtolower($constraint), $configurableMethodNames, \true)) { - throw new MethodCannotBeConfiguredException($constraint); - } - $this->matcher->setMethodNameRule(new Rule\MethodName($constraint)); - return $this; - } - /** - * @throws MethodNameNotConfiguredException - * @throws MethodParametersAlreadyConfiguredException - */ - private function ensureParametersCanBeConfigured() : void - { - if (!$this->matcher->hasMethodNameRule()) { - throw new MethodNameNotConfiguredException(); - } - if ($this->matcher->hasParametersRule()) { - throw new MethodParametersAlreadyConfiguredException(); - } - } - private function getConfiguredMethod() : ?ConfigurableMethod - { - $configuredMethod = null; - foreach ($this->configurableMethods as $configurableMethod) { - if ($this->matcher->getMethodNameRule()->matchesName($configurableMethod->getName())) { - if ($configuredMethod !== null) { - return null; - } - $configuredMethod = $configurableMethod; - } - } - return $configuredMethod; - } - /** - * @throws IncompatibleReturnValueException + * @throws InvalidArgumentException */ - private function ensureTypeOfReturnValues(array $values) : void + protected function failureDescription($other): string { - $configuredMethod = $this->getConfiguredMethod(); - if ($configuredMethod === null) { - return; - } - foreach ($values as $value) { - if (!$configuredMethod->mayReturn($value)) { - throw new IncompatibleReturnValueException($configuredMethod, $value); - } - } + return 'an array ' . $this->toString(); } } value = $value; + } /** - * @param array> $valueMap + * Returns a string representation of the constraint. * - * @return self + * @throws InvalidArgumentException */ - public function willReturnMap(array $valueMap); + public function toString(): string + { + return 'contains ' . $this->exporter()->export($this->value); + } /** - * @param int $argumentIndex + * Returns the description of the failure. * - * @return self - */ - public function willReturnArgument($argumentIndex); - /** - * @param callable $callback + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. * - * @return self - */ - public function willReturnCallback($callback); - /** @return self */ - public function willReturnSelf(); - /** - * @param mixed $values + * @param mixed $other evaluated value or object * - * @return self + * @throws InvalidArgumentException */ - public function willReturnOnConsecutiveCalls(...$values); - /** @return self */ - public function willThrowException(Throwable $exception); + protected function failureDescription($other): string + { + return sprintf('%s %s', is_array($other) ? 'an array' : 'a traversable', $this->toString()); + } + protected function value() + { + return $this->value; + } } contains($this->value()); + } + foreach ($other as $element) { + /* @noinspection TypeUnsafeComparisonInspection */ + if ($this->value() == $element) { + return \true; + } + } + return \false; + } } - * // match first parameter with value 2 - * $b->with(2); - * // match first parameter with value 'smock' and second identical to 42 - * $b->with('smock', new PHPUnit\Framework\Constraint\IsEqual(42)); - * - * - * @return ParametersMatch - */ - public function with(...$arguments); - /** - * Sets a rule which allows any kind of parameters. - * - * Some examples: - * - * // match any number of parameters - * $b->withAnyParameters(); - * + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. * - * @return ParametersMatch + * @param mixed $other value or object to evaluate */ - public function withAnyParameters(); + protected function matches($other): bool + { + if ($other instanceof SplObjectStorage) { + return $other->contains($this->value()); + } + foreach ($other as $element) { + if ($this->value() === $element) { + return \true; + } + } + return \false; + } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject; - -use PHPUnit\SebastianBergmann\Type\Type; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class ConfigurableMethod -{ + private $constraint; /** * @var string */ - private $name; + private $type; /** - * @var Type + * @throws Exception */ - private $returnType; - public function __construct(string $name, Type $returnType) - { - $this->name = $name; - $this->returnType = $returnType; - } - public function getName() : string + public function __construct(string $type, bool $isNativeType = \true) { - return $this->name; + if ($isNativeType) { + $this->constraint = new \PHPUnit\Framework\Constraint\IsType($type); + } else { + $this->constraint = new \PHPUnit\Framework\Constraint\IsInstanceOf($type); + } + $this->type = $type; } - public function mayReturn($value) : bool + /** + * Evaluates the constraint for parameter $other. + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed|Traversable $other + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException + */ + public function evaluate($other, string $description = '', bool $returnResult = \false): ?bool { - if ($value === null && $this->returnType->allowsNull()) { - return \true; + $success = \true; + foreach ($other as $item) { + if (!$this->constraint->evaluate($item, '', \true)) { + $success = \false; + break; + } } - return $this->returnType->isAssignable(Type::fromValue($value, \false)); + if ($returnResult) { + return $success; + } + if (!$success) { + $this->fail($other, $description); + } + return null; } - public function getReturnTypeDeclaration() : string + /** + * Returns a string representation of the constraint. + */ + public function toString(): string { - return $this->returnType->asString(); + return 'contains only values of type "' . $this->type . '"'; } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject; - -use function sprintf; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class CannotUseAddMethodsException extends \PHPUnit\Framework\Exception implements \PHPUnit\Framework\MockObject\Exception -{ - public function __construct(string $type, string $methodName) + /** + * @var string + */ + private $className; + public function __construct(string $className) { - parent::__construct(sprintf('Trying to configure method "%s" with addMethods(), but it exists in class "%s". Use onlyMethods() for methods that exist in the class', $methodName, $type)); + $this->className = $className; + } + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return sprintf('is instance of %s "%s"', $this->getType(), $this->className); + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $other instanceof $this->className; + } + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws InvalidArgumentException + */ + protected function failureDescription($other): string + { + return sprintf('%s is an instance of %s "%s"', $this->exporter()->shortenedExport($other), $this->getType(), $this->className); + } + private function getType(): string + { + try { + $reflection = new ReflectionClass($this->className); + if ($reflection->isInterface()) { + return 'interface'; + } + } catch (ReflectionException $e) { + } + return 'class'; } } + */ + private const KNOWN_TYPES = ['array' => \true, 'boolean' => \true, 'bool' => \true, 'double' => \true, 'float' => \true, 'integer' => \true, 'int' => \true, 'null' => \true, 'numeric' => \true, 'object' => \true, 'real' => \true, 'resource' => \true, 'resource (closed)' => \true, 'string' => \true, 'scalar' => \true, 'callable' => \true, 'iterable' => \true]; + /** + * @var string + */ + private $type; + /** + * @throws Exception + */ + public function __construct(string $type) { - parent::__construct(sprintf('Class "%s" already exists', $className)); + if (!isset(self::KNOWN_TYPES[$type])) { + throw new Exception(sprintf('Type specified for PHPUnit\Framework\Constraint\IsType <%s> ' . 'is not a valid type.', $type)); + } + $this->type = $type; + } + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return sprintf('is of type "%s"', $this->type); + } + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + switch ($this->type) { + case 'numeric': + return is_numeric($other); + case 'integer': + case 'int': + return is_int($other); + case 'double': + case 'float': + case 'real': + return is_float($other); + case 'string': + return is_string($other); + case 'boolean': + case 'bool': + return is_bool($other); + case 'null': + return null === $other; + case 'array': + return is_array($other); + case 'object': + return is_object($other); + case 'resource': + $type = gettype($other); + return $type === 'resource' || $type === 'resource (closed)'; + case 'resource (closed)': + return gettype($other) === 'resource (closed)'; + case 'scalar': + return is_scalar($other); + case 'callable': + return is_callable($other); + case 'iterable': + return is_iterable($other); + default: + return \false; + } } } + */ + private $dependencies = []; + /** + * @param list $dependencies + */ + public function setDependencies(array $dependencies): void { - parent::__construct(sprintf('Class "%s" is declared "final" and cannot be doubled', $className)); + $this->dependencies = $dependencies; + foreach ($this->tests as $test) { + if (!$test instanceof \PHPUnit\Framework\TestCase) { + // @codeCoverageIgnoreStart + continue; + // @codeCoverageIgnoreStart + } + $test->setDependencies($dependencies); + } + } + /** + * @return list + */ + public function provides(): array + { + if ($this->providedTests === null) { + $this->providedTests = [new \PHPUnit\Framework\ExecutionOrderDependency($this->getName())]; + } + return $this->providedTests; + } + /** + * @return list + */ + public function requires(): array + { + // A DataProviderTestSuite does not have to traverse its child tests + // as these are inherited and cannot reference dataProvider rows directly + return $this->dependencies; + } + /** + * Returns the size of the each test created using the data provider(s). + * + * @throws InvalidArgumentException + */ + public function getSize(): int + { + [$className, $methodName] = explode('::', $this->getName()); + return TestUtil::getSize($className, $methodName); } } file = $file; + $this->line = $line; + } } $methods - */ - public function __construct(array $methods) - { - parent::__construct(sprintf('Cannot double using a method list that contains duplicates: "%s" (duplicate: "%s")', implode(', ', $methods), implode(', ', array_unique(array_diff_assoc($methods, array_unique($methods)))))); - } } getName(), is_object($value) ? get_class($value) : gettype($value), $method->getReturnTypeDeclaration())); + $this->message = $message; + parent::__construct('Error'); + } + public function getMessage(): string + { + return $this->message; + } + /** + * Returns a string representation of the test case. + */ + public function toString(): string + { + return 'Error'; + } + /** + * @throws Exception + * + * @psalm-return never-return + */ + protected function runTest(): void + { + throw new \PHPUnit\Framework\Error($this->message); } } getMessage() . PHP_EOL; } } ', $id)); + return $this->getMessage(); } } is already registered', $id)); - } } getMessage() . PHP_EOL; } } getMessage() . PHP_EOL; } } getMessage() . PHP_EOL; } } getMessage() . PHP_EOL; } } getMessage() . PHP_EOL; } } getClassName(), $invocation->getMethodName())); + return $this->getMessage(); } } + * Ensures that exceptions thrown during a test run do not leave stray + * references behind. + * + * Every Exception contains a stack trace. Each stack frame contains the 'args' + * of the called function. The function arguments can contain references to + * instantiated objects. The references prevent the objects from being + * destructed (until test results are eventually printed), so memory cannot be + * freed up. + * + * With enabled process isolation, test results are serialized in the child + * process and unserialized in the parent process. The stack trace of Exceptions + * may contain objects that cannot be serialized or unserialized (e.g., PDO + * connections). Unserializing user-space objects from the child process into + * the parent would break the intended encapsulation of process isolation. + * + * @see http://fabien.potencier.org/article/9/php-serialization-stack-traces-and-exceptions * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject; - -/** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class SoapExtensionNotAvailableException extends \PHPUnit\Framework\Exception implements \PHPUnit\Framework\MockObject\Exception +class Exception extends RuntimeException implements \PHPUnit\Exception { - public function __construct() + /** + * @var array + */ + protected $serializableTrace; + public function __construct($message = '', $code = 0, ?Throwable $previous = null) { - parent::__construct('The SOAP extension is required to generate a test double from WSDL'); + parent::__construct($message, $code, $previous); + $this->serializableTrace = $this->getTrace(); + foreach (array_keys($this->serializableTrace) as $key) { + unset($this->serializableTrace[$key]['args']); + } + } + public function __toString(): string + { + $string = \PHPUnit\Framework\TestFailure::exceptionToString($this); + if ($trace = Filter::getFilteredStacktrace($this)) { + $string .= "\n" . $trace; + } + return $string; + } + public function __sleep(): array + { + return array_keys(get_object_vars($this)); + } + /** + * Returns the serializable trace (without 'args'). + */ + public function getSerializableTrace(): array + { + return $this->serializableTrace; } } comparisonFailure = $comparisonFailure; + parent::__construct($message, 0, $previous); + } + public function getComparisonFailure(): ?ComparisonFailure + { + return $this->comparisonFailure; } } + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class InvalidDataProviderException extends \PHPUnit\Framework\Exception { - public function __clone(): void - { - $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler(); - } } -EOT; - private const MOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT = <<<'EOT' -namespace PHPUnit\Framework\MockObject; + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class MissingCoversAnnotationException extends \PHPUnit\Framework\RiskyTestError { - public function __clone() - { - $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler(); - } } -EOT; - private const UNMOCKED_CLONE_METHOD_WITH_VOID_RETURN_TYPE_TRAIT = <<<'EOT' -namespace PHPUnit\Framework\MockObject; + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class NoChildTestSuiteException extends \PHPUnit\Framework\Exception { - public function __clone(): void - { - $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler(); +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class OutputError extends \PHPUnit\Framework\AssertionFailedError +{ } -EOT; - private const UNMOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT = <<<'EOT' -namespace PHPUnit\Framework\MockObject; + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class PHPTAssertionFailedError extends \PHPUnit\Framework\SyntheticError { - public function __clone() + /** + * @var string + */ + private $diff; + public function __construct(string $message, int $code, string $file, int $line, array $trace, string $diff) { - $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler(); - - parent::__clone(); + parent::__construct($message, $code, $file, $line, $trace); + $this->diff = $diff; + } + public function getDiff(): string + { + return $this->diff; } } -EOT; - /** - * @var array - */ - private const EXCLUDED_METHOD_NAMES = ['__CLASS__' => \true, '__DIR__' => \true, '__FILE__' => \true, '__FUNCTION__' => \true, '__LINE__' => \true, '__METHOD__' => \true, '__NAMESPACE__' => \true, '__TRAIT__' => \true, '__clone' => \true, '__halt_compiler' => \true]; + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +class RiskyTestError extends \PHPUnit\Framework\AssertionFailedError +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class SkippedTestError extends \PHPUnit\Framework\AssertionFailedError implements \PHPUnit\Framework\SkippedTest +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class SkippedTestSuiteError extends \PHPUnit\Framework\AssertionFailedError implements \PHPUnit\Framework\SkippedTest +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +class SyntheticError extends \PHPUnit\Framework\AssertionFailedError +{ /** - * @var array + * The synthetic file. + * + * @var string */ - private static $cache = []; + protected $syntheticFile = ''; /** - * @var Template[] + * The synthetic line number. + * + * @var int */ - private static $templates = []; + protected $syntheticLine = 0; /** - * Returns a mock object for the specified class. - * - * @param null|array $methods + * The synthetic trace. * - * @throws \PHPUnit\Framework\InvalidArgumentException - * @throws ClassAlreadyExistsException - * @throws ClassIsFinalException - * @throws ClassIsReadonlyException - * @throws DuplicateMethodException - * @throws InvalidMethodNameException - * @throws OriginalConstructorInvocationRequiredException - * @throws ReflectionException - * @throws RuntimeException - * @throws UnknownTypeException + * @var array */ - public function getMock(string $type, $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, bool $cloneArguments = \true, bool $callOriginalMethods = \false, object $proxyTarget = null, bool $allowMockingUnknownTypes = \true, bool $returnValueGeneration = \true) : \PHPUnit\Framework\MockObject\MockObject + protected $syntheticTrace = []; + public function __construct(string $message, int $code, string $file, int $line, array $trace) { - if (!is_array($methods) && null !== $methods) { - throw InvalidArgumentException::create(2, 'array'); - } - if ($type === 'Traversable' || $type === '\\Traversable') { - $type = 'Iterator'; - } - if (!$allowMockingUnknownTypes && !class_exists($type, $callAutoload) && !interface_exists($type, $callAutoload)) { - throw new \PHPUnit\Framework\MockObject\UnknownTypeException($type); - } - if (null !== $methods) { - foreach ($methods as $method) { - if (!preg_match('~[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*~', (string) $method)) { - throw new \PHPUnit\Framework\MockObject\InvalidMethodNameException((string) $method); - } - } - if ($methods !== array_unique($methods)) { - throw new \PHPUnit\Framework\MockObject\DuplicateMethodException($methods); - } - } - if ($mockClassName !== '' && class_exists($mockClassName, \false)) { - try { - $reflector = new ReflectionClass($mockClassName); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if (!$reflector->implementsInterface(\PHPUnit\Framework\MockObject\MockObject::class)) { - throw new \PHPUnit\Framework\MockObject\ClassAlreadyExistsException($mockClassName); - } - } - if (!$callOriginalConstructor && $callOriginalMethods) { - throw new \PHPUnit\Framework\MockObject\OriginalConstructorInvocationRequiredException(); - } - $mock = $this->generate($type, $methods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments, $callOriginalMethods); - return $this->getObject($mock, $type, $callOriginalConstructor, $callAutoload, $arguments, $callOriginalMethods, $proxyTarget, $returnValueGeneration); + parent::__construct($message, $code); + $this->syntheticFile = $file; + $this->syntheticLine = $line; + $this->syntheticTrace = $trace; } - /** - * @psalm-param list $interfaces - * - * @throws RuntimeException - * @throws UnknownTypeException - */ - public function getMockForInterfaces(array $interfaces, bool $callAutoload = \true) : \PHPUnit\Framework\MockObject\MockObject + public function getSyntheticFile(): string { - if (count($interfaces) < 2) { - throw new \PHPUnit\Framework\MockObject\RuntimeException('At least two interfaces must be specified'); - } - foreach ($interfaces as $interface) { - if (!interface_exists($interface, $callAutoload)) { - throw new \PHPUnit\Framework\MockObject\UnknownTypeException($interface); - } - } - sort($interfaces); - $methods = []; - foreach ($interfaces as $interface) { - $methods = array_merge($methods, $this->getClassMethods($interface)); - } - if (count(array_unique($methods)) < count($methods)) { - throw new \PHPUnit\Framework\MockObject\RuntimeException('Interfaces must not declare the same method'); - } - $unqualifiedNames = []; - foreach ($interfaces as $interface) { - $parts = explode('\\', $interface); - $unqualifiedNames[] = array_pop($parts); - } - sort($unqualifiedNames); - do { - $intersectionName = sprintf('Intersection_%s_%s', implode('_', $unqualifiedNames), substr(md5((string) mt_rand()), 0, 8)); - } while (interface_exists($intersectionName, \false)); - $template = $this->getTemplate('intersection.tpl'); - $template->setVar(['intersection' => $intersectionName, 'interfaces' => implode(', ', $interfaces)]); - eval($template->render()); - return $this->getMock($intersectionName); + return $this->syntheticFile; } - /** - * Returns a mock object for the specified abstract class with all abstract - * methods of the class mocked. - * - * Concrete methods to mock can be specified with the $mockedMethods parameter. - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $originalClassName - * - * @psalm-return MockObject&RealInstanceType - * - * @throws \PHPUnit\Framework\InvalidArgumentException - * @throws ClassAlreadyExistsException - * @throws ClassIsFinalException - * @throws ClassIsReadonlyException - * @throws DuplicateMethodException - * @throws InvalidMethodNameException - * @throws OriginalConstructorInvocationRequiredException - * @throws ReflectionException - * @throws RuntimeException - * @throws UnknownClassException - * @throws UnknownTypeException - */ - public function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, array $mockedMethods = null, bool $cloneArguments = \true) : \PHPUnit\Framework\MockObject\MockObject + public function getSyntheticLine(): int { - if (class_exists($originalClassName, $callAutoload) || interface_exists($originalClassName, $callAutoload)) { - try { - $reflector = new ReflectionClass($originalClassName); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $methods = $mockedMethods; - foreach ($reflector->getMethods() as $method) { - if ($method->isAbstract() && !in_array($method->getName(), $methods ?? [], \true)) { - $methods[] = $method->getName(); - } - } - if (empty($methods)) { - $methods = null; - } - return $this->getMock($originalClassName, $methods, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $cloneArguments); - } - throw new \PHPUnit\Framework\MockObject\UnknownClassException($originalClassName); + return $this->syntheticLine; } - /** - * Returns a mock object for the specified trait with all abstract methods - * of the trait mocked. Concrete methods to mock can be specified with the - * `$mockedMethods` parameter. - * - * @psalm-param trait-string $traitName - * - * @throws \PHPUnit\Framework\InvalidArgumentException - * @throws ClassAlreadyExistsException - * @throws ClassIsFinalException - * @throws ClassIsReadonlyException - * @throws DuplicateMethodException - * @throws InvalidMethodNameException - * @throws OriginalConstructorInvocationRequiredException - * @throws ReflectionException - * @throws RuntimeException - * @throws UnknownClassException - * @throws UnknownTraitException - * @throws UnknownTypeException - */ - public function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, array $mockedMethods = null, bool $cloneArguments = \true) : \PHPUnit\Framework\MockObject\MockObject + public function getSyntheticTrace(): array { - if (!trait_exists($traitName, $callAutoload)) { - throw new \PHPUnit\Framework\MockObject\UnknownTraitException($traitName); - } - $className = $this->generateClassName($traitName, '', 'Trait_'); - $classTemplate = $this->getTemplate('trait_class.tpl'); - $classTemplate->setVar(['prologue' => 'abstract ', 'class_name' => $className['className'], 'trait_name' => $traitName]); - $mockTrait = new \PHPUnit\Framework\MockObject\MockTrait($classTemplate->render(), $className['className']); - $mockTrait->generate(); - return $this->getMockForAbstractClass($className['className'], $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments); + return $this->syntheticTrace; } - /** - * Returns an object for the specified trait. - * - * @psalm-param trait-string $traitName - * - * @throws ReflectionException - * @throws RuntimeException - * @throws UnknownTraitException +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class SyntheticSkippedError extends \PHPUnit\Framework\SyntheticError implements \PHPUnit\Framework\SkippedTest +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class UnintentionallyCoveredCodeError extends \PHPUnit\Framework\RiskyTestError +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Warning extends \PHPUnit\Framework\Exception implements \PHPUnit\Framework\SelfDescribing +{ + /** + * Wrapper for getMessage() which is declared as final. */ - public function getObjectForTrait(string $traitName, string $traitClassName = '', bool $callAutoload = \true, bool $callOriginalConstructor = \false, array $arguments = []) : object + public function toString(): string { - if (!trait_exists($traitName, $callAutoload)) { - throw new \PHPUnit\Framework\MockObject\UnknownTraitException($traitName); - } - $className = $this->generateClassName($traitName, $traitClassName, 'Trait_'); - $classTemplate = $this->getTemplate('trait_class.tpl'); - $classTemplate->setVar(['prologue' => '', 'class_name' => $className['className'], 'trait_name' => $traitName]); - return $this->getObject(new \PHPUnit\Framework\MockObject\MockTrait($classTemplate->render(), $className['className']), '', $callOriginalConstructor, $callAutoload, $arguments); + return $this->getMessage(); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use const PHP_VERSION_ID; +use function array_keys; +use function get_class; +use function spl_object_hash; +use PHPUnit\Util\Filter; +use Throwable; +use WeakReference; +/** + * Wraps Exceptions thrown by code under test. + * + * Re-instantiates Exceptions thrown by user-space code to retain their original + * class names, properties, and stack traces (but without arguments). + * + * Unlike PHPUnit\Framework\Exception, the complete stack of previous Exceptions + * is processed. + * + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ExceptionWrapper extends \PHPUnit\Framework\Exception +{ /** - * @throws ClassIsFinalException - * @throws ClassIsReadonlyException - * @throws ReflectionException - * @throws RuntimeException + * @var string */ - public function generate(string $type, array $methods = null, string $mockClassName = '', bool $callOriginalClone = \true, bool $callAutoload = \true, bool $cloneArguments = \true, bool $callOriginalMethods = \false) : \PHPUnit\Framework\MockObject\MockClass - { - if ($mockClassName !== '') { - return $this->generateMock($type, $methods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments, $callOriginalMethods); - } - $key = md5($type . serialize($methods) . serialize($callOriginalClone) . serialize($cloneArguments) . serialize($callOriginalMethods)); - if (!isset(self::$cache[$key])) { - self::$cache[$key] = $this->generateMock($type, $methods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments, $callOriginalMethods); - } - return self::$cache[$key]; - } + protected $className; /** - * @throws RuntimeException - * @throws SoapExtensionNotAvailableException + * @var null|ExceptionWrapper + */ + protected $previous; + /** + * @var null|WeakReference */ - public function generateClassFromWsdl(string $wsdlFile, string $className, array $methods = [], array $options = []) : string + private $originalException; + public function __construct(Throwable $t) { - if (!extension_loaded('soap')) { - throw new \PHPUnit\Framework\MockObject\SoapExtensionNotAvailableException(); - } - $options = array_merge($options, ['cache_wsdl' => WSDL_CACHE_NONE]); - try { - $client = new SoapClient($wsdlFile, $options); - $_methods = array_unique($client->__getFunctions()); - unset($client); - } catch (SoapFault $e) { - throw new \PHPUnit\Framework\MockObject\RuntimeException($e->getMessage(), $e->getCode(), $e); + // PDOException::getCode() is a string. + // @see https://php.net/manual/en/class.pdoexception.php#95812 + parent::__construct($t->getMessage(), (int) $t->getCode()); + $this->setOriginalException($t); + } + public function __toString(): string + { + $string = \PHPUnit\Framework\TestFailure::exceptionToString($this); + if ($trace = Filter::getFilteredStacktrace($this)) { + $string .= "\n" . $trace; } - sort($_methods); - $methodTemplate = $this->getTemplate('wsdl_method.tpl'); - $methodsBuffer = ''; - foreach ($_methods as $method) { - preg_match_all('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*\\(/', $method, $matches, PREG_OFFSET_CAPTURE); - $lastFunction = array_pop($matches[0]); - $nameStart = $lastFunction[1]; - $nameEnd = $nameStart + strlen($lastFunction[0]) - 1; - $name = str_replace('(', '', $lastFunction[0]); - if (empty($methods) || in_array($name, $methods, \true)) { - $args = explode(',', str_replace(')', '', substr($method, $nameEnd + 1))); - foreach (range(0, count($args) - 1) as $i) { - $parameterStart = strpos($args[$i], '$'); - if (!$parameterStart) { - continue; - } - $args[$i] = substr($args[$i], $parameterStart); - } - $methodTemplate->setVar(['method_name' => $name, 'arguments' => implode(', ', $args)]); - $methodsBuffer .= $methodTemplate->render(); - } + if ($this->previous) { + $string .= "\nCaused by\n" . $this->previous; } - $optionsBuffer = '['; - foreach ($options as $key => $value) { - $optionsBuffer .= $key . ' => ' . $value; + return $string; + } + public function getClassName(): string + { + return $this->className; + } + public function getPreviousWrapped(): ?self + { + return $this->previous; + } + public function setClassName(string $className): void + { + $this->className = $className; + } + public function setOriginalException(Throwable $t): void + { + $this->originalException($t); + $this->className = get_class($t); + $this->file = $t->getFile(); + $this->line = $t->getLine(); + $this->serializableTrace = $t->getTrace(); + foreach (array_keys($this->serializableTrace) as $key) { + unset($this->serializableTrace[$key]['args']); } - $optionsBuffer .= ']'; - $classTemplate = $this->getTemplate('wsdl_class.tpl'); - $namespace = ''; - if (strpos($className, '\\') !== \false) { - $parts = explode('\\', $className); - $className = array_pop($parts); - $namespace = 'namespace ' . implode('\\', $parts) . ';' . "\n\n"; + if ($t->getPrevious()) { + $this->previous = new self($t->getPrevious()); } - $classTemplate->setVar(['namespace' => $namespace, 'class_name' => $className, 'wsdl' => $wsdlFile, 'options' => $optionsBuffer, 'methods' => $methodsBuffer]); - return $classTemplate->render(); + } + public function getOriginalException(): ?Throwable + { + return $this->originalException(); } /** - * @throws ReflectionException + * Method to contain static originalException to exclude it from stacktrace to prevent the stacktrace contents, + * which can be quite big, from being garbage-collected, thus blocking memory until shutdown. * - * @return string[] + * Approach works both for var_dump() and var_export() and print_r(). */ - public function getClassMethods(string $className) : array + private function originalException(?Throwable $exceptionToStore = null): ?Throwable { - try { - $class = new ReflectionClass($className); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $methods = []; - foreach ($class->getMethods() as $method) { - if ($method->isPublic() || $method->isAbstract()) { - $methods[] = $method->getName(); + // drop once PHP 7.3 support is removed + if (PHP_VERSION_ID < 70400) { + static $originalExceptions; + $instanceId = spl_object_hash($this); + if ($exceptionToStore) { + $originalExceptions[$instanceId] = $exceptionToStore; } + return $originalExceptions[$instanceId] ?? null; } - return $methods; + if ($exceptionToStore) { + $this->originalException = WeakReference::create($exceptionToStore); + } + return ($this->originalException !== null) ? $this->originalException->get() : null; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use function array_filter; +use function array_map; +use function array_values; +use function count; +use function explode; +use function in_array; +use function strpos; +use function trim; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ExecutionOrderDependency +{ /** - * @throws ReflectionException - * - * @return MockMethod[] + * @var string + */ + private $className = ''; + /** + * @var string + */ + private $methodName = ''; + /** + * @var bool + */ + private $useShallowClone = \false; + /** + * @var bool */ - public function mockClassMethods(string $className, bool $callOriginalMethods, bool $cloneArguments) : array + private $useDeepClone = \false; + public static function createFromDependsAnnotation(string $className, string $annotation): self { - try { - $class = new ReflectionClass($className); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + // Split clone option and target + $parts = explode(' ', trim($annotation), 2); + if (count($parts) === 1) { + $cloneOption = ''; + $target = $parts[0]; + } else { + $cloneOption = $parts[0]; + $target = $parts[1]; } - // @codeCoverageIgnoreEnd - $methods = []; - foreach ($class->getMethods() as $method) { - if (($method->isPublic() || $method->isAbstract()) && $this->canMockMethod($method)) { - $methods[] = \PHPUnit\Framework\MockObject\MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments); - } + // Prefix provided class for targets assumed to be in scope + if ($target !== '' && strpos($target, '::') === \false) { + $target = $className . '::' . $target; } - return $methods; + return new self($target, null, $cloneOption); } /** - * @throws ReflectionException + * @psalm-param list $dependencies * - * @return MockMethod[] + * @psalm-return list */ - public function mockInterfaceMethods(string $interfaceName, bool $cloneArguments) : array + public static function filterInvalid(array $dependencies): array { - try { - $class = new ReflectionClass($interfaceName); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $methods = []; - foreach ($class->getMethods() as $method) { - $methods[] = \PHPUnit\Framework\MockObject\MockMethod::fromReflection($method, \false, $cloneArguments); - } - return $methods; + return array_values(array_filter($dependencies, static function (self $d) { + return $d->isValid(); + })); } /** - * @psalm-param class-string $interfaceName - * - * @throws ReflectionException + * @psalm-param list $existing + * @psalm-param list $additional * - * @return ReflectionMethod[] + * @psalm-return list */ - private function userDefinedInterfaceMethods(string $interfaceName) : array + public static function mergeUnique(array $existing, array $additional): array { - try { - // @codeCoverageIgnoreStart - $interface = new ReflectionClass($interfaceName); - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $methods = []; - foreach ($interface->getMethods() as $method) { - if (!$method->isUserDefined()) { + $existingTargets = array_map(static function ($dependency) { + return $dependency->getTarget(); + }, $existing); + foreach ($additional as $dependency) { + if (in_array($dependency->getTarget(), $existingTargets, \true)) { continue; } - $methods[] = $method; + $existingTargets[] = $dependency->getTarget(); + $existing[] = $dependency; } - return $methods; + return $existing; } /** - * @throws ReflectionException - * @throws RuntimeException + * @psalm-param list $left + * @psalm-param list $right + * + * @psalm-return list */ - private function getObject(\PHPUnit\Framework\MockObject\MockType $mockClass, $type = '', bool $callOriginalConstructor = \false, bool $callAutoload = \false, array $arguments = [], bool $callOriginalMethods = \false, object $proxyTarget = null, bool $returnValueGeneration = \true) + public static function diff(array $left, array $right): array { - $className = $mockClass->generate(); - if ($callOriginalConstructor) { - if (count($arguments) === 0) { - $object = new $className(); - } else { - try { - $class = new ReflectionClass($className); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $object = $class->newInstanceArgs($arguments); - } - } else { - try { - $object = (new Instantiator())->instantiate($className); - } catch (InstantiatorException $e) { - throw new \PHPUnit\Framework\MockObject\RuntimeException($e->getMessage()); - } + if ($right === []) { + return $left; } - if ($callOriginalMethods) { - if (!is_object($proxyTarget)) { - if (count($arguments) === 0) { - $proxyTarget = new $type(); - } else { - try { - $class = new ReflectionClass($type); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $proxyTarget = $class->newInstanceArgs($arguments); - } - } - $object->__phpunit_setOriginalObject($proxyTarget); + if ($left === []) { + return []; } - if ($object instanceof \PHPUnit\Framework\MockObject\MockObject) { - $object->__phpunit_setReturnValueGeneration($returnValueGeneration); + $diff = []; + $rightTargets = array_map(static function ($dependency) { + return $dependency->getTarget(); + }, $right); + foreach ($left as $dependency) { + if (in_array($dependency->getTarget(), $rightTargets, \true)) { + continue; + } + $diff[] = $dependency; } - return $object; + return $diff; } - /** - * @throws ClassIsFinalException - * @throws ClassIsReadonlyException - * @throws ReflectionException - * @throws RuntimeException - */ - private function generateMock(string $type, ?array $explicitMethods, string $mockClassName, bool $callOriginalClone, bool $callAutoload, bool $cloneArguments, bool $callOriginalMethods) : \PHPUnit\Framework\MockObject\MockClass + public function __construct(string $classOrCallableName, ?string $methodName = null, ?string $option = null) { - $classTemplate = $this->getTemplate('mocked_class.tpl'); - $additionalInterfaces = []; - $mockedCloneMethod = \false; - $unmockedCloneMethod = \false; - $isClass = \false; - $isInterface = \false; - $class = null; - $mockMethods = new \PHPUnit\Framework\MockObject\MockMethodSet(); - $_mockClassName = $this->generateClassName($type, $mockClassName, 'Mock_'); - if (class_exists($_mockClassName['fullClassName'], $callAutoload)) { - $isClass = \true; - } elseif (interface_exists($_mockClassName['fullClassName'], $callAutoload)) { - $isInterface = \true; + if ($classOrCallableName === '') { + return; } - if (!$isClass && !$isInterface) { - $prologue = 'class ' . $_mockClassName['originalClassName'] . "\n{\n}\n\n"; - if (!empty($_mockClassName['namespaceName'])) { - $prologue = 'namespace ' . $_mockClassName['namespaceName'] . " {\n\n" . $prologue . "}\n\n" . "namespace {\n\n"; - $epilogue = "\n\n}"; - } - $mockedCloneMethod = \true; + if (strpos($classOrCallableName, '::') !== \false) { + [$this->className, $this->methodName] = explode('::', $classOrCallableName); } else { - try { - $class = new ReflectionClass($_mockClassName['fullClassName']); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($class->isFinal()) { - throw new \PHPUnit\Framework\MockObject\ClassIsFinalException($_mockClassName['fullClassName']); - } - if (method_exists($class, 'isReadOnly') && $class->isReadOnly()) { - throw new \PHPUnit\Framework\MockObject\ClassIsReadonlyException($_mockClassName['fullClassName']); - } - // @see https://github.com/sebastianbergmann/phpunit/issues/2995 - if ($isInterface && $class->implementsInterface(Throwable::class)) { - $actualClassName = Exception::class; - $additionalInterfaces[] = $class->getName(); - $isInterface = \false; - try { - $class = new ReflectionClass($actualClassName); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - foreach ($this->userDefinedInterfaceMethods($_mockClassName['fullClassName']) as $method) { - $methodName = $method->getName(); - if ($class->hasMethod($methodName)) { - try { - $classMethod = $class->getMethod($methodName); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if (!$this->canMockMethod($classMethod)) { - continue; - } - } - $mockMethods->addMethods(\PHPUnit\Framework\MockObject\MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)); - } - $_mockClassName = $this->generateClassName($actualClassName, $_mockClassName['className'], 'Mock_'); - } - // @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/103 - if ($isInterface && $class->implementsInterface(Traversable::class) && !$class->implementsInterface(Iterator::class) && !$class->implementsInterface(IteratorAggregate::class)) { - $additionalInterfaces[] = Iterator::class; - $mockMethods->addMethods(...$this->mockClassMethods(Iterator::class, $callOriginalMethods, $cloneArguments)); - } - if ($class->hasMethod('__clone')) { - try { - $cloneMethod = $class->getMethod('__clone'); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if (!$cloneMethod->isFinal()) { - if ($callOriginalClone && !$isInterface) { - $unmockedCloneMethod = \true; - } else { - $mockedCloneMethod = \true; - } - } - } else { - $mockedCloneMethod = \true; - } - } - if ($isClass && $explicitMethods === []) { - $mockMethods->addMethods(...$this->mockClassMethods($_mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments)); + $this->className = $classOrCallableName; + $this->methodName = (!empty($methodName)) ? $methodName : 'class'; } - if ($isInterface && ($explicitMethods === [] || $explicitMethods === null)) { - $mockMethods->addMethods(...$this->mockInterfaceMethods($_mockClassName['fullClassName'], $cloneArguments)); + if ($option === 'clone') { + $this->useDeepClone = \true; + } elseif ($option === 'shallowClone') { + $this->useShallowClone = \true; } - if (is_array($explicitMethods)) { - foreach ($explicitMethods as $methodName) { - if ($class !== null && $class->hasMethod($methodName)) { - try { - $method = $class->getMethod($methodName); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($this->canMockMethod($method)) { - $mockMethods->addMethods(\PHPUnit\Framework\MockObject\MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)); - } - } else { - $mockMethods->addMethods(\PHPUnit\Framework\MockObject\MockMethod::fromName($_mockClassName['fullClassName'], $methodName, $cloneArguments)); - } - } - } - $mockedMethods = ''; - $configurable = []; - foreach ($mockMethods->asArray() as $mockMethod) { - $mockedMethods .= $mockMethod->generateCode(); - $configurable[] = new \PHPUnit\Framework\MockObject\ConfigurableMethod($mockMethod->getName(), $mockMethod->getReturnType()); - } - $method = ''; - if (!$mockMethods->hasMethod('method') && (!isset($class) || !$class->hasMethod('method'))) { - $method = PHP_EOL . ' use \\PHPUnit\\Framework\\MockObject\\Method;'; - } - $cloneTrait = ''; - if ($mockedCloneMethod) { - $cloneTrait = $this->mockedCloneMethod(); - } - if ($unmockedCloneMethod) { - $cloneTrait = $this->unmockedCloneMethod(); - } - $classTemplate->setVar(['prologue' => $prologue ?? '', 'epilogue' => $epilogue ?? '', 'class_declaration' => $this->generateMockClassDeclaration($_mockClassName, $isInterface, $additionalInterfaces), 'clone' => $cloneTrait, 'mock_class_name' => $_mockClassName['className'], 'mocked_methods' => $mockedMethods, 'method' => $method]); - return new \PHPUnit\Framework\MockObject\MockClass($classTemplate->render(), $_mockClassName['className'], $configurable); - } - private function generateClassName(string $type, string $className, string $prefix) : array - { - if ($type[0] === '\\') { - $type = substr($type, 1); - } - $classNameParts = explode('\\', $type); - if (count($classNameParts) > 1) { - $type = array_pop($classNameParts); - $namespaceName = implode('\\', $classNameParts); - $fullClassName = $namespaceName . '\\' . $type; - } else { - $namespaceName = ''; - $fullClassName = $type; - } - if ($className === '') { - do { - $className = $prefix . $type . '_' . substr(md5((string) mt_rand()), 0, 8); - } while (class_exists($className, \false)); - } - return ['className' => $className, 'originalClassName' => $type, 'fullClassName' => $fullClassName, 'namespaceName' => $namespaceName]; } - private function generateMockClassDeclaration(array $mockClassName, bool $isInterface, array $additionalInterfaces = []) : string + public function __toString(): string { - $buffer = 'class '; - $additionalInterfaces[] = \PHPUnit\Framework\MockObject\MockObject::class; - $interfaces = implode(', ', $additionalInterfaces); - if ($isInterface) { - $buffer .= sprintf('%s implements %s', $mockClassName['className'], $interfaces); - if (!in_array($mockClassName['originalClassName'], $additionalInterfaces, \true)) { - $buffer .= ', '; - if (!empty($mockClassName['namespaceName'])) { - $buffer .= $mockClassName['namespaceName'] . '\\'; - } - $buffer .= $mockClassName['originalClassName']; - } - } else { - $buffer .= sprintf('%s extends %s%s implements %s', $mockClassName['className'], !empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '', $mockClassName['originalClassName'], $interfaces); - } - return $buffer; + return $this->getTarget(); } - private function canMockMethod(ReflectionMethod $method) : bool + public function isValid(): bool { - return !($this->isConstructor($method) || $method->isFinal() || $method->isPrivate() || $this->isMethodNameExcluded($method->getName())); + // Invalid dependencies can be declared and are skipped by the runner + return $this->className !== '' && $this->methodName !== ''; } - private function isMethodNameExcluded(string $name) : bool + public function useShallowClone(): bool { - return isset(self::EXCLUDED_METHOD_NAMES[$name]); + return $this->useShallowClone; } - /** - * @throws RuntimeException - */ - private function getTemplate(string $template) : Template + public function useDeepClone(): bool { - $filename = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR . $template; - if (!isset(self::$templates[$filename])) { - try { - self::$templates[$filename] = new Template($filename); - } catch (TemplateException $e) { - throw new \PHPUnit\Framework\MockObject\RuntimeException($e->getMessage(), $e->getCode(), $e); - } - } - return self::$templates[$filename]; + return $this->useDeepClone; } - /** - * @see https://github.com/sebastianbergmann/phpunit/issues/4139#issuecomment-605409765 - */ - private function isConstructor(ReflectionMethod $method) : bool + public function targetIsClass(): bool { - $methodName = strtolower($method->getName()); - if ($methodName === '__construct') { - return \true; - } - if (PHP_MAJOR_VERSION >= 8) { - return \false; - } - $className = strtolower($method->getDeclaringClass()->getName()); - return $methodName === $className; + return $this->methodName === 'class'; } - private function mockedCloneMethod() : string + public function getTarget(): string { - if (PHP_MAJOR_VERSION >= 8) { - if (!trait_exists('\\PHPUnit\\Framework\\MockObject\\MockedCloneMethodWithVoidReturnType')) { - eval(self::MOCKED_CLONE_METHOD_WITH_VOID_RETURN_TYPE_TRAIT); - } - return PHP_EOL . ' use \\PHPUnit\\Framework\\MockObject\\MockedCloneMethodWithVoidReturnType;'; - } - if (!trait_exists('\\PHPUnit\\Framework\\MockObject\\MockedCloneMethodWithoutReturnType')) { - eval(self::MOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT); - } - return PHP_EOL . ' use \\PHPUnit\\Framework\\MockObject\\MockedCloneMethodWithoutReturnType;'; + return $this->isValid() ? $this->className . '::' . $this->methodName : ''; } - private function unmockedCloneMethod() : string + public function getTargetClassName(): string { - if (PHP_MAJOR_VERSION >= 8) { - if (!trait_exists('\\PHPUnit\\Framework\\MockObject\\UnmockedCloneMethodWithVoidReturnType')) { - eval(self::UNMOCKED_CLONE_METHOD_WITH_VOID_RETURN_TYPE_TRAIT); - } - return PHP_EOL . ' use \\PHPUnit\\Framework\\MockObject\\UnmockedCloneMethodWithVoidReturnType;'; - } - if (!trait_exists('\\PHPUnit\\Framework\\MockObject\\UnmockedCloneMethodWithoutReturnType')) { - eval(self::UNMOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT); - } - return PHP_EOL . ' use \\PHPUnit\\Framework\\MockObject\\UnmockedCloneMethodWithoutReturnType;'; + return $this->className; } } + {arguments_count}) { - $__phpunit_arguments_tmp = func_get_args(); - - for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { - $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; - } - } - - $__phpunit_result = $this->__phpunit_getInvocationHandler()->invoke( - new \PHPUnit\Framework\MockObject\Invocation( - '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments} - ) - ); - - return $__phpunit_result; - } - - {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} - {{deprecation} - $__phpunit_arguments = [{arguments_call}]; - $__phpunit_count = func_num_args(); - - if ($__phpunit_count > {arguments_count}) { - $__phpunit_arguments_tmp = func_get_args(); - - for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { - $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; - } - } - - $this->__phpunit_getInvocationHandler()->invoke( - new \PHPUnit\Framework\MockObject\Invocation( - '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments} - ) - ); - } - - {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} - { - throw new \PHPUnit\Framework\MockObject\BadMethodCallException('Static method "{method_name}" cannot be invoked on mock object'); - } - - {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} - { - $__phpunit_arguments = [{arguments_call}]; - $__phpunit_count = func_num_args(); - - if ($__phpunit_count > {arguments_count}) { - $__phpunit_arguments_tmp = func_get_args(); - - for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { - $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; - } - } - - $this->__phpunit_getInvocationHandler()->invoke( - new \PHPUnit\Framework\MockObject\Invocation( - '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}, true - ) - ); - - return call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments); - } - - {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} - { - $__phpunit_arguments = [{arguments_call}]; - $__phpunit_count = func_num_args(); - - if ($__phpunit_count > {arguments_count}) { - $__phpunit_arguments_tmp = func_get_args(); - - for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { - $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; - } - } - - $this->__phpunit_getInvocationHandler()->invoke( - new \PHPUnit\Framework\MockObject\Invocation( - '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}, true - ) - ); - - call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments); - } -declare(strict_types=1); +declare (strict_types=1); +/* + * This file is part of PHPUnit. + * + * (c) Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; -{prologue}class {class_name} +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +interface IncompleteTest extends Throwable { - use {trait_name}; } -declare(strict_types=1); - -{namespace}class {class_name} extends \SoapClient -{ - public function __construct($wsdl, array $options) - { - parent::__construct('{wsdl}', $options); - } -{methods}} - - public function {method_name}({arguments}) - { - } className = $className; - $this->methodName = $methodName; - $this->parameters = $parameters; - $this->object = $object; - $this->proxiedCall = $proxiedCall; - if (strtolower($methodName) === '__tostring') { - $returnType = 'string'; - } - if (strpos($returnType, '?') === 0) { - $returnType = substr($returnType, 1); - $this->isReturnTypeNullable = \true; - } - $this->returnType = $returnType; - if (!$cloneObjects) { - return; - } - foreach ($this->parameters as $key => $value) { - if (is_object($value)) { - $this->parameters[$key] = Cloner::clone($value); - } - } - } - public function getClassName() : string - { - return $this->className; - } - public function getMethodName() : string + private $message; + public function __construct(string $className, string $methodName, string $message = '') { - return $this->methodName; + parent::__construct($className . '::' . $methodName); + $this->message = $message; } - public function getParameters() : array + public function getMessage(): string { - return $this->parameters; + return $this->message; } /** - * @throws RuntimeException + * Returns a string representation of the test case. * - * @return mixed Mocked return value + * @throws InvalidArgumentException */ - public function generateReturnValue() - { - if ($this->isReturnTypeNullable || $this->proxiedCall) { - return null; - } - $intersection = \false; - $union = \false; - $unionContainsIntersections = \false; - if (strpos($this->returnType, '|') !== \false) { - $types = explode('|', $this->returnType); - $union = \true; - if (strpos($this->returnType, '(') !== \false) { - $unionContainsIntersections = \true; - } - } elseif (strpos($this->returnType, '&') !== \false) { - $types = explode('&', $this->returnType); - $intersection = \true; - } else { - $types = [$this->returnType]; - } - $types = array_map('strtolower', $types); - if (!$intersection && !$unionContainsIntersections) { - if (in_array('', $types, \true) || in_array('null', $types, \true) || in_array('mixed', $types, \true) || in_array('void', $types, \true)) { - return null; - } - if (in_array('true', $types, \true)) { - return \true; - } - if (in_array('false', $types, \true) || in_array('bool', $types, \true)) { - return \false; - } - if (in_array('float', $types, \true)) { - return 0.0; - } - if (in_array('int', $types, \true)) { - return 0; - } - if (in_array('string', $types, \true)) { - return ''; - } - if (in_array('array', $types, \true)) { - return []; - } - if (in_array('static', $types, \true)) { - try { - return (new Instantiator())->instantiate(get_class($this->object)); - } catch (Throwable $t) { - throw new \PHPUnit\Framework\MockObject\RuntimeException($t->getMessage(), (int) $t->getCode(), $t); - } - } - if (in_array('object', $types, \true)) { - return new stdClass(); - } - if (in_array('callable', $types, \true) || in_array('closure', $types, \true)) { - return static function () : void { - }; - } - if (in_array('traversable', $types, \true) || in_array('generator', $types, \true) || in_array('iterable', $types, \true)) { - $generator = static function () : \Generator { - yield from []; - }; - return $generator(); - } - if (!$union) { - try { - return (new \PHPUnit\Framework\MockObject\Generator())->getMock($this->returnType, [], [], '', \false); - } catch (Throwable $t) { - if ($t instanceof \PHPUnit\Framework\MockObject\Exception) { - throw $t; - } - throw new \PHPUnit\Framework\MockObject\RuntimeException($t->getMessage(), (int) $t->getCode(), $t); - } - } - } - if ($intersection && $this->onlyInterfaces($types)) { - try { - return (new \PHPUnit\Framework\MockObject\Generator())->getMockForInterfaces($types); - } catch (Throwable $t) { - throw new \PHPUnit\Framework\MockObject\RuntimeException(sprintf('Return value for %s::%s() cannot be generated: %s', $this->className, $this->methodName, $t->getMessage()), (int) $t->getCode()); - } - } - $reason = ''; - if ($union) { - $reason = ' because the declared return type is a union'; - } elseif ($intersection) { - $reason = ' because the declared return type is an intersection'; - } - throw new \PHPUnit\Framework\MockObject\RuntimeException(sprintf('Return value for %s::%s() cannot be generated%s, please configure a return value for this method', $this->className, $this->methodName, $reason)); - } - public function toString() : string - { - $exporter = new Exporter(); - return sprintf('%s::%s(%s)%s', $this->className, $this->methodName, implode(', ', array_map([$exporter, 'shortenedExport'], $this->parameters)), $this->returnType ? sprintf(': %s', $this->returnType) : ''); - } - public function getObject() : object + public function toString(): string { - return $this->object; + return $this->getName(); } /** - * @psalm-param non-empty-list $types + * @throws Exception */ - private function onlyInterfaces(array $types) : bool + protected function runTest(): void { - foreach ($types as $type) { - if (!interface_exists($type)) { - return \false; - } - } - return \true; + $this->markTestIncomplete($this->message); } } + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class InvalidParameterGroupException extends \PHPUnit\Framework\Exception +{ +} +configurableMethods = $configurableMethods; - $this->returnValueGeneration = $returnValueGeneration; + if (isset(static::$__phpunit_configurableMethods)) { + throw new \PHPUnit\Framework\MockObject\ConfigurableMethodsAlreadyInitializedException('Configurable methods is already initialized and can not be reinitialized'); + } + static::$__phpunit_configurableMethods = $configurableMethods; } - public function hasMatchers() : bool + /** @noinspection MagicMethodsValidityInspection */ + public function __phpunit_setOriginalObject($originalObject): void { - foreach ($this->matchers as $matcher) { - if ($matcher->hasMatchers()) { - return \true; - } - } - return \false; + $this->__phpunit_originalObject = $originalObject; } - /** - * Looks up the match builder with identification $id and returns it. - * - * @param string $id The identification of the match builder - */ - public function lookupMatcher(string $id) : ?\PHPUnit\Framework\MockObject\Matcher + /** @noinspection MagicMethodsValidityInspection */ + public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration): void { - if (isset($this->matcherMap[$id])) { - return $this->matcherMap[$id]; - } - return null; + $this->__phpunit_returnValueGeneration = $returnValueGeneration; } - /** - * Registers a matcher with the identification $id. The matcher can later be - * looked up using lookupMatcher() to figure out if it has been invoked. - * - * @param string $id The identification of the matcher - * @param Matcher $matcher The builder which is being registered - * - * @throws MatcherAlreadyRegisteredException - */ - public function registerMatcher(string $id, \PHPUnit\Framework\MockObject\Matcher $matcher) : void - { - if (isset($this->matcherMap[$id])) { - throw new \PHPUnit\Framework\MockObject\MatcherAlreadyRegisteredException($id); - } - $this->matcherMap[$id] = $matcher; - } - public function expects(InvocationOrder $rule) : InvocationMocker - { - $matcher = new \PHPUnit\Framework\MockObject\Matcher($rule); - $this->addMatcher($matcher); - return new InvocationMocker($this, $matcher, ...$this->configurableMethods); - } - /** - * @throws Exception - * @throws RuntimeException - */ - public function invoke(\PHPUnit\Framework\MockObject\Invocation $invocation) + /** @noinspection MagicMethodsValidityInspection */ + public function __phpunit_getInvocationHandler(): \PHPUnit\Framework\MockObject\InvocationHandler { - $exception = null; - $hasReturnValue = \false; - $returnValue = null; - foreach ($this->matchers as $match) { - try { - if ($match->matches($invocation)) { - $value = $match->invoked($invocation); - if (!$hasReturnValue) { - $returnValue = $value; - $hasReturnValue = \true; - } - } - } catch (Exception $e) { - $exception = $e; - } - } - if ($exception !== null) { - throw $exception; - } - if ($hasReturnValue) { - return $returnValue; - } - if (!$this->returnValueGeneration) { - $exception = new \PHPUnit\Framework\MockObject\ReturnValueNotConfiguredException($invocation); - if (strtolower($invocation->getMethodName()) === '__tostring') { - $this->deferredError = $exception; - return ''; - } - throw $exception; + if ($this->__phpunit_invocationMocker === null) { + $this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationHandler(static::$__phpunit_configurableMethods, $this->__phpunit_returnValueGeneration); } - return $invocation->generateReturnValue(); + return $this->__phpunit_invocationMocker; } - public function matches(\PHPUnit\Framework\MockObject\Invocation $invocation) : bool + /** @noinspection MagicMethodsValidityInspection */ + public function __phpunit_hasMatchers(): bool { - foreach ($this->matchers as $matcher) { - if (!$matcher->matches($invocation)) { - return \false; - } - } - return \true; + return $this->__phpunit_getInvocationHandler()->hasMatchers(); } - /** - * @throws Throwable - */ - public function verify() : void + /** @noinspection MagicMethodsValidityInspection */ + public function __phpunit_verify(bool $unsetInvocationMocker = \true): void { - foreach ($this->matchers as $matcher) { - $matcher->verify(); - } - if ($this->deferredError) { - throw $this->deferredError; + $this->__phpunit_getInvocationHandler()->verify(); + if ($unsetInvocationMocker) { + $this->__phpunit_invocationMocker = null; } } - private function addMatcher(\PHPUnit\Framework\MockObject\Matcher $matcher) : void + public function expects(InvocationOrder $matcher): InvocationMockerBuilder { - $this->matchers[] = $matcher; + return $this->__phpunit_getInvocationHandler()->expects($matcher); } } expects(new AnyInvokedCount()); + return call_user_func_array([$expects, 'method'], func_get_args()); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class Matcher +interface Identity { /** - * @var InvocationOrder + * Sets the identification of the expectation to $id. + * + * @note The identifier is unique per mock object. + * + * @param string $id unique identification of expectation */ - private $invocationRule; + public function id($id); +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +use function array_map; +use function array_merge; +use function count; +use function in_array; +use function is_string; +use function strtolower; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\InvalidArgumentException; +use PHPUnit\Framework\MockObject\ConfigurableMethod; +use PHPUnit\Framework\MockObject\IncompatibleReturnValueException; +use PHPUnit\Framework\MockObject\InvocationHandler; +use PHPUnit\Framework\MockObject\Matcher; +use PHPUnit\Framework\MockObject\MatcherAlreadyRegisteredException; +use PHPUnit\Framework\MockObject\MethodCannotBeConfiguredException; +use PHPUnit\Framework\MockObject\MethodNameAlreadyConfiguredException; +use PHPUnit\Framework\MockObject\MethodNameNotConfiguredException; +use PHPUnit\Framework\MockObject\MethodParametersAlreadyConfiguredException; +use PHPUnit\Framework\MockObject\Rule; +use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls; +use PHPUnit\Framework\MockObject\Stub\Exception; +use PHPUnit\Framework\MockObject\Stub\ReturnArgument; +use PHPUnit\Framework\MockObject\Stub\ReturnCallback; +use PHPUnit\Framework\MockObject\Stub\ReturnReference; +use PHPUnit\Framework\MockObject\Stub\ReturnSelf; +use PHPUnit\Framework\MockObject\Stub\ReturnStub; +use PHPUnit\Framework\MockObject\Stub\ReturnValueMap; +use PHPUnit\Framework\MockObject\Stub\Stub; +use Throwable; +/** + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +final class InvocationMocker implements \PHPUnit\Framework\MockObject\Builder\InvocationStubber, \PHPUnit\Framework\MockObject\Builder\MethodNameMatch +{ /** - * @var mixed + * @var InvocationHandler */ - private $afterMatchBuilderId; + private $invocationHandler; /** - * @var bool + * @var Matcher */ - private $afterMatchBuilderIsInvoked = \false; + private $matcher; /** - * @var MethodName + * @var ConfigurableMethod[] */ - private $methodNameRule; + private $configurableMethods; + public function __construct(InvocationHandler $handler, Matcher $matcher, ConfigurableMethod ...$configurableMethods) + { + $this->invocationHandler = $handler; + $this->matcher = $matcher; + $this->configurableMethods = $configurableMethods; + } /** - * @var ParametersRule + * @throws MatcherAlreadyRegisteredException + * + * @return $this */ - private $parametersRule; + public function id($id): self + { + $this->invocationHandler->registerMatcher($id, $this->matcher); + return $this; + } /** - * @var Stub + * @return $this */ - private $stub; - public function __construct(InvocationOrder $rule) + public function will(Stub $stub): \PHPUnit\Framework\MockObject\Builder\Identity { - $this->invocationRule = $rule; + $this->matcher->setStub($stub); + return $this; } - public function hasMatchers() : bool + /** + * @param mixed $value + * @param mixed[] $nextValues + * + * @throws IncompatibleReturnValueException + */ + public function willReturn($value, ...$nextValues): self { - return !$this->invocationRule instanceof AnyInvokedCount; + if (count($nextValues) === 0) { + $this->ensureTypeOfReturnValues([$value]); + $stub = ($value instanceof Stub) ? $value : new ReturnStub($value); + } else { + $values = array_merge([$value], $nextValues); + $this->ensureTypeOfReturnValues($values); + $stub = new ConsecutiveCalls($values); + } + return $this->will($stub); } - public function hasMethodNameRule() : bool + public function willReturnReference(&$reference): self { - return $this->methodNameRule !== null; + $stub = new ReturnReference($reference); + return $this->will($stub); } - public function getMethodNameRule() : MethodName + public function willReturnMap(array $valueMap): self { - return $this->methodNameRule; + $stub = new ReturnValueMap($valueMap); + return $this->will($stub); } - public function setMethodNameRule(MethodName $rule) : void + public function willReturnArgument($argumentIndex): self { - $this->methodNameRule = $rule; + $stub = new ReturnArgument($argumentIndex); + return $this->will($stub); } - public function hasParametersRule() : bool + public function willReturnCallback($callback): self { - return $this->parametersRule !== null; + $stub = new ReturnCallback($callback); + return $this->will($stub); } - public function setParametersRule(ParametersRule $rule) : void + public function willReturnSelf(): self { - $this->parametersRule = $rule; + $stub = new ReturnSelf(); + return $this->will($stub); } - public function setStub(Stub $stub) : void + public function willReturnOnConsecutiveCalls(...$values): self { - $this->stub = $stub; + $stub = new ConsecutiveCalls($values); + return $this->will($stub); } - public function setAfterMatchBuilderId(string $id) : void + public function willThrowException(Throwable $exception): self { - $this->afterMatchBuilderId = $id; + $stub = new Exception($exception); + return $this->will($stub); } /** - * @throws ExpectationFailedException - * @throws MatchBuilderNotFoundException + * @return $this + */ + public function after($id): self + { + $this->matcher->setAfterMatchBuilderId($id); + return $this; + } + /** + * @param mixed[] $arguments + * + * @throws \PHPUnit\Framework\Exception * @throws MethodNameNotConfiguredException - * @throws RuntimeException + * @throws MethodParametersAlreadyConfiguredException + * + * @return $this */ - public function invoked(\PHPUnit\Framework\MockObject\Invocation $invocation) + public function with(...$arguments): self { - if ($this->methodNameRule === null) { - throw new \PHPUnit\Framework\MockObject\MethodNameNotConfiguredException(); - } - if ($this->afterMatchBuilderId !== null) { - $matcher = $invocation->getObject()->__phpunit_getInvocationHandler()->lookupMatcher($this->afterMatchBuilderId); - if (!$matcher) { - throw new \PHPUnit\Framework\MockObject\MatchBuilderNotFoundException($this->afterMatchBuilderId); - } - assert($matcher instanceof self); - if ($matcher->invocationRule->hasBeenInvoked()) { - $this->afterMatchBuilderIsInvoked = \true; - } - } - $this->invocationRule->invoked($invocation); - try { - if ($this->parametersRule !== null) { - $this->parametersRule->apply($invocation); - } - } catch (ExpectationFailedException $e) { - throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s\n%s", $this->methodNameRule->toString(), $this->invocationRule->toString(), $e->getMessage()), $e->getComparisonFailure()); - } - if ($this->stub) { - return $this->stub->invoke($invocation); - } - return $invocation->generateReturnValue(); + $this->ensureParametersCanBeConfigured(); + $this->matcher->setParametersRule(new Rule\Parameters($arguments)); + return $this; } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - * @throws MatchBuilderNotFoundException + * @param array ...$arguments + * + * @throws \PHPUnit\Framework\Exception * @throws MethodNameNotConfiguredException - * @throws RuntimeException + * @throws MethodParametersAlreadyConfiguredException + * + * @return $this + * + * @deprecated */ - public function matches(\PHPUnit\Framework\MockObject\Invocation $invocation) : bool + public function withConsecutive(...$arguments): self { - if ($this->afterMatchBuilderId !== null) { - $matcher = $invocation->getObject()->__phpunit_getInvocationHandler()->lookupMatcher($this->afterMatchBuilderId); - if (!$matcher) { - throw new \PHPUnit\Framework\MockObject\MatchBuilderNotFoundException($this->afterMatchBuilderId); - } - assert($matcher instanceof self); - if (!$matcher->invocationRule->hasBeenInvoked()) { - return \false; - } - } - if ($this->methodNameRule === null) { - throw new \PHPUnit\Framework\MockObject\MethodNameNotConfiguredException(); - } - if (!$this->invocationRule->matches($invocation)) { - return \false; - } - try { - if (!$this->methodNameRule->matches($invocation)) { - return \false; - } - } catch (ExpectationFailedException $e) { - throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s\n%s", $this->methodNameRule->toString(), $this->invocationRule->toString(), $e->getMessage()), $e->getComparisonFailure()); - } - return \true; + $this->ensureParametersCanBeConfigured(); + $this->matcher->setParametersRule(new Rule\ConsecutiveParameters($arguments)); + return $this; } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException * @throws MethodNameNotConfiguredException + * @throws MethodParametersAlreadyConfiguredException + * + * @return $this */ - public function verify() : void + public function withAnyParameters(): self { - if ($this->methodNameRule === null) { - throw new \PHPUnit\Framework\MockObject\MethodNameNotConfiguredException(); + $this->ensureParametersCanBeConfigured(); + $this->matcher->setParametersRule(new Rule\AnyParameters()); + return $this; + } + /** + * @param Constraint|string $constraint + * + * @throws InvalidArgumentException + * @throws MethodCannotBeConfiguredException + * @throws MethodNameAlreadyConfiguredException + * + * @return $this + */ + public function method($constraint): self + { + if ($this->matcher->hasMethodNameRule()) { + throw new MethodNameAlreadyConfiguredException(); } - try { - $this->invocationRule->verify(); - if ($this->parametersRule === null) { - $this->parametersRule = new AnyParameters(); - } - $invocationIsAny = $this->invocationRule instanceof AnyInvokedCount; - $invocationIsNever = $this->invocationRule instanceof InvokedCount && $this->invocationRule->isNever(); - $invocationIsAtMost = $this->invocationRule instanceof InvokedAtMostCount; - if (!$invocationIsAny && !$invocationIsNever && !$invocationIsAtMost) { - $this->parametersRule->verify(); - } - } catch (ExpectationFailedException $e) { - throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s.\n%s", $this->methodNameRule->toString(), $this->invocationRule->toString(), TestFailure::exceptionToString($e))); + $configurableMethodNames = array_map(static function (ConfigurableMethod $configurable) { + return strtolower($configurable->getName()); + }, $this->configurableMethods); + if (is_string($constraint) && !in_array(strtolower($constraint), $configurableMethodNames, \true)) { + throw new MethodCannotBeConfiguredException($constraint); } + $this->matcher->setMethodNameRule(new Rule\MethodName($constraint)); + return $this; } - public function toString() : string + /** + * @throws MethodNameNotConfiguredException + * @throws MethodParametersAlreadyConfiguredException + */ + private function ensureParametersCanBeConfigured(): void { - $list = []; - if ($this->invocationRule !== null) { - $list[] = $this->invocationRule->toString(); + if (!$this->matcher->hasMethodNameRule()) { + throw new MethodNameNotConfiguredException(); } - if ($this->methodNameRule !== null) { - $list[] = 'where ' . $this->methodNameRule->toString(); + if ($this->matcher->hasParametersRule()) { + throw new MethodParametersAlreadyConfiguredException(); } - if ($this->parametersRule !== null) { - $list[] = 'and ' . $this->parametersRule->toString(); + } + private function getConfiguredMethod(): ?ConfigurableMethod + { + $configuredMethod = null; + foreach ($this->configurableMethods as $configurableMethod) { + if ($this->matcher->getMethodNameRule()->matchesName($configurableMethod->getName())) { + if ($configuredMethod !== null) { + return null; + } + $configuredMethod = $configurableMethod; + } } - if ($this->afterMatchBuilderId !== null) { - $list[] = 'after ' . $this->afterMatchBuilderId; + return $configuredMethod; + } + /** + * @throws IncompatibleReturnValueException + */ + private function ensureTypeOfReturnValues(array $values): void + { + $configuredMethod = $this->getConfiguredMethod(); + if ($configuredMethod === null) { + return; } - if ($this->stub !== null) { - $list[] = 'will ' . $this->stub->toString(); + foreach ($values as $value) { + if (!$configuredMethod->mayReturn($value)) { + throw new IncompatibleReturnValueException($configuredMethod, $value); + } } - return implode(' ', $list); } } > $valueMap + * + * @return self + */ + public function willReturnMap(array $valueMap); + /** + * @param int $argumentIndex + * + * @return self + */ + public function willReturnArgument($argumentIndex); + /** + * @param callable $callback + * + * @return self + */ + public function willReturnCallback($callback); + /** @return self */ + public function willReturnSelf(); + /** + * @param mixed $values + * + * @return self + */ + public function willReturnOnConsecutiveCalls(...$values); + /** @return self */ + public function willThrowException(Throwable $exception); +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; -use function is_string; -use function sprintf; -use function strtolower; use PHPUnit\Framework\Constraint\Constraint; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class MethodNameConstraint extends Constraint +interface MethodNameMatch extends \PHPUnit\Framework\MockObject\Builder\ParametersMatch { /** - * @var string + * Adds a new method name match and returns the parameter match object for + * further matching possibilities. + * + * @param Constraint $constraint Constraint for matching method, if a string is passed it will use the PHPUnit_Framework_Constraint_IsEqual + * + * @return ParametersMatch */ - private $methodName; - public function __construct(string $methodName) - { - $this->methodName = $methodName; - } - public function toString() : string - { - return sprintf('is "%s"', $this->methodName); - } - protected function matches($other) : bool - { - if (!is_string($other)) { - return \false; - } - return strtolower($this->methodName) === strtolower($other); - } + public function method($constraint); } |string|string[] $type - */ - public function __construct(TestCase $testCase, $type) - { - $this->testCase = $testCase; - $this->type = $type; - $this->generator = new \PHPUnit\Framework\MockObject\Generator(); - } - /** - * Creates a mock object using a fluent interface. - * - * @throws \PHPUnit\Framework\InvalidArgumentException - * @throws ClassAlreadyExistsException - * @throws ClassIsFinalException - * @throws ClassIsReadonlyException - * @throws DuplicateMethodException - * @throws InvalidMethodNameException - * @throws OriginalConstructorInvocationRequiredException - * @throws ReflectionException - * @throws RuntimeException - * @throws UnknownTypeException - * - * @psalm-return MockObject&MockedType - */ - public function getMock() : \PHPUnit\Framework\MockObject\MockObject - { - $object = $this->generator->getMock($this->type, !$this->emptyMethodsArray ? $this->methods : null, $this->constructorArgs, $this->mockClassName, $this->originalConstructor, $this->originalClone, $this->autoload, $this->cloneArguments, $this->callOriginalMethods, $this->proxyTarget, $this->allowMockingUnknownTypes, $this->returnValueGeneration); - $this->testCase->registerMockObject($object); - return $object; - } - /** - * Creates a mock object for an abstract class using a fluent interface. - * - * @psalm-return MockObject&MockedType - * - * @throws \PHPUnit\Framework\Exception - * @throws ReflectionException - * @throws RuntimeException - */ - public function getMockForAbstractClass() : \PHPUnit\Framework\MockObject\MockObject - { - $object = $this->generator->getMockForAbstractClass($this->type, $this->constructorArgs, $this->mockClassName, $this->originalConstructor, $this->originalClone, $this->autoload, $this->methods, $this->cloneArguments); - $this->testCase->registerMockObject($object); - return $object; - } - /** - * Creates a mock object for a trait using a fluent interface. - * - * @psalm-return MockObject&MockedType - * - * @throws \PHPUnit\Framework\Exception - * @throws ReflectionException - * @throws RuntimeException - */ - public function getMockForTrait() : \PHPUnit\Framework\MockObject\MockObject - { - $object = $this->generator->getMockForTrait($this->type, $this->constructorArgs, $this->mockClassName, $this->originalConstructor, $this->originalClone, $this->autoload, $this->methods, $this->cloneArguments); - $this->testCase->registerMockObject($object); - return $object; - } - /** - * Specifies the subset of methods to mock. Default is to mock none of them. - * - * @deprecated https://github.com/sebastianbergmann/phpunit/pull/3687 - * - * @return $this - */ - public function setMethods(?array $methods = null) : self - { - if ($methods === null) { - $this->methods = $methods; - } else { - $this->methods = array_merge($this->methods ?? [], $methods); - } - return $this; - } - /** - * Specifies the subset of methods to mock, requiring each to exist in the class. - * - * @param string[] $methods - * - * @throws CannotUseOnlyMethodsException - * @throws ReflectionException - * - * @return $this - */ - public function onlyMethods(array $methods) : self - { - if (empty($methods)) { - $this->emptyMethodsArray = \true; - return $this; - } - try { - $reflector = new ReflectionClass($this->type); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - foreach ($methods as $method) { - if (!$reflector->hasMethod($method)) { - throw new \PHPUnit\Framework\MockObject\CannotUseOnlyMethodsException($this->type, $method); - } - } - $this->methods = array_merge($this->methods ?? [], $methods); - return $this; - } - /** - * Specifies methods that don't exist in the class which you want to mock. - * - * @param string[] $methods - * - * @throws CannotUseAddMethodsException - * @throws ReflectionException - * @throws RuntimeException - * - * @return $this - */ - public function addMethods(array $methods) : self - { - if (empty($methods)) { - $this->emptyMethodsArray = \true; - return $this; - } - try { - $reflector = new ReflectionClass($this->type); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - foreach ($methods as $method) { - if ($reflector->hasMethod($method)) { - throw new \PHPUnit\Framework\MockObject\CannotUseAddMethodsException($this->type, $method); - } - } - $this->methods = array_merge($this->methods ?? [], $methods); - return $this; - } - /** - * Specifies the subset of methods to not mock. Default is to mock all of them. - * - * @deprecated https://github.com/sebastianbergmann/phpunit/pull/3687 - * - * @throws ReflectionException - */ - public function setMethodsExcept(array $methods = []) : self - { - return $this->setMethods(array_diff($this->generator->getClassMethods($this->type), $methods)); - } - /** - * Specifies the arguments for the constructor. - * - * @return $this - */ - public function setConstructorArgs(array $args) : self - { - $this->constructorArgs = $args; - return $this; - } - /** - * Specifies the name for the mock class. - * - * @return $this - */ - public function setMockClassName(string $name) : self - { - $this->mockClassName = $name; - return $this; - } - /** - * Disables the invocation of the original constructor. - * - * @return $this - */ - public function disableOriginalConstructor() : self - { - $this->originalConstructor = \false; - return $this; - } - /** - * Enables the invocation of the original constructor. - * - * @return $this - */ - public function enableOriginalConstructor() : self - { - $this->originalConstructor = \true; - return $this; - } - /** - * Disables the invocation of the original clone constructor. - * - * @return $this - */ - public function disableOriginalClone() : self - { - $this->originalClone = \false; - return $this; - } - /** - * Enables the invocation of the original clone constructor. + * Defines the expectation which must occur before the current is valid. * - * @return $this - */ - public function enableOriginalClone() : self - { - $this->originalClone = \true; - return $this; - } - /** - * Disables the use of class autoloading while creating the mock object. + * @param string $id the identification of the expectation that should + * occur before this one * - * @return $this + * @return Stub */ - public function disableAutoload() : self - { - $this->autoload = \false; - return $this; - } + public function after($id); /** - * Enables the use of class autoloading while creating the mock object. + * Sets the parameters to match for, each parameter to this function will + * be part of match. To perform specific matches or constraints create a + * new PHPUnit\Framework\Constraint\Constraint and use it for the parameter. + * If the parameter value is not a constraint it will use the + * PHPUnit\Framework\Constraint\IsEqual for the value. * - * @return $this - */ - public function enableAutoload() : self - { - $this->autoload = \true; - return $this; - } - /** - * Disables the cloning of arguments passed to mocked methods. + * Some examples: + * + * // match first parameter with value 2 + * $b->with(2); + * // match first parameter with value 'smock' and second identical to 42 + * $b->with('smock', new PHPUnit\Framework\Constraint\IsEqual(42)); + * * - * @return $this + * @return ParametersMatch */ - public function disableArgumentCloning() : self - { - $this->cloneArguments = \false; - return $this; - } + public function with(...$arguments); /** - * Enables the cloning of arguments passed to mocked methods. + * Sets a rule which allows any kind of parameters. * - * @return $this - */ - public function enableArgumentCloning() : self - { - $this->cloneArguments = \true; - return $this; - } - /** - * Enables the invocation of the original methods. + * Some examples: + * + * // match any number of parameters + * $b->withAnyParameters(); + * * - * @return $this + * @return ParametersMatch */ - public function enableProxyingToOriginalMethods() : self - { - $this->callOriginalMethods = \true; - return $this; - } + public function withAnyParameters(); +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +use PHPUnit\Framework\MockObject\Stub\Stub as BaseStub; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +interface Stub extends \PHPUnit\Framework\MockObject\Builder\Identity +{ /** - * Disables the invocation of the original methods. - * - * @return $this + * Stubs the matching method with the stub object $stub. Any invocations of + * the matched method will now be handled by the stub instead. */ - public function disableProxyingToOriginalMethods() : self - { - $this->callOriginalMethods = \false; - $this->proxyTarget = null; - return $this; - } + public function will(BaseStub $stub): \PHPUnit\Framework\MockObject\Builder\Identity; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use PHPUnitPHAR\SebastianBergmann\Type\Type; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ConfigurableMethod +{ /** - * Sets the proxy target. - * - * @return $this + * @var string */ - public function setProxyTarget(object $object) : self - { - $this->proxyTarget = $object; - return $this; - } + private $name; /** - * @return $this + * @var Type */ - public function allowMockingUnknownTypes() : self + private $returnType; + public function __construct(string $name, Type $returnType) { - $this->allowMockingUnknownTypes = \true; - return $this; + $this->name = $name; + $this->returnType = $returnType; } - /** - * @return $this - */ - public function disallowMockingUnknownTypes() : self + public function getName(): string { - $this->allowMockingUnknownTypes = \false; - return $this; + return $this->name; } - /** - * @return $this - */ - public function enableAutoReturnValueGeneration() : self + public function mayReturn($value): bool { - $this->returnValueGeneration = \true; - return $this; + if ($value === null && $this->returnType->allowsNull()) { + return \true; + } + return $this->returnType->isAssignable(Type::fromValue($value, \false)); } - /** - * @return $this - */ - public function disableAutoReturnValueGeneration() : self + public function getReturnTypeDeclaration(): string { - $this->returnValueGeneration = \false; - return $this; + return $this->returnType->asString(); } } classCode = $classCode; - $this->mockName = $mockName; - $this->configurableMethods = $configurableMethods; - } - /** - * @psalm-return class-string - */ - public function generate() : string +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function sprintf; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class CannotUseAddMethodsException extends \PHPUnit\Framework\Exception implements \PHPUnit\Framework\MockObject\Exception +{ + public function __construct(string $type, string $methodName) { - if (!class_exists($this->mockName, \false)) { - eval($this->classCode); - call_user_func([$this->mockName, '__phpunit_initConfigurableMethods'], ...$this->configurableMethods); - } - return $this->mockName; + parent::__construct(sprintf('Trying to configure method "%s" with addMethods(), but it exists in class "%s". Use onlyMethods() for methods that exist in the class', $methodName, $type)); } - public function getClassCode() : string +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function sprintf; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class CannotUseOnlyMethodsException extends \PHPUnit\Framework\Exception implements \PHPUnit\Framework\MockObject\Exception +{ + public function __construct(string $type, string $methodName) { - return $this->classCode; + parent::__construct(sprintf('Trying to configure method "%s" with onlyMethods(), but it does not exist in class "%s". Use addMethods() for methods that do not exist in the class', $methodName, $type)); } } isPrivate()) { - $modifier = 'private'; - } elseif ($method->isProtected()) { - $modifier = 'protected'; - } else { - $modifier = 'public'; - } - if ($method->isStatic()) { - $modifier .= ' static'; - } - if ($method->returnsReference()) { - $reference = '&'; - } else { - $reference = ''; - } - $docComment = $method->getDocComment(); - if (is_string($docComment) && preg_match('#\\*[ \\t]*+@deprecated[ \\t]*+(.*?)\\r?+\\n[ \\t]*+\\*(?:[ \\t]*+@|/$)#s', $docComment, $deprecation)) { - $deprecation = trim(preg_replace('#[ \\t]*\\r?\\n[ \\t]*+\\*[ \\t]*+#', ' ', $deprecation[1])); - } else { - $deprecation = null; - } - return new self($method->getDeclaringClass()->getName(), $method->getName(), $cloneArguments, $modifier, self::getMethodParametersForDeclaration($method), self::getMethodParametersForCall($method), (new ReflectionMapper())->fromReturnType($method), $reference, $callOriginalMethod, $method->isStatic(), $deprecation); - } - public static function fromName(string $fullClassName, string $methodName, bool $cloneArguments) : self - { - return new self($fullClassName, $methodName, $cloneArguments, 'public', '', '', new UnknownType(), '', \false, \false, null); - } - public function __construct(string $className, string $methodName, bool $cloneArguments, string $modifier, string $argumentsForDeclaration, string $argumentsForCall, Type $returnType, string $reference, bool $callOriginalMethod, bool $static, ?string $deprecation) - { - $this->className = $className; - $this->methodName = $methodName; - $this->cloneArguments = $cloneArguments; - $this->modifier = $modifier; - $this->argumentsForDeclaration = $argumentsForDeclaration; - $this->argumentsForCall = $argumentsForCall; - $this->returnType = $returnType; - $this->reference = $reference; - $this->callOriginalMethod = $callOriginalMethod; - $this->static = $static; - $this->deprecation = $deprecation; - } - public function getName() : string - { - return $this->methodName; - } - /** - * @throws RuntimeException - */ - public function generateCode() : string - { - if ($this->static) { - $templateFile = 'mocked_static_method.tpl'; - } elseif ($this->returnType->isNever() || $this->returnType->isVoid()) { - $templateFile = sprintf('%s_method_never_or_void.tpl', $this->callOriginalMethod ? 'proxied' : 'mocked'); - } else { - $templateFile = sprintf('%s_method.tpl', $this->callOriginalMethod ? 'proxied' : 'mocked'); - } - $deprecation = $this->deprecation; - if (null !== $this->deprecation) { - $deprecation = "The {$this->className}::{$this->methodName} method is deprecated ({$this->deprecation})."; - $deprecationTemplate = $this->getTemplate('deprecation.tpl'); - $deprecationTemplate->setVar(['deprecation' => var_export($deprecation, \true)]); - $deprecation = $deprecationTemplate->render(); - } - $template = $this->getTemplate($templateFile); - $template->setVar(['arguments_decl' => $this->argumentsForDeclaration, 'arguments_call' => $this->argumentsForCall, 'return_declaration' => !empty($this->returnType->asString()) ? ': ' . $this->returnType->asString() : '', 'return_type' => $this->returnType->asString(), 'arguments_count' => !empty($this->argumentsForCall) ? substr_count($this->argumentsForCall, ',') + 1 : 0, 'class_name' => $this->className, 'method_name' => $this->methodName, 'modifier' => $this->modifier, 'reference' => $this->reference, 'clone_arguments' => $this->cloneArguments ? 'true' : 'false', 'deprecation' => $deprecation]); - return $template->render(); - } - public function getReturnType() : Type - { - return $this->returnType; - } - /** - * @throws RuntimeException - */ - private function getTemplate(string $template) : Template - { - $filename = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR . $template; - if (!isset(self::$templates[$filename])) { - try { - self::$templates[$filename] = new Template($filename); - } catch (TemplateException $e) { - throw new \PHPUnit\Framework\MockObject\RuntimeException($e->getMessage(), $e->getCode(), $e); - } - } - return self::$templates[$filename]; - } - /** - * Returns the parameters of a function or method. - * - * @throws RuntimeException - */ - private static function getMethodParametersForDeclaration(ReflectionMethod $method) : string - { - $parameters = []; - $types = (new ReflectionMapper())->fromParameterTypes($method); - foreach ($method->getParameters() as $i => $parameter) { - $name = '$' . $parameter->getName(); - /* Note: PHP extensions may use empty names for reference arguments - * or "..." for methods taking a variable number of arguments. - */ - if ($name === '$' || $name === '$...') { - $name = '$arg' . $i; - } - $default = ''; - $reference = ''; - $typeDeclaration = ''; - if (!$types[$i]->type()->isUnknown()) { - $typeDeclaration = $types[$i]->type()->asString() . ' '; - } - if ($parameter->isPassedByReference()) { - $reference = '&'; - } - if ($parameter->isVariadic()) { - $name = '...' . $name; - } elseif ($parameter->isDefaultValueAvailable()) { - $default = ' = ' . self::exportDefaultValue($parameter); - } elseif ($parameter->isOptional()) { - $default = ' = null'; - } - $parameters[] = $typeDeclaration . $reference . $name . $default; - } - return implode(', ', $parameters); - } - /** - * Returns the parameters of a function or method. - * - * @throws ReflectionException - */ - private static function getMethodParametersForCall(ReflectionMethod $method) : string - { - $parameters = []; - foreach ($method->getParameters() as $i => $parameter) { - $name = '$' . $parameter->getName(); - /* Note: PHP extensions may use empty names for reference arguments - * or "..." for methods taking a variable number of arguments. - */ - if ($name === '$' || $name === '$...') { - $name = '$arg' . $i; - } - if ($parameter->isVariadic()) { - continue; - } - if ($parameter->isPassedByReference()) { - $parameters[] = '&' . $name; - } else { - $parameters[] = $name; - } - } - return implode(', ', $parameters); - } - /** - * @throws ReflectionException - */ - private static function exportDefaultValue(ReflectionParameter $parameter) : string + public function __construct(string $className) { - try { - $defaultValue = $parameter->getDefaultValue(); - if (!is_object($defaultValue)) { - return (string) var_export($defaultValue, \true); - } - $parameterAsString = $parameter->__toString(); - return (string) explode(' = ', substr(substr($parameterAsString, strpos($parameterAsString, ' ') + strlen(' ')), 0, -2))[1]; - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd + parent::__construct(sprintf('Class "%s" already exists', $className)); } } methods[strtolower($method->getName())] = $method; - } - } - /** - * @return MockMethod[] - */ - public function asArray() : array + public function __construct(string $className) { - return array_values($this->methods); + parent::__construct(sprintf('Class "%s" is declared "final" and cannot be doubled', $className)); } - public function hasMethod(string $methodName) : bool +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function sprintf; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ClassIsReadonlyException extends \PHPUnit\Framework\Exception implements \PHPUnit\Framework\MockObject\Exception +{ + public function __construct(string $className) { - return array_key_exists(strtolower($methodName), $this->methods); + parent::__construct(sprintf('Class "%s" is declared "readonly" and cannot be doubled', $className)); } } classCode = $classCode; - $this->mockName = $mockName; - } - /** - * @psalm-return class-string + * @psalm-param list $methods */ - public function generate() : string - { - if (!class_exists($this->mockName, \false)) { - eval($this->classCode); - } - return $this->mockName; - } - public function getClassCode() : string + public function __construct(array $methods) { - return $this->classCode; + parent::__construct(sprintf('Cannot double using a method list that contains duplicates: "%s" (duplicate: "%s")', implode(', ', $methods), implode(', ', array_unique(array_diff_assoc($methods, array_unique($methods)))))); } } getName(), is_object($value) ? get_class($value) : gettype($value), $method->getReturnTypeDeclaration())); } } $parameters) { - if (!is_iterable($parameters)) { - throw new InvalidParameterGroupException(sprintf('Parameter group #%d must be an array or Traversable, got %s', $index, gettype($parameters))); - } - foreach ($parameters as $parameter) { - if (!$parameter instanceof Constraint) { - $parameter = new IsEqual($parameter); - } - $this->parameterGroups[$index][] = $parameter; - } - } - } - public function toString() : string - { - return 'with consecutive parameters'; - } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public function apply(BaseInvocation $invocation) : void - { - $this->invocations[] = $invocation; - $callIndex = count($this->invocations) - 1; - $this->verifyInvocation($invocation, $callIndex); - } - /** - * @throws \PHPUnit\Framework\ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function verify() : void - { - foreach ($this->invocations as $callIndex => $invocation) { - $this->verifyInvocation($invocation, $callIndex); - } - } - /** - * Verify a single invocation. - * - * @param int $callIndex - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - private function verifyInvocation(BaseInvocation $invocation, $callIndex) : void + public function __construct(string $id) { - if (!isset($this->parameterGroups[$callIndex])) { - // no parameter assertion for this call index - return; - } - $parameters = $this->parameterGroups[$callIndex]; - if (count($invocation->getParameters()) < count($parameters)) { - throw new ExpectationFailedException(sprintf('Parameter count for invocation %s is too low.', $invocation->toString())); - } - foreach ($parameters as $i => $parameter) { - $parameter->evaluate($invocation->getParameters()[$i], sprintf('Parameter %s for invocation #%d %s does not match expected ' . 'value.', $i, $callIndex, $invocation->toString())); - } + parent::__construct(sprintf('No builder found for match builder identification <%s>', $id)); } } invocations); - } - public function hasBeenInvoked() : bool - { - return count($this->invocations) > 0; - } - public final function invoked(BaseInvocation $invocation) + public function __construct(string $id) { - $this->invocations[] = $invocation; - return $this->invokedDo($invocation); + parent::__construct(sprintf('Matcher with id <%s> is already registered', $id)); } - public abstract function matches(BaseInvocation $invocation) : bool; - protected abstract function invokedDo(BaseInvocation $invocation); } sequenceIndex = $sequenceIndex; - } - public function toString() : string - { - return 'invoked at sequence index ' . $this->sequenceIndex; - } - public function matches(BaseInvocation $invocation) : bool - { - $this->currentIndex++; - return $this->currentIndex == $this->sequenceIndex; - } - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws ExpectationFailedException - */ - public function verify() : void - { - if ($this->currentIndex < $this->sequenceIndex) { - throw new ExpectationFailedException(sprintf('The expected invocation at index %s was never reached.', $this->sequenceIndex)); - } - } - protected function invokedDo(BaseInvocation $invocation) : void + public function __construct(string $method) { + parent::__construct(sprintf('Trying to configure method "%s" which cannot be configured because it does not exist, has not been specified, is final, or is static', $method)); } } requiredInvocations = $requiredInvocations; - } - public function toString() : string - { - return 'invoked at least ' . $this->requiredInvocations . ' times'; - } - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws ExpectationFailedException - */ - public function verify() : void - { - $count = $this->getInvocationCount(); - if ($count < $this->requiredInvocations) { - throw new ExpectationFailedException('Expected invocation at least ' . $this->requiredInvocations . ' times but it occurred ' . $count . ' time(s).'); - } - } - public function matches(BaseInvocation $invocation) : bool - { - return \true; - } - protected function invokedDo(BaseInvocation $invocation) : void + public function __construct() { + parent::__construct('Method name is already configured'); } } getInvocationCount(); - if ($count < 1) { - throw new ExpectationFailedException('Expected invocation at least once but it never occurred.'); - } - } - public function matches(BaseInvocation $invocation) : bool - { - return \true; - } - protected function invokedDo(BaseInvocation $invocation) : void + public function __construct() { + parent::__construct('Method name is not configured'); } } allowedInvocations = $allowedInvocations; - } - public function toString() : string - { - return 'invoked at most ' . $this->allowedInvocations . ' times'; - } - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws ExpectationFailedException - */ - public function verify() : void - { - $count = $this->getInvocationCount(); - if ($count > $this->allowedInvocations) { - throw new ExpectationFailedException('Expected invocation at most ' . $this->allowedInvocations . ' times but it occurred ' . $count . ' time(s).'); - } - } - public function matches(BaseInvocation $invocation) : bool - { - return \true; - } - protected function invokedDo(BaseInvocation $invocation) : void + public function __construct() { + parent::__construct('Method parameters already configured'); } } expectedCount = $expectedCount; - } - public function isNever() : bool - { - return $this->expectedCount === 0; - } - public function toString() : string - { - return 'invoked ' . $this->expectedCount . ' time(s)'; - } - public function matches(BaseInvocation $invocation) : bool - { - return \true; - } - /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. - * - * @throws ExpectationFailedException - */ - public function verify() : void - { - $count = $this->getInvocationCount(); - if ($count !== $this->expectedCount) { - throw new ExpectationFailedException(sprintf('Method was expected to be called %d times, ' . 'actually called %d times.', $this->expectedCount, $count)); - } - } - /** - * @throws ExpectationFailedException - */ - protected function invokedDo(BaseInvocation $invocation) : void + public function __construct() { - $count = $this->getInvocationCount(); - if ($count > $this->expectedCount) { - $message = $invocation->toString() . ' '; - switch ($this->expectedCount) { - case 0: - $message .= 'was not expected to be called.'; - break; - case 1: - $message .= 'was not expected to be called more than once.'; - break; - default: - $message .= sprintf('was not expected to be called more than %d times.', $this->expectedCount); - } - throw new ExpectationFailedException($message); - } + parent::__construct('Proxying to original methods requires invoking the original constructor'); } } constraint = $constraint; - } - public function toString() : string - { - return 'method name ' . $this->constraint->toString(); - } - /** - * @throws \PHPUnit\Framework\ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function matches(BaseInvocation $invocation) : bool - { - return $this->matchesName($invocation->getMethodName()); - } - /** - * @throws \PHPUnit\Framework\ExpectationFailedException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function matchesName(string $methodName) : bool - { - return (bool) $this->constraint->evaluate($methodName, '', \true); - } } parameters[] = $parameter; - } - } - public function toString() : string - { - $text = 'with parameter'; - foreach ($this->parameters as $index => $parameter) { - if ($index > 0) { - $text .= ' and'; - } - $text .= ' ' . $index . ' ' . $parameter->toString(); - } - return $text; - } - /** - * @throws Exception - */ - public function apply(BaseInvocation $invocation) : void - { - $this->invocation = $invocation; - $this->parameterVerificationResult = null; - try { - $this->parameterVerificationResult = $this->doVerify(); - } catch (ExpectationFailedException $e) { - $this->parameterVerificationResult = $e; - throw $this->parameterVerificationResult; - } - } - /** - * Checks if the invocation $invocation matches the current rules. If it - * does the rule will get the invoked() method called which should check - * if an expectation is met. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - public function verify() : void - { - $this->doVerify(); - } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws ExpectationFailedException - */ - private function doVerify() : bool - { - if (isset($this->parameterVerificationResult)) { - return $this->guardAgainstDuplicateEvaluationOfParameterConstraints(); - } - if ($this->invocation === null) { - throw new ExpectationFailedException('Mocked method does not exist.'); - } - if (count($this->invocation->getParameters()) < count($this->parameters)) { - $message = 'Parameter count for invocation %s is too low.'; - // The user called `->with($this->anything())`, but may have meant - // `->withAnyParameters()`. - // - // @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/199 - if (count($this->parameters) === 1 && get_class($this->parameters[0]) === IsAnything::class) { - $message .= "\nTo allow 0 or more parameters with any value, omit ->with() or use ->withAnyParameters() instead."; - } - throw new ExpectationFailedException(sprintf($message, $this->invocation->toString())); - } - foreach ($this->parameters as $i => $parameter) { - $parameter->evaluate($this->invocation->getParameters()[$i], sprintf('Parameter %s for invocation %s does not match expected ' . 'value.', $i, $this->invocation->toString())); - } - return \true; - } - /** - * @throws ExpectationFailedException - */ - private function guardAgainstDuplicateEvaluationOfParameterConstraints() : bool + public function __construct(\PHPUnit\Framework\MockObject\Invocation $invocation) { - if ($this->parameterVerificationResult instanceof ExpectationFailedException) { - throw $this->parameterVerificationResult; - } - return (bool) $this->parameterVerificationResult; + parent::__construct(sprintf('Return value inference disabled and no expectation set up for %s::%s()', $invocation->getClassName(), $invocation->getMethodName())); } } stack = $stack; - } - public function invoke(Invocation $invocation) - { - $this->value = array_shift($this->stack); - if ($this->value instanceof \PHPUnit\Framework\MockObject\Stub\Stub) { - $this->value = $this->value->invoke($invocation); - } - return $this->value; - } - public function toString() : string + public function __construct(string $className) { - $exporter = new Exporter(); - return sprintf('return user-specified value %s', $exporter->export($this->value)); + parent::__construct(sprintf('Class "%s" does not exist', $className)); } } exception = $exception; - } - /** - * @throws Throwable - */ - public function invoke(Invocation $invocation) : void - { - throw $this->exception; - } - public function toString() : string + public function __construct(string $traitName) { - $exporter = new Exporter(); - return sprintf('raise user-specified exception %s', $exporter->export($this->exception)); + parent::__construct(sprintf('Trait "%s" does not exist', $traitName)); } } argumentIndex = $argumentIndex; - } - public function invoke(Invocation $invocation) - { - if (isset($invocation->getParameters()[$this->argumentIndex])) { - return $invocation->getParameters()[$this->argumentIndex]; - } - } - public function toString() : string + public function __construct(string $type) { - return sprintf('return argument #%d', $this->argumentIndex); + parent::__construct(sprintf('Class or interface "%s" does not exist', $type)); } } callback = $callback; - } - public function invoke(Invocation $invocation) - { - return call_user_func_array($this->callback, $invocation->getParameters()); - } - public function toString() : string + private const MOCKED_CLONE_METHOD_WITH_VOID_RETURN_TYPE_TRAIT = <<<'EOT' +namespace PHPUnit\Framework\MockObject; + +trait MockedCloneMethodWithVoidReturnType +{ + public function __clone(): void { - if (is_array($this->callback)) { - if (is_object($this->callback[0])) { - $class = get_class($this->callback[0]); - $type = '->'; - } else { - $class = $this->callback[0]; - $type = '::'; - } - return sprintf('return result of user defined callback %s%s%s() with the ' . 'passed arguments', $class, $type, $this->callback[1]); - } - return 'return result of user defined callback ' . $this->callback . ' with the passed arguments'; + $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler(); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject\Stub; +EOT; + private const MOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT = <<<'EOT' +namespace PHPUnit\Framework\MockObject; -use function sprintf; -use PHPUnit\Framework\MockObject\Invocation; -use PHPUnit\SebastianBergmann\Exporter\Exporter; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class ReturnReference implements \PHPUnit\Framework\MockObject\Stub\Stub +trait MockedCloneMethodWithoutReturnType { - /** - * @var mixed - */ - private $reference; - public function __construct(&$reference) - { - $this->reference =& $reference; - } - public function invoke(Invocation $invocation) - { - return $this->reference; - } - public function toString() : string + public function __clone() { - $exporter = new Exporter(); - return sprintf('return user-specified reference %s', $exporter->export($this->reference)); + $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler(); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject\Stub; +EOT; + private const UNMOCKED_CLONE_METHOD_WITH_VOID_RETURN_TYPE_TRAIT = <<<'EOT' +namespace PHPUnit\Framework\MockObject; -use PHPUnit\Framework\MockObject\Invocation; -use PHPUnit\Framework\MockObject\RuntimeException; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class ReturnSelf implements \PHPUnit\Framework\MockObject\Stub\Stub +trait UnmockedCloneMethodWithVoidReturnType { - /** - * @throws RuntimeException - */ - public function invoke(Invocation $invocation) - { - return $invocation->getObject(); - } - public function toString() : string + public function __clone(): void { - return 'return the current object'; + $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler(); + + parent::__clone(); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject\Stub; +EOT; + private const UNMOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT = <<<'EOT' +namespace PHPUnit\Framework\MockObject; -use function sprintf; -use PHPUnit\Framework\MockObject\Invocation; -use PHPUnit\SebastianBergmann\Exporter\Exporter; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class ReturnStub implements \PHPUnit\Framework\MockObject\Stub\Stub +trait UnmockedCloneMethodWithoutReturnType { - /** - * @var mixed - */ - private $value; - public function __construct($value) - { - $this->value = $value; - } - public function invoke(Invocation $invocation) - { - return $this->value; - } - public function toString() : string + public function __clone() { - $exporter = new Exporter(); - return sprintf('return user-specified value %s', $exporter->export($this->value)); + $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler(); + + parent::__clone(); } } - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject\Stub; - -use function array_pop; -use function count; -use function is_array; -use PHPUnit\Framework\MockObject\Invocation; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class ReturnValueMap implements \PHPUnit\Framework\MockObject\Stub\Stub -{ +EOT; /** * @var array */ - private $valueMap; - public function __construct(array $valueMap) - { - $this->valueMap = $valueMap; - } - public function invoke(Invocation $invocation) + private const EXCLUDED_METHOD_NAMES = ['__CLASS__' => \true, '__DIR__' => \true, '__FILE__' => \true, '__FUNCTION__' => \true, '__LINE__' => \true, '__METHOD__' => \true, '__NAMESPACE__' => \true, '__TRAIT__' => \true, '__clone' => \true, '__halt_compiler' => \true]; + /** + * @var array + */ + private static $cache = []; + /** + * @var Template[] + */ + private static $templates = []; + /** + * Returns a mock object for the specified class. + * + * @param null|array $methods + * + * @throws ClassAlreadyExistsException + * @throws ClassIsFinalException + * @throws ClassIsReadonlyException + * @throws DuplicateMethodException + * @throws InvalidArgumentException + * @throws InvalidMethodNameException + * @throws OriginalConstructorInvocationRequiredException + * @throws ReflectionException + * @throws RuntimeException + * @throws UnknownTypeException + */ + public function getMock(string $type, $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, bool $cloneArguments = \true, bool $callOriginalMethods = \false, ?object $proxyTarget = null, bool $allowMockingUnknownTypes = \true, bool $returnValueGeneration = \true): \PHPUnit\Framework\MockObject\MockObject { - $parameterCount = count($invocation->getParameters()); - foreach ($this->valueMap as $map) { - if (!is_array($map) || $parameterCount !== count($map) - 1) { - continue; + if (!is_array($methods) && null !== $methods) { + throw InvalidArgumentException::create(2, 'array'); + } + if ($type === 'Traversable' || $type === '\Traversable') { + $type = 'Iterator'; + } + if (!$allowMockingUnknownTypes && !class_exists($type, $callAutoload) && !interface_exists($type, $callAutoload)) { + throw new \PHPUnit\Framework\MockObject\UnknownTypeException($type); + } + if (null !== $methods) { + foreach ($methods as $method) { + if (!preg_match('~[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*~', (string) $method)) { + throw new \PHPUnit\Framework\MockObject\InvalidMethodNameException((string) $method); + } } - $return = array_pop($map); - if ($invocation->getParameters() === $map) { - return $return; + if ($methods !== array_unique($methods)) { + throw new \PHPUnit\Framework\MockObject\DuplicateMethodException($methods); } } + if ($mockClassName !== '' && class_exists($mockClassName, \false)) { + try { + $reflector = new ReflectionClass($mockClassName); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if (!$reflector->implementsInterface(\PHPUnit\Framework\MockObject\MockObject::class)) { + throw new \PHPUnit\Framework\MockObject\ClassAlreadyExistsException($mockClassName); + } + } + if (!$callOriginalConstructor && $callOriginalMethods) { + throw new \PHPUnit\Framework\MockObject\OriginalConstructorInvocationRequiredException(); + } + $mock = $this->generate($type, $methods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments, $callOriginalMethods); + return $this->getObject($mock, $type, $callOriginalConstructor, $callAutoload, $arguments, $callOriginalMethods, $proxyTarget, $returnValueGeneration); } - public function toString() : string - { - return 'return value from a map'; - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject\Stub; - -use PHPUnit\Framework\MockObject\Invocation; -use PHPUnit\Framework\SelfDescribing; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -interface Stub extends SelfDescribing -{ /** - * Fakes the processing of the invocation $invocation by returning a - * specific value. + * @psalm-param list $interfaces * - * @param Invocation $invocation The invocation which was mocked and matched by the current method and argument matchers + * @throws RuntimeException + * @throws UnknownTypeException */ - public function invoke(Invocation $invocation); -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework\MockObject; - -use PHPUnit\Framework\ExpectationFailedException; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -interface Verifiable -{ + public function getMockForInterfaces(array $interfaces, bool $callAutoload = \true): \PHPUnit\Framework\MockObject\MockObject + { + if (count($interfaces) < 2) { + throw new \PHPUnit\Framework\MockObject\RuntimeException('At least two interfaces must be specified'); + } + foreach ($interfaces as $interface) { + if (!interface_exists($interface, $callAutoload)) { + throw new \PHPUnit\Framework\MockObject\UnknownTypeException($interface); + } + } + sort($interfaces); + $methods = []; + foreach ($interfaces as $interface) { + $methods = array_merge($methods, $this->getClassMethods($interface)); + } + if (count(array_unique($methods)) < count($methods)) { + throw new \PHPUnit\Framework\MockObject\RuntimeException('Interfaces must not declare the same method'); + } + $unqualifiedNames = []; + foreach ($interfaces as $interface) { + $parts = explode('\\', $interface); + $unqualifiedNames[] = array_pop($parts); + } + sort($unqualifiedNames); + do { + $intersectionName = sprintf('Intersection_%s_%s', implode('_', $unqualifiedNames), substr(md5((string) mt_rand()), 0, 8)); + } while (interface_exists($intersectionName, \false)); + $template = $this->getTemplate('intersection.tpl'); + $template->setVar(['intersection' => $intersectionName, 'interfaces' => implode(', ', $interfaces)]); + eval($template->render()); + return $this->getMock($intersectionName); + } /** - * Verifies that the current expectation is valid. If everything is OK the - * code should just return, if not it must throw an exception. + * Returns a mock object for the specified abstract class with all abstract + * methods of the class mocked. * - * @throws ExpectationFailedException - */ - public function verify() : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -interface Reorderable -{ - public function sortId() : string; - /** - * @return list - */ - public function provides() : array; - /** - * @return list - */ - public function requires() : array; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -interface SelfDescribing -{ - /** - * Returns a string representation of the object. + * Concrete methods to mock can be specified with the $mockedMethods parameter. + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return MockObject&RealInstanceType + * + * @throws ClassAlreadyExistsException + * @throws ClassIsFinalException + * @throws ClassIsReadonlyException + * @throws DuplicateMethodException + * @throws InvalidArgumentException + * @throws InvalidMethodNameException + * @throws OriginalConstructorInvocationRequiredException + * @throws ReflectionException + * @throws RuntimeException + * @throws UnknownClassException + * @throws UnknownTypeException */ - public function toString() : string; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -use Throwable; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -interface SkippedTest extends Throwable -{ -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class SkippedTestCase extends \PHPUnit\Framework\TestCase -{ + public function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, ?array $mockedMethods = null, bool $cloneArguments = \true): \PHPUnit\Framework\MockObject\MockObject + { + if (class_exists($originalClassName, $callAutoload) || interface_exists($originalClassName, $callAutoload)) { + try { + $reflector = new ReflectionClass($originalClassName); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $methods = $mockedMethods; + foreach ($reflector->getMethods() as $method) { + if ($method->isAbstract() && !in_array($method->getName(), $methods ?? [], \true)) { + $methods[] = $method->getName(); + } + } + if (empty($methods)) { + $methods = null; + } + return $this->getMock($originalClassName, $methods, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $cloneArguments); + } + throw new \PHPUnit\Framework\MockObject\UnknownClassException($originalClassName); + } /** - * @var ?bool + * Returns a mock object for the specified trait with all abstract methods + * of the trait mocked. Concrete methods to mock can be specified with the + * `$mockedMethods` parameter. + * + * @psalm-param trait-string $traitName + * + * @throws ClassAlreadyExistsException + * @throws ClassIsFinalException + * @throws ClassIsReadonlyException + * @throws DuplicateMethodException + * @throws InvalidArgumentException + * @throws InvalidMethodNameException + * @throws OriginalConstructorInvocationRequiredException + * @throws ReflectionException + * @throws RuntimeException + * @throws UnknownClassException + * @throws UnknownTraitException + * @throws UnknownTypeException */ - protected $backupGlobals = \false; + public function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, ?array $mockedMethods = null, bool $cloneArguments = \true): \PHPUnit\Framework\MockObject\MockObject + { + if (!trait_exists($traitName, $callAutoload)) { + throw new \PHPUnit\Framework\MockObject\UnknownTraitException($traitName); + } + $className = $this->generateClassName($traitName, '', 'Trait_'); + $classTemplate = $this->getTemplate('trait_class.tpl'); + $classTemplate->setVar(['prologue' => 'abstract ', 'class_name' => $className['className'], 'trait_name' => $traitName]); + $mockTrait = new \PHPUnit\Framework\MockObject\MockTrait($classTemplate->render(), $className['className']); + $mockTrait->generate(); + return $this->getMockForAbstractClass($className['className'], $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments); + } /** - * @var ?bool + * Returns an object for the specified trait. + * + * @psalm-param trait-string $traitName + * + * @throws ReflectionException + * @throws RuntimeException + * @throws UnknownTraitException */ - protected $backupStaticAttributes = \false; + public function getObjectForTrait(string $traitName, string $traitClassName = '', bool $callAutoload = \true, bool $callOriginalConstructor = \false, array $arguments = []): object + { + if (!trait_exists($traitName, $callAutoload)) { + throw new \PHPUnit\Framework\MockObject\UnknownTraitException($traitName); + } + $className = $this->generateClassName($traitName, $traitClassName, 'Trait_'); + $classTemplate = $this->getTemplate('trait_class.tpl'); + $classTemplate->setVar(['prologue' => '', 'class_name' => $className['className'], 'trait_name' => $traitName]); + return $this->getObject(new \PHPUnit\Framework\MockObject\MockTrait($classTemplate->render(), $className['className']), '', $callOriginalConstructor, $callAutoload, $arguments); + } /** - * @var ?bool + * @throws ClassIsFinalException + * @throws ClassIsReadonlyException + * @throws ReflectionException + * @throws RuntimeException */ - protected $runTestInSeparateProcess = \false; + public function generate(string $type, ?array $methods = null, string $mockClassName = '', bool $callOriginalClone = \true, bool $callAutoload = \true, bool $cloneArguments = \true, bool $callOriginalMethods = \false): \PHPUnit\Framework\MockObject\MockClass + { + if ($mockClassName !== '') { + return $this->generateMock($type, $methods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments, $callOriginalMethods); + } + $key = md5($type . serialize($methods) . serialize($callOriginalClone) . serialize($cloneArguments) . serialize($callOriginalMethods)); + if (!isset(self::$cache[$key])) { + self::$cache[$key] = $this->generateMock($type, $methods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments, $callOriginalMethods); + } + return self::$cache[$key]; + } /** - * @var string + * @throws RuntimeException + * @throws SoapExtensionNotAvailableException */ - private $message; - public function __construct(string $className, string $methodName, string $message = '') + public function generateClassFromWsdl(string $wsdlFile, string $className, array $methods = [], array $options = []): string { - parent::__construct($className . '::' . $methodName); - $this->message = $message; + if (!extension_loaded('soap')) { + throw new \PHPUnit\Framework\MockObject\SoapExtensionNotAvailableException(); + } + $options = array_merge($options, ['cache_wsdl' => WSDL_CACHE_NONE]); + try { + $client = new SoapClient($wsdlFile, $options); + $_methods = array_unique($client->__getFunctions()); + unset($client); + } catch (SoapFault $e) { + throw new \PHPUnit\Framework\MockObject\RuntimeException($e->getMessage(), $e->getCode(), $e); + } + sort($_methods); + $methodTemplate = $this->getTemplate('wsdl_method.tpl'); + $methodsBuffer = ''; + foreach ($_methods as $method) { + preg_match_all('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\(/', $method, $matches, PREG_OFFSET_CAPTURE); + $lastFunction = array_pop($matches[0]); + $nameStart = $lastFunction[1]; + $nameEnd = $nameStart + strlen($lastFunction[0]) - 1; + $name = str_replace('(', '', $lastFunction[0]); + if (empty($methods) || in_array($name, $methods, \true)) { + $args = explode(',', str_replace(')', '', substr($method, $nameEnd + 1))); + foreach (range(0, count($args) - 1) as $i) { + $parameterStart = strpos($args[$i], '$'); + if (!$parameterStart) { + continue; + } + $args[$i] = substr($args[$i], $parameterStart); + } + $methodTemplate->setVar(['method_name' => $name, 'arguments' => implode(', ', $args)]); + $methodsBuffer .= $methodTemplate->render(); + } + } + $optionsBuffer = '['; + foreach ($options as $key => $value) { + $optionsBuffer .= $key . ' => ' . $value; + } + $optionsBuffer .= ']'; + $classTemplate = $this->getTemplate('wsdl_class.tpl'); + $namespace = ''; + if (strpos($className, '\\') !== \false) { + $parts = explode('\\', $className); + $className = array_pop($parts); + $namespace = 'namespace ' . implode('\\', $parts) . ';' . "\n\n"; + } + $classTemplate->setVar(['namespace' => $namespace, 'class_name' => $className, 'wsdl' => $wsdlFile, 'options' => $optionsBuffer, 'methods' => $methodsBuffer]); + return $classTemplate->render(); } - public function getMessage() : string + /** + * @throws ReflectionException + * + * @return string[] + */ + public function getClassMethods(string $className): array { - return $this->message; + try { + $class = new ReflectionClass($className); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $methods = []; + foreach ($class->getMethods() as $method) { + if ($method->isPublic() || $method->isAbstract()) { + $methods[] = $method->getName(); + } + } + return $methods; } /** - * Returns a string representation of the test case. + * @throws ReflectionException * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @return MockMethod[] */ - public function toString() : string + public function mockClassMethods(string $className, bool $callOriginalMethods, bool $cloneArguments): array { - return $this->getName(); + try { + $class = new ReflectionClass($className); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $methods = []; + foreach ($class->getMethods() as $method) { + if (($method->isPublic() || $method->isAbstract()) && $this->canMockMethod($method)) { + $methods[] = \PHPUnit\Framework\MockObject\MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments); + } + } + return $methods; } /** - * @throws Exception + * @throws ReflectionException + * + * @return MockMethod[] */ - protected function runTest() : void + public function mockInterfaceMethods(string $interfaceName, bool $cloneArguments): array { - $this->markTestSkipped($this->message); - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -use Countable; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -interface Test extends Countable -{ + try { + $class = new ReflectionClass($interfaceName); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $methods = []; + foreach ($class->getMethods() as $method) { + $methods[] = \PHPUnit\Framework\MockObject\MockMethod::fromReflection($method, \false, $cloneArguments); + } + return $methods; + } /** - * Runs a test and collects its result in a TestResult instance. + * @psalm-param class-string $interfaceName + * + * @throws ReflectionException + * + * @return ReflectionMethod[] */ - public function run(\PHPUnit\Framework\TestResult $result = null) : \PHPUnit\Framework\TestResult; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -use function assert; -use function count; -use function get_class; -use function sprintf; -use function trim; -use PHPUnit\Util\Filter; -use PHPUnit\Util\InvalidDataSetException; -use PHPUnit\Util\Test as TestUtil; -use ReflectionClass; -use Throwable; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class TestBuilder -{ - public function build(ReflectionClass $theClass, string $methodName) : \PHPUnit\Framework\Test + private function userDefinedInterfaceMethods(string $interfaceName): array { - $className = $theClass->getName(); - if (!$theClass->isInstantiable()) { - return new \PHPUnit\Framework\ErrorTestCase(sprintf('Cannot instantiate class "%s".', $className)); + try { + // @codeCoverageIgnoreStart + $interface = new ReflectionClass($interfaceName); + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); } - $backupSettings = TestUtil::getBackupSettings($className, $methodName); - $preserveGlobalState = TestUtil::getPreserveGlobalStateSettings($className, $methodName); - $runTestInSeparateProcess = TestUtil::getProcessIsolationSettings($className, $methodName); - $runClassInSeparateProcess = TestUtil::getClassProcessIsolationSettings($className, $methodName); - $constructor = $theClass->getConstructor(); - if ($constructor === null) { - throw new \PHPUnit\Framework\Exception('No valid test provided.'); + // @codeCoverageIgnoreEnd + $methods = []; + foreach ($interface->getMethods() as $method) { + if (!$method->isUserDefined()) { + continue; + } + $methods[] = $method; } - $parameters = $constructor->getParameters(); - // TestCase() or TestCase($name) - if (count($parameters) < 2) { - $test = $this->buildTestWithoutData($className); + return $methods; + } + /** + * @throws ReflectionException + * @throws RuntimeException + */ + private function getObject(\PHPUnit\Framework\MockObject\MockType $mockClass, $type = '', bool $callOriginalConstructor = \false, bool $callAutoload = \false, array $arguments = [], bool $callOriginalMethods = \false, ?object $proxyTarget = null, bool $returnValueGeneration = \true) + { + $className = $mockClass->generate(); + if ($callOriginalConstructor) { + if (count($arguments) === 0) { + $object = new $className(); + } else { + try { + $class = new ReflectionClass($className); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $object = $class->newInstanceArgs($arguments); + } } else { try { - $data = TestUtil::getProvidedData($className, $methodName); - } catch (\PHPUnit\Framework\IncompleteTestError $e) { - $message = sprintf("Test for %s::%s marked incomplete by data provider\n%s", $className, $methodName, $this->throwableToString($e)); - $data = new \PHPUnit\Framework\IncompleteTestCase($className, $methodName, $message); - } catch (\PHPUnit\Framework\SkippedTestError $e) { - $message = sprintf("Test for %s::%s skipped by data provider\n%s", $className, $methodName, $this->throwableToString($e)); - $data = new \PHPUnit\Framework\SkippedTestCase($className, $methodName, $message); - } catch (Throwable $t) { - $message = sprintf("The data provider specified for %s::%s is invalid.\n%s", $className, $methodName, $this->throwableToString($t)); - $data = new \PHPUnit\Framework\ErrorTestCase($message); + $object = (new Instantiator())->instantiate($className); + } catch (InstantiatorException $e) { + throw new \PHPUnit\Framework\MockObject\RuntimeException($e->getMessage()); } - // Test method with @dataProvider. - if (isset($data)) { - $test = $this->buildDataProviderTestSuite($methodName, $className, $data, $runTestInSeparateProcess, $preserveGlobalState, $runClassInSeparateProcess, $backupSettings); + } + if ($callOriginalMethods) { + if (!is_object($proxyTarget)) { + if (count($arguments) === 0) { + $proxyTarget = new $type(); + } else { + try { + $class = new ReflectionClass($type); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $proxyTarget = $class->newInstanceArgs($arguments); + } + } + $object->__phpunit_setOriginalObject($proxyTarget); + } + if ($object instanceof \PHPUnit\Framework\MockObject\MockObject) { + $object->__phpunit_setReturnValueGeneration($returnValueGeneration); + } + return $object; + } + /** + * @throws ClassIsFinalException + * @throws ClassIsReadonlyException + * @throws ReflectionException + * @throws RuntimeException + */ + private function generateMock(string $type, ?array $explicitMethods, string $mockClassName, bool $callOriginalClone, bool $callAutoload, bool $cloneArguments, bool $callOriginalMethods): \PHPUnit\Framework\MockObject\MockClass + { + $classTemplate = $this->getTemplate('mocked_class.tpl'); + $additionalInterfaces = []; + $mockedCloneMethod = \false; + $unmockedCloneMethod = \false; + $isClass = \false; + $isInterface = \false; + $class = null; + $mockMethods = new \PHPUnit\Framework\MockObject\MockMethodSet(); + $_mockClassName = $this->generateClassName($type, $mockClassName, 'Mock_'); + if (class_exists($_mockClassName['fullClassName'], $callAutoload)) { + $isClass = \true; + } elseif (interface_exists($_mockClassName['fullClassName'], $callAutoload)) { + $isInterface = \true; + } + if (!$isClass && !$isInterface) { + $prologue = 'class ' . $_mockClassName['originalClassName'] . "\n{\n}\n\n"; + if (!empty($_mockClassName['namespaceName'])) { + $prologue = 'namespace ' . $_mockClassName['namespaceName'] . " {\n\n" . $prologue . "}\n\n" . "namespace {\n\n"; + $epilogue = "\n\n}"; + } + $mockedCloneMethod = \true; + } else { + try { + $class = new ReflectionClass($_mockClassName['fullClassName']); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if ($class->isFinal()) { + throw new \PHPUnit\Framework\MockObject\ClassIsFinalException($_mockClassName['fullClassName']); + } + if (method_exists($class, 'isReadOnly') && $class->isReadOnly()) { + throw new \PHPUnit\Framework\MockObject\ClassIsReadonlyException($_mockClassName['fullClassName']); + } + // @see https://github.com/sebastianbergmann/phpunit/issues/2995 + if ($isInterface && $class->implementsInterface(Throwable::class)) { + $actualClassName = Exception::class; + $additionalInterfaces[] = $class->getName(); + $isInterface = \false; + try { + $class = new ReflectionClass($actualClassName); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + foreach ($this->userDefinedInterfaceMethods($_mockClassName['fullClassName']) as $method) { + $methodName = $method->getName(); + if ($class->hasMethod($methodName)) { + try { + $classMethod = $class->getMethod($methodName); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if (!$this->canMockMethod($classMethod)) { + continue; + } + } + $mockMethods->addMethods(\PHPUnit\Framework\MockObject\MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)); + } + $_mockClassName = $this->generateClassName($actualClassName, $_mockClassName['className'], 'Mock_'); + } + // @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/103 + if ($isInterface && $class->implementsInterface(Traversable::class) && !$class->implementsInterface(Iterator::class) && !$class->implementsInterface(IteratorAggregate::class)) { + $additionalInterfaces[] = Iterator::class; + $mockMethods->addMethods(...$this->mockClassMethods(Iterator::class, $callOriginalMethods, $cloneArguments)); + } + if ($class->hasMethod('__clone')) { + try { + $cloneMethod = $class->getMethod('__clone'); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if (!$cloneMethod->isFinal()) { + if ($callOriginalClone && !$isInterface) { + $unmockedCloneMethod = \true; + } else { + $mockedCloneMethod = \true; + } + } } else { - $test = $this->buildTestWithoutData($className); + $mockedCloneMethod = \true; } } - if ($test instanceof \PHPUnit\Framework\TestCase) { - $test->setName($methodName); - $this->configureTestCase($test, $runTestInSeparateProcess, $preserveGlobalState, $runClassInSeparateProcess, $backupSettings); + if ($isClass && $explicitMethods === []) { + $mockMethods->addMethods(...$this->mockClassMethods($_mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments)); } - return $test; + if ($isInterface && ($explicitMethods === [] || $explicitMethods === null)) { + $mockMethods->addMethods(...$this->mockInterfaceMethods($_mockClassName['fullClassName'], $cloneArguments)); + } + if (is_array($explicitMethods)) { + foreach ($explicitMethods as $methodName) { + if ($class !== null && $class->hasMethod($methodName)) { + try { + $method = $class->getMethod($methodName); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if ($this->canMockMethod($method)) { + $mockMethods->addMethods(\PHPUnit\Framework\MockObject\MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)); + } + } else { + $mockMethods->addMethods(\PHPUnit\Framework\MockObject\MockMethod::fromName($_mockClassName['fullClassName'], $methodName, $cloneArguments)); + } + } + } + $mockedMethods = ''; + $configurable = []; + foreach ($mockMethods->asArray() as $mockMethod) { + $mockedMethods .= $mockMethod->generateCode(); + $configurable[] = new \PHPUnit\Framework\MockObject\ConfigurableMethod($mockMethod->getName(), $mockMethod->getReturnType()); + } + $method = ''; + if (!$mockMethods->hasMethod('method') && (!isset($class) || !$class->hasMethod('method'))) { + $method = PHP_EOL . ' use \PHPUnit\Framework\MockObject\Method;'; + } + $cloneTrait = ''; + if ($mockedCloneMethod) { + $cloneTrait = $this->mockedCloneMethod(); + } + if ($unmockedCloneMethod) { + $cloneTrait = $this->unmockedCloneMethod(); + } + $classTemplate->setVar(['prologue' => $prologue ?? '', 'epilogue' => $epilogue ?? '', 'class_declaration' => $this->generateMockClassDeclaration($_mockClassName, $isInterface, $additionalInterfaces), 'clone' => $cloneTrait, 'mock_class_name' => $_mockClassName['className'], 'mocked_methods' => $mockedMethods, 'method' => $method]); + return new \PHPUnit\Framework\MockObject\MockClass($classTemplate->render(), $_mockClassName['className'], $configurable); } - /** @psalm-param class-string $className */ - private function buildTestWithoutData(string $className) + private function generateClassName(string $type, string $className, string $prefix): array { - return new $className(); + if ($type[0] === '\\') { + $type = substr($type, 1); + } + $classNameParts = explode('\\', $type); + if (count($classNameParts) > 1) { + $type = array_pop($classNameParts); + $namespaceName = implode('\\', $classNameParts); + $fullClassName = $namespaceName . '\\' . $type; + } else { + $namespaceName = ''; + $fullClassName = $type; + } + if ($className === '') { + do { + $className = $prefix . $type . '_' . substr(md5((string) mt_rand()), 0, 8); + } while (class_exists($className, \false)); + } + return ['className' => $className, 'originalClassName' => $type, 'fullClassName' => $fullClassName, 'namespaceName' => $namespaceName]; } - /** @psalm-param class-string $className */ - private function buildDataProviderTestSuite(string $methodName, string $className, $data, bool $runTestInSeparateProcess, ?bool $preserveGlobalState, bool $runClassInSeparateProcess, array $backupSettings) : \PHPUnit\Framework\DataProviderTestSuite + private function generateMockClassDeclaration(array $mockClassName, bool $isInterface, array $additionalInterfaces = []): string { - $dataProviderTestSuite = new \PHPUnit\Framework\DataProviderTestSuite($className . '::' . $methodName); - $groups = TestUtil::getGroups($className, $methodName); - if ($data instanceof \PHPUnit\Framework\ErrorTestCase || $data instanceof \PHPUnit\Framework\SkippedTestCase || $data instanceof \PHPUnit\Framework\IncompleteTestCase) { - $dataProviderTestSuite->addTest($data, $groups); + $buffer = 'class '; + $additionalInterfaces[] = \PHPUnit\Framework\MockObject\MockObject::class; + $interfaces = implode(', ', $additionalInterfaces); + if ($isInterface) { + $buffer .= sprintf('%s implements %s', $mockClassName['className'], $interfaces); + if (!in_array($mockClassName['originalClassName'], $additionalInterfaces, \true)) { + $buffer .= ', '; + if (!empty($mockClassName['namespaceName'])) { + $buffer .= $mockClassName['namespaceName'] . '\\'; + } + $buffer .= $mockClassName['originalClassName']; + } } else { - foreach ($data as $_dataName => $_data) { - $_test = new $className($methodName, $_data, $_dataName); - assert($_test instanceof \PHPUnit\Framework\TestCase); - $this->configureTestCase($_test, $runTestInSeparateProcess, $preserveGlobalState, $runClassInSeparateProcess, $backupSettings); - $dataProviderTestSuite->addTest($_test, $groups); + $buffer .= sprintf('%s extends %s%s implements %s', $mockClassName['className'], (!empty($mockClassName['namespaceName'])) ? $mockClassName['namespaceName'] . '\\' : '', $mockClassName['originalClassName'], $interfaces); + } + return $buffer; + } + private function canMockMethod(ReflectionMethod $method): bool + { + return !($this->isConstructor($method) || $method->isFinal() || $method->isPrivate() || $this->isMethodNameExcluded($method->getName())); + } + private function isMethodNameExcluded(string $name): bool + { + return isset(self::EXCLUDED_METHOD_NAMES[$name]); + } + /** + * @throws RuntimeException + */ + private function getTemplate(string $template): Template + { + $filename = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR . $template; + if (!isset(self::$templates[$filename])) { + try { + self::$templates[$filename] = new Template($filename); + } catch (TemplateException $e) { + throw new \PHPUnit\Framework\MockObject\RuntimeException($e->getMessage(), $e->getCode(), $e); } } - return $dataProviderTestSuite; + return self::$templates[$filename]; + } + /** + * @see https://github.com/sebastianbergmann/phpunit/issues/4139#issuecomment-605409765 + */ + private function isConstructor(ReflectionMethod $method): bool + { + $methodName = strtolower($method->getName()); + if ($methodName === '__construct') { + return \true; + } + if (PHP_MAJOR_VERSION >= 8) { + return \false; + } + $className = strtolower($method->getDeclaringClass()->getName()); + return $methodName === $className; } - private function configureTestCase(\PHPUnit\Framework\TestCase $test, bool $runTestInSeparateProcess, ?bool $preserveGlobalState, bool $runClassInSeparateProcess, array $backupSettings) : void + private function mockedCloneMethod(): string { - if ($runTestInSeparateProcess) { - $test->setRunTestInSeparateProcess(\true); - if ($preserveGlobalState !== null) { - $test->setPreserveGlobalState($preserveGlobalState); + if (PHP_MAJOR_VERSION >= 8) { + if (!trait_exists('\PHPUnit\Framework\MockObject\MockedCloneMethodWithVoidReturnType')) { + eval(self::MOCKED_CLONE_METHOD_WITH_VOID_RETURN_TYPE_TRAIT); } + return PHP_EOL . ' use \PHPUnit\Framework\MockObject\MockedCloneMethodWithVoidReturnType;'; } - if ($runClassInSeparateProcess) { - $test->setRunClassInSeparateProcess(\true); - if ($preserveGlobalState !== null) { - $test->setPreserveGlobalState($preserveGlobalState); + if (!trait_exists('\PHPUnit\Framework\MockObject\MockedCloneMethodWithoutReturnType')) { + eval(self::MOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT); + } + return PHP_EOL . ' use \PHPUnit\Framework\MockObject\MockedCloneMethodWithoutReturnType;'; + } + private function unmockedCloneMethod(): string + { + if (PHP_MAJOR_VERSION >= 8) { + if (!trait_exists('\PHPUnit\Framework\MockObject\UnmockedCloneMethodWithVoidReturnType')) { + eval(self::UNMOCKED_CLONE_METHOD_WITH_VOID_RETURN_TYPE_TRAIT); } + return PHP_EOL . ' use \PHPUnit\Framework\MockObject\UnmockedCloneMethodWithVoidReturnType;'; } - if ($backupSettings['backupGlobals'] !== null) { - $test->setBackupGlobals($backupSettings['backupGlobals']); + if (!trait_exists('\PHPUnit\Framework\MockObject\UnmockedCloneMethodWithoutReturnType')) { + eval(self::UNMOCKED_CLONE_METHOD_WITHOUT_RETURN_TYPE_TRAIT); } - if ($backupSettings['backupStaticAttributes'] !== null) { - $test->setBackupStaticAttributes($backupSettings['backupStaticAttributes']); + return PHP_EOL . ' use \PHPUnit\Framework\MockObject\UnmockedCloneMethodWithoutReturnType;'; + } +} + + @trigger_error({deprecation}, E_USER_DEPRECATED); +declare(strict_types=1); + +interface {intersection} extends {interfaces} +{ +} +declare(strict_types=1); + +{prologue}{class_declaration} +{ + use \PHPUnit\Framework\MockObject\Api;{method}{clone} +{mocked_methods}}{epilogue} + + {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} + {{deprecation} + $__phpunit_arguments = [{arguments_call}]; + $__phpunit_count = func_num_args(); + + if ($__phpunit_count > {arguments_count}) { + $__phpunit_arguments_tmp = func_get_args(); + + for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { + $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; + } + } + + $__phpunit_result = $this->__phpunit_getInvocationHandler()->invoke( + new \PHPUnit\Framework\MockObject\Invocation( + '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments} + ) + ); + + return $__phpunit_result; + } + + {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} + {{deprecation} + $__phpunit_arguments = [{arguments_call}]; + $__phpunit_count = func_num_args(); + + if ($__phpunit_count > {arguments_count}) { + $__phpunit_arguments_tmp = func_get_args(); + + for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { + $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; + } } + + $this->__phpunit_getInvocationHandler()->invoke( + new \PHPUnit\Framework\MockObject\Invocation( + '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments} + ) + ); } - private function throwableToString(Throwable $t) : string + + {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} { - $message = $t->getMessage(); - if (empty(trim($message))) { - $message = ''; + throw new \PHPUnit\Framework\MockObject\BadMethodCallException('Static method "{method_name}" cannot be invoked on mock object'); + } + + {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} + { + $__phpunit_arguments = [{arguments_call}]; + $__phpunit_count = func_num_args(); + + if ($__phpunit_count > {arguments_count}) { + $__phpunit_arguments_tmp = func_get_args(); + + for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { + $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; + } } - if ($t instanceof InvalidDataSetException) { - return sprintf("%s\n%s", $message, Filter::getFilteredStacktrace($t)); + + $this->__phpunit_getInvocationHandler()->invoke( + new \PHPUnit\Framework\MockObject\Invocation( + '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}, true + ) + ); + + return call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments); + } + + {modifier} function {reference}{method_name}({arguments_decl}){return_declaration} + { + $__phpunit_arguments = [{arguments_call}]; + $__phpunit_count = func_num_args(); + + if ($__phpunit_count > {arguments_count}) { + $__phpunit_arguments_tmp = func_get_args(); + + for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { + $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; + } } - return sprintf("%s: %s\n%s", get_class($t), $message, Filter::getFilteredStacktrace($t)); + + $this->__phpunit_getInvocationHandler()->invoke( + new \PHPUnit\Framework\MockObject\Invocation( + '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}, true + ) + ); + + call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments); } +declare(strict_types=1); + +{prologue}class {class_name} +{ + use {trait_name}; } +declare(strict_types=1); + +{namespace}class {class_name} extends \SoapClient +{ + public function __construct($wsdl, array $options) + { + parent::__construct('{wsdl}', $options); + } +{methods}} + + public function {method_name}({arguments}) + { + } > - */ - protected $backupStaticAttributesExcludeList = []; - /** - * @var array> - * - * @deprecated Use $backupStaticAttributesExcludeList instead - */ - protected $backupStaticAttributesBlacklist = []; - /** - * @var ?bool - */ - protected $runTestInSeparateProcess; - /** - * @var bool - */ - protected $preserveGlobalState = \true; - /** - * @var list - */ - protected $providedTests = []; - /** - * @var ?bool - */ - private $runClassInSeparateProcess; - /** - * @var bool - */ - private $inIsolation = \false; - /** - * @var array - */ - private $data; - /** - * @var int|string - */ - private $dataName; - /** - * @var null|string - */ - private $expectedException; - /** - * @var null|string - */ - private $expectedExceptionMessage; - /** - * @var null|string - */ - private $expectedExceptionMessageRegExp; - /** - * @var null|int|string - */ - private $expectedExceptionCode; /** * @var string */ - private $name = ''; - /** - * @var list - */ - private $dependencies = []; - /** - * @var array - */ - private $dependencyInput = []; - /** - * @var array - */ - private $iniSettings = []; - /** - * @var array - */ - private $locale = []; - /** - * @var MockObject[] - */ - private $mockObjects = []; - /** - * @var MockGenerator - */ - private $mockObjectGenerator; - /** - * @var int - */ - private $status = BaseTestRunner::STATUS_UNKNOWN; + private $className; /** * @var string */ - private $statusMessage = ''; - /** - * @var int - */ - private $numAssertions = 0; - /** - * @var TestResult - */ - private $result; + private $methodName; /** - * @var mixed + * @var array */ - private $testResult; + private $parameters; /** * @var string */ - private $output = ''; - /** - * @var ?string - */ - private $outputExpectedRegex; - /** - * @var ?string - */ - private $outputExpectedString; - /** - * @var mixed - */ - private $outputCallback = \false; - /** - * @var bool - */ - private $outputBufferingActive = \false; - /** - * @var int - */ - private $outputBufferingLevel; - /** - * @var bool - */ - private $outputRetrievedForAssertion = \false; - /** - * @var ?Snapshot - */ - private $snapshot; - /** - * @var \Prophecy\Prophet - */ - private $prophet; - /** - * @var bool - */ - private $beStrictAboutChangesToGlobalState = \false; + private $returnType; /** * @var bool */ - private $registerMockObjectsFromTestArgumentsRecursively = \false; - /** - * @var string[] - */ - private $warnings = []; - /** - * @var string[] - */ - private $groups = []; + private $isReturnTypeNullable = \false; /** * @var bool */ - private $doesNotPerformAssertions = \false; - /** - * @var Comparator[] - */ - private $customComparators = []; - /** - * @var string[] - */ - private $doubledTypes = []; + private $proxiedCall; /** - * Returns a matcher that matches when the method is executed - * zero or more times. + * @var object */ - public static function any() : AnyInvokedCountMatcher + private $object; + public function __construct(string $className, string $methodName, array $parameters, string $returnType, object $object, bool $cloneObjects = \false, bool $proxiedCall = \false) { - return new AnyInvokedCountMatcher(); + $this->className = $className; + $this->methodName = $methodName; + $this->parameters = $parameters; + $this->object = $object; + $this->proxiedCall = $proxiedCall; + if (strtolower($methodName) === '__tostring') { + $returnType = 'string'; + } + if (strpos($returnType, '?') === 0) { + $returnType = substr($returnType, 1); + $this->isReturnTypeNullable = \true; + } + $this->returnType = $returnType; + if (!$cloneObjects) { + return; + } + foreach ($this->parameters as $key => $value) { + if (is_object($value)) { + $this->parameters[$key] = Cloner::clone($value); + } + } } - /** - * Returns a matcher that matches when the method is never executed. - */ - public static function never() : InvokedCountMatcher + public function getClassName(): string { - return new InvokedCountMatcher(0); + return $this->className; } - /** - * Returns a matcher that matches when the method is executed - * at least N times. - */ - public static function atLeast(int $requiredInvocations) : InvokedAtLeastCountMatcher + public function getMethodName(): string { - return new InvokedAtLeastCountMatcher($requiredInvocations); + return $this->methodName; } - /** - * Returns a matcher that matches when the method is executed at least once. - */ - public static function atLeastOnce() : InvokedAtLeastOnceMatcher + public function getParameters(): array { - return new InvokedAtLeastOnceMatcher(); + return $this->parameters; } /** - * Returns a matcher that matches when the method is executed exactly once. + * @throws RuntimeException + * + * @return mixed Mocked return value */ - public static function once() : InvokedCountMatcher + public function generateReturnValue() { - return new InvokedCountMatcher(1); + if ($this->isReturnTypeNullable || $this->proxiedCall) { + return null; + } + $intersection = \false; + $union = \false; + $unionContainsIntersections = \false; + if (strpos($this->returnType, '|') !== \false) { + $types = explode('|', $this->returnType); + $union = \true; + if (strpos($this->returnType, '(') !== \false) { + $unionContainsIntersections = \true; + } + } elseif (strpos($this->returnType, '&') !== \false) { + $types = explode('&', $this->returnType); + $intersection = \true; + } else { + $types = [$this->returnType]; + } + $types = array_map('strtolower', $types); + if (!$intersection && !$unionContainsIntersections) { + if (in_array('', $types, \true) || in_array('null', $types, \true) || in_array('mixed', $types, \true) || in_array('void', $types, \true)) { + return null; + } + if (in_array('true', $types, \true)) { + return \true; + } + if (in_array('false', $types, \true) || in_array('bool', $types, \true)) { + return \false; + } + if (in_array('float', $types, \true)) { + return 0.0; + } + if (in_array('int', $types, \true)) { + return 0; + } + if (in_array('string', $types, \true)) { + return ''; + } + if (in_array('array', $types, \true)) { + return []; + } + if (in_array('static', $types, \true)) { + try { + return (new Instantiator())->instantiate(get_class($this->object)); + } catch (Throwable $t) { + throw new \PHPUnit\Framework\MockObject\RuntimeException($t->getMessage(), (int) $t->getCode(), $t); + } + } + if (in_array('object', $types, \true)) { + return new stdClass(); + } + if (in_array('callable', $types, \true) || in_array('closure', $types, \true)) { + return static function (): void { + }; + } + if (in_array('traversable', $types, \true) || in_array('generator', $types, \true) || in_array('iterable', $types, \true)) { + $generator = static function (): \Generator { + yield from []; + }; + return $generator(); + } + if (!$union) { + try { + return (new \PHPUnit\Framework\MockObject\Generator())->getMock($this->returnType, [], [], '', \false); + } catch (Throwable $t) { + if ($t instanceof \PHPUnit\Framework\MockObject\Exception) { + throw $t; + } + throw new \PHPUnit\Framework\MockObject\RuntimeException($t->getMessage(), (int) $t->getCode(), $t); + } + } + } + if ($intersection && $this->onlyInterfaces($types)) { + try { + return (new \PHPUnit\Framework\MockObject\Generator())->getMockForInterfaces($types); + } catch (Throwable $t) { + throw new \PHPUnit\Framework\MockObject\RuntimeException(sprintf('Return value for %s::%s() cannot be generated: %s', $this->className, $this->methodName, $t->getMessage()), (int) $t->getCode()); + } + } + $reason = ''; + if ($union) { + $reason = ' because the declared return type is a union'; + } elseif ($intersection) { + $reason = ' because the declared return type is an intersection'; + } + throw new \PHPUnit\Framework\MockObject\RuntimeException(sprintf('Return value for %s::%s() cannot be generated%s, please configure a return value for this method', $this->className, $this->methodName, $reason)); } - /** - * Returns a matcher that matches when the method is executed - * exactly $count times. - */ - public static function exactly(int $count) : InvokedCountMatcher + public function toString(): string { - return new InvokedCountMatcher($count); + $exporter = new Exporter(); + return sprintf('%s::%s(%s)%s', $this->className, $this->methodName, implode(', ', array_map([$exporter, 'shortenedExport'], $this->parameters)), $this->returnType ? sprintf(': %s', $this->returnType) : ''); } - /** - * Returns a matcher that matches when the method is executed - * at most N times. - */ - public static function atMost(int $allowedInvocations) : InvokedAtMostCountMatcher + public function getObject(): object { - return new InvokedAtMostCountMatcher($allowedInvocations); + return $this->object; } /** - * Returns a matcher that matches when the method is executed - * at the given index. - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4297 - * - * @codeCoverageIgnore + * @psalm-param non-empty-list $types */ - public static function at(int $index) : InvokedAtIndexMatcher + private function onlyInterfaces(array $types): bool { - $stack = debug_backtrace(); - while (!empty($stack)) { - $frame = array_pop($stack); - if (isset($frame['object']) && $frame['object'] instanceof self) { - $frame['object']->addWarning('The at() matcher has been deprecated. It will be removed in PHPUnit 10. Please refactor your test to not rely on the order in which methods are invoked.'); - break; + foreach ($types as $type) { + if (!interface_exists($type)) { + return \false; } } - return new InvokedAtIndexMatcher($index); - } - public static function returnValue($value) : ReturnStub - { - return new ReturnStub($value); - } - public static function returnValueMap(array $valueMap) : ReturnValueMapStub - { - return new ReturnValueMapStub($valueMap); - } - public static function returnArgument(int $argumentIndex) : ReturnArgumentStub - { - return new ReturnArgumentStub($argumentIndex); - } - public static function returnCallback($callback) : ReturnCallbackStub - { - return new ReturnCallbackStub($callback); + return \true; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function strtolower; +use Exception; +use PHPUnit\Framework\MockObject\Builder\InvocationMocker; +use PHPUnit\Framework\MockObject\Rule\InvocationOrder; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class InvocationHandler +{ /** - * Returns the current object. - * - * This method is useful when mocking a fluent interface. + * @var Matcher[] */ - public static function returnSelf() : ReturnSelfStub - { - return new ReturnSelfStub(); - } - public static function throwException(Throwable $exception) : ExceptionStub - { - return new ExceptionStub($exception); - } - public static function onConsecutiveCalls(...$args) : ConsecutiveCallsStub - { - return new ConsecutiveCallsStub($args); - } + private $matchers = []; /** - * @param int|string $dataName - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var Matcher[] */ - public function __construct(?string $name = null, array $data = [], $dataName = '') - { - if ($name !== null) { - $this->setName($name); - } - $this->data = $data; - $this->dataName = $dataName; - } + private $matcherMap = []; /** - * This method is called before the first test of this test class is run. + * @var ConfigurableMethod[] */ - public static function setUpBeforeClass() : void - { - } + private $configurableMethods; /** - * This method is called after the last test of this test class is run. + * @var bool */ - public static function tearDownAfterClass() : void - { - } + private $returnValueGeneration; /** - * This method is called before each test. + * @var Throwable */ - protected function setUp() : void + private $deferredError; + public function __construct(array $configurableMethods, bool $returnValueGeneration) { + $this->configurableMethods = $configurableMethods; + $this->returnValueGeneration = $returnValueGeneration; } - /** - * Performs assertions shared by all tests of a test case. - * - * This method is called between setUp() and test. - */ - protected function assertPreConditions() : void + public function hasMatchers(): bool { + foreach ($this->matchers as $matcher) { + if ($matcher->hasMatchers()) { + return \true; + } + } + return \false; } /** - * Performs assertions shared by all tests of a test case. + * Looks up the match builder with identification $id and returns it. * - * This method is called between test and tearDown(). - */ - protected function assertPostConditions() : void - { - } - /** - * This method is called after each test. + * @param string $id The identification of the match builder */ - protected function tearDown() : void + public function lookupMatcher(string $id): ?\PHPUnit\Framework\MockObject\Matcher { + if (isset($this->matcherMap[$id])) { + return $this->matcherMap[$id]; + } + return null; } /** - * Returns a string representation of the test case. + * Registers a matcher with the identification $id. The matcher can later be + * looked up using lookupMatcher() to figure out if it has been invoked. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception + * @param string $id The identification of the matcher + * @param Matcher $matcher The builder which is being registered + * + * @throws MatcherAlreadyRegisteredException */ - public function toString() : string + public function registerMatcher(string $id, \PHPUnit\Framework\MockObject\Matcher $matcher): void { - try { - $class = new ReflectionClass($this); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + if (isset($this->matcherMap[$id])) { + throw new \PHPUnit\Framework\MockObject\MatcherAlreadyRegisteredException($id); } - // @codeCoverageIgnoreEnd - $buffer = sprintf('%s::%s', $class->name, $this->getName(\false)); - return $buffer . $this->getDataSetAsString(); - } - public function count() : int - { - return 1; - } - public function getActualOutputForAssertion() : string - { - $this->outputRetrievedForAssertion = \true; - return $this->getActualOutput(); - } - public function expectOutputRegex(string $expectedRegex) : void - { - $this->outputExpectedRegex = $expectedRegex; + $this->matcherMap[$id] = $matcher; } - public function expectOutputString(string $expectedString) : void + public function expects(InvocationOrder $rule): InvocationMocker { - $this->outputExpectedString = $expectedString; + $matcher = new \PHPUnit\Framework\MockObject\Matcher($rule); + $this->addMatcher($matcher); + return new InvocationMocker($this, $matcher, ...$this->configurableMethods); } /** - * @psalm-param class-string<\Throwable> $exception + * @throws Exception + * @throws RuntimeException */ - public function expectException(string $exception) : void + public function invoke(\PHPUnit\Framework\MockObject\Invocation $invocation) { - // @codeCoverageIgnoreStart - switch ($exception) { - case Deprecated::class: - $this->addWarning('Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10.'); - break; - case Error::class: - $this->addWarning('Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10.'); - break; - case Notice::class: - $this->addWarning('Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE is deprecated and will no longer be possible in PHPUnit 10.'); - break; - case WarningError::class: - $this->addWarning('Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.'); - break; + $exception = null; + $hasReturnValue = \false; + $returnValue = null; + foreach ($this->matchers as $match) { + try { + if ($match->matches($invocation)) { + $value = $match->invoked($invocation); + if (!$hasReturnValue) { + $returnValue = $value; + $hasReturnValue = \true; + } + } + } catch (Exception $e) { + $exception = $e; + } } - // @codeCoverageIgnoreEnd - $this->expectedException = $exception; - } - /** - * @param int|string $code - */ - public function expectExceptionCode($code) : void - { - $this->expectedExceptionCode = $code; - } - public function expectExceptionMessage(string $message) : void - { - $this->expectedExceptionMessage = $message; - } - public function expectExceptionMessageMatches(string $regularExpression) : void - { - $this->expectedExceptionMessageRegExp = $regularExpression; - } - /** - * Sets up an expectation for an exception to be raised by the code under test. - * Information for expected exception class, expected exception message, and - * expected exception code are retrieved from a given Exception object. - */ - public function expectExceptionObject(\Exception $exception) : void - { - $this->expectException(get_class($exception)); - $this->expectExceptionMessage($exception->getMessage()); - $this->expectExceptionCode($exception->getCode()); + if ($exception !== null) { + throw $exception; + } + if ($hasReturnValue) { + return $returnValue; + } + if (!$this->returnValueGeneration) { + $exception = new \PHPUnit\Framework\MockObject\ReturnValueNotConfiguredException($invocation); + if (strtolower($invocation->getMethodName()) === '__tostring') { + $this->deferredError = $exception; + return ''; + } + throw $exception; + } + return $invocation->generateReturnValue(); } - public function expectNotToPerformAssertions() : void + public function matches(\PHPUnit\Framework\MockObject\Invocation $invocation): bool { - $this->doesNotPerformAssertions = \true; + foreach ($this->matchers as $matcher) { + if (!$matcher->matches($invocation)) { + return \false; + } + } + return \true; } /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + * @throws Throwable */ - public function expectDeprecation() : void + public function verify(): void { - $this->addWarning('Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectedException = Deprecated::class; + foreach ($this->matchers as $matcher) { + $matcher->verify(); + } + if ($this->deferredError) { + throw $this->deferredError; + } } - /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 - */ - public function expectDeprecationMessage(string $message) : void + private function addMatcher(\PHPUnit\Framework\MockObject\Matcher $matcher): void { - $this->addWarning('Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectExceptionMessage($message); + $this->matchers[] = $matcher; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function assert; +use function implode; +use function sprintf; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount; +use PHPUnit\Framework\MockObject\Rule\AnyParameters; +use PHPUnit\Framework\MockObject\Rule\InvocationOrder; +use PHPUnit\Framework\MockObject\Rule\InvokedAtMostCount; +use PHPUnit\Framework\MockObject\Rule\InvokedCount; +use PHPUnit\Framework\MockObject\Rule\MethodName; +use PHPUnit\Framework\MockObject\Rule\ParametersRule; +use PHPUnit\Framework\MockObject\Stub\Stub; +use PHPUnit\Framework\TestFailure; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Matcher +{ /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + * @var InvocationOrder */ - public function expectDeprecationMessageMatches(string $regularExpression) : void - { - $this->addWarning('Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectExceptionMessageMatches($regularExpression); - } + private $invocationRule; /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + * @var mixed */ - public function expectNotice() : void - { - $this->addWarning('Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectedException = Notice::class; - } + private $afterMatchBuilderId; /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + * @var bool */ - public function expectNoticeMessage(string $message) : void - { - $this->addWarning('Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectExceptionMessage($message); - } + private $afterMatchBuilderIsInvoked = \false; /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + * @var MethodName */ - public function expectNoticeMessageMatches(string $regularExpression) : void - { - $this->addWarning('Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectExceptionMessageMatches($regularExpression); - } + private $methodNameRule; /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + * @var ParametersRule */ - public function expectWarning() : void - { - $this->addWarning('Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectedException = WarningError::class; - } + private $parametersRule; /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + * @var Stub */ - public function expectWarningMessage(string $message) : void + private $stub; + public function __construct(InvocationOrder $rule) { - $this->addWarning('Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectExceptionMessage($message); + $this->invocationRule = $rule; } - /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 - */ - public function expectWarningMessageMatches(string $regularExpression) : void + public function hasMatchers(): bool { - $this->addWarning('Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectExceptionMessageMatches($regularExpression); + return !$this->invocationRule instanceof AnyInvokedCount; } - /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 - */ - public function expectError() : void + public function hasMethodNameRule(): bool { - $this->addWarning('Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectedException = Error::class; + return $this->methodNameRule !== null; } - /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 - */ - public function expectErrorMessage(string $message) : void + public function getMethodNameRule(): MethodName { - $this->addWarning('Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectExceptionMessage($message); + return $this->methodNameRule; } - /** - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 - */ - public function expectErrorMessageMatches(string $regularExpression) : void + public function setMethodNameRule(MethodName $rule): void { - $this->addWarning('Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10.'); - $this->expectExceptionMessageMatches($regularExpression); + $this->methodNameRule = $rule; } - public function getStatus() : int + public function hasParametersRule(): bool { - return $this->status; + return $this->parametersRule !== null; } - public function markAsRisky() : void + public function setParametersRule(ParametersRule $rule): void { - $this->status = BaseTestRunner::STATUS_RISKY; + $this->parametersRule = $rule; } - public function getStatusMessage() : string + public function setStub(Stub $stub): void { - return $this->statusMessage; + $this->stub = $stub; } - public function hasFailed() : bool + public function setAfterMatchBuilderId(string $id): void { - $status = $this->getStatus(); - return $status === BaseTestRunner::STATUS_FAILURE || $status === BaseTestRunner::STATUS_ERROR; + $this->afterMatchBuilderId = $id; } /** - * Runs the test case and collects the results in a TestResult object. - * If no TestResult object is passed a new one will be created. - * - * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException - * @throws \SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws CodeCoverageException - * @throws UtilException + * @throws ExpectationFailedException + * @throws MatchBuilderNotFoundException + * @throws MethodNameNotConfiguredException + * @throws RuntimeException */ - public function run(\PHPUnit\Framework\TestResult $result = null) : \PHPUnit\Framework\TestResult + public function invoked(\PHPUnit\Framework\MockObject\Invocation $invocation) { - if ($result === null) { - $result = $this->createResult(); - } - if (!$this instanceof \PHPUnit\Framework\ErrorTestCase && !$this instanceof \PHPUnit\Framework\WarningTestCase) { - $this->setTestResultObject($result); - } - if (!$this instanceof \PHPUnit\Framework\ErrorTestCase && !$this instanceof \PHPUnit\Framework\WarningTestCase && !$this instanceof \PHPUnit\Framework\SkippedTestCase && !$this->handleDependencies()) { - return $result; + if ($this->methodNameRule === null) { + throw new \PHPUnit\Framework\MockObject\MethodNameNotConfiguredException(); } - if ($this->runInSeparateProcess()) { - $runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess; - try { - $class = new ReflectionClass($this); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($runEntireClass) { - $template = new Template(__DIR__ . '/../Util/PHP/Template/TestCaseClass.tpl'); - } else { - $template = new Template(__DIR__ . '/../Util/PHP/Template/TestCaseMethod.tpl'); + if ($this->afterMatchBuilderId !== null) { + $matcher = $invocation->getObject()->__phpunit_getInvocationHandler()->lookupMatcher($this->afterMatchBuilderId); + if (!$matcher) { + throw new \PHPUnit\Framework\MockObject\MatchBuilderNotFoundException($this->afterMatchBuilderId); } - if ($this->preserveGlobalState) { - $constants = GlobalState::getConstantsAsString(); - $globals = GlobalState::getGlobalsAsString(); - $includedFiles = GlobalState::getIncludedFilesAsString(); - $iniSettings = GlobalState::getIniSettingsAsString(); - } else { - $constants = ''; - if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { - $globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . var_export($GLOBALS['__PHPUNIT_BOOTSTRAP'], \true) . ";\n"; - } else { - $globals = ''; - } - $includedFiles = ''; - $iniSettings = ''; + assert($matcher instanceof self); + if ($matcher->invocationRule->hasBeenInvoked()) { + $this->afterMatchBuilderIsInvoked = \true; } - $coverage = $result->getCollectCodeCoverageInformation() ? 'true' : 'false'; - $isStrictAboutTestsThatDoNotTestAnything = $result->isStrictAboutTestsThatDoNotTestAnything() ? 'true' : 'false'; - $isStrictAboutOutputDuringTests = $result->isStrictAboutOutputDuringTests() ? 'true' : 'false'; - $enforcesTimeLimit = $result->enforcesTimeLimit() ? 'true' : 'false'; - $isStrictAboutTodoAnnotatedTests = $result->isStrictAboutTodoAnnotatedTests() ? 'true' : 'false'; - $isStrictAboutResourceUsageDuringSmallTests = $result->isStrictAboutResourceUsageDuringSmallTests() ? 'true' : 'false'; - if (defined('PHPUNIT_COMPOSER_INSTALL')) { - $composerAutoload = var_export(PHPUNIT_COMPOSER_INSTALL, \true); - } else { - $composerAutoload = '\'\''; + } + $this->invocationRule->invoked($invocation); + try { + if ($this->parametersRule !== null) { + $this->parametersRule->apply($invocation); } - if (defined('__PHPUNIT_PHAR__')) { - $phar = var_export(__PHPUNIT_PHAR__, \true); - } else { - $phar = '\'\''; + } catch (ExpectationFailedException $e) { + throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s\n%s", $this->methodNameRule->toString(), $this->invocationRule->toString(), $e->getMessage()), $e->getComparisonFailure()); + } + if ($this->stub) { + return $this->stub->invoke($invocation); + } + return $invocation->generateReturnValue(); + } + /** + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws MatchBuilderNotFoundException + * @throws MethodNameNotConfiguredException + * @throws RuntimeException + */ + public function matches(\PHPUnit\Framework\MockObject\Invocation $invocation): bool + { + if ($this->afterMatchBuilderId !== null) { + $matcher = $invocation->getObject()->__phpunit_getInvocationHandler()->lookupMatcher($this->afterMatchBuilderId); + if (!$matcher) { + throw new \PHPUnit\Framework\MockObject\MatchBuilderNotFoundException($this->afterMatchBuilderId); } - $codeCoverage = $result->getCodeCoverage(); - $codeCoverageFilter = null; - $cachesStaticAnalysis = 'false'; - $codeCoverageCacheDirectory = null; - $driverMethod = 'forLineCoverage'; - if ($codeCoverage) { - $codeCoverageFilter = $codeCoverage->filter(); - if ($codeCoverage->collectsBranchAndPathCoverage()) { - $driverMethod = 'forLineAndPathCoverage'; - } - if ($codeCoverage->cachesStaticAnalysis()) { - $cachesStaticAnalysis = 'true'; - $codeCoverageCacheDirectory = $codeCoverage->cacheDirectory(); - } + assert($matcher instanceof self); + if (!$matcher->invocationRule->hasBeenInvoked()) { + return \false; } - $data = var_export(serialize($this->data), \true); - $dataName = var_export($this->dataName, \true); - $dependencyInput = var_export(serialize($this->dependencyInput), \true); - $includePath = var_export(get_include_path(), \true); - $codeCoverageFilter = var_export(serialize($codeCoverageFilter), \true); - $codeCoverageCacheDirectory = var_export(serialize($codeCoverageCacheDirectory), \true); - // must do these fixes because TestCaseMethod.tpl has unserialize('{data}') in it, and we can't break BC - // the lines above used to use addcslashes() rather than var_export(), which breaks null byte escape sequences - $data = "'." . $data . ".'"; - $dataName = "'.(" . $dataName . ").'"; - $dependencyInput = "'." . $dependencyInput . ".'"; - $includePath = "'." . $includePath . ".'"; - $codeCoverageFilter = "'." . $codeCoverageFilter . ".'"; - $codeCoverageCacheDirectory = "'." . $codeCoverageCacheDirectory . ".'"; - $configurationFilePath = $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] ?? ''; - $processResultFile = tempnam(sys_get_temp_dir(), 'phpunit_'); - $var = ['composerAutoload' => $composerAutoload, 'phar' => $phar, 'filename' => $class->getFileName(), 'className' => $class->getName(), 'collectCodeCoverageInformation' => $coverage, 'cachesStaticAnalysis' => $cachesStaticAnalysis, 'codeCoverageCacheDirectory' => $codeCoverageCacheDirectory, 'driverMethod' => $driverMethod, 'data' => $data, 'dataName' => $dataName, 'dependencyInput' => $dependencyInput, 'constants' => $constants, 'globals' => $globals, 'include_path' => $includePath, 'included_files' => $includedFiles, 'iniSettings' => $iniSettings, 'isStrictAboutTestsThatDoNotTestAnything' => $isStrictAboutTestsThatDoNotTestAnything, 'isStrictAboutOutputDuringTests' => $isStrictAboutOutputDuringTests, 'enforcesTimeLimit' => $enforcesTimeLimit, 'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests, 'isStrictAboutResourceUsageDuringSmallTests' => $isStrictAboutResourceUsageDuringSmallTests, 'codeCoverageFilter' => $codeCoverageFilter, 'configurationFilePath' => $configurationFilePath, 'name' => $this->getName(\false), 'processResultFile' => $processResultFile]; - if (!$runEntireClass) { - $var['methodName'] = $this->name; + } + if ($this->methodNameRule === null) { + throw new \PHPUnit\Framework\MockObject\MethodNameNotConfiguredException(); + } + if (!$this->invocationRule->matches($invocation)) { + return \false; + } + try { + if (!$this->methodNameRule->matches($invocation)) { + return \false; } - $template->setVar($var); - $php = AbstractPhpProcess::factory(); - $php->runTestJob($template->render(), $this, $result, $processResultFile); - } else { - $result->run($this); + } catch (ExpectationFailedException $e) { + throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s\n%s", $this->methodNameRule->toString(), $this->invocationRule->toString(), $e->getMessage()), $e->getComparisonFailure()); } - $this->result = null; - return $result; + return \true; } /** - * Returns a builder object to create mock objects using a fluent interface. - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $className - * - * @psalm-return MockBuilder + * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws MethodNameNotConfiguredException */ - public function getMockBuilder(string $className) : MockBuilder - { - $this->recordDoubledType($className); - return new MockBuilder($this, $className); - } - public function registerComparator(Comparator $comparator) : void + public function verify(): void { - ComparatorFactory::getInstance()->register($comparator); - $this->customComparators[] = $comparator; + if ($this->methodNameRule === null) { + throw new \PHPUnit\Framework\MockObject\MethodNameNotConfiguredException(); + } + try { + $this->invocationRule->verify(); + if ($this->parametersRule === null) { + $this->parametersRule = new AnyParameters(); + } + $invocationIsAny = $this->invocationRule instanceof AnyInvokedCount; + $invocationIsNever = $this->invocationRule instanceof InvokedCount && $this->invocationRule->isNever(); + $invocationIsAtMost = $this->invocationRule instanceof InvokedAtMostCount; + if (!$invocationIsAny && !$invocationIsNever && !$invocationIsAtMost) { + $this->parametersRule->verify(); + } + } catch (ExpectationFailedException $e) { + throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s.\n%s", $this->methodNameRule->toString(), $this->invocationRule->toString(), TestFailure::exceptionToString($e))); + } } - /** - * @return string[] - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit - */ - public function doubledTypes() : array + public function toString(): string { - return array_unique($this->doubledTypes); + $list = []; + if ($this->invocationRule !== null) { + $list[] = $this->invocationRule->toString(); + } + if ($this->methodNameRule !== null) { + $list[] = 'where ' . $this->methodNameRule->toString(); + } + if ($this->parametersRule !== null) { + $list[] = 'and ' . $this->parametersRule->toString(); + } + if ($this->afterMatchBuilderId !== null) { + $list[] = 'after ' . $this->afterMatchBuilderId; + } + if ($this->stub !== null) { + $list[] = 'will ' . $this->stub->toString(); + } + return implode(' ', $list); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function is_string; +use function sprintf; +use function strtolower; +use PHPUnit\Framework\Constraint\Constraint; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class MethodNameConstraint extends Constraint +{ /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var string */ - public function getGroups() : array + private $methodName; + public function __construct(string $methodName) { - return $this->groups; + $this->methodName = $methodName; } - /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit - */ - public function setGroups(array $groups) : void + public function toString(): string { - $this->groups = $groups; + return sprintf('is "%s"', $this->methodName); } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit - */ - public function getName(bool $withDataSet = \true) : string + protected function matches($other): bool { - if ($withDataSet) { - return $this->name . $this->getDataSetAsString(\false); + if (!is_string($other)) { + return \false; } - return $this->name; + return strtolower($this->methodName) === strtolower($other); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function array_diff; +use function array_merge; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\InvalidArgumentException; +use PHPUnit\Framework\TestCase; +use ReflectionClass; +/** + * @psalm-template MockedType + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +final class MockBuilder +{ /** - * Returns the size of the test. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var TestCase */ - public function getSize() : int - { - return TestUtil::getSize(static::class, $this->getName(\false)); - } + private $testCase; /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var string */ - public function hasSize() : bool - { - return $this->getSize() !== TestUtil::UNKNOWN; - } + private $type; /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var null|string[] */ - public function isSmall() : bool - { - return $this->getSize() === TestUtil::SMALL; - } + private $methods = []; /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var bool */ - public function isMedium() : bool - { - return $this->getSize() === TestUtil::MEDIUM; - } + private $emptyMethodsArray = \false; /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var string */ - public function isLarge() : bool - { - return $this->getSize() === TestUtil::LARGE; - } + private $mockClassName = ''; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var array */ - public function getActualOutput() : string - { - if (!$this->outputBufferingActive) { - return $this->output; - } - return (string) ob_get_contents(); - } + private $constructorArgs = []; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var bool */ - public function hasOutput() : bool - { - if ($this->output === '') { - return \false; - } - if ($this->hasExpectationOnOutput()) { - return \false; - } - return \true; - } + private $originalConstructor = \true; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var bool */ - public function doesNotPerformAssertions() : bool - { - return $this->doesNotPerformAssertions; - } + private $originalClone = \true; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var bool */ - public function hasExpectationOnOutput() : bool - { - return is_string($this->outputExpectedString) || is_string($this->outputExpectedRegex) || $this->outputRetrievedForAssertion; - } + private $autoload = \true; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var bool */ - public function getExpectedException() : ?string - { - return $this->expectedException; - } + private $cloneArguments = \false; /** - * @return null|int|string - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var bool */ - public function getExpectedExceptionCode() - { - return $this->expectedExceptionCode; - } + private $callOriginalMethods = \false; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var ?object */ - public function getExpectedExceptionMessage() : ?string - { - return $this->expectedExceptionMessage; - } + private $proxyTarget; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var bool */ - public function getExpectedExceptionMessageRegExp() : ?string - { - return $this->expectedExceptionMessageRegExp; - } + private $allowMockingUnknownTypes = \true; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var bool */ - public function setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag) : void - { - $this->registerMockObjectsFromTestArgumentsRecursively = $flag; - } + private $returnValueGeneration = \true; /** - * @throws Throwable - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @var Generator */ - public function runBare() : void - { - $this->numAssertions = 0; - $this->snapshotGlobalState(); - $this->startOutputBuffering(); - clearstatcache(); - $currentWorkingDirectory = getcwd(); - $hookMethods = TestUtil::getHookMethods(static::class); - $hasMetRequirements = \false; - try { - $this->checkRequirements(); - $hasMetRequirements = \true; - if ($this->inIsolation) { - foreach ($hookMethods['beforeClass'] as $method) { - $this->{$method}(); - } - } - $this->setDoesNotPerformAssertionsFromAnnotation(); - foreach ($hookMethods['before'] as $method) { - $this->{$method}(); - } - foreach ($hookMethods['preCondition'] as $method) { - $this->{$method}(); - } - $this->testResult = $this->runTest(); - $this->verifyMockObjects(); - foreach ($hookMethods['postCondition'] as $method) { - $this->{$method}(); - } - if (!empty($this->warnings)) { - throw new \PHPUnit\Framework\Warning(implode("\n", array_unique($this->warnings))); - } - $this->status = BaseTestRunner::STATUS_PASSED; - } catch (\PHPUnit\Framework\IncompleteTest $e) { - $this->status = BaseTestRunner::STATUS_INCOMPLETE; - $this->statusMessage = $e->getMessage(); - } catch (\PHPUnit\Framework\SkippedTest $e) { - $this->status = BaseTestRunner::STATUS_SKIPPED; - $this->statusMessage = $e->getMessage(); - } catch (\PHPUnit\Framework\Warning $e) { - $this->status = BaseTestRunner::STATUS_WARNING; - $this->statusMessage = $e->getMessage(); - } catch (\PHPUnit\Framework\AssertionFailedError $e) { - $this->status = BaseTestRunner::STATUS_FAILURE; - $this->statusMessage = $e->getMessage(); - } catch (PredictionException $e) { - $this->status = BaseTestRunner::STATUS_FAILURE; - $this->statusMessage = $e->getMessage(); - } catch (Throwable $_e) { - $e = $_e; - $this->status = BaseTestRunner::STATUS_ERROR; - $this->statusMessage = $_e->getMessage(); - } - $this->mockObjects = []; - $this->prophet = null; - // Tear down the fixture. An exception raised in tearDown() will be - // caught and passed on when no exception was raised before. - try { - if ($hasMetRequirements) { - foreach ($hookMethods['after'] as $method) { - $this->{$method}(); - } - if ($this->inIsolation) { - foreach ($hookMethods['afterClass'] as $method) { - $this->{$method}(); - } - } - } - } catch (Throwable $_e) { - $e = $e ?? $_e; - } - try { - $this->stopOutputBuffering(); - } catch (\PHPUnit\Framework\RiskyTestError $_e) { - $e = $e ?? $_e; - } - if (isset($_e)) { - $this->status = BaseTestRunner::STATUS_ERROR; - $this->statusMessage = $_e->getMessage(); - } - clearstatcache(); - if ($currentWorkingDirectory !== getcwd()) { - chdir($currentWorkingDirectory); - } - $this->restoreGlobalState(); - $this->unregisterCustomComparators(); - $this->cleanupIniSettings(); - $this->cleanupLocaleSettings(); - libxml_clear_errors(); - // Perform assertion on output. - if (!isset($e)) { - try { - if ($this->outputExpectedRegex !== null) { - $this->assertMatchesRegularExpression($this->outputExpectedRegex, $this->output); - } elseif ($this->outputExpectedString !== null) { - $this->assertEquals($this->outputExpectedString, $this->output); - } - } catch (Throwable $_e) { - $e = $_e; - } - } - // Workaround for missing "finally". - if (isset($e)) { - if ($e instanceof PredictionException) { - $e = new \PHPUnit\Framework\AssertionFailedError($e->getMessage()); - } - $this->onNotSuccessfulTest($e); - } - } + private $generator; /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @param string|string[] $type + * + * @psalm-param class-string|string|string[] $type */ - public function setName(string $name) : void + public function __construct(TestCase $testCase, $type) { - $this->name = $name; - if (is_callable($this->sortId(), \true)) { - $this->providedTests = [new \PHPUnit\Framework\ExecutionOrderDependency($this->sortId())]; - } + $this->testCase = $testCase; + $this->type = $type; + $this->generator = new \PHPUnit\Framework\MockObject\Generator(); } /** - * @param list $dependencies + * Creates a mock object using a fluent interface. * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @throws ClassAlreadyExistsException + * @throws ClassIsFinalException + * @throws ClassIsReadonlyException + * @throws DuplicateMethodException + * @throws InvalidArgumentException + * @throws InvalidMethodNameException + * @throws OriginalConstructorInvocationRequiredException + * @throws ReflectionException + * @throws RuntimeException + * @throws UnknownTypeException + * + * @psalm-return MockObject&MockedType */ - public function setDependencies(array $dependencies) : void + public function getMock(): \PHPUnit\Framework\MockObject\MockObject { - $this->dependencies = $dependencies; + $object = $this->generator->getMock($this->type, (!$this->emptyMethodsArray) ? $this->methods : null, $this->constructorArgs, $this->mockClassName, $this->originalConstructor, $this->originalClone, $this->autoload, $this->cloneArguments, $this->callOriginalMethods, $this->proxyTarget, $this->allowMockingUnknownTypes, $this->returnValueGeneration); + $this->testCase->registerMockObject($object); + return $object; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Creates a mock object for an abstract class using a fluent interface. + * + * @psalm-return MockObject&MockedType + * + * @throws Exception + * @throws ReflectionException + * @throws RuntimeException */ - public function setDependencyInput(array $dependencyInput) : void + public function getMockForAbstractClass(): \PHPUnit\Framework\MockObject\MockObject { - $this->dependencyInput = $dependencyInput; + $object = $this->generator->getMockForAbstractClass($this->type, $this->constructorArgs, $this->mockClassName, $this->originalConstructor, $this->originalClone, $this->autoload, $this->methods, $this->cloneArguments); + $this->testCase->registerMockObject($object); + return $object; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Creates a mock object for a trait using a fluent interface. + * + * @psalm-return MockObject&MockedType + * + * @throws Exception + * @throws ReflectionException + * @throws RuntimeException */ - public function setBeStrictAboutChangesToGlobalState(?bool $beStrictAboutChangesToGlobalState) : void + public function getMockForTrait(): \PHPUnit\Framework\MockObject\MockObject { - $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + $object = $this->generator->getMockForTrait($this->type, $this->constructorArgs, $this->mockClassName, $this->originalConstructor, $this->originalClone, $this->autoload, $this->methods, $this->cloneArguments); + $this->testCase->registerMockObject($object); + return $object; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Specifies the subset of methods to mock. Default is to mock none of them. + * + * @deprecated https://github.com/sebastianbergmann/phpunit/pull/3687 + * + * @return $this */ - public function setBackupGlobals(?bool $backupGlobals) : void + public function setMethods(?array $methods = null): self { - if ($this->backupGlobals === null && $backupGlobals !== null) { - $this->backupGlobals = $backupGlobals; + if ($methods === null) { + $this->methods = $methods; + } else { + $this->methods = array_merge($this->methods ?? [], $methods); } + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Specifies the subset of methods to mock, requiring each to exist in the class. + * + * @param string[] $methods + * + * @throws CannotUseOnlyMethodsException + * @throws ReflectionException + * + * @return $this */ - public function setBackupStaticAttributes(?bool $backupStaticAttributes) : void + public function onlyMethods(array $methods): self { - if ($this->backupStaticAttributes === null && $backupStaticAttributes !== null) { - $this->backupStaticAttributes = $backupStaticAttributes; + if (empty($methods)) { + $this->emptyMethodsArray = \true; + return $this; + } + try { + $reflector = new ReflectionClass($this->type); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + foreach ($methods as $method) { + if (!$reflector->hasMethod($method)) { + throw new \PHPUnit\Framework\MockObject\CannotUseOnlyMethodsException($this->type, $method); + } } + $this->methods = array_merge($this->methods ?? [], $methods); + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Specifies methods that don't exist in the class which you want to mock. + * + * @param string[] $methods + * + * @throws CannotUseAddMethodsException + * @throws ReflectionException + * @throws RuntimeException + * + * @return $this */ - public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess) : void + public function addMethods(array $methods): self { - if ($this->runTestInSeparateProcess === null) { - $this->runTestInSeparateProcess = $runTestInSeparateProcess; + if (empty($methods)) { + $this->emptyMethodsArray = \true; + return $this; + } + try { + $reflector = new ReflectionClass($this->type); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + foreach ($methods as $method) { + if ($reflector->hasMethod($method)) { + throw new \PHPUnit\Framework\MockObject\CannotUseAddMethodsException($this->type, $method); + } } + $this->methods = array_merge($this->methods ?? [], $methods); + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Specifies the subset of methods to not mock. Default is to mock all of them. + * + * @deprecated https://github.com/sebastianbergmann/phpunit/pull/3687 + * + * @throws ReflectionException */ - public function setRunClassInSeparateProcess(bool $runClassInSeparateProcess) : void + public function setMethodsExcept(array $methods = []): self { - if ($this->runClassInSeparateProcess === null) { - $this->runClassInSeparateProcess = $runClassInSeparateProcess; - } + return $this->setMethods(array_diff($this->generator->getClassMethods($this->type), $methods)); } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Specifies the arguments for the constructor. + * + * @return $this */ - public function setPreserveGlobalState(bool $preserveGlobalState) : void + public function setConstructorArgs(array $args): self { - $this->preserveGlobalState = $preserveGlobalState; + $this->constructorArgs = $args; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Specifies the name for the mock class. + * + * @return $this */ - public function setInIsolation(bool $inIsolation) : void + public function setMockClassName(string $name): self { - $this->inIsolation = $inIsolation; + $this->mockClassName = $name; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Disables the invocation of the original constructor. + * + * @return $this */ - public function isInIsolation() : bool + public function disableOriginalConstructor(): self { - return $this->inIsolation; + $this->originalConstructor = \false; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Enables the invocation of the original constructor. + * + * @return $this */ - public function getResult() + public function enableOriginalConstructor(): self { - return $this->testResult; + $this->originalConstructor = \true; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Disables the invocation of the original clone constructor. + * + * @return $this */ - public function setResult($result) : void + public function disableOriginalClone(): self { - $this->testResult = $result; + $this->originalClone = \false; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Enables the invocation of the original clone constructor. + * + * @return $this */ - public function setOutputCallback(callable $callback) : void + public function enableOriginalClone(): self { - $this->outputCallback = $callback; + $this->originalClone = \true; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Disables the use of class autoloading while creating the mock object. + * + * @return $this */ - public function getTestResultObject() : ?\PHPUnit\Framework\TestResult + public function disableAutoload(): self { - return $this->result; + $this->autoload = \false; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Enables the use of class autoloading while creating the mock object. + * + * @return $this */ - public function setTestResultObject(\PHPUnit\Framework\TestResult $result) : void + public function enableAutoload(): self { - $this->result = $result; + $this->autoload = \true; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Disables the cloning of arguments passed to mocked methods. + * + * @return $this */ - public function registerMockObject(MockObject $mockObject) : void + public function disableArgumentCloning(): self { - $this->mockObjects[] = $mockObject; + $this->cloneArguments = \false; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Enables the cloning of arguments passed to mocked methods. + * + * @return $this */ - public function addToAssertionCount(int $count) : void + public function enableArgumentCloning(): self { - $this->numAssertions += $count; + $this->cloneArguments = \true; + return $this; } /** - * Returns the number of assertions performed by this test. + * Enables the invocation of the original methods. * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @return $this */ - public function getNumAssertions() : int + public function enableProxyingToOriginalMethods(): self { - return $this->numAssertions; + $this->callOriginalMethods = \true; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * Disables the invocation of the original methods. + * + * @return $this */ - public function usesDataProvider() : bool + public function disableProxyingToOriginalMethods(): self { - return !empty($this->data); + $this->callOriginalMethods = \false; + $this->proxyTarget = null; + return $this; } /** - * @return int|string + * Sets the proxy target. * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @return $this */ - public function dataName() + public function setProxyTarget(object $object): self { - return $this->dataName; + $this->proxyTarget = $object; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @return $this */ - public function getDataSetAsString(bool $includeData = \true) : string + public function allowMockingUnknownTypes(): self { - $buffer = ''; - if (!empty($this->data)) { - if (is_int($this->dataName)) { - $buffer .= sprintf(' with data set #%d', $this->dataName); - } else { - $buffer .= sprintf(' with data set "%s"', $this->dataName); - } - if ($includeData) { - $exporter = new Exporter(); - $buffer .= sprintf(' (%s)', $exporter->shortenedRecursiveExport($this->data)); - } - } - return $buffer; + $this->allowMockingUnknownTypes = \true; + return $this; } /** - * Gets the data set of a TestCase. - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @return $this */ - public function getProvidedData() : array + public function disallowMockingUnknownTypes(): self { - return $this->data; + $this->allowMockingUnknownTypes = \false; + return $this; } /** - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @return $this */ - public function addWarning(string $warning) : void + public function enableAutoReturnValueGeneration(): self { - $this->warnings[] = $warning; + $this->returnValueGeneration = \true; + return $this; } - public function sortId() : string + /** + * @return $this + */ + public function disableAutoReturnValueGeneration(): self { - $id = $this->name; - if (strpos($id, '::') === \false) { - $id = static::class . '::' . $id; - } - if ($this->usesDataProvider()) { - $id .= $this->getDataSetAsString(\false); - } - return $id; + $this->returnValueGeneration = \false; + return $this; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function call_user_func; +use function class_exists; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class MockClass implements \PHPUnit\Framework\MockObject\MockType +{ /** - * Returns the normalized test name as class::method. - * - * @return list + * @var string */ - public function provides() : array - { - return $this->providedTests; - } + private $classCode; /** - * Returns a list of normalized dependency names, class::method. - * - * This list can differ from the raw dependencies as the resolver has - * no need for the [!][shallow]clone prefix that is filtered out - * during normalization. - * - * @return list + * @var class-string */ - public function requires() : array - { - return $this->dependencies; - } + private $mockName; /** - * Override to run the test and assert its state. - * - * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException - * @throws AssertionFailedError - * @throws Exception - * @throws ExpectationFailedException - * @throws Throwable + * @var ConfigurableMethod[] */ - protected function runTest() - { - if (trim($this->name) === '') { - throw new \PHPUnit\Framework\Exception('PHPUnit\\Framework\\TestCase::$name must be a non-blank string.'); - } - $testArguments = array_merge($this->data, $this->dependencyInput); - $this->registerMockObjectsFromTestArguments($testArguments); - try { - $testResult = $this->{$this->name}(...array_values($testArguments)); - } catch (Throwable $exception) { - if (!$this->checkExceptionExpectations($exception)) { - throw $exception; - } - if ($this->expectedException !== null) { - if ($this->expectedException === Error::class) { - $this->assertThat($exception, LogicalOr::fromConstraints(new ExceptionConstraint(Error::class), new ExceptionConstraint(\Error::class))); - } else { - $this->assertThat($exception, new ExceptionConstraint($this->expectedException)); - } - } - if ($this->expectedExceptionMessage !== null) { - $this->assertThat($exception, new ExceptionMessage($this->expectedExceptionMessage)); - } - if ($this->expectedExceptionMessageRegExp !== null) { - $this->assertThat($exception, new ExceptionMessageRegularExpression($this->expectedExceptionMessageRegExp)); - } - if ($this->expectedExceptionCode !== null) { - $this->assertThat($exception, new ExceptionCode($this->expectedExceptionCode)); - } - return; - } - if ($this->expectedException !== null) { - $this->assertThat(null, new ExceptionConstraint($this->expectedException)); - } elseif ($this->expectedExceptionMessage !== null) { - $this->numAssertions++; - throw new \PHPUnit\Framework\AssertionFailedError(sprintf('Failed asserting that exception with message "%s" is thrown', $this->expectedExceptionMessage)); - } elseif ($this->expectedExceptionMessageRegExp !== null) { - $this->numAssertions++; - throw new \PHPUnit\Framework\AssertionFailedError(sprintf('Failed asserting that exception with message matching "%s" is thrown', $this->expectedExceptionMessageRegExp)); - } elseif ($this->expectedExceptionCode !== null) { - $this->numAssertions++; - throw new \PHPUnit\Framework\AssertionFailedError(sprintf('Failed asserting that exception with code "%s" is thrown', $this->expectedExceptionCode)); - } - return $testResult; - } + private $configurableMethods; /** - * This method is a wrapper for the ini_set() function that automatically - * resets the modified php.ini setting to its original value after the - * test is run. - * - * @throws Exception + * @psalm-param class-string $mockName */ - protected function iniSet(string $varName, string $newValue) : void + public function __construct(string $classCode, string $mockName, array $configurableMethods) { - $currentValue = ini_set($varName, $newValue); - if ($currentValue !== \false) { - $this->iniSettings[$varName] = $currentValue; - } else { - throw new \PHPUnit\Framework\Exception(sprintf('INI setting "%s" could not be set to "%s".', $varName, $newValue)); - } + $this->classCode = $classCode; + $this->mockName = $mockName; + $this->configurableMethods = $configurableMethods; } /** - * This method is a wrapper for the setlocale() function that automatically - * resets the locale to its original value after the test is run. - * - * @throws Exception + * @psalm-return class-string */ - protected function setLocale(...$args) : void + public function generate(): string { - if (count($args) < 2) { - throw new \PHPUnit\Framework\Exception(); - } - [$category, $locale] = $args; - if (!in_array($category, self::LOCALE_CATEGORIES, \true)) { - throw new \PHPUnit\Framework\Exception(); - } - if (!is_array($locale) && !is_string($locale)) { - throw new \PHPUnit\Framework\Exception(); - } - $this->locale[$category] = setlocale($category, 0); - $result = setlocale(...$args); - if ($result === \false) { - throw new \PHPUnit\Framework\Exception('The locale functionality is not implemented on your platform, ' . 'the specified locale does not exist or the category name is ' . 'invalid.'); + if (!class_exists($this->mockName, \false)) { + eval($this->classCode); + call_user_func([$this->mockName, '__phpunit_initConfigurableMethods'], ...$this->configurableMethods); } + return $this->mockName; } - /** - * Makes configurable stub for the specified class. - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $originalClassName - * - * @psalm-return Stub&RealInstanceType - */ - protected function createStub(string $originalClassName) : Stub + public function getClassCode(): string { - return $this->createMockObject($originalClassName); + return $this->classCode; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use const DIRECTORY_SEPARATOR; +use function explode; +use function implode; +use function is_object; +use function is_string; +use function preg_match; +use function preg_replace; +use function sprintf; +use function strlen; +use function strpos; +use function substr; +use function substr_count; +use function trim; +use function var_export; +use ReflectionMethod; +use ReflectionParameter; +use PHPUnitPHAR\SebastianBergmann\Template\Exception as TemplateException; +use PHPUnitPHAR\SebastianBergmann\Template\Template; +use PHPUnitPHAR\SebastianBergmann\Type\ReflectionMapper; +use PHPUnitPHAR\SebastianBergmann\Type\Type; +use PHPUnitPHAR\SebastianBergmann\Type\UnknownType; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class MockMethod +{ /** - * Returns a mock object for the specified class. - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $originalClassName - * - * @psalm-return MockObject&RealInstanceType + * @var Template[] */ - protected function createMock(string $originalClassName) : MockObject - { - return $this->createMockObject($originalClassName); - } + private static $templates = []; /** - * Returns a configured mock object for the specified class. - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $originalClassName - * - * @psalm-return MockObject&RealInstanceType + * @var string */ - protected function createConfiguredMock(string $originalClassName, array $configuration) : MockObject - { - $o = $this->createMockObject($originalClassName); - foreach ($configuration as $method => $return) { - $o->method($method)->willReturn($return); - } - return $o; - } + private $className; /** - * Returns a partial mock object for the specified class. - * - * @param string[] $methods - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $originalClassName - * - * @psalm-return MockObject&RealInstanceType + * @var string */ - protected function createPartialMock(string $originalClassName, array $methods) : MockObject - { - try { - $reflector = new ReflectionClass($originalClassName); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $mockedMethodsThatDontExist = array_filter($methods, static function (string $method) use($reflector) { - return !$reflector->hasMethod($method); - }); - if ($mockedMethodsThatDontExist) { - $this->addWarning(sprintf('createPartialMock() called with method(s) %s that do not exist in %s. This will not be allowed in future versions of PHPUnit.', implode(', ', $mockedMethodsThatDontExist), $originalClassName)); - } - return $this->getMockBuilder($originalClassName)->disableOriginalConstructor()->disableOriginalClone()->disableArgumentCloning()->disallowMockingUnknownTypes()->setMethods(empty($methods) ? null : $methods)->getMock(); - } + private $methodName; /** - * Returns a test proxy for the specified class. - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $originalClassName - * - * @psalm-return MockObject&RealInstanceType + * @var bool */ - protected function createTestProxy(string $originalClassName, array $constructorArguments = []) : MockObject - { - return $this->getMockBuilder($originalClassName)->setConstructorArgs($constructorArguments)->enableProxyingToOriginalMethods()->getMock(); - } + private $cloneArguments; /** - * Mocks the specified class and returns the name of the mocked class. - * - * @param null|array $methods $methods - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string|string $originalClassName - * - * @psalm-return class-string - * - * @deprecated + * @var string string */ - protected function getMockClass(string $originalClassName, $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \false, bool $callOriginalClone = \true, bool $callAutoload = \true, bool $cloneArguments = \false) : string - { - $this->addWarning('PHPUnit\\Framework\\TestCase::getMockClass() is deprecated and will be removed in PHPUnit 10.'); - $this->recordDoubledType($originalClassName); - $mock = $this->getMockObjectGenerator()->getMock($originalClassName, $methods, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $cloneArguments); - return get_class($mock); - } + private $modifier; /** - * Returns a mock object for the specified abstract class with all abstract - * methods of the class mocked. Concrete methods are not mocked by default. - * To mock concrete methods, use the 7th parameter ($mockedMethods). - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $originalClassName - * - * @psalm-return MockObject&RealInstanceType + * @var string */ - protected function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, array $mockedMethods = [], bool $cloneArguments = \false) : MockObject - { - $this->recordDoubledType($originalClassName); - $mockObject = $this->getMockObjectGenerator()->getMockForAbstractClass($originalClassName, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments); - $this->registerMockObject($mockObject); - return $mockObject; - } + private $argumentsForDeclaration; /** - * Returns a mock object based on the given WSDL file. - * - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string|string $originalClassName - * - * @psalm-return MockObject&RealInstanceType + * @var string + */ + private $argumentsForCall; + /** + * @var Type + */ + private $returnType; + /** + * @var string + */ + private $reference; + /** + * @var bool + */ + private $callOriginalMethod; + /** + * @var bool + */ + private $static; + /** + * @var ?string + */ + private $deprecation; + /** + * @throws ReflectionException + * @throws RuntimeException */ - protected function getMockFromWsdl(string $wsdlFile, string $originalClassName = '', string $mockClassName = '', array $methods = [], bool $callOriginalConstructor = \true, array $options = []) : MockObject + public static function fromReflection(ReflectionMethod $method, bool $callOriginalMethod, bool $cloneArguments): self { - $this->recordDoubledType(SoapClient::class); - if ($originalClassName === '') { - $fileName = pathinfo(basename(parse_url($wsdlFile, PHP_URL_PATH)), PATHINFO_FILENAME); - $originalClassName = preg_replace('/\\W/', '', $fileName); + if ($method->isPrivate()) { + $modifier = 'private'; + } elseif ($method->isProtected()) { + $modifier = 'protected'; + } else { + $modifier = 'public'; } - if (!class_exists($originalClassName)) { - eval($this->getMockObjectGenerator()->generateClassFromWsdl($wsdlFile, $originalClassName, $methods, $options)); + if ($method->isStatic()) { + $modifier .= ' static'; } - $mockObject = $this->getMockObjectGenerator()->getMock($originalClassName, $methods, ['', $options], $mockClassName, $callOriginalConstructor, \false, \false); - $this->registerMockObject($mockObject); - return $mockObject; + if ($method->returnsReference()) { + $reference = '&'; + } else { + $reference = ''; + } + $docComment = $method->getDocComment(); + if (is_string($docComment) && preg_match('#\*[ \t]*+@deprecated[ \t]*+(.*?)\r?+\n[ \t]*+\*(?:[ \t]*+@|/$)#s', $docComment, $deprecation)) { + $deprecation = trim(preg_replace('#[ \t]*\r?\n[ \t]*+\*[ \t]*+#', ' ', $deprecation[1])); + } else { + $deprecation = null; + } + return new self($method->getDeclaringClass()->getName(), $method->getName(), $cloneArguments, $modifier, self::getMethodParametersForDeclaration($method), self::getMethodParametersForCall($method), (new ReflectionMapper())->fromReturnType($method), $reference, $callOriginalMethod, $method->isStatic(), $deprecation); } - /** - * Returns a mock object for the specified trait with all abstract methods - * of the trait mocked. Concrete methods to mock can be specified with the - * `$mockedMethods` parameter. - * - * @psalm-param trait-string $traitName - */ - protected function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, array $mockedMethods = [], bool $cloneArguments = \false) : MockObject + public static function fromName(string $fullClassName, string $methodName, bool $cloneArguments): self { - $this->recordDoubledType($traitName); - $mockObject = $this->getMockObjectGenerator()->getMockForTrait($traitName, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments); - $this->registerMockObject($mockObject); - return $mockObject; + return new self($fullClassName, $methodName, $cloneArguments, 'public', '', '', new UnknownType(), '', \false, \false, null); } - /** - * Returns an object for the specified trait. - * - * @psalm-param trait-string $traitName - */ - protected function getObjectForTrait(string $traitName, array $arguments = [], string $traitClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true) : object + public function __construct(string $className, string $methodName, bool $cloneArguments, string $modifier, string $argumentsForDeclaration, string $argumentsForCall, Type $returnType, string $reference, bool $callOriginalMethod, bool $static, ?string $deprecation) { - $this->recordDoubledType($traitName); - return $this->getMockObjectGenerator()->getObjectForTrait($traitName, $traitClassName, $callAutoload, $callOriginalConstructor, $arguments); + $this->className = $className; + $this->methodName = $methodName; + $this->cloneArguments = $cloneArguments; + $this->modifier = $modifier; + $this->argumentsForDeclaration = $argumentsForDeclaration; + $this->argumentsForCall = $argumentsForCall; + $this->returnType = $returnType; + $this->reference = $reference; + $this->callOriginalMethod = $callOriginalMethod; + $this->static = $static; + $this->deprecation = $deprecation; + } + public function getName(): string + { + return $this->methodName; } /** - * @throws \Prophecy\Exception\Doubler\ClassNotFoundException - * @throws \Prophecy\Exception\Doubler\DoubleException - * @throws \Prophecy\Exception\Doubler\InterfaceNotFoundException - * - * @psalm-param class-string|null $classOrInterface - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4141 + * @throws RuntimeException */ - protected function prophesize(?string $classOrInterface = null) : ObjectProphecy + public function generateCode(): string { - if (!class_exists(Prophet::class)) { - throw new \PHPUnit\Framework\Exception('This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".'); + if ($this->static) { + $templateFile = 'mocked_static_method.tpl'; + } elseif ($this->returnType->isNever() || $this->returnType->isVoid()) { + $templateFile = sprintf('%s_method_never_or_void.tpl', $this->callOriginalMethod ? 'proxied' : 'mocked'); + } else { + $templateFile = sprintf('%s_method.tpl', $this->callOriginalMethod ? 'proxied' : 'mocked'); } - $this->addWarning('PHPUnit\\Framework\\TestCase::prophesize() is deprecated and will be removed in PHPUnit 10. Please use the trait provided by phpspec/prophecy-phpunit.'); - if (is_string($classOrInterface)) { - $this->recordDoubledType($classOrInterface); + $deprecation = $this->deprecation; + if (null !== $this->deprecation) { + $deprecation = "The {$this->className}::{$this->methodName} method is deprecated ({$this->deprecation})."; + $deprecationTemplate = $this->getTemplate('deprecation.tpl'); + $deprecationTemplate->setVar(['deprecation' => var_export($deprecation, \true)]); + $deprecation = $deprecationTemplate->render(); } - return $this->getProphet()->prophesize($classOrInterface); + $template = $this->getTemplate($templateFile); + $template->setVar(['arguments_decl' => $this->argumentsForDeclaration, 'arguments_call' => $this->argumentsForCall, 'return_declaration' => (!empty($this->returnType->asString())) ? ': ' . $this->returnType->asString() : '', 'return_type' => $this->returnType->asString(), 'arguments_count' => (!empty($this->argumentsForCall)) ? substr_count($this->argumentsForCall, ',') + 1 : 0, 'class_name' => $this->className, 'method_name' => $this->methodName, 'modifier' => $this->modifier, 'reference' => $this->reference, 'clone_arguments' => $this->cloneArguments ? 'true' : 'false', 'deprecation' => $deprecation]); + return $template->render(); + } + public function getReturnType(): Type + { + return $this->returnType; } /** - * Creates a default TestResult object. - * - * @internal This method is not covered by the backward compatibility promise for PHPUnit + * @throws RuntimeException */ - protected function createResult() : \PHPUnit\Framework\TestResult + private function getTemplate(string $template): Template { - return new \PHPUnit\Framework\TestResult(); + $filename = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR . $template; + if (!isset(self::$templates[$filename])) { + try { + self::$templates[$filename] = new Template($filename); + } catch (TemplateException $e) { + throw new \PHPUnit\Framework\MockObject\RuntimeException($e->getMessage(), $e->getCode(), $e); + } + } + return self::$templates[$filename]; } /** - * This method is called when a test method did not execute successfully. + * Returns the parameters of a function or method. * - * @throws Throwable + * @throws RuntimeException */ - protected function onNotSuccessfulTest(Throwable $t) : void + private static function getMethodParametersForDeclaration(ReflectionMethod $method): string { - throw $t; - } - protected function recordDoubledType(string $originalClassName) : void - { - $this->doubledTypes[] = $originalClassName; + $parameters = []; + $types = (new ReflectionMapper())->fromParameterTypes($method); + foreach ($method->getParameters() as $i => $parameter) { + $name = '$' . $parameter->getName(); + /* Note: PHP extensions may use empty names for reference arguments + * or "..." for methods taking a variable number of arguments. + */ + if ($name === '$' || $name === '$...') { + $name = '$arg' . $i; + } + $default = ''; + $reference = ''; + $typeDeclaration = ''; + if (!$types[$i]->type()->isUnknown()) { + $typeDeclaration = $types[$i]->type()->asString() . ' '; + } + if ($parameter->isPassedByReference()) { + $reference = '&'; + } + if ($parameter->isVariadic()) { + $name = '...' . $name; + } elseif ($parameter->isDefaultValueAvailable()) { + $default = ' = ' . self::exportDefaultValue($parameter); + } elseif ($parameter->isOptional()) { + $default = ' = null'; + } + $parameters[] = $typeDeclaration . $reference . $name . $default; + } + return implode(', ', $parameters); } /** - * @throws Throwable + * Returns the parameters of a function or method. + * + * @throws ReflectionException */ - private function verifyMockObjects() : void + private static function getMethodParametersForCall(ReflectionMethod $method): string { - foreach ($this->mockObjects as $mockObject) { - if ($mockObject->__phpunit_hasMatchers()) { - $this->numAssertions++; + $parameters = []; + foreach ($method->getParameters() as $i => $parameter) { + $name = '$' . $parameter->getName(); + /* Note: PHP extensions may use empty names for reference arguments + * or "..." for methods taking a variable number of arguments. + */ + if ($name === '$' || $name === '$...') { + $name = '$arg' . $i; } - $mockObject->__phpunit_verify($this->shouldInvocationMockerBeReset($mockObject)); - } - if ($this->prophet !== null) { - try { - $this->prophet->checkPredictions(); - } finally { - foreach ($this->prophet->getProphecies() as $objectProphecy) { - foreach ($objectProphecy->getMethodProphecies() as $methodProphecies) { - foreach ($methodProphecies as $methodProphecy) { - /* @var MethodProphecy $methodProphecy */ - $this->numAssertions += count($methodProphecy->getCheckedPredictions()); - } - } - } + if ($parameter->isVariadic()) { + continue; + } + if ($parameter->isPassedByReference()) { + $parameters[] = '&' . $name; + } else { + $parameters[] = $name; } } + return implode(', ', $parameters); } /** - * @throws SkippedTestError - * @throws SyntheticSkippedError - * @throws Warning + * @throws ReflectionException */ - private function checkRequirements() : void + private static function exportDefaultValue(ReflectionParameter $parameter): string { - if (!$this->name || !method_exists($this, $this->name)) { - return; + try { + $defaultValue = $parameter->getDefaultValue(); + if (!is_object($defaultValue)) { + return (string) var_export($defaultValue, \true); + } + $parameterAsString = $parameter->__toString(); + return (string) explode(' = ', substr(substr($parameterAsString, strpos($parameterAsString, ' ') + strlen(' ')), 0, -2))[1]; + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\Framework\MockObject\ReflectionException($e->getMessage(), $e->getCode(), $e); } - $missingRequirements = TestUtil::getMissingRequirements(static::class, $this->name); - if (!empty($missingRequirements)) { - $this->markTestSkipped(implode(PHP_EOL, $missingRequirements)); - } - } - private function handleDependencies() : bool - { - if ([] === $this->dependencies || $this->inIsolation) { - return \true; - } - $passed = $this->result->passed(); - $passedKeys = array_keys($passed); - $numKeys = count($passedKeys); - for ($i = 0; $i < $numKeys; $i++) { - $pos = strpos($passedKeys[$i], ' with data set'); - if ($pos !== \false) { - $passedKeys[$i] = substr($passedKeys[$i], 0, $pos); - } - } - $passedKeys = array_flip(array_unique($passedKeys)); - foreach ($this->dependencies as $dependency) { - if (!$dependency->isValid()) { - $this->markSkippedForNotSpecifyingDependency(); - return \false; - } - if ($dependency->targetIsClass()) { - $dependencyClassName = $dependency->getTargetClassName(); - if (array_search($dependencyClassName, $this->result->passedClasses(), \true) === \false) { - $this->markSkippedForMissingDependency($dependency); - return \false; - } - continue; - } - $dependencyTarget = $dependency->getTarget(); - if (!isset($passedKeys[$dependencyTarget])) { - if (!$this->isCallableTestMethod($dependencyTarget)) { - $this->markWarningForUncallableDependency($dependency); - } else { - $this->markSkippedForMissingDependency($dependency); - } - return \false; - } - if (isset($passed[$dependencyTarget])) { - if ($passed[$dependencyTarget]['size'] != \PHPUnit\Util\Test::UNKNOWN && $this->getSize() != \PHPUnit\Util\Test::UNKNOWN && $passed[$dependencyTarget]['size'] > $this->getSize()) { - $this->result->addError($this, new \PHPUnit\Framework\SkippedTestError('This test depends on a test that is larger than itself.'), 0); - return \false; - } - if ($dependency->useDeepClone()) { - $deepCopy = new DeepCopy(); - $deepCopy->skipUncloneable(\false); - $this->dependencyInput[$dependencyTarget] = $deepCopy->copy($passed[$dependencyTarget]['result']); - } elseif ($dependency->useShallowClone()) { - $this->dependencyInput[$dependencyTarget] = clone $passed[$dependencyTarget]['result']; - } else { - $this->dependencyInput[$dependencyTarget] = $passed[$dependencyTarget]['result']; - } - } else { - $this->dependencyInput[$dependencyTarget] = null; - } - } - return \true; - } - private function markSkippedForNotSpecifyingDependency() : void - { - $this->status = BaseTestRunner::STATUS_SKIPPED; - $this->result->startTest($this); - $this->result->addError($this, new \PHPUnit\Framework\SkippedTestError('This method has an invalid @depends annotation.'), 0); - $this->result->endTest($this, 0); - } - private function markSkippedForMissingDependency(\PHPUnit\Framework\ExecutionOrderDependency $dependency) : void - { - $this->status = BaseTestRunner::STATUS_SKIPPED; - $this->result->startTest($this); - $this->result->addError($this, new \PHPUnit\Framework\SkippedTestError(sprintf('This test depends on "%s" to pass.', $dependency->getTarget())), 0); - $this->result->endTest($this, 0); - } - private function markWarningForUncallableDependency(\PHPUnit\Framework\ExecutionOrderDependency $dependency) : void - { - $this->status = BaseTestRunner::STATUS_WARNING; - $this->result->startTest($this); - $this->result->addWarning($this, new \PHPUnit\Framework\Warning(sprintf('This test depends on "%s" which does not exist.', $dependency->getTarget())), 0); - $this->result->endTest($this, 0); - } - /** - * Get the mock object generator, creating it if it doesn't exist. - */ - private function getMockObjectGenerator() : MockGenerator - { - if ($this->mockObjectGenerator === null) { - $this->mockObjectGenerator = new MockGenerator(); - } - return $this->mockObjectGenerator; - } - private function startOutputBuffering() : void - { - ob_start(); - $this->outputBufferingActive = \true; - $this->outputBufferingLevel = ob_get_level(); - } - /** - * @throws RiskyTestError - */ - private function stopOutputBuffering() : void - { - if (ob_get_level() !== $this->outputBufferingLevel) { - while (ob_get_level() >= $this->outputBufferingLevel) { - ob_end_clean(); - } - throw new \PHPUnit\Framework\RiskyTestError('Test code or tested code did not (only) close its own output buffers'); - } - $this->output = ob_get_contents(); - if ($this->outputCallback !== \false) { - $this->output = (string) call_user_func($this->outputCallback, $this->output); - } - ob_end_clean(); - $this->outputBufferingActive = \false; - $this->outputBufferingLevel = ob_get_level(); - } - private function snapshotGlobalState() : void - { - if ($this->runTestInSeparateProcess || $this->inIsolation || !$this->backupGlobals && !$this->backupStaticAttributes) { - return; - } - $this->snapshot = $this->createGlobalStateSnapshot($this->backupGlobals === \true); - } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws RiskyTestError - */ - private function restoreGlobalState() : void - { - if (!$this->snapshot instanceof Snapshot) { - return; - } - if ($this->beStrictAboutChangesToGlobalState) { - try { - $this->compareGlobalStateSnapshots($this->snapshot, $this->createGlobalStateSnapshot($this->backupGlobals === \true)); - } catch (\PHPUnit\Framework\RiskyTestError $rte) { - // Intentionally left empty - } - } - $restorer = new Restorer(); - if ($this->backupGlobals) { - $restorer->restoreGlobalVariables($this->snapshot); - } - if ($this->backupStaticAttributes) { - $restorer->restoreStaticAttributes($this->snapshot); - } - $this->snapshot = null; - if (isset($rte)) { - throw $rte; - } - } - private function createGlobalStateSnapshot(bool $backupGlobals) : Snapshot - { - $excludeList = new ExcludeList(); - foreach ($this->backupGlobalsExcludeList as $globalVariable) { - $excludeList->addGlobalVariable($globalVariable); - } - if (!empty($this->backupGlobalsBlacklist)) { - $this->addWarning('PHPUnit\\Framework\\TestCase::$backupGlobalsBlacklist is deprecated and will be removed in PHPUnit 10. Please use PHPUnit\\Framework\\TestCase::$backupGlobalsExcludeList instead.'); - foreach ($this->backupGlobalsBlacklist as $globalVariable) { - $excludeList->addGlobalVariable($globalVariable); - } - } - if (!defined('PHPUNIT_TESTSUITE')) { - $excludeList->addClassNamePrefix('PHPUnit'); - $excludeList->addClassNamePrefix('PHPUnit\\SebastianBergmann\\CodeCoverage'); - $excludeList->addClassNamePrefix('PHPUnit\\SebastianBergmann\\FileIterator'); - $excludeList->addClassNamePrefix('PHPUnit\\SebastianBergmann\\Invoker'); - $excludeList->addClassNamePrefix('PHPUnit\\SebastianBergmann\\Template'); - $excludeList->addClassNamePrefix('PHPUnit\\SebastianBergmann\\Timer'); - $excludeList->addClassNamePrefix('PHPUnit\\Doctrine\\Instantiator'); - $excludeList->addClassNamePrefix('Prophecy'); - $excludeList->addStaticAttribute(ComparatorFactory::class, 'instance'); - foreach ($this->backupStaticAttributesExcludeList as $class => $attributes) { - foreach ($attributes as $attribute) { - $excludeList->addStaticAttribute($class, $attribute); - } - } - if (!empty($this->backupStaticAttributesBlacklist)) { - $this->addWarning('PHPUnit\\Framework\\TestCase::$backupStaticAttributesBlacklist is deprecated and will be removed in PHPUnit 10. Please use PHPUnit\\Framework\\TestCase::$backupStaticAttributesExcludeList instead.'); - foreach ($this->backupStaticAttributesBlacklist as $class => $attributes) { - foreach ($attributes as $attribute) { - $excludeList->addStaticAttribute($class, $attribute); - } - } - } - } - return new Snapshot($excludeList, $backupGlobals, (bool) $this->backupStaticAttributes, \false, \false, \false, \false, \false, \false, \false); - } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws RiskyTestError - */ - private function compareGlobalStateSnapshots(Snapshot $before, Snapshot $after) : void - { - $backupGlobals = $this->backupGlobals === null || $this->backupGlobals; - if ($backupGlobals) { - $this->compareGlobalStateSnapshotPart($before->globalVariables(), $after->globalVariables(), "--- Global variables before the test\n+++ Global variables after the test\n"); - $this->compareGlobalStateSnapshotPart($before->superGlobalVariables(), $after->superGlobalVariables(), "--- Super-global variables before the test\n+++ Super-global variables after the test\n"); - } - if ($this->backupStaticAttributes) { - $this->compareGlobalStateSnapshotPart($before->staticAttributes(), $after->staticAttributes(), "--- Static attributes before the test\n+++ Static attributes after the test\n"); - } - } - /** - * @throws RiskyTestError - */ - private function compareGlobalStateSnapshotPart(array $before, array $after, string $header) : void - { - if ($before != $after) { - $differ = new Differ($header); - $exporter = new Exporter(); - $diff = $differ->diff($exporter->export($before), $exporter->export($after)); - throw new \PHPUnit\Framework\RiskyTestError($diff); - } - } - private function getProphet() : Prophet - { - if ($this->prophet === null) { - $this->prophet = new Prophet(); - } - return $this->prophet; - } - /** - * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException - */ - private function shouldInvocationMockerBeReset(MockObject $mock) : bool - { - $enumerator = new Enumerator(); - foreach ($enumerator->enumerate($this->dependencyInput) as $object) { - if ($mock === $object) { - return \false; - } - } - if (!is_array($this->testResult) && !is_object($this->testResult)) { - return \true; - } - return !in_array($mock, $enumerator->enumerate($this->testResult), \true); + // @codeCoverageIgnoreEnd } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function array_key_exists; +use function array_values; +use function strtolower; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class MockMethodSet +{ /** - * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException - * @throws \SebastianBergmann\ObjectReflector\InvalidArgumentException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @var MockMethod[] */ - private function registerMockObjectsFromTestArguments(array $testArguments, array &$visited = []) : void - { - if ($this->registerMockObjectsFromTestArgumentsRecursively) { - foreach ((new Enumerator())->enumerate($testArguments) as $object) { - if ($object instanceof MockObject) { - $this->registerMockObject($object); - } - } - } else { - foreach ($testArguments as $testArgument) { - if ($testArgument instanceof MockObject) { - $testArgument = Cloner::clone($testArgument); - $this->registerMockObject($testArgument); - } elseif (is_array($testArgument) && !in_array($testArgument, $visited, \true)) { - $visited[] = $testArgument; - $this->registerMockObjectsFromTestArguments($testArgument, $visited); - } - } - } - } - private function setDoesNotPerformAssertionsFromAnnotation() : void - { - $annotations = TestUtil::parseTestMethodAnnotations(static::class, $this->name); - if (isset($annotations['method']['doesNotPerformAssertions'])) { - $this->doesNotPerformAssertions = \true; - } - } - private function unregisterCustomComparators() : void - { - $factory = ComparatorFactory::getInstance(); - foreach ($this->customComparators as $comparator) { - $factory->unregister($comparator); - } - $this->customComparators = []; - } - private function cleanupIniSettings() : void - { - foreach ($this->iniSettings as $varName => $oldValue) { - ini_set($varName, $oldValue); - } - $this->iniSettings = []; - } - private function cleanupLocaleSettings() : void + private $methods = []; + public function addMethods(\PHPUnit\Framework\MockObject\MockMethod ...$methods): void { - foreach ($this->locale as $category => $locale) { - setlocale($category, $locale); + foreach ($methods as $method) { + $this->methods[strtolower($method->getName())] = $method; } - $this->locale = []; } /** - * @throws Exception + * @return MockMethod[] */ - private function checkExceptionExpectations(Throwable $throwable) : bool + public function asArray(): array { - $result = \false; - if ($this->expectedException !== null || $this->expectedExceptionCode !== null || $this->expectedExceptionMessage !== null || $this->expectedExceptionMessageRegExp !== null) { - $result = \true; - } - if ($throwable instanceof \PHPUnit\Framework\Exception) { - $result = \false; - } - if (is_string($this->expectedException)) { - try { - $reflector = new ReflectionClass($this->expectedException); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($this->expectedException === 'PHPUnit\\Framework\\Exception' || $this->expectedException === '\\PHPUnit\\Framework\\Exception' || $reflector->isSubclassOf(\PHPUnit\Framework\Exception::class)) { - $result = \true; - } - } - return $result; - } - private function runInSeparateProcess() : bool - { - return ($this->runTestInSeparateProcess || $this->runClassInSeparateProcess) && !$this->inIsolation && !$this instanceof PhptTestCase; - } - private function isCallableTestMethod(string $dependency) : bool - { - [$className, $methodName] = explode('::', $dependency); - if (!class_exists($className)) { - return \false; - } - try { - $class = new ReflectionClass($className); - } catch (ReflectionException $e) { - return \false; - } - if (!$class->isSubclassOf(__CLASS__)) { - return \false; - } - if (!$class->hasMethod($methodName)) { - return \false; - } - try { - $method = $class->getMethod($methodName); - } catch (ReflectionException $e) { - return \false; - } - return TestUtil::isTestMethod($method); + return array_values($this->methods); } - /** - * @psalm-template RealInstanceType of object - * - * @psalm-param class-string $originalClassName - * - * @psalm-return MockObject&RealInstanceType - */ - private function createMockObject(string $originalClassName) : MockObject + public function hasMethod(string $methodName): bool { - return $this->getMockBuilder($originalClassName)->disableOriginalConstructor()->disableOriginalClone()->disableArgumentCloning()->disallowMockingUnknownTypes()->getMock(); + return array_key_exists(strtolower($methodName), $this->methods); } } + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use function class_exists; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class TestFailure +final class MockTrait implements \PHPUnit\Framework\MockObject\MockType { - /** - * @var null|Test - */ - private $failedTest; - /** - * @var Throwable - */ - private $thrownException; /** * @var string */ - private $testName; - /** - * Returns a description for an exception. - */ - public static function exceptionToString(Throwable $e) : string - { - if ($e instanceof \PHPUnit\Framework\SelfDescribing) { - $buffer = $e->toString(); - if ($e instanceof \PHPUnit\Framework\ExpectationFailedException && $e->getComparisonFailure()) { - $buffer .= $e->getComparisonFailure()->getDiff(); - } - if ($e instanceof \PHPUnit\Framework\PHPTAssertionFailedError) { - $buffer .= $e->getDiff(); - } - if (!empty($buffer)) { - $buffer = trim($buffer) . "\n"; - } - return $buffer; - } - if ($e instanceof Error) { - return $e->getMessage() . "\n"; - } - if ($e instanceof \PHPUnit\Framework\ExceptionWrapper) { - return $e->getClassName() . ': ' . $e->getMessage() . "\n"; - } - return get_class($e) . ': ' . $e->getMessage() . "\n"; - } - /** - * Constructs a TestFailure with the given test and exception. - */ - public function __construct(\PHPUnit\Framework\Test $failedTest, Throwable $t) - { - if ($failedTest instanceof \PHPUnit\Framework\SelfDescribing) { - $this->testName = $failedTest->toString(); - } else { - $this->testName = get_class($failedTest); - } - if (!$failedTest instanceof \PHPUnit\Framework\TestCase || !$failedTest->isInIsolation()) { - $this->failedTest = $failedTest; - } - $this->thrownException = $t; - } - /** - * Returns a short description of the failure. - */ - public function toString() : string - { - return sprintf('%s: %s', $this->testName, $this->thrownException->getMessage()); - } - /** - * Returns a description for the thrown exception. - */ - public function getExceptionAsString() : string - { - return self::exceptionToString($this->thrownException); - } - /** - * Returns the name of the failing test (including data set, if any). - */ - public function getTestName() : string - { - return $this->testName; - } + private $classCode; /** - * Returns the failing test. - * - * Note: The test object is not set when the test is executed in process - * isolation. - * - * @see Exception + * @var class-string */ - public function failedTest() : ?\PHPUnit\Framework\Test - { - return $this->failedTest; - } + private $mockName; /** - * Gets the thrown exception. + * @psalm-param class-string $mockName */ - public function thrownException() : Throwable + public function __construct(string $classCode, string $mockName) { - return $this->thrownException; + $this->classCode = $classCode; + $this->mockName = $mockName; } /** - * Returns the exception's message. + * @psalm-return class-string */ - public function exceptionMessage() : string + public function generate(): string { - return $this->thrownException()->getMessage(); + if (!class_exists($this->mockName, \false)) { + eval($this->classCode); + } + return $this->mockName; } - /** - * Returns true if the thrown exception - * is of type AssertionFailedError. - */ - public function isFailure() : bool + public function getClassCode(): string { - return $this->thrownException() instanceof \PHPUnit\Framework\AssertionFailedError; + return $this->classCode; } } + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class AnyParameters implements \PHPUnit\Framework\MockObject\Rule\ParametersRule +{ + public function toString(): string + { + return 'with any parameters'; + } + public function apply(BaseInvocation $invocation): void + { } - public function endTest(\PHPUnit\Framework\Test $test, float $time) : void + public function verify(): void { } } @@ -64913,984 +70407,1017 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\Framework; +namespace PHPUnit\Framework\MockObject\Rule; -use const PHP_EOL; -use function class_exists; use function count; -use function extension_loaded; -use function function_exists; -use function get_class; +use function gettype; +use function is_iterable; use function sprintf; -use function xdebug_get_monitored_functions; -use function xdebug_is_debugger_active; -use function xdebug_start_function_monitor; -use function xdebug_stop_function_monitor; -use AssertionError; -use Countable; -use Error; -use PHPUnit\Util\ErrorHandler; -use PHPUnit\Util\ExcludeList; -use PHPUnit\Util\Printer; -use PHPUnit\Util\Test as TestUtil; -use ReflectionClass; -use ReflectionException; -use PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception as OriginalCodeCoverageException; -use PHPUnit\SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException; -use PHPUnit\SebastianBergmann\Invoker\Invoker; -use PHPUnit\SebastianBergmann\Invoker\TimeoutException; -use PHPUnit\SebastianBergmann\ResourceOperations\ResourceOperations; -use PHPUnit\SebastianBergmann\Timer\Timer; -use Throwable; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\InvalidParameterGroupException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @deprecated */ -final class TestResult implements Countable +final class ConsecutiveParameters implements \PHPUnit\Framework\MockObject\Rule\ParametersRule { /** * @var array */ - private $passed = []; - /** - * @var array - */ - private $passedTestClasses = []; - /** - * @var bool - */ - private $currentTestSuiteFailed = \false; - /** - * @var TestFailure[] - */ - private $errors = []; - /** - * @var TestFailure[] - */ - private $failures = []; - /** - * @var TestFailure[] - */ - private $warnings = []; - /** - * @var TestFailure[] - */ - private $notImplemented = []; - /** - * @var TestFailure[] - */ - private $risky = []; - /** - * @var TestFailure[] - */ - private $skipped = []; - /** - * @deprecated Use the `TestHook` interfaces instead - * - * @var TestListener[] - */ - private $listeners = []; - /** - * @var int - */ - private $runTests = 0; - /** - * @var float - */ - private $time = 0; - /** - * Code Coverage information. - * - * @var CodeCoverage - */ - private $codeCoverage; - /** - * @var bool - */ - private $convertDeprecationsToExceptions = \false; - /** - * @var bool - */ - private $convertErrorsToExceptions = \true; - /** - * @var bool - */ - private $convertNoticesToExceptions = \true; - /** - * @var bool - */ - private $convertWarningsToExceptions = \true; - /** - * @var bool - */ - private $stop = \false; - /** - * @var bool - */ - private $stopOnError = \false; - /** - * @var bool - */ - private $stopOnFailure = \false; - /** - * @var bool - */ - private $stopOnWarning = \false; - /** - * @var bool - */ - private $beStrictAboutTestsThatDoNotTestAnything = \true; - /** - * @var bool - */ - private $beStrictAboutOutputDuringTests = \false; - /** - * @var bool - */ - private $beStrictAboutTodoAnnotatedTests = \false; - /** - * @var bool - */ - private $beStrictAboutResourceUsageDuringSmallTests = \false; - /** - * @var bool - */ - private $enforceTimeLimit = \false; - /** - * @var bool - */ - private $forceCoversAnnotation = \false; - /** - * @var int - */ - private $timeoutForSmallTests = 1; - /** - * @var int - */ - private $timeoutForMediumTests = 10; - /** - * @var int - */ - private $timeoutForLargeTests = 60; - /** - * @var bool - */ - private $stopOnRisky = \false; - /** - * @var bool - */ - private $stopOnIncomplete = \false; - /** - * @var bool - */ - private $stopOnSkipped = \false; - /** - * @var bool - */ - private $lastTestFailed = \false; - /** - * @var int - */ - private $defaultTimeLimit = 0; - /** - * @var bool - */ - private $stopOnDefect = \false; + private $parameterGroups = []; /** - * @var bool + * @var array */ - private $registerMockObjectsFromTestArgumentsRecursively = \false; + private $invocations = []; /** - * @deprecated Use the `TestHook` interfaces instead - * - * @codeCoverageIgnore - * - * Registers a TestListener. + * @throws Exception */ - public function addListener(\PHPUnit\Framework\TestListener $listener) : void + public function __construct(array $parameterGroups) { - $this->listeners[] = $listener; + foreach ($parameterGroups as $index => $parameters) { + if (!is_iterable($parameters)) { + throw new InvalidParameterGroupException(sprintf('Parameter group #%d must be an array or Traversable, got %s', $index, gettype($parameters))); + } + foreach ($parameters as $parameter) { + if (!$parameter instanceof Constraint) { + $parameter = new IsEqual($parameter); + } + $this->parameterGroups[$index][] = $parameter; + } + } + } + public function toString(): string + { + return 'with consecutive parameters'; } /** - * @deprecated Use the `TestHook` interfaces instead - * - * @codeCoverageIgnore - * - * Unregisters a TestListener. + * @throws ExpectationFailedException + * @throws InvalidArgumentException */ - public function removeListener(\PHPUnit\Framework\TestListener $listener) : void + public function apply(BaseInvocation $invocation): void { - foreach ($this->listeners as $key => $_listener) { - if ($listener === $_listener) { - unset($this->listeners[$key]); - } - } + $this->invocations[] = $invocation; + $callIndex = count($this->invocations) - 1; + $this->verifyInvocation($invocation, $callIndex); } /** - * @deprecated Use the `TestHook` interfaces instead - * - * @codeCoverageIgnore - * - * Flushes all flushable TestListeners. + * @throws ExpectationFailedException + * @throws InvalidArgumentException */ - public function flushListeners() : void + public function verify(): void { - foreach ($this->listeners as $listener) { - if ($listener instanceof Printer) { - $listener->flush(); - } + foreach ($this->invocations as $callIndex => $invocation) { + $this->verifyInvocation($invocation, $callIndex); } } /** - * Adds an error to the list of errors. + * Verify a single invocation. + * + * @param int $callIndex + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException */ - public function addError(\PHPUnit\Framework\Test $test, Throwable $t, float $time) : void + private function verifyInvocation(BaseInvocation $invocation, $callIndex): void { - if ($t instanceof \PHPUnit\Framework\RiskyTestError) { - $this->recordRisky($test, $t); - $notifyMethod = 'addRiskyTest'; - if ($test instanceof \PHPUnit\Framework\TestCase) { - $test->markAsRisky(); - } - if ($this->stopOnRisky || $this->stopOnDefect) { - $this->stop(); - } - } elseif ($t instanceof \PHPUnit\Framework\IncompleteTest) { - $this->recordNotImplemented($test, $t); - $notifyMethod = 'addIncompleteTest'; - if ($this->stopOnIncomplete) { - $this->stop(); - } - } elseif ($t instanceof \PHPUnit\Framework\SkippedTest) { - $this->recordSkipped($test, $t); - $notifyMethod = 'addSkippedTest'; - if ($this->stopOnSkipped) { - $this->stop(); - } - } else { - $this->recordError($test, $t); - $notifyMethod = 'addError'; - if ($this->stopOnError || $this->stopOnFailure) { - $this->stop(); - } + if (!isset($this->parameterGroups[$callIndex])) { + // no parameter assertion for this call index + return; } - // @see https://github.com/sebastianbergmann/phpunit/issues/1953 - if ($t instanceof Error) { - $t = new \PHPUnit\Framework\ExceptionWrapper($t); + $parameters = $this->parameterGroups[$callIndex]; + if (count($invocation->getParameters()) < count($parameters)) { + throw new ExpectationFailedException(sprintf('Parameter count for invocation %s is too low.', $invocation->toString())); } - foreach ($this->listeners as $listener) { - $listener->{$notifyMethod}($test, $t, $time); + foreach ($parameters as $i => $parameter) { + $parameter->evaluate($invocation->getParameters()[$i], sprintf('Parameter %s for invocation #%d %s does not match expected ' . 'value.', $i, $callIndex, $invocation->toString())); } - $this->lastTestFailed = \true; - $this->time += $time; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use function count; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +use PHPUnit\Framework\MockObject\Verifiable; +use PHPUnit\Framework\SelfDescribing; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +abstract class InvocationOrder implements SelfDescribing, Verifiable +{ /** - * Adds a warning to the list of warnings. - * The passed in exception caused the warning. + * @var BaseInvocation[] */ - public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, float $time) : void + private $invocations = []; + public function getInvocationCount(): int { - if ($this->stopOnWarning || $this->stopOnDefect) { - $this->stop(); - } - $this->recordWarning($test, $e); - foreach ($this->listeners as $listener) { - $listener->addWarning($test, $e, $time); - } - $this->time += $time; + return count($this->invocations); } - /** - * Adds a failure to the list of failures. - * The passed in exception caused the failure. - */ - public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, float $time) : void + public function hasBeenInvoked(): bool { - if ($e instanceof \PHPUnit\Framework\RiskyTestError || $e instanceof \PHPUnit\Framework\OutputError) { - $this->recordRisky($test, $e); - $notifyMethod = 'addRiskyTest'; - if ($test instanceof \PHPUnit\Framework\TestCase) { - $test->markAsRisky(); - } - if ($this->stopOnRisky || $this->stopOnDefect) { - $this->stop(); - } - } elseif ($e instanceof \PHPUnit\Framework\IncompleteTest) { - $this->recordNotImplemented($test, $e); - $notifyMethod = 'addIncompleteTest'; - if ($this->stopOnIncomplete) { - $this->stop(); - } - } elseif ($e instanceof \PHPUnit\Framework\SkippedTest) { - $this->recordSkipped($test, $e); - $notifyMethod = 'addSkippedTest'; - if ($this->stopOnSkipped) { - $this->stop(); - } - } else { - $this->failures[] = new \PHPUnit\Framework\TestFailure($test, $e); - $notifyMethod = 'addFailure'; - if ($this->stopOnFailure || $this->stopOnDefect) { - $this->stop(); - } - } - foreach ($this->listeners as $listener) { - $listener->{$notifyMethod}($test, $e, $time); - } - $this->lastTestFailed = \true; - $this->time += $time; + return count($this->invocations) > 0; } - /** - * Informs the result that a test suite will be started. - */ - public function startTestSuite(\PHPUnit\Framework\TestSuite $suite) : void + final public function invoked(BaseInvocation $invocation) { - $this->currentTestSuiteFailed = \false; - foreach ($this->listeners as $listener) { - $listener->startTestSuite($suite); - } + $this->invocations[] = $invocation; + return $this->invokedDo($invocation); } + abstract public function matches(BaseInvocation $invocation): bool; + abstract protected function invokedDo(BaseInvocation $invocation); +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use function sprintf; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4297 + * + * @codeCoverageIgnore + */ +final class InvokedAtIndex extends \PHPUnit\Framework\MockObject\Rule\InvocationOrder +{ /** - * Informs the result that a test suite was completed. + * @var int */ - public function endTestSuite(\PHPUnit\Framework\TestSuite $suite) : void - { - if (!$this->currentTestSuiteFailed) { - $this->passedTestClasses[] = $suite->getName(); - } - foreach ($this->listeners as $listener) { - $listener->endTestSuite($suite); - } - } + private $sequenceIndex; /** - * Informs the result that a test will be started. + * @var int + */ + private $currentIndex = -1; + /** + * @param int $sequenceIndex */ - public function startTest(\PHPUnit\Framework\Test $test) : void + public function __construct($sequenceIndex) { - $this->lastTestFailed = \false; - $this->runTests += count($test); - foreach ($this->listeners as $listener) { - $listener->startTest($test); - } + $this->sequenceIndex = $sequenceIndex; + } + public function toString(): string + { + return 'invoked at sequence index ' . $this->sequenceIndex; + } + public function matches(BaseInvocation $invocation): bool + { + $this->currentIndex++; + return $this->currentIndex == $this->sequenceIndex; } /** - * Informs the result that a test was completed. + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - public function endTest(\PHPUnit\Framework\Test $test, float $time) : void + public function verify(): void { - foreach ($this->listeners as $listener) { - $listener->endTest($test, $time); - } - if (!$this->lastTestFailed && $test instanceof \PHPUnit\Framework\TestCase) { - $class = get_class($test); - $key = $class . '::' . $test->getName(); - $this->passed[$key] = ['result' => $test->getResult(), 'size' => TestUtil::getSize($class, $test->getName(\false))]; - $this->time += $time; - } - if ($this->lastTestFailed && $test instanceof \PHPUnit\Framework\TestCase) { - $this->currentTestSuiteFailed = \true; + if ($this->currentIndex < $this->sequenceIndex) { + throw new ExpectationFailedException(sprintf('The expected invocation at index %s was never reached.', $this->sequenceIndex)); } } - /** - * Returns true if no risky test occurred. - */ - public function allHarmless() : bool + protected function invokedDo(BaseInvocation $invocation): void { - return $this->riskyCount() === 0; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class InvokedAtLeastCount extends \PHPUnit\Framework\MockObject\Rule\InvocationOrder +{ /** - * Gets the number of risky tests. + * @var int */ - public function riskyCount() : int - { - return count($this->risky); - } + private $requiredInvocations; /** - * Returns true if no incomplete test occurred. + * @param int $requiredInvocations */ - public function allCompletelyImplemented() : bool + public function __construct($requiredInvocations) { - return $this->notImplementedCount() === 0; + $this->requiredInvocations = $requiredInvocations; } - /** - * Gets the number of incomplete tests. - */ - public function notImplementedCount() : int + public function toString(): string { - return count($this->notImplemented); + return 'invoked at least ' . $this->requiredInvocations . ' times'; } /** - * Returns an array of TestFailure objects for the risky tests. + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. * - * @return TestFailure[] + * @throws ExpectationFailedException */ - public function risky() : array + public function verify(): void { - return $this->risky; - } - /** - * Returns an array of TestFailure objects for the incomplete tests. - * - * @return TestFailure[] - */ - public function notImplemented() : array + $count = $this->getInvocationCount(); + if ($count < $this->requiredInvocations) { + throw new ExpectationFailedException('Expected invocation at least ' . $this->requiredInvocations . ' times but it occurred ' . $count . ' time(s).'); + } + } + public function matches(BaseInvocation $invocation): bool { - return $this->notImplemented; + return \true; } - /** - * Returns true if no test has been skipped. - */ - public function noneSkipped() : bool + protected function invokedDo(BaseInvocation $invocation): void { - return $this->skippedCount() === 0; } - /** - * Gets the number of skipped tests. - */ - public function skippedCount() : int +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class InvokedAtLeastOnce extends \PHPUnit\Framework\MockObject\Rule\InvocationOrder +{ + public function toString(): string { - return count($this->skipped); + return 'invoked at least once'; } /** - * Returns an array of TestFailure objects for the skipped tests. + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. * - * @return TestFailure[] + * @throws ExpectationFailedException */ - public function skipped() : array + public function verify(): void { - return $this->skipped; + $count = $this->getInvocationCount(); + if ($count < 1) { + throw new ExpectationFailedException('Expected invocation at least once but it never occurred.'); + } } - /** - * Gets the number of detected errors. - */ - public function errorCount() : int + public function matches(BaseInvocation $invocation): bool { - return count($this->errors); + return \true; } - /** - * Returns an array of TestFailure objects for the errors. - * - * @return TestFailure[] - */ - public function errors() : array + protected function invokedDo(BaseInvocation $invocation): void { - return $this->errors; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class InvokedAtMostCount extends \PHPUnit\Framework\MockObject\Rule\InvocationOrder +{ /** - * Gets the number of detected failures. + * @var int */ - public function failureCount() : int - { - return count($this->failures); - } + private $allowedInvocations; /** - * Returns an array of TestFailure objects for the failures. - * - * @return TestFailure[] + * @param int $allowedInvocations */ - public function failures() : array + public function __construct($allowedInvocations) { - return $this->failures; + $this->allowedInvocations = $allowedInvocations; } - /** - * Gets the number of detected warnings. - */ - public function warningCount() : int + public function toString(): string { - return count($this->warnings); + return 'invoked at most ' . $this->allowedInvocations . ' times'; } /** - * Returns an array of TestFailure objects for the warnings. + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. * - * @return TestFailure[] + * @throws ExpectationFailedException */ - public function warnings() : array + public function verify(): void { - return $this->warnings; + $count = $this->getInvocationCount(); + if ($count > $this->allowedInvocations) { + throw new ExpectationFailedException('Expected invocation at most ' . $this->allowedInvocations . ' times but it occurred ' . $count . ' time(s).'); + } } - /** - * Returns the names of the tests that have passed. - */ - public function passed() : array + public function matches(BaseInvocation $invocation): bool { - return $this->passed; + return \true; } - /** - * Returns the names of the TestSuites that have passed. - * - * This enables @depends-annotations for TestClassName::class - */ - public function passedClasses() : array + protected function invokedDo(BaseInvocation $invocation): void { - return $this->passedTestClasses; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use function sprintf; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class InvokedCount extends \PHPUnit\Framework\MockObject\Rule\InvocationOrder +{ /** - * Returns whether code coverage information should be collected. + * @var int */ - public function getCollectCodeCoverageInformation() : bool - { - return $this->codeCoverage !== null; - } + private $expectedCount; /** - * Runs a TestCase. - * - * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws CodeCoverageException - * @throws UnintentionallyCoveredCodeException + * @param int $expectedCount */ - public function run(\PHPUnit\Framework\Test $test) : void + public function __construct($expectedCount) { - \PHPUnit\Framework\Assert::resetCount(); - $size = TestUtil::UNKNOWN; - if ($test instanceof \PHPUnit\Framework\TestCase) { - $test->setRegisterMockObjectsFromTestArgumentsRecursively($this->registerMockObjectsFromTestArgumentsRecursively); - $isAnyCoverageRequired = TestUtil::requiresCodeCoverageDataCollection($test); - $size = $test->getSize(); - } - $error = \false; - $failure = \false; - $warning = \false; - $incomplete = \false; - $risky = \false; - $skipped = \false; - $this->startTest($test); - if ($this->convertDeprecationsToExceptions || $this->convertErrorsToExceptions || $this->convertNoticesToExceptions || $this->convertWarningsToExceptions) { - $errorHandler = new ErrorHandler($this->convertDeprecationsToExceptions, $this->convertErrorsToExceptions, $this->convertNoticesToExceptions, $this->convertWarningsToExceptions); - $errorHandler->register(); - } - $collectCodeCoverage = $this->codeCoverage !== null && !$test instanceof \PHPUnit\Framework\ErrorTestCase && !$test instanceof \PHPUnit\Framework\WarningTestCase && $isAnyCoverageRequired; - if ($collectCodeCoverage) { - $this->codeCoverage->start($test); - } - $monitorFunctions = $this->beStrictAboutResourceUsageDuringSmallTests && !$test instanceof \PHPUnit\Framework\ErrorTestCase && !$test instanceof \PHPUnit\Framework\WarningTestCase && $size === TestUtil::SMALL && function_exists('xdebug_start_function_monitor'); - if ($monitorFunctions) { - /* @noinspection ForgottenDebugOutputInspection */ - xdebug_start_function_monitor(ResourceOperations::getFunctions()); - } - $timer = new Timer(); - $timer->start(); - try { - $invoker = new Invoker(); - if (!$test instanceof \PHPUnit\Framework\ErrorTestCase && !$test instanceof \PHPUnit\Framework\WarningTestCase && $this->shouldTimeLimitBeEnforced($size) && $invoker->canInvokeWithTimeout()) { - switch ($size) { - case TestUtil::SMALL: - $_timeout = $this->timeoutForSmallTests; - break; - case TestUtil::MEDIUM: - $_timeout = $this->timeoutForMediumTests; - break; - case TestUtil::LARGE: - $_timeout = $this->timeoutForLargeTests; - break; - default: - $_timeout = $this->defaultTimeLimit; - } - $invoker->invoke([$test, 'runBare'], [], $_timeout); - } else { - $test->runBare(); - } - } catch (TimeoutException $e) { - $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError($e->getMessage()), $_timeout); - $risky = \true; - } catch (\PHPUnit\Framework\AssertionFailedError $e) { - $failure = \true; - if ($e instanceof \PHPUnit\Framework\RiskyTestError) { - $risky = \true; - } elseif ($e instanceof \PHPUnit\Framework\IncompleteTestError) { - $incomplete = \true; - } elseif ($e instanceof \PHPUnit\Framework\SkippedTestError) { - $skipped = \true; - } - } catch (AssertionError $e) { - $test->addToAssertionCount(1); - $failure = \true; - $frame = $e->getTrace()[0]; - $e = new \PHPUnit\Framework\AssertionFailedError(sprintf('%s in %s:%s', $e->getMessage(), $frame['file'] ?? $e->getFile(), $frame['line'] ?? $e->getLine()), 0, $e); - } catch (\PHPUnit\Framework\Warning $e) { - $warning = \true; - } catch (\PHPUnit\Framework\Exception $e) { - $error = \true; - } catch (Throwable $e) { - $e = new \PHPUnit\Framework\ExceptionWrapper($e); - $error = \true; - } - $time = $timer->stop()->asSeconds(); - $test->addToAssertionCount(\PHPUnit\Framework\Assert::getCount()); - if ($monitorFunctions) { - $excludeList = new ExcludeList(); - /** @noinspection ForgottenDebugOutputInspection */ - $functions = xdebug_get_monitored_functions(); - /* @noinspection ForgottenDebugOutputInspection */ - xdebug_stop_function_monitor(); - foreach ($functions as $function) { - if (!$excludeList->isExcluded($function['filename'])) { - $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError(sprintf('%s() used in %s:%s', $function['function'], $function['filename'], $function['lineno'])), $time); - } - } - } - if ($this->beStrictAboutTestsThatDoNotTestAnything && !$test->doesNotPerformAssertions() && $test->getNumAssertions() === 0) { - $risky = \true; - } - if ($this->forceCoversAnnotation && !$error && !$failure && !$warning && !$incomplete && !$skipped && !$risky) { - $annotations = TestUtil::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); - if (!isset($annotations['class']['covers']) && !isset($annotations['method']['covers']) && !isset($annotations['class']['coversNothing']) && !isset($annotations['method']['coversNothing'])) { - $this->addFailure($test, new \PHPUnit\Framework\MissingCoversAnnotationException('This test does not have a @covers annotation but is expected to have one'), $time); - $risky = \true; - } - } - if ($collectCodeCoverage) { - $append = !$risky && !$incomplete && !$skipped; - $linesToBeCovered = []; - $linesToBeUsed = []; - if ($append && $test instanceof \PHPUnit\Framework\TestCase) { - try { - $linesToBeCovered = TestUtil::getLinesToBeCovered(get_class($test), $test->getName(\false)); - $linesToBeUsed = TestUtil::getLinesToBeUsed(get_class($test), $test->getName(\false)); - } catch (\PHPUnit\Framework\InvalidCoversTargetException $cce) { - $this->addWarning($test, new \PHPUnit\Framework\Warning($cce->getMessage()), $time); - } - } - try { - $this->codeCoverage->stop($append, $linesToBeCovered, $linesToBeUsed); - } catch (UnintentionallyCoveredCodeException $cce) { - $unintentionallyCoveredCodeError = new \PHPUnit\Framework\UnintentionallyCoveredCodeError('This test executed code that is not listed as code to be covered or used:' . PHP_EOL . $cce->getMessage()); - } catch (OriginalCodeCoverageException $cce) { - $error = \true; - $e = $e ?? $cce; - } - } - if (isset($errorHandler)) { - $errorHandler->unregister(); - unset($errorHandler); - } - if ($error) { - $this->addError($test, $e, $time); - } elseif ($failure) { - $this->addFailure($test, $e, $time); - } elseif ($warning) { - $this->addWarning($test, $e, $time); - } elseif (isset($unintentionallyCoveredCodeError)) { - $this->addFailure($test, $unintentionallyCoveredCodeError, $time); - } elseif ($this->beStrictAboutTestsThatDoNotTestAnything && !$test->doesNotPerformAssertions() && $test->getNumAssertions() === 0) { - try { - $reflected = new ReflectionClass($test); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $name = $test->getName(\false); - if ($name && $reflected->hasMethod($name)) { - try { - $reflected = $reflected->getMethod($name); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - } - $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError(sprintf("This test did not perform any assertions\n\n%s:%d", $reflected->getFileName(), $reflected->getStartLine())), $time); - } elseif ($this->beStrictAboutTestsThatDoNotTestAnything && $test->doesNotPerformAssertions() && $test->getNumAssertions() > 0) { - $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError(sprintf('This test is annotated with "@doesNotPerformAssertions" but performed %d assertions', $test->getNumAssertions())), $time); - } elseif ($this->beStrictAboutOutputDuringTests && $test->hasOutput()) { - $this->addFailure($test, new \PHPUnit\Framework\OutputError(sprintf('This test printed output: %s', $test->getActualOutput())), $time); - } elseif ($this->beStrictAboutTodoAnnotatedTests && $test instanceof \PHPUnit\Framework\TestCase) { - $annotations = TestUtil::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); - if (isset($annotations['method']['todo'])) { - $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError('Test method is annotated with @todo'), $time); - } - } - $this->endTest($test, $time); + $this->expectedCount = $expectedCount; } - /** - * Gets the number of run tests. - */ - public function count() : int + public function isNever(): bool { - return $this->runTests; + return $this->expectedCount === 0; } - /** - * Checks whether the test run should stop. - */ - public function shouldStop() : bool + public function toString(): string { - return $this->stop; + return 'invoked ' . $this->expectedCount . ' time(s)'; } - /** - * Marks that the test run should stop. - */ - public function stop() : void + public function matches(BaseInvocation $invocation): bool { - $this->stop = \true; + return \true; } /** - * Returns the code coverage object. + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. + * + * @throws ExpectationFailedException */ - public function getCodeCoverage() : ?CodeCoverage + public function verify(): void { - return $this->codeCoverage; + $count = $this->getInvocationCount(); + if ($count !== $this->expectedCount) { + throw new ExpectationFailedException(sprintf('Method was expected to be called %d times, ' . 'actually called %d times.', $this->expectedCount, $count)); + } } /** - * Sets the code coverage object. + * @throws ExpectationFailedException */ - public function setCodeCoverage(CodeCoverage $codeCoverage) : void + protected function invokedDo(BaseInvocation $invocation): void { - $this->codeCoverage = $codeCoverage; + $count = $this->getInvocationCount(); + if ($count > $this->expectedCount) { + $message = $invocation->toString() . ' '; + switch ($this->expectedCount) { + case 0: + $message .= 'was not expected to be called.'; + break; + case 1: + $message .= 'was not expected to be called more than once.'; + break; + default: + $message .= sprintf('was not expected to be called more than %d times.', $this->expectedCount); + } + throw new ExpectationFailedException($message); + } } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use function is_string; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\InvalidArgumentException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +use PHPUnit\Framework\MockObject\MethodNameConstraint; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class MethodName +{ /** - * Enables or disables the deprecation-to-exception conversion. + * @var Constraint */ - public function convertDeprecationsToExceptions(bool $flag) : void - { - $this->convertDeprecationsToExceptions = $flag; - } + private $constraint; /** - * Returns the deprecation-to-exception conversion setting. + * @param Constraint|string $constraint + * + * @throws InvalidArgumentException */ - public function getConvertDeprecationsToExceptions() : bool + public function __construct($constraint) { - return $this->convertDeprecationsToExceptions; + if (is_string($constraint)) { + $constraint = new MethodNameConstraint($constraint); + } + if (!$constraint instanceof Constraint) { + throw InvalidArgumentException::create(1, 'PHPUnit\Framework\Constraint\Constraint object or string'); + } + $this->constraint = $constraint; } - /** - * Enables or disables the error-to-exception conversion. - */ - public function convertErrorsToExceptions(bool $flag) : void + public function toString(): string { - $this->convertErrorsToExceptions = $flag; + return 'method name ' . $this->constraint->toString(); } /** - * Returns the error-to-exception conversion setting. + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - public function getConvertErrorsToExceptions() : bool + public function matches(BaseInvocation $invocation): bool { - return $this->convertErrorsToExceptions; + return $this->matchesName($invocation->getMethodName()); } /** - * Enables or disables the notice-to-exception conversion. + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ExpectationFailedException */ - public function convertNoticesToExceptions(bool $flag) : void + public function matchesName(string $methodName): bool { - $this->convertNoticesToExceptions = $flag; + return (bool) $this->constraint->evaluate($methodName, '', \true); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use function count; +use function get_class; +use function sprintf; +use Exception; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\IsAnything; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Parameters implements \PHPUnit\Framework\MockObject\Rule\ParametersRule +{ /** - * Returns the notice-to-exception conversion setting. + * @var Constraint[] */ - public function getConvertNoticesToExceptions() : bool - { - return $this->convertNoticesToExceptions; - } + private $parameters = []; /** - * Enables or disables the warning-to-exception conversion. + * @var BaseInvocation */ - public function convertWarningsToExceptions(bool $flag) : void - { - $this->convertWarningsToExceptions = $flag; - } + private $invocation; /** - * Returns the warning-to-exception conversion setting. + * @var bool|ExpectationFailedException */ - public function getConvertWarningsToExceptions() : bool - { - return $this->convertWarningsToExceptions; - } + private $parameterVerificationResult; /** - * Enables or disables the stopping when an error occurs. + * @throws \PHPUnit\Framework\Exception */ - public function stopOnError(bool $flag) : void + public function __construct(array $parameters) { - $this->stopOnError = $flag; + foreach ($parameters as $parameter) { + if (!$parameter instanceof Constraint) { + $parameter = new IsEqual($parameter); + } + $this->parameters[] = $parameter; + } + } + public function toString(): string + { + $text = 'with parameter'; + foreach ($this->parameters as $index => $parameter) { + if ($index > 0) { + $text .= ' and'; + } + $text .= ' ' . $index . ' ' . $parameter->toString(); + } + return $text; } /** - * Enables or disables the stopping when a failure occurs. + * @throws Exception */ - public function stopOnFailure(bool $flag) : void + public function apply(BaseInvocation $invocation): void { - $this->stopOnFailure = $flag; + $this->invocation = $invocation; + $this->parameterVerificationResult = null; + try { + $this->parameterVerificationResult = $this->doVerify(); + } catch (ExpectationFailedException $e) { + $this->parameterVerificationResult = $e; + throw $this->parameterVerificationResult; + } } /** - * Enables or disables the stopping when a warning occurs. + * Checks if the invocation $invocation matches the current rules. If it + * does the rule will get the invoked() method called which should check + * if an expectation is met. + * + * @throws ExpectationFailedException + * @throws InvalidArgumentException */ - public function stopOnWarning(bool $flag) : void + public function verify(): void { - $this->stopOnWarning = $flag; + $this->doVerify(); } - public function beStrictAboutTestsThatDoNotTestAnything(bool $flag) : void + /** + * @throws ExpectationFailedException + * @throws InvalidArgumentException + */ + private function doVerify(): bool { - $this->beStrictAboutTestsThatDoNotTestAnything = $flag; - } - public function isStrictAboutTestsThatDoNotTestAnything() : bool - { - return $this->beStrictAboutTestsThatDoNotTestAnything; - } - public function beStrictAboutOutputDuringTests(bool $flag) : void - { - $this->beStrictAboutOutputDuringTests = $flag; - } - public function isStrictAboutOutputDuringTests() : bool - { - return $this->beStrictAboutOutputDuringTests; - } - public function beStrictAboutResourceUsageDuringSmallTests(bool $flag) : void - { - $this->beStrictAboutResourceUsageDuringSmallTests = $flag; - } - public function isStrictAboutResourceUsageDuringSmallTests() : bool - { - return $this->beStrictAboutResourceUsageDuringSmallTests; - } - public function enforceTimeLimit(bool $flag) : void - { - $this->enforceTimeLimit = $flag; - } - public function enforcesTimeLimit() : bool - { - return $this->enforceTimeLimit; + if (isset($this->parameterVerificationResult)) { + return $this->guardAgainstDuplicateEvaluationOfParameterConstraints(); + } + if ($this->invocation === null) { + throw new ExpectationFailedException('Mocked method does not exist.'); + } + if (count($this->invocation->getParameters()) < count($this->parameters)) { + $message = 'Parameter count for invocation %s is too low.'; + // The user called `->with($this->anything())`, but may have meant + // `->withAnyParameters()`. + // + // @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/199 + if (count($this->parameters) === 1 && get_class($this->parameters[0]) === IsAnything::class) { + $message .= "\nTo allow 0 or more parameters with any value, omit ->with() or use ->withAnyParameters() instead."; + } + throw new ExpectationFailedException(sprintf($message, $this->invocation->toString())); + } + foreach ($this->parameters as $i => $parameter) { + $parameter->evaluate($this->invocation->getParameters()[$i], sprintf('Parameter %s for invocation %s does not match expected ' . 'value.', $i, $this->invocation->toString())); + } + return \true; } - public function beStrictAboutTodoAnnotatedTests(bool $flag) : void + /** + * @throws ExpectationFailedException + */ + private function guardAgainstDuplicateEvaluationOfParameterConstraints(): bool { - $this->beStrictAboutTodoAnnotatedTests = $flag; + if ($this->parameterVerificationResult instanceof ExpectationFailedException) { + throw $this->parameterVerificationResult; + } + return (bool) $this->parameterVerificationResult; } - public function isStrictAboutTodoAnnotatedTests() : bool +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Rule; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +use PHPUnit\Framework\MockObject\Verifiable; +use PHPUnit\Framework\SelfDescribing; +/** + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +interface ParametersRule extends SelfDescribing, Verifiable +{ + /** + * @throws ExpectationFailedException if the invocation violates the rule + */ + public function apply(BaseInvocation $invocation): void; + public function verify(): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use PHPUnit\Framework\MockObject\Builder\InvocationStubber; +/** + * @method InvocationStubber method($constraint) + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +interface Stub +{ + public function __phpunit_getInvocationHandler(): \PHPUnit\Framework\MockObject\InvocationHandler; + public function __phpunit_hasMatchers(): bool; + public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use function array_shift; +use function sprintf; +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnitPHAR\SebastianBergmann\Exporter\Exporter; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ConsecutiveCalls implements \PHPUnit\Framework\MockObject\Stub\Stub +{ + /** + * @var array + */ + private $stack; + /** + * @var mixed + */ + private $value; + public function __construct(array $stack) { - return $this->beStrictAboutTodoAnnotatedTests; + $this->stack = $stack; } - public function forceCoversAnnotation() : void + public function invoke(Invocation $invocation) { - $this->forceCoversAnnotation = \true; + $this->value = array_shift($this->stack); + if ($this->value instanceof \PHPUnit\Framework\MockObject\Stub\Stub) { + $this->value = $this->value->invoke($invocation); + } + return $this->value; } - public function forcesCoversAnnotation() : bool + public function toString(): string { - return $this->forceCoversAnnotation; + $exporter = new Exporter(); + return sprintf('return user-specified value %s', $exporter->export($this->value)); } - /** - * Enables or disables the stopping for risky tests. - */ - public function stopOnRisky(bool $flag) : void +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use function sprintf; +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnitPHAR\SebastianBergmann\Exporter\Exporter; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Exception implements \PHPUnit\Framework\MockObject\Stub\Stub +{ + private $exception; + public function __construct(Throwable $exception) { - $this->stopOnRisky = $flag; + $this->exception = $exception; } /** - * Enables or disables the stopping for incomplete tests. + * @throws Throwable */ - public function stopOnIncomplete(bool $flag) : void + public function invoke(Invocation $invocation): void { - $this->stopOnIncomplete = $flag; + throw $this->exception; } - /** - * Enables or disables the stopping for skipped tests. - */ - public function stopOnSkipped(bool $flag) : void + public function toString(): string { - $this->stopOnSkipped = $flag; + $exporter = new Exporter(); + return sprintf('raise user-specified exception %s', $exporter->export($this->exception)); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use function sprintf; +use PHPUnit\Framework\MockObject\Invocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ReturnArgument implements \PHPUnit\Framework\MockObject\Stub\Stub +{ /** - * Enables or disables the stopping for defects: error, failure, warning. + * @var int */ - public function stopOnDefect(bool $flag) : void + private $argumentIndex; + public function __construct($argumentIndex) { - $this->stopOnDefect = $flag; + $this->argumentIndex = $argumentIndex; } - /** - * Returns the time spent running the tests. - */ - public function time() : float + public function invoke(Invocation $invocation) { - return $this->time; + if (isset($invocation->getParameters()[$this->argumentIndex])) { + return $invocation->getParameters()[$this->argumentIndex]; + } } - /** - * Returns whether the entire test was successful or not. - */ - public function wasSuccessful() : bool + public function toString(): string { - return $this->wasSuccessfulIgnoringWarnings() && empty($this->warnings); + return sprintf('return argument #%d', $this->argumentIndex); } - public function wasSuccessfulIgnoringWarnings() : bool +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use function call_user_func_array; +use function get_class; +use function is_array; +use function is_object; +use function sprintf; +use PHPUnit\Framework\MockObject\Invocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ReturnCallback implements \PHPUnit\Framework\MockObject\Stub\Stub +{ + private $callback; + public function __construct($callback) { - return empty($this->errors) && empty($this->failures); + $this->callback = $callback; } - public function wasSuccessfulAndNoTestIsRiskyOrSkippedOrIncomplete() : bool + public function invoke(Invocation $invocation) { - return $this->wasSuccessful() && $this->allHarmless() && $this->allCompletelyImplemented() && $this->noneSkipped(); + return call_user_func_array($this->callback, $invocation->getParameters()); } - /** - * Sets the default timeout for tests. - */ - public function setDefaultTimeLimit(int $timeout) : void + public function toString(): string { - $this->defaultTimeLimit = $timeout; + if (is_array($this->callback)) { + if (is_object($this->callback[0])) { + $class = get_class($this->callback[0]); + $type = '->'; + } else { + $class = $this->callback[0]; + $type = '::'; + } + return sprintf('return result of user defined callback %s%s%s() with the ' . 'passed arguments', $class, $type, $this->callback[1]); + } + return 'return result of user defined callback ' . $this->callback . ' with the passed arguments'; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use function sprintf; +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnitPHAR\SebastianBergmann\Exporter\Exporter; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ReturnReference implements \PHPUnit\Framework\MockObject\Stub\Stub +{ /** - * Sets the timeout for small tests. + * @var mixed */ - public function setTimeoutForSmallTests(int $timeout) : void + private $reference; + public function __construct(&$reference) { - $this->timeoutForSmallTests = $timeout; + $this->reference =& $reference; } - /** - * Sets the timeout for medium tests. - */ - public function setTimeoutForMediumTests(int $timeout) : void + public function invoke(Invocation $invocation) { - $this->timeoutForMediumTests = $timeout; + return $this->reference; } - /** - * Sets the timeout for large tests. - */ - public function setTimeoutForLargeTests(int $timeout) : void + public function toString(): string { - $this->timeoutForLargeTests = $timeout; + $exporter = new Exporter(); + return sprintf('return user-specified reference %s', $exporter->export($this->reference)); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\RuntimeException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ReturnSelf implements \PHPUnit\Framework\MockObject\Stub\Stub +{ /** - * Returns the set timeout for large tests. + * @throws RuntimeException */ - public function getTimeoutForLargeTests() : int + public function invoke(Invocation $invocation) { - return $this->timeoutForLargeTests; + return $invocation->getObject(); } - public function setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag) : void + public function toString(): string { - $this->registerMockObjectsFromTestArgumentsRecursively = $flag; + return 'return the current object'; } - private function recordError(\PHPUnit\Framework\Test $test, Throwable $t) : void +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use function sprintf; +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnitPHAR\SebastianBergmann\Exporter\Exporter; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ReturnStub implements \PHPUnit\Framework\MockObject\Stub\Stub +{ + /** + * @var mixed + */ + private $value; + public function __construct($value) { - $this->errors[] = new \PHPUnit\Framework\TestFailure($test, $t); + $this->value = $value; } - private function recordNotImplemented(\PHPUnit\Framework\Test $test, Throwable $t) : void + public function invoke(Invocation $invocation) { - $this->notImplemented[] = new \PHPUnit\Framework\TestFailure($test, $t); + return $this->value; } - private function recordRisky(\PHPUnit\Framework\Test $test, Throwable $t) : void + public function toString(): string { - $this->risky[] = new \PHPUnit\Framework\TestFailure($test, $t); + $exporter = new Exporter(); + return sprintf('return user-specified value %s', $exporter->export($this->value)); } - private function recordSkipped(\PHPUnit\Framework\Test $test, Throwable $t) : void +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use function array_pop; +use function count; +use function is_array; +use PHPUnit\Framework\MockObject\Invocation; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ReturnValueMap implements \PHPUnit\Framework\MockObject\Stub\Stub +{ + /** + * @var array + */ + private $valueMap; + public function __construct(array $valueMap) { - $this->skipped[] = new \PHPUnit\Framework\TestFailure($test, $t); + $this->valueMap = $valueMap; } - private function recordWarning(\PHPUnit\Framework\Test $test, Throwable $t) : void + public function invoke(Invocation $invocation) { - $this->warnings[] = new \PHPUnit\Framework\TestFailure($test, $t); + $parameterCount = count($invocation->getParameters()); + foreach ($this->valueMap as $map) { + if (!is_array($map) || $parameterCount !== count($map) - 1) { + continue; + } + $return = array_pop($map); + if ($invocation->getParameters() === $map) { + return $return; + } + } } - private function shouldTimeLimitBeEnforced(int $size) : bool + public function toString(): string { - if (!$this->enforceTimeLimit) { - return \false; - } - if (!($this->defaultTimeLimit || $size !== TestUtil::UNKNOWN)) { - return \false; - } - if (!extension_loaded('pcntl')) { - return \false; - } - if (!class_exists(Invoker::class)) { - return \false; - } - if (extension_loaded('xdebug') && xdebug_is_debugger_active()) { - return \false; - } - return \true; + return 'return value from a map'; } } - * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -class TestSuite implements IteratorAggregate, \PHPUnit\Framework\Reorderable, \PHPUnit\Framework\SelfDescribing, \PHPUnit\Framework\Test +interface Stub extends SelfDescribing { /** - * Enable or disable the backup and restoration of the $GLOBALS array. + * Fakes the processing of the invocation $invocation by returning a + * specific value. * - * @var bool + * @param Invocation $invocation The invocation which was mocked and matched by the current method and argument matchers */ - protected $backupGlobals; + public function invoke(Invocation $invocation); +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use PHPUnit\Framework\ExpectationFailedException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +interface Verifiable +{ /** - * Enable or disable the backup and restoration of static attributes. + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. * - * @var bool - */ - protected $backupStaticAttributes; - /** - * @var bool + * @throws ExpectationFailedException */ - protected $runTestInSeparateProcess = \false; - /** - * The name of the test suite. - * - * @var string - */ - protected $name = ''; - /** - * The test groups of the test suite. - * - * @psalm-var array> - */ - protected $groups = []; - /** - * The tests in the test suite. - * - * @var Test[] - */ - protected $tests = []; - /** - * The number of tests in the test suite. - * - * @var int - */ - protected $numTests = -1; - /** - * @var bool - */ - protected $testCase = \false; - /** - * @var string[] - */ - protected $foundClasses = []; + public function verify(): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +interface Reorderable +{ + public function sortId(): string; /** - * @var null|list + * @return list */ - protected $providedTests; + public function provides(): array; /** - * @var null|list + * @return list */ - protected $requiredTests; + public function requires(): array; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +interface SelfDescribing +{ /** - * @var bool + * Returns a string representation of the object. */ - private $beStrictAboutChangesToGlobalState; + public function toString(): string; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +interface SkippedTest extends Throwable +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class SkippedTestCase extends \PHPUnit\Framework\TestCase +{ /** - * @var Factory + * @var ?bool */ - private $iteratorFilter; + protected $backupGlobals = \false; /** - * @var int + * @var ?bool */ - private $declaredClassesPointer; + protected $backupStaticAttributes = \false; /** - * @psalm-var array + * @var ?bool */ - private $warnings = []; + protected $runTestInSeparateProcess = \false; /** - * Constructs a new TestSuite. - * - * - PHPUnit\Framework\TestSuite() constructs an empty TestSuite. - * - * - PHPUnit\Framework\TestSuite(ReflectionClass) constructs a - * TestSuite from the given class. - * - * - PHPUnit\Framework\TestSuite(ReflectionClass, String) - * constructs a TestSuite from the given class with the given - * name. - * - * - PHPUnit\Framework\TestSuite(String) either constructs a - * TestSuite from the given class (if the passed string is the - * name of an existing class) or constructs an empty TestSuite - * with the given name. - * - * @param ReflectionClass|string $theClass - * - * @throws Exception + * @var string */ - public function __construct($theClass = '', string $name = '') + private $message; + public function __construct(string $className, string $methodName, string $message = '') { - if (!is_string($theClass) && !$theClass instanceof ReflectionClass) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'ReflectionClass object or string'); - } - $this->declaredClassesPointer = count(get_declared_classes()); - if (!$theClass instanceof ReflectionClass) { - if (class_exists($theClass, \true)) { - if ($name === '') { - $name = $theClass; - } - try { - $theClass = new ReflectionClass($theClass); - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - } else { - $this->setName($theClass); - return; - } - } - if (!$theClass->isSubclassOf(\PHPUnit\Framework\TestCase::class)) { - $this->setName((string) $theClass); - return; - } - if ($name !== '') { - $this->setName($name); - } else { - $this->setName($theClass->getName()); - } - $constructor = $theClass->getConstructor(); - if ($constructor !== null && !$constructor->isPublic()) { - $this->addTest(new \PHPUnit\Framework\WarningTestCase(sprintf('Class "%s" has no public constructor.', $theClass->getName()))); - return; - } - foreach ((new Reflection())->publicMethodsInTestClass($theClass) as $method) { - if (!TestUtil::isTestMethod($method)) { - continue; - } - $this->addTestMethod($theClass, $method); - } - if (empty($this->tests)) { - $this->addTest(new \PHPUnit\Framework\WarningTestCase(sprintf('No tests found in class "%s".', $theClass->getName()))); - } - $this->testCase = \true; + parent::__construct($className . '::' . $methodName); + $this->message = $message; + } + public function getMessage(): string + { + return $this->message; } /** - * Returns a string representation of the test suite. + * Returns a string representation of the test case. + * + * @throws InvalidArgumentException */ - public function toString() : string + public function toString(): string { return $this->getName(); } /** - * Adds a test to the suite. - * - * @param array $groups + * @throws Exception */ - public function addTest(\PHPUnit\Framework\Test $test, $groups = []) : void + protected function runTest(): void { - try { - $class = new ReflectionClass($test); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if (!$class->isAbstract()) { - $this->tests[] = $test; - $this->clearCaches(); - if ($test instanceof self && empty($groups)) { - $groups = $test->getGroups(); - } - if ($this->containsOnlyVirtualGroups($groups)) { - $groups[] = 'default'; - } - foreach ($groups as $group) { - if (!isset($this->groups[$group])) { - $this->groups[$group] = [$test]; - } else { - $this->groups[$group][] = $test; - } - } - if ($test instanceof \PHPUnit\Framework\TestCase) { - $test->setGroups($groups); - } - } + $this->markTestSkipped($this->message); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use Countable; +/** + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +interface Test extends Countable +{ /** - * Adds the tests from the given class to the suite. - * - * @psalm-param object|class-string $testClass - * - * @throws Exception + * Runs a test and collects its result in a TestResult instance. */ - public function addTestSuite($testClass) : void + public function run(?\PHPUnit\Framework\TestResult $result = null): \PHPUnit\Framework\TestResult; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use function assert; +use function count; +use function get_class; +use function sprintf; +use function trim; +use PHPUnit\Util\Filter; +use PHPUnit\Util\InvalidDataSetException; +use PHPUnit\Util\Test as TestUtil; +use ReflectionClass; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class TestBuilder +{ + public function build(ReflectionClass $theClass, string $methodName): \PHPUnit\Framework\Test { - if (!(is_object($testClass) || is_string($testClass) && class_exists($testClass))) { - throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'class name or object'); + $className = $theClass->getName(); + if (!$theClass->isInstantiable()) { + return new \PHPUnit\Framework\ErrorTestCase(sprintf('Cannot instantiate class "%s".', $className)); } - if (!is_object($testClass)) { - try { - $testClass = new ReflectionClass($testClass); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd + $backupSettings = TestUtil::getBackupSettings($className, $methodName); + $preserveGlobalState = TestUtil::getPreserveGlobalStateSettings($className, $methodName); + $runTestInSeparateProcess = TestUtil::getProcessIsolationSettings($className, $methodName); + $runClassInSeparateProcess = TestUtil::getClassProcessIsolationSettings($className, $methodName); + $constructor = $theClass->getConstructor(); + if ($constructor === null) { + throw new \PHPUnit\Framework\Exception('No valid test provided.'); } - if ($testClass instanceof self) { - $this->addTest($testClass); - } elseif ($testClass instanceof ReflectionClass) { - $suiteMethod = \false; - if (!$testClass->isAbstract() && $testClass->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { - try { - $method = $testClass->getMethod(BaseTestRunner::SUITE_METHODNAME); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($method->isStatic()) { - $this->addTest($method->invoke(null, $testClass->getName())); - $suiteMethod = \true; - } + $parameters = $constructor->getParameters(); + // TestCase() or TestCase($name) + if (count($parameters) < 2) { + $test = $this->buildTestWithoutData($className); + } else { + try { + $data = TestUtil::getProvidedData($className, $methodName); + } catch (\PHPUnit\Framework\IncompleteTestError $e) { + $message = sprintf("Test for %s::%s marked incomplete by data provider\n%s", $className, $methodName, $this->throwableToString($e)); + $data = new \PHPUnit\Framework\IncompleteTestCase($className, $methodName, $message); + } catch (\PHPUnit\Framework\SkippedTestError $e) { + $message = sprintf("Test for %s::%s skipped by data provider\n%s", $className, $methodName, $this->throwableToString($e)); + $data = new \PHPUnit\Framework\SkippedTestCase($className, $methodName, $message); + } catch (Throwable $t) { + $message = sprintf("The data provider specified for %s::%s is invalid.\n%s", $className, $methodName, $this->throwableToString($t)); + $data = new \PHPUnit\Framework\ErrorTestCase($message); } - if (!$suiteMethod && !$testClass->isAbstract() && $testClass->isSubclassOf(\PHPUnit\Framework\TestCase::class)) { - $this->addTest(new self($testClass)); + // Test method with @dataProvider. + if (isset($data)) { + $test = $this->buildDataProviderTestSuite($methodName, $className, $data, $runTestInSeparateProcess, $preserveGlobalState, $runClassInSeparateProcess, $backupSettings); + } else { + $test = $this->buildTestWithoutData($className); } - } else { - throw new \PHPUnit\Framework\Exception(); } + if ($test instanceof \PHPUnit\Framework\TestCase) { + $test->setName($methodName); + $this->configureTestCase($test, $runTestInSeparateProcess, $preserveGlobalState, $runClassInSeparateProcess, $backupSettings); + } + return $test; } - public function addWarning(string $warning) : void + /** @psalm-param class-string $className */ + private function buildTestWithoutData(string $className) { - $this->warnings[] = $warning; + return new $className(); } - /** - * Wraps both addTest() and addTestSuite - * as well as the separate import statements for the user's convenience. - * - * If the named file cannot be read or there are no new tests that can be - * added, a PHPUnit\Framework\WarningTestCase will be created instead, - * leaving the current test run untouched. - * - * @throws Exception - */ - public function addTestFile(string $filename) : void + /** @psalm-param class-string $className */ + private function buildDataProviderTestSuite(string $methodName, string $className, $data, bool $runTestInSeparateProcess, ?bool $preserveGlobalState, bool $runClassInSeparateProcess, array $backupSettings): \PHPUnit\Framework\DataProviderTestSuite { - if (is_file($filename) && substr($filename, -5) === '.phpt') { - $this->addTest(new PhptTestCase($filename)); - $this->declaredClassesPointer = count(get_declared_classes()); - return; - } - $numTests = count($this->tests); - // The given file may contain further stub classes in addition to the - // test class itself. Figure out the actual test class. - $filename = FileLoader::checkAndLoad($filename); - $newClasses = array_slice(get_declared_classes(), $this->declaredClassesPointer); - // The diff is empty in case a parent class (with test methods) is added - // AFTER a child class that inherited from it. To account for that case, - // accumulate all discovered classes, so the parent class may be found in - // a later invocation. - if (!empty($newClasses)) { - // On the assumption that test classes are defined first in files, - // process discovered classes in approximate LIFO order, so as to - // avoid unnecessary reflection. - $this->foundClasses = array_merge($newClasses, $this->foundClasses); - $this->declaredClassesPointer = count(get_declared_classes()); - } - // The test class's name must match the filename, either in full, or as - // a PEAR/PSR-0 prefixed short name ('NameSpace_ShortName'), or as a - // PSR-1 local short name ('NameSpace\ShortName'). The comparison must be - // anchored to prevent false-positive matches (e.g., 'OtherShortName'). - $shortName = basename($filename, '.php'); - $shortNameRegEx = '/(?:^|_|\\\\)' . preg_quote($shortName, '/') . '$/'; - foreach ($this->foundClasses as $i => $className) { - if (preg_match($shortNameRegEx, $className)) { - try { - $class = new ReflectionClass($className); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($class->getFileName() == $filename) { - $newClasses = [$className]; - unset($this->foundClasses[$i]); - break; - } + $dataProviderTestSuite = new \PHPUnit\Framework\DataProviderTestSuite($className . '::' . $methodName); + $groups = TestUtil::getGroups($className, $methodName); + if ($data instanceof \PHPUnit\Framework\ErrorTestCase || $data instanceof \PHPUnit\Framework\SkippedTestCase || $data instanceof \PHPUnit\Framework\IncompleteTestCase) { + $dataProviderTestSuite->addTest($data, $groups); + } else { + foreach ($data as $_dataName => $_data) { + $_test = new $className($methodName, $_data, $_dataName); + assert($_test instanceof \PHPUnit\Framework\TestCase); + $this->configureTestCase($_test, $runTestInSeparateProcess, $preserveGlobalState, $runClassInSeparateProcess, $backupSettings); + $dataProviderTestSuite->addTest($_test, $groups); } } - foreach ($newClasses as $className) { - try { - $class = new ReflectionClass($className); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if (dirname($class->getFileName()) === __DIR__) { - continue; - } - if ($class->isAbstract() && $class->isSubclassOf(\PHPUnit\Framework\TestCase::class)) { - $this->addWarning(sprintf('Abstract test case classes with "Test" suffix are deprecated (%s)', $class->getName())); + return $dataProviderTestSuite; + } + private function configureTestCase(\PHPUnit\Framework\TestCase $test, bool $runTestInSeparateProcess, ?bool $preserveGlobalState, bool $runClassInSeparateProcess, array $backupSettings): void + { + if ($runTestInSeparateProcess) { + $test->setRunTestInSeparateProcess(\true); + if ($preserveGlobalState !== null) { + $test->setPreserveGlobalState($preserveGlobalState); } - if (!$class->isAbstract()) { - if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { - try { - $method = $class->getMethod(BaseTestRunner::SUITE_METHODNAME); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($method->isStatic()) { - $this->addTest($method->invoke(null, $className)); - } - } elseif ($class->implementsInterface(\PHPUnit\Framework\Test::class)) { - // Do we have modern namespacing ('Foo\Bar\WhizBangTest') or old-school namespacing ('Foo_Bar_WhizBangTest')? - $isPsr0 = !$class->inNamespace() && strpos($class->getName(), '_') !== \false; - $expectedClassName = $isPsr0 ? $className : $shortName; - if (($pos = strpos($expectedClassName, '.')) !== \false) { - $expectedClassName = substr($expectedClassName, 0, $pos); - } - if ($class->getShortName() !== $expectedClassName) { - $this->addWarning(sprintf("Test case class not matching filename is deprecated\n in %s\n Class name was '%s', expected '%s'", $filename, $class->getShortName(), $expectedClassName)); - } - $this->addTestSuite($class); - } + } + if ($runClassInSeparateProcess) { + $test->setRunClassInSeparateProcess(\true); + if ($preserveGlobalState !== null) { + $test->setPreserveGlobalState($preserveGlobalState); } } - if (count($this->tests) > ++$numTests) { - $this->addWarning(sprintf("Multiple test case classes per file is deprecated\n in %s", $filename)); + if ($backupSettings['backupGlobals'] !== null) { + $test->setBackupGlobals($backupSettings['backupGlobals']); } - $this->numTests = -1; - } - /** - * Wrapper for addTestFile() that adds multiple test files. - * - * @throws Exception - */ - public function addTestFiles(iterable $fileNames) : void - { - foreach ($fileNames as $filename) { - $this->addTestFile((string) $filename); + if ($backupSettings['backupStaticAttributes'] !== null) { + $test->setBackupStaticAttributes($backupSettings['backupStaticAttributes']); } } - /** - * Counts the number of test cases that will be run by this test. - * - * @todo refactor usage of numTests in DefaultResultPrinter - */ - public function count() : int + private function throwableToString(Throwable $t): string { - $this->numTests = 0; - foreach ($this as $test) { - $this->numTests += count($test); + $message = $t->getMessage(); + if (empty(trim($message))) { + $message = ''; } - return $this->numTests; - } - /** - * Returns the name of the suite. - */ - public function getName() : string - { - return $this->name; + if ($t instanceof InvalidDataSetException) { + return sprintf("%s\n%s", $message, Filter::getFilteredStacktrace($t)); + } + return sprintf("%s: %s\n%s", get_class($t), $message, Filter::getFilteredStacktrace($t)); } - /** - * Returns the test groups of the suite. - * - * @psalm-return list +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use const LC_ALL; +use const LC_COLLATE; +use const LC_CTYPE; +use const LC_MONETARY; +use const LC_NUMERIC; +use const LC_TIME; +use const PATHINFO_FILENAME; +use const PHP_EOL; +use const PHP_URL_PATH; +use function array_filter; +use function array_flip; +use function array_keys; +use function array_merge; +use function array_pop; +use function array_search; +use function array_unique; +use function array_values; +use function basename; +use function call_user_func; +use function chdir; +use function class_exists; +use function clearstatcache; +use function count; +use function debug_backtrace; +use function defined; +use function explode; +use function get_class; +use function get_include_path; +use function getcwd; +use function implode; +use function in_array; +use function ini_set; +use function is_array; +use function is_callable; +use function is_int; +use function is_object; +use function is_string; +use function libxml_clear_errors; +use function method_exists; +use function ob_end_clean; +use function ob_get_contents; +use function ob_get_level; +use function ob_start; +use function parse_url; +use function pathinfo; +use function preg_replace; +use function serialize; +use function setlocale; +use function sprintf; +use function strpos; +use function substr; +use function sys_get_temp_dir; +use function tempnam; +use function trim; +use function var_export; +use PHPUnitPHAR\DeepCopy\DeepCopy; +use PHPUnit\Framework\Constraint\Exception as ExceptionConstraint; +use PHPUnit\Framework\Constraint\ExceptionCode; +use PHPUnit\Framework\Constraint\ExceptionMessage; +use PHPUnit\Framework\Constraint\ExceptionMessageRegularExpression; +use PHPUnit\Framework\Constraint\LogicalOr; +use PHPUnit\Framework\Error\Deprecated; +use PHPUnit\Framework\Error\Error; +use PHPUnit\Framework\Error\Notice; +use PHPUnit\Framework\Error\Warning as WarningError; +use PHPUnit\Framework\MockObject\Generator as MockGenerator; +use PHPUnit\Framework\MockObject\MockBuilder; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount as AnyInvokedCountMatcher; +use PHPUnit\Framework\MockObject\Rule\InvokedAtIndex as InvokedAtIndexMatcher; +use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastCount as InvokedAtLeastCountMatcher; +use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastOnce as InvokedAtLeastOnceMatcher; +use PHPUnit\Framework\MockObject\Rule\InvokedAtMostCount as InvokedAtMostCountMatcher; +use PHPUnit\Framework\MockObject\Rule\InvokedCount as InvokedCountMatcher; +use PHPUnit\Framework\MockObject\Stub; +use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls as ConsecutiveCallsStub; +use PHPUnit\Framework\MockObject\Stub\Exception as ExceptionStub; +use PHPUnit\Framework\MockObject\Stub\ReturnArgument as ReturnArgumentStub; +use PHPUnit\Framework\MockObject\Stub\ReturnCallback as ReturnCallbackStub; +use PHPUnit\Framework\MockObject\Stub\ReturnSelf as ReturnSelfStub; +use PHPUnit\Framework\MockObject\Stub\ReturnStub; +use PHPUnit\Framework\MockObject\Stub\ReturnValueMap as ReturnValueMapStub; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\Cloner; +use PHPUnit\Util\Exception as UtilException; +use PHPUnit\Util\GlobalState; +use PHPUnit\Util\PHP\AbstractPhpProcess; +use PHPUnit\Util\Test as TestUtil; +use Prophecy\Exception\Doubler\ClassNotFoundException; +use Prophecy\Exception\Doubler\DoubleException; +use Prophecy\Exception\Doubler\InterfaceNotFoundException; +use Prophecy\Exception\Prediction\PredictionException; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophet; +use ReflectionClass; +use ReflectionException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException; +use PHPUnitPHAR\SebastianBergmann\Comparator\Comparator; +use PHPUnitPHAR\SebastianBergmann\Comparator\Factory as ComparatorFactory; +use PHPUnitPHAR\SebastianBergmann\Diff\Differ; +use PHPUnitPHAR\SebastianBergmann\Exporter\Exporter; +use PHPUnitPHAR\SebastianBergmann\GlobalState\ExcludeList; +use PHPUnitPHAR\SebastianBergmann\GlobalState\Restorer; +use PHPUnitPHAR\SebastianBergmann\GlobalState\Snapshot; +use PHPUnitPHAR\SebastianBergmann\ObjectEnumerator\Enumerator; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +use PHPUnitPHAR\SebastianBergmann\Template\Template; +use SoapClient; +use Throwable; +/** + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + */ +abstract class TestCase extends \PHPUnit\Framework\Assert implements \PHPUnit\Framework\Reorderable, \PHPUnit\Framework\SelfDescribing, \PHPUnit\Framework\Test +{ + private const LOCALE_CATEGORIES = [LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME]; + /** + * @var ?bool + */ + protected $backupGlobals; + /** + * @var string[] + */ + protected $backupGlobalsExcludeList = []; + /** + * @var string[] + * + * @deprecated Use $backupGlobalsExcludeList instead + */ + protected $backupGlobalsBlacklist = []; + /** + * @var ?bool + */ + protected $backupStaticAttributes; + /** + * @var array> + */ + protected $backupStaticAttributesExcludeList = []; + /** + * @var array> + * + * @deprecated Use $backupStaticAttributesExcludeList instead + */ + protected $backupStaticAttributesBlacklist = []; + /** + * @var ?bool + */ + protected $runTestInSeparateProcess; + /** + * @var bool + */ + protected $preserveGlobalState = \true; + /** + * @var list + */ + protected $providedTests = []; + /** + * @var ?bool + */ + private $runClassInSeparateProcess; + /** + * @var bool + */ + private $inIsolation = \false; + /** + * @var array + */ + private $data; + /** + * @var int|string + */ + private $dataName; + /** + * @var null|string + */ + private $expectedException; + /** + * @var null|string + */ + private $expectedExceptionMessage; + /** + * @var null|string + */ + private $expectedExceptionMessageRegExp; + /** + * @var null|int|string + */ + private $expectedExceptionCode; + /** + * @var string + */ + private $name = ''; + /** + * @var list + */ + private $dependencies = []; + /** + * @var array + */ + private $dependencyInput = []; + /** + * @var array + */ + private $iniSettings = []; + /** + * @var array + */ + private $locale = []; + /** + * @var MockObject[] + */ + private $mockObjects = []; + /** + * @var MockGenerator + */ + private $mockObjectGenerator; + /** + * @var int + */ + private $status = BaseTestRunner::STATUS_UNKNOWN; + /** + * @var string + */ + private $statusMessage = ''; + /** + * @var int + */ + private $numAssertions = 0; + /** + * @var TestResult + */ + private $result; + /** + * @var mixed + */ + private $testResult; + /** + * @var string + */ + private $output = ''; + /** + * @var ?string + */ + private $outputExpectedRegex; + /** + * @var ?string + */ + private $outputExpectedString; + /** + * @var mixed + */ + private $outputCallback = \false; + /** + * @var bool + */ + private $outputBufferingActive = \false; + /** + * @var int + */ + private $outputBufferingLevel; + /** + * @var bool + */ + private $outputRetrievedForAssertion = \false; + /** + * @var ?Snapshot + */ + private $snapshot; + /** + * @var Prophet + */ + private $prophet; + /** + * @var bool + */ + private $beStrictAboutChangesToGlobalState = \false; + /** + * @var bool + */ + private $registerMockObjectsFromTestArgumentsRecursively = \false; + /** + * @var string[] + */ + private $warnings = []; + /** + * @var string[] + */ + private $groups = []; + /** + * @var bool + */ + private $doesNotPerformAssertions = \false; + /** + * @var Comparator[] + */ + private $customComparators = []; + /** + * @var string[] + */ + private $doubledTypes = []; + /** + * Returns a matcher that matches when the method is executed + * zero or more times. */ - public function getGroups() : array + public static function any(): AnyInvokedCountMatcher { - return array_map(static function ($key) : string { - return (string) $key; - }, array_keys($this->groups)); + return new AnyInvokedCountMatcher(); } - public function getGroupDetails() : array + /** + * Returns a matcher that matches when the method is never executed. + */ + public static function never(): InvokedCountMatcher { - return $this->groups; + return new InvokedCountMatcher(0); } /** - * Set tests groups of the test case. + * Returns a matcher that matches when the method is executed + * at least N times. */ - public function setGroupDetails(array $groups) : void + public static function atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher { - $this->groups = $groups; + return new InvokedAtLeastCountMatcher($requiredInvocations); } /** - * Runs the tests and collects their result in a TestResult. - * - * @throws \PHPUnit\Framework\CodeCoverageException - * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException - * @throws \SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Warning + * Returns a matcher that matches when the method is executed at least once. */ - public function run(\PHPUnit\Framework\TestResult $result = null) : \PHPUnit\Framework\TestResult + public static function atLeastOnce(): InvokedAtLeastOnceMatcher { - if ($result === null) { - $result = $this->createResult(); - } - if (count($this) === 0) { - return $result; - } - /** @psalm-var class-string $className */ - $className = $this->name; - $hookMethods = TestUtil::getHookMethods($className); - $result->startTestSuite($this); - $test = null; - if ($this->testCase && class_exists($this->name, \false)) { - try { - foreach ($hookMethods['beforeClass'] as $beforeClassMethod) { - if (method_exists($this->name, $beforeClassMethod)) { - if ($missingRequirements = TestUtil::getMissingRequirements($this->name, $beforeClassMethod)) { - $this->markTestSuiteSkipped(implode(PHP_EOL, $missingRequirements)); - } - call_user_func([$this->name, $beforeClassMethod]); - } - } - } catch (\PHPUnit\Framework\SkippedTestError|\PHPUnit\Framework\SkippedTestSuiteError $error) { - foreach ($this->tests() as $test) { - $result->startTest($test); - $result->addFailure($test, $error, 0); - $result->endTest($test, 0); - } - $result->endTestSuite($this); - return $result; - } catch (Throwable $t) { - $errorAdded = \false; - foreach ($this->tests() as $test) { - if ($result->shouldStop()) { - break; - } - $result->startTest($test); - if (!$errorAdded) { - $result->addError($test, $t, 0); - $errorAdded = \true; - } else { - $result->addFailure($test, new \PHPUnit\Framework\SkippedTestError('Test skipped because of an error in hook method'), 0); - } - $result->endTest($test, 0); - } - $result->endTestSuite($this); - return $result; - } - } - foreach ($this as $test) { - if ($result->shouldStop()) { - break; - } - if ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof self) { - $test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState); - $test->setBackupGlobals($this->backupGlobals); - $test->setBackupStaticAttributes($this->backupStaticAttributes); - $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess); - } - $test->run($result); - } - if ($this->testCase && class_exists($this->name, \false)) { - foreach ($hookMethods['afterClass'] as $afterClassMethod) { - if (method_exists($this->name, $afterClassMethod)) { - try { - call_user_func([$this->name, $afterClassMethod]); - } catch (Throwable $t) { - $message = "Exception in {$this->name}::{$afterClassMethod}" . PHP_EOL . $t->getMessage(); - $error = new \PHPUnit\Framework\SyntheticError($message, 0, $t->getFile(), $t->getLine(), $t->getTrace()); - $placeholderTest = clone $test; - $placeholderTest->setName($afterClassMethod); - $result->startTest($placeholderTest); - $result->addFailure($placeholderTest, $error, 0); - $result->endTest($placeholderTest, 0); - } - } - } - } - $result->endTestSuite($this); - return $result; + return new InvokedAtLeastOnceMatcher(); } - public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess) : void + /** + * Returns a matcher that matches when the method is executed exactly once. + */ + public static function once(): InvokedCountMatcher { - $this->runTestInSeparateProcess = $runTestInSeparateProcess; + return new InvokedCountMatcher(1); } - public function setName(string $name) : void + /** + * Returns a matcher that matches when the method is executed + * exactly $count times. + */ + public static function exactly(int $count): InvokedCountMatcher { - $this->name = $name; + return new InvokedCountMatcher($count); } /** - * Returns the tests as an enumeration. - * - * @return Test[] + * Returns a matcher that matches when the method is executed + * at most N times. */ - public function tests() : array + public static function atMost(int $allowedInvocations): InvokedAtMostCountMatcher { - return $this->tests; + return new InvokedAtMostCountMatcher($allowedInvocations); } /** - * Set tests of the test suite. + * Returns a matcher that matches when the method is executed + * at the given index. * - * @param Test[] $tests + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4297 + * + * @codeCoverageIgnore */ - public function setTests(array $tests) : void + public static function at(int $index): InvokedAtIndexMatcher { - $this->tests = $tests; + $stack = debug_backtrace(); + while (!empty($stack)) { + $frame = array_pop($stack); + if (isset($frame['object']) && $frame['object'] instanceof self) { + $frame['object']->addWarning('The at() matcher has been deprecated. It will be removed in PHPUnit 10. Please refactor your test to not rely on the order in which methods are invoked.'); + break; + } + } + return new InvokedAtIndexMatcher($index); + } + public static function returnValue($value): ReturnStub + { + return new ReturnStub($value); + } + public static function returnValueMap(array $valueMap): ReturnValueMapStub + { + return new ReturnValueMapStub($valueMap); + } + public static function returnArgument(int $argumentIndex): ReturnArgumentStub + { + return new ReturnArgumentStub($argumentIndex); + } + public static function returnCallback($callback): ReturnCallbackStub + { + return new ReturnCallbackStub($callback); } /** - * Mark the test suite as skipped. - * - * @param string $message - * - * @throws SkippedTestSuiteError + * Returns the current object. * - * @psalm-return never-return + * This method is useful when mocking a fluent interface. */ - public function markTestSuiteSkipped($message = '') : void + public static function returnSelf(): ReturnSelfStub { - throw new \PHPUnit\Framework\SkippedTestSuiteError($message); + return new ReturnSelfStub(); + } + public static function throwException(Throwable $exception): ExceptionStub + { + return new ExceptionStub($exception); + } + public static function onConsecutiveCalls(...$args): ConsecutiveCallsStub + { + return new ConsecutiveCallsStub($args); } /** - * @param bool $beStrictAboutChangesToGlobalState + * @param int|string $dataName + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState) : void + public function __construct(?string $name = null, array $data = [], $dataName = '') { - if (null === $this->beStrictAboutChangesToGlobalState && is_bool($beStrictAboutChangesToGlobalState)) { - $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + if ($name !== null) { + $this->setName($name); } + $this->data = $data; + $this->dataName = $dataName; } /** - * @param bool $backupGlobals + * This method is called before the first test of this test class is run. */ - public function setBackupGlobals($backupGlobals) : void + public static function setUpBeforeClass(): void { - if (null === $this->backupGlobals && is_bool($backupGlobals)) { - $this->backupGlobals = $backupGlobals; - } } /** - * @param bool $backupStaticAttributes + * This method is called after the last test of this test class is run. */ - public function setBackupStaticAttributes($backupStaticAttributes) : void + public static function tearDownAfterClass(): void { - if (null === $this->backupStaticAttributes && is_bool($backupStaticAttributes)) { - $this->backupStaticAttributes = $backupStaticAttributes; - } } /** - * Returns an iterator for this test suite. + * This method is called before each test. */ - public function getIterator() : Iterator + protected function setUp(): void { - $iterator = new \PHPUnit\Framework\TestSuiteIterator($this); - if ($this->iteratorFilter !== null) { - $iterator = $this->iteratorFilter->factory($iterator, $this); - } - return $iterator; } - public function injectFilter(Factory $filter) : void + /** + * Performs assertions shared by all tests of a test case. + * + * This method is called between setUp() and test. + */ + protected function assertPreConditions(): void { - $this->iteratorFilter = $filter; - foreach ($this as $test) { - if ($test instanceof self) { - $test->injectFilter($filter); - } - } } /** - * @psalm-return array + * Performs assertions shared by all tests of a test case. + * + * This method is called between test and tearDown(). */ - public function warnings() : array + protected function assertPostConditions(): void { - return array_unique($this->warnings); } /** - * @return list + * This method is called after each test. */ - public function provides() : array + protected function tearDown(): void { - if ($this->providedTests === null) { - $this->providedTests = []; - if (is_callable($this->sortId(), \true)) { - $this->providedTests[] = new \PHPUnit\Framework\ExecutionOrderDependency($this->sortId()); - } - foreach ($this->tests as $test) { - if (!$test instanceof \PHPUnit\Framework\Reorderable) { - // @codeCoverageIgnoreStart - continue; - // @codeCoverageIgnoreEnd - } - $this->providedTests = \PHPUnit\Framework\ExecutionOrderDependency::mergeUnique($this->providedTests, $test->provides()); - } - } - return $this->providedTests; } /** - * @return list + * Returns a string representation of the test case. + * + * @throws Exception + * @throws InvalidArgumentException */ - public function requires() : array + public function toString(): string { - if ($this->requiredTests === null) { - $this->requiredTests = []; - foreach ($this->tests as $test) { - if (!$test instanceof \PHPUnit\Framework\Reorderable) { - // @codeCoverageIgnoreStart - continue; - // @codeCoverageIgnoreEnd - } - $this->requiredTests = \PHPUnit\Framework\ExecutionOrderDependency::mergeUnique(\PHPUnit\Framework\ExecutionOrderDependency::filterInvalid($this->requiredTests), $test->requires()); - } - $this->requiredTests = \PHPUnit\Framework\ExecutionOrderDependency::diff($this->requiredTests, $this->provides()); + try { + $class = new ReflectionClass($this); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); } - return $this->requiredTests; + // @codeCoverageIgnoreEnd + $buffer = sprintf('%s::%s', $class->name, $this->getName(\false)); + return $buffer . $this->getDataSetAsString(); } - public function sortId() : string + public function count(): int { - return $this->getName() . '::class'; + return 1; } - /** - * Creates a default TestResult object. - */ - protected function createResult() : \PHPUnit\Framework\TestResult + public function getActualOutputForAssertion(): string { - return new \PHPUnit\Framework\TestResult(); + $this->outputRetrievedForAssertion = \true; + return $this->getActualOutput(); } - /** - * @throws Exception - */ - protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method) : void + public function expectOutputRegex(string $expectedRegex): void { - $methodName = $method->getName(); - $test = (new \PHPUnit\Framework\TestBuilder())->build($class, $methodName); - if ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof \PHPUnit\Framework\DataProviderTestSuite) { - $test->setDependencies(TestUtil::getDependencies($class->getName(), $methodName)); - } - $this->addTest($test, TestUtil::getGroups($class->getName(), $methodName)); + $this->outputExpectedRegex = $expectedRegex; } - private function clearCaches() : void + public function expectOutputString(string $expectedString): void { - $this->numTests = -1; - $this->providedTests = null; - $this->requiredTests = null; + $this->outputExpectedString = $expectedString; } - private function containsOnlyVirtualGroups(array $groups) : bool + /** + * @psalm-param class-string<\Throwable> $exception + */ + public function expectException(string $exception): void { - foreach ($groups as $group) { - if (strpos($group, '__phpunit_') !== 0) { - return \false; - } + // @codeCoverageIgnoreStart + switch ($exception) { + case Deprecated::class: + $this->addWarning('Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10.'); + break; + case Error::class: + $this->addWarning('Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10.'); + break; + case Notice::class: + $this->addWarning('Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE is deprecated and will no longer be possible in PHPUnit 10.'); + break; + case WarningError::class: + $this->addWarning('Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.'); + break; } - return \true; + // @codeCoverageIgnoreEnd + $this->expectedException = $exception; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -use function assert; -use function count; -use RecursiveIterator; -/** - * @template-implements RecursiveIterator - * - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class TestSuiteIterator implements RecursiveIterator -{ /** - * @var int - */ - private $position = 0; - /** - * @var Test[] + * @param int|string $code */ - private $tests; - public function __construct(\PHPUnit\Framework\TestSuite $testSuite) + public function expectExceptionCode($code): void { - $this->tests = $testSuite->tests(); + $this->expectedExceptionCode = $code; } - public function rewind() : void + public function expectExceptionMessage(string $message): void { - $this->position = 0; + $this->expectedExceptionMessage = $message; } - public function valid() : bool + public function expectExceptionMessageMatches(string $regularExpression): void { - return $this->position < count($this->tests); + $this->expectedExceptionMessageRegExp = $regularExpression; } - public function key() : int + /** + * Sets up an expectation for an exception to be raised by the code under test. + * Information for expected exception class, expected exception message, and + * expected exception code are retrieved from a given Exception object. + */ + public function expectExceptionObject(\Exception $exception): void { - return $this->position; + $this->expectException(get_class($exception)); + $this->expectExceptionMessage($exception->getMessage()); + $this->expectExceptionCode($exception->getCode()); } - public function current() : \PHPUnit\Framework\Test + public function expectNotToPerformAssertions(): void { - return $this->tests[$this->position]; + $this->doesNotPerformAssertions = \true; } - public function next() : void + /** + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + */ + public function expectDeprecation(): void { - $this->position++; + $this->addWarning('Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectedException = Deprecated::class; } /** - * @throws NoChildTestSuiteException + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - public function getChildren() : self + public function expectDeprecationMessage(string $message): void { - if (!$this->hasChildren()) { - throw new \PHPUnit\Framework\NoChildTestSuiteException('The current item is not a TestSuite instance and therefore does not have any children.'); - } - $current = $this->current(); - assert($current instanceof \PHPUnit\Framework\TestSuite); - return new self($current); + $this->addWarning('Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectExceptionMessage($message); } - public function hasChildren() : bool + /** + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + */ + public function expectDeprecationMessageMatches(string $regularExpression): void { - return $this->valid() && $this->current() instanceof \PHPUnit\Framework\TestSuite; + $this->addWarning('Expecting E_DEPRECATED and E_USER_DEPRECATED is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectExceptionMessageMatches($regularExpression); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Framework; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class WarningTestCase extends \PHPUnit\Framework\TestCase -{ /** - * @var ?bool + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - protected $backupGlobals = \false; + public function expectNotice(): void + { + $this->addWarning('Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectedException = Notice::class; + } /** - * @var ?bool + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - protected $backupStaticAttributes = \false; + public function expectNoticeMessage(string $message): void + { + $this->addWarning('Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectExceptionMessage($message); + } /** - * @var ?bool + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - protected $runTestInSeparateProcess = \false; + public function expectNoticeMessageMatches(string $regularExpression): void + { + $this->addWarning('Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectExceptionMessageMatches($regularExpression); + } /** - * @var string + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - private $message; - public function __construct(string $message = '') + public function expectWarning(): void { - $this->message = $message; - parent::__construct('Warning'); + $this->addWarning('Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectedException = WarningError::class; } - public function getMessage() : string + /** + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 + */ + public function expectWarningMessage(string $message): void { - return $this->message; + $this->addWarning('Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectExceptionMessage($message); } /** - * Returns a string representation of the test case. + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - public function toString() : string + public function expectWarningMessageMatches(string $regularExpression): void { - return 'Warning'; + $this->addWarning('Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectExceptionMessageMatches($regularExpression); } /** - * @throws Exception - * - * @psalm-return never-return + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - protected function runTest() : void + public function expectError(): void { - throw new \PHPUnit\Framework\Warning($this->message); + $this->addWarning('Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectedException = Error::class; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -use function is_dir; -use function is_file; -use function substr; -use PHPUnit\Framework\Exception; -use PHPUnit\Framework\TestSuite; -use ReflectionClass; -use ReflectionException; -use PHPUnit\SebastianBergmann\FileIterator\Facade as FileIteratorFacade; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -abstract class BaseTestRunner -{ /** - * @var int + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - public const STATUS_UNKNOWN = -1; + public function expectErrorMessage(string $message): void + { + $this->addWarning('Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectExceptionMessage($message); + } /** - * @var int + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/5062 */ - public const STATUS_PASSED = 0; + public function expectErrorMessageMatches(string $regularExpression): void + { + $this->addWarning('Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be possible in PHPUnit 10.'); + $this->expectExceptionMessageMatches($regularExpression); + } + public function getStatus(): int + { + return $this->status; + } + public function markAsRisky(): void + { + $this->status = BaseTestRunner::STATUS_RISKY; + } + public function getStatusMessage(): string + { + return $this->statusMessage; + } + public function hasFailed(): bool + { + $status = $this->getStatus(); + return $status === BaseTestRunner::STATUS_FAILURE || $status === BaseTestRunner::STATUS_ERROR; + } /** - * @var int + * Runs the test case and collects the results in a TestResult object. + * If no TestResult object is passed a new one will be created. + * + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + * @throws CodeCoverageException + * @throws InvalidArgumentException + * @throws UnintentionallyCoveredCodeException + * @throws UtilException */ - public const STATUS_SKIPPED = 1; + public function run(?\PHPUnit\Framework\TestResult $result = null): \PHPUnit\Framework\TestResult + { + if ($result === null) { + $result = $this->createResult(); + } + if (!$this instanceof \PHPUnit\Framework\ErrorTestCase && !$this instanceof \PHPUnit\Framework\WarningTestCase) { + $this->setTestResultObject($result); + } + if (!$this instanceof \PHPUnit\Framework\ErrorTestCase && !$this instanceof \PHPUnit\Framework\WarningTestCase && !$this instanceof \PHPUnit\Framework\SkippedTestCase && !$this->handleDependencies()) { + return $result; + } + if ($this->runInSeparateProcess()) { + $runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess; + try { + $class = new ReflectionClass($this); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if ($runEntireClass) { + $template = new Template(__DIR__ . '/../Util/PHP/Template/TestCaseClass.tpl'); + } else { + $template = new Template(__DIR__ . '/../Util/PHP/Template/TestCaseMethod.tpl'); + } + if ($this->preserveGlobalState) { + $constants = GlobalState::getConstantsAsString(); + $globals = GlobalState::getGlobalsAsString(); + $includedFiles = GlobalState::getIncludedFilesAsString(); + $iniSettings = GlobalState::getIniSettingsAsString(); + } else { + $constants = ''; + if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { + $globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . var_export($GLOBALS['__PHPUNIT_BOOTSTRAP'], \true) . ";\n"; + } else { + $globals = ''; + } + $includedFiles = ''; + $iniSettings = ''; + } + $coverage = $result->getCollectCodeCoverageInformation() ? 'true' : 'false'; + $isStrictAboutTestsThatDoNotTestAnything = $result->isStrictAboutTestsThatDoNotTestAnything() ? 'true' : 'false'; + $isStrictAboutOutputDuringTests = $result->isStrictAboutOutputDuringTests() ? 'true' : 'false'; + $enforcesTimeLimit = $result->enforcesTimeLimit() ? 'true' : 'false'; + $isStrictAboutTodoAnnotatedTests = $result->isStrictAboutTodoAnnotatedTests() ? 'true' : 'false'; + $isStrictAboutResourceUsageDuringSmallTests = $result->isStrictAboutResourceUsageDuringSmallTests() ? 'true' : 'false'; + if (defined('PHPUNIT_COMPOSER_INSTALL')) { + $composerAutoload = var_export(PHPUNIT_COMPOSER_INSTALL, \true); + } else { + $composerAutoload = '\'\''; + } + if (defined('__PHPUNIT_PHAR__')) { + $phar = var_export(__PHPUNIT_PHAR__, \true); + } else { + $phar = '\'\''; + } + $codeCoverage = $result->getCodeCoverage(); + $codeCoverageFilter = null; + $cachesStaticAnalysis = 'false'; + $codeCoverageCacheDirectory = null; + $driverMethod = 'forLineCoverage'; + if ($codeCoverage) { + $codeCoverageFilter = $codeCoverage->filter(); + if ($codeCoverage->collectsBranchAndPathCoverage()) { + $driverMethod = 'forLineAndPathCoverage'; + } + if ($codeCoverage->cachesStaticAnalysis()) { + $cachesStaticAnalysis = 'true'; + $codeCoverageCacheDirectory = $codeCoverage->cacheDirectory(); + } + } + $data = var_export(serialize($this->data), \true); + $dataName = var_export($this->dataName, \true); + $dependencyInput = var_export(serialize($this->dependencyInput), \true); + $includePath = var_export(get_include_path(), \true); + $codeCoverageFilter = var_export(serialize($codeCoverageFilter), \true); + $codeCoverageCacheDirectory = var_export(serialize($codeCoverageCacheDirectory), \true); + // must do these fixes because TestCaseMethod.tpl has unserialize('{data}') in it, and we can't break BC + // the lines above used to use addcslashes() rather than var_export(), which breaks null byte escape sequences + $data = "'." . $data . ".'"; + $dataName = "'.(" . $dataName . ").'"; + $dependencyInput = "'." . $dependencyInput . ".'"; + $includePath = "'." . $includePath . ".'"; + $codeCoverageFilter = "'." . $codeCoverageFilter . ".'"; + $codeCoverageCacheDirectory = "'." . $codeCoverageCacheDirectory . ".'"; + $configurationFilePath = $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] ?? ''; + $processResultFile = tempnam(sys_get_temp_dir(), 'phpunit_'); + $var = ['composerAutoload' => $composerAutoload, 'phar' => $phar, 'filename' => $class->getFileName(), 'className' => $class->getName(), 'collectCodeCoverageInformation' => $coverage, 'cachesStaticAnalysis' => $cachesStaticAnalysis, 'codeCoverageCacheDirectory' => $codeCoverageCacheDirectory, 'driverMethod' => $driverMethod, 'data' => $data, 'dataName' => $dataName, 'dependencyInput' => $dependencyInput, 'constants' => $constants, 'globals' => $globals, 'include_path' => $includePath, 'included_files' => $includedFiles, 'iniSettings' => $iniSettings, 'isStrictAboutTestsThatDoNotTestAnything' => $isStrictAboutTestsThatDoNotTestAnything, 'isStrictAboutOutputDuringTests' => $isStrictAboutOutputDuringTests, 'enforcesTimeLimit' => $enforcesTimeLimit, 'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests, 'isStrictAboutResourceUsageDuringSmallTests' => $isStrictAboutResourceUsageDuringSmallTests, 'codeCoverageFilter' => $codeCoverageFilter, 'configurationFilePath' => $configurationFilePath, 'name' => $this->getName(\false), 'processResultFile' => $processResultFile]; + if (!$runEntireClass) { + $var['methodName'] = $this->name; + } + $template->setVar($var); + $php = AbstractPhpProcess::factory(); + $php->runTestJob($template->render(), $this, $result, $processResultFile); + } else { + $result->run($this); + } + $this->result = null; + return $result; + } /** - * @var int + * Returns a builder object to create mock objects using a fluent interface. + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $className + * + * @psalm-return MockBuilder */ - public const STATUS_INCOMPLETE = 2; + public function getMockBuilder(string $className): MockBuilder + { + $this->recordDoubledType($className); + return new MockBuilder($this, $className); + } + public function registerComparator(Comparator $comparator): void + { + ComparatorFactory::getInstance()->register($comparator); + $this->customComparators[] = $comparator; + } /** - * @var int + * @return string[] + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public const STATUS_FAILURE = 3; + public function doubledTypes(): array + { + return array_unique($this->doubledTypes); + } /** - * @var int + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public const STATUS_ERROR = 4; + public function getGroups(): array + { + return $this->groups; + } /** - * @var int + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public const STATUS_RISKY = 5; + public function setGroups(array $groups): void + { + $this->groups = $groups; + } /** - * @var int + * @throws InvalidArgumentException + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public const STATUS_WARNING = 6; + public function getName(bool $withDataSet = \true): string + { + if ($withDataSet) { + return $this->name . $this->getDataSetAsString(\false); + } + return $this->name; + } /** - * @var string + * Returns the size of the test. + * + * @throws InvalidArgumentException + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public const SUITE_METHODNAME = 'suite'; + public function getSize(): int + { + return TestUtil::getSize(static::class, $this->getName(\false)); + } /** - * Returns the loader to be used. + * @throws InvalidArgumentException + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function getLoader() : \PHPUnit\Runner\TestSuiteLoader + public function hasSize(): bool { - return new \PHPUnit\Runner\StandardTestSuiteLoader(); + return $this->getSize() !== TestUtil::UNKNOWN; } /** - * Returns the Test corresponding to the given suite. - * This is a template method, subclasses override - * the runFailed() and clearStatus() methods. + * @throws InvalidArgumentException * - * @param string|string[] $suffixes + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function isSmall(): bool + { + return $this->getSize() === TestUtil::SMALL; + } + /** + * @throws InvalidArgumentException * - * @throws Exception + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function getTest(string $suiteClassFile, $suffixes = '') : ?TestSuite + public function isMedium(): bool { - if (is_dir($suiteClassFile)) { - /** @var string[] $files */ - $files = (new FileIteratorFacade())->getFilesAsArray($suiteClassFile, $suffixes); - $suite = new TestSuite($suiteClassFile); - $suite->addTestFiles($files); - return $suite; - } - if (is_file($suiteClassFile) && substr($suiteClassFile, -5, 5) === '.phpt') { - $suite = new TestSuite(); - $suite->addTestFile($suiteClassFile); - return $suite; - } - try { - $testClass = $this->loadSuiteClass($suiteClassFile); - } catch (\PHPUnit\Exception $e) { - $this->runFailed($e->getMessage()); - return null; - } - try { - $suiteMethod = $testClass->getMethod(self::SUITE_METHODNAME); - if (!$suiteMethod->isStatic()) { - $this->runFailed('suite() method must be static.'); - return null; - } - $test = $suiteMethod->invoke(null, $testClass->getName()); - } catch (ReflectionException $e) { - $test = new TestSuite($testClass); - } - $this->clearStatus(); - return $test; + return $this->getSize() === TestUtil::MEDIUM; } /** - * Returns the loaded ReflectionClass for a suite name. + * @throws InvalidArgumentException + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - protected function loadSuiteClass(string $suiteClassFile) : ReflectionClass + public function isLarge(): bool { - return $this->getLoader()->load($suiteClassFile); + return $this->getSize() === TestUtil::LARGE; } /** - * Clears the status message. + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - protected function clearStatus() : void + public function getActualOutput(): string { + if (!$this->outputBufferingActive) { + return $this->output; + } + return (string) ob_get_contents(); } /** - * Override to define how to handle a failed loading of - * a test suite. + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - protected abstract function runFailed(string $message) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -use const DIRECTORY_SEPARATOR; -use const LOCK_EX; -use function assert; -use function dirname; -use function file_get_contents; -use function file_put_contents; -use function in_array; -use function is_array; -use function is_dir; -use function is_file; -use function json_decode; -use function json_encode; -use function sprintf; -use PHPUnit\Util\Filesystem; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class DefaultTestResultCache implements \PHPUnit\Runner\TestResultCache -{ - /** - * @var int - */ - private const VERSION = 1; - /** - * @psalm-var list - */ - private const ALLOWED_TEST_STATUSES = [\PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED, \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE, \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE, \PHPUnit\Runner\BaseTestRunner::STATUS_ERROR, \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY, \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING]; - /** - * @var string - */ - private const DEFAULT_RESULT_CACHE_FILENAME = '.phpunit.result.cache'; + public function hasOutput(): bool + { + if ($this->output === '') { + return \false; + } + if ($this->hasExpectationOnOutput()) { + return \false; + } + return \true; + } /** - * @var string + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private $cacheFilename; + public function doesNotPerformAssertions(): bool + { + return $this->doesNotPerformAssertions; + } /** - * @psalm-var array + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private $defects = []; + public function hasExpectationOnOutput(): bool + { + return is_string($this->outputExpectedString) || is_string($this->outputExpectedRegex) || $this->outputRetrievedForAssertion; + } /** - * @psalm-var array + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private $times = []; - public function __construct(?string $filepath = null) + public function getExpectedException(): ?string { - if ($filepath !== null && is_dir($filepath)) { - $filepath .= DIRECTORY_SEPARATOR . self::DEFAULT_RESULT_CACHE_FILENAME; - } - $this->cacheFilename = $filepath ?? $_ENV['PHPUNIT_RESULT_CACHE'] ?? self::DEFAULT_RESULT_CACHE_FILENAME; + return $this->expectedException; } - public function setState(string $testName, int $state) : void + /** + * @return null|int|string + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function getExpectedExceptionCode() { - if (!in_array($state, self::ALLOWED_TEST_STATUSES, \true)) { - return; - } - $this->defects[$testName] = $state; + return $this->expectedExceptionCode; } - public function getState(string $testName) : int + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function getExpectedExceptionMessage(): ?string { - return $this->defects[$testName] ?? \PHPUnit\Runner\BaseTestRunner::STATUS_UNKNOWN; + return $this->expectedExceptionMessage; } - public function setTime(string $testName, float $time) : void + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function getExpectedExceptionMessageRegExp(): ?string { - $this->times[$testName] = $time; + return $this->expectedExceptionMessageRegExp; } - public function getTime(string $testName) : float + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag): void { - return $this->times[$testName] ?? 0.0; + $this->registerMockObjectsFromTestArgumentsRecursively = $flag; } - public function load() : void + /** + * @throws Throwable + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function runBare(): void { - if (!is_file($this->cacheFilename)) { - return; + $this->numAssertions = 0; + $this->snapshotGlobalState(); + $this->startOutputBuffering(); + clearstatcache(); + $currentWorkingDirectory = getcwd(); + $hookMethods = TestUtil::getHookMethods(static::class); + $hasMetRequirements = \false; + try { + $this->checkRequirements(); + $hasMetRequirements = \true; + if ($this->inIsolation) { + foreach ($hookMethods['beforeClass'] as $method) { + $this->{$method}(); + } + } + $this->setDoesNotPerformAssertionsFromAnnotation(); + foreach ($hookMethods['before'] as $method) { + $this->{$method}(); + } + foreach ($hookMethods['preCondition'] as $method) { + $this->{$method}(); + } + $this->testResult = $this->runTest(); + $this->verifyMockObjects(); + foreach ($hookMethods['postCondition'] as $method) { + $this->{$method}(); + } + if (!empty($this->warnings)) { + throw new \PHPUnit\Framework\Warning(implode("\n", array_unique($this->warnings))); + } + $this->status = BaseTestRunner::STATUS_PASSED; + } catch (\PHPUnit\Framework\IncompleteTest $e) { + $this->status = BaseTestRunner::STATUS_INCOMPLETE; + $this->statusMessage = $e->getMessage(); + } catch (\PHPUnit\Framework\SkippedTest $e) { + $this->status = BaseTestRunner::STATUS_SKIPPED; + $this->statusMessage = $e->getMessage(); + } catch (\PHPUnit\Framework\Warning $e) { + $this->status = BaseTestRunner::STATUS_WARNING; + $this->statusMessage = $e->getMessage(); + } catch (\PHPUnit\Framework\AssertionFailedError $e) { + $this->status = BaseTestRunner::STATUS_FAILURE; + $this->statusMessage = $e->getMessage(); + } catch (PredictionException $e) { + $this->status = BaseTestRunner::STATUS_FAILURE; + $this->statusMessage = $e->getMessage(); + } catch (Throwable $_e) { + $e = $_e; + $this->status = BaseTestRunner::STATUS_ERROR; + $this->statusMessage = $_e->getMessage(); } - $data = json_decode(file_get_contents($this->cacheFilename), \true); - if ($data === null) { - return; + $this->mockObjects = []; + $this->prophet = null; + // Tear down the fixture. An exception raised in tearDown() will be + // caught and passed on when no exception was raised before. + try { + if ($hasMetRequirements) { + foreach ($hookMethods['after'] as $method) { + $this->{$method}(); + } + if ($this->inIsolation) { + foreach ($hookMethods['afterClass'] as $method) { + $this->{$method}(); + } + } + } + } catch (Throwable $_e) { + $e = $e ?? $_e; } - if (!isset($data['version'])) { - return; + try { + $this->stopOutputBuffering(); + } catch (\PHPUnit\Framework\RiskyTestError $_e) { + $e = $e ?? $_e; } - if ($data['version'] !== self::VERSION) { - return; + if (isset($_e)) { + $this->status = BaseTestRunner::STATUS_ERROR; + $this->statusMessage = $_e->getMessage(); + } + clearstatcache(); + if ($currentWorkingDirectory !== getcwd()) { + chdir($currentWorkingDirectory); + } + $this->restoreGlobalState(); + $this->unregisterCustomComparators(); + $this->cleanupIniSettings(); + $this->cleanupLocaleSettings(); + libxml_clear_errors(); + // Perform assertion on output. + if (!isset($e)) { + try { + if ($this->outputExpectedRegex !== null) { + $this->assertMatchesRegularExpression($this->outputExpectedRegex, $this->output); + } elseif ($this->outputExpectedString !== null) { + $this->assertEquals($this->outputExpectedString, $this->output); + } + } catch (Throwable $_e) { + $e = $_e; + } + } + // Workaround for missing "finally". + if (isset($e)) { + if ($e instanceof PredictionException) { + $e = new \PHPUnit\Framework\AssertionFailedError($e->getMessage()); + } + $this->onNotSuccessfulTest($e); } - assert(isset($data['defects']) && is_array($data['defects'])); - assert(isset($data['times']) && is_array($data['times'])); - $this->defects = $data['defects']; - $this->times = $data['times']; } /** - * @throws Exception + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function persist() : void + public function setName(string $name): void { - if (!Filesystem::createDirectory(dirname($this->cacheFilename))) { - throw new \PHPUnit\Runner\Exception(sprintf('Cannot create directory "%s" for result cache file', $this->cacheFilename)); + $this->name = $name; + if (is_callable($this->sortId(), \true)) { + $this->providedTests = [new \PHPUnit\Framework\ExecutionOrderDependency($this->sortId())]; } - file_put_contents($this->cacheFilename, json_encode(['version' => self::VERSION, 'defects' => $this->defects, 'times' => $this->times]), LOCK_EX); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -use RuntimeException; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class Exception extends RuntimeException implements \PHPUnit\Exception -{ -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner\Extension; - -use function class_exists; -use function sprintf; -use PHPUnit\Framework\TestListener; -use PHPUnit\Runner\Exception; -use PHPUnit\Runner\Hook; -use PHPUnit\TextUI\TestRunner; -use PHPUnit\TextUI\XmlConfiguration\Extension; -use ReflectionClass; -use ReflectionException; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class ExtensionHandler -{ /** - * @throws Exception + * @param list $dependencies + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function registerExtension(Extension $extensionConfiguration, TestRunner $runner) : void + public function setDependencies(array $dependencies): void { - $extension = $this->createInstance($extensionConfiguration); - if (!$extension instanceof Hook) { - throw new Exception(sprintf('Class "%s" does not implement a PHPUnit\\Runner\\Hook interface', $extensionConfiguration->className())); - } - $runner->addExtension($extension); + $this->dependencies = $dependencies; } /** - * @throws Exception - * - * @deprecated + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function createTestListenerInstance(Extension $listenerConfiguration) : TestListener + public function setDependencyInput(array $dependencyInput): void { - $listener = $this->createInstance($listenerConfiguration); - if (!$listener instanceof TestListener) { - throw new Exception(sprintf('Class "%s" does not implement the PHPUnit\\Framework\\TestListener interface', $listenerConfiguration->className())); - } - return $listener; + $this->dependencyInput = $dependencyInput; } /** - * @throws Exception + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private function createInstance(Extension $extensionConfiguration) : object + public function setBeStrictAboutChangesToGlobalState(?bool $beStrictAboutChangesToGlobalState): void { - $this->ensureClassExists($extensionConfiguration); - try { - $reflector = new ReflectionClass($extensionConfiguration->className()); - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - if (!$extensionConfiguration->hasArguments()) { - return $reflector->newInstance(); - } - return $reflector->newInstanceArgs($extensionConfiguration->arguments()); + $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; } /** - * @throws Exception + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private function ensureClassExists(Extension $extensionConfiguration) : void + public function setBackupGlobals(?bool $backupGlobals): void { - if (class_exists($extensionConfiguration->className(), \false)) { - return; - } - if ($extensionConfiguration->hasSourceFile()) { - /** - * @noinspection PhpIncludeInspection - * - * @psalm-suppress UnresolvableInclude - */ - require_once $extensionConfiguration->sourceFile(); - } - if (!class_exists($extensionConfiguration->className())) { - throw new Exception(sprintf('Class "%s" does not exist', $extensionConfiguration->className())); + if ($this->backupGlobals === null && $backupGlobals !== null) { + $this->backupGlobals = $backupGlobals; } } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner\Extension; - -use function count; -use function explode; -use function implode; -use function is_file; -use function strpos; -use PHPUnit\PharIo\Manifest\ApplicationName; -use PHPUnit\PharIo\Manifest\Exception as ManifestException; -use PHPUnit\PharIo\Manifest\ManifestLoader; -use PHPUnit\PharIo\Version\Version as PharIoVersion; -use PHPUnit\Runner\Version; -use PHPUnit\SebastianBergmann\FileIterator\Facade as FileIteratorFacade; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class PharLoader -{ /** - * @psalm-return array{loadedExtensions: list, notLoadedExtensions: list} + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function loadPharExtensionsInDirectory(string $directory) : array + public function setBackupStaticAttributes(?bool $backupStaticAttributes): void { - $loadedExtensions = []; - $notLoadedExtensions = []; - foreach ((new FileIteratorFacade())->getFilesAsArray($directory, '.phar') as $file) { - if (!is_file('phar://' . $file . '/manifest.xml')) { - $notLoadedExtensions[] = $file . ' is not an extension for PHPUnit'; - continue; - } - try { - $applicationName = new ApplicationName('phpunit/phpunit'); - $version = new PharIoVersion($this->phpunitVersion()); - $manifest = ManifestLoader::fromFile('phar://' . $file . '/manifest.xml'); - if (!$manifest->isExtensionFor($applicationName)) { - $notLoadedExtensions[] = $file . ' is not an extension for PHPUnit'; - continue; - } - if (!$manifest->isExtensionFor($applicationName, $version)) { - $notLoadedExtensions[] = $file . ' is not compatible with this version of PHPUnit'; - continue; - } - } catch (ManifestException $e) { - $notLoadedExtensions[] = $file . ': ' . $e->getMessage(); - continue; - } - /** - * @noinspection PhpIncludeInspection - * - * @psalm-suppress UnresolvableInclude - */ - require $file; - $loadedExtensions[] = $manifest->getName()->asString() . ' ' . $manifest->getVersion()->getVersionString(); + if ($this->backupStaticAttributes === null && $backupStaticAttributes !== null) { + $this->backupStaticAttributes = $backupStaticAttributes; } - return ['loadedExtensions' => $loadedExtensions, 'notLoadedExtensions' => $notLoadedExtensions]; } - private function phpunitVersion() : string + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void { - $version = Version::id(); - if (strpos($version, '-') === \false) { - return $version; + if ($this->runTestInSeparateProcess === null) { + $this->runTestInSeparateProcess = $runTestInSeparateProcess; } - $parts = explode('.', explode('-', $version)[0]); - if (count($parts) === 2) { - $parts[] = 0; + } + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function setRunClassInSeparateProcess(bool $runClassInSeparateProcess): void + { + if ($this->runClassInSeparateProcess === null) { + $this->runClassInSeparateProcess = $runClassInSeparateProcess; } - return implode('.', $parts); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner\Filter; - -use function in_array; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class ExcludeGroupFilterIterator extends \PHPUnit\Runner\Filter\GroupFilterIterator -{ - protected function doAccept(string $hash) : bool + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function setPreserveGlobalState(bool $preserveGlobalState): void { - return !in_array($hash, $this->groupTests, \true); + $this->preserveGlobalState = $preserveGlobalState; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner\Filter; - -use function assert; -use function sprintf; -use FilterIterator; -use Iterator; -use PHPUnit\Framework\TestSuite; -use PHPUnit\Runner\Exception; -use RecursiveFilterIterator; -use ReflectionClass; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class Factory -{ /** - * @psalm-var array + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private $filters = []; + public function setInIsolation(bool $inIsolation): void + { + $this->inIsolation = $inIsolation; + } /** - * @param array|string $args - * - * @throws Exception + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function addFilter(ReflectionClass $filter, $args) : void + public function isInIsolation(): bool { - if (!$filter->isSubclassOf(RecursiveFilterIterator::class)) { - throw new Exception(sprintf('Class "%s" does not extend RecursiveFilterIterator', $filter->name)); - } - $this->filters[] = [$filter, $args]; + return $this->inIsolation; } - public function factory(Iterator $iterator, TestSuite $suite) : FilterIterator + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function getResult() { - foreach ($this->filters as $filter) { - [$class, $args] = $filter; - $iterator = $class->newInstance($iterator, $args, $suite); - } - assert($iterator instanceof FilterIterator); - return $iterator; + return $this->testResult; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner\Filter; - -use function array_map; -use function array_merge; -use function in_array; -use function spl_object_hash; -use PHPUnit\Framework\TestSuite; -use RecursiveFilterIterator; -use RecursiveIterator; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -abstract class GroupFilterIterator extends RecursiveFilterIterator -{ /** - * @var string[] + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - protected $groupTests = []; - public function __construct(RecursiveIterator $iterator, array $groups, TestSuite $suite) + public function setResult($result): void { - parent::__construct($iterator); - foreach ($suite->getGroupDetails() as $group => $tests) { - if (in_array((string) $group, $groups, \true)) { - $testHashes = array_map('spl_object_hash', $tests); - $this->groupTests = array_merge($this->groupTests, $testHashes); - } - } + $this->testResult = $result; } - public function accept() : bool + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function setOutputCallback(callable $callback): void { - $test = $this->getInnerIterator()->current(); - if ($test instanceof TestSuite) { - return \true; - } - return $this->doAccept(spl_object_hash($test)); + $this->outputCallback = $callback; } - protected abstract function doAccept(string $hash); -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner\Filter; - -use function in_array; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class IncludeGroupFilterIterator extends \PHPUnit\Runner\Filter\GroupFilterIterator -{ - protected function doAccept(string $hash) : bool + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function getTestResultObject(): ?\PHPUnit\Framework\TestResult { - return in_array($hash, $this->groupTests, \true); + return $this->result; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner\Filter; - -use function end; -use function implode; -use function preg_match; -use function sprintf; -use function str_replace; -use Exception; -use PHPUnit\Framework\ErrorTestCase; -use PHPUnit\Framework\TestSuite; -use PHPUnit\Framework\WarningTestCase; -use PHPUnit\Util\RegularExpression; -use RecursiveFilterIterator; -use RecursiveIterator; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class NameFilterIterator extends RecursiveFilterIterator -{ /** - * @var string + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private $filter; + public function setTestResultObject(\PHPUnit\Framework\TestResult $result): void + { + $this->result = $result; + } /** - * @var int + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private $filterMin; + public function registerMockObject(MockObject $mockObject): void + { + $this->mockObjects[] = $mockObject; + } /** - * @var int + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - private $filterMax; + public function addToAssertionCount(int $count): void + { + $this->numAssertions += $count; + } /** - * @throws Exception + * Returns the number of assertions performed by this test. + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function __construct(RecursiveIterator $iterator, string $filter) + public function getNumAssertions(): int { - parent::__construct($iterator); - $this->setFilter($filter); + return $this->numAssertions; } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function accept() : bool + public function usesDataProvider(): bool { - $test = $this->getInnerIterator()->current(); - if ($test instanceof TestSuite) { - return \true; + return !empty($this->data); + } + /** + * @return int|string + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function dataName() + { + return $this->dataName; + } + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function getDataSetAsString(bool $includeData = \true): string + { + $buffer = ''; + if (!empty($this->data)) { + if (is_int($this->dataName)) { + $buffer .= sprintf(' with data set #%d', $this->dataName); + } else { + $buffer .= sprintf(' with data set "%s"', $this->dataName); + } + if ($includeData) { + $exporter = new Exporter(); + $buffer .= sprintf(' (%s)', $exporter->shortenedRecursiveExport($this->data)); + } } - $tmp = \PHPUnit\Util\Test::describe($test); - if ($test instanceof ErrorTestCase || $test instanceof WarningTestCase) { - $name = $test->getMessage(); - } elseif ($tmp[0] !== '') { - $name = implode('::', $tmp); - } else { - $name = $tmp[1]; + return $buffer; + } + /** + * Gets the data set of a TestCase. + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function getProvidedData(): array + { + return $this->data; + } + /** + * @internal This method is not covered by the backward compatibility promise for PHPUnit + */ + public function addWarning(string $warning): void + { + $this->warnings[] = $warning; + } + public function sortId(): string + { + $id = $this->name; + if (strpos($id, '::') === \false) { + $id = static::class . '::' . $id; } - $accepted = @preg_match($this->filter, $name, $matches); - if ($accepted && isset($this->filterMax)) { - $set = end($matches); - $accepted = $set >= $this->filterMin && $set <= $this->filterMax; + if ($this->usesDataProvider()) { + $id .= $this->getDataSetAsString(\false); } - return (bool) $accepted; + return $id; + } + /** + * Returns the normalized test name as class::method. + * + * @return list + */ + public function provides(): array + { + return $this->providedTests; + } + /** + * Returns a list of normalized dependency names, class::method. + * + * This list can differ from the raw dependencies as the resolver has + * no need for the [!][shallow]clone prefix that is filtered out + * during normalization. + * + * @return list + */ + public function requires(): array + { + return $this->dependencies; } /** + * Override to run the test and assert its state. + * + * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException + * @throws AssertionFailedError * @throws Exception + * @throws ExpectationFailedException + * @throws Throwable */ - private function setFilter(string $filter) : void + protected function runTest() { - if (RegularExpression::safeMatch($filter, '') === \false) { - // Handles: - // * testAssertEqualsSucceeds#4 - // * testAssertEqualsSucceeds#4-8 - if (preg_match('/^(.*?)#(\\d+)(?:-(\\d+))?$/', $filter, $matches)) { - if (isset($matches[3]) && $matches[2] < $matches[3]) { - $filter = sprintf('%s.*with data set #(\\d+)$', $matches[1]); - $this->filterMin = (int) $matches[2]; - $this->filterMax = (int) $matches[3]; + if (trim($this->name) === '') { + throw new \PHPUnit\Framework\Exception('PHPUnit\Framework\TestCase::$name must be a non-blank string.'); + } + $testArguments = array_merge($this->data, $this->dependencyInput); + $this->registerMockObjectsFromTestArguments($testArguments); + try { + $testResult = $this->{$this->name}(...array_values($testArguments)); + } catch (Throwable $exception) { + if (!$this->checkExceptionExpectations($exception)) { + throw $exception; + } + if ($this->expectedException !== null) { + if ($this->expectedException === Error::class) { + $this->assertThat($exception, LogicalOr::fromConstraints(new ExceptionConstraint(Error::class), new ExceptionConstraint(\Error::class))); } else { - $filter = sprintf('%s.*with data set #%s$', $matches[1], $matches[2]); + $this->assertThat($exception, new ExceptionConstraint($this->expectedException)); } - } elseif (preg_match('/^(.*?)@(.+)$/', $filter, $matches)) { - $filter = sprintf('%s.*with data set "%s"$', $matches[1], $matches[2]); } - // Escape delimiters in regular expression. Do NOT use preg_quote, - // to keep magic characters. - $filter = sprintf('/%s/i', str_replace('/', '\\/', $filter)); + if ($this->expectedExceptionMessage !== null) { + $this->assertThat($exception, new ExceptionMessage($this->expectedExceptionMessage)); + } + if ($this->expectedExceptionMessageRegExp !== null) { + $this->assertThat($exception, new ExceptionMessageRegularExpression($this->expectedExceptionMessageRegExp)); + } + if ($this->expectedExceptionCode !== null) { + $this->assertThat($exception, new ExceptionCode($this->expectedExceptionCode)); + } + return; } - $this->filter = $filter; + if ($this->expectedException !== null) { + $this->assertThat(null, new ExceptionConstraint($this->expectedException)); + } elseif ($this->expectedExceptionMessage !== null) { + $this->numAssertions++; + throw new \PHPUnit\Framework\AssertionFailedError(sprintf('Failed asserting that exception with message "%s" is thrown', $this->expectedExceptionMessage)); + } elseif ($this->expectedExceptionMessageRegExp !== null) { + $this->numAssertions++; + throw new \PHPUnit\Framework\AssertionFailedError(sprintf('Failed asserting that exception with message matching "%s" is thrown', $this->expectedExceptionMessageRegExp)); + } elseif ($this->expectedExceptionCode !== null) { + $this->numAssertions++; + throw new \PHPUnit\Framework\AssertionFailedError(sprintf('Failed asserting that exception with code "%s" is thrown', $this->expectedExceptionCode)); + } + return $testResult; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterIncompleteTestHook extends \PHPUnit\Runner\TestHook -{ - public function executeAfterIncompleteTest(string $test, string $message, float $time) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterLastTestHook extends \PHPUnit\Runner\Hook -{ - public function executeAfterLastTest() : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterRiskyTestHook extends \PHPUnit\Runner\TestHook -{ - public function executeAfterRiskyTest(string $test, string $message, float $time) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterSkippedTestHook extends \PHPUnit\Runner\TestHook -{ - public function executeAfterSkippedTest(string $test, string $message, float $time) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterSuccessfulTestHook extends \PHPUnit\Runner\TestHook -{ - public function executeAfterSuccessfulTest(string $test, float $time) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterTestErrorHook extends \PHPUnit\Runner\TestHook -{ - public function executeAfterTestError(string $test, string $message, float $time) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterTestFailureHook extends \PHPUnit\Runner\TestHook -{ - public function executeAfterTestFailure(string $test, string $message, float $time) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterTestHook extends \PHPUnit\Runner\TestHook -{ /** - * This hook will fire after any test, regardless of the result. + * This method is a wrapper for the ini_set() function that automatically + * resets the modified php.ini setting to its original value after the + * test is run. * - * For more fine grained control, have a look at the other hooks - * that extend PHPUnit\Runner\Hook. + * @throws Exception */ - public function executeAfterTest(string $test, float $time) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface AfterTestWarningHook extends \PHPUnit\Runner\TestHook -{ - public function executeAfterTestWarning(string $test, string $message, float $time) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface BeforeFirstTestHook extends \PHPUnit\Runner\Hook -{ - public function executeBeforeFirstTest() : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface BeforeTestHook extends \PHPUnit\Runner\TestHook -{ - public function executeBeforeTest(string $test) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface Hook -{ -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * This interface, as well as the associated mechanism for extending PHPUnit, - * will be removed in PHPUnit 10. There is no alternative available in this - * version of PHPUnit. - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - * - * @see https://github.com/sebastianbergmann/phpunit/issues/4676 - */ -interface TestHook extends \PHPUnit\Runner\Hook -{ -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -use PHPUnit\Framework\AssertionFailedError; -use PHPUnit\Framework\Test; -use PHPUnit\Framework\TestListener; -use PHPUnit\Framework\TestSuite; -use PHPUnit\Framework\Warning; -use PHPUnit\Util\Test as TestUtil; -use Throwable; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class TestListenerAdapter implements TestListener -{ - /** - * @var TestHook[] - */ - private $hooks = []; - /** - * @var bool - */ - private $lastTestWasNotSuccessful; - public function add(\PHPUnit\Runner\TestHook $hook) : void - { - $this->hooks[] = $hook; - } - public function startTest(Test $test) : void + protected function iniSet(string $varName, string $newValue): void { - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\BeforeTestHook) { - $hook->executeBeforeTest(TestUtil::describeAsString($test)); - } + $currentValue = ini_set($varName, $newValue); + if ($currentValue !== \false) { + $this->iniSettings[$varName] = $currentValue; + } else { + throw new \PHPUnit\Framework\Exception(sprintf('INI setting "%s" could not be set to "%s".', $varName, $newValue)); } - $this->lastTestWasNotSuccessful = \false; } - public function addError(Test $test, Throwable $t, float $time) : void + /** + * This method is a wrapper for the setlocale() function that automatically + * resets the locale to its original value after the test is run. + * + * @throws Exception + */ + protected function setLocale(...$args): void { - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\AfterTestErrorHook) { - $hook->executeAfterTestError(TestUtil::describeAsString($test), $t->getMessage(), $time); - } + if (count($args) < 2) { + throw new \PHPUnit\Framework\Exception(); } - $this->lastTestWasNotSuccessful = \true; - } - public function addWarning(Test $test, Warning $e, float $time) : void - { - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\AfterTestWarningHook) { - $hook->executeAfterTestWarning(TestUtil::describeAsString($test), $e->getMessage(), $time); - } + [$category, $locale] = $args; + if (!in_array($category, self::LOCALE_CATEGORIES, \true)) { + throw new \PHPUnit\Framework\Exception(); } - $this->lastTestWasNotSuccessful = \true; - } - public function addFailure(Test $test, AssertionFailedError $e, float $time) : void - { - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\AfterTestFailureHook) { - $hook->executeAfterTestFailure(TestUtil::describeAsString($test), $e->getMessage(), $time); - } + if (!is_array($locale) && !is_string($locale)) { + throw new \PHPUnit\Framework\Exception(); + } + $this->locale[$category] = setlocale($category, 0); + $result = setlocale(...$args); + if ($result === \false) { + throw new \PHPUnit\Framework\Exception('The locale functionality is not implemented on your platform, ' . 'the specified locale does not exist or the category name is ' . 'invalid.'); } - $this->lastTestWasNotSuccessful = \true; } - public function addIncompleteTest(Test $test, Throwable $t, float $time) : void + /** + * Makes configurable stub for the specified class. + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return Stub&RealInstanceType + */ + protected function createStub(string $originalClassName): Stub { - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\AfterIncompleteTestHook) { - $hook->executeAfterIncompleteTest(TestUtil::describeAsString($test), $t->getMessage(), $time); - } - } - $this->lastTestWasNotSuccessful = \true; + return $this->createMockObject($originalClassName); } - public function addRiskyTest(Test $test, Throwable $t, float $time) : void + /** + * Returns a mock object for the specified class. + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return MockObject&RealInstanceType + */ + protected function createMock(string $originalClassName): MockObject { - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\AfterRiskyTestHook) { - $hook->executeAfterRiskyTest(TestUtil::describeAsString($test), $t->getMessage(), $time); - } - } - $this->lastTestWasNotSuccessful = \true; + return $this->createMockObject($originalClassName); } - public function addSkippedTest(Test $test, Throwable $t, float $time) : void + /** + * Returns a configured mock object for the specified class. + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return MockObject&RealInstanceType + */ + protected function createConfiguredMock(string $originalClassName, array $configuration): MockObject { - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\AfterSkippedTestHook) { - $hook->executeAfterSkippedTest(TestUtil::describeAsString($test), $t->getMessage(), $time); - } + $o = $this->createMockObject($originalClassName); + foreach ($configuration as $method => $return) { + $o->method($method)->willReturn($return); } - $this->lastTestWasNotSuccessful = \true; + return $o; } - public function endTest(Test $test, float $time) : void + /** + * Returns a partial mock object for the specified class. + * + * @param string[] $methods + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return MockObject&RealInstanceType + */ + protected function createPartialMock(string $originalClassName, array $methods): MockObject { - if (!$this->lastTestWasNotSuccessful) { - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\AfterSuccessfulTestHook) { - $hook->executeAfterSuccessfulTest(TestUtil::describeAsString($test), $time); - } - } + try { + $reflector = new ReflectionClass($originalClassName); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); } - foreach ($this->hooks as $hook) { - if ($hook instanceof \PHPUnit\Runner\AfterTestHook) { - $hook->executeAfterTest(TestUtil::describeAsString($test), $time); - } + // @codeCoverageIgnoreEnd + $mockedMethodsThatDontExist = array_filter($methods, static function (string $method) use ($reflector) { + return !$reflector->hasMethod($method); + }); + if ($mockedMethodsThatDontExist) { + $this->addWarning(sprintf('createPartialMock() called with method(s) %s that do not exist in %s. This will not be allowed in future versions of PHPUnit.', implode(', ', $mockedMethodsThatDontExist), $originalClassName)); } + return $this->getMockBuilder($originalClassName)->disableOriginalConstructor()->disableOriginalClone()->disableArgumentCloning()->disallowMockingUnknownTypes()->setMethods(empty($methods) ? null : $methods)->getMock(); } - public function startTestSuite(TestSuite $suite) : void - { - } - public function endTestSuite(TestSuite $suite) : void - { - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class NullTestResultCache implements \PHPUnit\Runner\TestResultCache -{ - public function setState(string $testName, int $state) : void - { - } - public function getState(string $testName) : int - { - return \PHPUnit\Runner\BaseTestRunner::STATUS_UNKNOWN; - } - public function setTime(string $testName, float $time) : void - { - } - public function getTime(string $testName) : float + /** + * Returns a test proxy for the specified class. + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return MockObject&RealInstanceType + */ + protected function createTestProxy(string $originalClassName, array $constructorArguments = []): MockObject { - return 0; + return $this->getMockBuilder($originalClassName)->setConstructorArgs($constructorArguments)->enableProxyingToOriginalMethods()->getMock(); } - public function load() : void + /** + * Mocks the specified class and returns the name of the mocked class. + * + * @param null|array $methods $methods + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string|string $originalClassName + * + * @psalm-return class-string + * + * @deprecated + */ + protected function getMockClass(string $originalClassName, $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \false, bool $callOriginalClone = \true, bool $callAutoload = \true, bool $cloneArguments = \false): string { + $this->addWarning('PHPUnit\Framework\TestCase::getMockClass() is deprecated and will be removed in PHPUnit 10.'); + $this->recordDoubledType($originalClassName); + $mock = $this->getMockObjectGenerator()->getMock($originalClassName, $methods, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $cloneArguments); + return get_class($mock); } - public function persist() : void + /** + * Returns a mock object for the specified abstract class with all abstract + * methods of the class mocked. Concrete methods are not mocked by default. + * To mock concrete methods, use the 7th parameter ($mockedMethods). + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return MockObject&RealInstanceType + */ + protected function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, array $mockedMethods = [], bool $cloneArguments = \false): MockObject { + $this->recordDoubledType($originalClassName); + $mockObject = $this->getMockObjectGenerator()->getMockForAbstractClass($originalClassName, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments); + $this->registerMockObject($mockObject); + return $mockObject; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -use const DEBUG_BACKTRACE_IGNORE_ARGS; -use const DIRECTORY_SEPARATOR; -use function array_merge; -use function basename; -use function debug_backtrace; -use function defined; -use function dirname; -use function explode; -use function extension_loaded; -use function file; -use function file_get_contents; -use function file_put_contents; -use function is_array; -use function is_file; -use function is_readable; -use function is_string; -use function ltrim; -use function phpversion; -use function preg_match; -use function preg_replace; -use function preg_split; -use function realpath; -use function rtrim; -use function sprintf; -use function str_replace; -use function strncasecmp; -use function strpos; -use function substr; -use function trim; -use function unlink; -use function unserialize; -use function var_export; -use function version_compare; -use PHPUnit\Framework\Assert; -use PHPUnit\Framework\AssertionFailedError; -use PHPUnit\Framework\ExecutionOrderDependency; -use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Framework\IncompleteTestError; -use PHPUnit\Framework\PHPTAssertionFailedError; -use PHPUnit\Framework\Reorderable; -use PHPUnit\Framework\SelfDescribing; -use PHPUnit\Framework\SkippedTestError; -use PHPUnit\Framework\SyntheticSkippedError; -use PHPUnit\Framework\Test; -use PHPUnit\Framework\TestResult; -use PHPUnit\Util\PHP\AbstractPhpProcess; -use PHPUnit\SebastianBergmann\CodeCoverage\RawCodeCoverageData; -use PHPUnit\SebastianBergmann\Template\Template; -use PHPUnit\SebastianBergmann\Timer\Timer; -use Throwable; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class PhptTestCase implements Reorderable, SelfDescribing, Test -{ /** - * @var string + * Returns a mock object based on the given WSDL file. + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string|string $originalClassName + * + * @psalm-return MockObject&RealInstanceType */ - private $filename; + protected function getMockFromWsdl(string $wsdlFile, string $originalClassName = '', string $mockClassName = '', array $methods = [], bool $callOriginalConstructor = \true, array $options = []): MockObject + { + $this->recordDoubledType(SoapClient::class); + if ($originalClassName === '') { + $fileName = pathinfo(basename(parse_url($wsdlFile, PHP_URL_PATH)), PATHINFO_FILENAME); + $originalClassName = preg_replace('/\W/', '', $fileName); + } + if (!class_exists($originalClassName)) { + eval($this->getMockObjectGenerator()->generateClassFromWsdl($wsdlFile, $originalClassName, $methods, $options)); + } + $mockObject = $this->getMockObjectGenerator()->getMock($originalClassName, $methods, ['', $options], $mockClassName, $callOriginalConstructor, \false, \false); + $this->registerMockObject($mockObject); + return $mockObject; + } /** - * @var AbstractPhpProcess + * Returns a mock object for the specified trait with all abstract methods + * of the trait mocked. Concrete methods to mock can be specified with the + * `$mockedMethods` parameter. + * + * @psalm-param trait-string $traitName */ - private $phpUtil; + protected function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true, array $mockedMethods = [], bool $cloneArguments = \false): MockObject + { + $this->recordDoubledType($traitName); + $mockObject = $this->getMockObjectGenerator()->getMockForTrait($traitName, $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments); + $this->registerMockObject($mockObject); + return $mockObject; + } /** - * @var string + * Returns an object for the specified trait. + * + * @psalm-param trait-string $traitName */ - private $output = ''; + protected function getObjectForTrait(string $traitName, array $arguments = [], string $traitClassName = '', bool $callOriginalConstructor = \true, bool $callOriginalClone = \true, bool $callAutoload = \true): object + { + $this->recordDoubledType($traitName); + return $this->getMockObjectGenerator()->getObjectForTrait($traitName, $traitClassName, $callAutoload, $callOriginalConstructor, $arguments); + } /** - * Constructs a test case with the given filename. + * @throws ClassNotFoundException + * @throws DoubleException + * @throws InterfaceNotFoundException * - * @throws Exception + * @psalm-param class-string|null $classOrInterface + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4141 */ - public function __construct(string $filename, AbstractPhpProcess $phpUtil = null) + protected function prophesize(?string $classOrInterface = null): ObjectProphecy { - if (!is_file($filename)) { - throw new \PHPUnit\Runner\Exception(sprintf('File "%s" does not exist.', $filename)); + if (!class_exists(Prophet::class)) { + throw new \PHPUnit\Framework\Exception('This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".'); } - $this->filename = $filename; - $this->phpUtil = $phpUtil ?: AbstractPhpProcess::factory(); + $this->addWarning('PHPUnit\Framework\TestCase::prophesize() is deprecated and will be removed in PHPUnit 10. Please use the trait provided by phpspec/prophecy-phpunit.'); + if (is_string($classOrInterface)) { + $this->recordDoubledType($classOrInterface); + } + return $this->getProphet()->prophesize($classOrInterface); } /** - * Counts the number of test cases executed by run(TestResult result). + * Creates a default TestResult object. + * + * @internal This method is not covered by the backward compatibility promise for PHPUnit */ - public function count() : int + protected function createResult(): \PHPUnit\Framework\TestResult { - return 1; + return new \PHPUnit\Framework\TestResult(); } /** - * Runs a test and collects its result in a TestResult instance. + * This method is called when a test method did not execute successfully. * - * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException - * @throws \SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception + * @throws Throwable */ - public function run(TestResult $result = null) : TestResult + protected function onNotSuccessfulTest(Throwable $t): void { - if ($result === null) { - $result = new TestResult(); - } - try { - $sections = $this->parse(); - } catch (\PHPUnit\Runner\Exception $e) { - $result->startTest($this); - $result->addFailure($this, new SkippedTestError($e->getMessage()), 0); - $result->endTest($this, 0); - return $result; + throw $t; + } + protected function recordDoubledType(string $originalClassName): void + { + $this->doubledTypes[] = $originalClassName; + } + /** + * @throws Throwable + */ + private function verifyMockObjects(): void + { + foreach ($this->mockObjects as $mockObject) { + if ($mockObject->__phpunit_hasMatchers()) { + $this->numAssertions++; + } + $mockObject->__phpunit_verify($this->shouldInvocationMockerBeReset($mockObject)); } - $code = $this->render($sections['FILE']); - $xfail = \false; - $settings = $this->parseIniSection($this->settings($result->getCollectCodeCoverageInformation())); - $result->startTest($this); - if (isset($sections['INI'])) { - $settings = $this->parseIniSection($sections['INI'], $settings); + if ($this->prophet !== null) { + try { + $this->prophet->checkPredictions(); + } finally { + foreach ($this->prophet->getProphecies() as $objectProphecy) { + foreach ($objectProphecy->getMethodProphecies() as $methodProphecies) { + foreach ($methodProphecies as $methodProphecy) { + /* @var MethodProphecy $methodProphecy */ + $this->numAssertions += count($methodProphecy->getCheckedPredictions()); + } + } + } + } } - if (isset($sections['ENV'])) { - $env = $this->parseEnvSection($sections['ENV']); - $this->phpUtil->setEnv($env); + } + /** + * @throws SkippedTestError + * @throws SyntheticSkippedError + * @throws Warning + */ + private function checkRequirements(): void + { + if (!$this->name || !method_exists($this, $this->name)) { + return; } - $this->phpUtil->setUseStderrRedirection(\true); - if ($result->enforcesTimeLimit()) { - $this->phpUtil->setTimeout($result->getTimeoutForLargeTests()); + $missingRequirements = TestUtil::getMissingRequirements(static::class, $this->name); + if (!empty($missingRequirements)) { + $this->markTestSkipped(implode(PHP_EOL, $missingRequirements)); } - $skip = $this->runSkip($sections, $result, $settings); - if ($skip) { - return $result; + } + private function handleDependencies(): bool + { + if ([] === $this->dependencies || $this->inIsolation) { + return \true; } - if (isset($sections['XFAIL'])) { - $xfail = trim($sections['XFAIL']); + $passed = $this->result->passed(); + $passedKeys = array_keys($passed); + $numKeys = count($passedKeys); + for ($i = 0; $i < $numKeys; $i++) { + $pos = strpos($passedKeys[$i], ' with data set'); + if ($pos !== \false) { + $passedKeys[$i] = substr($passedKeys[$i], 0, $pos); + } } - if (isset($sections['STDIN'])) { - $this->phpUtil->setStdin($sections['STDIN']); - } - if (isset($sections['ARGS'])) { - $this->phpUtil->setArgs($sections['ARGS']); - } - if ($result->getCollectCodeCoverageInformation()) { - $codeCoverageCacheDirectory = null; - $pathCoverage = \false; - $codeCoverage = $result->getCodeCoverage(); - if ($codeCoverage) { - if ($codeCoverage->cachesStaticAnalysis()) { - $codeCoverageCacheDirectory = $codeCoverage->cacheDirectory(); + $passedKeys = array_flip(array_unique($passedKeys)); + foreach ($this->dependencies as $dependency) { + if (!$dependency->isValid()) { + $this->markSkippedForNotSpecifyingDependency(); + return \false; + } + if ($dependency->targetIsClass()) { + $dependencyClassName = $dependency->getTargetClassName(); + if (array_search($dependencyClassName, $this->result->passedClasses(), \true) === \false) { + $this->markSkippedForMissingDependency($dependency); + return \false; } - $pathCoverage = $codeCoverage->collectsBranchAndPathCoverage(); + continue; } - $this->renderForCoverage($code, $pathCoverage, $codeCoverageCacheDirectory); - } - $timer = new Timer(); - $timer->start(); - $jobResult = $this->phpUtil->runJob($code, $this->stringifyIni($settings)); - $time = $timer->stop()->asSeconds(); - $this->output = $jobResult['stdout'] ?? ''; - if (isset($codeCoverage) && ($coverage = $this->cleanupForCoverage())) { - $codeCoverage->append($coverage, $this, \true, [], []); - } - try { - $this->assertPhptExpectation($sections, $this->output); - } catch (AssertionFailedError $e) { - $failure = $e; - if ($xfail !== \false) { - $failure = new IncompleteTestError($xfail, 0, $e); - } elseif ($e instanceof ExpectationFailedException) { - $comparisonFailure = $e->getComparisonFailure(); - if ($comparisonFailure) { - $diff = $comparisonFailure->getDiff(); + $dependencyTarget = $dependency->getTarget(); + if (!isset($passedKeys[$dependencyTarget])) { + if (!$this->isCallableTestMethod($dependencyTarget)) { + $this->markWarningForUncallableDependency($dependency); } else { - $diff = $e->getMessage(); + $this->markSkippedForMissingDependency($dependency); } - $hint = $this->getLocationHintFromDiff($diff, $sections); - $trace = array_merge($hint, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); - $failure = new PHPTAssertionFailedError($e->getMessage(), 0, $trace[0]['file'], $trace[0]['line'], $trace, $comparisonFailure ? $diff : ''); + return \false; + } + if (isset($passed[$dependencyTarget])) { + if ($passed[$dependencyTarget]['size'] != TestUtil::UNKNOWN && $this->getSize() != TestUtil::UNKNOWN && $passed[$dependencyTarget]['size'] > $this->getSize()) { + $this->result->addError($this, new \PHPUnit\Framework\SkippedTestError('This test depends on a test that is larger than itself.'), 0); + return \false; + } + if ($dependency->useDeepClone()) { + $deepCopy = new DeepCopy(); + $deepCopy->skipUncloneable(\false); + $this->dependencyInput[$dependencyTarget] = $deepCopy->copy($passed[$dependencyTarget]['result']); + } elseif ($dependency->useShallowClone()) { + $this->dependencyInput[$dependencyTarget] = clone $passed[$dependencyTarget]['result']; + } else { + $this->dependencyInput[$dependencyTarget] = $passed[$dependencyTarget]['result']; + } + } else { + $this->dependencyInput[$dependencyTarget] = null; } - $result->addFailure($this, $failure, $time); - } catch (Throwable $t) { - $result->addError($this, $t, $time); - } - if ($xfail !== \false && $result->allCompletelyImplemented()) { - $result->addFailure($this, new IncompleteTestError('XFAIL section but test passes'), $time); } - $this->runClean($sections, $result->getCollectCodeCoverageInformation()); - $result->endTest($this, $time); - return $result; - } - /** - * Returns the name of the test case. - */ - public function getName() : string - { - return $this->toString(); - } - /** - * Returns a string representation of the test case. - */ - public function toString() : string - { - return $this->filename; + return \true; } - public function usesDataProvider() : bool + private function markSkippedForNotSpecifyingDependency(): void { - return \false; + $this->status = BaseTestRunner::STATUS_SKIPPED; + $this->result->startTest($this); + $this->result->addError($this, new \PHPUnit\Framework\SkippedTestError('This method has an invalid @depends annotation.'), 0); + $this->result->endTest($this, 0); } - public function getNumAssertions() : int + private function markSkippedForMissingDependency(\PHPUnit\Framework\ExecutionOrderDependency $dependency): void { - return 1; + $this->status = BaseTestRunner::STATUS_SKIPPED; + $this->result->startTest($this); + $this->result->addError($this, new \PHPUnit\Framework\SkippedTestError(sprintf('This test depends on "%s" to pass.', $dependency->getTarget())), 0); + $this->result->endTest($this, 0); } - public function getActualOutput() : string + private function markWarningForUncallableDependency(\PHPUnit\Framework\ExecutionOrderDependency $dependency): void { - return $this->output; + $this->status = BaseTestRunner::STATUS_WARNING; + $this->result->startTest($this); + $this->result->addWarning($this, new \PHPUnit\Framework\Warning(sprintf('This test depends on "%s" which does not exist.', $dependency->getTarget())), 0); + $this->result->endTest($this, 0); } - public function hasOutput() : bool + /** + * Get the mock object generator, creating it if it doesn't exist. + */ + private function getMockObjectGenerator(): MockGenerator { - return !empty($this->output); + if ($this->mockObjectGenerator === null) { + $this->mockObjectGenerator = new MockGenerator(); + } + return $this->mockObjectGenerator; } - public function sortId() : string + private function startOutputBuffering(): void { - return $this->filename; + ob_start(); + $this->outputBufferingActive = \true; + $this->outputBufferingLevel = ob_get_level(); } /** - * @return list + * @throws RiskyTestError */ - public function provides() : array + private function stopOutputBuffering(): void { - return []; + if (ob_get_level() !== $this->outputBufferingLevel) { + while (ob_get_level() >= $this->outputBufferingLevel) { + ob_end_clean(); + } + throw new \PHPUnit\Framework\RiskyTestError('Test code or tested code did not (only) close its own output buffers'); + } + $this->output = ob_get_contents(); + if ($this->outputCallback !== \false) { + $this->output = (string) call_user_func($this->outputCallback, $this->output); + } + ob_end_clean(); + $this->outputBufferingActive = \false; + $this->outputBufferingLevel = ob_get_level(); } - /** - * @return list - */ - public function requires() : array + private function snapshotGlobalState(): void { - return []; + if ($this->runTestInSeparateProcess || $this->inIsolation || !$this->backupGlobals && !$this->backupStaticAttributes) { + return; + } + $this->snapshot = $this->createGlobalStateSnapshot($this->backupGlobals === \true); } /** - * Parse --INI-- section key value pairs and return as array. - * - * @param array|string $content + * @throws InvalidArgumentException + * @throws RiskyTestError */ - private function parseIniSection($content, array $ini = []) : array + private function restoreGlobalState(): void { - if (is_string($content)) { - $content = explode("\n", trim($content)); + if (!$this->snapshot instanceof Snapshot) { + return; } - foreach ($content as $setting) { - if (strpos($setting, '=') === \false) { - continue; - } - $setting = explode('=', $setting, 2); - $name = trim($setting[0]); - $value = trim($setting[1]); - if ($name === 'extension' || $name === 'zend_extension') { - if (!isset($ini[$name])) { - $ini[$name] = []; - } - $ini[$name][] = $value; - continue; + if ($this->beStrictAboutChangesToGlobalState) { + try { + $this->compareGlobalStateSnapshots($this->snapshot, $this->createGlobalStateSnapshot($this->backupGlobals === \true)); + } catch (\PHPUnit\Framework\RiskyTestError $rte) { + // Intentionally left empty } - $ini[$name] = $value; } - return $ini; + $restorer = new Restorer(); + if ($this->backupGlobals) { + $restorer->restoreGlobalVariables($this->snapshot); + } + if ($this->backupStaticAttributes) { + $restorer->restoreStaticAttributes($this->snapshot); + } + $this->snapshot = null; + if (isset($rte)) { + throw $rte; + } } - private function parseEnvSection(string $content) : array + private function createGlobalStateSnapshot(bool $backupGlobals): Snapshot { - $env = []; - foreach (explode("\n", trim($content)) as $e) { - $e = explode('=', trim($e), 2); - if (!empty($e[0]) && isset($e[1])) { - $env[$e[0]] = $e[1]; + $excludeList = new ExcludeList(); + foreach ($this->backupGlobalsExcludeList as $globalVariable) { + $excludeList->addGlobalVariable($globalVariable); + } + if (!empty($this->backupGlobalsBlacklist)) { + $this->addWarning('PHPUnit\Framework\TestCase::$backupGlobalsBlacklist is deprecated and will be removed in PHPUnit 10. Please use PHPUnit\Framework\TestCase::$backupGlobalsExcludeList instead.'); + foreach ($this->backupGlobalsBlacklist as $globalVariable) { + $excludeList->addGlobalVariable($globalVariable); } } - return $env; + if (!defined('PHPUNIT_TESTSUITE')) { + $excludeList->addClassNamePrefix('PHPUnit'); + $excludeList->addClassNamePrefix('PHPUnitPHAR\SebastianBergmann\CodeCoverage'); + $excludeList->addClassNamePrefix('PHPUnitPHAR\SebastianBergmann\FileIterator'); + $excludeList->addClassNamePrefix('PHPUnitPHAR\SebastianBergmann\Invoker'); + $excludeList->addClassNamePrefix('PHPUnitPHAR\SebastianBergmann\Template'); + $excludeList->addClassNamePrefix('PHPUnitPHAR\SebastianBergmann\Timer'); + $excludeList->addClassNamePrefix('PHPUnitPHAR\Doctrine\Instantiator'); + $excludeList->addClassNamePrefix('Prophecy'); + $excludeList->addStaticAttribute(ComparatorFactory::class, 'instance'); + foreach ($this->backupStaticAttributesExcludeList as $class => $attributes) { + foreach ($attributes as $attribute) { + $excludeList->addStaticAttribute($class, $attribute); + } + } + if (!empty($this->backupStaticAttributesBlacklist)) { + $this->addWarning('PHPUnit\Framework\TestCase::$backupStaticAttributesBlacklist is deprecated and will be removed in PHPUnit 10. Please use PHPUnit\Framework\TestCase::$backupStaticAttributesExcludeList instead.'); + foreach ($this->backupStaticAttributesBlacklist as $class => $attributes) { + foreach ($attributes as $attribute) { + $excludeList->addStaticAttribute($class, $attribute); + } + } + } + } + return new Snapshot($excludeList, $backupGlobals, (bool) $this->backupStaticAttributes, \false, \false, \false, \false, \false, \false, \false); } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception - * @throws ExpectationFailedException + * @throws InvalidArgumentException + * @throws RiskyTestError */ - private function assertPhptExpectation(array $sections, string $output) : void + private function compareGlobalStateSnapshots(Snapshot $before, Snapshot $after): void { - $assertions = ['EXPECT' => 'assertEquals', 'EXPECTF' => 'assertStringMatchesFormat', 'EXPECTREGEX' => 'assertMatchesRegularExpression']; - $actual = preg_replace('/\\r\\n/', "\n", trim($output)); - foreach ($assertions as $sectionName => $sectionAssertion) { - if (isset($sections[$sectionName])) { - $sectionContent = preg_replace('/\\r\\n/', "\n", trim($sections[$sectionName])); - $expected = $sectionName === 'EXPECTREGEX' ? "/{$sectionContent}/" : $sectionContent; - if ($expected === '') { - throw new \PHPUnit\Runner\Exception('No PHPT expectation found'); - } - Assert::$sectionAssertion($expected, $actual); - return; - } + $backupGlobals = $this->backupGlobals === null || $this->backupGlobals; + if ($backupGlobals) { + $this->compareGlobalStateSnapshotPart($before->globalVariables(), $after->globalVariables(), "--- Global variables before the test\n+++ Global variables after the test\n"); + $this->compareGlobalStateSnapshotPart($before->superGlobalVariables(), $after->superGlobalVariables(), "--- Super-global variables before the test\n+++ Super-global variables after the test\n"); + } + if ($this->backupStaticAttributes) { + $this->compareGlobalStateSnapshotPart($before->staticAttributes(), $after->staticAttributes(), "--- Static attributes before the test\n+++ Static attributes after the test\n"); } - throw new \PHPUnit\Runner\Exception('No PHPT assertion found'); } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws RiskyTestError */ - private function runSkip(array &$sections, TestResult $result, array $settings) : bool + private function compareGlobalStateSnapshotPart(array $before, array $after, string $header): void { - if (!isset($sections['SKIPIF'])) { - return \false; - } - $skipif = $this->render($sections['SKIPIF']); - $jobResult = $this->phpUtil->runJob($skipif, $this->stringifyIni($settings)); - if (!strncasecmp('skip', ltrim($jobResult['stdout']), 4)) { - $message = ''; - if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $jobResult['stdout'], $skipMatch)) { - $message = substr($skipMatch[1], 2); - } - $hint = $this->getLocationHint($message, $sections, 'SKIPIF'); - $trace = array_merge($hint, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); - $result->addFailure($this, new SyntheticSkippedError($message, 0, $trace[0]['file'], $trace[0]['line'], $trace), 0); - $result->endTest($this, 0); - return \true; + if ($before != $after) { + $differ = new Differ($header); + $exporter = new Exporter(); + $diff = $differ->diff($exporter->export($before), $exporter->export($after)); + throw new \PHPUnit\Framework\RiskyTestError($diff); } - return \false; } - private function runClean(array &$sections, bool $collectCoverage) : void + private function getProphet(): Prophet { - $this->phpUtil->setStdin(''); - $this->phpUtil->setArgs(''); - if (isset($sections['CLEAN'])) { - $cleanCode = $this->render($sections['CLEAN']); - $this->phpUtil->runJob($cleanCode, $this->settings($collectCoverage)); + if ($this->prophet === null) { + $this->prophet = new Prophet(); } + return $this->prophet; } /** - * @throws Exception + * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException */ - private function parse() : array + private function shouldInvocationMockerBeReset(MockObject $mock): bool { - $sections = []; - $section = ''; - $unsupportedSections = ['CGI', 'COOKIE', 'DEFLATE_POST', 'EXPECTHEADERS', 'EXTENSIONS', 'GET', 'GZIP_POST', 'HEADERS', 'PHPDBG', 'POST', 'POST_RAW', 'PUT', 'REDIRECTTEST', 'REQUEST']; - $lineNr = 0; - foreach (file($this->filename) as $line) { - $lineNr++; - if (preg_match('/^--([_A-Z]+)--/', $line, $result)) { - $section = $result[1]; - $sections[$section] = ''; - $sections[$section . '_offset'] = $lineNr; - continue; - } - if (empty($section)) { - throw new \PHPUnit\Runner\Exception('Invalid PHPT file: empty section header'); + $enumerator = new Enumerator(); + foreach ($enumerator->enumerate($this->dependencyInput) as $object) { + if ($mock === $object) { + return \false; } - $sections[$section] .= $line; - } - if (isset($sections['FILEEOF'])) { - $sections['FILE'] = rtrim($sections['FILEEOF'], "\r\n"); - unset($sections['FILEEOF']); - } - $this->parseExternal($sections); - if (!$this->validate($sections)) { - throw new \PHPUnit\Runner\Exception('Invalid PHPT file'); } - foreach ($unsupportedSections as $section) { - if (isset($sections[$section])) { - throw new \PHPUnit\Runner\Exception("PHPUnit does not support PHPT {$section} sections"); - } + if (!is_array($this->testResult) && !is_object($this->testResult)) { + return \true; } - return $sections; + return !in_array($mock, $enumerator->enumerate($this->testResult), \true); } /** - * @throws Exception + * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException + * @throws \SebastianBergmann\ObjectReflector\InvalidArgumentException + * @throws InvalidArgumentException */ - private function parseExternal(array &$sections) : void + private function registerMockObjectsFromTestArguments(array $testArguments, array &$visited = []): void { - $allowSections = ['FILE', 'EXPECT', 'EXPECTF', 'EXPECTREGEX']; - $testDirectory = dirname($this->filename) . DIRECTORY_SEPARATOR; - foreach ($allowSections as $section) { - if (isset($sections[$section . '_EXTERNAL'])) { - $externalFilename = trim($sections[$section . '_EXTERNAL']); - if (!is_file($testDirectory . $externalFilename) || !is_readable($testDirectory . $externalFilename)) { - throw new \PHPUnit\Runner\Exception(sprintf('Could not load --%s-- %s for PHPT file', $section . '_EXTERNAL', $testDirectory . $externalFilename)); + if ($this->registerMockObjectsFromTestArgumentsRecursively) { + foreach ((new Enumerator())->enumerate($testArguments) as $object) { + if ($object instanceof MockObject) { + $this->registerMockObject($object); } - $sections[$section] = file_get_contents($testDirectory . $externalFilename); } - } - } - private function validate(array &$sections) : bool - { - $requiredSections = ['FILE', ['EXPECT', 'EXPECTF', 'EXPECTREGEX']]; - foreach ($requiredSections as $section) { - if (is_array($section)) { - $foundSection = \false; - foreach ($section as $anySection) { - if (isset($sections[$anySection])) { - $foundSection = \true; - break; - } - } - if (!$foundSection) { - return \false; + } else { + foreach ($testArguments as $testArgument) { + if ($testArgument instanceof MockObject) { + $testArgument = Cloner::clone($testArgument); + $this->registerMockObject($testArgument); + } elseif (is_array($testArgument) && !in_array($testArgument, $visited, \true)) { + $visited[] = $testArgument; + $this->registerMockObjectsFromTestArguments($testArgument, $visited); } - continue; - } - if (!isset($sections[$section])) { - return \false; } } - return \true; - } - private function render(string $code) : string - { - return str_replace(['__DIR__', '__FILE__'], ["'" . dirname($this->filename) . "'", "'" . $this->filename . "'"], $code); } - private function getCoverageFiles() : array + private function setDoesNotPerformAssertionsFromAnnotation(): void { - $baseDir = dirname(realpath($this->filename)) . DIRECTORY_SEPARATOR; - $basename = basename($this->filename, 'phpt'); - return ['coverage' => $baseDir . $basename . 'coverage', 'job' => $baseDir . $basename . 'php']; + $annotations = TestUtil::parseTestMethodAnnotations(static::class, $this->name); + if (isset($annotations['method']['doesNotPerformAssertions'])) { + $this->doesNotPerformAssertions = \true; + } } - private function renderForCoverage(string &$job, bool $pathCoverage, ?string $codeCoverageCacheDirectory) : void + private function unregisterCustomComparators(): void { - $files = $this->getCoverageFiles(); - $template = new Template(__DIR__ . '/../Util/PHP/Template/PhptTestCase.tpl'); - $composerAutoload = '\'\''; - if (defined('PHPUNIT_COMPOSER_INSTALL')) { - $composerAutoload = var_export(PHPUNIT_COMPOSER_INSTALL, \true); - } - $phar = '\'\''; - if (defined('__PHPUNIT_PHAR__')) { - $phar = var_export(__PHPUNIT_PHAR__, \true); - } - $globals = ''; - if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { - $globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . var_export($GLOBALS['__PHPUNIT_BOOTSTRAP'], \true) . ";\n"; - } - if ($codeCoverageCacheDirectory === null) { - $codeCoverageCacheDirectory = 'null'; - } else { - $codeCoverageCacheDirectory = "'" . $codeCoverageCacheDirectory . "'"; + $factory = ComparatorFactory::getInstance(); + foreach ($this->customComparators as $comparator) { + $factory->unregister($comparator); } - $template->setVar(['composerAutoload' => $composerAutoload, 'phar' => $phar, 'globals' => $globals, 'job' => $files['job'], 'coverageFile' => $files['coverage'], 'driverMethod' => $pathCoverage ? 'forLineAndPathCoverage' : 'forLineCoverage', 'codeCoverageCacheDirectory' => $codeCoverageCacheDirectory]); - file_put_contents($files['job'], $job); - $job = $template->render(); + $this->customComparators = []; } - private function cleanupForCoverage() : RawCodeCoverageData + private function cleanupIniSettings(): void { - $coverage = RawCodeCoverageData::fromXdebugWithoutPathCoverage([]); - $files = $this->getCoverageFiles(); - if (is_file($files['coverage'])) { - $buffer = @file_get_contents($files['coverage']); - if ($buffer !== \false) { - $coverage = @unserialize($buffer); - if ($coverage === \false) { - $coverage = RawCodeCoverageData::fromXdebugWithoutPathCoverage([]); - } - } - } - foreach ($files as $file) { - @unlink($file); + foreach ($this->iniSettings as $varName => $oldValue) { + ini_set($varName, $oldValue); } - return $coverage; + $this->iniSettings = []; } - private function stringifyIni(array $ini) : array + private function cleanupLocaleSettings(): void { - $settings = []; - foreach ($ini as $key => $value) { - if (is_array($value)) { - foreach ($value as $val) { - $settings[] = $key . '=' . $val; - } - continue; - } - $settings[] = $key . '=' . $value; + foreach ($this->locale as $category => $locale) { + setlocale($category, $locale); } - return $settings; + $this->locale = []; } - private function getLocationHintFromDiff(string $message, array $sections) : array + /** + * @throws Exception + */ + private function checkExceptionExpectations(Throwable $throwable): bool { - $needle = ''; - $previousLine = ''; - $block = 'message'; - foreach (preg_split('/\\r\\n|\\r|\\n/', $message) as $line) { - $line = trim($line); - if ($block === 'message' && $line === '--- Expected') { - $block = 'expected'; - } - if ($block === 'expected' && $line === '@@ @@') { - $block = 'diff'; - } - if ($block === 'diff') { - if (strpos($line, '+') === 0) { - $needle = $this->getCleanDiffLine($previousLine); - break; - } - if (strpos($line, '-') === 0) { - $needle = $this->getCleanDiffLine($line); - break; - } + $result = \false; + if ($this->expectedException !== null || $this->expectedExceptionCode !== null || $this->expectedExceptionMessage !== null || $this->expectedExceptionMessageRegExp !== null) { + $result = \true; + } + if ($throwable instanceof \PHPUnit\Framework\Exception) { + $result = \false; + } + if (is_string($this->expectedException)) { + try { + $reflector = new ReflectionClass($this->expectedException); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); } - if (!empty($line)) { - $previousLine = $line; + // @codeCoverageIgnoreEnd + if ($this->expectedException === 'PHPUnit\Framework\Exception' || $this->expectedException === '\PHPUnit\Framework\Exception' || $reflector->isSubclassOf(\PHPUnit\Framework\Exception::class)) { + $result = \true; } } - return $this->getLocationHint($needle, $sections); + return $result; } - private function getCleanDiffLine(string $line) : string + private function runInSeparateProcess(): bool { - if (preg_match('/^[\\-+]([\'\\"]?)(.*)\\1$/', $line, $matches)) { - $line = $matches[2]; - } - return $line; + return ($this->runTestInSeparateProcess || $this->runClassInSeparateProcess) && !$this->inIsolation && !$this instanceof PhptTestCase; } - private function getLocationHint(string $needle, array $sections, ?string $sectionName = null) : array + private function isCallableTestMethod(string $dependency): bool { - $needle = trim($needle); - if (empty($needle)) { - return [['file' => realpath($this->filename), 'line' => 1]]; + [$className, $methodName] = explode('::', $dependency); + if (!class_exists($className)) { + return \false; } - if ($sectionName) { - $search = [$sectionName]; - } else { - $search = [ - // 'FILE', - 'EXPECT', - 'EXPECTF', - 'EXPECTREGEX', - ]; + try { + $class = new ReflectionClass($className); + } catch (ReflectionException $e) { + return \false; } - $sectionOffset = null; - foreach ($search as $section) { - if (!isset($sections[$section])) { - continue; - } - if (isset($sections[$section . '_EXTERNAL'])) { - $externalFile = trim($sections[$section . '_EXTERNAL']); - return [['file' => realpath(dirname($this->filename) . DIRECTORY_SEPARATOR . $externalFile), 'line' => 1], ['file' => realpath($this->filename), 'line' => ($sections[$section . '_EXTERNAL_offset'] ?? 0) + 1]]; - } - $sectionOffset = $sections[$section . '_offset'] ?? 0; - $offset = $sectionOffset + 1; - foreach (preg_split('/\\r\\n|\\r|\\n/', $sections[$section]) as $line) { - if (strpos($line, $needle) !== \false) { - return [['file' => realpath($this->filename), 'line' => $offset]]; - } - $offset++; - } + if (!$class->isSubclassOf(__CLASS__)) { + return \false; } - if ($sectionName) { - // String not found in specified section, show user the start of the named section - return [['file' => realpath($this->filename), 'line' => $sectionOffset]]; + if (!$class->hasMethod($methodName)) { + return \false; } - // No section specified, show user start of code - return [['file' => realpath($this->filename), 'line' => 1]]; + try { + $method = $class->getMethod($methodName); + } catch (ReflectionException $e) { + return \false; + } + return TestUtil::isTestMethod($method); } /** - * @psalm-return list - */ - private function settings(bool $collectCoverage) : array - { - $settings = ['allow_url_fopen=1', 'auto_append_file=', 'auto_prepend_file=', 'disable_functions=', 'display_errors=1', 'docref_ext=.html', 'docref_root=', 'error_append_string=', 'error_prepend_string=', 'error_reporting=-1', 'html_errors=0', 'log_errors=0', 'open_basedir=', 'output_buffering=Off', 'output_handler=', 'report_memleaks=0', 'report_zend_debug=0']; - if (extension_loaded('pcov')) { - if ($collectCoverage) { - $settings[] = 'pcov.enabled=1'; - } else { - $settings[] = 'pcov.enabled=0'; - } - } - if (extension_loaded('xdebug')) { - if (version_compare(phpversion('xdebug'), '3', '>=')) { - if ($collectCoverage) { - $settings[] = 'xdebug.mode=coverage'; - } else { - $settings[] = 'xdebug.mode=off'; - } - } else { - $settings[] = 'xdebug.default_enable=0'; - if ($collectCoverage) { - $settings[] = 'xdebug.coverage_enable=1'; - } - } - } - return $settings; + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return MockObject&RealInstanceType + */ + private function createMockObject(string $originalClassName): MockObject + { + return $this->getMockBuilder($originalClassName)->disableOriginalConstructor()->disableOriginalClone()->disableArgumentCloning()->disallowMockingUnknownTypes()->getMock(); } } cache = $cache; - } - public function flush() : void - { - $this->cache->persist(); - } - public function executeAfterSuccessfulTest(string $test, float $time) : void - { - $testName = $this->getTestName($test); - $this->cache->setTime($testName, round($time, 3)); - } - public function executeAfterIncompleteTest(string $test, string $message, float $time) : void - { - $testName = $this->getTestName($test); - $this->cache->setTime($testName, round($time, 3)); - $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE); - } - public function executeAfterRiskyTest(string $test, string $message, float $time) : void + private $failedTest; + /** + * @var Throwable + */ + private $thrownException; + /** + * @var string + */ + private $testName; + /** + * Returns a description for an exception. + */ + public static function exceptionToString(Throwable $e): string { - $testName = $this->getTestName($test); - $this->cache->setTime($testName, round($time, 3)); - $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY); + if ($e instanceof \PHPUnit\Framework\SelfDescribing) { + $buffer = $e->toString(); + if ($e instanceof \PHPUnit\Framework\ExpectationFailedException && $e->getComparisonFailure()) { + $buffer .= $e->getComparisonFailure()->getDiff(); + } + if ($e instanceof \PHPUnit\Framework\PHPTAssertionFailedError) { + $buffer .= $e->getDiff(); + } + if (!empty($buffer)) { + $buffer = trim($buffer) . "\n"; + } + return $buffer; + } + if ($e instanceof Error) { + return $e->getMessage() . "\n"; + } + if ($e instanceof \PHPUnit\Framework\ExceptionWrapper) { + return $e->getClassName() . ': ' . $e->getMessage() . "\n"; + } + return get_class($e) . ': ' . $e->getMessage() . "\n"; } - public function executeAfterSkippedTest(string $test, string $message, float $time) : void + /** + * Constructs a TestFailure with the given test and exception. + */ + public function __construct(\PHPUnit\Framework\Test $failedTest, Throwable $t) { - $testName = $this->getTestName($test); - $this->cache->setTime($testName, round($time, 3)); - $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED); + if ($failedTest instanceof \PHPUnit\Framework\SelfDescribing) { + $this->testName = $failedTest->toString(); + } else { + $this->testName = get_class($failedTest); + } + if (!$failedTest instanceof \PHPUnit\Framework\TestCase || !$failedTest->isInIsolation()) { + $this->failedTest = $failedTest; + } + $this->thrownException = $t; } - public function executeAfterTestError(string $test, string $message, float $time) : void + /** + * Returns a short description of the failure. + */ + public function toString(): string { - $testName = $this->getTestName($test); - $this->cache->setTime($testName, round($time, 3)); - $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_ERROR); + return sprintf('%s: %s', $this->testName, $this->thrownException->getMessage()); } - public function executeAfterTestFailure(string $test, string $message, float $time) : void + /** + * Returns a description for the thrown exception. + */ + public function getExceptionAsString(): string { - $testName = $this->getTestName($test); - $this->cache->setTime($testName, round($time, 3)); - $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE); + return self::exceptionToString($this->thrownException); } - public function executeAfterTestWarning(string $test, string $message, float $time) : void + /** + * Returns the name of the failing test (including data set, if any). + */ + public function getTestName(): string { - $testName = $this->getTestName($test); - $this->cache->setTime($testName, round($time, 3)); - $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING); + return $this->testName; } - public function executeAfterLastTest() : void + /** + * Returns the failing test. + * + * Note: The test object is not set when the test is executed in process + * isolation. + * + * @see Exception + */ + public function failedTest(): ?\PHPUnit\Framework\Test { - $this->flush(); + return $this->failedTest; } /** - * @param string $test A long description format of the current test - * - * @return string The test name without TestSuiteClassName:: and @dataprovider details + * Gets the thrown exception. */ - private function getTestName(string $test) : string + public function thrownException(): Throwable { - $matches = []; - if (preg_match('/^(?\\S+::\\S+)(?:(? with data set (?:#\\d+|"[^"]+"))\\s\\()?/', $test, $matches)) { - $test = $matches['name'] . ($matches['dataname'] ?? ''); - } - return $test; + return $this->thrownException; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -use function array_diff; -use function array_values; -use function basename; -use function class_exists; -use function get_declared_classes; -use function sprintf; -use function stripos; -use function strlen; -use function substr; -use PHPUnit\Framework\TestCase; -use PHPUnit\Util\FileLoader; -use ReflectionClass; -use ReflectionException; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 - */ -final class StandardTestSuiteLoader implements \PHPUnit\Runner\TestSuiteLoader -{ /** - * @throws Exception + * Returns the exception's message. */ - public function load(string $suiteClassFile) : ReflectionClass + public function exceptionMessage(): string { - $suiteClassName = basename($suiteClassFile, '.php'); - $loadedClasses = get_declared_classes(); - if (!class_exists($suiteClassName, \false)) { - /* @noinspection UnusedFunctionResultInspection */ - FileLoader::checkAndLoad($suiteClassFile); - $loadedClasses = array_values(array_diff(get_declared_classes(), $loadedClasses)); - if (empty($loadedClasses)) { - throw new \PHPUnit\Runner\Exception(sprintf('Class %s could not be found in %s', $suiteClassName, $suiteClassFile)); - } - } - if (!class_exists($suiteClassName, \false)) { - $offset = 0 - strlen($suiteClassName); - foreach ($loadedClasses as $loadedClass) { - // @see https://github.com/sebastianbergmann/phpunit/issues/5020 - if (stripos(substr($loadedClass, $offset - 1), '\\' . $suiteClassName) === 0 || stripos(substr($loadedClass, $offset - 1), '_' . $suiteClassName) === 0) { - $suiteClassName = $loadedClass; - break; - } - } - } - if (!class_exists($suiteClassName, \false)) { - throw new \PHPUnit\Runner\Exception(sprintf('Class %s could not be found in %s', $suiteClassName, $suiteClassFile)); - } - try { - $class = new ReflectionClass($suiteClassName); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Runner\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($class->isSubclassOf(TestCase::class)) { - if ($class->isAbstract()) { - throw new \PHPUnit\Runner\Exception(sprintf('Class %s declared in %s is abstract', $suiteClassName, $suiteClassFile)); - } - return $class; - } - if ($class->hasMethod('suite')) { - try { - $method = $class->getMethod('suite'); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Runner\Exception(sprintf('Method %s::suite() declared in %s is abstract', $suiteClassName, $suiteClassFile)); - } - if (!$method->isPublic()) { - throw new \PHPUnit\Runner\Exception(sprintf('Method %s::suite() declared in %s is not public', $suiteClassName, $suiteClassFile)); - } - if (!$method->isStatic()) { - throw new \PHPUnit\Runner\Exception(sprintf('Method %s::suite() declared in %s is not static', $suiteClassName, $suiteClassFile)); - } - } - return $class; + return $this->thrownException()->getMessage(); } - public function reload(ReflectionClass $aClass) : ReflectionClass + /** + * Returns true if the thrown exception + * is of type AssertionFailedError. + */ + public function isFailure(): bool { - return $aClass; + return $this->thrownException() instanceof \PHPUnit\Framework\AssertionFailedError; } } */ - public const ORDER_RANDOMIZED = 1; + private $passedTestClasses = []; + /** + * @var bool + */ + private $currentTestSuiteFailed = \false; + /** + * @var TestFailure[] + */ + private $errors = []; + /** + * @var TestFailure[] + */ + private $failures = []; + /** + * @var TestFailure[] + */ + private $warnings = []; + /** + * @var TestFailure[] + */ + private $notImplemented = []; + /** + * @var TestFailure[] + */ + private $risky = []; + /** + * @var TestFailure[] + */ + private $skipped = []; + /** + * @deprecated Use the `TestHook` interfaces instead + * + * @var TestListener[] + */ + private $listeners = []; /** * @var int */ - public const ORDER_REVERSED = 2; + private $runTests = 0; + /** + * @var float + */ + private $time = 0; + /** + * Code Coverage information. + * + * @var CodeCoverage + */ + private $codeCoverage; + /** + * @var bool + */ + private $convertDeprecationsToExceptions = \false; + /** + * @var bool + */ + private $convertErrorsToExceptions = \true; + /** + * @var bool + */ + private $convertNoticesToExceptions = \true; + /** + * @var bool + */ + private $convertWarningsToExceptions = \true; + /** + * @var bool + */ + private $stop = \false; + /** + * @var bool + */ + private $stopOnError = \false; + /** + * @var bool + */ + private $stopOnFailure = \false; + /** + * @var bool + */ + private $stopOnWarning = \false; + /** + * @var bool + */ + private $beStrictAboutTestsThatDoNotTestAnything = \true; + /** + * @var bool + */ + private $beStrictAboutOutputDuringTests = \false; + /** + * @var bool + */ + private $beStrictAboutTodoAnnotatedTests = \false; + /** + * @var bool + */ + private $beStrictAboutResourceUsageDuringSmallTests = \false; + /** + * @var bool + */ + private $enforceTimeLimit = \false; + /** + * @var bool + */ + private $forceCoversAnnotation = \false; /** * @var int */ - public const ORDER_DEFECTS_FIRST = 3; + private $timeoutForSmallTests = 1; /** * @var int */ - public const ORDER_DURATION = 4; + private $timeoutForMediumTests = 10; /** - * Order tests by @size annotation 'small', 'medium', 'large'. - * * @var int */ - public const ORDER_SIZE = 5; + private $timeoutForLargeTests = 60; /** - * List of sorting weights for all test result codes. A higher number gives higher priority. + * @var bool */ - private const DEFECT_SORT_WEIGHT = [\PHPUnit\Runner\BaseTestRunner::STATUS_ERROR => 6, \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE => 5, \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING => 4, \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE => 3, \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY => 2, \PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED => 1, \PHPUnit\Runner\BaseTestRunner::STATUS_UNKNOWN => 0]; - private const SIZE_SORT_WEIGHT = [TestUtil::SMALL => 1, TestUtil::MEDIUM => 2, TestUtil::LARGE => 3, TestUtil::UNKNOWN => 4]; + private $stopOnRisky = \false; /** - * @var array Associative array of (string => DEFECT_SORT_WEIGHT) elements + * @var bool */ - private $defectSortOrder = []; + private $stopOnIncomplete = \false; /** - * @var TestResultCache + * @var bool */ - private $cache; + private $stopOnSkipped = \false; /** - * @var array A list of normalized names of tests before reordering + * @var bool */ - private $originalExecutionOrder = []; + private $lastTestFailed = \false; /** - * @var array A list of normalized names of tests affected by reordering + * @var int */ - private $executionOrder = []; - public function __construct(?\PHPUnit\Runner\TestResultCache $cache = null) + private $defaultTimeLimit = 0; + /** + * @var bool + */ + private $stopOnDefect = \false; + /** + * @var bool + */ + private $registerMockObjectsFromTestArgumentsRecursively = \false; + /** + * @deprecated Use the `TestHook` interfaces instead + * + * @codeCoverageIgnore + * + * Registers a TestListener. + */ + public function addListener(\PHPUnit\Framework\TestListener $listener): void { - $this->cache = $cache ?? new \PHPUnit\Runner\NullTestResultCache(); + $this->listeners[] = $listener; } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - * @throws Exception + * @deprecated Use the `TestHook` interfaces instead + * + * @codeCoverageIgnore + * + * Unregisters a TestListener. */ - public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects, bool $isRootTestSuite = \true) : void + public function removeListener(\PHPUnit\Framework\TestListener $listener): void { - $allowedOrders = [self::ORDER_DEFAULT, self::ORDER_REVERSED, self::ORDER_RANDOMIZED, self::ORDER_DURATION, self::ORDER_SIZE]; - if (!in_array($order, $allowedOrders, \true)) { - throw new \PHPUnit\Runner\Exception('$order must be one of TestSuiteSorter::ORDER_[DEFAULT|REVERSED|RANDOMIZED|DURATION|SIZE]'); - } - $allowedOrderDefects = [self::ORDER_DEFAULT, self::ORDER_DEFECTS_FIRST]; - if (!in_array($orderDefects, $allowedOrderDefects, \true)) { - throw new \PHPUnit\Runner\Exception('$orderDefects must be one of TestSuiteSorter::ORDER_DEFAULT, TestSuiteSorter::ORDER_DEFECTS_FIRST'); - } - if ($isRootTestSuite) { - $this->originalExecutionOrder = $this->calculateTestExecutionOrder($suite); - } - if ($suite instanceof TestSuite) { - foreach ($suite as $_suite) { - $this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects, \false); - } - if ($orderDefects === self::ORDER_DEFECTS_FIRST) { - $this->addSuiteToDefectSortOrder($suite); + foreach ($this->listeners as $key => $_listener) { + if ($listener === $_listener) { + unset($this->listeners[$key]); } - $this->sort($suite, $order, $resolveDependencies, $orderDefects); - } - if ($isRootTestSuite) { - $this->executionOrder = $this->calculateTestExecutionOrder($suite); } } - public function getOriginalExecutionOrder() : array - { - return $this->originalExecutionOrder; - } - public function getExecutionOrder() : array + /** + * @deprecated Use the `TestHook` interfaces instead + * + * @codeCoverageIgnore + * + * Flushes all flushable TestListeners. + */ + public function flushListeners(): void { - return $this->executionOrder; + foreach ($this->listeners as $listener) { + if ($listener instanceof Printer) { + $listener->flush(); + } + } } - private function sort(TestSuite $suite, int $order, bool $resolveDependencies, int $orderDefects) : void + /** + * Adds an error to the list of errors. + */ + public function addError(\PHPUnit\Framework\Test $test, Throwable $t, float $time): void { - if (empty($suite->tests())) { - return; + if ($t instanceof \PHPUnit\Framework\RiskyTestError) { + $this->recordRisky($test, $t); + $notifyMethod = 'addRiskyTest'; + if ($test instanceof \PHPUnit\Framework\TestCase) { + $test->markAsRisky(); + } + if ($this->stopOnRisky || $this->stopOnDefect) { + $this->stop(); + } + } elseif ($t instanceof \PHPUnit\Framework\IncompleteTest) { + $this->recordNotImplemented($test, $t); + $notifyMethod = 'addIncompleteTest'; + if ($this->stopOnIncomplete) { + $this->stop(); + } + } elseif ($t instanceof \PHPUnit\Framework\SkippedTest) { + $this->recordSkipped($test, $t); + $notifyMethod = 'addSkippedTest'; + if ($this->stopOnSkipped) { + $this->stop(); + } + } else { + $this->recordError($test, $t); + $notifyMethod = 'addError'; + if ($this->stopOnError || $this->stopOnFailure) { + $this->stop(); + } } - if ($order === self::ORDER_REVERSED) { - $suite->setTests($this->reverse($suite->tests())); - } elseif ($order === self::ORDER_RANDOMIZED) { - $suite->setTests($this->randomize($suite->tests())); - } elseif ($order === self::ORDER_DURATION && $this->cache !== null) { - $suite->setTests($this->sortByDuration($suite->tests())); - } elseif ($order === self::ORDER_SIZE) { - $suite->setTests($this->sortBySize($suite->tests())); + // @see https://github.com/sebastianbergmann/phpunit/issues/1953 + if ($t instanceof Error) { + $t = new \PHPUnit\Framework\ExceptionWrapper($t); } - if ($orderDefects === self::ORDER_DEFECTS_FIRST && $this->cache !== null) { - $suite->setTests($this->sortDefectsFirst($suite->tests())); + foreach ($this->listeners as $listener) { + $listener->{$notifyMethod}($test, $t, $time); } - if ($resolveDependencies && !$suite instanceof DataProviderTestSuite) { - /** @var TestCase[] $tests */ - $tests = $suite->tests(); - $suite->setTests($this->resolveDependencies($tests)); + $this->lastTestFailed = \true; + $this->time += $time; + } + /** + * Adds a warning to the list of warnings. + * The passed in exception caused the warning. + */ + public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, float $time): void + { + if ($this->stopOnWarning || $this->stopOnDefect) { + $this->stop(); + } + $this->recordWarning($test, $e); + foreach ($this->listeners as $listener) { + $listener->addWarning($test, $e, $time); } + $this->time += $time; } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Adds a failure to the list of failures. + * The passed in exception caused the failure. */ - private function addSuiteToDefectSortOrder(TestSuite $suite) : void + public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, float $time): void { - $max = 0; - foreach ($suite->tests() as $test) { - if (!$test instanceof Reorderable) { - continue; + if ($e instanceof \PHPUnit\Framework\RiskyTestError || $e instanceof \PHPUnit\Framework\OutputError) { + $this->recordRisky($test, $e); + $notifyMethod = 'addRiskyTest'; + if ($test instanceof \PHPUnit\Framework\TestCase) { + $test->markAsRisky(); } - if (!isset($this->defectSortOrder[$test->sortId()])) { - $this->defectSortOrder[$test->sortId()] = self::DEFECT_SORT_WEIGHT[$this->cache->getState($test->sortId())]; - $max = max($max, $this->defectSortOrder[$test->sortId()]); + if ($this->stopOnRisky || $this->stopOnDefect) { + $this->stop(); + } + } elseif ($e instanceof \PHPUnit\Framework\IncompleteTest) { + $this->recordNotImplemented($test, $e); + $notifyMethod = 'addIncompleteTest'; + if ($this->stopOnIncomplete) { + $this->stop(); + } + } elseif ($e instanceof \PHPUnit\Framework\SkippedTest) { + $this->recordSkipped($test, $e); + $notifyMethod = 'addSkippedTest'; + if ($this->stopOnSkipped) { + $this->stop(); + } + } else { + $this->failures[] = new \PHPUnit\Framework\TestFailure($test, $e); + $notifyMethod = 'addFailure'; + if ($this->stopOnFailure || $this->stopOnDefect) { + $this->stop(); } } - $this->defectSortOrder[$suite->sortId()] = $max; + foreach ($this->listeners as $listener) { + $listener->{$notifyMethod}($test, $e, $time); + } + $this->lastTestFailed = \true; + $this->time += $time; } - private function reverse(array $tests) : array + /** + * Informs the result that a test suite will be started. + */ + public function startTestSuite(\PHPUnit\Framework\TestSuite $suite): void { - return array_reverse($tests); + $this->currentTestSuiteFailed = \false; + foreach ($this->listeners as $listener) { + $listener->startTestSuite($suite); + } } - private function randomize(array $tests) : array + /** + * Informs the result that a test suite was completed. + */ + public function endTestSuite(\PHPUnit\Framework\TestSuite $suite): void { - shuffle($tests); - return $tests; + if (!$this->currentTestSuiteFailed) { + $this->passedTestClasses[] = $suite->getName(); + } + foreach ($this->listeners as $listener) { + $listener->endTestSuite($suite); + } } - private function sortDefectsFirst(array $tests) : array + /** + * Informs the result that a test will be started. + */ + public function startTest(\PHPUnit\Framework\Test $test): void { - usort( - $tests, - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - function ($left, $right) { - return $this->cmpDefectPriorityAndTime($left, $right); - } - ); - return $tests; + $this->lastTestFailed = \false; + $this->runTests += count($test); + foreach ($this->listeners as $listener) { + $listener->startTest($test); + } } - private function sortByDuration(array $tests) : array + /** + * Informs the result that a test was completed. + * + * @throws InvalidArgumentException + */ + public function endTest(\PHPUnit\Framework\Test $test, float $time): void { - usort( - $tests, - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - function ($left, $right) { - return $this->cmpDuration($left, $right); - } - ); - return $tests; + foreach ($this->listeners as $listener) { + $listener->endTest($test, $time); + } + if (!$this->lastTestFailed && $test instanceof \PHPUnit\Framework\TestCase) { + $class = get_class($test); + $key = $class . '::' . $test->getName(); + $this->passed[$key] = ['result' => $test->getResult(), 'size' => TestUtil::getSize($class, $test->getName(\false))]; + $this->time += $time; + } + if ($this->lastTestFailed && $test instanceof \PHPUnit\Framework\TestCase) { + $this->currentTestSuiteFailed = \true; + } } - private function sortBySize(array $tests) : array + /** + * Returns true if no risky test occurred. + */ + public function allHarmless(): bool { - usort( - $tests, - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - function ($left, $right) { - return $this->cmpSize($left, $right); - } - ); - return $tests; + return $this->riskyCount() === 0; } /** - * Comparator callback function to sort tests for "reach failure as fast as possible". - * - * 1. sort tests by defect weight defined in self::DEFECT_SORT_WEIGHT - * 2. when tests are equally defective, sort the fastest to the front - * 3. do not reorder successful tests + * Gets the number of risky tests. + */ + public function riskyCount(): int + { + return count($this->risky); + } + /** + * Returns true if no incomplete test occurred. + */ + public function allCompletelyImplemented(): bool + { + return $this->notImplementedCount() === 0; + } + /** + * Gets the number of incomplete tests. + */ + public function notImplementedCount(): int + { + return count($this->notImplemented); + } + /** + * Returns an array of TestFailure objects for the risky tests. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @return TestFailure[] */ - private function cmpDefectPriorityAndTime(Test $a, Test $b) : int + public function risky(): array { - if (!($a instanceof Reorderable && $b instanceof Reorderable)) { - return 0; - } - $priorityA = $this->defectSortOrder[$a->sortId()] ?? 0; - $priorityB = $this->defectSortOrder[$b->sortId()] ?? 0; - if ($priorityB <=> $priorityA) { - // Sort defect weight descending - return $priorityB <=> $priorityA; - } - if ($priorityA || $priorityB) { - return $this->cmpDuration($a, $b); - } - // do not change execution order - return 0; + return $this->risky; } /** - * Compares test duration for sorting tests by duration ascending. + * Returns an array of TestFailure objects for the incomplete tests. * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @return TestFailure[] */ - private function cmpDuration(Test $a, Test $b) : int + public function notImplemented(): array { - if (!($a instanceof Reorderable && $b instanceof Reorderable)) { - return 0; - } - return $this->cache->getTime($a->sortId()) <=> $this->cache->getTime($b->sortId()); + return $this->notImplemented; } /** - * Compares test size for sorting tests small->medium->large->unknown. + * Returns true if no test has been skipped. */ - private function cmpSize(Test $a, Test $b) : int + public function noneSkipped(): bool { - $sizeA = $a instanceof TestCase || $a instanceof DataProviderTestSuite ? $a->getSize() : TestUtil::UNKNOWN; - $sizeB = $b instanceof TestCase || $b instanceof DataProviderTestSuite ? $b->getSize() : TestUtil::UNKNOWN; - return self::SIZE_SORT_WEIGHT[$sizeA] <=> self::SIZE_SORT_WEIGHT[$sizeB]; + return $this->skippedCount() === 0; } /** - * Reorder Tests within a TestCase in such a way as to resolve as many dependencies as possible. - * The algorithm will leave the tests in original running order when it can. - * For more details see the documentation for test dependencies. - * - * Short description of algorithm: - * 1. Pick the next Test from remaining tests to be checked for dependencies. - * 2. If the test has no dependencies: mark done, start again from the top - * 3. If the test has dependencies but none left to do: mark done, start again from the top - * 4. When we reach the end add any leftover tests to the end. These will be marked 'skipped' during execution. + * Gets the number of skipped tests. + */ + public function skippedCount(): int + { + return count($this->skipped); + } + /** + * Returns an array of TestFailure objects for the skipped tests. * - * @param array $tests + * @return TestFailure[] + */ + public function skipped(): array + { + return $this->skipped; + } + /** + * Gets the number of detected errors. + */ + public function errorCount(): int + { + return count($this->errors); + } + /** + * Returns an array of TestFailure objects for the errors. * - * @return array + * @return TestFailure[] */ - private function resolveDependencies(array $tests) : array + public function errors(): array { - $newTestOrder = []; - $i = 0; - $provided = []; - do { - if ([] === array_diff($tests[$i]->requires(), $provided)) { - $provided = array_merge($provided, $tests[$i]->provides()); - $newTestOrder = array_merge($newTestOrder, array_splice($tests, $i, 1)); - $i = 0; - } else { - $i++; - } - } while (!empty($tests) && $i < count($tests)); - return array_merge($newTestOrder, $tests); + return $this->errors; } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Gets the number of detected failures. */ - private function calculateTestExecutionOrder(Test $suite) : array + public function failureCount(): int { - $tests = []; - if ($suite instanceof TestSuite) { - foreach ($suite->tests() as $test) { - if (!$test instanceof TestSuite && $test instanceof Reorderable) { - $tests[] = $test->sortId(); - } else { - $tests = array_merge($tests, $this->calculateTestExecutionOrder($test)); - } - } - } - return $tests; + return count($this->failures); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Runner; - -use function array_slice; -use function dirname; -use function explode; -use function implode; -use function strpos; -use PHPUnit\SebastianBergmann\Version as VersionId; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final class Version -{ /** - * @var string + * Returns an array of TestFailure objects for the failures. + * + * @return TestFailure[] */ - private static $pharVersion = '9.6.13'; + public function failures(): array + { + return $this->failures; + } /** - * @var string + * Gets the number of detected warnings. */ - private static $version = ''; + public function warningCount(): int + { + return count($this->warnings); + } /** - * Returns the current version of PHPUnit. + * Returns an array of TestFailure objects for the warnings. + * + * @return TestFailure[] */ - public static function id() : string + public function warnings(): array { - if (self::$pharVersion !== '') { - return self::$pharVersion; - } - if (self::$version === '') { - self::$version = (new VersionId('9.6.13', dirname(__DIR__, 2)))->getVersion(); - } - return self::$version; + return $this->warnings; } - public static function series() : string + /** + * Returns the names of the tests that have passed. + */ + public function passed(): array { - if (strpos(self::id(), '-')) { - $version = explode('-', self::id())[0]; - } else { - $version = self::id(); - } - return implode('.', array_slice(explode('.', $version), 0, 2)); + return $this->passed; } - public static function getVersionString() : string + /** + * Returns the names of the TestSuites that have passed. + * + * This enables @depends-annotations for TestClassName::class + */ + public function passedClasses(): array { - return 'PHPUnit ' . self::id() . ' by Sebastian Bergmann and contributors.'; + return $this->passedTestClasses; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\CliArguments; - -use function array_map; -use function array_merge; -use function class_exists; -use function explode; -use function is_numeric; -use function str_replace; -use PHPUnit\Runner\TestSuiteSorter; -use PHPUnit\TextUI\DefaultResultPrinter; -use PHPUnit\TextUI\XmlConfiguration\Extension; -use PHPUnit\Util\Log\TeamCity; -use PHPUnit\Util\TestDox\CliTestDoxPrinter; -use PHPUnit\SebastianBergmann\CliParser\Exception as CliParserException; -use PHPUnit\SebastianBergmann\CliParser\Parser as CliParser; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class Builder -{ - private const LONG_OPTIONS = ['atleast-version=', 'prepend=', 'bootstrap=', 'cache-result', 'do-not-cache-result', 'cache-result-file=', 'check-version', 'colors==', 'columns=', 'configuration=', 'coverage-cache=', 'warm-coverage-cache', 'coverage-filter=', 'coverage-clover=', 'coverage-cobertura=', 'coverage-crap4j=', 'coverage-html=', 'coverage-php=', 'coverage-text==', 'coverage-xml=', 'path-coverage', 'debug', 'disallow-test-output', 'disallow-resource-usage', 'disallow-todo-tests', 'default-time-limit=', 'enforce-time-limit', 'exclude-group=', 'extensions=', 'filter=', 'generate-configuration', 'globals-backup', 'group=', 'covers=', 'uses=', 'help', 'resolve-dependencies', 'ignore-dependencies', 'include-path=', 'list-groups', 'list-suites', 'list-tests', 'list-tests-xml=', 'loader=', 'log-junit=', 'log-teamcity=', 'migrate-configuration', 'no-configuration', 'no-coverage', 'no-logging', 'no-interaction', 'no-extensions', 'order-by=', 'printer=', 'process-isolation', 'repeat=', 'dont-report-useless-tests', 'random-order', 'random-order-seed=', 'reverse-order', 'reverse-list', 'static-backup', 'stderr', 'stop-on-defect', 'stop-on-error', 'stop-on-failure', 'stop-on-warning', 'stop-on-incomplete', 'stop-on-risky', 'stop-on-skipped', 'fail-on-empty-test-suite', 'fail-on-incomplete', 'fail-on-risky', 'fail-on-skipped', 'fail-on-warning', 'strict-coverage', 'disable-coverage-ignore', 'strict-global-state', 'teamcity', 'testdox', 'testdox-group=', 'testdox-exclude-group=', 'testdox-html=', 'testdox-text=', 'testdox-xml=', 'test-suffix=', 'testsuite=', 'verbose', 'version', 'whitelist=', 'dump-xdebug-filter=']; - private const SHORT_OPTIONS = 'd:c:hv'; - public function fromParameters(array $parameters, array $additionalLongOptions) : \PHPUnit\TextUI\CliArguments\Configuration + /** + * Returns whether code coverage information should be collected. + */ + public function getCollectCodeCoverageInformation(): bool + { + return $this->codeCoverage !== null; + } + /** + * Runs a TestCase. + * + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + * @throws CodeCoverageException + * @throws InvalidArgumentException + * @throws UnintentionallyCoveredCodeException + */ + public function run(\PHPUnit\Framework\Test $test): void { + \PHPUnit\Framework\Assert::resetCount(); + $size = TestUtil::UNKNOWN; + if ($test instanceof \PHPUnit\Framework\TestCase) { + $test->setRegisterMockObjectsFromTestArgumentsRecursively($this->registerMockObjectsFromTestArgumentsRecursively); + $isAnyCoverageRequired = TestUtil::requiresCodeCoverageDataCollection($test); + $size = $test->getSize(); + } + $error = \false; + $failure = \false; + $warning = \false; + $incomplete = \false; + $risky = \false; + $skipped = \false; + $this->startTest($test); + if ($this->convertDeprecationsToExceptions || $this->convertErrorsToExceptions || $this->convertNoticesToExceptions || $this->convertWarningsToExceptions) { + $errorHandler = new ErrorHandler($this->convertDeprecationsToExceptions, $this->convertErrorsToExceptions, $this->convertNoticesToExceptions, $this->convertWarningsToExceptions); + $errorHandler->register(); + } + $collectCodeCoverage = $this->codeCoverage !== null && !$test instanceof \PHPUnit\Framework\ErrorTestCase && !$test instanceof \PHPUnit\Framework\WarningTestCase && $isAnyCoverageRequired; + if ($collectCodeCoverage) { + $this->codeCoverage->start($test); + } + $monitorFunctions = $this->beStrictAboutResourceUsageDuringSmallTests && !$test instanceof \PHPUnit\Framework\ErrorTestCase && !$test instanceof \PHPUnit\Framework\WarningTestCase && $size === TestUtil::SMALL && function_exists('xdebug_start_function_monitor'); + if ($monitorFunctions) { + /* @noinspection ForgottenDebugOutputInspection */ + xdebug_start_function_monitor(ResourceOperations::getFunctions()); + } + $timer = new Timer(); + $timer->start(); try { - $options = (new CliParser())->parse($parameters, self::SHORT_OPTIONS, array_merge(self::LONG_OPTIONS, $additionalLongOptions)); - } catch (CliParserException $e) { - throw new \PHPUnit\TextUI\CliArguments\Exception($e->getMessage(), $e->getCode(), $e); + $invoker = new Invoker(); + if (!$test instanceof \PHPUnit\Framework\ErrorTestCase && !$test instanceof \PHPUnit\Framework\WarningTestCase && $this->shouldTimeLimitBeEnforced($size) && $invoker->canInvokeWithTimeout()) { + switch ($size) { + case TestUtil::SMALL: + $_timeout = $this->timeoutForSmallTests; + break; + case TestUtil::MEDIUM: + $_timeout = $this->timeoutForMediumTests; + break; + case TestUtil::LARGE: + $_timeout = $this->timeoutForLargeTests; + break; + default: + $_timeout = $this->defaultTimeLimit; + } + $invoker->invoke([$test, 'runBare'], [], $_timeout); + } else { + $test->runBare(); + } + } catch (TimeoutException $e) { + $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError($e->getMessage()), $_timeout); + $risky = \true; + } catch (\PHPUnit\Framework\AssertionFailedError $e) { + $failure = \true; + if ($e instanceof \PHPUnit\Framework\RiskyTestError) { + $risky = \true; + } elseif ($e instanceof \PHPUnit\Framework\IncompleteTestError) { + $incomplete = \true; + } elseif ($e instanceof \PHPUnit\Framework\SkippedTestError) { + $skipped = \true; + } + } catch (AssertionError $e) { + $test->addToAssertionCount(1); + $failure = \true; + $frame = $e->getTrace()[0]; + $e = new \PHPUnit\Framework\AssertionFailedError(sprintf('%s in %s:%s', $e->getMessage(), $frame['file'] ?? $e->getFile(), $frame['line'] ?? $e->getLine()), 0, $e); + } catch (\PHPUnit\Framework\Warning $e) { + $warning = \true; + } catch (\PHPUnit\Framework\Exception $e) { + $error = \true; + } catch (Throwable $e) { + $e = new \PHPUnit\Framework\ExceptionWrapper($e); + $error = \true; } - $argument = null; - $atLeastVersion = null; - $backupGlobals = null; - $backupStaticAttributes = null; - $beStrictAboutChangesToGlobalState = null; - $beStrictAboutResourceUsageDuringSmallTests = null; - $bootstrap = null; - $cacheResult = null; - $cacheResultFile = null; - $checkVersion = null; - $colors = null; - $columns = null; - $configuration = null; - $coverageCacheDirectory = null; - $warmCoverageCache = null; - $coverageFilter = null; - $coverageClover = null; - $coverageCobertura = null; - $coverageCrap4J = null; - $coverageHtml = null; - $coveragePhp = null; - $coverageText = null; - $coverageTextShowUncoveredFiles = null; - $coverageTextShowOnlySummary = null; - $coverageXml = null; - $pathCoverage = null; - $debug = null; - $defaultTimeLimit = null; - $disableCodeCoverageIgnore = null; - $disallowTestOutput = null; - $disallowTodoAnnotatedTests = null; - $enforceTimeLimit = null; - $excludeGroups = null; - $executionOrder = null; - $executionOrderDefects = null; - $extensions = []; - $unavailableExtensions = []; - $failOnEmptyTestSuite = null; - $failOnIncomplete = null; - $failOnRisky = null; - $failOnSkipped = null; - $failOnWarning = null; - $filter = null; - $generateConfiguration = null; - $migrateConfiguration = null; - $groups = null; - $testsCovering = null; - $testsUsing = null; - $help = null; - $includePath = null; - $iniSettings = []; - $junitLogfile = null; - $listGroups = null; - $listSuites = null; - $listTests = null; - $listTestsXml = null; - $loader = null; - $noCoverage = null; - $noExtensions = null; - $noInteraction = null; - $noLogging = null; - $printer = null; - $processIsolation = null; - $randomOrderSeed = null; - $repeat = null; - $reportUselessTests = null; - $resolveDependencies = null; - $reverseList = null; - $stderr = null; - $strictCoverage = null; - $stopOnDefect = null; - $stopOnError = null; - $stopOnFailure = null; - $stopOnIncomplete = null; - $stopOnRisky = null; - $stopOnSkipped = null; - $stopOnWarning = null; - $teamcityLogfile = null; - $testdoxExcludeGroups = null; - $testdoxGroups = null; - $testdoxHtmlFile = null; - $testdoxTextFile = null; - $testdoxXmlFile = null; - $testSuffixes = null; - $testSuite = null; - $unrecognizedOptions = []; - $unrecognizedOrderBy = null; - $useDefaultConfiguration = null; - $verbose = null; - $version = null; - $xdebugFilterFile = null; - if (isset($options[1][0])) { - $argument = $options[1][0]; - } - foreach ($options[0] as $option) { - switch ($option[0]) { - case '--colors': - $colors = $option[1] ?: DefaultResultPrinter::COLOR_AUTO; - break; - case '--bootstrap': - $bootstrap = $option[1]; - break; - case '--cache-result': - $cacheResult = \true; - break; - case '--do-not-cache-result': - $cacheResult = \false; - break; - case '--cache-result-file': - $cacheResultFile = $option[1]; - break; - case '--columns': - if (is_numeric($option[1])) { - $columns = (int) $option[1]; - } elseif ($option[1] === 'max') { - $columns = 'max'; - } - break; - case 'c': - case '--configuration': - $configuration = $option[1]; - break; - case '--coverage-cache': - $coverageCacheDirectory = $option[1]; - break; - case '--warm-coverage-cache': - $warmCoverageCache = \true; - break; - case '--coverage-clover': - $coverageClover = $option[1]; - break; - case '--coverage-cobertura': - $coverageCobertura = $option[1]; - break; - case '--coverage-crap4j': - $coverageCrap4J = $option[1]; - break; - case '--coverage-html': - $coverageHtml = $option[1]; - break; - case '--coverage-php': - $coveragePhp = $option[1]; - break; - case '--coverage-text': - if ($option[1] === null) { - $option[1] = 'php://stdout'; - } - $coverageText = $option[1]; - $coverageTextShowUncoveredFiles = \false; - $coverageTextShowOnlySummary = \false; - break; - case '--coverage-xml': - $coverageXml = $option[1]; - break; - case '--path-coverage': - $pathCoverage = \true; - break; - case 'd': - $tmp = explode('=', $option[1]); - if (isset($tmp[0])) { - if (isset($tmp[1])) { - $iniSettings[$tmp[0]] = $tmp[1]; - } else { - $iniSettings[$tmp[0]] = '1'; - } - } - break; - case '--debug': - $debug = \true; - break; - case 'h': - case '--help': - $help = \true; - break; - case '--filter': - $filter = $option[1]; - break; - case '--testsuite': - $testSuite = $option[1]; - break; - case '--generate-configuration': - $generateConfiguration = \true; - break; - case '--migrate-configuration': - $migrateConfiguration = \true; - break; - case '--group': - $groups = explode(',', $option[1]); - break; - case '--exclude-group': - $excludeGroups = explode(',', $option[1]); - break; - case '--covers': - $testsCovering = array_map('strtolower', explode(',', $option[1])); - break; - case '--uses': - $testsUsing = array_map('strtolower', explode(',', $option[1])); - break; - case '--test-suffix': - $testSuffixes = explode(',', $option[1]); - break; - case '--include-path': - $includePath = $option[1]; - break; - case '--list-groups': - $listGroups = \true; - break; - case '--list-suites': - $listSuites = \true; - break; - case '--list-tests': - $listTests = \true; - break; - case '--list-tests-xml': - $listTestsXml = $option[1]; - break; - case '--printer': - $printer = $option[1]; - break; - case '--loader': - $loader = $option[1]; - break; - case '--log-junit': - $junitLogfile = $option[1]; - break; - case '--log-teamcity': - $teamcityLogfile = $option[1]; - break; - case '--order-by': - foreach (explode(',', $option[1]) as $order) { - switch ($order) { - case 'default': - $executionOrder = TestSuiteSorter::ORDER_DEFAULT; - $executionOrderDefects = TestSuiteSorter::ORDER_DEFAULT; - $resolveDependencies = \true; - break; - case 'defects': - $executionOrderDefects = TestSuiteSorter::ORDER_DEFECTS_FIRST; - break; - case 'depends': - $resolveDependencies = \true; - break; - case 'duration': - $executionOrder = TestSuiteSorter::ORDER_DURATION; - break; - case 'no-depends': - $resolveDependencies = \false; - break; - case 'random': - $executionOrder = TestSuiteSorter::ORDER_RANDOMIZED; - break; - case 'reverse': - $executionOrder = TestSuiteSorter::ORDER_REVERSED; - break; - case 'size': - $executionOrder = TestSuiteSorter::ORDER_SIZE; - break; - default: - $unrecognizedOrderBy = $order; - } - } - break; - case '--process-isolation': - $processIsolation = \true; - break; - case '--repeat': - $repeat = (int) $option[1]; - break; - case '--stderr': - $stderr = \true; - break; - case '--stop-on-defect': - $stopOnDefect = \true; - break; - case '--stop-on-error': - $stopOnError = \true; - break; - case '--stop-on-failure': - $stopOnFailure = \true; - break; - case '--stop-on-warning': - $stopOnWarning = \true; - break; - case '--stop-on-incomplete': - $stopOnIncomplete = \true; - break; - case '--stop-on-risky': - $stopOnRisky = \true; - break; - case '--stop-on-skipped': - $stopOnSkipped = \true; - break; - case '--fail-on-empty-test-suite': - $failOnEmptyTestSuite = \true; - break; - case '--fail-on-incomplete': - $failOnIncomplete = \true; - break; - case '--fail-on-risky': - $failOnRisky = \true; - break; - case '--fail-on-skipped': - $failOnSkipped = \true; - break; - case '--fail-on-warning': - $failOnWarning = \true; - break; - case '--teamcity': - $printer = TeamCity::class; - break; - case '--testdox': - $printer = CliTestDoxPrinter::class; - break; - case '--testdox-group': - $testdoxGroups = explode(',', $option[1]); - break; - case '--testdox-exclude-group': - $testdoxExcludeGroups = explode(',', $option[1]); - break; - case '--testdox-html': - $testdoxHtmlFile = $option[1]; - break; - case '--testdox-text': - $testdoxTextFile = $option[1]; - break; - case '--testdox-xml': - $testdoxXmlFile = $option[1]; - break; - case '--no-configuration': - $useDefaultConfiguration = \false; - break; - case '--extensions': - foreach (explode(',', $option[1]) as $extensionClass) { - if (!class_exists($extensionClass)) { - $unavailableExtensions[] = $extensionClass; - continue; - } - $extensions[] = new Extension($extensionClass, '', []); - } - break; - case '--no-extensions': - $noExtensions = \true; - break; - case '--no-coverage': - $noCoverage = \true; - break; - case '--no-logging': - $noLogging = \true; - break; - case '--no-interaction': - $noInteraction = \true; - break; - case '--globals-backup': - $backupGlobals = \true; - break; - case '--static-backup': - $backupStaticAttributes = \true; - break; - case 'v': - case '--verbose': - $verbose = \true; - break; - case '--atleast-version': - $atLeastVersion = $option[1]; - break; - case '--version': - $version = \true; - break; - case '--dont-report-useless-tests': - $reportUselessTests = \false; - break; - case '--strict-coverage': - $strictCoverage = \true; - break; - case '--disable-coverage-ignore': - $disableCodeCoverageIgnore = \true; - break; - case '--strict-global-state': - $beStrictAboutChangesToGlobalState = \true; - break; - case '--disallow-test-output': - $disallowTestOutput = \true; - break; - case '--disallow-resource-usage': - $beStrictAboutResourceUsageDuringSmallTests = \true; - break; - case '--default-time-limit': - $defaultTimeLimit = (int) $option[1]; - break; - case '--enforce-time-limit': - $enforceTimeLimit = \true; - break; - case '--disallow-todo-tests': - $disallowTodoAnnotatedTests = \true; - break; - case '--reverse-list': - $reverseList = \true; - break; - case '--check-version': - $checkVersion = \true; - break; - case '--coverage-filter': - case '--whitelist': - if ($coverageFilter === null) { - $coverageFilter = []; - } - $coverageFilter[] = $option[1]; - break; - case '--random-order': - $executionOrder = TestSuiteSorter::ORDER_RANDOMIZED; - break; - case '--random-order-seed': - $randomOrderSeed = (int) $option[1]; - break; - case '--resolve-dependencies': - $resolveDependencies = \true; - break; - case '--ignore-dependencies': - $resolveDependencies = \false; - break; - case '--reverse-order': - $executionOrder = TestSuiteSorter::ORDER_REVERSED; - break; - case '--dump-xdebug-filter': - $xdebugFilterFile = $option[1]; - break; - default: - $unrecognizedOptions[str_replace('--', '', $option[0])] = $option[1]; + $time = $timer->stop()->asSeconds(); + $test->addToAssertionCount(\PHPUnit\Framework\Assert::getCount()); + if ($monitorFunctions) { + $excludeList = new ExcludeList(); + /** @noinspection ForgottenDebugOutputInspection */ + $functions = xdebug_get_monitored_functions(); + /* @noinspection ForgottenDebugOutputInspection */ + xdebug_stop_function_monitor(); + foreach ($functions as $function) { + if (!$excludeList->isExcluded($function['filename'])) { + $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError(sprintf('%s() used in %s:%s', $function['function'], $function['filename'], $function['lineno'])), $time); + } } } - if (empty($extensions)) { - $extensions = null; + if ($this->beStrictAboutTestsThatDoNotTestAnything && !$test->doesNotPerformAssertions() && $test->getNumAssertions() === 0) { + $risky = \true; } - if (empty($unavailableExtensions)) { - $unavailableExtensions = null; + if ($this->forceCoversAnnotation && !$error && !$failure && !$warning && !$incomplete && !$skipped && !$risky) { + $annotations = TestUtil::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); + if (!isset($annotations['class']['covers']) && !isset($annotations['method']['covers']) && !isset($annotations['class']['coversNothing']) && !isset($annotations['method']['coversNothing'])) { + $this->addFailure($test, new \PHPUnit\Framework\MissingCoversAnnotationException('This test does not have a @covers annotation but is expected to have one'), $time); + $risky = \true; + } } - if (empty($iniSettings)) { - $iniSettings = null; + if ($collectCodeCoverage) { + $append = !$risky && !$incomplete && !$skipped; + $linesToBeCovered = []; + $linesToBeUsed = []; + if ($append && $test instanceof \PHPUnit\Framework\TestCase) { + try { + $linesToBeCovered = TestUtil::getLinesToBeCovered(get_class($test), $test->getName(\false)); + $linesToBeUsed = TestUtil::getLinesToBeUsed(get_class($test), $test->getName(\false)); + } catch (\PHPUnit\Framework\InvalidCoversTargetException $cce) { + $this->addWarning($test, new \PHPUnit\Framework\Warning($cce->getMessage()), $time); + } + } + try { + $this->codeCoverage->stop($append, $linesToBeCovered, $linesToBeUsed); + } catch (UnintentionallyCoveredCodeException $cce) { + $unintentionallyCoveredCodeError = new \PHPUnit\Framework\UnintentionallyCoveredCodeError('This test executed code that is not listed as code to be covered or used:' . PHP_EOL . $cce->getMessage()); + } catch (OriginalCodeCoverageException $cce) { + $error = \true; + $e = $e ?? $cce; + } } - if (empty($coverageFilter)) { - $coverageFilter = null; + if (isset($errorHandler)) { + $errorHandler->unregister(); + unset($errorHandler); } - return new \PHPUnit\TextUI\CliArguments\Configuration($argument, $atLeastVersion, $backupGlobals, $backupStaticAttributes, $beStrictAboutChangesToGlobalState, $beStrictAboutResourceUsageDuringSmallTests, $bootstrap, $cacheResult, $cacheResultFile, $checkVersion, $colors, $columns, $configuration, $coverageClover, $coverageCobertura, $coverageCrap4J, $coverageHtml, $coveragePhp, $coverageText, $coverageTextShowUncoveredFiles, $coverageTextShowOnlySummary, $coverageXml, $pathCoverage, $coverageCacheDirectory, $warmCoverageCache, $debug, $defaultTimeLimit, $disableCodeCoverageIgnore, $disallowTestOutput, $disallowTodoAnnotatedTests, $enforceTimeLimit, $excludeGroups, $executionOrder, $executionOrderDefects, $extensions, $unavailableExtensions, $failOnEmptyTestSuite, $failOnIncomplete, $failOnRisky, $failOnSkipped, $failOnWarning, $filter, $generateConfiguration, $migrateConfiguration, $groups, $testsCovering, $testsUsing, $help, $includePath, $iniSettings, $junitLogfile, $listGroups, $listSuites, $listTests, $listTestsXml, $loader, $noCoverage, $noExtensions, $noInteraction, $noLogging, $printer, $processIsolation, $randomOrderSeed, $repeat, $reportUselessTests, $resolveDependencies, $reverseList, $stderr, $strictCoverage, $stopOnDefect, $stopOnError, $stopOnFailure, $stopOnIncomplete, $stopOnRisky, $stopOnSkipped, $stopOnWarning, $teamcityLogfile, $testdoxExcludeGroups, $testdoxGroups, $testdoxHtmlFile, $testdoxTextFile, $testdoxXmlFile, $testSuffixes, $testSuite, $unrecognizedOptions, $unrecognizedOrderBy, $useDefaultConfiguration, $verbose, $version, $coverageFilter, $xdebugFilterFile); + if ($error) { + $this->addError($test, $e, $time); + } elseif ($failure) { + $this->addFailure($test, $e, $time); + } elseif ($warning) { + $this->addWarning($test, $e, $time); + } elseif (isset($unintentionallyCoveredCodeError)) { + $this->addFailure($test, $unintentionallyCoveredCodeError, $time); + } elseif ($this->beStrictAboutTestsThatDoNotTestAnything && !$test->doesNotPerformAssertions() && $test->getNumAssertions() === 0) { + try { + $reflected = new ReflectionClass($test); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $name = $test->getName(\false); + if ($name && $reflected->hasMethod($name)) { + try { + $reflected = $reflected->getMethod($name); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + } + $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError(sprintf("This test did not perform any assertions\n\n%s:%d", $reflected->getFileName(), $reflected->getStartLine())), $time); + } elseif ($this->beStrictAboutTestsThatDoNotTestAnything && $test->doesNotPerformAssertions() && $test->getNumAssertions() > 0) { + $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError(sprintf('This test is annotated with "@doesNotPerformAssertions" but performed %d assertions', $test->getNumAssertions())), $time); + } elseif ($this->beStrictAboutOutputDuringTests && $test->hasOutput()) { + $this->addFailure($test, new \PHPUnit\Framework\OutputError(sprintf('This test printed output: %s', $test->getActualOutput())), $time); + } elseif ($this->beStrictAboutTodoAnnotatedTests && $test instanceof \PHPUnit\Framework\TestCase) { + $annotations = TestUtil::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); + if (isset($annotations['method']['todo'])) { + $this->addFailure($test, new \PHPUnit\Framework\RiskyTestError('Test method is annotated with @todo'), $time); + } + } + $this->endTest($test, $time); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\CliArguments; - -use PHPUnit\TextUI\XmlConfiguration\Extension; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Configuration -{ - /** - * @var ?string - */ - private $argument; /** - * @var ?string - */ - private $atLeastVersion; - /** - * @var ?bool - */ - private $backupGlobals; - /** - * @var ?bool - */ - private $backupStaticAttributes; - /** - * @var ?bool + * Gets the number of run tests. */ - private $beStrictAboutChangesToGlobalState; + public function count(): int + { + return $this->runTests; + } /** - * @var ?bool + * Checks whether the test run should stop. */ - private $beStrictAboutResourceUsageDuringSmallTests; + public function shouldStop(): bool + { + return $this->stop; + } /** - * @var ?string + * Marks that the test run should stop. */ - private $bootstrap; + public function stop(): void + { + $this->stop = \true; + } /** - * @var ?bool + * Returns the code coverage object. */ - private $cacheResult; + public function getCodeCoverage(): ?CodeCoverage + { + return $this->codeCoverage; + } /** - * @var ?string + * Sets the code coverage object. */ - private $cacheResultFile; + public function setCodeCoverage(CodeCoverage $codeCoverage): void + { + $this->codeCoverage = $codeCoverage; + } /** - * @var ?bool + * Enables or disables the deprecation-to-exception conversion. */ - private $checkVersion; + public function convertDeprecationsToExceptions(bool $flag): void + { + $this->convertDeprecationsToExceptions = $flag; + } /** - * @var ?string + * Returns the deprecation-to-exception conversion setting. */ - private $colors; + public function getConvertDeprecationsToExceptions(): bool + { + return $this->convertDeprecationsToExceptions; + } /** - * @var null|int|string + * Enables or disables the error-to-exception conversion. */ - private $columns; + public function convertErrorsToExceptions(bool $flag): void + { + $this->convertErrorsToExceptions = $flag; + } /** - * @var ?string + * Returns the error-to-exception conversion setting. */ - private $configuration; + public function getConvertErrorsToExceptions(): bool + { + return $this->convertErrorsToExceptions; + } /** - * @var null|string[] + * Enables or disables the notice-to-exception conversion. */ - private $coverageFilter; + public function convertNoticesToExceptions(bool $flag): void + { + $this->convertNoticesToExceptions = $flag; + } /** - * @var ?string + * Returns the notice-to-exception conversion setting. */ - private $coverageClover; + public function getConvertNoticesToExceptions(): bool + { + return $this->convertNoticesToExceptions; + } /** - * @var ?string + * Enables or disables the warning-to-exception conversion. */ - private $coverageCobertura; + public function convertWarningsToExceptions(bool $flag): void + { + $this->convertWarningsToExceptions = $flag; + } /** - * @var ?string + * Returns the warning-to-exception conversion setting. */ - private $coverageCrap4J; + public function getConvertWarningsToExceptions(): bool + { + return $this->convertWarningsToExceptions; + } /** - * @var ?string + * Enables or disables the stopping when an error occurs. */ - private $coverageHtml; + public function stopOnError(bool $flag): void + { + $this->stopOnError = $flag; + } /** - * @var ?string + * Enables or disables the stopping when a failure occurs. */ - private $coveragePhp; + public function stopOnFailure(bool $flag): void + { + $this->stopOnFailure = $flag; + } /** - * @var ?string + * Enables or disables the stopping when a warning occurs. */ - private $coverageText; + public function stopOnWarning(bool $flag): void + { + $this->stopOnWarning = $flag; + } + public function beStrictAboutTestsThatDoNotTestAnything(bool $flag): void + { + $this->beStrictAboutTestsThatDoNotTestAnything = $flag; + } + public function isStrictAboutTestsThatDoNotTestAnything(): bool + { + return $this->beStrictAboutTestsThatDoNotTestAnything; + } + public function beStrictAboutOutputDuringTests(bool $flag): void + { + $this->beStrictAboutOutputDuringTests = $flag; + } + public function isStrictAboutOutputDuringTests(): bool + { + return $this->beStrictAboutOutputDuringTests; + } + public function beStrictAboutResourceUsageDuringSmallTests(bool $flag): void + { + $this->beStrictAboutResourceUsageDuringSmallTests = $flag; + } + public function isStrictAboutResourceUsageDuringSmallTests(): bool + { + return $this->beStrictAboutResourceUsageDuringSmallTests; + } + public function enforceTimeLimit(bool $flag): void + { + $this->enforceTimeLimit = $flag; + } + public function enforcesTimeLimit(): bool + { + return $this->enforceTimeLimit; + } + public function beStrictAboutTodoAnnotatedTests(bool $flag): void + { + $this->beStrictAboutTodoAnnotatedTests = $flag; + } + public function isStrictAboutTodoAnnotatedTests(): bool + { + return $this->beStrictAboutTodoAnnotatedTests; + } + public function forceCoversAnnotation(): void + { + $this->forceCoversAnnotation = \true; + } + public function forcesCoversAnnotation(): bool + { + return $this->forceCoversAnnotation; + } /** - * @var ?bool + * Enables or disables the stopping for risky tests. */ - private $coverageTextShowUncoveredFiles; + public function stopOnRisky(bool $flag): void + { + $this->stopOnRisky = $flag; + } /** - * @var ?bool + * Enables or disables the stopping for incomplete tests. */ - private $coverageTextShowOnlySummary; + public function stopOnIncomplete(bool $flag): void + { + $this->stopOnIncomplete = $flag; + } /** - * @var ?string + * Enables or disables the stopping for skipped tests. */ - private $coverageXml; + public function stopOnSkipped(bool $flag): void + { + $this->stopOnSkipped = $flag; + } /** - * @var ?bool + * Enables or disables the stopping for defects: error, failure, warning. */ - private $pathCoverage; + public function stopOnDefect(bool $flag): void + { + $this->stopOnDefect = $flag; + } /** - * @var ?string + * Returns the time spent running the tests. */ - private $coverageCacheDirectory; + public function time(): float + { + return $this->time; + } /** - * @var ?bool + * Returns whether the entire test was successful or not. */ - private $warmCoverageCache; + public function wasSuccessful(): bool + { + return $this->wasSuccessfulIgnoringWarnings() && empty($this->warnings); + } + public function wasSuccessfulIgnoringWarnings(): bool + { + return empty($this->errors) && empty($this->failures); + } + public function wasSuccessfulAndNoTestIsRiskyOrSkippedOrIncomplete(): bool + { + return $this->wasSuccessful() && $this->allHarmless() && $this->allCompletelyImplemented() && $this->noneSkipped(); + } /** - * @var ?bool + * Sets the default timeout for tests. */ - private $debug; + public function setDefaultTimeLimit(int $timeout): void + { + $this->defaultTimeLimit = $timeout; + } /** - * @var ?int + * Sets the timeout for small tests. */ - private $defaultTimeLimit; + public function setTimeoutForSmallTests(int $timeout): void + { + $this->timeoutForSmallTests = $timeout; + } /** - * @var ?bool + * Sets the timeout for medium tests. */ - private $disableCodeCoverageIgnore; + public function setTimeoutForMediumTests(int $timeout): void + { + $this->timeoutForMediumTests = $timeout; + } /** - * @var ?bool + * Sets the timeout for large tests. */ - private $disallowTestOutput; + public function setTimeoutForLargeTests(int $timeout): void + { + $this->timeoutForLargeTests = $timeout; + } /** - * @var ?bool + * Returns the set timeout for large tests. */ - private $disallowTodoAnnotatedTests; + public function getTimeoutForLargeTests(): int + { + return $this->timeoutForLargeTests; + } + public function setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag): void + { + $this->registerMockObjectsFromTestArgumentsRecursively = $flag; + } + private function recordError(\PHPUnit\Framework\Test $test, Throwable $t): void + { + $this->errors[] = new \PHPUnit\Framework\TestFailure($test, $t); + } + private function recordNotImplemented(\PHPUnit\Framework\Test $test, Throwable $t): void + { + $this->notImplemented[] = new \PHPUnit\Framework\TestFailure($test, $t); + } + private function recordRisky(\PHPUnit\Framework\Test $test, Throwable $t): void + { + $this->risky[] = new \PHPUnit\Framework\TestFailure($test, $t); + } + private function recordSkipped(\PHPUnit\Framework\Test $test, Throwable $t): void + { + $this->skipped[] = new \PHPUnit\Framework\TestFailure($test, $t); + } + private function recordWarning(\PHPUnit\Framework\Test $test, Throwable $t): void + { + $this->warnings[] = new \PHPUnit\Framework\TestFailure($test, $t); + } + private function shouldTimeLimitBeEnforced(int $size): bool + { + if (!$this->enforceTimeLimit) { + return \false; + } + if (!($this->defaultTimeLimit || $size !== TestUtil::UNKNOWN)) { + return \false; + } + if (!extension_loaded('pcntl')) { + return \false; + } + if (!class_exists(Invoker::class)) { + return \false; + } + if (extension_loaded('xdebug') && xdebug_is_debugger_active()) { + return \false; + } + return \true; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use const PHP_EOL; +use function array_keys; +use function array_map; +use function array_merge; +use function array_slice; +use function array_unique; +use function basename; +use function call_user_func; +use function class_exists; +use function count; +use function dirname; +use function get_declared_classes; +use function implode; +use function is_bool; +use function is_callable; +use function is_file; +use function is_object; +use function is_string; +use function method_exists; +use function preg_match; +use function preg_quote; +use function sprintf; +use function strpos; +use function substr; +use Iterator; +use IteratorAggregate; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\Filter\Factory; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\FileLoader; +use PHPUnit\Util\Reflection; +use PHPUnit\Util\Test as TestUtil; +use ReflectionClass; +use ReflectionException; +use ReflectionMethod; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException; +use Throwable; +/** + * @template-implements IteratorAggregate + * + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +class TestSuite implements IteratorAggregate, \PHPUnit\Framework\Reorderable, \PHPUnit\Framework\SelfDescribing, \PHPUnit\Framework\Test +{ /** - * @var ?bool + * Enable or disable the backup and restoration of the $GLOBALS array. + * + * @var bool */ - private $enforceTimeLimit; + protected $backupGlobals; /** - * @var null|string[] + * Enable or disable the backup and restoration of static attributes. + * + * @var bool */ - private $excludeGroups; + protected $backupStaticAttributes; /** - * @var ?int + * @var bool */ - private $executionOrder; + protected $runTestInSeparateProcess = \false; /** - * @var ?int + * The name of the test suite. + * + * @var string */ - private $executionOrderDefects; + protected $name = ''; /** - * @var null|Extension[] + * The test groups of the test suite. + * + * @psalm-var array> */ - private $extensions; + protected $groups = []; /** - * @var null|string[] + * The tests in the test suite. + * + * @var Test[] */ - private $unavailableExtensions; + protected $tests = []; /** - * @var ?bool + * The number of tests in the test suite. + * + * @var int */ - private $failOnEmptyTestSuite; + protected $numTests = -1; /** - * @var ?bool + * @var bool */ - private $failOnIncomplete; + protected $testCase = \false; /** - * @var ?bool + * @var string[] */ - private $failOnRisky; + protected $foundClasses = []; /** - * @var ?bool + * @var null|list */ - private $failOnSkipped; + protected $providedTests; /** - * @var ?bool + * @var null|list */ - private $failOnWarning; + protected $requiredTests; /** - * @var ?string + * @var bool */ - private $filter; + private $beStrictAboutChangesToGlobalState; /** - * @var ?bool + * @var Factory */ - private $generateConfiguration; + private $iteratorFilter; /** - * @var ?bool + * @var int */ - private $migrateConfiguration; + private $declaredClassesPointer; /** - * @var null|string[] + * @psalm-var array */ - private $groups; + private $warnings = []; /** - * @var null|string[] + * Constructs a new TestSuite. + * + * - PHPUnit\Framework\TestSuite() constructs an empty TestSuite. + * + * - PHPUnit\Framework\TestSuite(ReflectionClass) constructs a + * TestSuite from the given class. + * + * - PHPUnit\Framework\TestSuite(ReflectionClass, String) + * constructs a TestSuite from the given class with the given + * name. + * + * - PHPUnit\Framework\TestSuite(String) either constructs a + * TestSuite from the given class (if the passed string is the + * name of an existing class) or constructs an empty TestSuite + * with the given name. + * + * @param ReflectionClass|string $theClass + * + * @throws Exception */ - private $testsCovering; + public function __construct($theClass = '', string $name = '') + { + if (!is_string($theClass) && !$theClass instanceof ReflectionClass) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'ReflectionClass object or string'); + } + $this->declaredClassesPointer = count(get_declared_classes()); + if (!$theClass instanceof ReflectionClass) { + if (class_exists($theClass, \true)) { + if ($name === '') { + $name = $theClass; + } + try { + $theClass = new ReflectionClass($theClass); + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + } else { + $this->setName($theClass); + return; + } + } + if (!$theClass->isSubclassOf(\PHPUnit\Framework\TestCase::class)) { + $this->setName((string) $theClass); + return; + } + if ($name !== '') { + $this->setName($name); + } else { + $this->setName($theClass->getName()); + } + $constructor = $theClass->getConstructor(); + if ($constructor !== null && !$constructor->isPublic()) { + $this->addTest(new \PHPUnit\Framework\WarningTestCase(sprintf('Class "%s" has no public constructor.', $theClass->getName()))); + return; + } + foreach ((new Reflection())->publicMethodsInTestClass($theClass) as $method) { + if (!TestUtil::isTestMethod($method)) { + continue; + } + $this->addTestMethod($theClass, $method); + } + if (empty($this->tests)) { + $this->addTest(new \PHPUnit\Framework\WarningTestCase(sprintf('No tests found in class "%s".', $theClass->getName()))); + } + $this->testCase = \true; + } /** - * @var null|string[] + * Returns a string representation of the test suite. */ - private $testsUsing; + public function toString(): string + { + return $this->getName(); + } /** - * @var ?bool + * Adds a test to the suite. + * + * @param array $groups */ - private $help; + public function addTest(\PHPUnit\Framework\Test $test, $groups = []): void + { + try { + $class = new ReflectionClass($test); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if (!$class->isAbstract()) { + $this->tests[] = $test; + $this->clearCaches(); + if ($test instanceof self && empty($groups)) { + $groups = $test->getGroups(); + } + if ($this->containsOnlyVirtualGroups($groups)) { + $groups[] = 'default'; + } + foreach ($groups as $group) { + if (!isset($this->groups[$group])) { + $this->groups[$group] = [$test]; + } else { + $this->groups[$group][] = $test; + } + } + if ($test instanceof \PHPUnit\Framework\TestCase) { + $test->setGroups($groups); + } + } + } /** - * @var ?string + * Adds the tests from the given class to the suite. + * + * @psalm-param object|class-string $testClass + * + * @throws Exception */ - private $includePath; + public function addTestSuite($testClass): void + { + if (!(is_object($testClass) || is_string($testClass) && class_exists($testClass))) { + throw \PHPUnit\Framework\InvalidArgumentException::create(1, 'class name or object'); + } + if (!is_object($testClass)) { + try { + $testClass = new ReflectionClass($testClass); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + } + if ($testClass instanceof self) { + $this->addTest($testClass); + } elseif ($testClass instanceof ReflectionClass) { + $suiteMethod = \false; + if (!$testClass->isAbstract() && $testClass->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { + try { + $method = $testClass->getMethod(BaseTestRunner::SUITE_METHODNAME); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if ($method->isStatic()) { + $this->addTest($method->invoke(null, $testClass->getName())); + $suiteMethod = \true; + } + } + if (!$suiteMethod && !$testClass->isAbstract() && $testClass->isSubclassOf(\PHPUnit\Framework\TestCase::class)) { + $this->addTest(new self($testClass)); + } + } else { + throw new \PHPUnit\Framework\Exception(); + } + } + public function addWarning(string $warning): void + { + $this->warnings[] = $warning; + } /** - * @var null|string[] + * Wraps both addTest() and addTestSuite + * as well as the separate import statements for the user's convenience. + * + * If the named file cannot be read or there are no new tests that can be + * added, a PHPUnit\Framework\WarningTestCase will be created instead, + * leaving the current test run untouched. + * + * @throws Exception */ - private $iniSettings; + public function addTestFile(string $filename): void + { + if (is_file($filename) && substr($filename, -5) === '.phpt') { + $this->addTest(new PhptTestCase($filename)); + $this->declaredClassesPointer = count(get_declared_classes()); + return; + } + $numTests = count($this->tests); + // The given file may contain further stub classes in addition to the + // test class itself. Figure out the actual test class. + $filename = FileLoader::checkAndLoad($filename); + $newClasses = array_slice(get_declared_classes(), $this->declaredClassesPointer); + // The diff is empty in case a parent class (with test methods) is added + // AFTER a child class that inherited from it. To account for that case, + // accumulate all discovered classes, so the parent class may be found in + // a later invocation. + if (!empty($newClasses)) { + // On the assumption that test classes are defined first in files, + // process discovered classes in approximate LIFO order, so as to + // avoid unnecessary reflection. + $this->foundClasses = array_merge($newClasses, $this->foundClasses); + $this->declaredClassesPointer = count(get_declared_classes()); + } + // The test class's name must match the filename, either in full, or as + // a PEAR/PSR-0 prefixed short name ('NameSpace_ShortName'), or as a + // PSR-1 local short name ('NameSpace\ShortName'). The comparison must be + // anchored to prevent false-positive matches (e.g., 'OtherShortName'). + $shortName = basename($filename, '.php'); + $shortNameRegEx = '/(?:^|_|\\\\)' . preg_quote($shortName, '/') . '$/'; + foreach ($this->foundClasses as $i => $className) { + if (preg_match($shortNameRegEx, $className)) { + try { + $class = new ReflectionClass($className); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if ($class->getFileName() == $filename) { + $newClasses = [$className]; + unset($this->foundClasses[$i]); + break; + } + } + } + foreach ($newClasses as $className) { + try { + $class = new ReflectionClass($className); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if (dirname($class->getFileName()) === __DIR__) { + continue; + } + if ($class->isAbstract() && $class->isSubclassOf(\PHPUnit\Framework\TestCase::class)) { + $this->addWarning(sprintf('Abstract test case classes with "Test" suffix are deprecated (%s)', $class->getName())); + } + if (!$class->isAbstract()) { + if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { + try { + $method = $class->getMethod(BaseTestRunner::SUITE_METHODNAME); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Framework\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if ($method->isStatic()) { + $this->addTest($method->invoke(null, $className)); + } + } elseif ($class->implementsInterface(\PHPUnit\Framework\Test::class)) { + // Do we have modern namespacing ('Foo\Bar\WhizBangTest') or old-school namespacing ('Foo_Bar_WhizBangTest')? + $isPsr0 = !$class->inNamespace() && strpos($class->getName(), '_') !== \false; + $expectedClassName = $isPsr0 ? $className : $shortName; + if (($pos = strpos($expectedClassName, '.')) !== \false) { + $expectedClassName = substr($expectedClassName, 0, $pos); + } + if ($class->getShortName() !== $expectedClassName) { + $this->addWarning(sprintf("Test case class not matching filename is deprecated\n in %s\n Class name was '%s', expected '%s'", $filename, $class->getShortName(), $expectedClassName)); + } + $this->addTestSuite($class); + } + } + } + if (count($this->tests) > ++$numTests) { + $this->addWarning(sprintf("Multiple test case classes per file is deprecated\n in %s", $filename)); + } + $this->numTests = -1; + } /** - * @var ?string + * Wrapper for addTestFile() that adds multiple test files. + * + * @throws Exception */ - private $junitLogfile; + public function addTestFiles(iterable $fileNames): void + { + foreach ($fileNames as $filename) { + $this->addTestFile((string) $filename); + } + } /** - * @var ?bool + * Counts the number of test cases that will be run by this test. + * + * @todo refactor usage of numTests in DefaultResultPrinter */ - private $listGroups; + public function count(): int + { + $this->numTests = 0; + foreach ($this as $test) { + $this->numTests += count($test); + } + return $this->numTests; + } /** - * @var ?bool + * Returns the name of the suite. */ - private $listSuites; + public function getName(): string + { + return $this->name; + } /** - * @var ?bool + * Returns the test groups of the suite. + * + * @psalm-return list */ - private $listTests; + public function getGroups(): array + { + return array_map(static function ($key): string { + return (string) $key; + }, array_keys($this->groups)); + } + public function getGroupDetails(): array + { + return $this->groups; + } /** - * @var ?string + * Set tests groups of the test case. */ - private $listTestsXml; + public function setGroupDetails(array $groups): void + { + $this->groups = $groups; + } /** - * @var ?string + * Runs the tests and collects their result in a TestResult. + * + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws CodeCoverageException + * @throws UnintentionallyCoveredCodeException + * @throws Warning */ - private $loader; + public function run(?\PHPUnit\Framework\TestResult $result = null): \PHPUnit\Framework\TestResult + { + if ($result === null) { + $result = $this->createResult(); + } + if (count($this) === 0) { + return $result; + } + /** @psalm-var class-string $className */ + $className = $this->name; + $hookMethods = TestUtil::getHookMethods($className); + $result->startTestSuite($this); + $test = null; + if ($this->testCase && class_exists($this->name, \false)) { + try { + foreach ($hookMethods['beforeClass'] as $beforeClassMethod) { + if (method_exists($this->name, $beforeClassMethod)) { + if ($missingRequirements = TestUtil::getMissingRequirements($this->name, $beforeClassMethod)) { + $this->markTestSuiteSkipped(implode(PHP_EOL, $missingRequirements)); + } + call_user_func([$this->name, $beforeClassMethod]); + } + } + } catch (\PHPUnit\Framework\SkippedTestError|\PHPUnit\Framework\SkippedTestSuiteError $error) { + foreach ($this->tests() as $test) { + $result->startTest($test); + $result->addFailure($test, $error, 0); + $result->endTest($test, 0); + } + $result->endTestSuite($this); + return $result; + } catch (Throwable $t) { + $errorAdded = \false; + foreach ($this->tests() as $test) { + if ($result->shouldStop()) { + break; + } + $result->startTest($test); + if (!$errorAdded) { + $result->addError($test, $t, 0); + $errorAdded = \true; + } else { + $result->addFailure($test, new \PHPUnit\Framework\SkippedTestError('Test skipped because of an error in hook method'), 0); + } + $result->endTest($test, 0); + } + $result->endTestSuite($this); + return $result; + } + } + foreach ($this as $test) { + if ($result->shouldStop()) { + break; + } + if ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof self) { + $test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState); + $test->setBackupGlobals($this->backupGlobals); + $test->setBackupStaticAttributes($this->backupStaticAttributes); + $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess); + } + $test->run($result); + } + if ($this->testCase && class_exists($this->name, \false)) { + foreach ($hookMethods['afterClass'] as $afterClassMethod) { + if (method_exists($this->name, $afterClassMethod)) { + try { + call_user_func([$this->name, $afterClassMethod]); + } catch (Throwable $t) { + $message = "Exception in {$this->name}::{$afterClassMethod}" . PHP_EOL . $t->getMessage(); + $error = new \PHPUnit\Framework\SyntheticError($message, 0, $t->getFile(), $t->getLine(), $t->getTrace()); + $placeholderTest = clone $test; + $placeholderTest->setName($afterClassMethod); + $result->startTest($placeholderTest); + $result->addFailure($placeholderTest, $error, 0); + $result->endTest($placeholderTest, 0); + } + } + } + } + $result->endTestSuite($this); + return $result; + } + public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void + { + $this->runTestInSeparateProcess = $runTestInSeparateProcess; + } + public function setName(string $name): void + { + $this->name = $name; + } /** - * @var ?bool + * Returns the tests as an enumeration. + * + * @return Test[] */ - private $noCoverage; + public function tests(): array + { + return $this->tests; + } /** - * @var ?bool + * Set tests of the test suite. + * + * @param Test[] $tests */ - private $noExtensions; + public function setTests(array $tests): void + { + $this->tests = $tests; + } /** - * @var ?bool + * Mark the test suite as skipped. + * + * @param string $message + * + * @throws SkippedTestSuiteError + * + * @psalm-return never-return */ - private $noInteraction; + public function markTestSuiteSkipped($message = ''): void + { + throw new \PHPUnit\Framework\SkippedTestSuiteError($message); + } /** - * @var ?bool + * @param bool $beStrictAboutChangesToGlobalState */ - private $noLogging; + public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState): void + { + if (null === $this->beStrictAboutChangesToGlobalState && is_bool($beStrictAboutChangesToGlobalState)) { + $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + } + } /** - * @var ?string + * @param bool $backupGlobals */ - private $printer; + public function setBackupGlobals($backupGlobals): void + { + if (null === $this->backupGlobals && is_bool($backupGlobals)) { + $this->backupGlobals = $backupGlobals; + } + } /** - * @var ?bool + * @param bool $backupStaticAttributes */ - private $processIsolation; + public function setBackupStaticAttributes($backupStaticAttributes): void + { + if (null === $this->backupStaticAttributes && is_bool($backupStaticAttributes)) { + $this->backupStaticAttributes = $backupStaticAttributes; + } + } /** - * @var ?int + * Returns an iterator for this test suite. */ - private $randomOrderSeed; + public function getIterator(): Iterator + { + $iterator = new \PHPUnit\Framework\TestSuiteIterator($this); + if ($this->iteratorFilter !== null) { + $iterator = $this->iteratorFilter->factory($iterator, $this); + } + return $iterator; + } + public function injectFilter(Factory $filter): void + { + $this->iteratorFilter = $filter; + foreach ($this as $test) { + if ($test instanceof self) { + $test->injectFilter($filter); + } + } + } /** - * @var ?int + * @psalm-return array */ - private $repeat; + public function warnings(): array + { + return array_unique($this->warnings); + } /** - * @var ?bool + * @return list */ - private $reportUselessTests; + public function provides(): array + { + if ($this->providedTests === null) { + $this->providedTests = []; + if (is_callable($this->sortId(), \true)) { + $this->providedTests[] = new \PHPUnit\Framework\ExecutionOrderDependency($this->sortId()); + } + foreach ($this->tests as $test) { + if (!$test instanceof \PHPUnit\Framework\Reorderable) { + // @codeCoverageIgnoreStart + continue; + // @codeCoverageIgnoreEnd + } + $this->providedTests = \PHPUnit\Framework\ExecutionOrderDependency::mergeUnique($this->providedTests, $test->provides()); + } + } + return $this->providedTests; + } /** - * @var ?bool + * @return list */ - private $resolveDependencies; + public function requires(): array + { + if ($this->requiredTests === null) { + $this->requiredTests = []; + foreach ($this->tests as $test) { + if (!$test instanceof \PHPUnit\Framework\Reorderable) { + // @codeCoverageIgnoreStart + continue; + // @codeCoverageIgnoreEnd + } + $this->requiredTests = \PHPUnit\Framework\ExecutionOrderDependency::mergeUnique(\PHPUnit\Framework\ExecutionOrderDependency::filterInvalid($this->requiredTests), $test->requires()); + } + $this->requiredTests = \PHPUnit\Framework\ExecutionOrderDependency::diff($this->requiredTests, $this->provides()); + } + return $this->requiredTests; + } + public function sortId(): string + { + return $this->getName() . '::class'; + } /** - * @var ?bool + * Creates a default TestResult object. */ - private $reverseList; + protected function createResult(): \PHPUnit\Framework\TestResult + { + return new \PHPUnit\Framework\TestResult(); + } /** - * @var ?bool + * @throws Exception */ - private $stderr; + protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method): void + { + $methodName = $method->getName(); + $test = (new \PHPUnit\Framework\TestBuilder())->build($class, $methodName); + if ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof \PHPUnit\Framework\DataProviderTestSuite) { + $test->setDependencies(TestUtil::getDependencies($class->getName(), $methodName)); + } + $this->addTest($test, TestUtil::getGroups($class->getName(), $methodName)); + } + private function clearCaches(): void + { + $this->numTests = -1; + $this->providedTests = null; + $this->requiredTests = null; + } + private function containsOnlyVirtualGroups(array $groups): bool + { + foreach ($groups as $group) { + if (strpos($group, '__phpunit_') !== 0) { + return \false; + } + } + return \true; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use function assert; +use function count; +use RecursiveIterator; +/** + * @template-implements RecursiveIterator + * + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class TestSuiteIterator implements RecursiveIterator +{ /** - * @var ?bool + * @var int */ - private $strictCoverage; + private $position = 0; /** - * @var ?bool + * @var Test[] */ - private $stopOnDefect; + private $tests; + public function __construct(\PHPUnit\Framework\TestSuite $testSuite) + { + $this->tests = $testSuite->tests(); + } + public function rewind(): void + { + $this->position = 0; + } + public function valid(): bool + { + return $this->position < count($this->tests); + } + public function key(): int + { + return $this->position; + } + public function current(): \PHPUnit\Framework\Test + { + return $this->tests[$this->position]; + } + public function next(): void + { + $this->position++; + } /** - * @var ?bool + * @throws NoChildTestSuiteException */ - private $stopOnError; + public function getChildren(): self + { + if (!$this->hasChildren()) { + throw new \PHPUnit\Framework\NoChildTestSuiteException('The current item is not a TestSuite instance and therefore does not have any children.'); + } + $current = $this->current(); + assert($current instanceof \PHPUnit\Framework\TestSuite); + return new self($current); + } + public function hasChildren(): bool + { + return $this->valid() && $this->current() instanceof \PHPUnit\Framework\TestSuite; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class WarningTestCase extends \PHPUnit\Framework\TestCase +{ /** * @var ?bool */ - private $stopOnFailure; - /** - * @var ?bool - */ - private $stopOnIncomplete; - /** - * @var ?bool - */ - private $stopOnRisky; + protected $backupGlobals = \false; /** * @var ?bool */ - private $stopOnSkipped; + protected $backupStaticAttributes = \false; /** * @var ?bool */ - private $stopOnWarning; - /** - * @var ?string - */ - private $teamcityLogfile; - /** - * @var null|string[] - */ - private $testdoxExcludeGroups; + protected $runTestInSeparateProcess = \false; /** - * @var null|string[] + * @var string */ - private $testdoxGroups; + private $message; + public function __construct(string $message = '') + { + $this->message = $message; + parent::__construct('Warning'); + } + public function getMessage(): string + { + return $this->message; + } /** - * @var ?string + * Returns a string representation of the test case. */ - private $testdoxHtmlFile; + public function toString(): string + { + return 'Warning'; + } /** - * @var ?string + * @throws Exception + * + * @psalm-return never-return */ - private $testdoxTextFile; + protected function runTest(): void + { + throw new \PHPUnit\Framework\Warning($this->message); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use function is_dir; +use function is_file; +use function substr; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\TestSuite; +use ReflectionClass; +use ReflectionException; +use PHPUnitPHAR\SebastianBergmann\FileIterator\Facade as FileIteratorFacade; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +abstract class BaseTestRunner +{ /** - * @var ?string + * @var int */ - private $testdoxXmlFile; + public const STATUS_UNKNOWN = -1; /** - * @var null|string[] + * @var int */ - private $testSuffixes; + public const STATUS_PASSED = 0; /** - * @var ?string + * @var int */ - private $testSuite; + public const STATUS_SKIPPED = 1; /** - * @var string[] + * @var int */ - private $unrecognizedOptions; + public const STATUS_INCOMPLETE = 2; /** - * @var ?string + * @var int */ - private $unrecognizedOrderBy; + public const STATUS_FAILURE = 3; /** - * @var ?bool + * @var int */ - private $useDefaultConfiguration; + public const STATUS_ERROR = 4; /** - * @var ?bool + * @var int */ - private $verbose; + public const STATUS_RISKY = 5; /** - * @var ?bool + * @var int */ - private $version; + public const STATUS_WARNING = 6; /** - * @var ?string + * @var string */ - private $xdebugFilterFile; + public const SUITE_METHODNAME = 'suite'; /** - * @param null|int|string $columns + * Returns the loader to be used. */ - public function __construct(?string $argument, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticAttributes, ?bool $beStrictAboutChangesToGlobalState, ?bool $beStrictAboutResourceUsageDuringSmallTests, ?string $bootstrap, ?bool $cacheResult, ?string $cacheResultFile, ?bool $checkVersion, ?string $colors, $columns, ?string $configuration, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $pathCoverage, ?string $coverageCacheDirectory, ?bool $warmCoverageCache, ?bool $debug, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $disallowTodoAnnotatedTests, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?array $extensions, ?array $unavailableExtensions, ?bool $failOnEmptyTestSuite, ?bool $failOnIncomplete, ?bool $failOnRisky, ?bool $failOnSkipped, ?bool $failOnWarning, ?string $filter, ?bool $generateConfiguration, ?bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, ?bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, ?bool $listGroups, ?bool $listSuites, ?bool $listTests, ?string $listTestsXml, ?string $loader, ?bool $noCoverage, ?bool $noExtensions, ?bool $noInteraction, ?bool $noLogging, ?string $printer, ?bool $processIsolation, ?int $randomOrderSeed, ?int $repeat, ?bool $reportUselessTests, ?bool $resolveDependencies, ?bool $reverseList, ?bool $stderr, ?bool $strictCoverage, ?bool $stopOnDefect, ?bool $stopOnError, ?bool $stopOnFailure, ?bool $stopOnIncomplete, ?bool $stopOnRisky, ?bool $stopOnSkipped, ?bool $stopOnWarning, ?string $teamcityLogfile, ?array $testdoxExcludeGroups, ?array $testdoxGroups, ?string $testdoxHtmlFile, ?string $testdoxTextFile, ?string $testdoxXmlFile, ?array $testSuffixes, ?string $testSuite, array $unrecognizedOptions, ?string $unrecognizedOrderBy, ?bool $useDefaultConfiguration, ?bool $verbose, ?bool $version, ?array $coverageFilter, ?string $xdebugFilterFile) - { - $this->argument = $argument; - $this->atLeastVersion = $atLeastVersion; - $this->backupGlobals = $backupGlobals; - $this->backupStaticAttributes = $backupStaticAttributes; - $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; - $this->beStrictAboutResourceUsageDuringSmallTests = $beStrictAboutResourceUsageDuringSmallTests; - $this->bootstrap = $bootstrap; - $this->cacheResult = $cacheResult; - $this->cacheResultFile = $cacheResultFile; - $this->checkVersion = $checkVersion; - $this->colors = $colors; - $this->columns = $columns; - $this->configuration = $configuration; - $this->coverageFilter = $coverageFilter; - $this->coverageClover = $coverageClover; - $this->coverageCobertura = $coverageCobertura; - $this->coverageCrap4J = $coverageCrap4J; - $this->coverageHtml = $coverageHtml; - $this->coveragePhp = $coveragePhp; - $this->coverageText = $coverageText; - $this->coverageTextShowUncoveredFiles = $coverageTextShowUncoveredFiles; - $this->coverageTextShowOnlySummary = $coverageTextShowOnlySummary; - $this->coverageXml = $coverageXml; - $this->pathCoverage = $pathCoverage; - $this->coverageCacheDirectory = $coverageCacheDirectory; - $this->warmCoverageCache = $warmCoverageCache; - $this->debug = $debug; - $this->defaultTimeLimit = $defaultTimeLimit; - $this->disableCodeCoverageIgnore = $disableCodeCoverageIgnore; - $this->disallowTestOutput = $disallowTestOutput; - $this->disallowTodoAnnotatedTests = $disallowTodoAnnotatedTests; - $this->enforceTimeLimit = $enforceTimeLimit; - $this->excludeGroups = $excludeGroups; - $this->executionOrder = $executionOrder; - $this->executionOrderDefects = $executionOrderDefects; - $this->extensions = $extensions; - $this->unavailableExtensions = $unavailableExtensions; - $this->failOnEmptyTestSuite = $failOnEmptyTestSuite; - $this->failOnIncomplete = $failOnIncomplete; - $this->failOnRisky = $failOnRisky; - $this->failOnSkipped = $failOnSkipped; - $this->failOnWarning = $failOnWarning; - $this->filter = $filter; - $this->generateConfiguration = $generateConfiguration; - $this->migrateConfiguration = $migrateConfiguration; - $this->groups = $groups; - $this->testsCovering = $testsCovering; - $this->testsUsing = $testsUsing; - $this->help = $help; - $this->includePath = $includePath; - $this->iniSettings = $iniSettings; - $this->junitLogfile = $junitLogfile; - $this->listGroups = $listGroups; - $this->listSuites = $listSuites; - $this->listTests = $listTests; - $this->listTestsXml = $listTestsXml; - $this->loader = $loader; - $this->noCoverage = $noCoverage; - $this->noExtensions = $noExtensions; - $this->noInteraction = $noInteraction; - $this->noLogging = $noLogging; - $this->printer = $printer; - $this->processIsolation = $processIsolation; - $this->randomOrderSeed = $randomOrderSeed; - $this->repeat = $repeat; - $this->reportUselessTests = $reportUselessTests; - $this->resolveDependencies = $resolveDependencies; - $this->reverseList = $reverseList; - $this->stderr = $stderr; - $this->strictCoverage = $strictCoverage; - $this->stopOnDefect = $stopOnDefect; - $this->stopOnError = $stopOnError; - $this->stopOnFailure = $stopOnFailure; - $this->stopOnIncomplete = $stopOnIncomplete; - $this->stopOnRisky = $stopOnRisky; - $this->stopOnSkipped = $stopOnSkipped; - $this->stopOnWarning = $stopOnWarning; - $this->teamcityLogfile = $teamcityLogfile; - $this->testdoxExcludeGroups = $testdoxExcludeGroups; - $this->testdoxGroups = $testdoxGroups; - $this->testdoxHtmlFile = $testdoxHtmlFile; - $this->testdoxTextFile = $testdoxTextFile; - $this->testdoxXmlFile = $testdoxXmlFile; - $this->testSuffixes = $testSuffixes; - $this->testSuite = $testSuite; - $this->unrecognizedOptions = $unrecognizedOptions; - $this->unrecognizedOrderBy = $unrecognizedOrderBy; - $this->useDefaultConfiguration = $useDefaultConfiguration; - $this->verbose = $verbose; - $this->version = $version; - $this->xdebugFilterFile = $xdebugFilterFile; - } - public function hasArgument() : bool + public function getLoader(): \PHPUnit\Runner\TestSuiteLoader { - return $this->argument !== null; + return new \PHPUnit\Runner\StandardTestSuiteLoader(); } /** + * Returns the Test corresponding to the given suite. + * This is a template method, subclasses override + * the runFailed() and clearStatus() methods. + * + * @param string|string[] $suffixes + * * @throws Exception */ - public function argument() : string + public function getTest(string $suiteClassFile, $suffixes = ''): ?TestSuite { - if ($this->argument === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (is_dir($suiteClassFile)) { + /** @var string[] $files */ + $files = (new FileIteratorFacade())->getFilesAsArray($suiteClassFile, $suffixes); + $suite = new TestSuite($suiteClassFile); + $suite->addTestFiles($files); + return $suite; } - return $this->argument; - } - public function hasAtLeastVersion() : bool - { - return $this->atLeastVersion !== null; + if (is_file($suiteClassFile) && substr($suiteClassFile, -5, 5) === '.phpt') { + $suite = new TestSuite(); + $suite->addTestFile($suiteClassFile); + return $suite; + } + try { + $testClass = $this->loadSuiteClass($suiteClassFile); + } catch (\PHPUnit\Exception $e) { + $this->runFailed($e->getMessage()); + return null; + } + try { + $suiteMethod = $testClass->getMethod(self::SUITE_METHODNAME); + if (!$suiteMethod->isStatic()) { + $this->runFailed('suite() method must be static.'); + return null; + } + $test = $suiteMethod->invoke(null, $testClass->getName()); + } catch (ReflectionException $e) { + $test = new TestSuite($testClass); + } + $this->clearStatus(); + return $test; } /** - * @throws Exception + * Returns the loaded ReflectionClass for a suite name. */ - public function atLeastVersion() : string - { - if ($this->atLeastVersion === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->atLeastVersion; - } - public function hasBackupGlobals() : bool + protected function loadSuiteClass(string $suiteClassFile): ReflectionClass { - return $this->backupGlobals !== null; + return $this->getLoader()->load($suiteClassFile); } /** - * @throws Exception + * Clears the status message. */ - public function backupGlobals() : bool - { - if ($this->backupGlobals === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->backupGlobals; - } - public function hasBackupStaticAttributes() : bool + protected function clearStatus(): void { - return $this->backupStaticAttributes !== null; } /** - * @throws Exception + * Override to define how to handle a failed loading of + * a test suite. */ - public function backupStaticAttributes() : bool - { - if ($this->backupStaticAttributes === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->backupStaticAttributes; - } - public function hasBeStrictAboutChangesToGlobalState() : bool - { - return $this->beStrictAboutChangesToGlobalState !== null; - } + abstract protected function runFailed(string $message): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use const DIRECTORY_SEPARATOR; +use const LOCK_EX; +use function assert; +use function dirname; +use function file_get_contents; +use function file_put_contents; +use function in_array; +use function is_array; +use function is_dir; +use function is_file; +use function json_decode; +use function json_encode; +use function sprintf; +use PHPUnit\Util\Filesystem; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class DefaultTestResultCache implements \PHPUnit\Runner\TestResultCache +{ /** - * @throws Exception + * @var int */ - public function beStrictAboutChangesToGlobalState() : bool - { - if ($this->beStrictAboutChangesToGlobalState === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->beStrictAboutChangesToGlobalState; - } - public function hasBeStrictAboutResourceUsageDuringSmallTests() : bool - { - return $this->beStrictAboutResourceUsageDuringSmallTests !== null; - } + private const VERSION = 1; /** - * @throws Exception + * @psalm-var list */ - public function beStrictAboutResourceUsageDuringSmallTests() : bool - { - if ($this->beStrictAboutResourceUsageDuringSmallTests === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->beStrictAboutResourceUsageDuringSmallTests; - } - public function hasBootstrap() : bool - { - return $this->bootstrap !== null; - } + private const ALLOWED_TEST_STATUSES = [\PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED, \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE, \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE, \PHPUnit\Runner\BaseTestRunner::STATUS_ERROR, \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY, \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING]; /** - * @throws Exception + * @var string */ - public function bootstrap() : string - { - if ($this->bootstrap === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->bootstrap; - } - public function hasCacheResult() : bool - { - return $this->cacheResult !== null; - } + private const DEFAULT_RESULT_CACHE_FILENAME = '.phpunit.result.cache'; /** - * @throws Exception + * @var string */ - public function cacheResult() : bool - { - if ($this->cacheResult === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->cacheResult; - } - public function hasCacheResultFile() : bool - { - return $this->cacheResultFile !== null; - } + private $cacheFilename; /** - * @throws Exception + * @psalm-var array + */ + private $defects = []; + /** + * @psalm-var array */ - public function cacheResultFile() : string + private $times = []; + public function __construct(?string $filepath = null) { - if ($this->cacheResultFile === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if ($filepath !== null && is_dir($filepath)) { + $filepath .= DIRECTORY_SEPARATOR . self::DEFAULT_RESULT_CACHE_FILENAME; } - return $this->cacheResultFile; + $this->cacheFilename = $filepath ?? $_ENV['PHPUNIT_RESULT_CACHE'] ?? self::DEFAULT_RESULT_CACHE_FILENAME; } - public function hasCheckVersion() : bool + public function setState(string $testName, int $state): void { - return $this->checkVersion !== null; + if (!in_array($state, self::ALLOWED_TEST_STATUSES, \true)) { + return; + } + $this->defects[$testName] = $state; } - /** - * @throws Exception - */ - public function checkVersion() : bool + public function getState(string $testName): int { - if ($this->checkVersion === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->checkVersion; + return $this->defects[$testName] ?? \PHPUnit\Runner\BaseTestRunner::STATUS_UNKNOWN; } - public function hasColors() : bool + public function setTime(string $testName, float $time): void { - return $this->colors !== null; + $this->times[$testName] = $time; } - /** - * @throws Exception - */ - public function colors() : string + public function getTime(string $testName): float { - if ($this->colors === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->colors; + return $this->times[$testName] ?? 0.0; } - public function hasColumns() : bool + public function load(): void { - return $this->columns !== null; + if (!is_file($this->cacheFilename)) { + return; + } + $data = json_decode(file_get_contents($this->cacheFilename), \true); + if ($data === null) { + return; + } + if (!isset($data['version'])) { + return; + } + if ($data['version'] !== self::VERSION) { + return; + } + assert(isset($data['defects']) && is_array($data['defects'])); + assert(isset($data['times']) && is_array($data['times'])); + $this->defects = $data['defects']; + $this->times = $data['times']; } /** * @throws Exception */ - public function columns() + public function persist(): void { - if ($this->columns === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (!Filesystem::createDirectory(dirname($this->cacheFilename))) { + throw new \PHPUnit\Runner\Exception(sprintf('Cannot create directory "%s" for result cache file', $this->cacheFilename)); } - return $this->columns; - } - public function hasConfiguration() : bool - { - return $this->configuration !== null; + file_put_contents($this->cacheFilename, json_encode(['version' => self::VERSION, 'defects' => $this->defects, 'times' => $this->times]), LOCK_EX); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use RuntimeException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Exception extends RuntimeException implements \PHPUnit\Exception +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Extension; + +use function class_exists; +use function sprintf; +use PHPUnit\Framework\TestListener; +use PHPUnit\Runner\Exception; +use PHPUnit\Runner\Hook; +use PHPUnit\TextUI\TestRunner; +use PHPUnit\TextUI\XmlConfiguration\Extension; +use ReflectionClass; +use ReflectionException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ExtensionHandler +{ /** * @throws Exception */ - public function configuration() : string + public function registerExtension(Extension $extensionConfiguration, TestRunner $runner): void { - if ($this->configuration === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $extension = $this->createInstance($extensionConfiguration); + if (!$extension instanceof Hook) { + throw new Exception(sprintf('Class "%s" does not implement a PHPUnit\Runner\Hook interface', $extensionConfiguration->className())); } - return $this->configuration; - } - public function hasCoverageFilter() : bool - { - return $this->coverageFilter !== null; + $runner->addExtension($extension); } /** * @throws Exception + * + * @deprecated */ - public function coverageFilter() : array + public function createTestListenerInstance(Extension $listenerConfiguration): TestListener { - if ($this->coverageFilter === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $listener = $this->createInstance($listenerConfiguration); + if (!$listener instanceof TestListener) { + throw new Exception(sprintf('Class "%s" does not implement the PHPUnit\Framework\TestListener interface', $listenerConfiguration->className())); } - return $this->coverageFilter; - } - public function hasCoverageClover() : bool - { - return $this->coverageClover !== null; + return $listener; } /** * @throws Exception */ - public function coverageClover() : string + private function createInstance(Extension $extensionConfiguration): object { - if ($this->coverageClover === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $this->ensureClassExists($extensionConfiguration); + try { + $reflector = new ReflectionClass($extensionConfiguration->className()); + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); } - return $this->coverageClover; - } - public function hasCoverageCobertura() : bool - { - return $this->coverageCobertura !== null; + if (!$extensionConfiguration->hasArguments()) { + return $reflector->newInstance(); + } + return $reflector->newInstanceArgs($extensionConfiguration->arguments()); } /** * @throws Exception */ - public function coverageCobertura() : string + private function ensureClassExists(Extension $extensionConfiguration): void { - if ($this->coverageCobertura === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->coverageCobertura; - } - public function hasCoverageCrap4J() : bool - { - return $this->coverageCrap4J !== null; - } - /** - * @throws Exception - */ - public function coverageCrap4J() : string - { - if ($this->coverageCrap4J === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->coverageCrap4J; - } - public function hasCoverageHtml() : bool - { - return $this->coverageHtml !== null; - } - /** - * @throws Exception - */ - public function coverageHtml() : string - { - if ($this->coverageHtml === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->coverageHtml; - } - public function hasCoveragePhp() : bool - { - return $this->coveragePhp !== null; - } - /** - * @throws Exception - */ - public function coveragePhp() : string - { - if ($this->coveragePhp === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->coveragePhp; - } - public function hasCoverageText() : bool - { - return $this->coverageText !== null; - } - /** - * @throws Exception - */ - public function coverageText() : string - { - if ($this->coverageText === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->coverageText; - } - public function hasCoverageTextShowUncoveredFiles() : bool - { - return $this->coverageTextShowUncoveredFiles !== null; - } - /** - * @throws Exception - */ - public function coverageTextShowUncoveredFiles() : bool - { - if ($this->coverageTextShowUncoveredFiles === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->coverageTextShowUncoveredFiles; - } - public function hasCoverageTextShowOnlySummary() : bool - { - return $this->coverageTextShowOnlySummary !== null; - } - /** - * @throws Exception - */ - public function coverageTextShowOnlySummary() : bool - { - if ($this->coverageTextShowOnlySummary === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->coverageTextShowOnlySummary; - } - public function hasCoverageXml() : bool - { - return $this->coverageXml !== null; - } - /** - * @throws Exception - */ - public function coverageXml() : string - { - if ($this->coverageXml === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (class_exists($extensionConfiguration->className(), \false)) { + return; } - return $this->coverageXml; - } - public function hasPathCoverage() : bool - { - return $this->pathCoverage !== null; - } - /** - * @throws Exception - */ - public function pathCoverage() : bool - { - if ($this->pathCoverage === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if ($extensionConfiguration->hasSourceFile()) { + /** + * @noinspection PhpIncludeInspection + * + * @psalm-suppress UnresolvableInclude + */ + require_once $extensionConfiguration->sourceFile(); } - return $this->pathCoverage; - } - public function hasCoverageCacheDirectory() : bool - { - return $this->coverageCacheDirectory !== null; - } - /** - * @throws Exception - */ - public function coverageCacheDirectory() : string - { - if ($this->coverageCacheDirectory === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (!class_exists($extensionConfiguration->className())) { + throw new Exception(sprintf('Class "%s" does not exist', $extensionConfiguration->className())); } - return $this->coverageCacheDirectory; - } - public function hasWarmCoverageCache() : bool - { - return $this->warmCoverageCache !== null; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Extension; + +use function count; +use function explode; +use function implode; +use function is_file; +use function strpos; +use PHPUnitPHAR\PharIo\Manifest\ApplicationName; +use PHPUnitPHAR\PharIo\Manifest\Exception as ManifestException; +use PHPUnitPHAR\PharIo\Manifest\ManifestLoader; +use PHPUnitPHAR\PharIo\Version\Version as PharIoVersion; +use PHPUnit\Runner\Version; +use PHPUnitPHAR\SebastianBergmann\FileIterator\Facade as FileIteratorFacade; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class PharLoader +{ /** - * @throws Exception + * @psalm-return array{loadedExtensions: list, notLoadedExtensions: list} */ - public function warmCoverageCache() : bool + public function loadPharExtensionsInDirectory(string $directory): array { - if ($this->warmCoverageCache === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $loadedExtensions = []; + $notLoadedExtensions = []; + foreach ((new FileIteratorFacade())->getFilesAsArray($directory, '.phar') as $file) { + if (!is_file('phar://' . $file . '/manifest.xml')) { + $notLoadedExtensions[] = $file . ' is not an extension for PHPUnit'; + continue; + } + try { + $applicationName = new ApplicationName('phpunit/phpunit'); + $version = new PharIoVersion($this->phpunitVersion()); + $manifest = ManifestLoader::fromFile('phar://' . $file . '/manifest.xml'); + if (!$manifest->isExtensionFor($applicationName)) { + $notLoadedExtensions[] = $file . ' is not an extension for PHPUnit'; + continue; + } + if (!$manifest->isExtensionFor($applicationName, $version)) { + $notLoadedExtensions[] = $file . ' is not compatible with this version of PHPUnit'; + continue; + } + } catch (ManifestException $e) { + $notLoadedExtensions[] = $file . ': ' . $e->getMessage(); + continue; + } + /** + * @noinspection PhpIncludeInspection + * + * @psalm-suppress UnresolvableInclude + */ + require $file; + $loadedExtensions[] = $manifest->getName()->asString() . ' ' . $manifest->getVersion()->getVersionString(); } - return $this->warmCoverageCache; - } - public function hasDebug() : bool - { - return $this->debug !== null; + return ['loadedExtensions' => $loadedExtensions, 'notLoadedExtensions' => $notLoadedExtensions]; } - /** - * @throws Exception - */ - public function debug() : bool + private function phpunitVersion(): string { - if ($this->debug === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $version = Version::id(); + if (strpos($version, '-') === \false) { + return $version; } - return $this->debug; - } - public function hasDefaultTimeLimit() : bool - { - return $this->defaultTimeLimit !== null; - } - /** - * @throws Exception - */ - public function defaultTimeLimit() : int - { - if ($this->defaultTimeLimit === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $parts = explode('.', explode('-', $version)[0]); + if (count($parts) === 2) { + $parts[] = 0; } - return $this->defaultTimeLimit; + return implode('.', $parts); } - public function hasDisableCodeCoverageIgnore() : bool +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +use function in_array; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ExcludeGroupFilterIterator extends \PHPUnit\Runner\Filter\GroupFilterIterator +{ + protected function doAccept(string $hash): bool { - return $this->disableCodeCoverageIgnore !== null; + return !in_array($hash, $this->groupTests, \true); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +use function assert; +use function sprintf; +use FilterIterator; +use Iterator; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Runner\Exception; +use RecursiveFilterIterator; +use ReflectionClass; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Factory +{ /** - * @throws Exception + * @psalm-var array */ - public function disableCodeCoverageIgnore() : bool - { - if ($this->disableCodeCoverageIgnore === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->disableCodeCoverageIgnore; - } - public function hasDisallowTestOutput() : bool - { - return $this->disallowTestOutput !== null; - } + private $filters = []; /** + * @param array|string $args + * * @throws Exception */ - public function disallowTestOutput() : bool + public function addFilter(ReflectionClass $filter, $args): void { - if ($this->disallowTestOutput === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (!$filter->isSubclassOf(RecursiveFilterIterator::class)) { + throw new Exception(sprintf('Class "%s" does not extend RecursiveFilterIterator', $filter->name)); } - return $this->disallowTestOutput; - } - public function hasDisallowTodoAnnotatedTests() : bool - { - return $this->disallowTodoAnnotatedTests !== null; + $this->filters[] = [$filter, $args]; } - /** - * @throws Exception - */ - public function disallowTodoAnnotatedTests() : bool + public function factory(Iterator $iterator, TestSuite $suite): FilterIterator { - if ($this->disallowTodoAnnotatedTests === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + foreach ($this->filters as $filter) { + [$class, $args] = $filter; + $iterator = $class->newInstance($iterator, $args, $suite); } - return $this->disallowTodoAnnotatedTests; - } - public function hasEnforceTimeLimit() : bool - { - return $this->enforceTimeLimit !== null; + assert($iterator instanceof FilterIterator); + return $iterator; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +use function array_map; +use function array_merge; +use function in_array; +use function spl_object_hash; +use PHPUnit\Framework\TestSuite; +use RecursiveFilterIterator; +use RecursiveIterator; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +abstract class GroupFilterIterator extends RecursiveFilterIterator +{ /** - * @throws Exception + * @var string[] */ - public function enforceTimeLimit() : bool + protected $groupTests = []; + public function __construct(RecursiveIterator $iterator, array $groups, TestSuite $suite) { - if ($this->enforceTimeLimit === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + parent::__construct($iterator); + foreach ($suite->getGroupDetails() as $group => $tests) { + if (in_array((string) $group, $groups, \true)) { + $testHashes = array_map('spl_object_hash', $tests); + $this->groupTests = array_merge($this->groupTests, $testHashes); + } } - return $this->enforceTimeLimit; - } - public function hasExcludeGroups() : bool - { - return $this->excludeGroups !== null; } - /** - * @throws Exception - */ - public function excludeGroups() : array + public function accept(): bool { - if ($this->excludeGroups === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $test = $this->getInnerIterator()->current(); + if ($test instanceof TestSuite) { + return \true; } - return $this->excludeGroups; + return $this->doAccept(spl_object_hash($test)); } - public function hasExecutionOrder() : bool + abstract protected function doAccept(string $hash); +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +use function in_array; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class IncludeGroupFilterIterator extends \PHPUnit\Runner\Filter\GroupFilterIterator +{ + protected function doAccept(string $hash): bool { - return $this->executionOrder !== null; + return in_array($hash, $this->groupTests, \true); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +use function end; +use function implode; +use function preg_match; +use function sprintf; +use function str_replace; +use Exception; +use PHPUnit\Framework\ErrorTestCase; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\WarningTestCase; +use PHPUnit\Util\RegularExpression; +use PHPUnit\Util\Test; +use RecursiveFilterIterator; +use RecursiveIterator; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class NameFilterIterator extends RecursiveFilterIterator +{ /** - * @throws Exception + * @var string */ - public function executionOrder() : int - { - if ($this->executionOrder === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->executionOrder; - } - public function hasExecutionOrderDefects() : bool - { - return $this->executionOrderDefects !== null; - } + private $filter; /** - * @throws Exception + * @var int */ - public function executionOrderDefects() : int - { - if ($this->executionOrderDefects === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->executionOrderDefects; - } - public function hasFailOnEmptyTestSuite() : bool - { - return $this->failOnEmptyTestSuite !== null; - } + private $filterMin; /** - * @throws Exception + * @var int */ - public function failOnEmptyTestSuite() : bool - { - if ($this->failOnEmptyTestSuite === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->failOnEmptyTestSuite; - } - public function hasFailOnIncomplete() : bool - { - return $this->failOnIncomplete !== null; - } + private $filterMax; /** * @throws Exception */ - public function failOnIncomplete() : bool - { - if ($this->failOnIncomplete === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->failOnIncomplete; - } - public function hasFailOnRisky() : bool + public function __construct(RecursiveIterator $iterator, string $filter) { - return $this->failOnRisky !== null; + parent::__construct($iterator); + $this->setFilter($filter); } /** - * @throws Exception + * @throws InvalidArgumentException */ - public function failOnRisky() : bool + public function accept(): bool { - if ($this->failOnRisky === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $test = $this->getInnerIterator()->current(); + if ($test instanceof TestSuite) { + return \true; } - return $this->failOnRisky; - } - public function hasFailOnSkipped() : bool - { - return $this->failOnSkipped !== null; - } - /** - * @throws Exception - */ - public function failOnSkipped() : bool - { - if ($this->failOnSkipped === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $tmp = Test::describe($test); + if ($test instanceof ErrorTestCase || $test instanceof WarningTestCase) { + $name = $test->getMessage(); + } elseif ($tmp[0] !== '') { + $name = implode('::', $tmp); + } else { + $name = $tmp[1]; } - return $this->failOnSkipped; - } - public function hasFailOnWarning() : bool - { - return $this->failOnWarning !== null; - } - /** - * @throws Exception - */ - public function failOnWarning() : bool - { - if ($this->failOnWarning === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $accepted = @preg_match($this->filter, $name, $matches); + if ($accepted && isset($this->filterMax)) { + $set = end($matches); + $accepted = $set >= $this->filterMin && $set <= $this->filterMax; } - return $this->failOnWarning; - } - public function hasFilter() : bool - { - return $this->filter !== null; + return (bool) $accepted; } /** * @throws Exception */ - public function filter() : string + private function setFilter(string $filter): void { - if ($this->filter === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (RegularExpression::safeMatch($filter, '') === \false) { + // Handles: + // * testAssertEqualsSucceeds#4 + // * testAssertEqualsSucceeds#4-8 + if (preg_match('/^(.*?)#(\d+)(?:-(\d+))?$/', $filter, $matches)) { + if (isset($matches[3]) && $matches[2] < $matches[3]) { + $filter = sprintf('%s.*with data set #(\d+)$', $matches[1]); + $this->filterMin = (int) $matches[2]; + $this->filterMax = (int) $matches[3]; + } else { + $filter = sprintf('%s.*with data set #%s$', $matches[1], $matches[2]); + } + } elseif (preg_match('/^(.*?)@(.+)$/', $filter, $matches)) { + $filter = sprintf('%s.*with data set "%s"$', $matches[1], $matches[2]); + } + // Escape delimiters in regular expression. Do NOT use preg_quote, + // to keep magic characters. + $filter = sprintf('/%s/i', str_replace('/', '\/', $filter)); } - return $this->filter; - } - public function hasGenerateConfiguration() : bool - { - return $this->generateConfiguration !== null; + $this->filter = $filter; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterIncompleteTestHook extends \PHPUnit\Runner\TestHook +{ + public function executeAfterIncompleteTest(string $test, string $message, float $time): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterLastTestHook extends \PHPUnit\Runner\Hook +{ + public function executeAfterLastTest(): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterRiskyTestHook extends \PHPUnit\Runner\TestHook +{ + public function executeAfterRiskyTest(string $test, string $message, float $time): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterSkippedTestHook extends \PHPUnit\Runner\TestHook +{ + public function executeAfterSkippedTest(string $test, string $message, float $time): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterSuccessfulTestHook extends \PHPUnit\Runner\TestHook +{ + public function executeAfterSuccessfulTest(string $test, float $time): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterTestErrorHook extends \PHPUnit\Runner\TestHook +{ + public function executeAfterTestError(string $test, string $message, float $time): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterTestFailureHook extends \PHPUnit\Runner\TestHook +{ + public function executeAfterTestFailure(string $test, string $message, float $time): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterTestHook extends \PHPUnit\Runner\TestHook +{ /** - * @throws Exception + * This hook will fire after any test, regardless of the result. + * + * For more fine grained control, have a look at the other hooks + * that extend PHPUnit\Runner\Hook. */ - public function generateConfiguration() : bool - { - if ($this->generateConfiguration === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->generateConfiguration; - } - public function hasMigrateConfiguration() : bool - { - return $this->migrateConfiguration !== null; - } + public function executeAfterTest(string $test, float $time): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface AfterTestWarningHook extends \PHPUnit\Runner\TestHook +{ + public function executeAfterTestWarning(string $test, string $message, float $time): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface BeforeFirstTestHook extends \PHPUnit\Runner\Hook +{ + public function executeBeforeFirstTest(): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface BeforeTestHook extends \PHPUnit\Runner\TestHook +{ + public function executeBeforeTest(string $test): void; +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface Hook +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * This interface, as well as the associated mechanism for extending PHPUnit, + * will be removed in PHPUnit 10. There is no alternative available in this + * version of PHPUnit. + * + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit + * + * @see https://github.com/sebastianbergmann/phpunit/issues/4676 + */ +interface TestHook extends \PHPUnit\Runner\Hook +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestListener; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Util\Test as TestUtil; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class TestListenerAdapter implements TestListener +{ /** - * @throws Exception + * @var TestHook[] */ - public function migrateConfiguration() : bool - { - if ($this->migrateConfiguration === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->migrateConfiguration; - } - public function hasGroups() : bool - { - return $this->groups !== null; - } + private $hooks = []; /** - * @throws Exception + * @var bool */ - public function groups() : array + private $lastTestWasNotSuccessful; + public function add(\PHPUnit\Runner\TestHook $hook): void { - if ($this->groups === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->groups; + $this->hooks[] = $hook; } - public function hasTestsCovering() : bool + public function startTest(Test $test): void { - return $this->testsCovering !== null; + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\BeforeTestHook) { + $hook->executeBeforeTest(TestUtil::describeAsString($test)); + } + } + $this->lastTestWasNotSuccessful = \false; } - /** - * @throws Exception - */ - public function testsCovering() : array + public function addError(Test $test, Throwable $t, float $time): void { - if ($this->testsCovering === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\AfterTestErrorHook) { + $hook->executeAfterTestError(TestUtil::describeAsString($test), $t->getMessage(), $time); + } } - return $this->testsCovering; + $this->lastTestWasNotSuccessful = \true; } - public function hasTestsUsing() : bool + public function addWarning(Test $test, Warning $e, float $time): void { - return $this->testsUsing !== null; + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\AfterTestWarningHook) { + $hook->executeAfterTestWarning(TestUtil::describeAsString($test), $e->getMessage(), $time); + } + } + $this->lastTestWasNotSuccessful = \true; } - /** - * @throws Exception - */ - public function testsUsing() : array + public function addFailure(Test $test, AssertionFailedError $e, float $time): void { - if ($this->testsUsing === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\AfterTestFailureHook) { + $hook->executeAfterTestFailure(TestUtil::describeAsString($test), $e->getMessage(), $time); + } } - return $this->testsUsing; + $this->lastTestWasNotSuccessful = \true; } - public function hasHelp() : bool + public function addIncompleteTest(Test $test, Throwable $t, float $time): void { - return $this->help !== null; + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\AfterIncompleteTestHook) { + $hook->executeAfterIncompleteTest(TestUtil::describeAsString($test), $t->getMessage(), $time); + } + } + $this->lastTestWasNotSuccessful = \true; } - /** - * @throws Exception - */ - public function help() : bool + public function addRiskyTest(Test $test, Throwable $t, float $time): void { - if ($this->help === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\AfterRiskyTestHook) { + $hook->executeAfterRiskyTest(TestUtil::describeAsString($test), $t->getMessage(), $time); + } } - return $this->help; + $this->lastTestWasNotSuccessful = \true; } - public function hasIncludePath() : bool + public function addSkippedTest(Test $test, Throwable $t, float $time): void { - return $this->includePath !== null; + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\AfterSkippedTestHook) { + $hook->executeAfterSkippedTest(TestUtil::describeAsString($test), $t->getMessage(), $time); + } + } + $this->lastTestWasNotSuccessful = \true; } - /** - * @throws Exception - */ - public function includePath() : string + public function endTest(Test $test, float $time): void { - if ($this->includePath === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (!$this->lastTestWasNotSuccessful) { + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\AfterSuccessfulTestHook) { + $hook->executeAfterSuccessfulTest(TestUtil::describeAsString($test), $time); + } + } + } + foreach ($this->hooks as $hook) { + if ($hook instanceof \PHPUnit\Runner\AfterTestHook) { + $hook->executeAfterTest(TestUtil::describeAsString($test), $time); + } } - return $this->includePath; } - public function hasIniSettings() : bool + public function startTestSuite(TestSuite $suite): void { - return $this->iniSettings !== null; } - /** - * @throws Exception - */ - public function iniSettings() : array + public function endTestSuite(TestSuite $suite): void { - if ($this->iniSettings === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->iniSettings; } - public function hasJunitLogfile() : bool +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class NullTestResultCache implements \PHPUnit\Runner\TestResultCache +{ + public function setState(string $testName, int $state): void { - return $this->junitLogfile !== null; } - /** - * @throws Exception - */ - public function junitLogfile() : string + public function getState(string $testName): int { - if ($this->junitLogfile === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->junitLogfile; + return \PHPUnit\Runner\BaseTestRunner::STATUS_UNKNOWN; } - public function hasListGroups() : bool + public function setTime(string $testName, float $time): void { - return $this->listGroups !== null; } - /** - * @throws Exception - */ - public function listGroups() : bool + public function getTime(string $testName): float { - if ($this->listGroups === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->listGroups; + return 0; } - public function hasListSuites() : bool + public function load(): void { - return $this->listSuites !== null; } - /** - * @throws Exception - */ - public function listSuites() : bool + public function persist(): void { - if ($this->listSuites === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->listSuites; - } - public function hasListTests() : bool - { - return $this->listTests !== null; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use const DEBUG_BACKTRACE_IGNORE_ARGS; +use const DIRECTORY_SEPARATOR; +use function array_merge; +use function basename; +use function debug_backtrace; +use function defined; +use function dirname; +use function explode; +use function extension_loaded; +use function file; +use function file_get_contents; +use function file_put_contents; +use function is_array; +use function is_file; +use function is_readable; +use function is_string; +use function ltrim; +use function phpversion; +use function preg_match; +use function preg_replace; +use function preg_split; +use function realpath; +use function rtrim; +use function sprintf; +use function str_replace; +use function strncasecmp; +use function strpos; +use function substr; +use function trim; +use function unlink; +use function unserialize; +use function var_export; +use function version_compare; +use PHPUnit\Framework\Assert; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\ExecutionOrderDependency; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\IncompleteTestError; +use PHPUnit\Framework\PHPTAssertionFailedError; +use PHPUnit\Framework\Reorderable; +use PHPUnit\Framework\SelfDescribing; +use PHPUnit\Framework\SkippedTestError; +use PHPUnit\Framework\SyntheticSkippedError; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestResult; +use PHPUnit\Util\PHP\AbstractPhpProcess; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\InvalidArgumentException; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\RawCodeCoverageData; +use PHPUnitPHAR\SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException; +use PHPUnitPHAR\SebastianBergmann\Template\Template; +use PHPUnitPHAR\SebastianBergmann\Timer\Timer; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class PhptTestCase implements Reorderable, SelfDescribing, Test +{ /** - * @throws Exception + * @var string */ - public function listTests() : bool - { - if ($this->listTests === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->listTests; - } - public function hasListTestsXml() : bool - { - return $this->listTestsXml !== null; - } + private $filename; /** - * @throws Exception + * @var AbstractPhpProcess */ - public function listTestsXml() : string - { - if ($this->listTestsXml === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->listTestsXml; - } - public function hasLoader() : bool - { - return $this->loader !== null; - } + private $phpUtil; /** - * @throws Exception + * @var string */ - public function loader() : string - { - if ($this->loader === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->loader; - } - public function hasNoCoverage() : bool - { - return $this->noCoverage !== null; - } + private $output = ''; /** + * Constructs a test case with the given filename. + * * @throws Exception */ - public function noCoverage() : bool + public function __construct(string $filename, ?AbstractPhpProcess $phpUtil = null) { - if ($this->noCoverage === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (!is_file($filename)) { + throw new \PHPUnit\Runner\Exception(sprintf('File "%s" does not exist.', $filename)); } - return $this->noCoverage; - } - public function hasNoExtensions() : bool - { - return $this->noExtensions !== null; + $this->filename = $filename; + $this->phpUtil = $phpUtil ?: AbstractPhpProcess::factory(); } /** - * @throws Exception + * Counts the number of test cases executed by run(TestResult result). */ - public function noExtensions() : bool - { - if ($this->noExtensions === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->noExtensions; - } - public function hasExtensions() : bool + public function count(): int { - return $this->extensions !== null; + return 1; } /** + * Runs a test and collects its result in a TestResult instance. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException * @throws Exception + * @throws InvalidArgumentException + * @throws UnintentionallyCoveredCodeException */ - public function extensions() : array + public function run(?TestResult $result = null): TestResult { - if ($this->extensions === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if ($result === null) { + $result = new TestResult(); } - return $this->extensions; - } - public function hasUnavailableExtensions() : bool - { - return $this->unavailableExtensions !== null; + try { + $sections = $this->parse(); + } catch (\PHPUnit\Runner\Exception $e) { + $result->startTest($this); + $result->addFailure($this, new SkippedTestError($e->getMessage()), 0); + $result->endTest($this, 0); + return $result; + } + $code = $this->render($sections['FILE']); + $xfail = \false; + $settings = $this->parseIniSection($this->settings($result->getCollectCodeCoverageInformation())); + $result->startTest($this); + if (isset($sections['INI'])) { + $settings = $this->parseIniSection($sections['INI'], $settings); + } + if (isset($sections['ENV'])) { + $env = $this->parseEnvSection($sections['ENV']); + $this->phpUtil->setEnv($env); + } + $this->phpUtil->setUseStderrRedirection(\true); + if ($result->enforcesTimeLimit()) { + $this->phpUtil->setTimeout($result->getTimeoutForLargeTests()); + } + $skip = $this->runSkip($sections, $result, $settings); + if ($skip) { + return $result; + } + if (isset($sections['XFAIL'])) { + $xfail = trim($sections['XFAIL']); + } + if (isset($sections['STDIN'])) { + $this->phpUtil->setStdin($sections['STDIN']); + } + if (isset($sections['ARGS'])) { + $this->phpUtil->setArgs($sections['ARGS']); + } + if ($result->getCollectCodeCoverageInformation()) { + $codeCoverageCacheDirectory = null; + $pathCoverage = \false; + $codeCoverage = $result->getCodeCoverage(); + if ($codeCoverage) { + if ($codeCoverage->cachesStaticAnalysis()) { + $codeCoverageCacheDirectory = $codeCoverage->cacheDirectory(); + } + $pathCoverage = $codeCoverage->collectsBranchAndPathCoverage(); + } + $this->renderForCoverage($code, $pathCoverage, $codeCoverageCacheDirectory); + } + $timer = new Timer(); + $timer->start(); + $jobResult = $this->phpUtil->runJob($code, $this->stringifyIni($settings)); + $time = $timer->stop()->asSeconds(); + $this->output = $jobResult['stdout'] ?? ''; + if (isset($codeCoverage) && $coverage = $this->cleanupForCoverage()) { + $codeCoverage->append($coverage, $this, \true, [], []); + } + try { + $this->assertPhptExpectation($sections, $this->output); + } catch (AssertionFailedError $e) { + $failure = $e; + if ($xfail !== \false) { + $failure = new IncompleteTestError($xfail, 0, $e); + } elseif ($e instanceof ExpectationFailedException) { + $comparisonFailure = $e->getComparisonFailure(); + if ($comparisonFailure) { + $diff = $comparisonFailure->getDiff(); + } else { + $diff = $e->getMessage(); + } + $hint = $this->getLocationHintFromDiff($diff, $sections); + $trace = array_merge($hint, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); + $failure = new PHPTAssertionFailedError($e->getMessage(), 0, $trace[0]['file'], $trace[0]['line'], $trace, $comparisonFailure ? $diff : ''); + } + $result->addFailure($this, $failure, $time); + } catch (Throwable $t) { + $result->addError($this, $t, $time); + } + if ($xfail !== \false && $result->allCompletelyImplemented()) { + $result->addFailure($this, new IncompleteTestError('XFAIL section but test passes'), $time); + } + $this->runClean($sections, $result->getCollectCodeCoverageInformation()); + $result->endTest($this, $time); + return $result; } /** - * @throws Exception + * Returns the name of the test case. */ - public function unavailableExtensions() : array - { - if ($this->unavailableExtensions === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->unavailableExtensions; - } - public function hasNoInteraction() : bool + public function getName(): string { - return $this->noInteraction !== null; + return $this->toString(); } /** - * @throws Exception + * Returns a string representation of the test case. */ - public function noInteraction() : bool + public function toString(): string { - if ($this->noInteraction === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->noInteraction; + return $this->filename; } - public function hasNoLogging() : bool + public function usesDataProvider(): bool { - return $this->noLogging !== null; + return \false; } - /** - * @throws Exception - */ - public function noLogging() : bool + public function getNumAssertions(): int { - if ($this->noLogging === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->noLogging; + return 1; } - public function hasPrinter() : bool + public function getActualOutput(): string { - return $this->printer !== null; + return $this->output; } - /** - * @throws Exception - */ - public function printer() : string + public function hasOutput(): bool { - if ($this->printer === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->printer; + return !empty($this->output); } - public function hasProcessIsolation() : bool + public function sortId(): string { - return $this->processIsolation !== null; + return $this->filename; } /** - * @throws Exception + * @return list */ - public function processIsolation() : bool - { - if ($this->processIsolation === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->processIsolation; - } - public function hasRandomOrderSeed() : bool + public function provides(): array { - return $this->randomOrderSeed !== null; + return []; } /** - * @throws Exception + * @return list */ - public function randomOrderSeed() : int - { - if ($this->randomOrderSeed === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->randomOrderSeed; - } - public function hasRepeat() : bool + public function requires(): array { - return $this->repeat !== null; + return []; } /** - * @throws Exception + * Parse --INI-- section key value pairs and return as array. + * + * @param array|string $content */ - public function repeat() : int + private function parseIniSection($content, array $ini = []): array { - if ($this->repeat === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (is_string($content)) { + $content = explode("\n", trim($content)); } - return $this->repeat; + foreach ($content as $setting) { + if (strpos($setting, '=') === \false) { + continue; + } + $setting = explode('=', $setting, 2); + $name = trim($setting[0]); + $value = trim($setting[1]); + if ($name === 'extension' || $name === 'zend_extension') { + if (!isset($ini[$name])) { + $ini[$name] = []; + } + $ini[$name][] = $value; + continue; + } + $ini[$name] = $value; + } + return $ini; } - public function hasReportUselessTests() : bool + private function parseEnvSection(string $content): array { - return $this->reportUselessTests !== null; + $env = []; + foreach (explode("\n", trim($content)) as $e) { + $e = explode('=', trim($e), 2); + if ($e[0] !== '' && isset($e[1])) { + $env[$e[0]] = $e[1]; + } + } + return $env; } /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException * @throws Exception + * @throws ExpectationFailedException */ - public function reportUselessTests() : bool + private function assertPhptExpectation(array $sections, string $output): void { - if ($this->reportUselessTests === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $assertions = ['EXPECT' => 'assertEquals', 'EXPECTF' => 'assertStringMatchesFormat', 'EXPECTREGEX' => 'assertMatchesRegularExpression']; + $actual = preg_replace('/\r\n/', "\n", trim($output)); + foreach ($assertions as $sectionName => $sectionAssertion) { + if (isset($sections[$sectionName])) { + $sectionContent = preg_replace('/\r\n/', "\n", trim($sections[$sectionName])); + $expected = ($sectionName === 'EXPECTREGEX') ? "/{$sectionContent}/" : $sectionContent; + if ($expected === '') { + throw new \PHPUnit\Runner\Exception('No PHPT expectation found'); + } + Assert::$sectionAssertion($expected, $actual); + return; + } } - return $this->reportUselessTests; - } - public function hasResolveDependencies() : bool - { - return $this->resolveDependencies !== null; + throw new \PHPUnit\Runner\Exception('No PHPT assertion found'); } /** - * @throws Exception + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException */ - public function resolveDependencies() : bool + private function runSkip(array &$sections, TestResult $result, array $settings): bool { - if ($this->resolveDependencies === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (!isset($sections['SKIPIF'])) { + return \false; } - return $this->resolveDependencies; + $skipif = $this->render($sections['SKIPIF']); + $jobResult = $this->phpUtil->runJob($skipif, $this->stringifyIni($settings)); + if (!strncasecmp('skip', ltrim($jobResult['stdout']), 4)) { + $message = ''; + if (preg_match('/^\s*skip\s*(.+)\s*/i', $jobResult['stdout'], $skipMatch)) { + $message = substr($skipMatch[1], 2); + } + $hint = $this->getLocationHint($message, $sections, 'SKIPIF'); + $trace = array_merge($hint, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); + $result->addFailure($this, new SyntheticSkippedError($message, 0, $trace[0]['file'], $trace[0]['line'], $trace), 0); + $result->endTest($this, 0); + return \true; + } + return \false; } - public function hasReverseList() : bool + private function runClean(array &$sections, bool $collectCoverage): void { - return $this->reverseList !== null; + $this->phpUtil->setStdin(''); + $this->phpUtil->setArgs(''); + if (isset($sections['CLEAN'])) { + $cleanCode = $this->render($sections['CLEAN']); + $this->phpUtil->runJob($cleanCode, $this->settings($collectCoverage)); + } } /** * @throws Exception */ - public function reverseList() : bool + private function parse(): array { - if ($this->reverseList === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $sections = []; + $section = ''; + $unsupportedSections = ['CGI', 'COOKIE', 'DEFLATE_POST', 'EXPECTHEADERS', 'EXTENSIONS', 'GET', 'GZIP_POST', 'HEADERS', 'PHPDBG', 'POST', 'POST_RAW', 'PUT', 'REDIRECTTEST', 'REQUEST']; + $lineNr = 0; + foreach (file($this->filename) as $line) { + $lineNr++; + if (preg_match('/^--([_A-Z]+)--/', $line, $result)) { + $section = $result[1]; + $sections[$section] = ''; + $sections[$section . '_offset'] = $lineNr; + continue; + } + if (empty($section)) { + throw new \PHPUnit\Runner\Exception('Invalid PHPT file: empty section header'); + } + $sections[$section] .= $line; } - return $this->reverseList; - } - public function hasStderr() : bool - { - return $this->stderr !== null; + if (isset($sections['FILEEOF'])) { + $sections['FILE'] = rtrim($sections['FILEEOF'], "\r\n"); + unset($sections['FILEEOF']); + } + $this->parseExternal($sections); + if (!$this->validate($sections)) { + throw new \PHPUnit\Runner\Exception('Invalid PHPT file'); + } + foreach ($unsupportedSections as $section) { + if (isset($sections[$section])) { + throw new \PHPUnit\Runner\Exception("PHPUnit does not support PHPT {$section} sections"); + } + } + return $sections; } /** * @throws Exception */ - public function stderr() : bool + private function parseExternal(array &$sections): void { - if ($this->stderr === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $allowSections = ['FILE', 'EXPECT', 'EXPECTF', 'EXPECTREGEX']; + $testDirectory = dirname($this->filename) . DIRECTORY_SEPARATOR; + foreach ($allowSections as $section) { + if (isset($sections[$section . '_EXTERNAL'])) { + $externalFilename = trim($sections[$section . '_EXTERNAL']); + if (!is_file($testDirectory . $externalFilename) || !is_readable($testDirectory . $externalFilename)) { + throw new \PHPUnit\Runner\Exception(sprintf('Could not load --%s-- %s for PHPT file', $section . '_EXTERNAL', $testDirectory . $externalFilename)); + } + $sections[$section] = file_get_contents($testDirectory . $externalFilename); + } } - return $this->stderr; - } - public function hasStrictCoverage() : bool - { - return $this->strictCoverage !== null; } - /** - * @throws Exception - */ - public function strictCoverage() : bool + private function validate(array &$sections): bool { - if ($this->strictCoverage === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $requiredSections = ['FILE', ['EXPECT', 'EXPECTF', 'EXPECTREGEX']]; + foreach ($requiredSections as $section) { + if (is_array($section)) { + $foundSection = \false; + foreach ($section as $anySection) { + if (isset($sections[$anySection])) { + $foundSection = \true; + break; + } + } + if (!$foundSection) { + return \false; + } + continue; + } + if (!isset($sections[$section])) { + return \false; + } } - return $this->strictCoverage; + return \true; } - public function hasStopOnDefect() : bool + private function render(string $code): string { - return $this->stopOnDefect !== null; + return str_replace(['__DIR__', '__FILE__'], ["'" . dirname($this->filename) . "'", "'" . $this->filename . "'"], $code); } - /** - * @throws Exception - */ - public function stopOnDefect() : bool + private function getCoverageFiles(): array { - if ($this->stopOnDefect === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->stopOnDefect; + $baseDir = dirname(realpath($this->filename)) . DIRECTORY_SEPARATOR; + $basename = basename($this->filename, 'phpt'); + return ['coverage' => $baseDir . $basename . 'coverage', 'job' => $baseDir . $basename . 'php']; } - public function hasStopOnError() : bool + private function renderForCoverage(string &$job, bool $pathCoverage, ?string $codeCoverageCacheDirectory): void { - return $this->stopOnError !== null; + $files = $this->getCoverageFiles(); + $template = new Template(__DIR__ . '/../Util/PHP/Template/PhptTestCase.tpl'); + $composerAutoload = '\'\''; + if (defined('PHPUNIT_COMPOSER_INSTALL')) { + $composerAutoload = var_export(PHPUNIT_COMPOSER_INSTALL, \true); + } + $phar = '\'\''; + if (defined('__PHPUNIT_PHAR__')) { + $phar = var_export(__PHPUNIT_PHAR__, \true); + } + $globals = ''; + if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { + $globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . var_export($GLOBALS['__PHPUNIT_BOOTSTRAP'], \true) . ";\n"; + } + if ($codeCoverageCacheDirectory === null) { + $codeCoverageCacheDirectory = 'null'; + } else { + $codeCoverageCacheDirectory = "'" . $codeCoverageCacheDirectory . "'"; + } + $template->setVar(['composerAutoload' => $composerAutoload, 'phar' => $phar, 'globals' => $globals, 'job' => $files['job'], 'coverageFile' => $files['coverage'], 'driverMethod' => $pathCoverage ? 'forLineAndPathCoverage' : 'forLineCoverage', 'codeCoverageCacheDirectory' => $codeCoverageCacheDirectory]); + file_put_contents($files['job'], $job); + $job = $template->render(); } - /** - * @throws Exception - */ - public function stopOnError() : bool + private function cleanupForCoverage(): RawCodeCoverageData { - if ($this->stopOnError === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $coverage = RawCodeCoverageData::fromXdebugWithoutPathCoverage([]); + $files = $this->getCoverageFiles(); + if (is_file($files['coverage'])) { + $buffer = @file_get_contents($files['coverage']); + if ($buffer !== \false) { + $coverage = @unserialize($buffer); + if ($coverage === \false) { + $coverage = RawCodeCoverageData::fromXdebugWithoutPathCoverage([]); + } + } } - return $this->stopOnError; + foreach ($files as $file) { + @unlink($file); + } + return $coverage; } - public function hasStopOnFailure() : bool + private function stringifyIni(array $ini): array { - return $this->stopOnFailure !== null; + $settings = []; + foreach ($ini as $key => $value) { + if (is_array($value)) { + foreach ($value as $val) { + $settings[] = $key . '=' . $val; + } + continue; + } + $settings[] = $key . '=' . $value; + } + return $settings; } - /** - * @throws Exception - */ - public function stopOnFailure() : bool + private function getLocationHintFromDiff(string $message, array $sections): array { - if ($this->stopOnFailure === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $needle = ''; + $previousLine = ''; + $block = 'message'; + foreach (preg_split('/\r\n|\r|\n/', $message) as $line) { + $line = trim($line); + if ($block === 'message' && $line === '--- Expected') { + $block = 'expected'; + } + if ($block === 'expected' && $line === '@@ @@') { + $block = 'diff'; + } + if ($block === 'diff') { + if (strpos($line, '+') === 0) { + $needle = $this->getCleanDiffLine($previousLine); + break; + } + if (strpos($line, '-') === 0) { + $needle = $this->getCleanDiffLine($line); + break; + } + } + if (!empty($line)) { + $previousLine = $line; + } } - return $this->stopOnFailure; - } - public function hasStopOnIncomplete() : bool - { - return $this->stopOnIncomplete !== null; + return $this->getLocationHint($needle, $sections); } - /** - * @throws Exception - */ - public function stopOnIncomplete() : bool + private function getCleanDiffLine(string $line): string { - if ($this->stopOnIncomplete === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (preg_match('/^[\-+]([\'\"]?)(.*)\1$/', $line, $matches)) { + $line = $matches[2]; } - return $this->stopOnIncomplete; - } - public function hasStopOnRisky() : bool - { - return $this->stopOnRisky !== null; + return $line; } - /** - * @throws Exception - */ - public function stopOnRisky() : bool + private function getLocationHint(string $needle, array $sections, ?string $sectionName = null): array { - if ($this->stopOnRisky === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $needle = trim($needle); + if (empty($needle)) { + return [['file' => realpath($this->filename), 'line' => 1]]; } - return $this->stopOnRisky; - } - public function hasStopOnSkipped() : bool - { - return $this->stopOnSkipped !== null; - } - /** - * @throws Exception - */ - public function stopOnSkipped() : bool - { - if ($this->stopOnSkipped === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if ($sectionName) { + $search = [$sectionName]; + } else { + $search = [ + // 'FILE', + 'EXPECT', + 'EXPECTF', + 'EXPECTREGEX', + ]; } - return $this->stopOnSkipped; - } - public function hasStopOnWarning() : bool - { - return $this->stopOnWarning !== null; - } - /** - * @throws Exception - */ - public function stopOnWarning() : bool - { - if ($this->stopOnWarning === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $sectionOffset = null; + foreach ($search as $section) { + if (!isset($sections[$section])) { + continue; + } + if (isset($sections[$section . '_EXTERNAL'])) { + $externalFile = trim($sections[$section . '_EXTERNAL']); + return [['file' => realpath(dirname($this->filename) . DIRECTORY_SEPARATOR . $externalFile), 'line' => 1], ['file' => realpath($this->filename), 'line' => ($sections[$section . '_EXTERNAL_offset'] ?? 0) + 1]]; + } + $sectionOffset = $sections[$section . '_offset'] ?? 0; + $offset = $sectionOffset + 1; + foreach (preg_split('/\r\n|\r|\n/', $sections[$section]) as $line) { + if (strpos($line, $needle) !== \false) { + return [['file' => realpath($this->filename), 'line' => $offset]]; + } + $offset++; + } } - return $this->stopOnWarning; - } - public function hasTeamcityLogfile() : bool - { - return $this->teamcityLogfile !== null; - } - /** - * @throws Exception - */ - public function teamcityLogfile() : string - { - if ($this->teamcityLogfile === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if ($sectionName) { + // String not found in specified section, show user the start of the named section + return [['file' => realpath($this->filename), 'line' => $sectionOffset]]; } - return $this->teamcityLogfile; - } - public function hasTestdoxExcludeGroups() : bool - { - return $this->testdoxExcludeGroups !== null; + // No section specified, show user start of code + return [['file' => realpath($this->filename), 'line' => 1]]; } /** - * @throws Exception + * @psalm-return list */ - public function testdoxExcludeGroups() : array + private function settings(bool $collectCoverage): array { - if ($this->testdoxExcludeGroups === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $settings = ['allow_url_fopen=1', 'auto_append_file=', 'auto_prepend_file=', 'disable_functions=', 'display_errors=1', 'docref_ext=.html', 'docref_root=', 'error_append_string=', 'error_prepend_string=', 'error_reporting=-1', 'html_errors=0', 'log_errors=0', 'open_basedir=', 'output_buffering=Off', 'output_handler=', 'report_memleaks=0', 'report_zend_debug=0']; + if (extension_loaded('pcov')) { + if ($collectCoverage) { + $settings[] = 'pcov.enabled=1'; + } else { + $settings[] = 'pcov.enabled=0'; + } } - return $this->testdoxExcludeGroups; - } - public function hasTestdoxGroups() : bool - { - return $this->testdoxGroups !== null; - } - /** - * @throws Exception - */ - public function testdoxGroups() : array - { - if ($this->testdoxGroups === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (extension_loaded('xdebug')) { + if (version_compare(phpversion('xdebug'), '3', '>=')) { + if ($collectCoverage) { + $settings[] = 'xdebug.mode=coverage'; + } else { + $settings[] = 'xdebug.mode=off'; + } + } else { + $settings[] = 'xdebug.default_enable=0'; + if ($collectCoverage) { + $settings[] = 'xdebug.coverage_enable=1'; + } + } } - return $this->testdoxGroups; - } - public function hasTestdoxHtmlFile() : bool - { - return $this->testdoxHtmlFile !== null; + return $settings; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use function preg_match; +use function round; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class ResultCacheExtension implements \PHPUnit\Runner\AfterIncompleteTestHook, \PHPUnit\Runner\AfterLastTestHook, \PHPUnit\Runner\AfterRiskyTestHook, \PHPUnit\Runner\AfterSkippedTestHook, \PHPUnit\Runner\AfterSuccessfulTestHook, \PHPUnit\Runner\AfterTestErrorHook, \PHPUnit\Runner\AfterTestFailureHook, \PHPUnit\Runner\AfterTestWarningHook +{ /** - * @throws Exception + * @var TestResultCache */ - public function testdoxHtmlFile() : string - { - if ($this->testdoxHtmlFile === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->testdoxHtmlFile; - } - public function hasTestdoxTextFile() : bool + private $cache; + public function __construct(\PHPUnit\Runner\TestResultCache $cache) { - return $this->testdoxTextFile !== null; + $this->cache = $cache; } - /** - * @throws Exception - */ - public function testdoxTextFile() : string + public function flush(): void { - if ($this->testdoxTextFile === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->testdoxTextFile; + $this->cache->persist(); } - public function hasTestdoxXmlFile() : bool + public function executeAfterSuccessfulTest(string $test, float $time): void { - return $this->testdoxXmlFile !== null; + $testName = $this->getTestName($test); + $this->cache->setTime($testName, round($time, 3)); } - /** - * @throws Exception - */ - public function testdoxXmlFile() : string + public function executeAfterIncompleteTest(string $test, string $message, float $time): void { - if ($this->testdoxXmlFile === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->testdoxXmlFile; + $testName = $this->getTestName($test); + $this->cache->setTime($testName, round($time, 3)); + $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE); } - public function hasTestSuffixes() : bool + public function executeAfterRiskyTest(string $test, string $message, float $time): void { - return $this->testSuffixes !== null; + $testName = $this->getTestName($test); + $this->cache->setTime($testName, round($time, 3)); + $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY); } - /** - * @throws Exception - */ - public function testSuffixes() : array + public function executeAfterSkippedTest(string $test, string $message, float $time): void { - if ($this->testSuffixes === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->testSuffixes; + $testName = $this->getTestName($test); + $this->cache->setTime($testName, round($time, 3)); + $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED); } - public function hasTestSuite() : bool + public function executeAfterTestError(string $test, string $message, float $time): void { - return $this->testSuite !== null; + $testName = $this->getTestName($test); + $this->cache->setTime($testName, round($time, 3)); + $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_ERROR); } - /** - * @throws Exception - */ - public function testSuite() : string + public function executeAfterTestFailure(string $test, string $message, float $time): void { - if ($this->testSuite === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->testSuite; + $testName = $this->getTestName($test); + $this->cache->setTime($testName, round($time, 3)); + $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE); } - public function unrecognizedOptions() : array + public function executeAfterTestWarning(string $test, string $message, float $time): void { - return $this->unrecognizedOptions; + $testName = $this->getTestName($test); + $this->cache->setTime($testName, round($time, 3)); + $this->cache->setState($testName, \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING); } - public function hasUnrecognizedOrderBy() : bool + public function executeAfterLastTest(): void { - return $this->unrecognizedOrderBy !== null; + $this->flush(); } /** - * @throws Exception + * @param string $test A long description format of the current test + * + * @return string The test name without TestSuiteClassName:: and @dataprovider details */ - public function unrecognizedOrderBy() : string + private function getTestName(string $test): string { - if ($this->unrecognizedOrderBy === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $matches = []; + if (preg_match('/^(?\S+::\S+)(?:(? with data set (?:#\d+|"[^"]+"))\s\()?/', $test, $matches)) { + $test = $matches['name'] . ($matches['dataname'] ?? ''); } - return $this->unrecognizedOrderBy; - } - public function hasUseDefaultConfiguration() : bool - { - return $this->useDefaultConfiguration !== null; + return $test; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use function array_diff; +use function array_values; +use function basename; +use function class_exists; +use function get_declared_classes; +use function sprintf; +use function stripos; +use function strlen; +use function substr; +use PHPUnit\Framework\TestCase; +use PHPUnit\Util\FileLoader; +use ReflectionClass; +use ReflectionException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 + */ +final class StandardTestSuiteLoader implements \PHPUnit\Runner\TestSuiteLoader +{ /** * @throws Exception */ - public function useDefaultConfiguration() : bool + public function load(string $suiteClassFile): ReflectionClass { - if ($this->useDefaultConfiguration === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + $suiteClassName = basename($suiteClassFile, '.php'); + $loadedClasses = get_declared_classes(); + if (!class_exists($suiteClassName, \false)) { + /* @noinspection UnusedFunctionResultInspection */ + FileLoader::checkAndLoad($suiteClassFile); + $loadedClasses = array_values(array_diff(get_declared_classes(), $loadedClasses)); + if (empty($loadedClasses)) { + throw new \PHPUnit\Runner\Exception(sprintf('Class %s could not be found in %s', $suiteClassName, $suiteClassFile)); + } } - return $this->useDefaultConfiguration; - } - public function hasVerbose() : bool - { - return $this->verbose !== null; - } - /** - * @throws Exception - */ - public function verbose() : bool - { - if ($this->verbose === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (!class_exists($suiteClassName, \false)) { + $offset = 0 - strlen($suiteClassName); + foreach ($loadedClasses as $loadedClass) { + // @see https://github.com/sebastianbergmann/phpunit/issues/5020 + if (stripos(substr($loadedClass, $offset - 1), '\\' . $suiteClassName) === 0 || stripos(substr($loadedClass, $offset - 1), '_' . $suiteClassName) === 0) { + $suiteClassName = $loadedClass; + break; + } + } } - return $this->verbose; - } - public function hasVersion() : bool - { - return $this->version !== null; - } - /** - * @throws Exception - */ - public function version() : bool - { - if ($this->version === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); + if (!class_exists($suiteClassName, \false)) { + throw new \PHPUnit\Runner\Exception(sprintf('Class %s could not be found in %s', $suiteClassName, $suiteClassFile)); } - return $this->version; - } - public function hasXdebugFilterFile() : bool - { - return $this->xdebugFilterFile !== null; + try { + $class = new ReflectionClass($suiteClassName); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Runner\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if ($class->isSubclassOf(TestCase::class)) { + if ($class->isAbstract()) { + throw new \PHPUnit\Runner\Exception(sprintf('Class %s declared in %s is abstract', $suiteClassName, $suiteClassFile)); + } + return $class; + } + if ($class->hasMethod('suite')) { + try { + $method = $class->getMethod('suite'); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Runner\Exception(sprintf('Method %s::suite() declared in %s is abstract', $suiteClassName, $suiteClassFile)); + } + if (!$method->isPublic()) { + throw new \PHPUnit\Runner\Exception(sprintf('Method %s::suite() declared in %s is not public', $suiteClassName, $suiteClassFile)); + } + if (!$method->isStatic()) { + throw new \PHPUnit\Runner\Exception(sprintf('Method %s::suite() declared in %s is not static', $suiteClassName, $suiteClassFile)); + } + } + return $class; } - /** - * @throws Exception - */ - public function xdebugFilterFile() : string + public function reload(ReflectionClass $aClass): ReflectionClass { - if ($this->xdebugFilterFile === null) { - throw new \PHPUnit\TextUI\CliArguments\Exception(); - } - return $this->xdebugFilterFile; + return $aClass; } } + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; +use function array_diff; +use function array_merge; +use function array_reverse; +use function array_splice; +use function count; +use function in_array; +use function max; +use function shuffle; +use function usort; +use PHPUnit\Framework\DataProviderTestSuite; +use PHPUnit\Framework\Reorderable; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Util\Test as TestUtil; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class Mapper +final class TestSuiteSorter { + /** + * @var int + */ + public const ORDER_DEFAULT = 0; + /** + * @var int + */ + public const ORDER_RANDOMIZED = 1; + /** + * @var int + */ + public const ORDER_REVERSED = 2; + /** + * @var int + */ + public const ORDER_DEFECTS_FIRST = 3; + /** + * @var int + */ + public const ORDER_DURATION = 4; + /** + * Order tests by @size annotation 'small', 'medium', 'large'. + * + * @var int + */ + public const ORDER_SIZE = 5; + /** + * List of sorting weights for all test result codes. A higher number gives higher priority. + */ + private const DEFECT_SORT_WEIGHT = [\PHPUnit\Runner\BaseTestRunner::STATUS_ERROR => 6, \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE => 5, \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING => 4, \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE => 3, \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY => 2, \PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED => 1, \PHPUnit\Runner\BaseTestRunner::STATUS_UNKNOWN => 0]; + private const SIZE_SORT_WEIGHT = [TestUtil::SMALL => 1, TestUtil::MEDIUM => 2, TestUtil::LARGE => 3, TestUtil::UNKNOWN => 4]; + /** + * @var array Associative array of (string => DEFECT_SORT_WEIGHT) elements + */ + private $defectSortOrder = []; + /** + * @var TestResultCache + */ + private $cache; + /** + * @var array A list of normalized names of tests before reordering + */ + private $originalExecutionOrder = []; + /** + * @var array A list of normalized names of tests affected by reordering + */ + private $executionOrder = []; + public function __construct(?\PHPUnit\Runner\TestResultCache $cache = null) + { + $this->cache = $cache ?? new \PHPUnit\Runner\NullTestResultCache(); + } /** * @throws Exception + * @throws InvalidArgumentException */ - public function mapToLegacyArray(\PHPUnit\TextUI\CliArguments\Configuration $arguments) : array + public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects, bool $isRootTestSuite = \true): void { - $result = ['extensions' => [], 'listGroups' => \false, 'listSuites' => \false, 'listTests' => \false, 'listTestsXml' => \false, 'loader' => null, 'useDefaultConfiguration' => \true, 'loadedExtensions' => [], 'unavailableExtensions' => [], 'notLoadedExtensions' => []]; - if ($arguments->hasColors()) { - $result['colors'] = $arguments->colors(); - } - if ($arguments->hasBootstrap()) { - $result['bootstrap'] = $arguments->bootstrap(); - } - if ($arguments->hasCacheResult()) { - $result['cacheResult'] = $arguments->cacheResult(); - } - if ($arguments->hasCacheResultFile()) { - $result['cacheResultFile'] = $arguments->cacheResultFile(); + $allowedOrders = [self::ORDER_DEFAULT, self::ORDER_REVERSED, self::ORDER_RANDOMIZED, self::ORDER_DURATION, self::ORDER_SIZE]; + if (!in_array($order, $allowedOrders, \true)) { + throw new \PHPUnit\Runner\Exception('$order must be one of TestSuiteSorter::ORDER_[DEFAULT|REVERSED|RANDOMIZED|DURATION|SIZE]'); } - if ($arguments->hasColumns()) { - $result['columns'] = $arguments->columns(); + $allowedOrderDefects = [self::ORDER_DEFAULT, self::ORDER_DEFECTS_FIRST]; + if (!in_array($orderDefects, $allowedOrderDefects, \true)) { + throw new \PHPUnit\Runner\Exception('$orderDefects must be one of TestSuiteSorter::ORDER_DEFAULT, TestSuiteSorter::ORDER_DEFECTS_FIRST'); } - if ($arguments->hasConfiguration()) { - $result['configuration'] = $arguments->configuration(); + if ($isRootTestSuite) { + $this->originalExecutionOrder = $this->calculateTestExecutionOrder($suite); } - if ($arguments->hasCoverageCacheDirectory()) { - $result['coverageCacheDirectory'] = $arguments->coverageCacheDirectory(); + if ($suite instanceof TestSuite) { + foreach ($suite as $_suite) { + $this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects, \false); + } + if ($orderDefects === self::ORDER_DEFECTS_FIRST) { + $this->addSuiteToDefectSortOrder($suite); + } + $this->sort($suite, $order, $resolveDependencies, $orderDefects); } - if ($arguments->hasWarmCoverageCache()) { - $result['warmCoverageCache'] = $arguments->warmCoverageCache(); + if ($isRootTestSuite) { + $this->executionOrder = $this->calculateTestExecutionOrder($suite); } - if ($arguments->hasCoverageClover()) { - $result['coverageClover'] = $arguments->coverageClover(); - } - if ($arguments->hasCoverageCobertura()) { - $result['coverageCobertura'] = $arguments->coverageCobertura(); - } - if ($arguments->hasCoverageCrap4J()) { - $result['coverageCrap4J'] = $arguments->coverageCrap4J(); - } - if ($arguments->hasCoverageHtml()) { - $result['coverageHtml'] = $arguments->coverageHtml(); - } - if ($arguments->hasCoveragePhp()) { - $result['coveragePHP'] = $arguments->coveragePhp(); - } - if ($arguments->hasCoverageText()) { - $result['coverageText'] = $arguments->coverageText(); - } - if ($arguments->hasCoverageTextShowUncoveredFiles()) { - $result['coverageTextShowUncoveredFiles'] = $arguments->hasCoverageTextShowUncoveredFiles(); - } - if ($arguments->hasCoverageTextShowOnlySummary()) { - $result['coverageTextShowOnlySummary'] = $arguments->coverageTextShowOnlySummary(); - } - if ($arguments->hasCoverageXml()) { - $result['coverageXml'] = $arguments->coverageXml(); - } - if ($arguments->hasPathCoverage()) { - $result['pathCoverage'] = $arguments->pathCoverage(); - } - if ($arguments->hasDebug()) { - $result['debug'] = $arguments->debug(); - } - if ($arguments->hasHelp()) { - $result['help'] = $arguments->help(); - } - if ($arguments->hasFilter()) { - $result['filter'] = $arguments->filter(); - } - if ($arguments->hasTestSuite()) { - $result['testsuite'] = $arguments->testSuite(); - } - if ($arguments->hasGroups()) { - $result['groups'] = $arguments->groups(); - } - if ($arguments->hasExcludeGroups()) { - $result['excludeGroups'] = $arguments->excludeGroups(); - } - if ($arguments->hasTestsCovering()) { - $result['testsCovering'] = $arguments->testsCovering(); - } - if ($arguments->hasTestsUsing()) { - $result['testsUsing'] = $arguments->testsUsing(); - } - if ($arguments->hasTestSuffixes()) { - $result['testSuffixes'] = $arguments->testSuffixes(); - } - if ($arguments->hasIncludePath()) { - $result['includePath'] = $arguments->includePath(); - } - if ($arguments->hasListGroups()) { - $result['listGroups'] = $arguments->listGroups(); - } - if ($arguments->hasListSuites()) { - $result['listSuites'] = $arguments->listSuites(); - } - if ($arguments->hasListTests()) { - $result['listTests'] = $arguments->listTests(); - } - if ($arguments->hasListTestsXml()) { - $result['listTestsXml'] = $arguments->listTestsXml(); - } - if ($arguments->hasPrinter()) { - $result['printer'] = $arguments->printer(); - } - if ($arguments->hasLoader()) { - $result['loader'] = $arguments->loader(); - } - if ($arguments->hasJunitLogfile()) { - $result['junitLogfile'] = $arguments->junitLogfile(); - } - if ($arguments->hasTeamcityLogfile()) { - $result['teamcityLogfile'] = $arguments->teamcityLogfile(); - } - if ($arguments->hasExecutionOrder()) { - $result['executionOrder'] = $arguments->executionOrder(); - } - if ($arguments->hasExecutionOrderDefects()) { - $result['executionOrderDefects'] = $arguments->executionOrderDefects(); - } - if ($arguments->hasExtensions()) { - $result['extensions'] = $arguments->extensions(); - } - if ($arguments->hasUnavailableExtensions()) { - $result['unavailableExtensions'] = $arguments->unavailableExtensions(); - } - if ($arguments->hasResolveDependencies()) { - $result['resolveDependencies'] = $arguments->resolveDependencies(); - } - if ($arguments->hasProcessIsolation()) { - $result['processIsolation'] = $arguments->processIsolation(); - } - if ($arguments->hasRepeat()) { - $result['repeat'] = $arguments->repeat(); - } - if ($arguments->hasStderr()) { - $result['stderr'] = $arguments->stderr(); - } - if ($arguments->hasStopOnDefect()) { - $result['stopOnDefect'] = $arguments->stopOnDefect(); - } - if ($arguments->hasStopOnError()) { - $result['stopOnError'] = $arguments->stopOnError(); - } - if ($arguments->hasStopOnFailure()) { - $result['stopOnFailure'] = $arguments->stopOnFailure(); - } - if ($arguments->hasStopOnWarning()) { - $result['stopOnWarning'] = $arguments->stopOnWarning(); - } - if ($arguments->hasStopOnIncomplete()) { - $result['stopOnIncomplete'] = $arguments->stopOnIncomplete(); - } - if ($arguments->hasStopOnRisky()) { - $result['stopOnRisky'] = $arguments->stopOnRisky(); - } - if ($arguments->hasStopOnSkipped()) { - $result['stopOnSkipped'] = $arguments->stopOnSkipped(); - } - if ($arguments->hasFailOnEmptyTestSuite()) { - $result['failOnEmptyTestSuite'] = $arguments->failOnEmptyTestSuite(); - } - if ($arguments->hasFailOnIncomplete()) { - $result['failOnIncomplete'] = $arguments->failOnIncomplete(); - } - if ($arguments->hasFailOnRisky()) { - $result['failOnRisky'] = $arguments->failOnRisky(); - } - if ($arguments->hasFailOnSkipped()) { - $result['failOnSkipped'] = $arguments->failOnSkipped(); - } - if ($arguments->hasFailOnWarning()) { - $result['failOnWarning'] = $arguments->failOnWarning(); - } - if ($arguments->hasTestdoxGroups()) { - $result['testdoxGroups'] = $arguments->testdoxGroups(); - } - if ($arguments->hasTestdoxExcludeGroups()) { - $result['testdoxExcludeGroups'] = $arguments->testdoxExcludeGroups(); - } - if ($arguments->hasTestdoxHtmlFile()) { - $result['testdoxHTMLFile'] = $arguments->testdoxHtmlFile(); - } - if ($arguments->hasTestdoxTextFile()) { - $result['testdoxTextFile'] = $arguments->testdoxTextFile(); - } - if ($arguments->hasTestdoxXmlFile()) { - $result['testdoxXMLFile'] = $arguments->testdoxXmlFile(); - } - if ($arguments->hasUseDefaultConfiguration()) { - $result['useDefaultConfiguration'] = $arguments->useDefaultConfiguration(); - } - if ($arguments->hasNoExtensions()) { - $result['noExtensions'] = $arguments->noExtensions(); - } - if ($arguments->hasNoCoverage()) { - $result['noCoverage'] = $arguments->noCoverage(); - } - if ($arguments->hasNoLogging()) { - $result['noLogging'] = $arguments->noLogging(); - } - if ($arguments->hasNoInteraction()) { - $result['noInteraction'] = $arguments->noInteraction(); - } - if ($arguments->hasBackupGlobals()) { - $result['backupGlobals'] = $arguments->backupGlobals(); - } - if ($arguments->hasBackupStaticAttributes()) { - $result['backupStaticAttributes'] = $arguments->backupStaticAttributes(); - } - if ($arguments->hasVerbose()) { - $result['verbose'] = $arguments->verbose(); - } - if ($arguments->hasReportUselessTests()) { - $result['reportUselessTests'] = $arguments->reportUselessTests(); - } - if ($arguments->hasStrictCoverage()) { - $result['strictCoverage'] = $arguments->strictCoverage(); - } - if ($arguments->hasDisableCodeCoverageIgnore()) { - $result['disableCodeCoverageIgnore'] = $arguments->disableCodeCoverageIgnore(); - } - if ($arguments->hasBeStrictAboutChangesToGlobalState()) { - $result['beStrictAboutChangesToGlobalState'] = $arguments->beStrictAboutChangesToGlobalState(); + } + public function getOriginalExecutionOrder(): array + { + return $this->originalExecutionOrder; + } + public function getExecutionOrder(): array + { + return $this->executionOrder; + } + private function sort(TestSuite $suite, int $order, bool $resolveDependencies, int $orderDefects): void + { + if (empty($suite->tests())) { + return; } - if ($arguments->hasDisallowTestOutput()) { - $result['disallowTestOutput'] = $arguments->disallowTestOutput(); + if ($order === self::ORDER_REVERSED) { + $suite->setTests($this->reverse($suite->tests())); + } elseif ($order === self::ORDER_RANDOMIZED) { + $suite->setTests($this->randomize($suite->tests())); + } elseif ($order === self::ORDER_DURATION && $this->cache !== null) { + $suite->setTests($this->sortByDuration($suite->tests())); + } elseif ($order === self::ORDER_SIZE) { + $suite->setTests($this->sortBySize($suite->tests())); } - if ($arguments->hasBeStrictAboutResourceUsageDuringSmallTests()) { - $result['beStrictAboutResourceUsageDuringSmallTests'] = $arguments->beStrictAboutResourceUsageDuringSmallTests(); + if ($orderDefects === self::ORDER_DEFECTS_FIRST && $this->cache !== null) { + $suite->setTests($this->sortDefectsFirst($suite->tests())); } - if ($arguments->hasDefaultTimeLimit()) { - $result['defaultTimeLimit'] = $arguments->defaultTimeLimit(); + if ($resolveDependencies && !$suite instanceof DataProviderTestSuite) { + /** @var TestCase[] $tests */ + $tests = $suite->tests(); + $suite->setTests($this->resolveDependencies($tests)); } - if ($arguments->hasEnforceTimeLimit()) { - $result['enforceTimeLimit'] = $arguments->enforceTimeLimit(); + } + /** + * @throws InvalidArgumentException + */ + private function addSuiteToDefectSortOrder(TestSuite $suite): void + { + $max = 0; + foreach ($suite->tests() as $test) { + if (!$test instanceof Reorderable) { + continue; + } + if (!isset($this->defectSortOrder[$test->sortId()])) { + $this->defectSortOrder[$test->sortId()] = self::DEFECT_SORT_WEIGHT[$this->cache->getState($test->sortId())]; + $max = max($max, $this->defectSortOrder[$test->sortId()]); + } } - if ($arguments->hasDisallowTodoAnnotatedTests()) { - $result['disallowTodoAnnotatedTests'] = $arguments->disallowTodoAnnotatedTests(); + $this->defectSortOrder[$suite->sortId()] = $max; + } + private function reverse(array $tests): array + { + return array_reverse($tests); + } + private function randomize(array $tests): array + { + shuffle($tests); + return $tests; + } + private function sortDefectsFirst(array $tests): array + { + usort( + $tests, + /** + * @throws InvalidArgumentException + */ + function ($left, $right) { + return $this->cmpDefectPriorityAndTime($left, $right); + } + ); + return $tests; + } + private function sortByDuration(array $tests): array + { + usort( + $tests, + /** + * @throws InvalidArgumentException + */ + function ($left, $right) { + return $this->cmpDuration($left, $right); + } + ); + return $tests; + } + private function sortBySize(array $tests): array + { + usort( + $tests, + /** + * @throws InvalidArgumentException + */ + function ($left, $right) { + return $this->cmpSize($left, $right); + } + ); + return $tests; + } + /** + * Comparator callback function to sort tests for "reach failure as fast as possible". + * + * 1. sort tests by defect weight defined in self::DEFECT_SORT_WEIGHT + * 2. when tests are equally defective, sort the fastest to the front + * 3. do not reorder successful tests + * + * @throws InvalidArgumentException + */ + private function cmpDefectPriorityAndTime(Test $a, Test $b): int + { + if (!($a instanceof Reorderable && $b instanceof Reorderable)) { + return 0; } - if ($arguments->hasReverseList()) { - $result['reverseList'] = $arguments->reverseList(); + $priorityA = $this->defectSortOrder[$a->sortId()] ?? 0; + $priorityB = $this->defectSortOrder[$b->sortId()] ?? 0; + if ($priorityB <=> $priorityA) { + // Sort defect weight descending + return $priorityB <=> $priorityA; } - if ($arguments->hasCoverageFilter()) { - $result['coverageFilter'] = $arguments->coverageFilter(); + if ($priorityA || $priorityB) { + return $this->cmpDuration($a, $b); } - if ($arguments->hasRandomOrderSeed()) { - $result['randomOrderSeed'] = $arguments->randomOrderSeed(); + // do not change execution order + return 0; + } + /** + * Compares test duration for sorting tests by duration ascending. + * + * @throws InvalidArgumentException + */ + private function cmpDuration(Test $a, Test $b): int + { + if (!($a instanceof Reorderable && $b instanceof Reorderable)) { + return 0; } - if ($arguments->hasXdebugFilterFile()) { - $result['xdebugFilterFile'] = $arguments->xdebugFilterFile(); + return $this->cache->getTime($a->sortId()) <=> $this->cache->getTime($b->sortId()); + } + /** + * Compares test size for sorting tests small->medium->large->unknown. + */ + private function cmpSize(Test $a, Test $b): int + { + $sizeA = ($a instanceof TestCase || $a instanceof DataProviderTestSuite) ? $a->getSize() : TestUtil::UNKNOWN; + $sizeB = ($b instanceof TestCase || $b instanceof DataProviderTestSuite) ? $b->getSize() : TestUtil::UNKNOWN; + return self::SIZE_SORT_WEIGHT[$sizeA] <=> self::SIZE_SORT_WEIGHT[$sizeB]; + } + /** + * Reorder Tests within a TestCase in such a way as to resolve as many dependencies as possible. + * The algorithm will leave the tests in original running order when it can. + * For more details see the documentation for test dependencies. + * + * Short description of algorithm: + * 1. Pick the next Test from remaining tests to be checked for dependencies. + * 2. If the test has no dependencies: mark done, start again from the top + * 3. If the test has dependencies but none left to do: mark done, start again from the top + * 4. When we reach the end add any leftover tests to the end. These will be marked 'skipped' during execution. + * + * @param array $tests + * + * @return array + */ + private function resolveDependencies(array $tests): array + { + $newTestOrder = []; + $i = 0; + $provided = []; + do { + if ([] === array_diff($tests[$i]->requires(), $provided)) { + $provided = array_merge($provided, $tests[$i]->provides()); + $newTestOrder = array_merge($newTestOrder, array_splice($tests, $i, 1)); + $i = 0; + } else { + $i++; + } + } while (!empty($tests) && $i < count($tests)); + return array_merge($newTestOrder, $tests); + } + /** + * @throws InvalidArgumentException + */ + private function calculateTestExecutionOrder(Test $suite): array + { + $tests = []; + if ($suite instanceof TestSuite) { + foreach ($suite->tests() as $test) { + if (!$test instanceof TestSuite && $test instanceof Reorderable) { + $tests[] = $test->sortId(); + } else { + $tests = array_merge($tests, $this->calculateTestExecutionOrder($test)); + } + } } - return $result; + return $tests; } } - */ - protected $arguments = []; - /** - * @var array - */ - protected $longOptions = []; - /** - * @var bool + * @var string */ - private $versionStringPrinted = \false; + private static $pharVersion = '9.6.20'; /** - * @psalm-var list + * @var string */ - private $warnings = []; + private static $version = ''; /** - * @throws Exception + * Returns the current version of PHPUnit. + * + * @psalm-return non-empty-string */ - public static function main(bool $exit = \true) : int + public static function id(): string { - try { - return (new static())->run($_SERVER['argv'], $exit); - } catch (Throwable $t) { - throw new \PHPUnit\TextUI\RuntimeException($t->getMessage(), (int) $t->getCode(), $t); + if (self::$pharVersion !== '') { + return self::$pharVersion; + } + if (self::$version === '') { + self::$version = (new VersionId('9.6.20', dirname(__DIR__, 2)))->getVersion(); + assert(!empty(self::$version)); } + return self::$version; } /** - * @throws Exception + * @psalm-return non-empty-string */ - public function run(array $argv, bool $exit = \true) : int + public static function series(): string { - $this->handleArguments($argv); - $runner = $this->createRunner(); - if ($this->arguments['test'] instanceof TestSuite) { - $suite = $this->arguments['test']; + if (strpos(self::id(), '-')) { + $version = explode('-', self::id())[0]; } else { - $suite = $runner->getTest($this->arguments['test'], $this->arguments['testSuffixes']); - } - if ($this->arguments['listGroups']) { - return $this->handleListGroups($suite, $exit); - } - if ($this->arguments['listSuites']) { - return $this->handleListSuites($exit); - } - if ($this->arguments['listTests']) { - return $this->handleListTests($suite, $exit); - } - if ($this->arguments['listTestsXml']) { - return $this->handleListTestsXml($suite, $this->arguments['listTestsXml'], $exit); - } - unset($this->arguments['test'], $this->arguments['testFile']); - try { - $result = $runner->run($suite, $this->arguments, $this->warnings, $exit); - } catch (Throwable $t) { - print $t->getMessage() . PHP_EOL; - } - $return = \PHPUnit\TextUI\TestRunner::FAILURE_EXIT; - if (isset($result) && $result->wasSuccessful()) { - $return = \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; - } elseif (!isset($result) || $result->errorCount() > 0) { - $return = \PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT; - } - if ($exit) { - exit($return); + $version = self::id(); } - return $return; + return implode('.', array_slice(explode('.', $version), 0, 2)); } /** - * Create a TestRunner, override in subclasses. + * @psalm-return non-empty-string */ - protected function createRunner() : \PHPUnit\TextUI\TestRunner + public static function getVersionString(): string { - return new \PHPUnit\TextUI\TestRunner($this->arguments['loader']); - } - /** - * Handles the command-line arguments. - * - * A child class of PHPUnit\TextUI\Command can hook into the argument - * parsing by adding the switch(es) to the $longOptions array and point to a - * callback method that handles the switch(es) in the child class like this - * - * - * longOptions['my-switch'] = 'myHandler'; - * // my-secondswitch will accept a value - note the equals sign - * $this->longOptions['my-secondswitch='] = 'myOtherHandler'; - * } - * - * // --my-switch -> myHandler() - * protected function myHandler() - * { - * } - * - * // --my-secondswitch foo -> myOtherHandler('foo') - * protected function myOtherHandler ($value) - * { - * } - * - * // You will also need this - the static keyword in the - * // PHPUnit\TextUI\Command will mean that it'll be - * // PHPUnit\TextUI\Command that gets instantiated, - * // not MyCommand - * public static function main($exit = true) - * { - * $command = new static; - * - * return $command->run($_SERVER['argv'], $exit); - * } - * - * } - * - * - * @throws Exception - */ - protected function handleArguments(array $argv) : void - { - try { - $arguments = (new Builder())->fromParameters($argv, array_keys($this->longOptions)); - } catch (ArgumentsException $e) { - $this->exitWithErrorMessage($e->getMessage()); - } - assert(isset($arguments) && $arguments instanceof Configuration); - if ($arguments->hasGenerateConfiguration() && $arguments->generateConfiguration()) { - $this->generateConfiguration(); - } - if ($arguments->hasAtLeastVersion()) { - if (version_compare(Version::id(), $arguments->atLeastVersion(), '>=')) { - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - exit(\PHPUnit\TextUI\TestRunner::FAILURE_EXIT); - } - if ($arguments->hasVersion() && $arguments->version()) { - $this->printVersionString(); - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - if ($arguments->hasCheckVersion() && $arguments->checkVersion()) { - $this->handleVersionCheck(); - } - if ($arguments->hasHelp()) { - $this->showHelp(); - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - if ($arguments->hasUnrecognizedOrderBy()) { - $this->exitWithErrorMessage(sprintf('unrecognized --order-by option: %s', $arguments->unrecognizedOrderBy())); - } - if ($arguments->hasIniSettings()) { - foreach ($arguments->iniSettings() as $name => $value) { - ini_set($name, $value); - } - } - if ($arguments->hasIncludePath()) { - ini_set('include_path', $arguments->includePath() . PATH_SEPARATOR . ini_get('include_path')); - } - $this->arguments = (new Mapper())->mapToLegacyArray($arguments); - $this->handleCustomOptions($arguments->unrecognizedOptions()); - $this->handleCustomTestSuite(); - if (!isset($this->arguments['testSuffixes'])) { - $this->arguments['testSuffixes'] = ['Test.php', '.phpt']; - } - if (!isset($this->arguments['test']) && $arguments->hasArgument()) { - $this->arguments['test'] = realpath($arguments->argument()); - if ($this->arguments['test'] === \false) { - $this->exitWithErrorMessage(sprintf('Cannot open file "%s".', $arguments->argument())); - } - } - if ($this->arguments['loader'] !== null) { - $this->arguments['loader'] = $this->handleLoader($this->arguments['loader']); - } - if (isset($this->arguments['configuration'])) { - if (is_dir($this->arguments['configuration'])) { - $candidate = $this->configurationFileInDirectory($this->arguments['configuration']); - if ($candidate !== null) { - $this->arguments['configuration'] = $candidate; - } - } - } elseif ($this->arguments['useDefaultConfiguration']) { - $candidate = $this->configurationFileInDirectory(getcwd()); - if ($candidate !== null) { - $this->arguments['configuration'] = $candidate; - } - } - if ($arguments->hasMigrateConfiguration() && $arguments->migrateConfiguration()) { - if (!isset($this->arguments['configuration'])) { - print 'No configuration file found to migrate.' . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); - } - $this->migrateConfiguration(realpath($this->arguments['configuration'])); - } - if (isset($this->arguments['configuration'])) { - try { - $this->arguments['configurationObject'] = (new Loader())->load($this->arguments['configuration']); - } catch (Throwable $e) { - print $e->getMessage() . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::FAILURE_EXIT); - } - $phpunitConfiguration = $this->arguments['configurationObject']->phpunit(); - (new PhpHandler())->handle($this->arguments['configurationObject']->php()); - if (isset($this->arguments['bootstrap'])) { - $this->handleBootstrap($this->arguments['bootstrap']); - } elseif ($phpunitConfiguration->hasBootstrap()) { - $this->handleBootstrap($phpunitConfiguration->bootstrap()); - } - if (!isset($this->arguments['stderr'])) { - $this->arguments['stderr'] = $phpunitConfiguration->stderr(); - } - if (!isset($this->arguments['noExtensions']) && $phpunitConfiguration->hasExtensionsDirectory() && extension_loaded('phar')) { - $result = (new PharLoader())->loadPharExtensionsInDirectory($phpunitConfiguration->extensionsDirectory()); - $this->arguments['loadedExtensions'] = $result['loadedExtensions']; - $this->arguments['notLoadedExtensions'] = $result['notLoadedExtensions']; - unset($result); - } - if (!isset($this->arguments['columns'])) { - $this->arguments['columns'] = $phpunitConfiguration->columns(); - } - if (!isset($this->arguments['printer']) && $phpunitConfiguration->hasPrinterClass()) { - $file = $phpunitConfiguration->hasPrinterFile() ? $phpunitConfiguration->printerFile() : ''; - $this->arguments['printer'] = $this->handlePrinter($phpunitConfiguration->printerClass(), $file); - } - if ($phpunitConfiguration->hasTestSuiteLoaderClass()) { - $file = $phpunitConfiguration->hasTestSuiteLoaderFile() ? $phpunitConfiguration->testSuiteLoaderFile() : ''; - $this->arguments['loader'] = $this->handleLoader($phpunitConfiguration->testSuiteLoaderClass(), $file); - } - if (!isset($this->arguments['testsuite']) && $phpunitConfiguration->hasDefaultTestSuite()) { - $this->arguments['testsuite'] = $phpunitConfiguration->defaultTestSuite(); - } - if (!isset($this->arguments['test'])) { - try { - $this->arguments['test'] = (new \PHPUnit\TextUI\TestSuiteMapper())->map($this->arguments['configurationObject']->testSuite(), $this->arguments['testsuite'] ?? ''); - } catch (\PHPUnit\TextUI\Exception $e) { - $this->printVersionString(); - print $e->getMessage() . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); - } - } - } elseif (isset($this->arguments['bootstrap'])) { - $this->handleBootstrap($this->arguments['bootstrap']); - } - if (isset($this->arguments['printer']) && is_string($this->arguments['printer'])) { - $this->arguments['printer'] = $this->handlePrinter($this->arguments['printer']); - } - if (isset($this->arguments['configurationObject'], $this->arguments['warmCoverageCache'])) { - $this->handleWarmCoverageCache($this->arguments['configurationObject']); - } - if (!isset($this->arguments['test'])) { - $this->showHelp(); - exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); - } - } - /** - * Handles the loading of the PHPUnit\Runner\TestSuiteLoader implementation. - * - * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 - */ - protected function handleLoader(string $loaderClass, string $loaderFile = '') : ?TestSuiteLoader - { - $this->warnings[] = 'Using a custom test suite loader is deprecated'; - if (!class_exists($loaderClass, \false)) { - if ($loaderFile == '') { - $loaderFile = Filesystem::classNameToFilename($loaderClass); - } - $loaderFile = stream_resolve_include_path($loaderFile); - if ($loaderFile) { - /** - * @noinspection PhpIncludeInspection - * - * @psalm-suppress UnresolvableInclude - */ - require $loaderFile; - } - } - if (class_exists($loaderClass, \false)) { - try { - $class = new ReflectionClass($loaderClass); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\TextUI\ReflectionException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - if ($class->implementsInterface(TestSuiteLoader::class) && $class->isInstantiable()) { - $object = $class->newInstance(); - assert($object instanceof TestSuiteLoader); - return $object; - } - } - if ($loaderClass == StandardTestSuiteLoader::class) { - return null; - } - $this->exitWithErrorMessage(sprintf('Could not use "%s" as loader.', $loaderClass)); - return null; - } - /** - * Handles the loading of the PHPUnit\Util\Printer implementation. - * - * @return null|Printer|string - */ - protected function handlePrinter(string $printerClass, string $printerFile = '') - { - if (!class_exists($printerClass, \false)) { - if ($printerFile === '') { - $printerFile = Filesystem::classNameToFilename($printerClass); - } - $printerFile = stream_resolve_include_path($printerFile); - if ($printerFile) { - /** - * @noinspection PhpIncludeInspection - * - * @psalm-suppress UnresolvableInclude - */ - require $printerFile; - } - } - if (!class_exists($printerClass)) { - $this->exitWithErrorMessage(sprintf('Could not use "%s" as printer: class does not exist', $printerClass)); - } - try { - $class = new ReflectionClass($printerClass); - // @codeCoverageIgnoreStart - } catch (\ReflectionException $e) { - throw new \PHPUnit\TextUI\ReflectionException($e->getMessage(), $e->getCode(), $e); - // @codeCoverageIgnoreEnd - } - if (!$class->implementsInterface(\PHPUnit\TextUI\ResultPrinter::class)) { - $this->exitWithErrorMessage(sprintf('Could not use "%s" as printer: class does not implement %s', $printerClass, \PHPUnit\TextUI\ResultPrinter::class)); - } - if (!$class->isInstantiable()) { - $this->exitWithErrorMessage(sprintf('Could not use "%s" as printer: class cannot be instantiated', $printerClass)); - } - if ($class->isSubclassOf(\PHPUnit\TextUI\ResultPrinter::class)) { - return $printerClass; - } - $outputStream = isset($this->arguments['stderr']) ? 'php://stderr' : null; - return $class->newInstance($outputStream); - } - /** - * Loads a bootstrap file. - */ - protected function handleBootstrap(string $filename) : void - { - try { - FileLoader::checkAndLoad($filename); - } catch (Throwable $t) { - if ($t instanceof \PHPUnit\Exception) { - $this->exitWithErrorMessage($t->getMessage()); - } - $message = sprintf('Error in bootstrap script: %s:%s%s%s%s', get_class($t), PHP_EOL, $t->getMessage(), PHP_EOL, $t->getTraceAsString()); - while ($t = $t->getPrevious()) { - $message .= sprintf('%s%sPrevious error: %s:%s%s%s%s', PHP_EOL, PHP_EOL, get_class($t), PHP_EOL, $t->getMessage(), PHP_EOL, $t->getTraceAsString()); - } - $this->exitWithErrorMessage($message); - } - } - protected function handleVersionCheck() : void - { - $this->printVersionString(); - $latestVersion = file_get_contents('https://phar.phpunit.de/latest-version-of/phpunit'); - $isOutdated = version_compare($latestVersion, Version::id(), '>'); - if ($isOutdated) { - printf('You are not using the latest version of PHPUnit.' . PHP_EOL . 'The latest version is PHPUnit %s.' . PHP_EOL, $latestVersion); - } else { - print 'You are using the latest version of PHPUnit.' . PHP_EOL; - } - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - /** - * Show the help message. - */ - protected function showHelp() : void - { - $this->printVersionString(); - (new \PHPUnit\TextUI\Help())->writeToConsole(); - } - /** - * Custom callback for test suite discovery. - */ - protected function handleCustomTestSuite() : void - { - } - private function printVersionString() : void - { - if ($this->versionStringPrinted) { - return; - } - print Version::getVersionString() . PHP_EOL . PHP_EOL; - $this->versionStringPrinted = \true; - } - private function exitWithErrorMessage(string $message) : void - { - $this->printVersionString(); - print $message . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::FAILURE_EXIT); - } - private function handleListGroups(TestSuite $suite, bool $exit) : int - { - $this->printVersionString(); - $this->warnAboutConflictingOptions('listGroups', ['filter', 'groups', 'excludeGroups', 'testsuite']); - print 'Available test group(s):' . PHP_EOL; - $groups = $suite->getGroups(); - sort($groups); - foreach ($groups as $group) { - if (strpos($group, '__phpunit_') === 0) { - continue; - } - printf(' - %s' . PHP_EOL, $group); - } - if ($exit) { - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - return \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; - } - /** - * @throws \PHPUnit\Framework\Exception - * @throws \PHPUnit\TextUI\XmlConfiguration\Exception - */ - private function handleListSuites(bool $exit) : int - { - $this->printVersionString(); - $this->warnAboutConflictingOptions('listSuites', ['filter', 'groups', 'excludeGroups', 'testsuite']); - print 'Available test suite(s):' . PHP_EOL; - foreach ($this->arguments['configurationObject']->testSuite() as $testSuite) { - printf(' - %s' . PHP_EOL, $testSuite->name()); - } - if ($exit) { - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - return \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; - } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - private function handleListTests(TestSuite $suite, bool $exit) : int - { - $this->printVersionString(); - $this->warnAboutConflictingOptions('listTests', ['filter', 'groups', 'excludeGroups']); - $renderer = new TextTestListRenderer(); - print $renderer->render($suite); - if ($exit) { - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - return \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; - } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - private function handleListTestsXml(TestSuite $suite, string $target, bool $exit) : int - { - $this->printVersionString(); - $this->warnAboutConflictingOptions('listTestsXml', ['filter', 'groups', 'excludeGroups']); - $renderer = new XmlTestListRenderer(); - file_put_contents($target, $renderer->render($suite)); - printf('Wrote list of tests that would have been run to %s' . PHP_EOL, $target); - if ($exit) { - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - return \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; - } - private function generateConfiguration() : void - { - $this->printVersionString(); - print 'Generating phpunit.xml in ' . getcwd() . PHP_EOL . PHP_EOL; - print 'Bootstrap script (relative to path shown above; default: vendor/autoload.php): '; - $bootstrapScript = trim(fgets(STDIN)); - print 'Tests directory (relative to path shown above; default: tests): '; - $testsDirectory = trim(fgets(STDIN)); - print 'Source directory (relative to path shown above; default: src): '; - $src = trim(fgets(STDIN)); - print 'Cache directory (relative to path shown above; default: .phpunit.cache): '; - $cacheDirectory = trim(fgets(STDIN)); - if ($bootstrapScript === '') { - $bootstrapScript = 'vendor/autoload.php'; - } - if ($testsDirectory === '') { - $testsDirectory = 'tests'; - } - if ($src === '') { - $src = 'src'; - } - if ($cacheDirectory === '') { - $cacheDirectory = '.phpunit.cache'; - } - $generator = new Generator(); - file_put_contents('phpunit.xml', $generator->generateDefaultConfiguration(Version::series(), $bootstrapScript, $testsDirectory, $src, $cacheDirectory)); - print PHP_EOL . 'Generated phpunit.xml in ' . getcwd() . '.' . PHP_EOL; - print 'Make sure to exclude the ' . $cacheDirectory . ' directory from version control.' . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - private function migrateConfiguration(string $filename) : void - { - $this->printVersionString(); - if (!(new SchemaDetector())->detect($filename)->detected()) { - print $filename . ' does not need to be migrated.' . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); - } - copy($filename, $filename . '.bak'); - print 'Created backup: ' . $filename . '.bak' . PHP_EOL; - try { - file_put_contents($filename, (new Migrator())->migrate($filename)); - print 'Migrated configuration: ' . $filename . PHP_EOL; - } catch (Throwable $t) { - print 'Migration failed: ' . $t->getMessage() . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); - } - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - private function handleCustomOptions(array $unrecognizedOptions) : void - { - foreach ($unrecognizedOptions as $name => $value) { - if (isset($this->longOptions[$name])) { - $handler = $this->longOptions[$name]; - } - $name .= '='; - if (isset($this->longOptions[$name])) { - $handler = $this->longOptions[$name]; - } - if (isset($handler) && is_callable([$this, $handler])) { - $this->{$handler}($value); - unset($handler); - } - } - } - private function handleWarmCoverageCache(\PHPUnit\TextUI\XmlConfiguration\Configuration $configuration) : void - { - $this->printVersionString(); - if (isset($this->arguments['coverageCacheDirectory'])) { - $cacheDirectory = $this->arguments['coverageCacheDirectory']; - } elseif ($configuration->codeCoverage()->hasCacheDirectory()) { - $cacheDirectory = $configuration->codeCoverage()->cacheDirectory()->path(); - } else { - print 'Cache for static analysis has not been configured' . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); - } - $filter = new Filter(); - if ($configuration->codeCoverage()->hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport()) { - (new FilterMapper())->map($filter, $configuration->codeCoverage()); - } elseif (isset($this->arguments['coverageFilter'])) { - if (!is_array($this->arguments['coverageFilter'])) { - $coverageFilterDirectories = [$this->arguments['coverageFilter']]; - } else { - $coverageFilterDirectories = $this->arguments['coverageFilter']; - } - foreach ($coverageFilterDirectories as $coverageFilterDirectory) { - $filter->includeDirectory($coverageFilterDirectory); - } - } else { - print 'Filter for code coverage has not been configured' . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); - } - $timer = new Timer(); - $timer->start(); - print 'Warming cache for static analysis ... '; - (new CacheWarmer())->warmCache($cacheDirectory, !$configuration->codeCoverage()->disableCodeCoverageIgnore(), $configuration->codeCoverage()->ignoreDeprecatedCodeUnits(), $filter); - print 'done [' . $timer->stop()->asString() . ']' . PHP_EOL; - exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); - } - private function configurationFileInDirectory(string $directory) : ?string - { - $candidates = [$directory . '/phpunit.xml', $directory . '/phpunit.xml.dist']; - foreach ($candidates as $candidate) { - if (is_file($candidate)) { - return realpath($candidate); - } - } - return null; - } - /** - * @psalm-param "listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite" $key - * @psalm-param list<"listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite"> $keys - */ - private function warnAboutConflictingOptions(string $key, array $keys) : void - { - $warningPrinted = \false; - foreach ($keys as $_key) { - if (!empty($this->arguments[$_key])) { - printf('The %s and %s options cannot be combined, %s is ignored' . PHP_EOL, $this->mapKeyToOptionForWarning($_key), $this->mapKeyToOptionForWarning($key), $this->mapKeyToOptionForWarning($_key)); - $warningPrinted = \true; - } - } - if ($warningPrinted) { - print PHP_EOL; - } - } - /** - * @psalm-param "listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite" $key - */ - private function mapKeyToOptionForWarning(string $key) : string - { - switch ($key) { - case 'listGroups': - return '--list-groups'; - case 'listSuites': - return '--list-suites'; - case 'listTests': - return '--list-tests'; - case 'listTestsXml': - return '--list-tests-xml'; - case 'filter': - return '--filter'; - case 'groups': - return '--group'; - case 'excludeGroups': - return '--exclude-group'; - case 'testsuite': - return '--testsuite'; - } + return 'PHPUnit ' . self::id() . ' by Sebastian Bergmann and contributors.'; } } getNumberOfColumns(); - if ($numberOfColumns === 'max' || $numberOfColumns !== 80 && $numberOfColumns > $maxNumberOfColumns) { - $numberOfColumns = $maxNumberOfColumns; - } - $this->numberOfColumns = $numberOfColumns; - $this->verbose = $verbose; - $this->debug = $debug; - $this->reverse = $reverse; - if ($colors === self::COLOR_AUTO && $console->hasColorSupport()) { - $this->colors = \true; - } else { - $this->colors = self::COLOR_ALWAYS === $colors; - } - $this->timer = new Timer(); - $this->timer->start(); - } - public function printResult(TestResult $result) : void - { - $this->printHeader($result); - $this->printErrors($result); - $this->printWarnings($result); - $this->printFailures($result); - $this->printRisky($result); - if ($this->verbose) { - $this->printIncompletes($result); - $this->printSkipped($result); - } - $this->printFooter($result); - } - /** - * An error occurred. - */ - public function addError(Test $test, Throwable $t, float $time) : void - { - $this->writeProgressWithColor('fg-red, bold', 'E'); - $this->lastTestFailed = \true; - } - /** - * A failure occurred. - */ - public function addFailure(Test $test, AssertionFailedError $e, float $time) : void - { - $this->writeProgressWithColor('bg-red, fg-white', 'F'); - $this->lastTestFailed = \true; - } - /** - * A warning occurred. - */ - public function addWarning(Test $test, Warning $e, float $time) : void - { - $this->writeProgressWithColor('fg-yellow, bold', 'W'); - $this->lastTestFailed = \true; - } - /** - * Incomplete test. - */ - public function addIncompleteTest(Test $test, Throwable $t, float $time) : void - { - $this->writeProgressWithColor('fg-yellow, bold', 'I'); - $this->lastTestFailed = \true; - } - /** - * Risky test. - */ - public function addRiskyTest(Test $test, Throwable $t, float $time) : void - { - $this->writeProgressWithColor('fg-yellow, bold', 'R'); - $this->lastTestFailed = \true; - } - /** - * Skipped test. - */ - public function addSkippedTest(Test $test, Throwable $t, float $time) : void - { - $this->writeProgressWithColor('fg-cyan, bold', 'S'); - $this->lastTestFailed = \true; - } - /** - * A testsuite started. - */ - public function startTestSuite(TestSuite $suite) : void - { - if ($this->numTests == -1) { - $this->numTests = count($suite); - $this->numTestsWidth = strlen((string) $this->numTests); - $this->maxColumn = $this->numberOfColumns - strlen(' / (XXX%)') - 2 * $this->numTestsWidth; - } - } - /** - * A testsuite ended. - */ - public function endTestSuite(TestSuite $suite) : void - { - } - /** - * A test started. - */ - public function startTest(Test $test) : void - { - if ($this->debug) { - $this->write(sprintf("Test '%s' started\n", \PHPUnit\Util\Test::describeAsString($test))); - } - } - /** - * A test ended. - */ - public function endTest(Test $test, float $time) : void - { - if ($this->debug) { - $this->write(sprintf("Test '%s' ended\n", \PHPUnit\Util\Test::describeAsString($test))); - } - if (!$this->lastTestFailed) { - $this->writeProgress('.'); - } - if ($test instanceof TestCase) { - $this->numAssertions += $test->getNumAssertions(); - } elseif ($test instanceof PhptTestCase) { - $this->numAssertions++; - } - $this->lastTestFailed = \false; - if ($test instanceof TestCase && !$test->hasExpectationOnOutput()) { - $this->write($test->getActualOutput()); - } - } - protected function printDefects(array $defects, string $type) : void - { - $count = count($defects); - if ($count == 0) { - return; - } - if ($this->defectListPrinted) { - $this->write("\n--\n\n"); - } - $this->write(sprintf("There %s %d %s%s:\n", $count == 1 ? 'was' : 'were', $count, $type, $count == 1 ? '' : 's')); - $i = 1; - if ($this->reverse) { - $defects = array_reverse($defects); - } - foreach ($defects as $defect) { - $this->printDefect($defect, $i++); - } - $this->defectListPrinted = \true; - } - protected function printDefect(TestFailure $defect, int $count) : void - { - $this->printDefectHeader($defect, $count); - $this->printDefectTrace($defect); - } - protected function printDefectHeader(TestFailure $defect, int $count) : void - { - $this->write(sprintf("\n%d) %s\n", $count, $defect->getTestName())); - } - protected function printDefectTrace(TestFailure $defect) : void - { - $e = $defect->thrownException(); - $this->write((string) $e); - while ($e = $e->getPrevious()) { - $this->write("\nCaused by\n" . trim((string) $e) . "\n"); - } - } - protected function printErrors(TestResult $result) : void - { - $this->printDefects($result->errors(), 'error'); - } - protected function printFailures(TestResult $result) : void - { - $this->printDefects($result->failures(), 'failure'); - } - protected function printWarnings(TestResult $result) : void - { - $this->printDefects($result->warnings(), 'warning'); - } - protected function printIncompletes(TestResult $result) : void - { - $this->printDefects($result->notImplemented(), 'incomplete test'); - } - protected function printRisky(TestResult $result) : void - { - $this->printDefects($result->risky(), 'risky test'); - } - protected function printSkipped(TestResult $result) : void - { - $this->printDefects($result->skipped(), 'skipped test'); - } - protected function printHeader(TestResult $result) : void - { - if (count($result) > 0) { - $this->write(PHP_EOL . PHP_EOL . (new ResourceUsageFormatter())->resourceUsage($this->timer->stop()) . PHP_EOL . PHP_EOL); - } - } - protected function printFooter(TestResult $result) : void - { - if (count($result) === 0) { - $this->writeWithColor('fg-black, bg-yellow', 'No tests executed!'); - return; - } - if ($result->wasSuccessfulAndNoTestIsRiskyOrSkippedOrIncomplete()) { - $this->writeWithColor('fg-black, bg-green', sprintf('OK (%d test%s, %d assertion%s)', count($result), count($result) === 1 ? '' : 's', $this->numAssertions, $this->numAssertions === 1 ? '' : 's')); - return; - } - $color = 'fg-black, bg-yellow'; - if ($result->wasSuccessful()) { - if ($this->verbose || !$result->allHarmless()) { - $this->write("\n"); - } - $this->writeWithColor($color, 'OK, but incomplete, skipped, or risky tests!'); - } else { - $this->write("\n"); - if ($result->errorCount()) { - $color = 'fg-white, bg-red'; - $this->writeWithColor($color, 'ERRORS!'); - } elseif ($result->failureCount()) { - $color = 'fg-white, bg-red'; - $this->writeWithColor($color, 'FAILURES!'); - } elseif ($result->warningCount()) { - $color = 'fg-black, bg-yellow'; - $this->writeWithColor($color, 'WARNINGS!'); - } - } - $this->writeCountString(count($result), 'Tests', $color, \true); - $this->writeCountString($this->numAssertions, 'Assertions', $color, \true); - $this->writeCountString($result->errorCount(), 'Errors', $color); - $this->writeCountString($result->failureCount(), 'Failures', $color); - $this->writeCountString($result->warningCount(), 'Warnings', $color); - $this->writeCountString($result->skippedCount(), 'Skipped', $color); - $this->writeCountString($result->notImplementedCount(), 'Incomplete', $color); - $this->writeCountString($result->riskyCount(), 'Risky', $color); - $this->writeWithColor($color, '.'); - } - protected function writeProgress(string $progress) : void - { - if ($this->debug) { - return; - } - $this->write($progress); - $this->column++; - $this->numTestsRun++; - if ($this->column == $this->maxColumn || $this->numTestsRun == $this->numTests) { - if ($this->numTestsRun == $this->numTests) { - $this->write(str_repeat(' ', $this->maxColumn - $this->column)); - } - $this->write(sprintf(' %' . $this->numTestsWidth . 'd / %' . $this->numTestsWidth . 'd (%3s%%)', $this->numTestsRun, $this->numTests, floor($this->numTestsRun / $this->numTests * 100))); - if ($this->column == $this->maxColumn) { - $this->writeNewLine(); - } - } - } - protected function writeNewLine() : void - { - $this->column = 0; - $this->write("\n"); - } - /** - * Formats a buffer with a specified ANSI color sequence if colors are - * enabled. - */ - protected function colorizeTextBox(string $color, string $buffer) : string - { - if (!$this->colors) { - return $buffer; - } - $lines = preg_split('/\\r\\n|\\r|\\n/', $buffer); - $padding = max(array_map('\\strlen', $lines)); - $styledLines = []; - foreach ($lines as $line) { - $styledLines[] = Color::colorize($color, str_pad($line, $padding)); - } - return implode(PHP_EOL, $styledLines); - } - /** - * Writes a buffer out with a color sequence if colors are enabled. - */ - protected function writeWithColor(string $color, string $buffer, bool $lf = \true) : void + private const LONG_OPTIONS = ['atleast-version=', 'prepend=', 'bootstrap=', 'cache-result', 'do-not-cache-result', 'cache-result-file=', 'check-version', 'colors==', 'columns=', 'configuration=', 'coverage-cache=', 'warm-coverage-cache', 'coverage-filter=', 'coverage-clover=', 'coverage-cobertura=', 'coverage-crap4j=', 'coverage-html=', 'coverage-php=', 'coverage-text==', 'coverage-xml=', 'path-coverage', 'debug', 'disallow-test-output', 'disallow-resource-usage', 'disallow-todo-tests', 'default-time-limit=', 'enforce-time-limit', 'exclude-group=', 'extensions=', 'filter=', 'generate-configuration', 'globals-backup', 'group=', 'covers=', 'uses=', 'help', 'resolve-dependencies', 'ignore-dependencies', 'include-path=', 'list-groups', 'list-suites', 'list-tests', 'list-tests-xml=', 'loader=', 'log-junit=', 'log-teamcity=', 'migrate-configuration', 'no-configuration', 'no-coverage', 'no-logging', 'no-interaction', 'no-extensions', 'order-by=', 'printer=', 'process-isolation', 'repeat=', 'dont-report-useless-tests', 'random-order', 'random-order-seed=', 'reverse-order', 'reverse-list', 'static-backup', 'stderr', 'stop-on-defect', 'stop-on-error', 'stop-on-failure', 'stop-on-warning', 'stop-on-incomplete', 'stop-on-risky', 'stop-on-skipped', 'fail-on-empty-test-suite', 'fail-on-incomplete', 'fail-on-risky', 'fail-on-skipped', 'fail-on-warning', 'strict-coverage', 'disable-coverage-ignore', 'strict-global-state', 'teamcity', 'testdox', 'testdox-group=', 'testdox-exclude-group=', 'testdox-html=', 'testdox-text=', 'testdox-xml=', 'test-suffix=', 'testsuite=', 'verbose', 'version', 'whitelist=', 'dump-xdebug-filter=']; + private const SHORT_OPTIONS = 'd:c:hv'; + public function fromParameters(array $parameters, array $additionalLongOptions): \PHPUnit\TextUI\CliArguments\Configuration { - $this->write($this->colorizeTextBox($color, $buffer)); - if ($lf) { - $this->write(PHP_EOL); + try { + $options = (new CliParser())->parse($parameters, self::SHORT_OPTIONS, array_merge(self::LONG_OPTIONS, $additionalLongOptions)); + } catch (CliParserException $e) { + throw new \PHPUnit\TextUI\CliArguments\Exception($e->getMessage(), $e->getCode(), $e); } - } - /** - * Writes progress with a color sequence if colors are enabled. - */ - protected function writeProgressWithColor(string $color, string $buffer) : void - { - $buffer = $this->colorizeTextBox($color, $buffer); - $this->writeProgress($buffer); - } - private function writeCountString(int $count, string $name, string $color, bool $always = \false) : void - { - static $first = \true; - if ($always || $count > 0) { - $this->writeWithColor($color, sprintf('%s%s: %d', !$first ? ', ' : '', $name, $count), \false); - $first = \false; + $argument = null; + $atLeastVersion = null; + $backupGlobals = null; + $backupStaticAttributes = null; + $beStrictAboutChangesToGlobalState = null; + $beStrictAboutResourceUsageDuringSmallTests = null; + $bootstrap = null; + $cacheResult = null; + $cacheResultFile = null; + $checkVersion = null; + $colors = null; + $columns = null; + $configuration = null; + $coverageCacheDirectory = null; + $warmCoverageCache = null; + $coverageFilter = null; + $coverageClover = null; + $coverageCobertura = null; + $coverageCrap4J = null; + $coverageHtml = null; + $coveragePhp = null; + $coverageText = null; + $coverageTextShowUncoveredFiles = null; + $coverageTextShowOnlySummary = null; + $coverageXml = null; + $pathCoverage = null; + $debug = null; + $defaultTimeLimit = null; + $disableCodeCoverageIgnore = null; + $disallowTestOutput = null; + $disallowTodoAnnotatedTests = null; + $enforceTimeLimit = null; + $excludeGroups = null; + $executionOrder = null; + $executionOrderDefects = null; + $extensions = []; + $unavailableExtensions = []; + $failOnEmptyTestSuite = null; + $failOnIncomplete = null; + $failOnRisky = null; + $failOnSkipped = null; + $failOnWarning = null; + $filter = null; + $generateConfiguration = null; + $migrateConfiguration = null; + $groups = null; + $testsCovering = null; + $testsUsing = null; + $help = null; + $includePath = null; + $iniSettings = []; + $junitLogfile = null; + $listGroups = null; + $listSuites = null; + $listTests = null; + $listTestsXml = null; + $loader = null; + $noCoverage = null; + $noExtensions = null; + $noInteraction = null; + $noLogging = null; + $printer = null; + $processIsolation = null; + $randomOrderSeed = null; + $repeat = null; + $reportUselessTests = null; + $resolveDependencies = null; + $reverseList = null; + $stderr = null; + $strictCoverage = null; + $stopOnDefect = null; + $stopOnError = null; + $stopOnFailure = null; + $stopOnIncomplete = null; + $stopOnRisky = null; + $stopOnSkipped = null; + $stopOnWarning = null; + $teamcityLogfile = null; + $testdoxExcludeGroups = null; + $testdoxGroups = null; + $testdoxHtmlFile = null; + $testdoxTextFile = null; + $testdoxXmlFile = null; + $testSuffixes = null; + $testSuite = null; + $unrecognizedOptions = []; + $unrecognizedOrderBy = null; + $useDefaultConfiguration = null; + $verbose = null; + $version = null; + $xdebugFilterFile = null; + if (isset($options[1][0])) { + $argument = $options[1][0]; } + foreach ($options[0] as $option) { + switch ($option[0]) { + case '--colors': + $colors = $option[1] ?: DefaultResultPrinter::COLOR_AUTO; + break; + case '--bootstrap': + $bootstrap = $option[1]; + break; + case '--cache-result': + $cacheResult = \true; + break; + case '--do-not-cache-result': + $cacheResult = \false; + break; + case '--cache-result-file': + $cacheResultFile = $option[1]; + break; + case '--columns': + if (is_numeric($option[1])) { + $columns = (int) $option[1]; + } elseif ($option[1] === 'max') { + $columns = 'max'; + } + break; + case 'c': + case '--configuration': + $configuration = $option[1]; + break; + case '--coverage-cache': + $coverageCacheDirectory = $option[1]; + break; + case '--warm-coverage-cache': + $warmCoverageCache = \true; + break; + case '--coverage-clover': + $coverageClover = $option[1]; + break; + case '--coverage-cobertura': + $coverageCobertura = $option[1]; + break; + case '--coverage-crap4j': + $coverageCrap4J = $option[1]; + break; + case '--coverage-html': + $coverageHtml = $option[1]; + break; + case '--coverage-php': + $coveragePhp = $option[1]; + break; + case '--coverage-text': + if ($option[1] === null) { + $option[1] = 'php://stdout'; + } + $coverageText = $option[1]; + $coverageTextShowUncoveredFiles = \false; + $coverageTextShowOnlySummary = \false; + break; + case '--coverage-xml': + $coverageXml = $option[1]; + break; + case '--path-coverage': + $pathCoverage = \true; + break; + case 'd': + $tmp = explode('=', $option[1]); + if (isset($tmp[0])) { + if (isset($tmp[1])) { + $iniSettings[$tmp[0]] = $tmp[1]; + } else { + $iniSettings[$tmp[0]] = '1'; + } + } + break; + case '--debug': + $debug = \true; + break; + case 'h': + case '--help': + $help = \true; + break; + case '--filter': + $filter = $option[1]; + break; + case '--testsuite': + $testSuite = $option[1]; + break; + case '--generate-configuration': + $generateConfiguration = \true; + break; + case '--migrate-configuration': + $migrateConfiguration = \true; + break; + case '--group': + $groups = explode(',', $option[1]); + break; + case '--exclude-group': + $excludeGroups = explode(',', $option[1]); + break; + case '--covers': + $testsCovering = array_map('strtolower', explode(',', $option[1])); + break; + case '--uses': + $testsUsing = array_map('strtolower', explode(',', $option[1])); + break; + case '--test-suffix': + $testSuffixes = explode(',', $option[1]); + break; + case '--include-path': + $includePath = $option[1]; + break; + case '--list-groups': + $listGroups = \true; + break; + case '--list-suites': + $listSuites = \true; + break; + case '--list-tests': + $listTests = \true; + break; + case '--list-tests-xml': + $listTestsXml = $option[1]; + break; + case '--printer': + $printer = $option[1]; + break; + case '--loader': + $loader = $option[1]; + break; + case '--log-junit': + $junitLogfile = $option[1]; + break; + case '--log-teamcity': + $teamcityLogfile = $option[1]; + break; + case '--order-by': + foreach (explode(',', $option[1]) as $order) { + switch ($order) { + case 'default': + $executionOrder = TestSuiteSorter::ORDER_DEFAULT; + $executionOrderDefects = TestSuiteSorter::ORDER_DEFAULT; + $resolveDependencies = \true; + break; + case 'defects': + $executionOrderDefects = TestSuiteSorter::ORDER_DEFECTS_FIRST; + break; + case 'depends': + $resolveDependencies = \true; + break; + case 'duration': + $executionOrder = TestSuiteSorter::ORDER_DURATION; + break; + case 'no-depends': + $resolveDependencies = \false; + break; + case 'random': + $executionOrder = TestSuiteSorter::ORDER_RANDOMIZED; + break; + case 'reverse': + $executionOrder = TestSuiteSorter::ORDER_REVERSED; + break; + case 'size': + $executionOrder = TestSuiteSorter::ORDER_SIZE; + break; + default: + $unrecognizedOrderBy = $order; + } + } + break; + case '--process-isolation': + $processIsolation = \true; + break; + case '--repeat': + $repeat = (int) $option[1]; + break; + case '--stderr': + $stderr = \true; + break; + case '--stop-on-defect': + $stopOnDefect = \true; + break; + case '--stop-on-error': + $stopOnError = \true; + break; + case '--stop-on-failure': + $stopOnFailure = \true; + break; + case '--stop-on-warning': + $stopOnWarning = \true; + break; + case '--stop-on-incomplete': + $stopOnIncomplete = \true; + break; + case '--stop-on-risky': + $stopOnRisky = \true; + break; + case '--stop-on-skipped': + $stopOnSkipped = \true; + break; + case '--fail-on-empty-test-suite': + $failOnEmptyTestSuite = \true; + break; + case '--fail-on-incomplete': + $failOnIncomplete = \true; + break; + case '--fail-on-risky': + $failOnRisky = \true; + break; + case '--fail-on-skipped': + $failOnSkipped = \true; + break; + case '--fail-on-warning': + $failOnWarning = \true; + break; + case '--teamcity': + $printer = TeamCity::class; + break; + case '--testdox': + $printer = CliTestDoxPrinter::class; + break; + case '--testdox-group': + $testdoxGroups = explode(',', $option[1]); + break; + case '--testdox-exclude-group': + $testdoxExcludeGroups = explode(',', $option[1]); + break; + case '--testdox-html': + $testdoxHtmlFile = $option[1]; + break; + case '--testdox-text': + $testdoxTextFile = $option[1]; + break; + case '--testdox-xml': + $testdoxXmlFile = $option[1]; + break; + case '--no-configuration': + $useDefaultConfiguration = \false; + break; + case '--extensions': + foreach (explode(',', $option[1]) as $extensionClass) { + if (!class_exists($extensionClass)) { + $unavailableExtensions[] = $extensionClass; + continue; + } + $extensions[] = new Extension($extensionClass, '', []); + } + break; + case '--no-extensions': + $noExtensions = \true; + break; + case '--no-coverage': + $noCoverage = \true; + break; + case '--no-logging': + $noLogging = \true; + break; + case '--no-interaction': + $noInteraction = \true; + break; + case '--globals-backup': + $backupGlobals = \true; + break; + case '--static-backup': + $backupStaticAttributes = \true; + break; + case 'v': + case '--verbose': + $verbose = \true; + break; + case '--atleast-version': + $atLeastVersion = $option[1]; + break; + case '--version': + $version = \true; + break; + case '--dont-report-useless-tests': + $reportUselessTests = \false; + break; + case '--strict-coverage': + $strictCoverage = \true; + break; + case '--disable-coverage-ignore': + $disableCodeCoverageIgnore = \true; + break; + case '--strict-global-state': + $beStrictAboutChangesToGlobalState = \true; + break; + case '--disallow-test-output': + $disallowTestOutput = \true; + break; + case '--disallow-resource-usage': + $beStrictAboutResourceUsageDuringSmallTests = \true; + break; + case '--default-time-limit': + $defaultTimeLimit = (int) $option[1]; + break; + case '--enforce-time-limit': + $enforceTimeLimit = \true; + break; + case '--disallow-todo-tests': + $disallowTodoAnnotatedTests = \true; + break; + case '--reverse-list': + $reverseList = \true; + break; + case '--check-version': + $checkVersion = \true; + break; + case '--coverage-filter': + case '--whitelist': + if ($coverageFilter === null) { + $coverageFilter = []; + } + $coverageFilter[] = $option[1]; + break; + case '--random-order': + $executionOrder = TestSuiteSorter::ORDER_RANDOMIZED; + break; + case '--random-order-seed': + $randomOrderSeed = (int) $option[1]; + break; + case '--resolve-dependencies': + $resolveDependencies = \true; + break; + case '--ignore-dependencies': + $resolveDependencies = \false; + break; + case '--reverse-order': + $executionOrder = TestSuiteSorter::ORDER_REVERSED; + break; + case '--dump-xdebug-filter': + $xdebugFilterFile = $option[1]; + break; + default: + $unrecognizedOptions[str_replace('--', '', $option[0])] = $option[1]; + } + } + if (empty($extensions)) { + $extensions = null; + } + if (empty($unavailableExtensions)) { + $unavailableExtensions = null; + } + if (empty($iniSettings)) { + $iniSettings = null; + } + if (empty($coverageFilter)) { + $coverageFilter = null; + } + return new \PHPUnit\TextUI\CliArguments\Configuration($argument, $atLeastVersion, $backupGlobals, $backupStaticAttributes, $beStrictAboutChangesToGlobalState, $beStrictAboutResourceUsageDuringSmallTests, $bootstrap, $cacheResult, $cacheResultFile, $checkVersion, $colors, $columns, $configuration, $coverageClover, $coverageCobertura, $coverageCrap4J, $coverageHtml, $coveragePhp, $coverageText, $coverageTextShowUncoveredFiles, $coverageTextShowOnlySummary, $coverageXml, $pathCoverage, $coverageCacheDirectory, $warmCoverageCache, $debug, $defaultTimeLimit, $disableCodeCoverageIgnore, $disallowTestOutput, $disallowTodoAnnotatedTests, $enforceTimeLimit, $excludeGroups, $executionOrder, $executionOrderDefects, $extensions, $unavailableExtensions, $failOnEmptyTestSuite, $failOnIncomplete, $failOnRisky, $failOnSkipped, $failOnWarning, $filter, $generateConfiguration, $migrateConfiguration, $groups, $testsCovering, $testsUsing, $help, $includePath, $iniSettings, $junitLogfile, $listGroups, $listSuites, $listTests, $listTestsXml, $loader, $noCoverage, $noExtensions, $noInteraction, $noLogging, $printer, $processIsolation, $randomOrderSeed, $repeat, $reportUselessTests, $resolveDependencies, $reverseList, $stderr, $strictCoverage, $stopOnDefect, $stopOnError, $stopOnFailure, $stopOnIncomplete, $stopOnRisky, $stopOnSkipped, $stopOnWarning, $teamcityLogfile, $testdoxExcludeGroups, $testdoxGroups, $testdoxHtmlFile, $testdoxTextFile, $testdoxXmlFile, $testSuffixes, $testSuite, $unrecognizedOptions, $unrecognizedOrderBy, $useDefaultConfiguration, $verbose, $version, $coverageFilter, $xdebugFilterFile); } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI; - -use RuntimeException; -/** - * @internal This interface is not covered by the backward compatibility promise for PHPUnit - */ -final class ReflectionException extends RuntimeException implements \PHPUnit\TextUI\Exception -{ -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI; - -/** - * @internal This interface is not covered by the backward compatibility promise for PHPUnit - */ -final class RuntimeException extends \RuntimeException implements \PHPUnit\TextUI\Exception -{ -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI; - -use function sprintf; -use RuntimeException; -/** - * @internal This interface is not covered by the backward compatibility promise for PHPUnit - */ -final class TestDirectoryNotFoundException extends RuntimeException implements \PHPUnit\TextUI\Exception -{ - public function __construct(string $path) - { - parent::__construct(sprintf('Test directory "%s" not found', $path)); - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI; - -use function sprintf; -use RuntimeException; -/** - * @internal This interface is not covered by the backward compatibility promise for PHPUnit - */ -final class TestFileNotFoundException extends RuntimeException implements \PHPUnit\TextUI\Exception -{ - public function __construct(string $path) - { - parent::__construct(sprintf('Test file "%s" not found', $path)); - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI; +namespace PHPUnit\TextUI\CliArguments; -use const PHP_EOL; -use function count; -use function explode; -use function max; -use function preg_replace_callback; -use function str_pad; -use function str_repeat; -use function strlen; -use function wordwrap; -use PHPUnit\Util\Color; -use PHPUnit\SebastianBergmann\Environment\Console; +use PHPUnit\TextUI\XmlConfiguration\Extension; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable */ -final class Help +final class Configuration { - private const LEFT_MARGIN = ' '; - private const HELP_TEXT = ['Usage' => [['text' => 'phpunit [options] UnitTest.php'], ['text' => 'phpunit [options] ']], 'Code Coverage Options' => [['arg' => '--coverage-clover ', 'desc' => 'Generate code coverage report in Clover XML format'], ['arg' => '--coverage-cobertura ', 'desc' => 'Generate code coverage report in Cobertura XML format'], ['arg' => '--coverage-crap4j ', 'desc' => 'Generate code coverage report in Crap4J XML format'], ['arg' => '--coverage-html ', 'desc' => 'Generate code coverage report in HTML format'], ['arg' => '--coverage-php ', 'desc' => 'Export PHP_CodeCoverage object to file'], ['arg' => '--coverage-text=', 'desc' => 'Generate code coverage report in text format [default: standard output]'], ['arg' => '--coverage-xml ', 'desc' => 'Generate code coverage report in PHPUnit XML format'], ['arg' => '--coverage-cache ', 'desc' => 'Cache static analysis results'], ['arg' => '--warm-coverage-cache', 'desc' => 'Warm static analysis cache'], ['arg' => '--coverage-filter ', 'desc' => 'Include in code coverage analysis'], ['arg' => '--path-coverage', 'desc' => 'Perform path coverage analysis'], ['arg' => '--disable-coverage-ignore', 'desc' => 'Disable annotations for ignoring code coverage'], ['arg' => '--no-coverage', 'desc' => 'Ignore code coverage configuration']], 'Logging Options' => [['arg' => '--log-junit ', 'desc' => 'Log test execution in JUnit XML format to file'], ['arg' => '--log-teamcity ', 'desc' => 'Log test execution in TeamCity format to file'], ['arg' => '--testdox-html ', 'desc' => 'Write agile documentation in HTML format to file'], ['arg' => '--testdox-text ', 'desc' => 'Write agile documentation in Text format to file'], ['arg' => '--testdox-xml ', 'desc' => 'Write agile documentation in XML format to file'], ['arg' => '--reverse-list', 'desc' => 'Print defects in reverse order'], ['arg' => '--no-logging', 'desc' => 'Ignore logging configuration']], 'Test Selection Options' => [['arg' => '--list-suites', 'desc' => 'List available test suites'], ['arg' => '--testsuite ', 'desc' => 'Filter which testsuite to run'], ['arg' => '--list-groups', 'desc' => 'List available test groups'], ['arg' => '--group ', 'desc' => 'Only runs tests from the specified group(s)'], ['arg' => '--exclude-group ', 'desc' => 'Exclude tests from the specified group(s)'], ['arg' => '--covers ', 'desc' => 'Only runs tests annotated with "@covers "'], ['arg' => '--uses ', 'desc' => 'Only runs tests annotated with "@uses "'], ['arg' => '--list-tests', 'desc' => 'List available tests'], ['arg' => '--list-tests-xml ', 'desc' => 'List available tests in XML format'], ['arg' => '--filter ', 'desc' => 'Filter which tests to run'], ['arg' => '--test-suffix ', 'desc' => 'Only search for test in files with specified suffix(es). Default: Test.php,.phpt']], 'Test Execution Options' => [['arg' => '--dont-report-useless-tests', 'desc' => 'Do not report tests that do not test anything'], ['arg' => '--strict-coverage', 'desc' => 'Be strict about @covers annotation usage'], ['arg' => '--strict-global-state', 'desc' => 'Be strict about changes to global state'], ['arg' => '--disallow-test-output', 'desc' => 'Be strict about output during tests'], ['arg' => '--disallow-resource-usage', 'desc' => 'Be strict about resource usage during small tests'], ['arg' => '--enforce-time-limit', 'desc' => 'Enforce time limit based on test size'], ['arg' => '--default-time-limit ', 'desc' => 'Timeout in seconds for tests without @small, @medium or @large'], ['arg' => '--disallow-todo-tests', 'desc' => 'Disallow @todo-annotated tests'], ['spacer' => ''], ['arg' => '--process-isolation', 'desc' => 'Run each test in a separate PHP process'], ['arg' => '--globals-backup', 'desc' => 'Backup and restore $GLOBALS for each test'], ['arg' => '--static-backup', 'desc' => 'Backup and restore static attributes for each test'], ['spacer' => ''], ['arg' => '--colors ', 'desc' => 'Use colors in output ("never", "auto" or "always")'], ['arg' => '--columns ', 'desc' => 'Number of columns to use for progress output'], ['arg' => '--columns max', 'desc' => 'Use maximum number of columns for progress output'], ['arg' => '--stderr', 'desc' => 'Write to STDERR instead of STDOUT'], ['arg' => '--stop-on-defect', 'desc' => 'Stop execution upon first not-passed test'], ['arg' => '--stop-on-error', 'desc' => 'Stop execution upon first error'], ['arg' => '--stop-on-failure', 'desc' => 'Stop execution upon first error or failure'], ['arg' => '--stop-on-warning', 'desc' => 'Stop execution upon first warning'], ['arg' => '--stop-on-risky', 'desc' => 'Stop execution upon first risky test'], ['arg' => '--stop-on-skipped', 'desc' => 'Stop execution upon first skipped test'], ['arg' => '--stop-on-incomplete', 'desc' => 'Stop execution upon first incomplete test'], ['arg' => '--fail-on-incomplete', 'desc' => 'Treat incomplete tests as failures'], ['arg' => '--fail-on-risky', 'desc' => 'Treat risky tests as failures'], ['arg' => '--fail-on-skipped', 'desc' => 'Treat skipped tests as failures'], ['arg' => '--fail-on-warning', 'desc' => 'Treat tests with warnings as failures'], ['arg' => '-v|--verbose', 'desc' => 'Output more verbose information'], ['arg' => '--debug', 'desc' => 'Display debugging information'], ['spacer' => ''], ['arg' => '--repeat ', 'desc' => 'Runs the test(s) repeatedly'], ['arg' => '--teamcity', 'desc' => 'Report test execution progress in TeamCity format'], ['arg' => '--testdox', 'desc' => 'Report test execution progress in TestDox format'], ['arg' => '--testdox-group', 'desc' => 'Only include tests from the specified group(s)'], ['arg' => '--testdox-exclude-group', 'desc' => 'Exclude tests from the specified group(s)'], ['arg' => '--no-interaction', 'desc' => 'Disable TestDox progress animation'], ['arg' => '--printer ', 'desc' => 'TestListener implementation to use'], ['spacer' => ''], ['arg' => '--order-by ', 'desc' => 'Run tests in order: default|defects|duration|no-depends|random|reverse|size'], ['arg' => '--random-order-seed ', 'desc' => 'Use a specific random seed for random order'], ['arg' => '--cache-result', 'desc' => 'Write test results to cache file'], ['arg' => '--do-not-cache-result', 'desc' => 'Do not write test results to cache file']], 'Configuration Options' => [['arg' => '--prepend ', 'desc' => 'A PHP script that is included as early as possible'], ['arg' => '--bootstrap ', 'desc' => 'A PHP script that is included before the tests run'], ['arg' => '-c|--configuration ', 'desc' => 'Read configuration from XML file'], ['arg' => '--no-configuration', 'desc' => 'Ignore default configuration file (phpunit.xml)'], ['arg' => '--extensions ', 'desc' => 'A comma separated list of PHPUnit extensions to load'], ['arg' => '--no-extensions', 'desc' => 'Do not load PHPUnit extensions'], ['arg' => '--include-path ', 'desc' => 'Prepend PHP\'s include_path with given path(s)'], ['arg' => '-d ', 'desc' => 'Sets a php.ini value'], ['arg' => '--cache-result-file ', 'desc' => 'Specify result cache path and filename'], ['arg' => '--generate-configuration', 'desc' => 'Generate configuration file with suggested settings'], ['arg' => '--migrate-configuration', 'desc' => 'Migrate configuration file to current format']], 'Miscellaneous Options' => [['arg' => '-h|--help', 'desc' => 'Prints this usage information'], ['arg' => '--version', 'desc' => 'Prints the version and exits'], ['arg' => '--atleast-version ', 'desc' => 'Checks that version is greater than min and exits'], ['arg' => '--check-version', 'desc' => 'Check whether PHPUnit is the latest version']]]; /** - * @var int Number of columns required to write the longest option name to the console + * @var ?string */ - private $maxArgLength = 0; + private $argument; /** - * @var int Number of columns left for the description field after padding and option + * @var ?string */ - private $maxDescLength; + private $atLeastVersion; /** - * @var bool Use color highlights for sections, options and parameters + * @var ?bool */ - private $hasColor = \false; - public function __construct(?int $width = null, ?bool $withColor = null) - { - if ($width === null) { - $width = (new Console())->getNumberOfColumns(); - } - if ($withColor === null) { - $this->hasColor = (new Console())->hasColorSupport(); - } else { - $this->hasColor = $withColor; - } - foreach (self::HELP_TEXT as $options) { - foreach ($options as $option) { - if (isset($option['arg'])) { - $this->maxArgLength = max($this->maxArgLength, isset($option['arg']) ? strlen($option['arg']) : 0); - } - } - } - $this->maxDescLength = $width - $this->maxArgLength - 4; - } + private $backupGlobals; /** - * Write the help file to the CLI, adapting width and colors to the console. + * @var ?bool */ - public function writeToConsole() : void - { - if ($this->hasColor) { - $this->writeWithColor(); - } else { - $this->writePlaintext(); - } - } - private function writePlaintext() : void - { - foreach (self::HELP_TEXT as $section => $options) { - print "{$section}:" . PHP_EOL; - if ($section !== 'Usage') { - print PHP_EOL; - } - foreach ($options as $option) { - if (isset($option['spacer'])) { - print PHP_EOL; - } - if (isset($option['text'])) { - print self::LEFT_MARGIN . $option['text'] . PHP_EOL; - } - if (isset($option['arg'])) { - $arg = str_pad($option['arg'], $this->maxArgLength); - print self::LEFT_MARGIN . $arg . ' ' . $option['desc'] . PHP_EOL; - } - } - print PHP_EOL; - } - } - private function writeWithColor() : void - { - foreach (self::HELP_TEXT as $section => $options) { - print Color::colorize('fg-yellow', "{$section}:") . PHP_EOL; - foreach ($options as $option) { - if (isset($option['spacer'])) { - print PHP_EOL; - } - if (isset($option['text'])) { - print self::LEFT_MARGIN . $option['text'] . PHP_EOL; - } - if (isset($option['arg'])) { - $arg = Color::colorize('fg-green', str_pad($option['arg'], $this->maxArgLength)); - $arg = preg_replace_callback('/(<[^>]+>)/', static function ($matches) { - return Color::colorize('fg-cyan', $matches[0]); - }, $arg); - $desc = explode(PHP_EOL, wordwrap($option['desc'], $this->maxDescLength, PHP_EOL)); - print self::LEFT_MARGIN . $arg . ' ' . $desc[0] . PHP_EOL; - for ($i = 1; $i < count($desc); $i++) { - print str_repeat(' ', $this->maxArgLength + 3) . $desc[$i] . PHP_EOL; - } - } - } - print PHP_EOL; - } - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI; - -use PHPUnit\Framework\TestListener; -use PHPUnit\Framework\TestResult; -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -interface ResultPrinter extends TestListener -{ - public function printResult(TestResult $result) : void; - public function write(string $buffer) : void; -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI; - -use const PHP_EOL; -use const PHP_SAPI; -use const PHP_VERSION; -use function array_diff; -use function array_map; -use function array_merge; -use function assert; -use function class_exists; -use function count; -use function dirname; -use function file_put_contents; -use function htmlspecialchars; -use function is_array; -use function is_int; -use function is_string; -use function mt_srand; -use function range; -use function realpath; -use function sort; -use function sprintf; -use function time; -use PHPUnit\Framework\Exception; -use PHPUnit\Framework\TestResult; -use PHPUnit\Framework\TestSuite; -use PHPUnit\Runner\AfterLastTestHook; -use PHPUnit\Runner\BaseTestRunner; -use PHPUnit\Runner\BeforeFirstTestHook; -use PHPUnit\Runner\DefaultTestResultCache; -use PHPUnit\Runner\Extension\ExtensionHandler; -use PHPUnit\Runner\Filter\ExcludeGroupFilterIterator; -use PHPUnit\Runner\Filter\Factory; -use PHPUnit\Runner\Filter\IncludeGroupFilterIterator; -use PHPUnit\Runner\Filter\NameFilterIterator; -use PHPUnit\Runner\Hook; -use PHPUnit\Runner\NullTestResultCache; -use PHPUnit\Runner\ResultCacheExtension; -use PHPUnit\Runner\StandardTestSuiteLoader; -use PHPUnit\Runner\TestHook; -use PHPUnit\Runner\TestListenerAdapter; -use PHPUnit\Runner\TestSuiteLoader; -use PHPUnit\Runner\TestSuiteSorter; -use PHPUnit\Runner\Version; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\FilterMapper; -use PHPUnit\TextUI\XmlConfiguration\Configuration; -use PHPUnit\TextUI\XmlConfiguration\Loader; -use PHPUnit\TextUI\XmlConfiguration\PhpHandler; -use PHPUnit\Util\Filesystem; -use PHPUnit\Util\Log\JUnit; -use PHPUnit\Util\Log\TeamCity; -use PHPUnit\Util\Printer; -use PHPUnit\Util\TestDox\CliTestDoxPrinter; -use PHPUnit\Util\TestDox\HtmlResultPrinter; -use PHPUnit\Util\TestDox\TextResultPrinter; -use PHPUnit\Util\TestDox\XmlResultPrinter; -use PHPUnit\Util\XdebugFilterScriptGenerator; -use PHPUnit\Util\Xml\SchemaDetector; -use ReflectionClass; -use ReflectionException; -use PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage; -use PHPUnit\SebastianBergmann\CodeCoverage\Driver\Selector; -use PHPUnit\SebastianBergmann\CodeCoverage\Exception as CodeCoverageException; -use PHPUnit\SebastianBergmann\CodeCoverage\Filter as CodeCoverageFilter; -use PHPUnit\SebastianBergmann\CodeCoverage\Report\Clover as CloverReport; -use PHPUnit\SebastianBergmann\CodeCoverage\Report\Cobertura as CoberturaReport; -use PHPUnit\SebastianBergmann\CodeCoverage\Report\Crap4j as Crap4jReport; -use PHPUnit\SebastianBergmann\CodeCoverage\Report\Html\Facade as HtmlReport; -use PHPUnit\SebastianBergmann\CodeCoverage\Report\PHP as PhpReport; -use PHPUnit\SebastianBergmann\CodeCoverage\Report\Text as TextReport; -use PHPUnit\SebastianBergmann\CodeCoverage\Report\Xml\Facade as XmlReport; -use PHPUnit\SebastianBergmann\Comparator\Comparator; -use PHPUnit\SebastianBergmann\Environment\Runtime; -use PHPUnit\SebastianBergmann\Invoker\Invoker; -use PHPUnit\SebastianBergmann\Timer\Timer; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class TestRunner extends BaseTestRunner -{ - public const SUCCESS_EXIT = 0; - public const FAILURE_EXIT = 1; - public const EXCEPTION_EXIT = 2; + private $backupStaticAttributes; /** - * @var CodeCoverageFilter + * @var ?bool */ - private $codeCoverageFilter; + private $beStrictAboutChangesToGlobalState; /** - * @var TestSuiteLoader + * @var ?bool + */ + private $beStrictAboutResourceUsageDuringSmallTests; + /** + * @var ?string + */ + private $bootstrap; + /** + * @var ?bool + */ + private $cacheResult; + /** + * @var ?string + */ + private $cacheResultFile; + /** + * @var ?bool + */ + private $checkVersion; + /** + * @var ?string + */ + private $colors; + /** + * @var null|int|string + */ + private $columns; + /** + * @var ?string + */ + private $configuration; + /** + * @var null|string[] + */ + private $coverageFilter; + /** + * @var ?string + */ + private $coverageClover; + /** + * @var ?string + */ + private $coverageCobertura; + /** + * @var ?string + */ + private $coverageCrap4J; + /** + * @var ?string + */ + private $coverageHtml; + /** + * @var ?string + */ + private $coveragePhp; + /** + * @var ?string + */ + private $coverageText; + /** + * @var ?bool + */ + private $coverageTextShowUncoveredFiles; + /** + * @var ?bool + */ + private $coverageTextShowOnlySummary; + /** + * @var ?string + */ + private $coverageXml; + /** + * @var ?bool + */ + private $pathCoverage; + /** + * @var ?string + */ + private $coverageCacheDirectory; + /** + * @var ?bool + */ + private $warmCoverageCache; + /** + * @var ?bool + */ + private $debug; + /** + * @var ?int + */ + private $defaultTimeLimit; + /** + * @var ?bool + */ + private $disableCodeCoverageIgnore; + /** + * @var ?bool + */ + private $disallowTestOutput; + /** + * @var ?bool + */ + private $disallowTodoAnnotatedTests; + /** + * @var ?bool + */ + private $enforceTimeLimit; + /** + * @var null|string[] + */ + private $excludeGroups; + /** + * @var ?int + */ + private $executionOrder; + /** + * @var ?int + */ + private $executionOrderDefects; + /** + * @var null|Extension[] + */ + private $extensions; + /** + * @var null|string[] + */ + private $unavailableExtensions; + /** + * @var ?bool + */ + private $failOnEmptyTestSuite; + /** + * @var ?bool + */ + private $failOnIncomplete; + /** + * @var ?bool + */ + private $failOnRisky; + /** + * @var ?bool + */ + private $failOnSkipped; + /** + * @var ?bool + */ + private $failOnWarning; + /** + * @var ?string + */ + private $filter; + /** + * @var ?bool + */ + private $generateConfiguration; + /** + * @var ?bool + */ + private $migrateConfiguration; + /** + * @var null|string[] + */ + private $groups; + /** + * @var null|string[] + */ + private $testsCovering; + /** + * @var null|string[] + */ + private $testsUsing; + /** + * @var ?bool + */ + private $help; + /** + * @var ?string + */ + private $includePath; + /** + * @var null|string[] + */ + private $iniSettings; + /** + * @var ?string + */ + private $junitLogfile; + /** + * @var ?bool + */ + private $listGroups; + /** + * @var ?bool + */ + private $listSuites; + /** + * @var ?bool + */ + private $listTests; + /** + * @var ?string + */ + private $listTestsXml; + /** + * @var ?string */ private $loader; /** - * @var ResultPrinter + * @var ?bool + */ + private $noCoverage; + /** + * @var ?bool + */ + private $noExtensions; + /** + * @var ?bool + */ + private $noInteraction; + /** + * @var ?bool + */ + private $noLogging; + /** + * @var ?string */ private $printer; /** - * @var bool + * @var ?bool */ - private $messagePrinted = \false; + private $processIsolation; /** - * @var Hook[] + * @var ?int */ - private $extensions = []; + private $randomOrderSeed; /** - * @var Timer + * @var ?int */ - private $timer; - public function __construct(TestSuiteLoader $loader = null, CodeCoverageFilter $filter = null) - { - if ($filter === null) { - $filter = new CodeCoverageFilter(); - } - $this->codeCoverageFilter = $filter; - $this->loader = $loader; - $this->timer = new Timer(); - } + private $repeat; /** - * @throws \PHPUnit\Runner\Exception - * @throws \PHPUnit\TextUI\XmlConfiguration\Exception - * @throws Exception + * @var ?bool + */ + private $reportUselessTests; + /** + * @var ?bool + */ + private $resolveDependencies; + /** + * @var ?bool + */ + private $reverseList; + /** + * @var ?bool + */ + private $stderr; + /** + * @var ?bool + */ + private $strictCoverage; + /** + * @var ?bool + */ + private $stopOnDefect; + /** + * @var ?bool + */ + private $stopOnError; + /** + * @var ?bool + */ + private $stopOnFailure; + /** + * @var ?bool + */ + private $stopOnIncomplete; + /** + * @var ?bool + */ + private $stopOnRisky; + /** + * @var ?bool + */ + private $stopOnSkipped; + /** + * @var ?bool + */ + private $stopOnWarning; + /** + * @var ?string + */ + private $teamcityLogfile; + /** + * @var null|string[] + */ + private $testdoxExcludeGroups; + /** + * @var null|string[] + */ + private $testdoxGroups; + /** + * @var ?string + */ + private $testdoxHtmlFile; + /** + * @var ?string + */ + private $testdoxTextFile; + /** + * @var ?string + */ + private $testdoxXmlFile; + /** + * @var null|string[] + */ + private $testSuffixes; + /** + * @var ?string + */ + private $testSuite; + /** + * @var string[] + */ + private $unrecognizedOptions; + /** + * @var ?string + */ + private $unrecognizedOrderBy; + /** + * @var ?bool + */ + private $useDefaultConfiguration; + /** + * @var ?bool + */ + private $verbose; + /** + * @var ?bool + */ + private $version; + /** + * @var ?string + */ + private $xdebugFilterFile; + /** + * @param null|int|string $columns */ - public function run(TestSuite $suite, array $arguments = [], array $warnings = [], bool $exit = \true) : TestResult + public function __construct(?string $argument, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticAttributes, ?bool $beStrictAboutChangesToGlobalState, ?bool $beStrictAboutResourceUsageDuringSmallTests, ?string $bootstrap, ?bool $cacheResult, ?string $cacheResultFile, ?bool $checkVersion, ?string $colors, $columns, ?string $configuration, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $pathCoverage, ?string $coverageCacheDirectory, ?bool $warmCoverageCache, ?bool $debug, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $disallowTodoAnnotatedTests, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?array $extensions, ?array $unavailableExtensions, ?bool $failOnEmptyTestSuite, ?bool $failOnIncomplete, ?bool $failOnRisky, ?bool $failOnSkipped, ?bool $failOnWarning, ?string $filter, ?bool $generateConfiguration, ?bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, ?bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, ?bool $listGroups, ?bool $listSuites, ?bool $listTests, ?string $listTestsXml, ?string $loader, ?bool $noCoverage, ?bool $noExtensions, ?bool $noInteraction, ?bool $noLogging, ?string $printer, ?bool $processIsolation, ?int $randomOrderSeed, ?int $repeat, ?bool $reportUselessTests, ?bool $resolveDependencies, ?bool $reverseList, ?bool $stderr, ?bool $strictCoverage, ?bool $stopOnDefect, ?bool $stopOnError, ?bool $stopOnFailure, ?bool $stopOnIncomplete, ?bool $stopOnRisky, ?bool $stopOnSkipped, ?bool $stopOnWarning, ?string $teamcityLogfile, ?array $testdoxExcludeGroups, ?array $testdoxGroups, ?string $testdoxHtmlFile, ?string $testdoxTextFile, ?string $testdoxXmlFile, ?array $testSuffixes, ?string $testSuite, array $unrecognizedOptions, ?string $unrecognizedOrderBy, ?bool $useDefaultConfiguration, ?bool $verbose, ?bool $version, ?array $coverageFilter, ?string $xdebugFilterFile) { - if (isset($arguments['configuration'])) { - $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration']; - } - $this->handleConfiguration($arguments); - $warnings = array_merge($warnings, $arguments['warnings']); - if (is_int($arguments['columns']) && $arguments['columns'] < 16) { - $arguments['columns'] = 16; - $tooFewColumnsRequested = \true; - } - if (isset($arguments['bootstrap'])) { - $GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap']; - } - if ($arguments['backupGlobals'] === \true) { - $suite->setBackupGlobals(\true); - } - if ($arguments['backupStaticAttributes'] === \true) { - $suite->setBackupStaticAttributes(\true); - } - if ($arguments['beStrictAboutChangesToGlobalState'] === \true) { - $suite->setBeStrictAboutChangesToGlobalState(\true); - } - if ($arguments['executionOrder'] === TestSuiteSorter::ORDER_RANDOMIZED) { - mt_srand($arguments['randomOrderSeed']); - } - if ($arguments['cacheResult']) { - if (!isset($arguments['cacheResultFile'])) { - if (isset($arguments['configurationObject'])) { - assert($arguments['configurationObject'] instanceof Configuration); - $cacheLocation = $arguments['configurationObject']->filename(); - } else { - $cacheLocation = $_SERVER['PHP_SELF']; - } - $arguments['cacheResultFile'] = null; - $cacheResultFile = realpath($cacheLocation); - if ($cacheResultFile !== \false) { - $arguments['cacheResultFile'] = dirname($cacheResultFile); - } - } - $cache = new DefaultTestResultCache($arguments['cacheResultFile']); - $this->addExtension(new ResultCacheExtension($cache)); - } - if ($arguments['executionOrder'] !== TestSuiteSorter::ORDER_DEFAULT || $arguments['executionOrderDefects'] !== TestSuiteSorter::ORDER_DEFAULT || $arguments['resolveDependencies']) { - $cache = $cache ?? new NullTestResultCache(); - $cache->load(); - $sorter = new TestSuiteSorter($cache); - $sorter->reorderTestsInSuite($suite, $arguments['executionOrder'], $arguments['resolveDependencies'], $arguments['executionOrderDefects']); - $originalExecutionOrder = $sorter->getOriginalExecutionOrder(); - unset($sorter); - } - if (is_int($arguments['repeat']) && $arguments['repeat'] > 0) { - $_suite = new TestSuite(); - /* @noinspection PhpUnusedLocalVariableInspection */ - foreach (range(1, $arguments['repeat']) as $step) { - $_suite->addTest($suite); - } - $suite = $_suite; - unset($_suite); - } - $result = $this->createTestResult(); - $listener = new TestListenerAdapter(); - $listenerNeeded = \false; - foreach ($this->extensions as $extension) { - if ($extension instanceof TestHook) { - $listener->add($extension); - $listenerNeeded = \true; - } + $this->argument = $argument; + $this->atLeastVersion = $atLeastVersion; + $this->backupGlobals = $backupGlobals; + $this->backupStaticAttributes = $backupStaticAttributes; + $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + $this->beStrictAboutResourceUsageDuringSmallTests = $beStrictAboutResourceUsageDuringSmallTests; + $this->bootstrap = $bootstrap; + $this->cacheResult = $cacheResult; + $this->cacheResultFile = $cacheResultFile; + $this->checkVersion = $checkVersion; + $this->colors = $colors; + $this->columns = $columns; + $this->configuration = $configuration; + $this->coverageFilter = $coverageFilter; + $this->coverageClover = $coverageClover; + $this->coverageCobertura = $coverageCobertura; + $this->coverageCrap4J = $coverageCrap4J; + $this->coverageHtml = $coverageHtml; + $this->coveragePhp = $coveragePhp; + $this->coverageText = $coverageText; + $this->coverageTextShowUncoveredFiles = $coverageTextShowUncoveredFiles; + $this->coverageTextShowOnlySummary = $coverageTextShowOnlySummary; + $this->coverageXml = $coverageXml; + $this->pathCoverage = $pathCoverage; + $this->coverageCacheDirectory = $coverageCacheDirectory; + $this->warmCoverageCache = $warmCoverageCache; + $this->debug = $debug; + $this->defaultTimeLimit = $defaultTimeLimit; + $this->disableCodeCoverageIgnore = $disableCodeCoverageIgnore; + $this->disallowTestOutput = $disallowTestOutput; + $this->disallowTodoAnnotatedTests = $disallowTodoAnnotatedTests; + $this->enforceTimeLimit = $enforceTimeLimit; + $this->excludeGroups = $excludeGroups; + $this->executionOrder = $executionOrder; + $this->executionOrderDefects = $executionOrderDefects; + $this->extensions = $extensions; + $this->unavailableExtensions = $unavailableExtensions; + $this->failOnEmptyTestSuite = $failOnEmptyTestSuite; + $this->failOnIncomplete = $failOnIncomplete; + $this->failOnRisky = $failOnRisky; + $this->failOnSkipped = $failOnSkipped; + $this->failOnWarning = $failOnWarning; + $this->filter = $filter; + $this->generateConfiguration = $generateConfiguration; + $this->migrateConfiguration = $migrateConfiguration; + $this->groups = $groups; + $this->testsCovering = $testsCovering; + $this->testsUsing = $testsUsing; + $this->help = $help; + $this->includePath = $includePath; + $this->iniSettings = $iniSettings; + $this->junitLogfile = $junitLogfile; + $this->listGroups = $listGroups; + $this->listSuites = $listSuites; + $this->listTests = $listTests; + $this->listTestsXml = $listTestsXml; + $this->loader = $loader; + $this->noCoverage = $noCoverage; + $this->noExtensions = $noExtensions; + $this->noInteraction = $noInteraction; + $this->noLogging = $noLogging; + $this->printer = $printer; + $this->processIsolation = $processIsolation; + $this->randomOrderSeed = $randomOrderSeed; + $this->repeat = $repeat; + $this->reportUselessTests = $reportUselessTests; + $this->resolveDependencies = $resolveDependencies; + $this->reverseList = $reverseList; + $this->stderr = $stderr; + $this->strictCoverage = $strictCoverage; + $this->stopOnDefect = $stopOnDefect; + $this->stopOnError = $stopOnError; + $this->stopOnFailure = $stopOnFailure; + $this->stopOnIncomplete = $stopOnIncomplete; + $this->stopOnRisky = $stopOnRisky; + $this->stopOnSkipped = $stopOnSkipped; + $this->stopOnWarning = $stopOnWarning; + $this->teamcityLogfile = $teamcityLogfile; + $this->testdoxExcludeGroups = $testdoxExcludeGroups; + $this->testdoxGroups = $testdoxGroups; + $this->testdoxHtmlFile = $testdoxHtmlFile; + $this->testdoxTextFile = $testdoxTextFile; + $this->testdoxXmlFile = $testdoxXmlFile; + $this->testSuffixes = $testSuffixes; + $this->testSuite = $testSuite; + $this->unrecognizedOptions = $unrecognizedOptions; + $this->unrecognizedOrderBy = $unrecognizedOrderBy; + $this->useDefaultConfiguration = $useDefaultConfiguration; + $this->verbose = $verbose; + $this->version = $version; + $this->xdebugFilterFile = $xdebugFilterFile; + } + public function hasArgument(): bool + { + return $this->argument !== null; + } + /** + * @throws Exception + */ + public function argument(): string + { + if ($this->argument === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($listenerNeeded) { - $result->addListener($listener); + return $this->argument; + } + public function hasAtLeastVersion(): bool + { + return $this->atLeastVersion !== null; + } + /** + * @throws Exception + */ + public function atLeastVersion(): string + { + if ($this->atLeastVersion === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - unset($listener, $listenerNeeded); - if ($arguments['convertDeprecationsToExceptions']) { - $result->convertDeprecationsToExceptions(\true); + return $this->atLeastVersion; + } + public function hasBackupGlobals(): bool + { + return $this->backupGlobals !== null; + } + /** + * @throws Exception + */ + public function backupGlobals(): bool + { + if ($this->backupGlobals === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (!$arguments['convertErrorsToExceptions']) { - $result->convertErrorsToExceptions(\false); + return $this->backupGlobals; + } + public function hasBackupStaticAttributes(): bool + { + return $this->backupStaticAttributes !== null; + } + /** + * @throws Exception + */ + public function backupStaticAttributes(): bool + { + if ($this->backupStaticAttributes === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (!$arguments['convertNoticesToExceptions']) { - $result->convertNoticesToExceptions(\false); + return $this->backupStaticAttributes; + } + public function hasBeStrictAboutChangesToGlobalState(): bool + { + return $this->beStrictAboutChangesToGlobalState !== null; + } + /** + * @throws Exception + */ + public function beStrictAboutChangesToGlobalState(): bool + { + if ($this->beStrictAboutChangesToGlobalState === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (!$arguments['convertWarningsToExceptions']) { - $result->convertWarningsToExceptions(\false); + return $this->beStrictAboutChangesToGlobalState; + } + public function hasBeStrictAboutResourceUsageDuringSmallTests(): bool + { + return $this->beStrictAboutResourceUsageDuringSmallTests !== null; + } + /** + * @throws Exception + */ + public function beStrictAboutResourceUsageDuringSmallTests(): bool + { + if ($this->beStrictAboutResourceUsageDuringSmallTests === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['stopOnError']) { - $result->stopOnError(\true); + return $this->beStrictAboutResourceUsageDuringSmallTests; + } + public function hasBootstrap(): bool + { + return $this->bootstrap !== null; + } + /** + * @throws Exception + */ + public function bootstrap(): string + { + if ($this->bootstrap === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['stopOnFailure']) { - $result->stopOnFailure(\true); + return $this->bootstrap; + } + public function hasCacheResult(): bool + { + return $this->cacheResult !== null; + } + /** + * @throws Exception + */ + public function cacheResult(): bool + { + if ($this->cacheResult === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['stopOnWarning']) { - $result->stopOnWarning(\true); + return $this->cacheResult; + } + public function hasCacheResultFile(): bool + { + return $this->cacheResultFile !== null; + } + /** + * @throws Exception + */ + public function cacheResultFile(): string + { + if ($this->cacheResultFile === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['stopOnIncomplete']) { - $result->stopOnIncomplete(\true); + return $this->cacheResultFile; + } + public function hasCheckVersion(): bool + { + return $this->checkVersion !== null; + } + /** + * @throws Exception + */ + public function checkVersion(): bool + { + if ($this->checkVersion === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['stopOnRisky']) { - $result->stopOnRisky(\true); + return $this->checkVersion; + } + public function hasColors(): bool + { + return $this->colors !== null; + } + /** + * @throws Exception + */ + public function colors(): string + { + if ($this->colors === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['stopOnSkipped']) { - $result->stopOnSkipped(\true); + return $this->colors; + } + public function hasColumns(): bool + { + return $this->columns !== null; + } + /** + * @throws Exception + */ + public function columns() + { + if ($this->columns === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['stopOnDefect']) { - $result->stopOnDefect(\true); + return $this->columns; + } + public function hasConfiguration(): bool + { + return $this->configuration !== null; + } + /** + * @throws Exception + */ + public function configuration(): string + { + if ($this->configuration === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['registerMockObjectsFromTestArgumentsRecursively']) { - $result->setRegisterMockObjectsFromTestArgumentsRecursively(\true); + return $this->configuration; + } + public function hasCoverageFilter(): bool + { + return $this->coverageFilter !== null; + } + /** + * @throws Exception + */ + public function coverageFilter(): array + { + if ($this->coverageFilter === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($this->printer === null) { - if (isset($arguments['printer'])) { - if ($arguments['printer'] instanceof \PHPUnit\TextUI\ResultPrinter) { - $this->printer = $arguments['printer']; - } elseif (is_string($arguments['printer']) && class_exists($arguments['printer'], \false)) { - try { - $reflector = new ReflectionClass($arguments['printer']); - if ($reflector->implementsInterface(\PHPUnit\TextUI\ResultPrinter::class)) { - $this->printer = $this->createPrinter($arguments['printer'], $arguments); - } - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - } - } else { - $this->printer = $this->createPrinter(\PHPUnit\TextUI\DefaultResultPrinter::class, $arguments); - } + return $this->coverageFilter; + } + public function hasCoverageClover(): bool + { + return $this->coverageClover !== null; + } + /** + * @throws Exception + */ + public function coverageClover(): string + { + if ($this->coverageClover === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($originalExecutionOrder) && $this->printer instanceof CliTestDoxPrinter) { - assert($this->printer instanceof CliTestDoxPrinter); - $this->printer->setOriginalExecutionOrder($originalExecutionOrder); - $this->printer->setShowProgressAnimation(!$arguments['noInteraction']); + return $this->coverageClover; + } + public function hasCoverageCobertura(): bool + { + return $this->coverageCobertura !== null; + } + /** + * @throws Exception + */ + public function coverageCobertura(): string + { + if ($this->coverageCobertura === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $this->write(Version::getVersionString() . "\n"); - foreach ($arguments['listeners'] as $listener) { - $result->addListener($listener); + return $this->coverageCobertura; + } + public function hasCoverageCrap4J(): bool + { + return $this->coverageCrap4J !== null; + } + /** + * @throws Exception + */ + public function coverageCrap4J(): string + { + if ($this->coverageCrap4J === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $result->addListener($this->printer); - $coverageFilterFromConfigurationFile = \false; - $coverageFilterFromOption = \false; - $codeCoverageReports = 0; - if (isset($arguments['testdoxHTMLFile'])) { - $result->addListener(new HtmlResultPrinter($arguments['testdoxHTMLFile'], $arguments['testdoxGroups'], $arguments['testdoxExcludeGroups'])); + return $this->coverageCrap4J; + } + public function hasCoverageHtml(): bool + { + return $this->coverageHtml !== null; + } + /** + * @throws Exception + */ + public function coverageHtml(): string + { + if ($this->coverageHtml === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['testdoxTextFile'])) { - $result->addListener(new TextResultPrinter($arguments['testdoxTextFile'], $arguments['testdoxGroups'], $arguments['testdoxExcludeGroups'])); + return $this->coverageHtml; + } + public function hasCoveragePhp(): bool + { + return $this->coveragePhp !== null; + } + /** + * @throws Exception + */ + public function coveragePhp(): string + { + if ($this->coveragePhp === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['testdoxXMLFile'])) { - $result->addListener(new XmlResultPrinter($arguments['testdoxXMLFile'])); + return $this->coveragePhp; + } + public function hasCoverageText(): bool + { + return $this->coverageText !== null; + } + /** + * @throws Exception + */ + public function coverageText(): string + { + if ($this->coverageText === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['teamcityLogfile'])) { - $result->addListener(new TeamCity($arguments['teamcityLogfile'])); + return $this->coverageText; + } + public function hasCoverageTextShowUncoveredFiles(): bool + { + return $this->coverageTextShowUncoveredFiles !== null; + } + /** + * @throws Exception + */ + public function coverageTextShowUncoveredFiles(): bool + { + if ($this->coverageTextShowUncoveredFiles === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['junitLogfile'])) { - $result->addListener(new JUnit($arguments['junitLogfile'], $arguments['reportUselessTests'])); + return $this->coverageTextShowUncoveredFiles; + } + public function hasCoverageTextShowOnlySummary(): bool + { + return $this->coverageTextShowOnlySummary !== null; + } + /** + * @throws Exception + */ + public function coverageTextShowOnlySummary(): bool + { + if ($this->coverageTextShowOnlySummary === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['coverageClover'])) { - $codeCoverageReports++; + return $this->coverageTextShowOnlySummary; + } + public function hasCoverageXml(): bool + { + return $this->coverageXml !== null; + } + /** + * @throws Exception + */ + public function coverageXml(): string + { + if ($this->coverageXml === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['coverageCobertura'])) { - $codeCoverageReports++; + return $this->coverageXml; + } + public function hasPathCoverage(): bool + { + return $this->pathCoverage !== null; + } + /** + * @throws Exception + */ + public function pathCoverage(): bool + { + if ($this->pathCoverage === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['coverageCrap4J'])) { - $codeCoverageReports++; + return $this->pathCoverage; + } + public function hasCoverageCacheDirectory(): bool + { + return $this->coverageCacheDirectory !== null; + } + /** + * @throws Exception + */ + public function coverageCacheDirectory(): string + { + if ($this->coverageCacheDirectory === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['coverageHtml'])) { - $codeCoverageReports++; + return $this->coverageCacheDirectory; + } + public function hasWarmCoverageCache(): bool + { + return $this->warmCoverageCache !== null; + } + /** + * @throws Exception + */ + public function warmCoverageCache(): bool + { + if ($this->warmCoverageCache === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['coveragePHP'])) { - $codeCoverageReports++; + return $this->warmCoverageCache; + } + public function hasDebug(): bool + { + return $this->debug !== null; + } + /** + * @throws Exception + */ + public function debug(): bool + { + if ($this->debug === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['coverageText'])) { - $codeCoverageReports++; + return $this->debug; + } + public function hasDefaultTimeLimit(): bool + { + return $this->defaultTimeLimit !== null; + } + /** + * @throws Exception + */ + public function defaultTimeLimit(): int + { + if ($this->defaultTimeLimit === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['coverageXml'])) { - $codeCoverageReports++; + return $this->defaultTimeLimit; + } + public function hasDisableCodeCoverageIgnore(): bool + { + return $this->disableCodeCoverageIgnore !== null; + } + /** + * @throws Exception + */ + public function disableCodeCoverageIgnore(): bool + { + if ($this->disableCodeCoverageIgnore === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($codeCoverageReports > 0 || isset($arguments['xdebugFilterFile'])) { - if (isset($arguments['coverageFilter'])) { - if (!is_array($arguments['coverageFilter'])) { - $coverageFilterDirectories = [$arguments['coverageFilter']]; - } else { - $coverageFilterDirectories = $arguments['coverageFilter']; - } - foreach ($coverageFilterDirectories as $coverageFilterDirectory) { - $this->codeCoverageFilter->includeDirectory($coverageFilterDirectory); - } - $coverageFilterFromOption = \true; - } - if (isset($arguments['configurationObject'])) { - assert($arguments['configurationObject'] instanceof Configuration); - $codeCoverageConfiguration = $arguments['configurationObject']->codeCoverage(); - if ($codeCoverageConfiguration->hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport()) { - $coverageFilterFromConfigurationFile = \true; - (new FilterMapper())->map($this->codeCoverageFilter, $codeCoverageConfiguration); - } - } + return $this->disableCodeCoverageIgnore; + } + public function hasDisallowTestOutput(): bool + { + return $this->disallowTestOutput !== null; + } + /** + * @throws Exception + */ + public function disallowTestOutput(): bool + { + if ($this->disallowTestOutput === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($codeCoverageReports > 0) { - try { - if (isset($codeCoverageConfiguration) && ($codeCoverageConfiguration->pathCoverage() || isset($arguments['pathCoverage']) && $arguments['pathCoverage'] === \true)) { - $codeCoverageDriver = (new Selector())->forLineAndPathCoverage($this->codeCoverageFilter); - } else { - $codeCoverageDriver = (new Selector())->forLineCoverage($this->codeCoverageFilter); - } - $codeCoverage = new CodeCoverage($codeCoverageDriver, $this->codeCoverageFilter); - if (isset($codeCoverageConfiguration) && $codeCoverageConfiguration->hasCacheDirectory()) { - $codeCoverage->cacheStaticAnalysis($codeCoverageConfiguration->cacheDirectory()->path()); - } - if (isset($arguments['coverageCacheDirectory'])) { - $codeCoverage->cacheStaticAnalysis($arguments['coverageCacheDirectory']); - } - $codeCoverage->excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck(Comparator::class); - if ($arguments['strictCoverage']) { - $codeCoverage->enableCheckForUnintentionallyCoveredCode(); - } - if (isset($arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'])) { - if ($arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage']) { - $codeCoverage->ignoreDeprecatedCode(); - } else { - $codeCoverage->doNotIgnoreDeprecatedCode(); - } - } - if (isset($arguments['disableCodeCoverageIgnore'])) { - if ($arguments['disableCodeCoverageIgnore']) { - $codeCoverage->disableAnnotationsForIgnoringCode(); - } else { - $codeCoverage->enableAnnotationsForIgnoringCode(); - } - } - if (isset($arguments['configurationObject'])) { - $codeCoverageConfiguration = $arguments['configurationObject']->codeCoverage(); - if ($codeCoverageConfiguration->hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport()) { - if ($codeCoverageConfiguration->includeUncoveredFiles()) { - $codeCoverage->includeUncoveredFiles(); - } else { - $codeCoverage->excludeUncoveredFiles(); - } - if ($codeCoverageConfiguration->processUncoveredFiles()) { - $codeCoverage->processUncoveredFiles(); - } else { - $codeCoverage->doNotProcessUncoveredFiles(); - } - } - } - if ($this->codeCoverageFilter->isEmpty()) { - if (!$coverageFilterFromConfigurationFile && !$coverageFilterFromOption) { - $warnings[] = 'No filter is configured, code coverage will not be processed'; - } else { - $warnings[] = 'Incorrect filter configuration, code coverage will not be processed'; - } - unset($codeCoverage); - } - } catch (CodeCoverageException $e) { - $warnings[] = $e->getMessage(); - } + return $this->disallowTestOutput; + } + public function hasDisallowTodoAnnotatedTests(): bool + { + return $this->disallowTodoAnnotatedTests !== null; + } + /** + * @throws Exception + */ + public function disallowTodoAnnotatedTests(): bool + { + if ($this->disallowTodoAnnotatedTests === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['verbose']) { - if (PHP_SAPI === 'phpdbg') { - $this->writeMessage('Runtime', 'PHPDBG ' . PHP_VERSION); - } else { - $runtime = 'PHP ' . PHP_VERSION; - if (isset($codeCoverageDriver)) { - $runtime .= ' with ' . $codeCoverageDriver->nameAndVersion(); - } - $this->writeMessage('Runtime', $runtime); - } - if (isset($arguments['configurationObject'])) { - assert($arguments['configurationObject'] instanceof Configuration); - $this->writeMessage('Configuration', $arguments['configurationObject']->filename()); - } - foreach ($arguments['loadedExtensions'] as $extension) { - $this->writeMessage('Extension', $extension); - } - foreach ($arguments['notLoadedExtensions'] as $extension) { - $this->writeMessage('Extension', $extension); - } + return $this->disallowTodoAnnotatedTests; + } + public function hasEnforceTimeLimit(): bool + { + return $this->enforceTimeLimit !== null; + } + /** + * @throws Exception + */ + public function enforceTimeLimit(): bool + { + if ($this->enforceTimeLimit === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($arguments['executionOrder'] === TestSuiteSorter::ORDER_RANDOMIZED) { - $this->writeMessage('Random Seed', (string) $arguments['randomOrderSeed']); + return $this->enforceTimeLimit; + } + public function hasExcludeGroups(): bool + { + return $this->excludeGroups !== null; + } + /** + * @throws Exception + */ + public function excludeGroups(): array + { + if ($this->excludeGroups === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($tooFewColumnsRequested)) { - $warnings[] = 'Less than 16 columns requested, number of columns set to 16'; + return $this->excludeGroups; + } + public function hasExecutionOrder(): bool + { + return $this->executionOrder !== null; + } + /** + * @throws Exception + */ + public function executionOrder(): int + { + if ($this->executionOrder === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ((new Runtime())->discardsComments()) { - $warnings[] = 'opcache.save_comments=0 set; annotations will not work'; + return $this->executionOrder; + } + public function hasExecutionOrderDefects(): bool + { + return $this->executionOrderDefects !== null; + } + /** + * @throws Exception + */ + public function executionOrderDefects(): int + { + if ($this->executionOrderDefects === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['conflictBetweenPrinterClassAndTestdox'])) { - $warnings[] = 'Directives printerClass and testdox are mutually exclusive'; + return $this->executionOrderDefects; + } + public function hasFailOnEmptyTestSuite(): bool + { + return $this->failOnEmptyTestSuite !== null; + } + /** + * @throws Exception + */ + public function failOnEmptyTestSuite(): bool + { + if ($this->failOnEmptyTestSuite === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $warnings = array_merge($warnings, $suite->warnings()); - sort($warnings); - foreach ($warnings as $warning) { - $this->writeMessage('Warning', $warning); + return $this->failOnEmptyTestSuite; + } + public function hasFailOnIncomplete(): bool + { + return $this->failOnIncomplete !== null; + } + /** + * @throws Exception + */ + public function failOnIncomplete(): bool + { + if ($this->failOnIncomplete === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['configurationObject'])) { - assert($arguments['configurationObject'] instanceof Configuration); - if ($arguments['configurationObject']->hasValidationErrors()) { - if ((new SchemaDetector())->detect($arguments['configurationObject']->filename())->detected()) { - $this->writeMessage('Warning', 'Your XML configuration validates against a deprecated schema.'); - $this->writeMessage('Suggestion', 'Migrate your XML configuration using "--migrate-configuration"!'); - } else { - $this->write("\n Warning - The configuration file did not pass validation!\n The following problems have been detected:\n"); - $this->write($arguments['configurationObject']->validationErrors()); - $this->write("\n Test results may not be as expected.\n\n"); - } - } + return $this->failOnIncomplete; + } + public function hasFailOnRisky(): bool + { + return $this->failOnRisky !== null; + } + /** + * @throws Exception + */ + public function failOnRisky(): bool + { + if ($this->failOnRisky === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (isset($arguments['xdebugFilterFile'], $codeCoverageConfiguration)) { - $this->write(PHP_EOL . 'Please note that --dump-xdebug-filter and --prepend are deprecated and will be removed in PHPUnit 10.' . PHP_EOL); - $script = (new XdebugFilterScriptGenerator())->generate($codeCoverageConfiguration); - if ($arguments['xdebugFilterFile'] !== 'php://stdout' && $arguments['xdebugFilterFile'] !== 'php://stderr' && !Filesystem::createDirectory(dirname($arguments['xdebugFilterFile']))) { - $this->write(sprintf('Cannot write Xdebug filter script to %s ' . PHP_EOL, $arguments['xdebugFilterFile'])); - exit(self::EXCEPTION_EXIT); - } - file_put_contents($arguments['xdebugFilterFile'], $script); - $this->write(sprintf('Wrote Xdebug filter script to %s ' . PHP_EOL . PHP_EOL, $arguments['xdebugFilterFile'])); - exit(self::SUCCESS_EXIT); + return $this->failOnRisky; + } + public function hasFailOnSkipped(): bool + { + return $this->failOnSkipped !== null; + } + /** + * @throws Exception + */ + public function failOnSkipped(): bool + { + if ($this->failOnSkipped === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $this->write("\n"); - if (isset($codeCoverage)) { - $result->setCodeCoverage($codeCoverage); + return $this->failOnSkipped; + } + public function hasFailOnWarning(): bool + { + return $this->failOnWarning !== null; + } + /** + * @throws Exception + */ + public function failOnWarning(): bool + { + if ($this->failOnWarning === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $result->beStrictAboutTestsThatDoNotTestAnything($arguments['reportUselessTests']); - $result->beStrictAboutOutputDuringTests($arguments['disallowTestOutput']); - $result->beStrictAboutTodoAnnotatedTests($arguments['disallowTodoAnnotatedTests']); - $result->beStrictAboutResourceUsageDuringSmallTests($arguments['beStrictAboutResourceUsageDuringSmallTests']); - if ($arguments['enforceTimeLimit'] === \true && !(new Invoker())->canInvokeWithTimeout()) { - $this->writeMessage('Error', 'PHP extension pcntl is required for enforcing time limits'); + return $this->failOnWarning; + } + public function hasFilter(): bool + { + return $this->filter !== null; + } + /** + * @throws Exception + */ + public function filter(): string + { + if ($this->filter === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $result->enforceTimeLimit($arguments['enforceTimeLimit']); - $result->setDefaultTimeLimit($arguments['defaultTimeLimit']); - $result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']); - $result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']); - $result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']); - if (isset($arguments['forceCoversAnnotation']) && $arguments['forceCoversAnnotation'] === \true) { - $result->forceCoversAnnotation(); + return $this->filter; + } + public function hasGenerateConfiguration(): bool + { + return $this->generateConfiguration !== null; + } + /** + * @throws Exception + */ + public function generateConfiguration(): bool + { + if ($this->generateConfiguration === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $this->processSuiteFilters($suite, $arguments); - $suite->setRunTestInSeparateProcess($arguments['processIsolation']); - foreach ($this->extensions as $extension) { - if ($extension instanceof BeforeFirstTestHook) { - $extension->executeBeforeFirstTest(); - } + return $this->generateConfiguration; + } + public function hasMigrateConfiguration(): bool + { + return $this->migrateConfiguration !== null; + } + /** + * @throws Exception + */ + public function migrateConfiguration(): bool + { + if ($this->migrateConfiguration === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $suite->run($result); - foreach ($this->extensions as $extension) { - if ($extension instanceof AfterLastTestHook) { - $extension->executeAfterLastTest(); - } + return $this->migrateConfiguration; + } + public function hasGroups(): bool + { + return $this->groups !== null; + } + /** + * @throws Exception + */ + public function groups(): array + { + if ($this->groups === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $result->flushListeners(); - $this->printer->printResult($result); - if (isset($codeCoverage)) { - if (isset($arguments['coveragePHP'])) { - $this->codeCoverageGenerationStart('PHP'); - try { - $writer = new PhpReport(); - $writer->process($codeCoverage, $arguments['coveragePHP']); - $this->codeCoverageGenerationSucceeded(); - unset($writer); - } catch (CodeCoverageException $e) { - $this->codeCoverageGenerationFailed($e); - } - } - if (isset($arguments['coverageClover'])) { - $this->codeCoverageGenerationStart('Clover XML'); - try { - $writer = new CloverReport(); - $writer->process($codeCoverage, $arguments['coverageClover']); - $this->codeCoverageGenerationSucceeded(); - unset($writer); - } catch (CodeCoverageException $e) { - $this->codeCoverageGenerationFailed($e); - } - } - if (isset($arguments['coverageCobertura'])) { - $this->codeCoverageGenerationStart('Cobertura XML'); - try { - $writer = new CoberturaReport(); - $writer->process($codeCoverage, $arguments['coverageCobertura']); - $this->codeCoverageGenerationSucceeded(); - unset($writer); - } catch (CodeCoverageException $e) { - $this->codeCoverageGenerationFailed($e); - } - } - if (isset($arguments['coverageCrap4J'])) { - $this->codeCoverageGenerationStart('Crap4J XML'); - try { - $writer = new Crap4jReport($arguments['crap4jThreshold']); - $writer->process($codeCoverage, $arguments['coverageCrap4J']); - $this->codeCoverageGenerationSucceeded(); - unset($writer); - } catch (CodeCoverageException $e) { - $this->codeCoverageGenerationFailed($e); - } - } - if (isset($arguments['coverageHtml'])) { - $this->codeCoverageGenerationStart('HTML'); - try { - $writer = new HtmlReport($arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], sprintf(' and PHPUnit %s', Version::id())); - $writer->process($codeCoverage, $arguments['coverageHtml']); - $this->codeCoverageGenerationSucceeded(); - unset($writer); - } catch (CodeCoverageException $e) { - $this->codeCoverageGenerationFailed($e); - } - } - if (isset($arguments['coverageText'])) { - if ($arguments['coverageText'] === 'php://stdout') { - $outputStream = $this->printer; - $colors = $arguments['colors'] && $arguments['colors'] !== \PHPUnit\TextUI\DefaultResultPrinter::COLOR_NEVER; - } else { - $outputStream = new Printer($arguments['coverageText']); - $colors = \false; - } - $processor = new TextReport($arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], $arguments['coverageTextShowUncoveredFiles'], $arguments['coverageTextShowOnlySummary']); - $outputStream->write($processor->process($codeCoverage, $colors)); - } - if (isset($arguments['coverageXml'])) { - $this->codeCoverageGenerationStart('PHPUnit XML'); - try { - $writer = new XmlReport(Version::id()); - $writer->process($codeCoverage, $arguments['coverageXml']); - $this->codeCoverageGenerationSucceeded(); - unset($writer); - } catch (CodeCoverageException $e) { - $this->codeCoverageGenerationFailed($e); - } - } + return $this->groups; + } + public function hasTestsCovering(): bool + { + return $this->testsCovering !== null; + } + /** + * @throws Exception + */ + public function testsCovering(): array + { + if ($this->testsCovering === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($exit) { - if (isset($arguments['failOnEmptyTestSuite']) && $arguments['failOnEmptyTestSuite'] === \true && count($result) === 0) { - exit(self::FAILURE_EXIT); - } - if ($result->wasSuccessfulIgnoringWarnings()) { - if ($arguments['failOnRisky'] && !$result->allHarmless()) { - exit(self::FAILURE_EXIT); - } - if ($arguments['failOnWarning'] && $result->warningCount() > 0) { - exit(self::FAILURE_EXIT); - } - if ($arguments['failOnIncomplete'] && $result->notImplementedCount() > 0) { - exit(self::FAILURE_EXIT); - } - if ($arguments['failOnSkipped'] && $result->skippedCount() > 0) { - exit(self::FAILURE_EXIT); - } - exit(self::SUCCESS_EXIT); - } - if ($result->errorCount() > 0) { - exit(self::EXCEPTION_EXIT); - } - if ($result->failureCount() > 0) { - exit(self::FAILURE_EXIT); - } + return $this->testsCovering; + } + public function hasTestsUsing(): bool + { + return $this->testsUsing !== null; + } + /** + * @throws Exception + */ + public function testsUsing(): array + { + if ($this->testsUsing === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $result; + return $this->testsUsing; + } + public function hasHelp(): bool + { + return $this->help !== null; } /** - * Returns the loader to be used. + * @throws Exception */ - public function getLoader() : TestSuiteLoader + public function help(): bool { - if ($this->loader === null) { - $this->loader = new StandardTestSuiteLoader(); + if ($this->help === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->loader; + return $this->help; } - public function addExtension(Hook $extension) : void + public function hasIncludePath(): bool { - $this->extensions[] = $extension; + return $this->includePath !== null; } /** - * Override to define how to handle a failed loading of - * a test suite. + * @throws Exception */ - protected function runFailed(string $message) : void + public function includePath(): string { - $this->write($message . PHP_EOL); - exit(self::FAILURE_EXIT); + if ($this->includePath === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->includePath; } - private function createTestResult() : TestResult + public function hasIniSettings(): bool { - return new TestResult(); + return $this->iniSettings !== null; } - private function write(string $buffer) : void + /** + * @throws Exception + */ + public function iniSettings(): array { - if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { - $buffer = htmlspecialchars($buffer); + if ($this->iniSettings === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if ($this->printer !== null) { - $this->printer->write($buffer); - } else { - print $buffer; + return $this->iniSettings; + } + public function hasJunitLogfile(): bool + { + return $this->junitLogfile !== null; + } + /** + * @throws Exception + */ + public function junitLogfile(): string + { + if ($this->junitLogfile === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } + return $this->junitLogfile; + } + public function hasListGroups(): bool + { + return $this->listGroups !== null; } /** - * @throws \PHPUnit\TextUI\XmlConfiguration\Exception * @throws Exception */ - private function handleConfiguration(array &$arguments) : void + public function listGroups(): bool { - if (!isset($arguments['configurationObject']) && isset($arguments['configuration'])) { - $arguments['configurationObject'] = (new Loader())->load($arguments['configuration']); + if ($this->listGroups === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - if (!isset($arguments['warnings'])) { - $arguments['warnings'] = []; - } - $arguments['debug'] = $arguments['debug'] ?? \false; - $arguments['filter'] = $arguments['filter'] ?? \false; - $arguments['listeners'] = $arguments['listeners'] ?? []; - if (isset($arguments['configurationObject'])) { - (new PhpHandler())->handle($arguments['configurationObject']->php()); - $codeCoverageConfiguration = $arguments['configurationObject']->codeCoverage(); - if (!isset($arguments['noCoverage'])) { - if (!isset($arguments['coverageClover']) && $codeCoverageConfiguration->hasClover()) { - $arguments['coverageClover'] = $codeCoverageConfiguration->clover()->target()->path(); - } - if (!isset($arguments['coverageCobertura']) && $codeCoverageConfiguration->hasCobertura()) { - $arguments['coverageCobertura'] = $codeCoverageConfiguration->cobertura()->target()->path(); - } - if (!isset($arguments['coverageCrap4J']) && $codeCoverageConfiguration->hasCrap4j()) { - $arguments['coverageCrap4J'] = $codeCoverageConfiguration->crap4j()->target()->path(); - if (!isset($arguments['crap4jThreshold'])) { - $arguments['crap4jThreshold'] = $codeCoverageConfiguration->crap4j()->threshold(); - } - } - if (!isset($arguments['coverageHtml']) && $codeCoverageConfiguration->hasHtml()) { - $arguments['coverageHtml'] = $codeCoverageConfiguration->html()->target()->path(); - if (!isset($arguments['reportLowUpperBound'])) { - $arguments['reportLowUpperBound'] = $codeCoverageConfiguration->html()->lowUpperBound(); - } - if (!isset($arguments['reportHighLowerBound'])) { - $arguments['reportHighLowerBound'] = $codeCoverageConfiguration->html()->highLowerBound(); - } - } - if (!isset($arguments['coveragePHP']) && $codeCoverageConfiguration->hasPhp()) { - $arguments['coveragePHP'] = $codeCoverageConfiguration->php()->target()->path(); - } - if (!isset($arguments['coverageText']) && $codeCoverageConfiguration->hasText()) { - $arguments['coverageText'] = $codeCoverageConfiguration->text()->target()->path(); - $arguments['coverageTextShowUncoveredFiles'] = $codeCoverageConfiguration->text()->showUncoveredFiles(); - $arguments['coverageTextShowOnlySummary'] = $codeCoverageConfiguration->text()->showOnlySummary(); - } - if (!isset($arguments['coverageXml']) && $codeCoverageConfiguration->hasXml()) { - $arguments['coverageXml'] = $codeCoverageConfiguration->xml()->target()->path(); - } - } - $phpunitConfiguration = $arguments['configurationObject']->phpunit(); - $arguments['backupGlobals'] = $arguments['backupGlobals'] ?? $phpunitConfiguration->backupGlobals(); - $arguments['backupStaticAttributes'] = $arguments['backupStaticAttributes'] ?? $phpunitConfiguration->backupStaticAttributes(); - $arguments['beStrictAboutChangesToGlobalState'] = $arguments['beStrictAboutChangesToGlobalState'] ?? $phpunitConfiguration->beStrictAboutChangesToGlobalState(); - $arguments['cacheResult'] = $arguments['cacheResult'] ?? $phpunitConfiguration->cacheResult(); - $arguments['colors'] = $arguments['colors'] ?? $phpunitConfiguration->colors(); - $arguments['convertDeprecationsToExceptions'] = $arguments['convertDeprecationsToExceptions'] ?? $phpunitConfiguration->convertDeprecationsToExceptions(); - $arguments['convertErrorsToExceptions'] = $arguments['convertErrorsToExceptions'] ?? $phpunitConfiguration->convertErrorsToExceptions(); - $arguments['convertNoticesToExceptions'] = $arguments['convertNoticesToExceptions'] ?? $phpunitConfiguration->convertNoticesToExceptions(); - $arguments['convertWarningsToExceptions'] = $arguments['convertWarningsToExceptions'] ?? $phpunitConfiguration->convertWarningsToExceptions(); - $arguments['processIsolation'] = $arguments['processIsolation'] ?? $phpunitConfiguration->processIsolation(); - $arguments['stopOnDefect'] = $arguments['stopOnDefect'] ?? $phpunitConfiguration->stopOnDefect(); - $arguments['stopOnError'] = $arguments['stopOnError'] ?? $phpunitConfiguration->stopOnError(); - $arguments['stopOnFailure'] = $arguments['stopOnFailure'] ?? $phpunitConfiguration->stopOnFailure(); - $arguments['stopOnWarning'] = $arguments['stopOnWarning'] ?? $phpunitConfiguration->stopOnWarning(); - $arguments['stopOnIncomplete'] = $arguments['stopOnIncomplete'] ?? $phpunitConfiguration->stopOnIncomplete(); - $arguments['stopOnRisky'] = $arguments['stopOnRisky'] ?? $phpunitConfiguration->stopOnRisky(); - $arguments['stopOnSkipped'] = $arguments['stopOnSkipped'] ?? $phpunitConfiguration->stopOnSkipped(); - $arguments['failOnEmptyTestSuite'] = $arguments['failOnEmptyTestSuite'] ?? $phpunitConfiguration->failOnEmptyTestSuite(); - $arguments['failOnIncomplete'] = $arguments['failOnIncomplete'] ?? $phpunitConfiguration->failOnIncomplete(); - $arguments['failOnRisky'] = $arguments['failOnRisky'] ?? $phpunitConfiguration->failOnRisky(); - $arguments['failOnSkipped'] = $arguments['failOnSkipped'] ?? $phpunitConfiguration->failOnSkipped(); - $arguments['failOnWarning'] = $arguments['failOnWarning'] ?? $phpunitConfiguration->failOnWarning(); - $arguments['enforceTimeLimit'] = $arguments['enforceTimeLimit'] ?? $phpunitConfiguration->enforceTimeLimit(); - $arguments['defaultTimeLimit'] = $arguments['defaultTimeLimit'] ?? $phpunitConfiguration->defaultTimeLimit(); - $arguments['timeoutForSmallTests'] = $arguments['timeoutForSmallTests'] ?? $phpunitConfiguration->timeoutForSmallTests(); - $arguments['timeoutForMediumTests'] = $arguments['timeoutForMediumTests'] ?? $phpunitConfiguration->timeoutForMediumTests(); - $arguments['timeoutForLargeTests'] = $arguments['timeoutForLargeTests'] ?? $phpunitConfiguration->timeoutForLargeTests(); - $arguments['reportUselessTests'] = $arguments['reportUselessTests'] ?? $phpunitConfiguration->beStrictAboutTestsThatDoNotTestAnything(); - $arguments['strictCoverage'] = $arguments['strictCoverage'] ?? $phpunitConfiguration->beStrictAboutCoversAnnotation(); - $arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'] = $arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'] ?? $codeCoverageConfiguration->ignoreDeprecatedCodeUnits(); - $arguments['disallowTestOutput'] = $arguments['disallowTestOutput'] ?? $phpunitConfiguration->beStrictAboutOutputDuringTests(); - $arguments['disallowTodoAnnotatedTests'] = $arguments['disallowTodoAnnotatedTests'] ?? $phpunitConfiguration->beStrictAboutTodoAnnotatedTests(); - $arguments['beStrictAboutResourceUsageDuringSmallTests'] = $arguments['beStrictAboutResourceUsageDuringSmallTests'] ?? $phpunitConfiguration->beStrictAboutResourceUsageDuringSmallTests(); - $arguments['verbose'] = $arguments['verbose'] ?? $phpunitConfiguration->verbose(); - $arguments['reverseDefectList'] = $arguments['reverseDefectList'] ?? $phpunitConfiguration->reverseDefectList(); - $arguments['forceCoversAnnotation'] = $arguments['forceCoversAnnotation'] ?? $phpunitConfiguration->forceCoversAnnotation(); - $arguments['disableCodeCoverageIgnore'] = $arguments['disableCodeCoverageIgnore'] ?? $codeCoverageConfiguration->disableCodeCoverageIgnore(); - $arguments['registerMockObjectsFromTestArgumentsRecursively'] = $arguments['registerMockObjectsFromTestArgumentsRecursively'] ?? $phpunitConfiguration->registerMockObjectsFromTestArgumentsRecursively(); - $arguments['noInteraction'] = $arguments['noInteraction'] ?? $phpunitConfiguration->noInteraction(); - $arguments['executionOrder'] = $arguments['executionOrder'] ?? $phpunitConfiguration->executionOrder(); - $arguments['resolveDependencies'] = $arguments['resolveDependencies'] ?? $phpunitConfiguration->resolveDependencies(); - if (!isset($arguments['bootstrap']) && $phpunitConfiguration->hasBootstrap()) { - $arguments['bootstrap'] = $phpunitConfiguration->bootstrap(); - } - if (!isset($arguments['cacheResultFile']) && $phpunitConfiguration->hasCacheResultFile()) { - $arguments['cacheResultFile'] = $phpunitConfiguration->cacheResultFile(); - } - if (!isset($arguments['executionOrderDefects'])) { - $arguments['executionOrderDefects'] = $phpunitConfiguration->defectsFirst() ? TestSuiteSorter::ORDER_DEFECTS_FIRST : TestSuiteSorter::ORDER_DEFAULT; - } - if ($phpunitConfiguration->conflictBetweenPrinterClassAndTestdox()) { - $arguments['conflictBetweenPrinterClassAndTestdox'] = \true; - } - $groupCliArgs = []; - if (!empty($arguments['groups'])) { - $groupCliArgs = $arguments['groups']; - } - $groupConfiguration = $arguments['configurationObject']->groups(); - if (!isset($arguments['groups']) && $groupConfiguration->hasInclude()) { - $arguments['groups'] = $groupConfiguration->include()->asArrayOfStrings(); - } - if (!isset($arguments['excludeGroups']) && $groupConfiguration->hasExclude()) { - $arguments['excludeGroups'] = array_diff($groupConfiguration->exclude()->asArrayOfStrings(), $groupCliArgs); - } - if (!isset($this->arguments['noExtensions'])) { - $extensionHandler = new ExtensionHandler(); - foreach ($arguments['configurationObject']->extensions() as $extension) { - $extensionHandler->registerExtension($extension, $this); - } - foreach ($arguments['configurationObject']->listeners() as $listener) { - $arguments['listeners'][] = $extensionHandler->createTestListenerInstance($listener); - } - unset($extensionHandler); - } - foreach ($arguments['unavailableExtensions'] as $extension) { - $arguments['warnings'][] = sprintf('Extension "%s" is not available', $extension); - } - $loggingConfiguration = $arguments['configurationObject']->logging(); - if (!isset($arguments['noLogging'])) { - if ($loggingConfiguration->hasText()) { - $arguments['listeners'][] = new \PHPUnit\TextUI\DefaultResultPrinter($loggingConfiguration->text()->target()->path(), \true); - } - if (!isset($arguments['teamcityLogfile']) && $loggingConfiguration->hasTeamCity()) { - $arguments['teamcityLogfile'] = $loggingConfiguration->teamCity()->target()->path(); - } - if (!isset($arguments['junitLogfile']) && $loggingConfiguration->hasJunit()) { - $arguments['junitLogfile'] = $loggingConfiguration->junit()->target()->path(); - } - if (!isset($arguments['testdoxHTMLFile']) && $loggingConfiguration->hasTestDoxHtml()) { - $arguments['testdoxHTMLFile'] = $loggingConfiguration->testDoxHtml()->target()->path(); - } - if (!isset($arguments['testdoxTextFile']) && $loggingConfiguration->hasTestDoxText()) { - $arguments['testdoxTextFile'] = $loggingConfiguration->testDoxText()->target()->path(); - } - if (!isset($arguments['testdoxXMLFile']) && $loggingConfiguration->hasTestDoxXml()) { - $arguments['testdoxXMLFile'] = $loggingConfiguration->testDoxXml()->target()->path(); - } - } - $testdoxGroupConfiguration = $arguments['configurationObject']->testdoxGroups(); - if (!isset($arguments['testdoxGroups']) && $testdoxGroupConfiguration->hasInclude()) { - $arguments['testdoxGroups'] = $testdoxGroupConfiguration->include()->asArrayOfStrings(); - } - if (!isset($arguments['testdoxExcludeGroups']) && $testdoxGroupConfiguration->hasExclude()) { - $arguments['testdoxExcludeGroups'] = $testdoxGroupConfiguration->exclude()->asArrayOfStrings(); - } - } - $extensionHandler = new ExtensionHandler(); - foreach ($arguments['extensions'] as $extension) { - $extensionHandler->registerExtension($extension, $this); - } - unset($extensionHandler); - $arguments['backupGlobals'] = $arguments['backupGlobals'] ?? null; - $arguments['backupStaticAttributes'] = $arguments['backupStaticAttributes'] ?? null; - $arguments['beStrictAboutChangesToGlobalState'] = $arguments['beStrictAboutChangesToGlobalState'] ?? null; - $arguments['beStrictAboutResourceUsageDuringSmallTests'] = $arguments['beStrictAboutResourceUsageDuringSmallTests'] ?? \false; - $arguments['cacheResult'] = $arguments['cacheResult'] ?? \true; - $arguments['colors'] = $arguments['colors'] ?? \PHPUnit\TextUI\DefaultResultPrinter::COLOR_DEFAULT; - $arguments['columns'] = $arguments['columns'] ?? 80; - $arguments['convertDeprecationsToExceptions'] = $arguments['convertDeprecationsToExceptions'] ?? \false; - $arguments['convertErrorsToExceptions'] = $arguments['convertErrorsToExceptions'] ?? \true; - $arguments['convertNoticesToExceptions'] = $arguments['convertNoticesToExceptions'] ?? \true; - $arguments['convertWarningsToExceptions'] = $arguments['convertWarningsToExceptions'] ?? \true; - $arguments['crap4jThreshold'] = $arguments['crap4jThreshold'] ?? 30; - $arguments['disallowTestOutput'] = $arguments['disallowTestOutput'] ?? \false; - $arguments['disallowTodoAnnotatedTests'] = $arguments['disallowTodoAnnotatedTests'] ?? \false; - $arguments['defaultTimeLimit'] = $arguments['defaultTimeLimit'] ?? 0; - $arguments['enforceTimeLimit'] = $arguments['enforceTimeLimit'] ?? \false; - $arguments['excludeGroups'] = $arguments['excludeGroups'] ?? []; - $arguments['executionOrder'] = $arguments['executionOrder'] ?? TestSuiteSorter::ORDER_DEFAULT; - $arguments['executionOrderDefects'] = $arguments['executionOrderDefects'] ?? TestSuiteSorter::ORDER_DEFAULT; - $arguments['failOnIncomplete'] = $arguments['failOnIncomplete'] ?? \false; - $arguments['failOnRisky'] = $arguments['failOnRisky'] ?? \false; - $arguments['failOnSkipped'] = $arguments['failOnSkipped'] ?? \false; - $arguments['failOnWarning'] = $arguments['failOnWarning'] ?? \false; - $arguments['groups'] = $arguments['groups'] ?? []; - $arguments['noInteraction'] = $arguments['noInteraction'] ?? \false; - $arguments['processIsolation'] = $arguments['processIsolation'] ?? \false; - $arguments['randomOrderSeed'] = $arguments['randomOrderSeed'] ?? time(); - $arguments['registerMockObjectsFromTestArgumentsRecursively'] = $arguments['registerMockObjectsFromTestArgumentsRecursively'] ?? \false; - $arguments['repeat'] = $arguments['repeat'] ?? \false; - $arguments['reportHighLowerBound'] = $arguments['reportHighLowerBound'] ?? 90; - $arguments['reportLowUpperBound'] = $arguments['reportLowUpperBound'] ?? 50; - $arguments['reportUselessTests'] = $arguments['reportUselessTests'] ?? \true; - $arguments['reverseList'] = $arguments['reverseList'] ?? \false; - $arguments['resolveDependencies'] = $arguments['resolveDependencies'] ?? \true; - $arguments['stopOnError'] = $arguments['stopOnError'] ?? \false; - $arguments['stopOnFailure'] = $arguments['stopOnFailure'] ?? \false; - $arguments['stopOnIncomplete'] = $arguments['stopOnIncomplete'] ?? \false; - $arguments['stopOnRisky'] = $arguments['stopOnRisky'] ?? \false; - $arguments['stopOnSkipped'] = $arguments['stopOnSkipped'] ?? \false; - $arguments['stopOnWarning'] = $arguments['stopOnWarning'] ?? \false; - $arguments['stopOnDefect'] = $arguments['stopOnDefect'] ?? \false; - $arguments['strictCoverage'] = $arguments['strictCoverage'] ?? \false; - $arguments['testdoxExcludeGroups'] = $arguments['testdoxExcludeGroups'] ?? []; - $arguments['testdoxGroups'] = $arguments['testdoxGroups'] ?? []; - $arguments['timeoutForLargeTests'] = $arguments['timeoutForLargeTests'] ?? 60; - $arguments['timeoutForMediumTests'] = $arguments['timeoutForMediumTests'] ?? 10; - $arguments['timeoutForSmallTests'] = $arguments['timeoutForSmallTests'] ?? 1; - $arguments['verbose'] = $arguments['verbose'] ?? \false; - if ($arguments['reportLowUpperBound'] > $arguments['reportHighLowerBound']) { - $arguments['reportLowUpperBound'] = 50; - $arguments['reportHighLowerBound'] = 90; + return $this->listGroups; + } + public function hasListSuites(): bool + { + return $this->listSuites !== null; + } + /** + * @throws Exception + */ + public function listSuites(): bool + { + if ($this->listSuites === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } + return $this->listSuites; } - private function processSuiteFilters(TestSuite $suite, array $arguments) : void + public function hasListTests(): bool { - if (!$arguments['filter'] && empty($arguments['groups']) && empty($arguments['excludeGroups']) && empty($arguments['testsCovering']) && empty($arguments['testsUsing'])) { - return; - } - $filterFactory = new Factory(); - if (!empty($arguments['excludeGroups'])) { - $filterFactory->addFilter(new ReflectionClass(ExcludeGroupFilterIterator::class), $arguments['excludeGroups']); - } - if (!empty($arguments['groups'])) { - $filterFactory->addFilter(new ReflectionClass(IncludeGroupFilterIterator::class), $arguments['groups']); - } - if (!empty($arguments['testsCovering'])) { - $filterFactory->addFilter(new ReflectionClass(IncludeGroupFilterIterator::class), array_map(static function (string $name) : string { - return '__phpunit_covers_' . $name; - }, $arguments['testsCovering'])); - } - if (!empty($arguments['testsUsing'])) { - $filterFactory->addFilter(new ReflectionClass(IncludeGroupFilterIterator::class), array_map(static function (string $name) : string { - return '__phpunit_uses_' . $name; - }, $arguments['testsUsing'])); - } - if ($arguments['filter']) { - $filterFactory->addFilter(new ReflectionClass(NameFilterIterator::class), $arguments['filter']); - } - $suite->injectFilter($filterFactory); + return $this->listTests !== null; } - private function writeMessage(string $type, string $message) : void + /** + * @throws Exception + */ + public function listTests(): bool { - if (!$this->messagePrinted) { - $this->write("\n"); + if ($this->listTests === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - $this->write(sprintf("%-15s%s\n", $type . ':', $message)); - $this->messagePrinted = \true; - } - private function createPrinter(string $class, array $arguments) : \PHPUnit\TextUI\ResultPrinter - { - $object = new $class(isset($arguments['stderr']) && $arguments['stderr'] === \true ? 'php://stderr' : null, $arguments['verbose'], $arguments['colors'], $arguments['debug'], $arguments['columns'], $arguments['reverseList']); - assert($object instanceof \PHPUnit\TextUI\ResultPrinter); - return $object; + return $this->listTests; } - private function codeCoverageGenerationStart(string $format) : void + public function hasListTestsXml(): bool { - $this->write(sprintf("\nGenerating code coverage report in %s format ... ", $format)); - $this->timer->start(); + return $this->listTestsXml !== null; } - private function codeCoverageGenerationSucceeded() : void + /** + * @throws Exception + */ + public function listTestsXml(): string { - $this->write(sprintf("done [%s]\n", $this->timer->stop()->asString())); + if ($this->listTestsXml === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->listTestsXml; } - private function codeCoverageGenerationFailed(\Exception $e) : void + public function hasLoader(): bool { - $this->write(sprintf("failed [%s]\n%s\n", $this->timer->stop()->asString(), $e->getMessage())); + return $this->loader !== null; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI; - -use const PHP_VERSION; -use function explode; -use function in_array; -use function is_dir; -use function is_file; -use function strpos; -use function version_compare; -use PHPUnit\Framework\Exception as FrameworkException; -use PHPUnit\Framework\TestSuite as TestSuiteObject; -use PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection; -use PHPUnit\SebastianBergmann\FileIterator\Facade; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class TestSuiteMapper -{ /** - * @throws RuntimeException - * @throws TestDirectoryNotFoundException - * @throws TestFileNotFoundException + * @throws Exception */ - public function map(TestSuiteCollection $configuration, string $filter) : TestSuiteObject + public function loader(): string { - try { - $filterAsArray = $filter ? explode(',', $filter) : []; - $result = new TestSuiteObject(); - foreach ($configuration as $testSuiteConfiguration) { - if (!empty($filterAsArray) && !in_array($testSuiteConfiguration->name(), $filterAsArray, \true)) { - continue; - } - $testSuite = new TestSuiteObject($testSuiteConfiguration->name()); - $testSuiteEmpty = \true; - $exclude = []; - foreach ($testSuiteConfiguration->exclude()->asArray() as $file) { - $exclude[] = $file->path(); - } - foreach ($testSuiteConfiguration->directories() as $directory) { - if (!version_compare(PHP_VERSION, $directory->phpVersion(), $directory->phpVersionOperator()->asString())) { - continue; - } - $files = (new Facade())->getFilesAsArray($directory->path(), $directory->suffix(), $directory->prefix(), $exclude); - if (!empty($files)) { - $testSuite->addTestFiles($files); - $testSuiteEmpty = \false; - } elseif (strpos($directory->path(), '*') === \false && !is_dir($directory->path())) { - throw new \PHPUnit\TextUI\TestDirectoryNotFoundException($directory->path()); - } - } - foreach ($testSuiteConfiguration->files() as $file) { - if (!is_file($file->path())) { - throw new \PHPUnit\TextUI\TestFileNotFoundException($file->path()); - } - if (!version_compare(PHP_VERSION, $file->phpVersion(), $file->phpVersionOperator()->asString())) { - continue; - } - $testSuite->addTestFile($file->path()); - $testSuiteEmpty = \false; - } - if (!$testSuiteEmpty) { - $result->addTest($testSuite); - } - } - return $result; - } catch (FrameworkException $e) { - throw new \PHPUnit\TextUI\RuntimeException($e->getMessage(), $e->getCode(), $e); + if ($this->loader === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } + return $this->loader; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage; - -use function count; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\DirectoryCollection; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Clover; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Cobertura; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Crap4j; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Html; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Php; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Text; -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report\Xml; -use PHPUnit\TextUI\XmlConfiguration\Directory; -use PHPUnit\TextUI\XmlConfiguration\Exception; -use PHPUnit\TextUI\XmlConfiguration\FileCollection; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class CodeCoverage -{ - /** - * @var ?Directory - */ - private $cacheDirectory; - /** - * @var DirectoryCollection - */ - private $directories; - /** - * @var FileCollection - */ - private $files; - /** - * @var DirectoryCollection - */ - private $excludeDirectories; - /** - * @var FileCollection - */ - private $excludeFiles; - /** - * @var bool - */ - private $pathCoverage; - /** - * @var bool - */ - private $includeUncoveredFiles; - /** - * @var bool - */ - private $processUncoveredFiles; - /** - * @var bool - */ - private $ignoreDeprecatedCodeUnits; - /** - * @var bool - */ - private $disableCodeCoverageIgnore; - /** - * @var ?Clover - */ - private $clover; - /** - * @var ?Cobertura - */ - private $cobertura; - /** - * @var ?Crap4j - */ - private $crap4j; - /** - * @var ?Html - */ - private $html; - /** - * @var ?Php - */ - private $php; - /** - * @var ?Text - */ - private $text; - /** - * @var ?Xml - */ - private $xml; - public function __construct(?Directory $cacheDirectory, DirectoryCollection $directories, FileCollection $files, DirectoryCollection $excludeDirectories, FileCollection $excludeFiles, bool $pathCoverage, bool $includeUncoveredFiles, bool $processUncoveredFiles, bool $ignoreDeprecatedCodeUnits, bool $disableCodeCoverageIgnore, ?Clover $clover, ?Cobertura $cobertura, ?Crap4j $crap4j, ?Html $html, ?Php $php, ?Text $text, ?Xml $xml) + public function hasNoCoverage(): bool { - $this->cacheDirectory = $cacheDirectory; - $this->directories = $directories; - $this->files = $files; - $this->excludeDirectories = $excludeDirectories; - $this->excludeFiles = $excludeFiles; - $this->pathCoverage = $pathCoverage; - $this->includeUncoveredFiles = $includeUncoveredFiles; - $this->processUncoveredFiles = $processUncoveredFiles; - $this->ignoreDeprecatedCodeUnits = $ignoreDeprecatedCodeUnits; - $this->disableCodeCoverageIgnore = $disableCodeCoverageIgnore; - $this->clover = $clover; - $this->cobertura = $cobertura; - $this->crap4j = $crap4j; - $this->html = $html; - $this->php = $php; - $this->text = $text; - $this->xml = $xml; + return $this->noCoverage !== null; } /** - * @psalm-assert-if-true !null $this->cacheDirectory + * @throws Exception */ - public function hasCacheDirectory() : bool + public function noCoverage(): bool { - return $this->cacheDirectory !== null; + if ($this->noCoverage === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->noCoverage; + } + public function hasNoExtensions(): bool + { + return $this->noExtensions !== null; } /** * @throws Exception */ - public function cacheDirectory() : Directory + public function noExtensions(): bool { - if (!$this->hasCacheDirectory()) { - throw new Exception('No cache directory has been configured'); + if ($this->noExtensions === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->cacheDirectory; - } - public function hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport() : bool - { - return count($this->directories) > 0 || count($this->files) > 0; + return $this->noExtensions; } - public function directories() : DirectoryCollection + public function hasExtensions(): bool { - return $this->directories; + return $this->extensions !== null; } - public function files() : FileCollection + /** + * @throws Exception + */ + public function extensions(): array { - return $this->files; + if ($this->extensions === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->extensions; } - public function excludeDirectories() : DirectoryCollection + public function hasUnavailableExtensions(): bool { - return $this->excludeDirectories; + return $this->unavailableExtensions !== null; } - public function excludeFiles() : FileCollection + /** + * @throws Exception + */ + public function unavailableExtensions(): array { - return $this->excludeFiles; + if ($this->unavailableExtensions === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->unavailableExtensions; } - public function pathCoverage() : bool + public function hasNoInteraction(): bool { - return $this->pathCoverage; + return $this->noInteraction !== null; } - public function includeUncoveredFiles() : bool + /** + * @throws Exception + */ + public function noInteraction(): bool { - return $this->includeUncoveredFiles; + if ($this->noInteraction === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->noInteraction; } - public function ignoreDeprecatedCodeUnits() : bool + public function hasNoLogging(): bool { - return $this->ignoreDeprecatedCodeUnits; + return $this->noLogging !== null; } - public function disableCodeCoverageIgnore() : bool + /** + * @throws Exception + */ + public function noLogging(): bool { - return $this->disableCodeCoverageIgnore; + if ($this->noLogging === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->noLogging; } - public function processUncoveredFiles() : bool + public function hasPrinter(): bool { - return $this->processUncoveredFiles; + return $this->printer !== null; } /** - * @psalm-assert-if-true !null $this->clover + * @throws Exception */ - public function hasClover() : bool + public function printer(): string { - return $this->clover !== null; + if ($this->printer === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->printer; + } + public function hasProcessIsolation(): bool + { + return $this->processIsolation !== null; } /** * @throws Exception */ - public function clover() : Clover + public function processIsolation(): bool { - if (!$this->hasClover()) { - throw new Exception('Code Coverage report "Clover XML" has not been configured'); + if ($this->processIsolation === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->clover; + return $this->processIsolation; } - /** - * @psalm-assert-if-true !null $this->cobertura - */ - public function hasCobertura() : bool + public function hasRandomOrderSeed(): bool { - return $this->cobertura !== null; + return $this->randomOrderSeed !== null; } /** * @throws Exception */ - public function cobertura() : Cobertura + public function randomOrderSeed(): int { - if (!$this->hasCobertura()) { - throw new Exception('Code Coverage report "Cobertura XML" has not been configured'); + if ($this->randomOrderSeed === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->cobertura; + return $this->randomOrderSeed; } - /** - * @psalm-assert-if-true !null $this->crap4j - */ - public function hasCrap4j() : bool + public function hasRepeat(): bool { - return $this->crap4j !== null; + return $this->repeat !== null; } /** * @throws Exception */ - public function crap4j() : Crap4j + public function repeat(): int { - if (!$this->hasCrap4j()) { - throw new Exception('Code Coverage report "Crap4J" has not been configured'); + if ($this->repeat === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->crap4j; + return $this->repeat; } - /** - * @psalm-assert-if-true !null $this->html - */ - public function hasHtml() : bool + public function hasReportUselessTests(): bool { - return $this->html !== null; + return $this->reportUselessTests !== null; } /** * @throws Exception */ - public function html() : Html + public function reportUselessTests(): bool { - if (!$this->hasHtml()) { - throw new Exception('Code Coverage report "HTML" has not been configured'); + if ($this->reportUselessTests === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->html; + return $this->reportUselessTests; + } + public function hasResolveDependencies(): bool + { + return $this->resolveDependencies !== null; } /** - * @psalm-assert-if-true !null $this->php + * @throws Exception */ - public function hasPhp() : bool + public function resolveDependencies(): bool { - return $this->php !== null; + if ($this->resolveDependencies === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->resolveDependencies; + } + public function hasReverseList(): bool + { + return $this->reverseList !== null; } /** * @throws Exception */ - public function php() : Php + public function reverseList(): bool { - if (!$this->hasPhp()) { - throw new Exception('Code Coverage report "PHP" has not been configured'); + if ($this->reverseList === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->php; + return $this->reverseList; + } + public function hasStderr(): bool + { + return $this->stderr !== null; } /** - * @psalm-assert-if-true !null $this->text + * @throws Exception */ - public function hasText() : bool + public function stderr(): bool { - return $this->text !== null; + if ($this->stderr === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->stderr; + } + public function hasStrictCoverage(): bool + { + return $this->strictCoverage !== null; } /** * @throws Exception */ - public function text() : Text + public function strictCoverage(): bool { - if (!$this->hasText()) { - throw new Exception('Code Coverage report "Text" has not been configured'); + if ($this->strictCoverage === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->text; + return $this->strictCoverage; + } + public function hasStopOnDefect(): bool + { + return $this->stopOnDefect !== null; } /** - * @psalm-assert-if-true !null $this->xml + * @throws Exception */ - public function hasXml() : bool + public function stopOnDefect(): bool { - return $this->xml !== null; + if ($this->stopOnDefect === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->stopOnDefect; + } + public function hasStopOnError(): bool + { + return $this->stopOnError !== null; } /** * @throws Exception */ - public function xml() : Xml + public function stopOnError(): bool { - if (!$this->hasXml()) { - throw new Exception('Code Coverage report "XML" has not been configured'); + if ($this->stopOnError === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } - return $this->xml; + return $this->stopOnError; + } + public function hasStopOnFailure(): bool + { + return $this->stopOnFailure !== null; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Directory -{ /** - * @var string + * @throws Exception */ - private $path; + public function stopOnFailure(): bool + { + if ($this->stopOnFailure === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->stopOnFailure; + } + public function hasStopOnIncomplete(): bool + { + return $this->stopOnIncomplete !== null; + } /** - * @var string + * @throws Exception */ - private $prefix; + public function stopOnIncomplete(): bool + { + if ($this->stopOnIncomplete === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->stopOnIncomplete; + } + public function hasStopOnRisky(): bool + { + return $this->stopOnRisky !== null; + } /** - * @var string + * @throws Exception */ - private $suffix; + public function stopOnRisky(): bool + { + if ($this->stopOnRisky === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->stopOnRisky; + } + public function hasStopOnSkipped(): bool + { + return $this->stopOnSkipped !== null; + } /** - * @var string + * @throws Exception */ - private $group; - public function __construct(string $path, string $prefix, string $suffix, string $group) + public function stopOnSkipped(): bool { - $this->path = $path; - $this->prefix = $prefix; - $this->suffix = $suffix; - $this->group = $group; + if ($this->stopOnSkipped === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->stopOnSkipped; } - public function path() : string + public function hasStopOnWarning(): bool { - return $this->path; + return $this->stopOnWarning !== null; } - public function prefix() : string + /** + * @throws Exception + */ + public function stopOnWarning(): bool { - return $this->prefix; + if ($this->stopOnWarning === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->stopOnWarning; } - public function suffix() : string + public function hasTeamcityLogfile(): bool { - return $this->suffix; + return $this->teamcityLogfile !== null; + } + /** + * @throws Exception + */ + public function teamcityLogfile(): string + { + if ($this->teamcityLogfile === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->teamcityLogfile; } - public function group() : string + public function hasTestdoxExcludeGroups(): bool { - return $this->group; + return $this->testdoxExcludeGroups !== null; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter; - -use function count; -use Countable; -use IteratorAggregate; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - * - * @template-implements IteratorAggregate - */ -final class DirectoryCollection implements Countable, IteratorAggregate -{ /** - * @var Directory[] + * @throws Exception */ - private $directories; + public function testdoxExcludeGroups(): array + { + if ($this->testdoxExcludeGroups === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->testdoxExcludeGroups; + } + public function hasTestdoxGroups(): bool + { + return $this->testdoxGroups !== null; + } /** - * @param Directory[] $directories + * @throws Exception */ - public static function fromArray(array $directories) : self + public function testdoxGroups(): array { - return new self(...$directories); + if ($this->testdoxGroups === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->testdoxGroups; } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\Directory ...$directories) + public function hasTestdoxHtmlFile(): bool { - $this->directories = $directories; + return $this->testdoxHtmlFile !== null; } /** - * @return Directory[] + * @throws Exception */ - public function asArray() : array + public function testdoxHtmlFile(): string { - return $this->directories; + if ($this->testdoxHtmlFile === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->testdoxHtmlFile; } - public function count() : int + public function hasTestdoxTextFile(): bool { - return count($this->directories); + return $this->testdoxTextFile !== null; } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\DirectoryCollectionIterator + /** + * @throws Exception + */ + public function testdoxTextFile(): string { - return new \PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\DirectoryCollectionIterator($this); + if ($this->testdoxTextFile === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->testdoxTextFile; + } + public function hasTestdoxXmlFile(): bool + { + return $this->testdoxXmlFile !== null; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter; - -use function count; -use function iterator_count; -use Countable; -use Iterator; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @template-implements Iterator - */ -final class DirectoryCollectionIterator implements Countable, Iterator -{ /** - * @var Directory[] + * @throws Exception */ - private $directories; + public function testdoxXmlFile(): string + { + if ($this->testdoxXmlFile === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->testdoxXmlFile; + } + public function hasTestSuffixes(): bool + { + return $this->testSuffixes !== null; + } /** - * @var int + * @throws Exception */ - private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\DirectoryCollection $directories) + public function testSuffixes(): array { - $this->directories = $directories->asArray(); + if ($this->testSuffixes === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->testSuffixes; } - public function count() : int + public function hasTestSuite(): bool { - return iterator_count($this); + return $this->testSuite !== null; } - public function rewind() : void + /** + * @throws Exception + */ + public function testSuite(): string { - $this->position = 0; + if ($this->testSuite === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->testSuite; } - public function valid() : bool + public function unrecognizedOptions(): array { - return $this->position < count($this->directories); + return $this->unrecognizedOptions; } - public function key() : int + public function hasUnrecognizedOrderBy(): bool { - return $this->position; + return $this->unrecognizedOrderBy !== null; } - public function current() : \PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\Directory + /** + * @throws Exception + */ + public function unrecognizedOrderBy(): string { - return $this->directories[$this->position]; + if ($this->unrecognizedOrderBy === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->unrecognizedOrderBy; } - public function next() : void + public function hasUseDefaultConfiguration(): bool { - $this->position++; + return $this->useDefaultConfiguration !== null; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage; - -use PHPUnit\SebastianBergmann\CodeCoverage\Filter; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class FilterMapper -{ - public function map(Filter $filter, \PHPUnit\TextUI\XmlConfiguration\CodeCoverage\CodeCoverage $configuration) : void + /** + * @throws Exception + */ + public function useDefaultConfiguration(): bool { - foreach ($configuration->directories() as $directory) { - $filter->includeDirectory($directory->path(), $directory->suffix(), $directory->prefix()); - } - foreach ($configuration->files() as $file) { - $filter->includeFile($file->path()); - } - foreach ($configuration->excludeDirectories() as $directory) { - $filter->excludeDirectory($directory->path(), $directory->suffix(), $directory->prefix()); - } - foreach ($configuration->excludeFiles() as $file) { - $filter->excludeFile($file->path()); + if ($this->useDefaultConfiguration === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); } + return $this->useDefaultConfiguration; + } + public function hasVerbose(): bool + { + return $this->verbose !== null; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report; - -use PHPUnit\TextUI\XmlConfiguration\File; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Clover -{ /** - * @var File + * @throws Exception */ - private $target; - public function __construct(File $target) + public function verbose(): bool { - $this->target = $target; + if ($this->verbose === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->verbose; } - public function target() : File + public function hasVersion(): bool { - return $this->target; + return $this->version !== null; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report; - -use PHPUnit\TextUI\XmlConfiguration\File; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Cobertura -{ /** - * @var File + * @throws Exception */ - private $target; - public function __construct(File $target) + public function version(): bool { - $this->target = $target; + if ($this->version === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->version; } - public function target() : File + public function hasXdebugFilterFile(): bool { - return $this->target; + return $this->xdebugFilterFile !== null; + } + /** + * @throws Exception + */ + public function xdebugFilterFile(): string + { + if ($this->xdebugFilterFile === null) { + throw new \PHPUnit\TextUI\CliArguments\Exception(); + } + return $this->xdebugFilterFile; } } target = $target; - $this->threshold = $threshold; - } - public function target() : File - { - return $this->target; - } - public function threshold() : int - { - return $this->threshold; - } } target = $target; - $this->lowUpperBound = $lowUpperBound; - $this->highLowerBound = $highLowerBound; - } - public function target() : Directory + public function mapToLegacyArray(\PHPUnit\TextUI\CliArguments\Configuration $arguments): array { - return $this->target; - } - public function lowUpperBound() : int - { - return $this->lowUpperBound; - } - public function highLowerBound() : int - { - return $this->highLowerBound; - } + $result = ['extensions' => [], 'listGroups' => \false, 'listSuites' => \false, 'listTests' => \false, 'listTestsXml' => \false, 'loader' => null, 'useDefaultConfiguration' => \true, 'loadedExtensions' => [], 'unavailableExtensions' => [], 'notLoadedExtensions' => []]; + if ($arguments->hasColors()) { + $result['colors'] = $arguments->colors(); + } + if ($arguments->hasBootstrap()) { + $result['bootstrap'] = $arguments->bootstrap(); + } + if ($arguments->hasCacheResult()) { + $result['cacheResult'] = $arguments->cacheResult(); + } + if ($arguments->hasCacheResultFile()) { + $result['cacheResultFile'] = $arguments->cacheResultFile(); + } + if ($arguments->hasColumns()) { + $result['columns'] = $arguments->columns(); + } + if ($arguments->hasConfiguration()) { + $result['configuration'] = $arguments->configuration(); + } + if ($arguments->hasCoverageCacheDirectory()) { + $result['coverageCacheDirectory'] = $arguments->coverageCacheDirectory(); + } + if ($arguments->hasWarmCoverageCache()) { + $result['warmCoverageCache'] = $arguments->warmCoverageCache(); + } + if ($arguments->hasCoverageClover()) { + $result['coverageClover'] = $arguments->coverageClover(); + } + if ($arguments->hasCoverageCobertura()) { + $result['coverageCobertura'] = $arguments->coverageCobertura(); + } + if ($arguments->hasCoverageCrap4J()) { + $result['coverageCrap4J'] = $arguments->coverageCrap4J(); + } + if ($arguments->hasCoverageHtml()) { + $result['coverageHtml'] = $arguments->coverageHtml(); + } + if ($arguments->hasCoveragePhp()) { + $result['coveragePHP'] = $arguments->coveragePhp(); + } + if ($arguments->hasCoverageText()) { + $result['coverageText'] = $arguments->coverageText(); + } + if ($arguments->hasCoverageTextShowUncoveredFiles()) { + $result['coverageTextShowUncoveredFiles'] = $arguments->hasCoverageTextShowUncoveredFiles(); + } + if ($arguments->hasCoverageTextShowOnlySummary()) { + $result['coverageTextShowOnlySummary'] = $arguments->coverageTextShowOnlySummary(); + } + if ($arguments->hasCoverageXml()) { + $result['coverageXml'] = $arguments->coverageXml(); + } + if ($arguments->hasPathCoverage()) { + $result['pathCoverage'] = $arguments->pathCoverage(); + } + if ($arguments->hasDebug()) { + $result['debug'] = $arguments->debug(); + } + if ($arguments->hasHelp()) { + $result['help'] = $arguments->help(); + } + if ($arguments->hasFilter()) { + $result['filter'] = $arguments->filter(); + } + if ($arguments->hasTestSuite()) { + $result['testsuite'] = $arguments->testSuite(); + } + if ($arguments->hasGroups()) { + $result['groups'] = $arguments->groups(); + } + if ($arguments->hasExcludeGroups()) { + $result['excludeGroups'] = $arguments->excludeGroups(); + } + if ($arguments->hasTestsCovering()) { + $result['testsCovering'] = $arguments->testsCovering(); + } + if ($arguments->hasTestsUsing()) { + $result['testsUsing'] = $arguments->testsUsing(); + } + if ($arguments->hasTestSuffixes()) { + $result['testSuffixes'] = $arguments->testSuffixes(); + } + if ($arguments->hasIncludePath()) { + $result['includePath'] = $arguments->includePath(); + } + if ($arguments->hasListGroups()) { + $result['listGroups'] = $arguments->listGroups(); + } + if ($arguments->hasListSuites()) { + $result['listSuites'] = $arguments->listSuites(); + } + if ($arguments->hasListTests()) { + $result['listTests'] = $arguments->listTests(); + } + if ($arguments->hasListTestsXml()) { + $result['listTestsXml'] = $arguments->listTestsXml(); + } + if ($arguments->hasPrinter()) { + $result['printer'] = $arguments->printer(); + } + if ($arguments->hasLoader()) { + $result['loader'] = $arguments->loader(); + } + if ($arguments->hasJunitLogfile()) { + $result['junitLogfile'] = $arguments->junitLogfile(); + } + if ($arguments->hasTeamcityLogfile()) { + $result['teamcityLogfile'] = $arguments->teamcityLogfile(); + } + if ($arguments->hasExecutionOrder()) { + $result['executionOrder'] = $arguments->executionOrder(); + } + if ($arguments->hasExecutionOrderDefects()) { + $result['executionOrderDefects'] = $arguments->executionOrderDefects(); + } + if ($arguments->hasExtensions()) { + $result['extensions'] = $arguments->extensions(); + } + if ($arguments->hasUnavailableExtensions()) { + $result['unavailableExtensions'] = $arguments->unavailableExtensions(); + } + if ($arguments->hasResolveDependencies()) { + $result['resolveDependencies'] = $arguments->resolveDependencies(); + } + if ($arguments->hasProcessIsolation()) { + $result['processIsolation'] = $arguments->processIsolation(); + } + if ($arguments->hasRepeat()) { + $result['repeat'] = $arguments->repeat(); + } + if ($arguments->hasStderr()) { + $result['stderr'] = $arguments->stderr(); + } + if ($arguments->hasStopOnDefect()) { + $result['stopOnDefect'] = $arguments->stopOnDefect(); + } + if ($arguments->hasStopOnError()) { + $result['stopOnError'] = $arguments->stopOnError(); + } + if ($arguments->hasStopOnFailure()) { + $result['stopOnFailure'] = $arguments->stopOnFailure(); + } + if ($arguments->hasStopOnWarning()) { + $result['stopOnWarning'] = $arguments->stopOnWarning(); + } + if ($arguments->hasStopOnIncomplete()) { + $result['stopOnIncomplete'] = $arguments->stopOnIncomplete(); + } + if ($arguments->hasStopOnRisky()) { + $result['stopOnRisky'] = $arguments->stopOnRisky(); + } + if ($arguments->hasStopOnSkipped()) { + $result['stopOnSkipped'] = $arguments->stopOnSkipped(); + } + if ($arguments->hasFailOnEmptyTestSuite()) { + $result['failOnEmptyTestSuite'] = $arguments->failOnEmptyTestSuite(); + } + if ($arguments->hasFailOnIncomplete()) { + $result['failOnIncomplete'] = $arguments->failOnIncomplete(); + } + if ($arguments->hasFailOnRisky()) { + $result['failOnRisky'] = $arguments->failOnRisky(); + } + if ($arguments->hasFailOnSkipped()) { + $result['failOnSkipped'] = $arguments->failOnSkipped(); + } + if ($arguments->hasFailOnWarning()) { + $result['failOnWarning'] = $arguments->failOnWarning(); + } + if ($arguments->hasTestdoxGroups()) { + $result['testdoxGroups'] = $arguments->testdoxGroups(); + } + if ($arguments->hasTestdoxExcludeGroups()) { + $result['testdoxExcludeGroups'] = $arguments->testdoxExcludeGroups(); + } + if ($arguments->hasTestdoxHtmlFile()) { + $result['testdoxHTMLFile'] = $arguments->testdoxHtmlFile(); + } + if ($arguments->hasTestdoxTextFile()) { + $result['testdoxTextFile'] = $arguments->testdoxTextFile(); + } + if ($arguments->hasTestdoxXmlFile()) { + $result['testdoxXMLFile'] = $arguments->testdoxXmlFile(); + } + if ($arguments->hasUseDefaultConfiguration()) { + $result['useDefaultConfiguration'] = $arguments->useDefaultConfiguration(); + } + if ($arguments->hasNoExtensions()) { + $result['noExtensions'] = $arguments->noExtensions(); + } + if ($arguments->hasNoCoverage()) { + $result['noCoverage'] = $arguments->noCoverage(); + } + if ($arguments->hasNoLogging()) { + $result['noLogging'] = $arguments->noLogging(); + } + if ($arguments->hasNoInteraction()) { + $result['noInteraction'] = $arguments->noInteraction(); + } + if ($arguments->hasBackupGlobals()) { + $result['backupGlobals'] = $arguments->backupGlobals(); + } + if ($arguments->hasBackupStaticAttributes()) { + $result['backupStaticAttributes'] = $arguments->backupStaticAttributes(); + } + if ($arguments->hasVerbose()) { + $result['verbose'] = $arguments->verbose(); + } + if ($arguments->hasReportUselessTests()) { + $result['reportUselessTests'] = $arguments->reportUselessTests(); + } + if ($arguments->hasStrictCoverage()) { + $result['strictCoverage'] = $arguments->strictCoverage(); + } + if ($arguments->hasDisableCodeCoverageIgnore()) { + $result['disableCodeCoverageIgnore'] = $arguments->disableCodeCoverageIgnore(); + } + if ($arguments->hasBeStrictAboutChangesToGlobalState()) { + $result['beStrictAboutChangesToGlobalState'] = $arguments->beStrictAboutChangesToGlobalState(); + } + if ($arguments->hasDisallowTestOutput()) { + $result['disallowTestOutput'] = $arguments->disallowTestOutput(); + } + if ($arguments->hasBeStrictAboutResourceUsageDuringSmallTests()) { + $result['beStrictAboutResourceUsageDuringSmallTests'] = $arguments->beStrictAboutResourceUsageDuringSmallTests(); + } + if ($arguments->hasDefaultTimeLimit()) { + $result['defaultTimeLimit'] = $arguments->defaultTimeLimit(); + } + if ($arguments->hasEnforceTimeLimit()) { + $result['enforceTimeLimit'] = $arguments->enforceTimeLimit(); + } + if ($arguments->hasDisallowTodoAnnotatedTests()) { + $result['disallowTodoAnnotatedTests'] = $arguments->disallowTodoAnnotatedTests(); + } + if ($arguments->hasReverseList()) { + $result['reverseList'] = $arguments->reverseList(); + } + if ($arguments->hasCoverageFilter()) { + $result['coverageFilter'] = $arguments->coverageFilter(); + } + if ($arguments->hasRandomOrderSeed()) { + $result['randomOrderSeed'] = $arguments->randomOrderSeed(); + } + if ($arguments->hasXdebugFilterFile()) { + $result['xdebugFilterFile'] = $arguments->xdebugFilterFile(); + } + return $result; + } } */ - private $target; - public function __construct(File $target) - { - $this->target = $target; - } - public function target() : File - { - return $this->target; - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report; - -use PHPUnit\TextUI\XmlConfiguration\File; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Text -{ + protected $arguments = []; /** - * @var File + * @var array */ - private $target; + protected $longOptions = []; /** * @var bool */ - private $showUncoveredFiles; + private $versionStringPrinted = \false; /** - * @var bool + * @psalm-var list */ - private $showOnlySummary; - public function __construct(File $target, bool $showUncoveredFiles, bool $showOnlySummary) - { - $this->target = $target; - $this->showUncoveredFiles = $showUncoveredFiles; - $this->showOnlySummary = $showOnlySummary; - } - public function target() : File - { - return $this->target; - } - public function showUncoveredFiles() : bool - { - return $this->showUncoveredFiles; - } - public function showOnlySummary() : bool - { - return $this->showOnlySummary; - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Report; - -use PHPUnit\TextUI\XmlConfiguration\Directory; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Xml -{ + private $warnings = []; /** - * @var Directory + * @throws Exception */ - private $target; - public function __construct(Directory $target) + public static function main(bool $exit = \true): int { - $this->target = $target; + try { + return (new static())->run($_SERVER['argv'], $exit); + } catch (Throwable $t) { + throw new \PHPUnit\TextUI\RuntimeException($t->getMessage(), (int) $t->getCode(), $t); + } } - public function target() : Directory + /** + * @throws Exception + */ + public function run(array $argv, bool $exit = \true): int { - return $this->target; + $this->handleArguments($argv); + $runner = $this->createRunner(); + if ($this->arguments['test'] instanceof TestSuite) { + $suite = $this->arguments['test']; + } else { + $suite = $runner->getTest($this->arguments['test'], $this->arguments['testSuffixes']); + } + if ($this->arguments['listGroups']) { + return $this->handleListGroups($suite, $exit); + } + if ($this->arguments['listSuites']) { + return $this->handleListSuites($exit); + } + if ($this->arguments['listTests']) { + return $this->handleListTests($suite, $exit); + } + if ($this->arguments['listTestsXml']) { + return $this->handleListTestsXml($suite, $this->arguments['listTestsXml'], $exit); + } + unset($this->arguments['test'], $this->arguments['testFile']); + try { + $result = $runner->run($suite, $this->arguments, $this->warnings, $exit); + } catch (Throwable $t) { + print $t->getMessage() . PHP_EOL; + } + $return = \PHPUnit\TextUI\TestRunner::FAILURE_EXIT; + if (isset($result) && $result->wasSuccessful()) { + $return = \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; + } elseif (!isset($result) || $result->errorCount() > 0) { + $return = \PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT; + } + if ($exit) { + exit($return); + } + return $return; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\CodeCoverage; -use PHPUnit\TextUI\XmlConfiguration\Logging\Logging; -use PHPUnit\Util\Xml\ValidationResult; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Configuration -{ /** - * @var string + * Create a TestRunner, override in subclasses. */ - private $filename; + protected function createRunner(): \PHPUnit\TextUI\TestRunner + { + return new \PHPUnit\TextUI\TestRunner($this->arguments['loader']); + } /** - * @var ValidationResult + * Handles the command-line arguments. + * + * A child class of PHPUnit\TextUI\Command can hook into the argument + * parsing by adding the switch(es) to the $longOptions array and point to a + * callback method that handles the switch(es) in the child class like this + * + * + * longOptions['my-switch'] = 'myHandler'; + * // my-secondswitch will accept a value - note the equals sign + * $this->longOptions['my-secondswitch='] = 'myOtherHandler'; + * } + * + * // --my-switch -> myHandler() + * protected function myHandler() + * { + * } + * + * // --my-secondswitch foo -> myOtherHandler('foo') + * protected function myOtherHandler ($value) + * { + * } + * + * // You will also need this - the static keyword in the + * // PHPUnit\TextUI\Command will mean that it'll be + * // PHPUnit\TextUI\Command that gets instantiated, + * // not MyCommand + * public static function main($exit = true) + * { + * $command = new static; + * + * return $command->run($_SERVER['argv'], $exit); + * } + * + * } + * + * + * @throws Exception */ - private $validationResult; - /** - * @var ExtensionCollection - */ - private $extensions; - /** - * @var CodeCoverage - */ - private $codeCoverage; - /** - * @var Groups - */ - private $groups; - /** - * @var Groups - */ - private $testdoxGroups; + protected function handleArguments(array $argv): void + { + try { + $arguments = (new Builder())->fromParameters($argv, array_keys($this->longOptions)); + } catch (ArgumentsException $e) { + $this->exitWithErrorMessage($e->getMessage()); + } + assert(isset($arguments) && $arguments instanceof Configuration); + if ($arguments->hasGenerateConfiguration() && $arguments->generateConfiguration()) { + $this->generateConfiguration(); + } + if ($arguments->hasAtLeastVersion()) { + if (version_compare(Version::id(), $arguments->atLeastVersion(), '>=')) { + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); + } + exit(\PHPUnit\TextUI\TestRunner::FAILURE_EXIT); + } + if ($arguments->hasVersion() && $arguments->version()) { + $this->printVersionString(); + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); + } + if ($arguments->hasCheckVersion() && $arguments->checkVersion()) { + $this->handleVersionCheck(); + } + if ($arguments->hasHelp()) { + $this->showHelp(); + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); + } + if ($arguments->hasUnrecognizedOrderBy()) { + $this->exitWithErrorMessage(sprintf('unrecognized --order-by option: %s', $arguments->unrecognizedOrderBy())); + } + if ($arguments->hasIniSettings()) { + foreach ($arguments->iniSettings() as $name => $value) { + ini_set($name, $value); + } + } + if ($arguments->hasIncludePath()) { + ini_set('include_path', $arguments->includePath() . PATH_SEPARATOR . ini_get('include_path')); + } + $this->arguments = (new Mapper())->mapToLegacyArray($arguments); + $this->handleCustomOptions($arguments->unrecognizedOptions()); + $this->handleCustomTestSuite(); + if (!isset($this->arguments['testSuffixes'])) { + $this->arguments['testSuffixes'] = ['Test.php', '.phpt']; + } + if (!isset($this->arguments['test']) && $arguments->hasArgument()) { + $this->arguments['test'] = realpath($arguments->argument()); + if ($this->arguments['test'] === \false) { + $this->exitWithErrorMessage(sprintf('Cannot open file "%s".', $arguments->argument())); + } + } + if ($this->arguments['loader'] !== null) { + $this->arguments['loader'] = $this->handleLoader($this->arguments['loader']); + } + if (isset($this->arguments['configuration'])) { + if (is_dir($this->arguments['configuration'])) { + $candidate = $this->configurationFileInDirectory($this->arguments['configuration']); + if ($candidate !== null) { + $this->arguments['configuration'] = $candidate; + } + } + } elseif ($this->arguments['useDefaultConfiguration']) { + $candidate = $this->configurationFileInDirectory(getcwd()); + if ($candidate !== null) { + $this->arguments['configuration'] = $candidate; + } + } + if ($arguments->hasMigrateConfiguration() && $arguments->migrateConfiguration()) { + if (!isset($this->arguments['configuration'])) { + print 'No configuration file found to migrate.' . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); + } + $this->migrateConfiguration(realpath($this->arguments['configuration'])); + } + if (isset($this->arguments['configuration'])) { + try { + $this->arguments['configurationObject'] = (new Loader())->load($this->arguments['configuration']); + } catch (Throwable $e) { + print $e->getMessage() . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::FAILURE_EXIT); + } + $phpunitConfiguration = $this->arguments['configurationObject']->phpunit(); + (new PhpHandler())->handle($this->arguments['configurationObject']->php()); + if (isset($this->arguments['bootstrap'])) { + $this->handleBootstrap($this->arguments['bootstrap']); + } elseif ($phpunitConfiguration->hasBootstrap()) { + $this->handleBootstrap($phpunitConfiguration->bootstrap()); + } + if (!isset($this->arguments['stderr'])) { + $this->arguments['stderr'] = $phpunitConfiguration->stderr(); + } + if (!isset($this->arguments['noExtensions']) && $phpunitConfiguration->hasExtensionsDirectory() && extension_loaded('phar')) { + $result = (new PharLoader())->loadPharExtensionsInDirectory($phpunitConfiguration->extensionsDirectory()); + $this->arguments['loadedExtensions'] = $result['loadedExtensions']; + $this->arguments['notLoadedExtensions'] = $result['notLoadedExtensions']; + unset($result); + } + if (!isset($this->arguments['columns'])) { + $this->arguments['columns'] = $phpunitConfiguration->columns(); + } + if (!isset($this->arguments['printer']) && $phpunitConfiguration->hasPrinterClass()) { + $file = $phpunitConfiguration->hasPrinterFile() ? $phpunitConfiguration->printerFile() : ''; + $this->arguments['printer'] = $this->handlePrinter($phpunitConfiguration->printerClass(), $file); + } + if ($phpunitConfiguration->hasTestSuiteLoaderClass()) { + $file = $phpunitConfiguration->hasTestSuiteLoaderFile() ? $phpunitConfiguration->testSuiteLoaderFile() : ''; + $this->arguments['loader'] = $this->handleLoader($phpunitConfiguration->testSuiteLoaderClass(), $file); + } + if (!isset($this->arguments['testsuite']) && $phpunitConfiguration->hasDefaultTestSuite()) { + $this->arguments['testsuite'] = $phpunitConfiguration->defaultTestSuite(); + } + if (!isset($this->arguments['test'])) { + try { + $this->arguments['test'] = (new \PHPUnit\TextUI\TestSuiteMapper())->map($this->arguments['configurationObject']->testSuite(), $this->arguments['testsuite'] ?? ''); + } catch (\PHPUnit\TextUI\Exception $e) { + $this->printVersionString(); + print $e->getMessage() . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); + } + } + } elseif (isset($this->arguments['bootstrap'])) { + $this->handleBootstrap($this->arguments['bootstrap']); + } + if (isset($this->arguments['printer']) && is_string($this->arguments['printer'])) { + $this->arguments['printer'] = $this->handlePrinter($this->arguments['printer']); + } + if (isset($this->arguments['configurationObject'], $this->arguments['warmCoverageCache'])) { + $this->handleWarmCoverageCache($this->arguments['configurationObject']); + } + if (!isset($this->arguments['test'])) { + $this->showHelp(); + exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); + } + } /** - * @var ExtensionCollection + * Handles the loading of the PHPUnit\Runner\TestSuiteLoader implementation. + * + * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 */ - private $listeners; + protected function handleLoader(string $loaderClass, string $loaderFile = ''): ?TestSuiteLoader + { + $this->warnings[] = 'Using a custom test suite loader is deprecated'; + if (!class_exists($loaderClass, \false)) { + if ($loaderFile == '') { + $loaderFile = Filesystem::classNameToFilename($loaderClass); + } + $loaderFile = stream_resolve_include_path($loaderFile); + if ($loaderFile) { + /** + * @noinspection PhpIncludeInspection + * + * @psalm-suppress UnresolvableInclude + */ + require $loaderFile; + } + } + if (class_exists($loaderClass, \false)) { + try { + $class = new ReflectionClass($loaderClass); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\TextUI\ReflectionException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + if ($class->implementsInterface(TestSuiteLoader::class) && $class->isInstantiable()) { + $object = $class->newInstance(); + assert($object instanceof TestSuiteLoader); + return $object; + } + } + if ($loaderClass == StandardTestSuiteLoader::class) { + return null; + } + $this->exitWithErrorMessage(sprintf('Could not use "%s" as loader.', $loaderClass)); + return null; + } /** - * @var Logging + * Handles the loading of the PHPUnit\Util\Printer implementation. + * + * @return null|Printer|string */ - private $logging; + protected function handlePrinter(string $printerClass, string $printerFile = '') + { + if (!class_exists($printerClass, \false)) { + if ($printerFile === '') { + $printerFile = Filesystem::classNameToFilename($printerClass); + } + $printerFile = stream_resolve_include_path($printerFile); + if ($printerFile) { + /** + * @noinspection PhpIncludeInspection + * + * @psalm-suppress UnresolvableInclude + */ + require $printerFile; + } + } + if (!class_exists($printerClass)) { + $this->exitWithErrorMessage(sprintf('Could not use "%s" as printer: class does not exist', $printerClass)); + } + try { + $class = new ReflectionClass($printerClass); + // @codeCoverageIgnoreStart + } catch (\ReflectionException $e) { + throw new \PHPUnit\TextUI\ReflectionException($e->getMessage(), $e->getCode(), $e); + // @codeCoverageIgnoreEnd + } + if (!$class->implementsInterface(\PHPUnit\TextUI\ResultPrinter::class)) { + $this->exitWithErrorMessage(sprintf('Could not use "%s" as printer: class does not implement %s', $printerClass, \PHPUnit\TextUI\ResultPrinter::class)); + } + if (!$class->isInstantiable()) { + $this->exitWithErrorMessage(sprintf('Could not use "%s" as printer: class cannot be instantiated', $printerClass)); + } + if ($class->isSubclassOf(\PHPUnit\TextUI\ResultPrinter::class)) { + return $printerClass; + } + $outputStream = isset($this->arguments['stderr']) ? 'php://stderr' : null; + return $class->newInstance($outputStream); + } /** - * @var Php + * Loads a bootstrap file. */ - private $php; + protected function handleBootstrap(string $filename): void + { + try { + FileLoader::checkAndLoad($filename); + } catch (Throwable $t) { + if ($t instanceof \PHPUnit\Exception) { + $this->exitWithErrorMessage($t->getMessage()); + } + $message = sprintf('Error in bootstrap script: %s:%s%s%s%s', get_class($t), PHP_EOL, $t->getMessage(), PHP_EOL, $t->getTraceAsString()); + while ($t = $t->getPrevious()) { + $message .= sprintf('%s%sPrevious error: %s:%s%s%s%s', PHP_EOL, PHP_EOL, get_class($t), PHP_EOL, $t->getMessage(), PHP_EOL, $t->getTraceAsString()); + } + $this->exitWithErrorMessage($message); + } + } + protected function handleVersionCheck(): void + { + $this->printVersionString(); + $latestVersion = file_get_contents('https://phar.phpunit.de/latest-version-of/phpunit'); + $latestCompatibleVersion = file_get_contents('https://phar.phpunit.de/latest-version-of/phpunit-' . explode('.', Version::series())[0]); + $notLatest = version_compare($latestVersion, Version::id(), '>'); + $notLatestCompatible = version_compare($latestCompatibleVersion, Version::id(), '>'); + if ($notLatest || $notLatestCompatible) { + print 'You are not using the latest version of PHPUnit.' . PHP_EOL; + } else { + print 'You are using the latest version of PHPUnit.' . PHP_EOL; + } + if ($notLatestCompatible) { + printf('The latest version compatible with PHPUnit %s is PHPUnit %s.' . PHP_EOL, Version::id(), $latestCompatibleVersion); + } + if ($notLatest) { + printf('The latest version is PHPUnit %s.' . PHP_EOL, $latestVersion); + } + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); + } /** - * @var PHPUnit + * Show the help message. */ - private $phpunit; + protected function showHelp(): void + { + $this->printVersionString(); + (new \PHPUnit\TextUI\Help())->writeToConsole(); + } /** - * @var TestSuiteCollection + * Custom callback for test suite discovery. */ - private $testSuite; - public function __construct(string $filename, ValidationResult $validationResult, \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection $extensions, CodeCoverage $codeCoverage, \PHPUnit\TextUI\XmlConfiguration\Groups $groups, \PHPUnit\TextUI\XmlConfiguration\Groups $testdoxGroups, \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection $listeners, Logging $logging, \PHPUnit\TextUI\XmlConfiguration\Php $php, \PHPUnit\TextUI\XmlConfiguration\PHPUnit $phpunit, \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection $testSuite) + protected function handleCustomTestSuite(): void { - $this->filename = $filename; - $this->validationResult = $validationResult; - $this->extensions = $extensions; - $this->codeCoverage = $codeCoverage; - $this->groups = $groups; - $this->testdoxGroups = $testdoxGroups; - $this->listeners = $listeners; - $this->logging = $logging; - $this->php = $php; - $this->phpunit = $phpunit; - $this->testSuite = $testSuite; } - public function filename() : string + private function printVersionString(): void { - return $this->filename; + if ($this->versionStringPrinted) { + return; + } + print Version::getVersionString() . PHP_EOL . PHP_EOL; + $this->versionStringPrinted = \true; } - public function hasValidationErrors() : bool + private function exitWithErrorMessage(string $message): void { - return $this->validationResult->hasValidationErrors(); + $this->printVersionString(); + print $message . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::FAILURE_EXIT); } - public function validationErrors() : string + private function handleListGroups(TestSuite $suite, bool $exit): int { - return $this->validationResult->asString(); + $this->printVersionString(); + $this->warnAboutConflictingOptions('listGroups', ['filter', 'groups', 'excludeGroups', 'testsuite']); + print 'Available test group(s):' . PHP_EOL; + $groups = $suite->getGroups(); + sort($groups); + foreach ($groups as $group) { + if (strpos($group, '__phpunit_') === 0) { + continue; + } + printf(' - %s' . PHP_EOL, $group); + } + if ($exit) { + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); + } + return \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; } - public function extensions() : \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection + /** + * @throws \PHPUnit\Framework\Exception + * @throws XmlConfiguration\Exception + */ + private function handleListSuites(bool $exit): int { - return $this->extensions; + $this->printVersionString(); + $this->warnAboutConflictingOptions('listSuites', ['filter', 'groups', 'excludeGroups', 'testsuite']); + print 'Available test suite(s):' . PHP_EOL; + foreach ($this->arguments['configurationObject']->testSuite() as $testSuite) { + printf(' - %s' . PHP_EOL, $testSuite->name()); + } + if ($exit) { + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); + } + return \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; } - public function codeCoverage() : CodeCoverage + /** + * @throws InvalidArgumentException + */ + private function handleListTests(TestSuite $suite, bool $exit): int { - return $this->codeCoverage; + $this->printVersionString(); + $this->warnAboutConflictingOptions('listTests', ['filter', 'groups', 'excludeGroups']); + $renderer = new TextTestListRenderer(); + print $renderer->render($suite); + if ($exit) { + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); + } + return \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; } - public function groups() : \PHPUnit\TextUI\XmlConfiguration\Groups + /** + * @throws InvalidArgumentException + */ + private function handleListTestsXml(TestSuite $suite, string $target, bool $exit): int { - return $this->groups; + $this->printVersionString(); + $this->warnAboutConflictingOptions('listTestsXml', ['filter', 'groups', 'excludeGroups']); + $renderer = new XmlTestListRenderer(); + file_put_contents($target, $renderer->render($suite)); + printf('Wrote list of tests that would have been run to %s' . PHP_EOL, $target); + if ($exit) { + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); + } + return \PHPUnit\TextUI\TestRunner::SUCCESS_EXIT; } - public function testdoxGroups() : \PHPUnit\TextUI\XmlConfiguration\Groups + private function generateConfiguration(): void { - return $this->testdoxGroups; + $this->printVersionString(); + print 'Generating phpunit.xml in ' . getcwd() . PHP_EOL . PHP_EOL; + print 'Bootstrap script (relative to path shown above; default: vendor/autoload.php): '; + $bootstrapScript = trim(fgets(STDIN)); + print 'Tests directory (relative to path shown above; default: tests): '; + $testsDirectory = trim(fgets(STDIN)); + print 'Source directory (relative to path shown above; default: src): '; + $src = trim(fgets(STDIN)); + print 'Cache directory (relative to path shown above; default: .phpunit.cache): '; + $cacheDirectory = trim(fgets(STDIN)); + if ($bootstrapScript === '') { + $bootstrapScript = 'vendor/autoload.php'; + } + if ($testsDirectory === '') { + $testsDirectory = 'tests'; + } + if ($src === '') { + $src = 'src'; + } + if ($cacheDirectory === '') { + $cacheDirectory = '.phpunit.cache'; + } + $generator = new Generator(); + file_put_contents('phpunit.xml', $generator->generateDefaultConfiguration(Version::series(), $bootstrapScript, $testsDirectory, $src, $cacheDirectory)); + print PHP_EOL . 'Generated phpunit.xml in ' . getcwd() . '.' . PHP_EOL; + print 'Make sure to exclude the ' . $cacheDirectory . ' directory from version control.' . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); } - public function listeners() : \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection + private function migrateConfiguration(string $filename): void { - return $this->listeners; + $this->printVersionString(); + $result = (new SchemaDetector())->detect($filename); + if (!$result->detected()) { + print $filename . ' does not validate against any known schema.' . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); + } + /** @psalm-suppress MissingThrowsDocblock */ + if ($result->version() === Version::series()) { + print $filename . ' does not need to be migrated.' . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); + } + copy($filename, $filename . '.bak'); + print 'Created backup: ' . $filename . '.bak' . PHP_EOL; + try { + file_put_contents($filename, (new Migrator())->migrate($filename)); + print 'Migrated configuration: ' . $filename . PHP_EOL; + } catch (Throwable $t) { + print 'Migration failed: ' . $t->getMessage() . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); + } + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); } - public function logging() : Logging + private function handleCustomOptions(array $unrecognizedOptions): void { - return $this->logging; + foreach ($unrecognizedOptions as $name => $value) { + if (isset($this->longOptions[$name])) { + $handler = $this->longOptions[$name]; + } + $name .= '='; + if (isset($this->longOptions[$name])) { + $handler = $this->longOptions[$name]; + } + if (isset($handler) && is_callable([$this, $handler])) { + $this->{$handler}($value); + unset($handler); + } + } } - public function php() : \PHPUnit\TextUI\XmlConfiguration\Php + private function handleWarmCoverageCache(\PHPUnit\TextUI\XmlConfiguration\Configuration $configuration): void { - return $this->php; + $this->printVersionString(); + if (isset($this->arguments['coverageCacheDirectory'])) { + $cacheDirectory = $this->arguments['coverageCacheDirectory']; + } elseif ($configuration->codeCoverage()->hasCacheDirectory()) { + $cacheDirectory = $configuration->codeCoverage()->cacheDirectory()->path(); + } else { + print 'Cache for static analysis has not been configured' . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); + } + $filter = new Filter(); + if ($configuration->codeCoverage()->hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport()) { + (new FilterMapper())->map($filter, $configuration->codeCoverage()); + } elseif (isset($this->arguments['coverageFilter'])) { + if (!is_array($this->arguments['coverageFilter'])) { + $coverageFilterDirectories = [$this->arguments['coverageFilter']]; + } else { + $coverageFilterDirectories = $this->arguments['coverageFilter']; + } + foreach ($coverageFilterDirectories as $coverageFilterDirectory) { + $filter->includeDirectory($coverageFilterDirectory); + } + } else { + print 'Filter for code coverage has not been configured' . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::EXCEPTION_EXIT); + } + $timer = new Timer(); + $timer->start(); + print 'Warming cache for static analysis ... '; + (new CacheWarmer())->warmCache($cacheDirectory, !$configuration->codeCoverage()->disableCodeCoverageIgnore(), $configuration->codeCoverage()->ignoreDeprecatedCodeUnits(), $filter); + print 'done [' . $timer->stop()->asString() . ']' . PHP_EOL; + exit(\PHPUnit\TextUI\TestRunner::SUCCESS_EXIT); } - public function phpunit() : \PHPUnit\TextUI\XmlConfiguration\PHPUnit + private function configurationFileInDirectory(string $directory): ?string { - return $this->phpunit; + $candidates = [$directory . '/phpunit.xml', $directory . '/phpunit.xml.dist']; + foreach ($candidates as $candidate) { + if (is_file($candidate)) { + return realpath($candidate); + } + } + return null; + } + /** + * @psalm-param "listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite" $key + * @psalm-param list<"listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite"> $keys + */ + private function warnAboutConflictingOptions(string $key, array $keys): void + { + $warningPrinted = \false; + foreach ($keys as $_key) { + if (!empty($this->arguments[$_key])) { + printf('The %s and %s options cannot be combined, %s is ignored' . PHP_EOL, $this->mapKeyToOptionForWarning($_key), $this->mapKeyToOptionForWarning($key), $this->mapKeyToOptionForWarning($_key)); + $warningPrinted = \true; + } + } + if ($warningPrinted) { + print PHP_EOL; + } } - public function testSuite() : \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection + /** + * @psalm-param "listGroups"|"listSuites"|"listTests"|"listTestsXml"|"filter"|"groups"|"excludeGroups"|"testsuite" $key + */ + private function mapKeyToOptionForWarning(string $key): string { - return $this->testSuite; + switch ($key) { + case 'listGroups': + return '--list-groups'; + case 'listSuites': + return '--list-suites'; + case 'listTests': + return '--list-tests'; + case 'listTestsXml': + return '--list-tests-xml'; + case 'filter': + return '--filter'; + case 'groups': + return '--group'; + case 'excludeGroups': + return '--exclude-group'; + case 'testsuite': + return '--testsuite'; + } } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; +namespace PHPUnit\TextUI; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Directory +use const PHP_EOL; +use function array_map; +use function array_reverse; +use function count; +use function floor; +use function implode; +use function in_array; +use function is_int; +use function max; +use function preg_split; +use function sprintf; +use function str_pad; +use function str_repeat; +use function strlen; +use function trim; +use function vsprintf; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\InvalidArgumentException; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestResult; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\Color; +use PHPUnit\Util\Printer; +use PHPUnitPHAR\SebastianBergmann\Environment\Console; +use PHPUnitPHAR\SebastianBergmann\Timer\ResourceUsageFormatter; +use PHPUnitPHAR\SebastianBergmann\Timer\Timer; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +class DefaultResultPrinter extends Printer implements \PHPUnit\TextUI\ResultPrinter { + public const EVENT_TEST_START = 0; + public const EVENT_TEST_END = 1; + public const EVENT_TESTSUITE_START = 2; + public const EVENT_TESTSUITE_END = 3; + public const COLOR_NEVER = 'never'; + public const COLOR_AUTO = 'auto'; + public const COLOR_ALWAYS = 'always'; + public const COLOR_DEFAULT = self::COLOR_NEVER; + private const AVAILABLE_COLORS = [self::COLOR_NEVER, self::COLOR_AUTO, self::COLOR_ALWAYS]; /** - * @var string + * @var int */ - private $path; - public function __construct(string $path) + protected $column = 0; + /** + * @var int + */ + protected $maxColumn; + /** + * @var bool + */ + protected $lastTestFailed = \false; + /** + * @var int + */ + protected $numAssertions = 0; + /** + * @var int + */ + protected $numTests = -1; + /** + * @var int + */ + protected $numTestsRun = 0; + /** + * @var int + */ + protected $numTestsWidth; + /** + * @var bool + */ + protected $colors = \false; + /** + * @var bool + */ + protected $debug = \false; + /** + * @var bool + */ + protected $verbose = \false; + /** + * @var int + */ + private $numberOfColumns; + /** + * @var bool + */ + private $reverse; + /** + * @var bool + */ + private $defectListPrinted = \false; + /** + * @var Timer + */ + private $timer; + /** + * Constructor. + * + * @param null|resource|string $out + * @param int|string $numberOfColumns + * + * @throws Exception + */ + public function __construct($out = null, bool $verbose = \false, string $colors = self::COLOR_DEFAULT, bool $debug = \false, $numberOfColumns = 80, bool $reverse = \false) { - $this->path = $path; + parent::__construct($out); + if (!in_array($colors, self::AVAILABLE_COLORS, \true)) { + throw InvalidArgumentException::create(3, vsprintf('value from "%s", "%s" or "%s"', self::AVAILABLE_COLORS)); + } + if (!is_int($numberOfColumns) && $numberOfColumns !== 'max') { + throw InvalidArgumentException::create(5, 'integer or "max"'); + } + $console = new Console(); + $maxNumberOfColumns = $console->getNumberOfColumns(); + if ($numberOfColumns === 'max' || $numberOfColumns !== 80 && $numberOfColumns > $maxNumberOfColumns) { + $numberOfColumns = $maxNumberOfColumns; + } + $this->numberOfColumns = $numberOfColumns; + $this->verbose = $verbose; + $this->debug = $debug; + $this->reverse = $reverse; + if ($colors === self::COLOR_AUTO && $console->hasColorSupport()) { + $this->colors = \true; + } else { + $this->colors = self::COLOR_ALWAYS === $colors; + } + $this->timer = new Timer(); + $this->timer->start(); } - public function path() : string + public function printResult(TestResult $result): void { - return $this->path; + $this->printHeader($result); + $this->printErrors($result); + $this->printWarnings($result); + $this->printFailures($result); + $this->printRisky($result); + if ($this->verbose) { + $this->printIncompletes($result); + $this->printSkipped($result); + } + $this->printFooter($result); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function count; -use Countable; -use IteratorAggregate; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - * - * @template-implements IteratorAggregate - */ -final class DirectoryCollection implements Countable, IteratorAggregate -{ /** - * @var Directory[] + * An error occurred. */ - private $directories; + public function addError(Test $test, Throwable $t, float $time): void + { + $this->writeProgressWithColor('fg-red, bold', 'E'); + $this->lastTestFailed = \true; + } /** - * @param Directory[] $directories + * A failure occurred. */ - public static function fromArray(array $directories) : self + public function addFailure(Test $test, AssertionFailedError $e, float $time): void { - return new self(...$directories); + $this->writeProgressWithColor('bg-red, fg-white', 'F'); + $this->lastTestFailed = \true; } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\Directory ...$directories) + /** + * A warning occurred. + */ + public function addWarning(Test $test, Warning $e, float $time): void { - $this->directories = $directories; + $this->writeProgressWithColor('fg-yellow, bold', 'W'); + $this->lastTestFailed = \true; } /** - * @return Directory[] + * Incomplete test. */ - public function asArray() : array + public function addIncompleteTest(Test $test, Throwable $t, float $time): void { - return $this->directories; + $this->writeProgressWithColor('fg-yellow, bold', 'I'); + $this->lastTestFailed = \true; } - public function count() : int + /** + * Risky test. + */ + public function addRiskyTest(Test $test, Throwable $t, float $time): void { - return count($this->directories); + $this->writeProgressWithColor('fg-yellow, bold', 'R'); + $this->lastTestFailed = \true; } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\DirectoryCollectionIterator + /** + * Skipped test. + */ + public function addSkippedTest(Test $test, Throwable $t, float $time): void { - return new \PHPUnit\TextUI\XmlConfiguration\DirectoryCollectionIterator($this); + $this->writeProgressWithColor('fg-cyan, bold', 'S'); + $this->lastTestFailed = \true; } - public function isEmpty() : bool + /** + * A testsuite started. + */ + public function startTestSuite(TestSuite $suite): void { - return $this->count() === 0; + if ($this->numTests == -1) { + $this->numTests = count($suite); + $this->numTestsWidth = strlen((string) $this->numTests); + $this->maxColumn = $this->numberOfColumns - strlen(' / (XXX%)') - 2 * $this->numTestsWidth; + } } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function count; -use function iterator_count; -use Countable; -use Iterator; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @template-implements Iterator - */ -final class DirectoryCollectionIterator implements Countable, Iterator -{ /** - * @var Directory[] + * A testsuite ended. */ - private $directories; + public function endTestSuite(TestSuite $suite): void + { + } /** - * @var int + * A test started. */ - private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\DirectoryCollection $directories) + public function startTest(Test $test): void { - $this->directories = $directories->asArray(); + if ($this->debug) { + $this->write(sprintf("Test '%s' started\n", \PHPUnit\Util\Test::describeAsString($test))); + } + } + /** + * A test ended. + */ + public function endTest(Test $test, float $time): void + { + if ($this->debug) { + $this->write(sprintf("Test '%s' ended\n", \PHPUnit\Util\Test::describeAsString($test))); + } + if (!$this->lastTestFailed) { + $this->writeProgress('.'); + } + if ($test instanceof TestCase) { + $this->numAssertions += $test->getNumAssertions(); + } elseif ($test instanceof PhptTestCase) { + $this->numAssertions++; + } + $this->lastTestFailed = \false; + if ($test instanceof TestCase && !$test->hasExpectationOnOutput()) { + $this->write($test->getActualOutput()); + } } - public function count() : int + protected function printDefects(array $defects, string $type): void { - return iterator_count($this); + $count = count($defects); + if ($count == 0) { + return; + } + if ($this->defectListPrinted) { + $this->write("\n--\n\n"); + } + $this->write(sprintf("There %s %d %s%s:\n", ($count == 1) ? 'was' : 'were', $count, $type, ($count == 1) ? '' : 's')); + $i = 1; + if ($this->reverse) { + $defects = array_reverse($defects); + } + foreach ($defects as $defect) { + $this->printDefect($defect, $i++); + } + $this->defectListPrinted = \true; } - public function rewind() : void + protected function printDefect(TestFailure $defect, int $count): void { - $this->position = 0; + $this->printDefectHeader($defect, $count); + $this->printDefectTrace($defect); } - public function valid() : bool + protected function printDefectHeader(TestFailure $defect, int $count): void { - return $this->position < count($this->directories); + $this->write(sprintf("\n%d) %s\n", $count, $defect->getTestName())); } - public function key() : int + protected function printDefectTrace(TestFailure $defect): void { - return $this->position; + $e = $defect->thrownException(); + $this->write((string) $e); + while ($e = $e->getPrevious()) { + $this->write("\nCaused by\n" . trim((string) $e) . "\n"); + } } - public function current() : \PHPUnit\TextUI\XmlConfiguration\Directory + protected function printErrors(TestResult $result): void { - return $this->directories[$this->position]; + $this->printDefects($result->errors(), 'error'); } - public function next() : void + protected function printFailures(TestResult $result): void { - $this->position++; + $this->printDefects($result->failures(), 'failure'); + } + protected function printWarnings(TestResult $result): void + { + $this->printDefects($result->warnings(), 'warning'); + } + protected function printIncompletes(TestResult $result): void + { + $this->printDefects($result->notImplemented(), 'incomplete test'); + } + protected function printRisky(TestResult $result): void + { + $this->printDefects($result->risky(), 'risky test'); + } + protected function printSkipped(TestResult $result): void + { + $this->printDefects($result->skipped(), 'skipped test'); + } + protected function printHeader(TestResult $result): void + { + if (count($result) > 0) { + $this->write(PHP_EOL . PHP_EOL . (new ResourceUsageFormatter())->resourceUsage($this->timer->stop()) . PHP_EOL . PHP_EOL); + } + } + protected function printFooter(TestResult $result): void + { + if (count($result) === 0) { + $this->writeWithColor('fg-black, bg-yellow', 'No tests executed!'); + return; + } + if ($result->wasSuccessfulAndNoTestIsRiskyOrSkippedOrIncomplete()) { + $this->writeWithColor('fg-black, bg-green', sprintf('OK (%d test%s, %d assertion%s)', count($result), (count($result) === 1) ? '' : 's', $this->numAssertions, ($this->numAssertions === 1) ? '' : 's')); + return; + } + $color = 'fg-black, bg-yellow'; + if ($result->wasSuccessful()) { + if ($this->verbose || !$result->allHarmless()) { + $this->write("\n"); + } + $this->writeWithColor($color, 'OK, but incomplete, skipped, or risky tests!'); + } else { + $this->write("\n"); + if ($result->errorCount()) { + $color = 'fg-white, bg-red'; + $this->writeWithColor($color, 'ERRORS!'); + } elseif ($result->failureCount()) { + $color = 'fg-white, bg-red'; + $this->writeWithColor($color, 'FAILURES!'); + } elseif ($result->warningCount()) { + $color = 'fg-black, bg-yellow'; + $this->writeWithColor($color, 'WARNINGS!'); + } + } + $this->writeCountString(count($result), 'Tests', $color, \true); + $this->writeCountString($this->numAssertions, 'Assertions', $color, \true); + $this->writeCountString($result->errorCount(), 'Errors', $color); + $this->writeCountString($result->failureCount(), 'Failures', $color); + $this->writeCountString($result->warningCount(), 'Warnings', $color); + $this->writeCountString($result->skippedCount(), 'Skipped', $color); + $this->writeCountString($result->notImplementedCount(), 'Incomplete', $color); + $this->writeCountString($result->riskyCount(), 'Risky', $color); + $this->writeWithColor($color, '.'); + } + protected function writeProgress(string $progress): void + { + if ($this->debug) { + return; + } + $this->write($progress); + $this->column++; + $this->numTestsRun++; + if ($this->column == $this->maxColumn || $this->numTestsRun == $this->numTests) { + if ($this->numTestsRun == $this->numTests) { + $this->write(str_repeat(' ', $this->maxColumn - $this->column)); + } + $this->write(sprintf(' %' . $this->numTestsWidth . 'd / %' . $this->numTestsWidth . 'd (%3s%%)', $this->numTestsRun, $this->numTests, floor($this->numTestsRun / $this->numTests * 100))); + if ($this->column == $this->maxColumn) { + $this->writeNewLine(); + } + } + } + protected function writeNewLine(): void + { + $this->column = 0; + $this->write("\n"); + } + /** + * Formats a buffer with a specified ANSI color sequence if colors are + * enabled. + */ + protected function colorizeTextBox(string $color, string $buffer): string + { + if (!$this->colors) { + return $buffer; + } + $lines = preg_split('/\r\n|\r|\n/', $buffer); + $padding = max(array_map('\strlen', $lines)); + $styledLines = []; + foreach ($lines as $line) { + $styledLines[] = Color::colorize($color, str_pad($line, $padding)); + } + return implode(PHP_EOL, $styledLines); + } + /** + * Writes a buffer out with a color sequence if colors are enabled. + */ + protected function writeWithColor(string $color, string $buffer, bool $lf = \true): void + { + $this->write($this->colorizeTextBox($color, $buffer)); + if ($lf) { + $this->write(PHP_EOL); + } + } + /** + * Writes progress with a color sequence if colors are enabled. + */ + protected function writeProgressWithColor(string $color, string $buffer): void + { + $buffer = $this->colorizeTextBox($color, $buffer); + $this->writeProgress($buffer); + } + private function writeCountString(int $count, string $name, string $color, bool $always = \false): void + { + static $first = \true; + if ($always || $count > 0) { + $this->writeWithColor($color, sprintf('%s%s: %d', (!$first) ? ', ' : '', $name, $count), \false); + $first = \false; + } } } path = $path; - } - public function path() : string - { - return $this->path; - } } * - * @template-implements IteratorAggregate + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ -final class FileCollection implements Countable, IteratorAggregate +namespace PHPUnit\TextUI; + +/** + * @internal This interface is not covered by the backward compatibility promise for PHPUnit + */ +final class RuntimeException extends \RuntimeException implements \PHPUnit\TextUI\Exception { - /** - * @var File[] - */ - private $files; - /** - * @param File[] $files - */ - public static function fromArray(array $files) : self - { - return new self(...$files); - } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\File ...$files) - { - $this->files = $files; - } - /** - * @return File[] - */ - public function asArray() : array - { - return $this->files; - } - public function count() : int - { - return count($this->files); - } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\FileCollectionIterator - { - return new \PHPUnit\TextUI\XmlConfiguration\FileCollectionIterator($this); - } - public function isEmpty() : bool - { - return $this->count() === 0; - } } + * @internal This interface is not covered by the backward compatibility promise for PHPUnit */ -final class FileCollectionIterator implements Countable, Iterator +final class TestDirectoryNotFoundException extends RuntimeException implements \PHPUnit\TextUI\Exception { - /** - * @var File[] - */ - private $files; - /** - * @var int - */ - private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\FileCollection $files) - { - $this->files = $files->asArray(); - } - public function count() : int - { - return iterator_count($this); - } - public function rewind() : void - { - $this->position = 0; - } - public function valid() : bool - { - return $this->position < count($this->files); - } - public function key() : int - { - return $this->position; - } - public function current() : \PHPUnit\TextUI\XmlConfiguration\File - { - return $this->files[$this->position]; - } - public function next() : void - { - $this->position++; - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function str_replace; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class Generator -{ - /** - * @var string - */ - private const TEMPLATE = <<<'EOT' - - - - - {tests_directory} - - - - - - {src_directory} - - - - -EOT; - public function generateDefaultConfiguration(string $phpunitVersion, string $bootstrapScript, string $testsDirectory, string $srcDirectory, string $cacheDirectory) : string + public function __construct(string $path) { - return str_replace(['{phpunit_version}', '{bootstrap_script}', '{tests_directory}', '{src_directory}', '{cache_directory}'], [$phpunitVersion, $bootstrapScript, $testsDirectory, $srcDirectory, $cacheDirectory], self::TEMPLATE); + parent::__construct(sprintf('Test directory "%s" not found', $path)); } } name = $name; - } - public function name() : string + public function __construct(string $path) { - return $this->name; + parent::__construct(sprintf('Test file "%s" not found', $path)); } } */ -final class GroupCollection implements IteratorAggregate +final class Help { + private const LEFT_MARGIN = ' '; /** - * @var Group[] + * @var int Number of columns required to write the longest option name to the console */ - private $groups; + private $maxArgLength = 0; /** - * @param Group[] $groups + * @var int Number of columns left for the description field after padding and option */ - public static function fromArray(array $groups) : self - { - return new self(...$groups); - } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\Group ...$groups) - { - $this->groups = $groups; - } + private $maxDescLength; /** - * @return Group[] + * @var bool Use color highlights for sections, options and parameters */ - public function asArray() : array + private $hasColor = \false; + public function __construct(?int $width = null, ?bool $withColor = null) { - return $this->groups; + if ($width === null) { + $width = (new Console())->getNumberOfColumns(); + } + if ($withColor === null) { + $this->hasColor = (new Console())->hasColorSupport(); + } else { + $this->hasColor = $withColor; + } + foreach ($this->elements() as $options) { + foreach ($options as $option) { + if (isset($option['arg'])) { + $this->maxArgLength = max($this->maxArgLength, isset($option['arg']) ? strlen($option['arg']) : 0); + } + } + } + $this->maxDescLength = $width - $this->maxArgLength - 4; } /** - * @return string[] + * Write the help file to the CLI, adapting width and colors to the console. */ - public function asArrayOfStrings() : array + public function writeToConsole(): void { - $result = []; - foreach ($this->groups as $group) { - $result[] = $group->name(); + if ($this->hasColor) { + $this->writeWithColor(); + } else { + $this->writePlaintext(); } - return $result; } - public function isEmpty() : bool + private function writePlaintext(): void { - return empty($this->groups); + foreach ($this->elements() as $section => $options) { + print "{$section}:" . PHP_EOL; + if ($section !== 'Usage') { + print PHP_EOL; + } + foreach ($options as $option) { + if (isset($option['spacer'])) { + print PHP_EOL; + } + if (isset($option['text'])) { + print self::LEFT_MARGIN . $option['text'] . PHP_EOL; + } + if (isset($option['arg'])) { + $arg = str_pad($option['arg'], $this->maxArgLength); + print self::LEFT_MARGIN . $arg . ' ' . $option['desc'] . PHP_EOL; + } + } + print PHP_EOL; + } } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\GroupCollectionIterator + private function writeWithColor(): void { - return new \PHPUnit\TextUI\XmlConfiguration\GroupCollectionIterator($this); + foreach ($this->elements() as $section => $options) { + print Color::colorize('fg-yellow', "{$section}:") . PHP_EOL; + foreach ($options as $option) { + if (isset($option['spacer'])) { + print PHP_EOL; + } + if (isset($option['text'])) { + print self::LEFT_MARGIN . $option['text'] . PHP_EOL; + } + if (isset($option['arg'])) { + $arg = Color::colorize('fg-green', str_pad($option['arg'], $this->maxArgLength)); + $arg = preg_replace_callback('/(<[^>]+>)/', static function ($matches) { + return Color::colorize('fg-cyan', $matches[0]); + }, $arg); + $desc = explode(PHP_EOL, wordwrap($option['desc'], $this->maxDescLength, PHP_EOL)); + print self::LEFT_MARGIN . $arg . ' ' . $desc[0] . PHP_EOL; + for ($i = 1; $i < count($desc); $i++) { + print str_repeat(' ', $this->maxArgLength + 3) . $desc[$i] . PHP_EOL; + } + } + } + print PHP_EOL; + } } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function count; -use function iterator_count; -use Countable; -use Iterator; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @template-implements Iterator - */ -final class GroupCollectionIterator implements Countable, Iterator -{ - /** - * @var Group[] - */ - private $groups; /** - * @var int + * @psalm-return array> */ - private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\GroupCollection $groups) - { - $this->groups = $groups->asArray(); - } - public function count() : int - { - return iterator_count($this); - } - public function rewind() : void - { - $this->position = 0; - } - public function valid() : bool - { - return $this->position < count($this->groups); - } - public function key() : int - { - return $this->position; - } - public function current() : \PHPUnit\TextUI\XmlConfiguration\Group + private function elements(): array { - return $this->groups[$this->position]; - } - public function next() : void - { - $this->position++; + $elements = ['Usage' => [['text' => 'phpunit [options] UnitTest.php'], ['text' => 'phpunit [options] ']], 'Code Coverage Options' => [['arg' => '--coverage-clover ', 'desc' => 'Generate code coverage report in Clover XML format'], ['arg' => '--coverage-cobertura ', 'desc' => 'Generate code coverage report in Cobertura XML format'], ['arg' => '--coverage-crap4j ', 'desc' => 'Generate code coverage report in Crap4J XML format'], ['arg' => '--coverage-html ', 'desc' => 'Generate code coverage report in HTML format'], ['arg' => '--coverage-php ', 'desc' => 'Export PHP_CodeCoverage object to file'], ['arg' => '--coverage-text=', 'desc' => 'Generate code coverage report in text format [default: standard output]'], ['arg' => '--coverage-xml ', 'desc' => 'Generate code coverage report in PHPUnit XML format'], ['arg' => '--coverage-cache ', 'desc' => 'Cache static analysis results'], ['arg' => '--warm-coverage-cache', 'desc' => 'Warm static analysis cache'], ['arg' => '--coverage-filter ', 'desc' => 'Include in code coverage analysis'], ['arg' => '--path-coverage', 'desc' => 'Perform path coverage analysis'], ['arg' => '--disable-coverage-ignore', 'desc' => 'Disable annotations for ignoring code coverage'], ['arg' => '--no-coverage', 'desc' => 'Ignore code coverage configuration']], 'Logging Options' => [['arg' => '--log-junit ', 'desc' => 'Log test execution in JUnit XML format to file'], ['arg' => '--log-teamcity ', 'desc' => 'Log test execution in TeamCity format to file'], ['arg' => '--testdox-html ', 'desc' => 'Write agile documentation in HTML format to file'], ['arg' => '--testdox-text ', 'desc' => 'Write agile documentation in Text format to file'], ['arg' => '--testdox-xml ', 'desc' => 'Write agile documentation in XML format to file'], ['arg' => '--reverse-list', 'desc' => 'Print defects in reverse order'], ['arg' => '--no-logging', 'desc' => 'Ignore logging configuration']], 'Test Selection Options' => [['arg' => '--list-suites', 'desc' => 'List available test suites'], ['arg' => '--testsuite ', 'desc' => 'Filter which testsuite to run'], ['arg' => '--list-groups', 'desc' => 'List available test groups'], ['arg' => '--group ', 'desc' => 'Only runs tests from the specified group(s)'], ['arg' => '--exclude-group ', 'desc' => 'Exclude tests from the specified group(s)'], ['arg' => '--covers ', 'desc' => 'Only runs tests annotated with "@covers "'], ['arg' => '--uses ', 'desc' => 'Only runs tests annotated with "@uses "'], ['arg' => '--list-tests', 'desc' => 'List available tests'], ['arg' => '--list-tests-xml ', 'desc' => 'List available tests in XML format'], ['arg' => '--filter ', 'desc' => 'Filter which tests to run'], ['arg' => '--test-suffix ', 'desc' => 'Only search for test in files with specified suffix(es). Default: Test.php,.phpt']], 'Test Execution Options' => [['arg' => '--dont-report-useless-tests', 'desc' => 'Do not report tests that do not test anything'], ['arg' => '--strict-coverage', 'desc' => 'Be strict about @covers annotation usage'], ['arg' => '--strict-global-state', 'desc' => 'Be strict about changes to global state'], ['arg' => '--disallow-test-output', 'desc' => 'Be strict about output during tests'], ['arg' => '--disallow-resource-usage', 'desc' => 'Be strict about resource usage during small tests'], ['arg' => '--enforce-time-limit', 'desc' => 'Enforce time limit based on test size'], ['arg' => '--default-time-limit ', 'desc' => 'Timeout in seconds for tests without @small, @medium or @large'], ['arg' => '--disallow-todo-tests', 'desc' => 'Disallow @todo-annotated tests'], ['spacer' => ''], ['arg' => '--process-isolation', 'desc' => 'Run each test in a separate PHP process'], ['arg' => '--globals-backup', 'desc' => 'Backup and restore $GLOBALS for each test'], ['arg' => '--static-backup', 'desc' => 'Backup and restore static attributes for each test'], ['spacer' => ''], ['arg' => '--colors ', 'desc' => 'Use colors in output ("never", "auto" or "always")'], ['arg' => '--columns ', 'desc' => 'Number of columns to use for progress output'], ['arg' => '--columns max', 'desc' => 'Use maximum number of columns for progress output'], ['arg' => '--stderr', 'desc' => 'Write to STDERR instead of STDOUT'], ['arg' => '--stop-on-defect', 'desc' => 'Stop execution upon first not-passed test'], ['arg' => '--stop-on-error', 'desc' => 'Stop execution upon first error'], ['arg' => '--stop-on-failure', 'desc' => 'Stop execution upon first error or failure'], ['arg' => '--stop-on-warning', 'desc' => 'Stop execution upon first warning'], ['arg' => '--stop-on-risky', 'desc' => 'Stop execution upon first risky test'], ['arg' => '--stop-on-skipped', 'desc' => 'Stop execution upon first skipped test'], ['arg' => '--stop-on-incomplete', 'desc' => 'Stop execution upon first incomplete test'], ['arg' => '--fail-on-incomplete', 'desc' => 'Treat incomplete tests as failures'], ['arg' => '--fail-on-risky', 'desc' => 'Treat risky tests as failures'], ['arg' => '--fail-on-skipped', 'desc' => 'Treat skipped tests as failures'], ['arg' => '--fail-on-warning', 'desc' => 'Treat tests with warnings as failures'], ['arg' => '-v|--verbose', 'desc' => 'Output more verbose information'], ['arg' => '--debug', 'desc' => 'Display debugging information'], ['spacer' => ''], ['arg' => '--repeat ', 'desc' => 'Runs the test(s) repeatedly'], ['arg' => '--teamcity', 'desc' => 'Report test execution progress in TeamCity format'], ['arg' => '--testdox', 'desc' => 'Report test execution progress in TestDox format'], ['arg' => '--testdox-group', 'desc' => 'Only include tests from the specified group(s)'], ['arg' => '--testdox-exclude-group', 'desc' => 'Exclude tests from the specified group(s)'], ['arg' => '--no-interaction', 'desc' => 'Disable TestDox progress animation'], ['arg' => '--printer ', 'desc' => 'TestListener implementation to use'], ['spacer' => ''], ['arg' => '--order-by ', 'desc' => 'Run tests in order: default|defects|duration|no-depends|random|reverse|size'], ['arg' => '--random-order-seed ', 'desc' => 'Use a specific random seed for random order'], ['arg' => '--cache-result', 'desc' => 'Write test results to cache file'], ['arg' => '--do-not-cache-result', 'desc' => 'Do not write test results to cache file']], 'Configuration Options' => [['arg' => '--prepend ', 'desc' => 'A PHP script that is included as early as possible'], ['arg' => '--bootstrap ', 'desc' => 'A PHP script that is included before the tests run'], ['arg' => '-c|--configuration ', 'desc' => 'Read configuration from XML file'], ['arg' => '--no-configuration', 'desc' => 'Ignore default configuration file (phpunit.xml)'], ['arg' => '--extensions ', 'desc' => 'A comma separated list of PHPUnit extensions to load'], ['arg' => '--no-extensions', 'desc' => 'Do not load PHPUnit extensions'], ['arg' => '--include-path ', 'desc' => 'Prepend PHP\'s include_path with given path(s)'], ['arg' => '-d ', 'desc' => 'Sets a php.ini value'], ['arg' => '--cache-result-file ', 'desc' => 'Specify result cache path and filename'], ['arg' => '--generate-configuration', 'desc' => 'Generate configuration file with suggested settings'], ['arg' => '--migrate-configuration', 'desc' => 'Migrate configuration file to current format']]]; + if (defined('__PHPUNIT_PHAR__')) { + $elements['PHAR Options'] = [['arg' => '--manifest', 'desc' => 'Print Software Bill of Materials (SBOM) in plain-text format'], ['arg' => '--sbom', 'desc' => 'Print Software Bill of Materials (SBOM) in CycloneDX XML format'], ['arg' => '--composer-lock', 'desc' => 'Print composer.lock file used to build the PHAR']]; + } + $elements['Miscellaneous Options'] = [['arg' => '-h|--help', 'desc' => 'Prints this usage information'], ['arg' => '--version', 'desc' => 'Prints the version and exits'], ['arg' => '--atleast-version ', 'desc' => 'Checks that version is greater than min and exits'], ['arg' => '--check-version', 'desc' => 'Checks whether PHPUnit is the latest version and exits']]; + return $elements; } } include = $include; - $this->exclude = $exclude; - } - public function hasInclude() : bool - { - return !$this->include->isEmpty(); - } - public function include() : \PHPUnit\TextUI\XmlConfiguration\GroupCollection - { - return $this->include; - } - public function hasExclude() : bool - { - return !$this->exclude->isEmpty(); - } - public function exclude() : \PHPUnit\TextUI\XmlConfiguration\GroupCollection - { - return $this->exclude; - } + public function printResult(TestResult $result): void; + public function write(string $buffer): void; } loadFile($filename, \false, \true, \true); - } catch (XmlException $e) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception($e->getMessage(), $e->getCode(), $e); - } - $xpath = new DOMXPath($document); - try { - $xsdFilename = (new SchemaFinder())->find(Version::series()); - } catch (XmlException $e) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception($e->getMessage(), $e->getCode(), $e); + if ($filter === null) { + $filter = new CodeCoverageFilter(); } - return new \PHPUnit\TextUI\XmlConfiguration\Configuration($filename, (new Validator())->validate($document, $xsdFilename), $this->extensions($filename, $xpath), $this->codeCoverage($filename, $xpath, $document), $this->groups($xpath), $this->testdoxGroups($xpath), $this->listeners($filename, $xpath), $this->logging($filename, $xpath), $this->php($filename, $xpath), $this->phpunit($filename, $document), $this->testSuite($filename, $xpath)); + $this->codeCoverageFilter = $filter; + $this->loader = $loader; + $this->timer = new Timer(); } - public function logging(string $filename, DOMXPath $xpath) : Logging + /** + * @throws \PHPUnit\Runner\Exception + * @throws Exception + * @throws XmlConfiguration\Exception + */ + public function run(TestSuite $suite, array $arguments = [], array $warnings = [], bool $exit = \true): TestResult { - if ($xpath->query('logging/log')->length !== 0) { - return $this->legacyLogging($filename, $xpath); + if (isset($arguments['configuration'])) { + $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration']; } - $junit = null; - $element = $this->element($xpath, 'logging/junit'); - if ($element) { - $junit = new Junit(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + $this->handleConfiguration($arguments); + $warnings = array_merge($warnings, $arguments['warnings']); + if (is_int($arguments['columns']) && $arguments['columns'] < 16) { + $arguments['columns'] = 16; + $tooFewColumnsRequested = \true; } - $text = null; - $element = $this->element($xpath, 'logging/text'); - if ($element) { - $text = new Text(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + if (isset($arguments['bootstrap'])) { + $GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap']; } - $teamCity = null; - $element = $this->element($xpath, 'logging/teamcity'); - if ($element) { - $teamCity = new TeamCity(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + if ($arguments['backupGlobals'] === \true) { + $suite->setBackupGlobals(\true); } - $testDoxHtml = null; - $element = $this->element($xpath, 'logging/testdoxHtml'); - if ($element) { - $testDoxHtml = new TestDoxHtml(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + if ($arguments['backupStaticAttributes'] === \true) { + $suite->setBackupStaticAttributes(\true); } - $testDoxText = null; - $element = $this->element($xpath, 'logging/testdoxText'); - if ($element) { - $testDoxText = new TestDoxText(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + if ($arguments['beStrictAboutChangesToGlobalState'] === \true) { + $suite->setBeStrictAboutChangesToGlobalState(\true); } - $testDoxXml = null; - $element = $this->element($xpath, 'logging/testdoxXml'); - if ($element) { - $testDoxXml = new TestDoxXml(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + if ($arguments['executionOrder'] === TestSuiteSorter::ORDER_RANDOMIZED) { + mt_srand($arguments['randomOrderSeed']); } - return new Logging($junit, $text, $teamCity, $testDoxHtml, $testDoxText, $testDoxXml); - } - public function legacyLogging(string $filename, DOMXPath $xpath) : Logging - { - $junit = null; - $teamCity = null; - $testDoxHtml = null; - $testDoxText = null; - $testDoxXml = null; - $text = null; - foreach ($xpath->query('logging/log') as $log) { - assert($log instanceof DOMElement); - $type = (string) $log->getAttribute('type'); - $target = (string) $log->getAttribute('target'); - if (!$target) { - continue; + if ($arguments['cacheResult']) { + if (!isset($arguments['cacheResultFile'])) { + if (isset($arguments['configurationObject'])) { + assert($arguments['configurationObject'] instanceof Configuration); + $cacheLocation = $arguments['configurationObject']->filename(); + } else { + $cacheLocation = $_SERVER['PHP_SELF']; + } + $arguments['cacheResultFile'] = null; + $cacheResultFile = realpath($cacheLocation); + if ($cacheResultFile !== \false) { + $arguments['cacheResultFile'] = dirname($cacheResultFile); + } } - $target = $this->toAbsolutePath($filename, $target); - switch ($type) { - case 'plain': - $text = new Text(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - case 'junit': - $junit = new Junit(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - case 'teamcity': - $teamCity = new TeamCity(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - case 'testdox-html': - $testDoxHtml = new TestDoxHtml(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - case 'testdox-text': - $testDoxText = new TestDoxText(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - case 'testdox-xml': - $testDoxXml = new TestDoxXml(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - } - } - return new Logging($junit, $text, $teamCity, $testDoxHtml, $testDoxText, $testDoxXml); - } - private function extensions(string $filename, DOMXPath $xpath) : \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection - { - $extensions = []; - foreach ($xpath->query('extensions/extension') as $extension) { - assert($extension instanceof DOMElement); - $extensions[] = $this->getElementConfigurationParameters($filename, $extension); - } - return \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection::fromArray($extensions); - } - private function getElementConfigurationParameters(string $filename, DOMElement $element) : \PHPUnit\TextUI\XmlConfiguration\Extension - { - /** @psalm-var class-string $class */ - $class = (string) $element->getAttribute('class'); - $file = ''; - $arguments = $this->getConfigurationArguments($filename, $element->childNodes); - if ($element->getAttribute('file')) { - $file = $this->toAbsolutePath($filename, (string) $element->getAttribute('file'), \true); - } - return new \PHPUnit\TextUI\XmlConfiguration\Extension($class, $file, $arguments); - } - private function toAbsolutePath(string $filename, string $path, bool $useIncludePath = \false) : string - { - $path = trim($path); - if (strpos($path, '/') === 0) { - return $path; + $cache = new DefaultTestResultCache($arguments['cacheResultFile']); + $this->addExtension(new ResultCacheExtension($cache)); } - // Matches the following on Windows: - // - \\NetworkComputer\Path - // - \\.\D: - // - \\.\c: - // - C:\Windows - // - C:\windows - // - C:/windows - // - c:/windows - if (defined('PHP_WINDOWS_VERSION_BUILD') && ($path[0] === '\\' || strlen($path) >= 3 && preg_match('#^[A-Z]\\:[/\\\\]#i', substr($path, 0, 3)))) { - return $path; + if ($arguments['executionOrder'] !== TestSuiteSorter::ORDER_DEFAULT || $arguments['executionOrderDefects'] !== TestSuiteSorter::ORDER_DEFAULT || $arguments['resolveDependencies']) { + $cache = $cache ?? new NullTestResultCache(); + $cache->load(); + $sorter = new TestSuiteSorter($cache); + $sorter->reorderTestsInSuite($suite, $arguments['executionOrder'], $arguments['resolveDependencies'], $arguments['executionOrderDefects']); + $originalExecutionOrder = $sorter->getOriginalExecutionOrder(); + unset($sorter); } - if (strpos($path, '://') !== \false) { - return $path; + if (is_int($arguments['repeat']) && $arguments['repeat'] > 0) { + $_suite = new TestSuite(); + /* @noinspection PhpUnusedLocalVariableInspection */ + foreach (range(1, $arguments['repeat']) as $step) { + $_suite->addTest($suite); + } + $suite = $_suite; + unset($_suite); } - $file = dirname($filename) . DIRECTORY_SEPARATOR . $path; - if ($useIncludePath && !is_file($file)) { - $includePathFile = stream_resolve_include_path($path); - if ($includePathFile) { - $file = $includePathFile; + $result = $this->createTestResult(); + $listener = new TestListenerAdapter(); + $listenerNeeded = \false; + foreach ($this->extensions as $extension) { + if ($extension instanceof TestHook) { + $listener->add($extension); + $listenerNeeded = \true; } } - return $file; - } - private function getConfigurationArguments(string $filename, DOMNodeList $nodes) : array - { - $arguments = []; - if ($nodes->length === 0) { - return $arguments; + if ($listenerNeeded) { + $result->addListener($listener); } - foreach ($nodes as $node) { - if (!$node instanceof DOMElement) { - continue; - } - if ($node->tagName !== 'arguments') { - continue; - } - foreach ($node->childNodes as $argument) { - if (!$argument instanceof DOMElement) { - continue; - } - if ($argument->tagName === 'file' || $argument->tagName === 'directory') { - $arguments[] = $this->toAbsolutePath($filename, (string) $argument->textContent); - } else { - $arguments[] = Xml::xmlToVariable($argument); - } - } + unset($listener, $listenerNeeded); + if ($arguments['convertDeprecationsToExceptions']) { + $result->convertDeprecationsToExceptions(\true); } - return $arguments; - } - private function codeCoverage(string $filename, DOMXPath $xpath, DOMDocument $document) : CodeCoverage - { - if ($xpath->query('filter/whitelist')->length !== 0) { - return $this->legacyCodeCoverage($filename, $xpath, $document); + if (!$arguments['convertErrorsToExceptions']) { + $result->convertErrorsToExceptions(\false); } - $cacheDirectory = null; - $pathCoverage = \false; - $includeUncoveredFiles = \true; - $processUncoveredFiles = \false; - $ignoreDeprecatedCodeUnits = \false; - $disableCodeCoverageIgnore = \false; - $element = $this->element($xpath, 'coverage'); - if ($element) { - $cacheDirectory = $this->getStringAttribute($element, 'cacheDirectory'); - if ($cacheDirectory !== null) { - $cacheDirectory = new \PHPUnit\TextUI\XmlConfiguration\Directory($this->toAbsolutePath($filename, $cacheDirectory)); - } - $pathCoverage = $this->getBooleanAttribute($element, 'pathCoverage', \false); - $includeUncoveredFiles = $this->getBooleanAttribute($element, 'includeUncoveredFiles', \true); - $processUncoveredFiles = $this->getBooleanAttribute($element, 'processUncoveredFiles', \false); - $ignoreDeprecatedCodeUnits = $this->getBooleanAttribute($element, 'ignoreDeprecatedCodeUnits', \false); - $disableCodeCoverageIgnore = $this->getBooleanAttribute($element, 'disableCodeCoverageIgnore', \false); + if (!$arguments['convertNoticesToExceptions']) { + $result->convertNoticesToExceptions(\false); } - $clover = null; - $element = $this->element($xpath, 'coverage/report/clover'); - if ($element) { - $clover = new Clover(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + if (!$arguments['convertWarningsToExceptions']) { + $result->convertWarningsToExceptions(\false); } - $cobertura = null; - $element = $this->element($xpath, 'coverage/report/cobertura'); - if ($element) { - $cobertura = new Cobertura(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + if ($arguments['stopOnError']) { + $result->stopOnError(\true); } - $crap4j = null; - $element = $this->element($xpath, 'coverage/report/crap4j'); - if ($element) { - $crap4j = new Crap4j(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))), $this->getIntegerAttribute($element, 'threshold', 30)); + if ($arguments['stopOnFailure']) { + $result->stopOnFailure(\true); } - $html = null; - $element = $this->element($xpath, 'coverage/report/html'); - if ($element) { - $html = new CodeCoverageHtml(new \PHPUnit\TextUI\XmlConfiguration\Directory($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputDirectory'))), $this->getIntegerAttribute($element, 'lowUpperBound', 50), $this->getIntegerAttribute($element, 'highLowerBound', 90)); + if ($arguments['stopOnWarning']) { + $result->stopOnWarning(\true); } - $php = null; - $element = $this->element($xpath, 'coverage/report/php'); - if ($element) { - $php = new CodeCoveragePhp(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + if ($arguments['stopOnIncomplete']) { + $result->stopOnIncomplete(\true); } - $text = null; - $element = $this->element($xpath, 'coverage/report/text'); - if ($element) { - $text = new CodeCoverageText(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))), $this->getBooleanAttribute($element, 'showUncoveredFiles', \false), $this->getBooleanAttribute($element, 'showOnlySummary', \false)); + if ($arguments['stopOnRisky']) { + $result->stopOnRisky(\true); } - $xml = null; - $element = $this->element($xpath, 'coverage/report/xml'); - if ($element) { - $xml = new CodeCoverageXml(new \PHPUnit\TextUI\XmlConfiguration\Directory($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputDirectory')))); + if ($arguments['stopOnSkipped']) { + $result->stopOnSkipped(\true); } - return new CodeCoverage($cacheDirectory, $this->readFilterDirectories($filename, $xpath, 'coverage/include/directory'), $this->readFilterFiles($filename, $xpath, 'coverage/include/file'), $this->readFilterDirectories($filename, $xpath, 'coverage/exclude/directory'), $this->readFilterFiles($filename, $xpath, 'coverage/exclude/file'), $pathCoverage, $includeUncoveredFiles, $processUncoveredFiles, $ignoreDeprecatedCodeUnits, $disableCodeCoverageIgnore, $clover, $cobertura, $crap4j, $html, $php, $text, $xml); - } - /** - * @deprecated - */ - private function legacyCodeCoverage(string $filename, DOMXPath $xpath, DOMDocument $document) : CodeCoverage - { - $ignoreDeprecatedCodeUnits = $this->getBooleanAttribute($document->documentElement, 'ignoreDeprecatedCodeUnitsFromCodeCoverage', \false); - $disableCodeCoverageIgnore = $this->getBooleanAttribute($document->documentElement, 'disableCodeCoverageIgnore', \false); - $includeUncoveredFiles = \true; - $processUncoveredFiles = \false; - $element = $this->element($xpath, 'filter/whitelist'); - if ($element) { - if ($element->hasAttribute('addUncoveredFilesFromWhitelist')) { - $includeUncoveredFiles = (bool) $this->getBoolean((string) $element->getAttribute('addUncoveredFilesFromWhitelist'), \true); - } - if ($element->hasAttribute('processUncoveredFilesFromWhitelist')) { - $processUncoveredFiles = (bool) $this->getBoolean((string) $element->getAttribute('processUncoveredFilesFromWhitelist'), \false); - } + if ($arguments['stopOnDefect']) { + $result->stopOnDefect(\true); } - $clover = null; - $cobertura = null; - $crap4j = null; - $html = null; - $php = null; - $text = null; - $xml = null; - foreach ($xpath->query('logging/log') as $log) { - assert($log instanceof DOMElement); - $type = (string) $log->getAttribute('type'); - $target = (string) $log->getAttribute('target'); - if (!$target) { - continue; - } - $target = $this->toAbsolutePath($filename, $target); - switch ($type) { - case 'coverage-clover': - $clover = new Clover(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - case 'coverage-cobertura': - $cobertura = new Cobertura(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - case 'coverage-crap4j': - $crap4j = new Crap4j(new \PHPUnit\TextUI\XmlConfiguration\File($target), $this->getIntegerAttribute($log, 'threshold', 30)); - break; - case 'coverage-html': - $html = new CodeCoverageHtml(new \PHPUnit\TextUI\XmlConfiguration\Directory($target), $this->getIntegerAttribute($log, 'lowUpperBound', 50), $this->getIntegerAttribute($log, 'highLowerBound', 90)); - break; - case 'coverage-php': - $php = new CodeCoveragePhp(new \PHPUnit\TextUI\XmlConfiguration\File($target)); - break; - case 'coverage-text': - $text = new CodeCoverageText(new \PHPUnit\TextUI\XmlConfiguration\File($target), $this->getBooleanAttribute($log, 'showUncoveredFiles', \false), $this->getBooleanAttribute($log, 'showOnlySummary', \false)); - break; - case 'coverage-xml': - $xml = new CodeCoverageXml(new \PHPUnit\TextUI\XmlConfiguration\Directory($target)); - break; + if ($arguments['registerMockObjectsFromTestArgumentsRecursively']) { + $result->setRegisterMockObjectsFromTestArgumentsRecursively(\true); + } + if ($this->printer === null) { + if (isset($arguments['printer'])) { + if ($arguments['printer'] instanceof \PHPUnit\TextUI\ResultPrinter) { + $this->printer = $arguments['printer']; + } elseif (is_string($arguments['printer']) && class_exists($arguments['printer'], \false)) { + try { + $reflector = new ReflectionClass($arguments['printer']); + if ($reflector->implementsInterface(\PHPUnit\TextUI\ResultPrinter::class)) { + $this->printer = $this->createPrinter($arguments['printer'], $arguments); + } + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + } + } else { + $this->printer = $this->createPrinter(\PHPUnit\TextUI\DefaultResultPrinter::class, $arguments); } } - return new CodeCoverage(null, $this->readFilterDirectories($filename, $xpath, 'filter/whitelist/directory'), $this->readFilterFiles($filename, $xpath, 'filter/whitelist/file'), $this->readFilterDirectories($filename, $xpath, 'filter/whitelist/exclude/directory'), $this->readFilterFiles($filename, $xpath, 'filter/whitelist/exclude/file'), \false, $includeUncoveredFiles, $processUncoveredFiles, $ignoreDeprecatedCodeUnits, $disableCodeCoverageIgnore, $clover, $cobertura, $crap4j, $html, $php, $text, $xml); - } - /** - * If $value is 'false' or 'true', this returns the value that $value represents. - * Otherwise, returns $default, which may be a string in rare cases. - * - * @see \PHPUnit\TextUI\XmlConfigurationTest::testPHPConfigurationIsReadCorrectly - * - * @param bool|string $default - * - * @return bool|string - */ - private function getBoolean(string $value, $default) - { - if (strtolower($value) === 'false') { - return \false; + if (isset($originalExecutionOrder) && $this->printer instanceof CliTestDoxPrinter) { + assert($this->printer instanceof CliTestDoxPrinter); + $this->printer->setOriginalExecutionOrder($originalExecutionOrder); + $this->printer->setShowProgressAnimation(!$arguments['noInteraction']); } - if (strtolower($value) === 'true') { - return \true; + $this->write(Version::getVersionString() . "\n"); + foreach ($arguments['listeners'] as $listener) { + $result->addListener($listener); } - return $default; - } - private function readFilterDirectories(string $filename, DOMXPath $xpath, string $query) : FilterDirectoryCollection - { - $directories = []; - foreach ($xpath->query($query) as $directoryNode) { - assert($directoryNode instanceof DOMElement); - $directoryPath = (string) $directoryNode->textContent; - if (!$directoryPath) { - continue; - } - $directories[] = new FilterDirectory($this->toAbsolutePath($filename, $directoryPath), $directoryNode->hasAttribute('prefix') ? (string) $directoryNode->getAttribute('prefix') : '', $directoryNode->hasAttribute('suffix') ? (string) $directoryNode->getAttribute('suffix') : '.php', $directoryNode->hasAttribute('group') ? (string) $directoryNode->getAttribute('group') : 'DEFAULT'); + $result->addListener($this->printer); + $coverageFilterFromConfigurationFile = \false; + $coverageFilterFromOption = \false; + $codeCoverageReports = 0; + if (isset($arguments['testdoxHTMLFile'])) { + $result->addListener(new HtmlResultPrinter($arguments['testdoxHTMLFile'], $arguments['testdoxGroups'], $arguments['testdoxExcludeGroups'])); } - return FilterDirectoryCollection::fromArray($directories); - } - private function readFilterFiles(string $filename, DOMXPath $xpath, string $query) : \PHPUnit\TextUI\XmlConfiguration\FileCollection - { - $files = []; - foreach ($xpath->query($query) as $file) { - $filePath = (string) $file->textContent; - if ($filePath) { - $files[] = new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, $filePath)); - } + if (isset($arguments['testdoxTextFile'])) { + $result->addListener(new TextResultPrinter($arguments['testdoxTextFile'], $arguments['testdoxGroups'], $arguments['testdoxExcludeGroups'])); } - return \PHPUnit\TextUI\XmlConfiguration\FileCollection::fromArray($files); - } - private function groups(DOMXPath $xpath) : \PHPUnit\TextUI\XmlConfiguration\Groups - { - return $this->parseGroupConfiguration($xpath, 'groups'); - } - private function testdoxGroups(DOMXPath $xpath) : \PHPUnit\TextUI\XmlConfiguration\Groups - { - return $this->parseGroupConfiguration($xpath, 'testdoxGroups'); - } - private function parseGroupConfiguration(DOMXPath $xpath, string $root) : \PHPUnit\TextUI\XmlConfiguration\Groups - { - $include = []; - $exclude = []; - foreach ($xpath->query($root . '/include/group') as $group) { - $include[] = new \PHPUnit\TextUI\XmlConfiguration\Group((string) $group->textContent); + if (isset($arguments['testdoxXMLFile'])) { + $result->addListener(new XmlResultPrinter($arguments['testdoxXMLFile'])); } - foreach ($xpath->query($root . '/exclude/group') as $group) { - $exclude[] = new \PHPUnit\TextUI\XmlConfiguration\Group((string) $group->textContent); + if (isset($arguments['teamcityLogfile'])) { + $result->addListener(new TeamCity($arguments['teamcityLogfile'])); } - return new \PHPUnit\TextUI\XmlConfiguration\Groups(\PHPUnit\TextUI\XmlConfiguration\GroupCollection::fromArray($include), \PHPUnit\TextUI\XmlConfiguration\GroupCollection::fromArray($exclude)); - } - private function listeners(string $filename, DOMXPath $xpath) : \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection - { - $listeners = []; - foreach ($xpath->query('listeners/listener') as $listener) { - assert($listener instanceof DOMElement); - $listeners[] = $this->getElementConfigurationParameters($filename, $listener); + if (isset($arguments['junitLogfile'])) { + $result->addListener(new JUnit($arguments['junitLogfile'], $arguments['reportUselessTests'])); } - return \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection::fromArray($listeners); - } - private function getBooleanAttribute(DOMElement $element, string $attribute, bool $default) : bool - { - if (!$element->hasAttribute($attribute)) { - return $default; + if (isset($arguments['coverageClover'])) { + $codeCoverageReports++; } - return (bool) $this->getBoolean((string) $element->getAttribute($attribute), \false); - } - private function getIntegerAttribute(DOMElement $element, string $attribute, int $default) : int - { - if (!$element->hasAttribute($attribute)) { - return $default; + if (isset($arguments['coverageCobertura'])) { + $codeCoverageReports++; } - return $this->getInteger((string) $element->getAttribute($attribute), $default); - } - private function getStringAttribute(DOMElement $element, string $attribute) : ?string - { - if (!$element->hasAttribute($attribute)) { - return null; + if (isset($arguments['coverageCrap4J'])) { + $codeCoverageReports++; } - return (string) $element->getAttribute($attribute); - } - private function getInteger(string $value, int $default) : int - { - if (is_numeric($value)) { - return (int) $value; + if (isset($arguments['coverageHtml'])) { + $codeCoverageReports++; } - return $default; - } - private function php(string $filename, DOMXPath $xpath) : \PHPUnit\TextUI\XmlConfiguration\Php - { - $includePaths = []; - foreach ($xpath->query('php/includePath') as $includePath) { - $path = (string) $includePath->textContent; - if ($path) { - $includePaths[] = new \PHPUnit\TextUI\XmlConfiguration\Directory($this->toAbsolutePath($filename, $path)); - } + if (isset($arguments['coveragePHP'])) { + $codeCoverageReports++; } - $iniSettings = []; - foreach ($xpath->query('php/ini') as $ini) { - assert($ini instanceof DOMElement); - $iniSettings[] = new \PHPUnit\TextUI\XmlConfiguration\IniSetting((string) $ini->getAttribute('name'), (string) $ini->getAttribute('value')); + if (isset($arguments['coverageText'])) { + $codeCoverageReports++; } - $constants = []; - foreach ($xpath->query('php/const') as $const) { - assert($const instanceof DOMElement); - $value = (string) $const->getAttribute('value'); - $constants[] = new \PHPUnit\TextUI\XmlConfiguration\Constant((string) $const->getAttribute('name'), $this->getBoolean($value, $value)); + if (isset($arguments['coverageXml'])) { + $codeCoverageReports++; } - $variables = ['var' => [], 'env' => [], 'post' => [], 'get' => [], 'cookie' => [], 'server' => [], 'files' => [], 'request' => []]; - foreach (['var', 'env', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) { - foreach ($xpath->query('php/' . $array) as $var) { - assert($var instanceof DOMElement); - $name = (string) $var->getAttribute('name'); - $value = (string) $var->getAttribute('value'); - $force = \false; - $verbatim = \false; - if ($var->hasAttribute('force')) { - $force = (bool) $this->getBoolean($var->getAttribute('force'), \false); - } - if ($var->hasAttribute('verbatim')) { - $verbatim = $this->getBoolean($var->getAttribute('verbatim'), \false); + if ($codeCoverageReports > 0 || isset($arguments['xdebugFilterFile'])) { + if (isset($arguments['coverageFilter'])) { + if (!is_array($arguments['coverageFilter'])) { + $coverageFilterDirectories = [$arguments['coverageFilter']]; + } else { + $coverageFilterDirectories = $arguments['coverageFilter']; } - if (!$verbatim) { - $value = $this->getBoolean($value, $value); + foreach ($coverageFilterDirectories as $coverageFilterDirectory) { + $this->codeCoverageFilter->includeDirectory($coverageFilterDirectory); } - $variables[$array][] = new \PHPUnit\TextUI\XmlConfiguration\Variable($name, $value, $force); + $coverageFilterFromOption = \true; } - } - return new \PHPUnit\TextUI\XmlConfiguration\Php(\PHPUnit\TextUI\XmlConfiguration\DirectoryCollection::fromArray($includePaths), \PHPUnit\TextUI\XmlConfiguration\IniSettingCollection::fromArray($iniSettings), \PHPUnit\TextUI\XmlConfiguration\ConstantCollection::fromArray($constants), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['var']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['env']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['post']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['get']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['cookie']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['server']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['files']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['request'])); - } - private function phpunit(string $filename, DOMDocument $document) : \PHPUnit\TextUI\XmlConfiguration\PHPUnit - { - $executionOrder = TestSuiteSorter::ORDER_DEFAULT; - $defectsFirst = \false; - $resolveDependencies = $this->getBooleanAttribute($document->documentElement, 'resolveDependencies', \true); - if ($document->documentElement->hasAttribute('executionOrder')) { - foreach (explode(',', $document->documentElement->getAttribute('executionOrder')) as $order) { - switch ($order) { - case 'default': - $executionOrder = TestSuiteSorter::ORDER_DEFAULT; - $defectsFirst = \false; - $resolveDependencies = \true; - break; - case 'depends': - $resolveDependencies = \true; - break; - case 'no-depends': - $resolveDependencies = \false; - break; - case 'defects': - $defectsFirst = \true; - break; - case 'duration': - $executionOrder = TestSuiteSorter::ORDER_DURATION; - break; - case 'random': - $executionOrder = TestSuiteSorter::ORDER_RANDOMIZED; - break; - case 'reverse': - $executionOrder = TestSuiteSorter::ORDER_REVERSED; - break; - case 'size': - $executionOrder = TestSuiteSorter::ORDER_SIZE; - break; + if (isset($arguments['configurationObject'])) { + assert($arguments['configurationObject'] instanceof Configuration); + $codeCoverageConfiguration = $arguments['configurationObject']->codeCoverage(); + if ($codeCoverageConfiguration->hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport()) { + $coverageFilterFromConfigurationFile = \true; + (new FilterMapper())->map($this->codeCoverageFilter, $codeCoverageConfiguration); } } } - $printerClass = $this->getStringAttribute($document->documentElement, 'printerClass'); - $testdox = $this->getBooleanAttribute($document->documentElement, 'testdox', \false); - $conflictBetweenPrinterClassAndTestdox = \false; - if ($testdox) { - if ($printerClass !== null) { - $conflictBetweenPrinterClassAndTestdox = \true; - } - $printerClass = CliTestDoxPrinter::class; - } - $cacheResultFile = $this->getStringAttribute($document->documentElement, 'cacheResultFile'); - if ($cacheResultFile !== null) { - $cacheResultFile = $this->toAbsolutePath($filename, $cacheResultFile); - } - $bootstrap = $this->getStringAttribute($document->documentElement, 'bootstrap'); - if ($bootstrap !== null) { - $bootstrap = $this->toAbsolutePath($filename, $bootstrap); - } - $extensionsDirectory = $this->getStringAttribute($document->documentElement, 'extensionsDirectory'); - if ($extensionsDirectory !== null) { - $extensionsDirectory = $this->toAbsolutePath($filename, $extensionsDirectory); - } - $testSuiteLoaderFile = $this->getStringAttribute($document->documentElement, 'testSuiteLoaderFile'); - if ($testSuiteLoaderFile !== null) { - $testSuiteLoaderFile = $this->toAbsolutePath($filename, $testSuiteLoaderFile); - } - $printerFile = $this->getStringAttribute($document->documentElement, 'printerFile'); - if ($printerFile !== null) { - $printerFile = $this->toAbsolutePath($filename, $printerFile); - } - return new \PHPUnit\TextUI\XmlConfiguration\PHPUnit($this->getBooleanAttribute($document->documentElement, 'cacheResult', \true), $cacheResultFile, $this->getColumns($document), $this->getColors($document), $this->getBooleanAttribute($document->documentElement, 'stderr', \false), $this->getBooleanAttribute($document->documentElement, 'noInteraction', \false), $this->getBooleanAttribute($document->documentElement, 'verbose', \false), $this->getBooleanAttribute($document->documentElement, 'reverseDefectList', \false), $this->getBooleanAttribute($document->documentElement, 'convertDeprecationsToExceptions', \false), $this->getBooleanAttribute($document->documentElement, 'convertErrorsToExceptions', \true), $this->getBooleanAttribute($document->documentElement, 'convertNoticesToExceptions', \true), $this->getBooleanAttribute($document->documentElement, 'convertWarningsToExceptions', \true), $this->getBooleanAttribute($document->documentElement, 'forceCoversAnnotation', \false), $bootstrap, $this->getBooleanAttribute($document->documentElement, 'processIsolation', \false), $this->getBooleanAttribute($document->documentElement, 'failOnEmptyTestSuite', \false), $this->getBooleanAttribute($document->documentElement, 'failOnIncomplete', \false), $this->getBooleanAttribute($document->documentElement, 'failOnRisky', \false), $this->getBooleanAttribute($document->documentElement, 'failOnSkipped', \false), $this->getBooleanAttribute($document->documentElement, 'failOnWarning', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnDefect', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnError', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnFailure', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnWarning', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnIncomplete', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnRisky', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnSkipped', \false), $extensionsDirectory, $this->getStringAttribute($document->documentElement, 'testSuiteLoaderClass'), $testSuiteLoaderFile, $printerClass, $printerFile, $this->getBooleanAttribute($document->documentElement, 'beStrictAboutChangesToGlobalState', \false), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutOutputDuringTests', \false), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutResourceUsageDuringSmallTests', \false), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutTestsThatDoNotTestAnything', \true), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutTodoAnnotatedTests', \false), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutCoversAnnotation', \false), $this->getBooleanAttribute($document->documentElement, 'enforceTimeLimit', \false), $this->getIntegerAttribute($document->documentElement, 'defaultTimeLimit', 1), $this->getIntegerAttribute($document->documentElement, 'timeoutForSmallTests', 1), $this->getIntegerAttribute($document->documentElement, 'timeoutForMediumTests', 10), $this->getIntegerAttribute($document->documentElement, 'timeoutForLargeTests', 60), $this->getStringAttribute($document->documentElement, 'defaultTestSuite'), $executionOrder, $resolveDependencies, $defectsFirst, $this->getBooleanAttribute($document->documentElement, 'backupGlobals', \false), $this->getBooleanAttribute($document->documentElement, 'backupStaticAttributes', \false), $this->getBooleanAttribute($document->documentElement, 'registerMockObjectsFromTestArgumentsRecursively', \false), $conflictBetweenPrinterClassAndTestdox); - } - private function getColors(DOMDocument $document) : string - { - $colors = DefaultResultPrinter::COLOR_DEFAULT; - if ($document->documentElement->hasAttribute('colors')) { - /* only allow boolean for compatibility with previous versions - 'always' only allowed from command line */ - if ($this->getBoolean($document->documentElement->getAttribute('colors'), \false)) { - $colors = DefaultResultPrinter::COLOR_AUTO; - } else { - $colors = DefaultResultPrinter::COLOR_NEVER; - } - } - return $colors; - } - /** - * @return int|string - */ - private function getColumns(DOMDocument $document) - { - $columns = 80; - if ($document->documentElement->hasAttribute('columns')) { - $columns = (string) $document->documentElement->getAttribute('columns'); - if ($columns !== 'max') { - $columns = $this->getInteger($columns, 80); + if ($codeCoverageReports > 0) { + try { + if (isset($codeCoverageConfiguration) && ($codeCoverageConfiguration->pathCoverage() || isset($arguments['pathCoverage']) && $arguments['pathCoverage'] === \true)) { + $codeCoverageDriver = (new Selector())->forLineAndPathCoverage($this->codeCoverageFilter); + } else { + $codeCoverageDriver = (new Selector())->forLineCoverage($this->codeCoverageFilter); + } + $codeCoverage = new CodeCoverage($codeCoverageDriver, $this->codeCoverageFilter); + if (isset($codeCoverageConfiguration) && $codeCoverageConfiguration->hasCacheDirectory()) { + $codeCoverage->cacheStaticAnalysis($codeCoverageConfiguration->cacheDirectory()->path()); + } + if (isset($arguments['coverageCacheDirectory'])) { + $codeCoverage->cacheStaticAnalysis($arguments['coverageCacheDirectory']); + } + $codeCoverage->excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck(Comparator::class); + if ($arguments['strictCoverage']) { + $codeCoverage->enableCheckForUnintentionallyCoveredCode(); + } + if (isset($arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'])) { + if ($arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage']) { + $codeCoverage->ignoreDeprecatedCode(); + } else { + $codeCoverage->doNotIgnoreDeprecatedCode(); + } + } + if (isset($arguments['disableCodeCoverageIgnore'])) { + if ($arguments['disableCodeCoverageIgnore']) { + $codeCoverage->disableAnnotationsForIgnoringCode(); + } else { + $codeCoverage->enableAnnotationsForIgnoringCode(); + } + } + if (isset($arguments['configurationObject'])) { + $codeCoverageConfiguration = $arguments['configurationObject']->codeCoverage(); + if ($codeCoverageConfiguration->hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport()) { + if ($codeCoverageConfiguration->includeUncoveredFiles()) { + $codeCoverage->includeUncoveredFiles(); + } else { + $codeCoverage->excludeUncoveredFiles(); + } + if ($codeCoverageConfiguration->processUncoveredFiles()) { + $codeCoverage->processUncoveredFiles(); + } else { + $codeCoverage->doNotProcessUncoveredFiles(); + } + } + } + if ($this->codeCoverageFilter->isEmpty()) { + if (!$coverageFilterFromConfigurationFile && !$coverageFilterFromOption) { + $warnings[] = 'No filter is configured, code coverage will not be processed'; + } else { + $warnings[] = 'Incorrect filter configuration, code coverage will not be processed'; + } + unset($codeCoverage); + } + } catch (CodeCoverageException $e) { + $warnings[] = $e->getMessage(); } } - return $columns; - } - private function testSuite(string $filename, DOMXPath $xpath) : \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection - { - $testSuites = []; - foreach ($this->getTestSuiteElements($xpath) as $element) { - $exclude = []; - foreach ($element->getElementsByTagName('exclude') as $excludeNode) { - $excludeFile = (string) $excludeNode->textContent; - if ($excludeFile) { - $exclude[] = new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, $excludeFile)); + if ($arguments['verbose']) { + if (PHP_SAPI === 'phpdbg') { + $this->writeMessage('Runtime', 'PHPDBG ' . PHP_VERSION); + } else { + $runtime = 'PHP ' . PHP_VERSION; + if (isset($codeCoverageDriver)) { + $runtime .= ' with ' . $codeCoverageDriver->nameAndVersion(); } + $this->writeMessage('Runtime', $runtime); } - $directories = []; - foreach ($element->getElementsByTagName('directory') as $directoryNode) { - assert($directoryNode instanceof DOMElement); - $directory = (string) $directoryNode->textContent; - if (empty($directory)) { - continue; + if (isset($arguments['configurationObject'])) { + assert($arguments['configurationObject'] instanceof Configuration); + $this->writeMessage('Configuration', $arguments['configurationObject']->filename()); + } + foreach ($arguments['loadedExtensions'] as $extension) { + $this->writeMessage('Extension', $extension); + } + foreach ($arguments['notLoadedExtensions'] as $extension) { + $this->writeMessage('Extension', $extension); + } + } + if ($arguments['executionOrder'] === TestSuiteSorter::ORDER_RANDOMIZED) { + $this->writeMessage('Random Seed', (string) $arguments['randomOrderSeed']); + } + if (isset($tooFewColumnsRequested)) { + $warnings[] = 'Less than 16 columns requested, number of columns set to 16'; + } + if ((new Runtime())->discardsComments()) { + $warnings[] = 'opcache.save_comments=0 set; annotations will not work'; + } + if (isset($arguments['conflictBetweenPrinterClassAndTestdox'])) { + $warnings[] = 'Directives printerClass and testdox are mutually exclusive'; + } + $warnings = array_merge($warnings, $suite->warnings()); + sort($warnings); + foreach ($warnings as $warning) { + $this->writeMessage('Warning', $warning); + } + if (isset($arguments['configurationObject'])) { + assert($arguments['configurationObject'] instanceof Configuration); + if ($arguments['configurationObject']->hasValidationErrors()) { + if ((new SchemaDetector())->detect($arguments['configurationObject']->filename())->detected()) { + $this->writeMessage('Warning', 'Your XML configuration validates against a deprecated schema.'); + $this->writeMessage('Suggestion', 'Migrate your XML configuration using "--migrate-configuration"!'); + } else { + $this->write("\n Warning - The configuration file did not pass validation!\n The following problems have been detected:\n"); + $this->write($arguments['configurationObject']->validationErrors()); + $this->write("\n Test results may not be as expected.\n\n"); } - $prefix = ''; - if ($directoryNode->hasAttribute('prefix')) { - $prefix = (string) $directoryNode->getAttribute('prefix'); + } + } + if (isset($arguments['xdebugFilterFile'], $codeCoverageConfiguration)) { + $this->write(PHP_EOL . 'Please note that --dump-xdebug-filter and --prepend are deprecated and will be removed in PHPUnit 10.' . PHP_EOL); + $script = (new XdebugFilterScriptGenerator())->generate($codeCoverageConfiguration); + if ($arguments['xdebugFilterFile'] !== 'php://stdout' && $arguments['xdebugFilterFile'] !== 'php://stderr' && !Filesystem::createDirectory(dirname($arguments['xdebugFilterFile']))) { + $this->write(sprintf('Cannot write Xdebug filter script to %s ' . PHP_EOL, $arguments['xdebugFilterFile'])); + exit(self::EXCEPTION_EXIT); + } + file_put_contents($arguments['xdebugFilterFile'], $script); + $this->write(sprintf('Wrote Xdebug filter script to %s ' . PHP_EOL . PHP_EOL, $arguments['xdebugFilterFile'])); + exit(self::SUCCESS_EXIT); + } + $this->write("\n"); + if (isset($codeCoverage)) { + $result->setCodeCoverage($codeCoverage); + } + $result->beStrictAboutTestsThatDoNotTestAnything($arguments['reportUselessTests']); + $result->beStrictAboutOutputDuringTests($arguments['disallowTestOutput']); + $result->beStrictAboutTodoAnnotatedTests($arguments['disallowTodoAnnotatedTests']); + $result->beStrictAboutResourceUsageDuringSmallTests($arguments['beStrictAboutResourceUsageDuringSmallTests']); + if ($arguments['enforceTimeLimit'] === \true && !(new Invoker())->canInvokeWithTimeout()) { + $this->writeMessage('Error', 'PHP extension pcntl is required for enforcing time limits'); + } + $result->enforceTimeLimit($arguments['enforceTimeLimit']); + $result->setDefaultTimeLimit($arguments['defaultTimeLimit']); + $result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']); + $result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']); + $result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']); + if (isset($arguments['forceCoversAnnotation']) && $arguments['forceCoversAnnotation'] === \true) { + $result->forceCoversAnnotation(); + } + $this->processSuiteFilters($suite, $arguments); + $suite->setRunTestInSeparateProcess($arguments['processIsolation']); + foreach ($this->extensions as $extension) { + if ($extension instanceof BeforeFirstTestHook) { + $extension->executeBeforeFirstTest(); + } + } + $suite->run($result); + foreach ($this->extensions as $extension) { + if ($extension instanceof AfterLastTestHook) { + $extension->executeAfterLastTest(); + } + } + $result->flushListeners(); + $this->printer->printResult($result); + if (isset($codeCoverage)) { + if (isset($arguments['coveragePHP'])) { + $this->codeCoverageGenerationStart('PHP'); + try { + $writer = new PhpReport(); + $writer->process($codeCoverage, $arguments['coveragePHP']); + $this->codeCoverageGenerationSucceeded(); + unset($writer); + } catch (CodeCoverageException $e) { + $this->codeCoverageGenerationFailed($e); } - $suffix = 'Test.php'; - if ($directoryNode->hasAttribute('suffix')) { - $suffix = (string) $directoryNode->getAttribute('suffix'); + } + if (isset($arguments['coverageClover'])) { + $this->codeCoverageGenerationStart('Clover XML'); + try { + $writer = new CloverReport(); + $writer->process($codeCoverage, $arguments['coverageClover']); + $this->codeCoverageGenerationSucceeded(); + unset($writer); + } catch (CodeCoverageException $e) { + $this->codeCoverageGenerationFailed($e); } - $phpVersion = PHP_VERSION; - if ($directoryNode->hasAttribute('phpVersion')) { - $phpVersion = (string) $directoryNode->getAttribute('phpVersion'); + } + if (isset($arguments['coverageCobertura'])) { + $this->codeCoverageGenerationStart('Cobertura XML'); + try { + $writer = new CoberturaReport(); + $writer->process($codeCoverage, $arguments['coverageCobertura']); + $this->codeCoverageGenerationSucceeded(); + unset($writer); + } catch (CodeCoverageException $e) { + $this->codeCoverageGenerationFailed($e); } - $phpVersionOperator = new VersionComparisonOperator('>='); - if ($directoryNode->hasAttribute('phpVersionOperator')) { - $phpVersionOperator = new VersionComparisonOperator((string) $directoryNode->getAttribute('phpVersionOperator')); + } + if (isset($arguments['coverageCrap4J'])) { + $this->codeCoverageGenerationStart('Crap4J XML'); + try { + $writer = new Crap4jReport($arguments['crap4jThreshold']); + $writer->process($codeCoverage, $arguments['coverageCrap4J']); + $this->codeCoverageGenerationSucceeded(); + unset($writer); + } catch (CodeCoverageException $e) { + $this->codeCoverageGenerationFailed($e); } - $directories[] = new \PHPUnit\TextUI\XmlConfiguration\TestDirectory($this->toAbsolutePath($filename, $directory), $prefix, $suffix, $phpVersion, $phpVersionOperator); } - $files = []; - foreach ($element->getElementsByTagName('file') as $fileNode) { - assert($fileNode instanceof DOMElement); - $file = (string) $fileNode->textContent; - if (empty($file)) { - continue; + if (isset($arguments['coverageHtml'])) { + $this->codeCoverageGenerationStart('HTML'); + try { + $writer = new HtmlReport($arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], sprintf(' and PHPUnit %s', Version::id())); + $writer->process($codeCoverage, $arguments['coverageHtml']); + $this->codeCoverageGenerationSucceeded(); + unset($writer); + } catch (CodeCoverageException $e) { + $this->codeCoverageGenerationFailed($e); } - $phpVersion = PHP_VERSION; - if ($fileNode->hasAttribute('phpVersion')) { - $phpVersion = (string) $fileNode->getAttribute('phpVersion'); + } + if (isset($arguments['coverageText'])) { + if ($arguments['coverageText'] === 'php://stdout') { + $outputStream = $this->printer; + $colors = $arguments['colors'] && $arguments['colors'] !== \PHPUnit\TextUI\DefaultResultPrinter::COLOR_NEVER; + } else { + $outputStream = new Printer($arguments['coverageText']); + $colors = \false; } - $phpVersionOperator = new VersionComparisonOperator('>='); - if ($fileNode->hasAttribute('phpVersionOperator')) { - $phpVersionOperator = new VersionComparisonOperator((string) $fileNode->getAttribute('phpVersionOperator')); + $processor = new TextReport($arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], $arguments['coverageTextShowUncoveredFiles'], $arguments['coverageTextShowOnlySummary']); + $outputStream->write($processor->process($codeCoverage, $colors)); + } + if (isset($arguments['coverageXml'])) { + $this->codeCoverageGenerationStart('PHPUnit XML'); + try { + $writer = new XmlReport(Version::id()); + $writer->process($codeCoverage, $arguments['coverageXml']); + $this->codeCoverageGenerationSucceeded(); + unset($writer); + } catch (CodeCoverageException $e) { + $this->codeCoverageGenerationFailed($e); } - $files[] = new \PHPUnit\TextUI\XmlConfiguration\TestFile($this->toAbsolutePath($filename, $file), $phpVersion, $phpVersionOperator); } - $testSuites[] = new TestSuiteConfiguration((string) $element->getAttribute('name'), \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollection::fromArray($directories), \PHPUnit\TextUI\XmlConfiguration\TestFileCollection::fromArray($files), \PHPUnit\TextUI\XmlConfiguration\FileCollection::fromArray($exclude)); - } - return \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection::fromArray($testSuites); - } - /** - * @return DOMElement[] - */ - private function getTestSuiteElements(DOMXPath $xpath) : array - { - /** @var DOMElement[] $elements */ - $elements = []; - $testSuiteNodes = $xpath->query('testsuites/testsuite'); - if ($testSuiteNodes->length === 0) { - $testSuiteNodes = $xpath->query('testsuite'); } - if ($testSuiteNodes->length === 1) { - $element = $testSuiteNodes->item(0); - assert($element instanceof DOMElement); - $elements[] = $element; - } else { - foreach ($testSuiteNodes as $testSuiteNode) { - assert($testSuiteNode instanceof DOMElement); - $elements[] = $testSuiteNode; + if ($exit) { + if (isset($arguments['failOnEmptyTestSuite']) && $arguments['failOnEmptyTestSuite'] === \true && count($result) === 0) { + exit(self::FAILURE_EXIT); + } + if ($result->wasSuccessfulIgnoringWarnings()) { + if ($arguments['failOnRisky'] && !$result->allHarmless()) { + exit(self::FAILURE_EXIT); + } + if ($arguments['failOnWarning'] && $result->warningCount() > 0) { + exit(self::FAILURE_EXIT); + } + if ($arguments['failOnIncomplete'] && $result->notImplementedCount() > 0) { + exit(self::FAILURE_EXIT); + } + if ($arguments['failOnSkipped'] && $result->skippedCount() > 0) { + exit(self::FAILURE_EXIT); + } + exit(self::SUCCESS_EXIT); + } + if ($result->errorCount() > 0) { + exit(self::EXCEPTION_EXIT); + } + if ($result->failureCount() > 0) { + exit(self::FAILURE_EXIT); } } - return $elements; - } - private function element(DOMXPath $xpath, string $element) : ?DOMElement - { - $nodes = $xpath->query($element); - if ($nodes->length === 1) { - $node = $nodes->item(0); - assert($node instanceof DOMElement); - return $node; - } - return null; + return $result; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\Logging; - -use PHPUnit\TextUI\XmlConfiguration\File; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Junit -{ /** - * @var File + * Returns the loader to be used. */ - private $target; - public function __construct(File $target) + public function getLoader(): TestSuiteLoader { - $this->target = $target; + if ($this->loader === null) { + $this->loader = new StandardTestSuiteLoader(); + } + return $this->loader; } - public function target() : File + public function addExtension(Hook $extension): void { - return $this->target; + $this->extensions[] = $extension; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\Logging; - -use PHPUnit\TextUI\XmlConfiguration\Exception; -use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Html as TestDoxHtml; -use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Text as TestDoxText; -use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Xml as TestDoxXml; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Logging -{ - /** - * @var ?Junit - */ - private $junit; - /** - * @var ?Text - */ - private $text; - /** - * @var ?TeamCity - */ - private $teamCity; - /** - * @var ?TestDoxHtml - */ - private $testDoxHtml; - /** - * @var ?TestDoxText - */ - private $testDoxText; /** - * @var ?TestDoxXml + * Override to define how to handle a failed loading of + * a test suite. */ - private $testDoxXml; - public function __construct(?\PHPUnit\TextUI\XmlConfiguration\Logging\Junit $junit, ?\PHPUnit\TextUI\XmlConfiguration\Logging\Text $text, ?\PHPUnit\TextUI\XmlConfiguration\Logging\TeamCity $teamCity, ?TestDoxHtml $testDoxHtml, ?TestDoxText $testDoxText, ?TestDoxXml $testDoxXml) - { - $this->junit = $junit; - $this->text = $text; - $this->teamCity = $teamCity; - $this->testDoxHtml = $testDoxHtml; - $this->testDoxText = $testDoxText; - $this->testDoxXml = $testDoxXml; - } - public function hasJunit() : bool - { - return $this->junit !== null; - } - public function junit() : \PHPUnit\TextUI\XmlConfiguration\Logging\Junit - { - if ($this->junit === null) { - throw new Exception('Logger "JUnit XML" is not configured'); - } - return $this->junit; - } - public function hasText() : bool - { - return $this->text !== null; - } - public function text() : \PHPUnit\TextUI\XmlConfiguration\Logging\Text - { - if ($this->text === null) { - throw new Exception('Logger "Text" is not configured'); - } - return $this->text; - } - public function hasTeamCity() : bool - { - return $this->teamCity !== null; - } - public function teamCity() : \PHPUnit\TextUI\XmlConfiguration\Logging\TeamCity - { - if ($this->teamCity === null) { - throw new Exception('Logger "Team City" is not configured'); - } - return $this->teamCity; - } - public function hasTestDoxHtml() : bool - { - return $this->testDoxHtml !== null; - } - public function testDoxHtml() : TestDoxHtml + protected function runFailed(string $message): void { - if ($this->testDoxHtml === null) { - throw new Exception('Logger "TestDox HTML" is not configured'); - } - return $this->testDoxHtml; + $this->write($message . PHP_EOL); + exit(self::FAILURE_EXIT); } - public function hasTestDoxText() : bool + private function createTestResult(): TestResult { - return $this->testDoxText !== null; + return new TestResult(); } - public function testDoxText() : TestDoxText + private function write(string $buffer): void { - if ($this->testDoxText === null) { - throw new Exception('Logger "TestDox Text" is not configured'); + if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { + $buffer = htmlspecialchars($buffer); } - return $this->testDoxText; - } - public function hasTestDoxXml() : bool - { - return $this->testDoxXml !== null; - } - public function testDoxXml() : TestDoxXml - { - if ($this->testDoxXml === null) { - throw new Exception('Logger "TestDox XML" is not configured'); + if ($this->printer !== null) { + $this->printer->write($buffer); + } else { + print $buffer; } - return $this->testDoxXml; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\Logging; - -use PHPUnit\TextUI\XmlConfiguration\File; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class TeamCity -{ /** - * @var File + * @throws Exception + * @throws XmlConfiguration\Exception */ - private $target; - public function __construct(File $target) - { - $this->target = $target; - } - public function target() : File + private function handleConfiguration(array &$arguments): void { - return $this->target; - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\Logging\TestDox; - -use PHPUnit\TextUI\XmlConfiguration\File; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Html -{ - /** - * @var File - */ - private $target; - public function __construct(File $target) + if (!isset($arguments['configurationObject']) && isset($arguments['configuration'])) { + $arguments['configurationObject'] = (new Loader())->load($arguments['configuration']); + } + if (!isset($arguments['warnings'])) { + $arguments['warnings'] = []; + } + $arguments['debug'] = $arguments['debug'] ?? \false; + $arguments['filter'] = $arguments['filter'] ?? \false; + $arguments['listeners'] = $arguments['listeners'] ?? []; + if (isset($arguments['configurationObject'])) { + (new PhpHandler())->handle($arguments['configurationObject']->php()); + $codeCoverageConfiguration = $arguments['configurationObject']->codeCoverage(); + if (!isset($arguments['noCoverage'])) { + if (!isset($arguments['coverageClover']) && $codeCoverageConfiguration->hasClover()) { + $arguments['coverageClover'] = $codeCoverageConfiguration->clover()->target()->path(); + } + if (!isset($arguments['coverageCobertura']) && $codeCoverageConfiguration->hasCobertura()) { + $arguments['coverageCobertura'] = $codeCoverageConfiguration->cobertura()->target()->path(); + } + if (!isset($arguments['coverageCrap4J']) && $codeCoverageConfiguration->hasCrap4j()) { + $arguments['coverageCrap4J'] = $codeCoverageConfiguration->crap4j()->target()->path(); + if (!isset($arguments['crap4jThreshold'])) { + $arguments['crap4jThreshold'] = $codeCoverageConfiguration->crap4j()->threshold(); + } + } + if (!isset($arguments['coverageHtml']) && $codeCoverageConfiguration->hasHtml()) { + $arguments['coverageHtml'] = $codeCoverageConfiguration->html()->target()->path(); + if (!isset($arguments['reportLowUpperBound'])) { + $arguments['reportLowUpperBound'] = $codeCoverageConfiguration->html()->lowUpperBound(); + } + if (!isset($arguments['reportHighLowerBound'])) { + $arguments['reportHighLowerBound'] = $codeCoverageConfiguration->html()->highLowerBound(); + } + } + if (!isset($arguments['coveragePHP']) && $codeCoverageConfiguration->hasPhp()) { + $arguments['coveragePHP'] = $codeCoverageConfiguration->php()->target()->path(); + } + if (!isset($arguments['coverageText']) && $codeCoverageConfiguration->hasText()) { + $arguments['coverageText'] = $codeCoverageConfiguration->text()->target()->path(); + $arguments['coverageTextShowUncoveredFiles'] = $codeCoverageConfiguration->text()->showUncoveredFiles(); + $arguments['coverageTextShowOnlySummary'] = $codeCoverageConfiguration->text()->showOnlySummary(); + } + if (!isset($arguments['coverageXml']) && $codeCoverageConfiguration->hasXml()) { + $arguments['coverageXml'] = $codeCoverageConfiguration->xml()->target()->path(); + } + } + $phpunitConfiguration = $arguments['configurationObject']->phpunit(); + $arguments['backupGlobals'] = $arguments['backupGlobals'] ?? $phpunitConfiguration->backupGlobals(); + $arguments['backupStaticAttributes'] = $arguments['backupStaticAttributes'] ?? $phpunitConfiguration->backupStaticAttributes(); + $arguments['beStrictAboutChangesToGlobalState'] = $arguments['beStrictAboutChangesToGlobalState'] ?? $phpunitConfiguration->beStrictAboutChangesToGlobalState(); + $arguments['cacheResult'] = $arguments['cacheResult'] ?? $phpunitConfiguration->cacheResult(); + $arguments['colors'] = $arguments['colors'] ?? $phpunitConfiguration->colors(); + $arguments['convertDeprecationsToExceptions'] = $arguments['convertDeprecationsToExceptions'] ?? $phpunitConfiguration->convertDeprecationsToExceptions(); + $arguments['convertErrorsToExceptions'] = $arguments['convertErrorsToExceptions'] ?? $phpunitConfiguration->convertErrorsToExceptions(); + $arguments['convertNoticesToExceptions'] = $arguments['convertNoticesToExceptions'] ?? $phpunitConfiguration->convertNoticesToExceptions(); + $arguments['convertWarningsToExceptions'] = $arguments['convertWarningsToExceptions'] ?? $phpunitConfiguration->convertWarningsToExceptions(); + $arguments['processIsolation'] = $arguments['processIsolation'] ?? $phpunitConfiguration->processIsolation(); + $arguments['stopOnDefect'] = $arguments['stopOnDefect'] ?? $phpunitConfiguration->stopOnDefect(); + $arguments['stopOnError'] = $arguments['stopOnError'] ?? $phpunitConfiguration->stopOnError(); + $arguments['stopOnFailure'] = $arguments['stopOnFailure'] ?? $phpunitConfiguration->stopOnFailure(); + $arguments['stopOnWarning'] = $arguments['stopOnWarning'] ?? $phpunitConfiguration->stopOnWarning(); + $arguments['stopOnIncomplete'] = $arguments['stopOnIncomplete'] ?? $phpunitConfiguration->stopOnIncomplete(); + $arguments['stopOnRisky'] = $arguments['stopOnRisky'] ?? $phpunitConfiguration->stopOnRisky(); + $arguments['stopOnSkipped'] = $arguments['stopOnSkipped'] ?? $phpunitConfiguration->stopOnSkipped(); + $arguments['failOnEmptyTestSuite'] = $arguments['failOnEmptyTestSuite'] ?? $phpunitConfiguration->failOnEmptyTestSuite(); + $arguments['failOnIncomplete'] = $arguments['failOnIncomplete'] ?? $phpunitConfiguration->failOnIncomplete(); + $arguments['failOnRisky'] = $arguments['failOnRisky'] ?? $phpunitConfiguration->failOnRisky(); + $arguments['failOnSkipped'] = $arguments['failOnSkipped'] ?? $phpunitConfiguration->failOnSkipped(); + $arguments['failOnWarning'] = $arguments['failOnWarning'] ?? $phpunitConfiguration->failOnWarning(); + $arguments['enforceTimeLimit'] = $arguments['enforceTimeLimit'] ?? $phpunitConfiguration->enforceTimeLimit(); + $arguments['defaultTimeLimit'] = $arguments['defaultTimeLimit'] ?? $phpunitConfiguration->defaultTimeLimit(); + $arguments['timeoutForSmallTests'] = $arguments['timeoutForSmallTests'] ?? $phpunitConfiguration->timeoutForSmallTests(); + $arguments['timeoutForMediumTests'] = $arguments['timeoutForMediumTests'] ?? $phpunitConfiguration->timeoutForMediumTests(); + $arguments['timeoutForLargeTests'] = $arguments['timeoutForLargeTests'] ?? $phpunitConfiguration->timeoutForLargeTests(); + $arguments['reportUselessTests'] = $arguments['reportUselessTests'] ?? $phpunitConfiguration->beStrictAboutTestsThatDoNotTestAnything(); + $arguments['strictCoverage'] = $arguments['strictCoverage'] ?? $phpunitConfiguration->beStrictAboutCoversAnnotation(); + $arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'] = $arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'] ?? $codeCoverageConfiguration->ignoreDeprecatedCodeUnits(); + $arguments['disallowTestOutput'] = $arguments['disallowTestOutput'] ?? $phpunitConfiguration->beStrictAboutOutputDuringTests(); + $arguments['disallowTodoAnnotatedTests'] = $arguments['disallowTodoAnnotatedTests'] ?? $phpunitConfiguration->beStrictAboutTodoAnnotatedTests(); + $arguments['beStrictAboutResourceUsageDuringSmallTests'] = $arguments['beStrictAboutResourceUsageDuringSmallTests'] ?? $phpunitConfiguration->beStrictAboutResourceUsageDuringSmallTests(); + $arguments['verbose'] = $arguments['verbose'] ?? $phpunitConfiguration->verbose(); + $arguments['reverseDefectList'] = $arguments['reverseDefectList'] ?? $phpunitConfiguration->reverseDefectList(); + $arguments['forceCoversAnnotation'] = $arguments['forceCoversAnnotation'] ?? $phpunitConfiguration->forceCoversAnnotation(); + $arguments['disableCodeCoverageIgnore'] = $arguments['disableCodeCoverageIgnore'] ?? $codeCoverageConfiguration->disableCodeCoverageIgnore(); + $arguments['registerMockObjectsFromTestArgumentsRecursively'] = $arguments['registerMockObjectsFromTestArgumentsRecursively'] ?? $phpunitConfiguration->registerMockObjectsFromTestArgumentsRecursively(); + $arguments['noInteraction'] = $arguments['noInteraction'] ?? $phpunitConfiguration->noInteraction(); + $arguments['executionOrder'] = $arguments['executionOrder'] ?? $phpunitConfiguration->executionOrder(); + $arguments['resolveDependencies'] = $arguments['resolveDependencies'] ?? $phpunitConfiguration->resolveDependencies(); + if (!isset($arguments['bootstrap']) && $phpunitConfiguration->hasBootstrap()) { + $arguments['bootstrap'] = $phpunitConfiguration->bootstrap(); + } + if (!isset($arguments['cacheResultFile']) && $phpunitConfiguration->hasCacheResultFile()) { + $arguments['cacheResultFile'] = $phpunitConfiguration->cacheResultFile(); + } + if (!isset($arguments['executionOrderDefects'])) { + $arguments['executionOrderDefects'] = $phpunitConfiguration->defectsFirst() ? TestSuiteSorter::ORDER_DEFECTS_FIRST : TestSuiteSorter::ORDER_DEFAULT; + } + if ($phpunitConfiguration->conflictBetweenPrinterClassAndTestdox()) { + $arguments['conflictBetweenPrinterClassAndTestdox'] = \true; + } + $groupCliArgs = []; + if (!empty($arguments['groups'])) { + $groupCliArgs = $arguments['groups']; + } + $groupConfiguration = $arguments['configurationObject']->groups(); + if (!isset($arguments['groups']) && $groupConfiguration->hasInclude()) { + $arguments['groups'] = $groupConfiguration->include()->asArrayOfStrings(); + } + if (!isset($arguments['excludeGroups']) && $groupConfiguration->hasExclude()) { + $arguments['excludeGroups'] = array_diff($groupConfiguration->exclude()->asArrayOfStrings(), $groupCliArgs); + } + if (!isset($arguments['noExtensions'])) { + $extensionHandler = new ExtensionHandler(); + foreach ($arguments['configurationObject']->extensions() as $extension) { + $extensionHandler->registerExtension($extension, $this); + } + foreach ($arguments['configurationObject']->listeners() as $listener) { + $arguments['listeners'][] = $extensionHandler->createTestListenerInstance($listener); + } + unset($extensionHandler); + } + foreach ($arguments['unavailableExtensions'] as $extension) { + $arguments['warnings'][] = sprintf('Extension "%s" is not available', $extension); + } + $loggingConfiguration = $arguments['configurationObject']->logging(); + if (!isset($arguments['noLogging'])) { + if ($loggingConfiguration->hasText()) { + $arguments['listeners'][] = new \PHPUnit\TextUI\DefaultResultPrinter($loggingConfiguration->text()->target()->path(), \true); + } + if (!isset($arguments['teamcityLogfile']) && $loggingConfiguration->hasTeamCity()) { + $arguments['teamcityLogfile'] = $loggingConfiguration->teamCity()->target()->path(); + } + if (!isset($arguments['junitLogfile']) && $loggingConfiguration->hasJunit()) { + $arguments['junitLogfile'] = $loggingConfiguration->junit()->target()->path(); + } + if (!isset($arguments['testdoxHTMLFile']) && $loggingConfiguration->hasTestDoxHtml()) { + $arguments['testdoxHTMLFile'] = $loggingConfiguration->testDoxHtml()->target()->path(); + } + if (!isset($arguments['testdoxTextFile']) && $loggingConfiguration->hasTestDoxText()) { + $arguments['testdoxTextFile'] = $loggingConfiguration->testDoxText()->target()->path(); + } + if (!isset($arguments['testdoxXMLFile']) && $loggingConfiguration->hasTestDoxXml()) { + $arguments['testdoxXMLFile'] = $loggingConfiguration->testDoxXml()->target()->path(); + } + } + $testdoxGroupConfiguration = $arguments['configurationObject']->testdoxGroups(); + if (!isset($arguments['testdoxGroups']) && $testdoxGroupConfiguration->hasInclude()) { + $arguments['testdoxGroups'] = $testdoxGroupConfiguration->include()->asArrayOfStrings(); + } + if (!isset($arguments['testdoxExcludeGroups']) && $testdoxGroupConfiguration->hasExclude()) { + $arguments['testdoxExcludeGroups'] = $testdoxGroupConfiguration->exclude()->asArrayOfStrings(); + } + } + $extensionHandler = new ExtensionHandler(); + foreach ($arguments['extensions'] as $extension) { + $extensionHandler->registerExtension($extension, $this); + } + unset($extensionHandler); + $arguments['backupGlobals'] = $arguments['backupGlobals'] ?? null; + $arguments['backupStaticAttributes'] = $arguments['backupStaticAttributes'] ?? null; + $arguments['beStrictAboutChangesToGlobalState'] = $arguments['beStrictAboutChangesToGlobalState'] ?? null; + $arguments['beStrictAboutResourceUsageDuringSmallTests'] = $arguments['beStrictAboutResourceUsageDuringSmallTests'] ?? \false; + $arguments['cacheResult'] = $arguments['cacheResult'] ?? \true; + $arguments['colors'] = $arguments['colors'] ?? \PHPUnit\TextUI\DefaultResultPrinter::COLOR_DEFAULT; + $arguments['columns'] = $arguments['columns'] ?? 80; + $arguments['convertDeprecationsToExceptions'] = $arguments['convertDeprecationsToExceptions'] ?? \false; + $arguments['convertErrorsToExceptions'] = $arguments['convertErrorsToExceptions'] ?? \true; + $arguments['convertNoticesToExceptions'] = $arguments['convertNoticesToExceptions'] ?? \true; + $arguments['convertWarningsToExceptions'] = $arguments['convertWarningsToExceptions'] ?? \true; + $arguments['crap4jThreshold'] = $arguments['crap4jThreshold'] ?? 30; + $arguments['disallowTestOutput'] = $arguments['disallowTestOutput'] ?? \false; + $arguments['disallowTodoAnnotatedTests'] = $arguments['disallowTodoAnnotatedTests'] ?? \false; + $arguments['defaultTimeLimit'] = $arguments['defaultTimeLimit'] ?? 0; + $arguments['enforceTimeLimit'] = $arguments['enforceTimeLimit'] ?? \false; + $arguments['excludeGroups'] = $arguments['excludeGroups'] ?? []; + $arguments['executionOrder'] = $arguments['executionOrder'] ?? TestSuiteSorter::ORDER_DEFAULT; + $arguments['executionOrderDefects'] = $arguments['executionOrderDefects'] ?? TestSuiteSorter::ORDER_DEFAULT; + $arguments['failOnIncomplete'] = $arguments['failOnIncomplete'] ?? \false; + $arguments['failOnRisky'] = $arguments['failOnRisky'] ?? \false; + $arguments['failOnSkipped'] = $arguments['failOnSkipped'] ?? \false; + $arguments['failOnWarning'] = $arguments['failOnWarning'] ?? \false; + $arguments['groups'] = $arguments['groups'] ?? []; + $arguments['noInteraction'] = $arguments['noInteraction'] ?? \false; + $arguments['processIsolation'] = $arguments['processIsolation'] ?? \false; + $arguments['randomOrderSeed'] = $arguments['randomOrderSeed'] ?? time(); + $arguments['registerMockObjectsFromTestArgumentsRecursively'] = $arguments['registerMockObjectsFromTestArgumentsRecursively'] ?? \false; + $arguments['repeat'] = $arguments['repeat'] ?? \false; + $arguments['reportHighLowerBound'] = $arguments['reportHighLowerBound'] ?? 90; + $arguments['reportLowUpperBound'] = $arguments['reportLowUpperBound'] ?? 50; + $arguments['reportUselessTests'] = $arguments['reportUselessTests'] ?? \true; + $arguments['reverseList'] = $arguments['reverseList'] ?? \false; + $arguments['resolveDependencies'] = $arguments['resolveDependencies'] ?? \true; + $arguments['stopOnError'] = $arguments['stopOnError'] ?? \false; + $arguments['stopOnFailure'] = $arguments['stopOnFailure'] ?? \false; + $arguments['stopOnIncomplete'] = $arguments['stopOnIncomplete'] ?? \false; + $arguments['stopOnRisky'] = $arguments['stopOnRisky'] ?? \false; + $arguments['stopOnSkipped'] = $arguments['stopOnSkipped'] ?? \false; + $arguments['stopOnWarning'] = $arguments['stopOnWarning'] ?? \false; + $arguments['stopOnDefect'] = $arguments['stopOnDefect'] ?? \false; + $arguments['strictCoverage'] = $arguments['strictCoverage'] ?? \false; + $arguments['testdoxExcludeGroups'] = $arguments['testdoxExcludeGroups'] ?? []; + $arguments['testdoxGroups'] = $arguments['testdoxGroups'] ?? []; + $arguments['timeoutForLargeTests'] = $arguments['timeoutForLargeTests'] ?? 60; + $arguments['timeoutForMediumTests'] = $arguments['timeoutForMediumTests'] ?? 10; + $arguments['timeoutForSmallTests'] = $arguments['timeoutForSmallTests'] ?? 1; + $arguments['verbose'] = $arguments['verbose'] ?? \false; + if ($arguments['reportLowUpperBound'] > $arguments['reportHighLowerBound']) { + $arguments['reportLowUpperBound'] = 50; + $arguments['reportHighLowerBound'] = 90; + } + } + private function processSuiteFilters(TestSuite $suite, array $arguments): void { - $this->target = $target; + if (!$arguments['filter'] && empty($arguments['groups']) && empty($arguments['excludeGroups']) && empty($arguments['testsCovering']) && empty($arguments['testsUsing'])) { + return; + } + $filterFactory = new Factory(); + if (!empty($arguments['excludeGroups'])) { + $filterFactory->addFilter(new ReflectionClass(ExcludeGroupFilterIterator::class), $arguments['excludeGroups']); + } + if (!empty($arguments['groups'])) { + $filterFactory->addFilter(new ReflectionClass(IncludeGroupFilterIterator::class), $arguments['groups']); + } + if (!empty($arguments['testsCovering'])) { + $filterFactory->addFilter(new ReflectionClass(IncludeGroupFilterIterator::class), array_map(static function (string $name): string { + return '__phpunit_covers_' . $name; + }, $arguments['testsCovering'])); + } + if (!empty($arguments['testsUsing'])) { + $filterFactory->addFilter(new ReflectionClass(IncludeGroupFilterIterator::class), array_map(static function (string $name): string { + return '__phpunit_uses_' . $name; + }, $arguments['testsUsing'])); + } + if ($arguments['filter']) { + $filterFactory->addFilter(new ReflectionClass(NameFilterIterator::class), $arguments['filter']); + } + $suite->injectFilter($filterFactory); } - public function target() : File + private function writeMessage(string $type, string $message): void { - return $this->target; + if (!$this->messagePrinted) { + $this->write("\n"); + } + $this->write(sprintf("%-15s%s\n", $type . ':', $message)); + $this->messagePrinted = \true; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration\Logging\TestDox; - -use PHPUnit\TextUI\XmlConfiguration\File; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable - */ -final class Text -{ - /** - * @var File - */ - private $target; - public function __construct(File $target) + private function createPrinter(string $class, array $arguments): \PHPUnit\TextUI\ResultPrinter { - $this->target = $target; + $object = new $class((isset($arguments['stderr']) && $arguments['stderr'] === \true) ? 'php://stderr' : null, $arguments['verbose'], $arguments['colors'], $arguments['debug'], $arguments['columns'], $arguments['reverseList']); + assert($object instanceof \PHPUnit\TextUI\ResultPrinter); + return $object; } - public function target() : File + private function codeCoverageGenerationStart(string $format): void { - return $this->target; + $this->write(sprintf("\nGenerating code coverage report in %s format ... ", $format)); + $this->timer->start(); + } + private function codeCoverageGenerationSucceeded(): void + { + $this->write(sprintf("done [%s]\n", $this->timer->stop()->asString())); + } + private function codeCoverageGenerationFailed(\Exception $e): void + { + $this->write(sprintf("failed [%s]\n%s\n", $this->timer->stop()->asString(), $e->getMessage())); } } target = $target; - } - public function target() : File - { - return $this->target; + try { + $filterAsArray = $filter ? explode(',', $filter) : []; + $result = new TestSuiteObject(); + foreach ($configuration as $testSuiteConfiguration) { + if (!empty($filterAsArray) && !in_array($testSuiteConfiguration->name(), $filterAsArray, \true)) { + continue; + } + $testSuite = new TestSuiteObject($testSuiteConfiguration->name()); + $testSuiteEmpty = \true; + $exclude = []; + foreach ($testSuiteConfiguration->exclude()->asArray() as $file) { + $exclude[] = $file->path(); + } + foreach ($testSuiteConfiguration->directories() as $directory) { + if (!version_compare(PHP_VERSION, $directory->phpVersion(), $directory->phpVersionOperator()->asString())) { + continue; + } + $files = (new Facade())->getFilesAsArray($directory->path(), $directory->suffix(), $directory->prefix(), $exclude); + if (!empty($files)) { + $testSuite->addTestFiles($files); + $testSuiteEmpty = \false; + } elseif (strpos($directory->path(), '*') === \false && !is_dir($directory->path())) { + throw new \PHPUnit\TextUI\TestDirectoryNotFoundException($directory->path()); + } + } + foreach ($testSuiteConfiguration->files() as $file) { + if (!is_file($file->path())) { + throw new \PHPUnit\TextUI\TestFileNotFoundException($file->path()); + } + if (!version_compare(PHP_VERSION, $file->phpVersion(), $file->phpVersionOperator()->asString())) { + continue; + } + $testSuite->addTestFile($file->path()); + $testSuiteEmpty = \false; + } + if (!$testSuiteEmpty) { + $result->addTest($testSuite); + } + } + return $result; + } catch (FrameworkException $e) { + throw new \PHPUnit\TextUI\RuntimeException($e->getMessage(), $e->getCode(), $e); + } } } target = $target; + $this->cacheDirectory = $cacheDirectory; + $this->directories = $directories; + $this->files = $files; + $this->excludeDirectories = $excludeDirectories; + $this->excludeFiles = $excludeFiles; + $this->pathCoverage = $pathCoverage; + $this->includeUncoveredFiles = $includeUncoveredFiles; + $this->processUncoveredFiles = $processUncoveredFiles; + $this->ignoreDeprecatedCodeUnits = $ignoreDeprecatedCodeUnits; + $this->disableCodeCoverageIgnore = $disableCodeCoverageIgnore; + $this->clover = $clover; + $this->cobertura = $cobertura; + $this->crap4j = $crap4j; + $this->html = $html; + $this->php = $php; + $this->text = $text; + $this->xml = $xml; } - public function target() : File + /** + * @psalm-assert-if-true !null $this->cacheDirectory + */ + public function hasCacheDirectory(): bool { - return $this->target; + return $this->cacheDirectory !== null; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function array_key_exists; -use function sprintf; -use function version_compare; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class MigrationBuilder -{ - private const AVAILABLE_MIGRATIONS = ['8.5' => [\PHPUnit\TextUI\XmlConfiguration\RemoveLogTypes::class], '9.2' => [\PHPUnit\TextUI\XmlConfiguration\RemoveCacheTokensAttribute::class, \PHPUnit\TextUI\XmlConfiguration\IntroduceCoverageElement::class, \PHPUnit\TextUI\XmlConfiguration\MoveAttributesFromRootToCoverage::class, \PHPUnit\TextUI\XmlConfiguration\MoveAttributesFromFilterWhitelistToCoverage::class, \PHPUnit\TextUI\XmlConfiguration\MoveWhitelistIncludesToCoverage::class, \PHPUnit\TextUI\XmlConfiguration\MoveWhitelistExcludesToCoverage::class, \PHPUnit\TextUI\XmlConfiguration\RemoveEmptyFilter::class, \PHPUnit\TextUI\XmlConfiguration\CoverageCloverToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoverageCrap4jToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoverageHtmlToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoveragePhpToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoverageTextToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoverageXmlToReport::class, \PHPUnit\TextUI\XmlConfiguration\ConvertLogTypes::class, \PHPUnit\TextUI\XmlConfiguration\UpdateSchemaLocationTo93::class]]; /** - * @throws MigrationBuilderException + * @throws Exception */ - public function build(string $fromVersion) : array + public function cacheDirectory(): Directory { - if (!array_key_exists($fromVersion, self::AVAILABLE_MIGRATIONS)) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationBuilderException(sprintf('Migration from schema version %s is not supported', $fromVersion)); - } - $stack = []; - foreach (self::AVAILABLE_MIGRATIONS as $version => $migrations) { - if (version_compare($version, $fromVersion, '<')) { - continue; - } - foreach ($migrations as $migration) { - $stack[] = new $migration(); - } + if (!$this->hasCacheDirectory()) { + throw new Exception('No cache directory has been configured'); } - return $stack; + return $this->cacheDirectory; + } + public function hasNonEmptyListOfFilesToBeIncludedInCodeCoverageReport(): bool + { + return count($this->directories) > 0 || count($this->files) > 0; + } + public function directories(): DirectoryCollection + { + return $this->directories; + } + public function files(): FileCollection + { + return $this->files; + } + public function excludeDirectories(): DirectoryCollection + { + return $this->excludeDirectories; + } + public function excludeFiles(): FileCollection + { + return $this->excludeFiles; + } + public function pathCoverage(): bool + { + return $this->pathCoverage; + } + public function includeUncoveredFiles(): bool + { + return $this->includeUncoveredFiles; + } + public function ignoreDeprecatedCodeUnits(): bool + { + return $this->ignoreDeprecatedCodeUnits; + } + public function disableCodeCoverageIgnore(): bool + { + return $this->disableCodeCoverageIgnore; + } + public function processUncoveredFiles(): bool + { + return $this->processUncoveredFiles; + } + /** + * @psalm-assert-if-true !null $this->clover + */ + public function hasClover(): bool + { + return $this->clover !== null; + } + /** + * @throws Exception + */ + public function clover(): Clover + { + if (!$this->hasClover()) { + throw new Exception('Code Coverage report "Clover XML" has not been configured'); + } + return $this->clover; + } + /** + * @psalm-assert-if-true !null $this->cobertura + */ + public function hasCobertura(): bool + { + return $this->cobertura !== null; + } + /** + * @throws Exception + */ + public function cobertura(): Cobertura + { + if (!$this->hasCobertura()) { + throw new Exception('Code Coverage report "Cobertura XML" has not been configured'); + } + return $this->cobertura; + } + /** + * @psalm-assert-if-true !null $this->crap4j + */ + public function hasCrap4j(): bool + { + return $this->crap4j !== null; + } + /** + * @throws Exception + */ + public function crap4j(): Crap4j + { + if (!$this->hasCrap4j()) { + throw new Exception('Code Coverage report "Crap4J" has not been configured'); + } + return $this->crap4j; + } + /** + * @psalm-assert-if-true !null $this->html + */ + public function hasHtml(): bool + { + return $this->html !== null; + } + /** + * @throws Exception + */ + public function html(): Html + { + if (!$this->hasHtml()) { + throw new Exception('Code Coverage report "HTML" has not been configured'); + } + return $this->html; + } + /** + * @psalm-assert-if-true !null $this->php + */ + public function hasPhp(): bool + { + return $this->php !== null; + } + /** + * @throws Exception + */ + public function php(): Php + { + if (!$this->hasPhp()) { + throw new Exception('Code Coverage report "PHP" has not been configured'); + } + return $this->php; + } + /** + * @psalm-assert-if-true !null $this->text + */ + public function hasText(): bool + { + return $this->text !== null; + } + /** + * @throws Exception + */ + public function text(): Text + { + if (!$this->hasText()) { + throw new Exception('Code Coverage report "Text" has not been configured'); + } + return $this->text; + } + /** + * @psalm-assert-if-true !null $this->xml + */ + public function hasXml(): bool + { + return $this->xml !== null; + } + /** + * @throws Exception + */ + public function xml(): Xml + { + if (!$this->hasXml()) { + throw new Exception('Code Coverage report "XML" has not been configured'); + } + return $this->xml; } } - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; +namespace PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter; -use RuntimeException; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable */ -final class MigrationException extends RuntimeException implements \PHPUnit\Exception +final class Directory { + /** + * @var string + */ + private $path; + /** + * @var string + */ + private $prefix; + /** + * @var string + */ + private $suffix; + /** + * @var string + */ + private $group; + public function __construct(string $path, string $prefix, string $suffix, string $group) + { + $this->path = $path; + $this->prefix = $prefix; + $this->suffix = $suffix; + $this->group = $group; + } + public function path(): string + { + return $this->path; + } + public function prefix(): string + { + return $this->prefix; + } + public function suffix(): string + { + return $this->suffix; + } + public function group(): string + { + return $this->group; + } } */ -final class ConvertLogTypes implements \PHPUnit\TextUI\XmlConfiguration\Migration +final class DirectoryCollection implements Countable, IteratorAggregate { - public function migrate(DOMDocument $document) : void + /** + * @var Directory[] + */ + private $directories; + /** + * @param Directory[] $directories + */ + public static function fromArray(array $directories): self { - $logging = $document->getElementsByTagName('logging')->item(0); - if (!$logging instanceof DOMElement) { - return; - } - $types = ['junit' => 'junit', 'teamcity' => 'teamcity', 'testdox-html' => 'testdoxHtml', 'testdox-text' => 'testdoxText', 'testdox-xml' => 'testdoxXml', 'plain' => 'text']; - $logNodes = []; - foreach ($logging->getElementsByTagName('log') as $logNode) { - if (!isset($types[$logNode->getAttribute('type')])) { - continue; - } - $logNodes[] = $logNode; - } - foreach ($logNodes as $oldNode) { - $newLogNode = $document->createElement($types[$oldNode->getAttribute('type')]); - $newLogNode->setAttribute('outputFile', $oldNode->getAttribute('target')); - $logging->replaceChild($newLogNode, $oldNode); - } + return new self(...$directories); + } + private function __construct(\PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\Directory ...$directories) + { + $this->directories = $directories; + } + /** + * @return Directory[] + */ + public function asArray(): array + { + return $this->directories; + } + public function count(): int + { + return count($this->directories); + } + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\DirectoryCollectionIterator + { + return new \PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\DirectoryCollectionIterator($this); } } */ -final class CoverageCloverToReport extends \PHPUnit\TextUI\XmlConfiguration\LogToReportMigration +final class DirectoryCollectionIterator implements Countable, Iterator { - protected function forType() : string + /** + * @var Directory[] + */ + private $directories; + /** + * @var int + */ + private $position; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\DirectoryCollection $directories) { - return 'coverage-clover'; + $this->directories = $directories->asArray(); } - protected function toReportFormat(DOMElement $logNode) : DOMElement + public function count(): int { - $clover = $logNode->ownerDocument->createElement('clover'); - $clover->setAttribute('outputFile', $logNode->getAttribute('target')); - return $clover; + return iterator_count($this); + } + public function rewind(): void + { + $this->position = 0; + } + public function valid(): bool + { + return $this->position < count($this->directories); + } + public function key(): int + { + return $this->position; + } + public function current(): \PHPUnit\TextUI\XmlConfiguration\CodeCoverage\Filter\Directory + { + return $this->directories[$this->position]; + } + public function next(): void + { + $this->position++; } } ownerDocument->createElement('crap4j'); - $crap4j->setAttribute('outputFile', $logNode->getAttribute('target')); - $this->migrateAttributes($logNode, $crap4j, ['threshold']); - return $crap4j; + foreach ($configuration->directories() as $directory) { + $filter->includeDirectory($directory->path(), $directory->suffix(), $directory->prefix()); + } + foreach ($configuration->files() as $file) { + $filter->includeFile($file->path()); + } + foreach ($configuration->excludeDirectories() as $directory) { + $filter->excludeDirectory($directory->path(), $directory->suffix(), $directory->prefix()); + } + foreach ($configuration->excludeFiles() as $file) { + $filter->excludeFile($file->path()); + } } } target = $target; } - protected function toReportFormat(DOMElement $logNode) : DOMElement + public function target(): File { - $html = $logNode->ownerDocument->createElement('html'); - $html->setAttribute('outputDirectory', $logNode->getAttribute('target')); - $this->migrateAttributes($logNode, $html, ['lowUpperBound', 'highLowerBound']); - return $html; + return $this->target; } } target = $target; } - protected function toReportFormat(DOMElement $logNode) : DOMElement + public function target(): File { - $php = $logNode->ownerDocument->createElement('php'); - $php->setAttribute('outputFile', $logNode->getAttribute('target')); - return $php; + return $this->target; } } target = $target; + $this->threshold = $threshold; } - protected function toReportFormat(DOMElement $logNode) : DOMElement + public function target(): File { - $text = $logNode->ownerDocument->createElement('text'); - $text->setAttribute('outputFile', $logNode->getAttribute('target')); - $this->migrateAttributes($logNode, $text, ['showUncoveredFiles', 'showOnlySummary']); - return $text; + return $this->target; + } + public function threshold(): int + { + return $this->threshold; } } target = $target; + $this->lowUpperBound = $lowUpperBound; + $this->highLowerBound = $highLowerBound; } - protected function toReportFormat(DOMElement $logNode) : DOMElement + public function target(): Directory { - $xml = $logNode->ownerDocument->createElement('xml'); - $xml->setAttribute('outputDirectory', $logNode->getAttribute('target')); - return $xml; + return $this->target; + } + public function lowUpperBound(): int + { + return $this->lowUpperBound; + } + public function highLowerBound(): int + { + return $this->highLowerBound; } } createElement('coverage'); - $document->documentElement->insertBefore($coverage, $document->documentElement->firstChild); + $this->target = $target; + } + public function target(): File + { + return $this->target; } } getElementsByTagName('coverage')->item(0); - if (!$coverage instanceof DOMElement) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); - } - $logNode = $this->findLogNode($document); - if ($logNode === null) { - return; - } - $reportChild = $this->toReportFormat($logNode); - $report = $coverage->getElementsByTagName('report')->item(0); - if ($report === null) { - $report = $coverage->appendChild($document->createElement('report')); - } - $report->appendChild($reportChild); - $logNode->parentNode->removeChild($logNode); + $this->target = $target; + $this->showUncoveredFiles = $showUncoveredFiles; + $this->showOnlySummary = $showOnlySummary; } - protected function migrateAttributes(DOMElement $src, DOMElement $dest, array $attributes) : void + public function target(): File { - foreach ($attributes as $attr) { - if (!$src->hasAttribute($attr)) { - continue; - } - $dest->setAttribute($attr, $src->getAttribute($attr)); - $src->removeAttribute($attr); - } + return $this->target; } - protected abstract function forType() : string; - protected abstract function toReportFormat(DOMElement $logNode) : DOMElement; - private function findLogNode(DOMDocument $document) : ?DOMElement + public function showUncoveredFiles(): bool { - $logNode = (new DOMXPath($document))->query(sprintf('//logging/log[@type="%s"]', $this->forType()))->item(0); - if (!$logNode instanceof DOMElement) { - return null; - } - return $logNode; + return $this->showUncoveredFiles; + } + public function showOnlySummary(): bool + { + return $this->showOnlySummary; } } target = $target; + } + public function target(): Directory + { + return $this->target; + } } getElementsByTagName('whitelist')->item(0); - if (!$whitelist) { - return; - } - $coverage = $document->getElementsByTagName('coverage')->item(0); - if (!$coverage instanceof DOMElement) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); - } - $map = ['addUncoveredFilesFromWhitelist' => 'includeUncoveredFiles', 'processUncoveredFilesFromWhitelist' => 'processUncoveredFiles']; - foreach ($map as $old => $new) { - if (!$whitelist->hasAttribute($old)) { - continue; - } - $coverage->setAttribute($new, $whitelist->getAttribute($old)); - $whitelist->removeAttribute($old); - } - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use DOMDocument; -use DOMElement; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class MoveAttributesFromRootToCoverage implements \PHPUnit\TextUI\XmlConfiguration\Migration -{ + private $filename; /** - * @throws MigrationException + * @var ValidationResult */ - public function migrate(DOMDocument $document) : void - { - $map = ['disableCodeCoverageIgnore' => 'disableCodeCoverageIgnore', 'ignoreDeprecatedCodeUnitsFromCodeCoverage' => 'ignoreDeprecatedCodeUnits']; - $root = $document->documentElement; - $coverage = $document->getElementsByTagName('coverage')->item(0); - if (!$coverage instanceof DOMElement) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); - } - foreach ($map as $old => $new) { - if (!$root->hasAttribute($old)) { - continue; - } - $coverage->setAttribute($new, $root->getAttribute($old)); - $root->removeAttribute($old); - } - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function assert; -use function in_array; -use DOMDocument; -use DOMElement; -use PHPUnit\Util\Xml\SnapshotNodeList; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class MoveWhitelistExcludesToCoverage implements \PHPUnit\TextUI\XmlConfiguration\Migration -{ + private $validationResult; /** - * @throws MigrationException + * @var ExtensionCollection */ - public function migrate(DOMDocument $document) : void - { - $whitelist = $document->getElementsByTagName('whitelist')->item(0); - if ($whitelist === null) { - return; - } - $excludeNodes = SnapshotNodeList::fromNodeList($whitelist->getElementsByTagName('exclude')); - if ($excludeNodes->count() === 0) { - return; - } - $coverage = $document->getElementsByTagName('coverage')->item(0); - if (!$coverage instanceof DOMElement) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); - } - $targetExclude = $coverage->getElementsByTagName('exclude')->item(0); - if ($targetExclude === null) { - $targetExclude = $coverage->appendChild($document->createElement('exclude')); - } - foreach ($excludeNodes as $excludeNode) { - assert($excludeNode instanceof DOMElement); - foreach (SnapshotNodeList::fromNodeList($excludeNode->childNodes) as $child) { - if (!$child instanceof DOMElement || !in_array($child->nodeName, ['directory', 'file'], \true)) { - continue; - } - $targetExclude->appendChild($child); - } - if ($excludeNode->getElementsByTagName('*')->count() !== 0) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Dangling child elements in exclude found.'); - } - $whitelist->removeChild($excludeNode); - } - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use DOMDocument; -use DOMElement; -use PHPUnit\Util\Xml\SnapshotNodeList; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class MoveWhitelistIncludesToCoverage implements \PHPUnit\TextUI\XmlConfiguration\Migration -{ + private $extensions; /** - * @throws MigrationException + * @var CodeCoverage + */ + private $codeCoverage; + /** + * @var Groups + */ + private $groups; + /** + * @var Groups + */ + private $testdoxGroups; + /** + * @var ExtensionCollection + */ + private $listeners; + /** + * @var Logging + */ + private $logging; + /** + * @var Php + */ + private $php; + /** + * @var PHPUnit + */ + private $phpunit; + /** + * @var TestSuiteCollection */ - public function migrate(DOMDocument $document) : void + private $testSuite; + public function __construct(string $filename, ValidationResult $validationResult, \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection $extensions, CodeCoverage $codeCoverage, \PHPUnit\TextUI\XmlConfiguration\Groups $groups, \PHPUnit\TextUI\XmlConfiguration\Groups $testdoxGroups, \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection $listeners, Logging $logging, \PHPUnit\TextUI\XmlConfiguration\Php $php, \PHPUnit\TextUI\XmlConfiguration\PHPUnit $phpunit, \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection $testSuite) { - $whitelist = $document->getElementsByTagName('whitelist')->item(0); - if ($whitelist === null) { - return; - } - $coverage = $document->getElementsByTagName('coverage')->item(0); - if (!$coverage instanceof DOMElement) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); - } - $include = $document->createElement('include'); - $coverage->appendChild($include); - foreach (SnapshotNodeList::fromNodeList($whitelist->childNodes) as $child) { - if (!$child instanceof DOMElement) { - continue; - } - if (!($child->nodeName === 'directory' || $child->nodeName === 'file')) { - continue; - } - $include->appendChild($child); - } + $this->filename = $filename; + $this->validationResult = $validationResult; + $this->extensions = $extensions; + $this->codeCoverage = $codeCoverage; + $this->groups = $groups; + $this->testdoxGroups = $testdoxGroups; + $this->listeners = $listeners; + $this->logging = $logging; + $this->php = $php; + $this->phpunit = $phpunit; + $this->testSuite = $testSuite; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use DOMDocument; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class RemoveCacheTokensAttribute implements \PHPUnit\TextUI\XmlConfiguration\Migration -{ - public function migrate(DOMDocument $document) : void + public function filename(): string { - $root = $document->documentElement; - if ($root->hasAttribute('cacheTokens')) { - $root->removeAttribute('cacheTokens'); - } + return $this->filename; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function sprintf; -use DOMDocument; -use DOMElement; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class RemoveEmptyFilter implements \PHPUnit\TextUI\XmlConfiguration\Migration -{ - /** - * @throws MigrationException - */ - public function migrate(DOMDocument $document) : void + public function hasValidationErrors(): bool { - $whitelist = $document->getElementsByTagName('whitelist')->item(0); - if ($whitelist instanceof DOMElement) { - $this->ensureEmpty($whitelist); - $whitelist->parentNode->removeChild($whitelist); - } - $filter = $document->getElementsByTagName('filter')->item(0); - if ($filter instanceof DOMElement) { - $this->ensureEmpty($filter); - $filter->parentNode->removeChild($filter); - } + return $this->validationResult->hasValidationErrors(); } - /** - * @throws MigrationException - */ - private function ensureEmpty(DOMElement $element) : void + public function validationErrors(): string { - if ($element->attributes->length > 0) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException(sprintf('%s element has unexpected attributes', $element->nodeName)); - } - if ($element->getElementsByTagName('*')->length > 0) { - throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException(sprintf('%s element has unexpected children', $element->nodeName)); - } + return $this->validationResult->asString(); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function assert; -use DOMDocument; -use DOMElement; -use PHPUnit\Util\Xml\SnapshotNodeList; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class RemoveLogTypes implements \PHPUnit\TextUI\XmlConfiguration\Migration -{ - public function migrate(DOMDocument $document) : void + public function extensions(): \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection { - $logging = $document->getElementsByTagName('logging')->item(0); - if (!$logging instanceof DOMElement) { - return; - } - foreach (SnapshotNodeList::fromNodeList($logging->getElementsByTagName('log')) as $logNode) { - assert($logNode instanceof DOMElement); - switch ($logNode->getAttribute('type')) { - case 'json': - case 'tap': - $logging->removeChild($logNode); - } - } + return $this->extensions; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use DOMDocument; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class UpdateSchemaLocationTo93 implements \PHPUnit\TextUI\XmlConfiguration\Migration -{ - public function migrate(DOMDocument $document) : void + public function codeCoverage(): CodeCoverage { - $document->documentElement->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:noNamespaceSchemaLocation', 'https://schema.phpunit.de/9.3/phpunit.xsd'); + return $this->codeCoverage; + } + public function groups(): \PHPUnit\TextUI\XmlConfiguration\Groups + { + return $this->groups; + } + public function testdoxGroups(): \PHPUnit\TextUI\XmlConfiguration\Groups + { + return $this->testdoxGroups; + } + public function listeners(): \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection + { + return $this->listeners; + } + public function logging(): Logging + { + return $this->logging; + } + public function php(): \PHPUnit\TextUI\XmlConfiguration\Php + { + return $this->php; + } + public function phpunit(): \PHPUnit\TextUI\XmlConfiguration\PHPUnit + { + return $this->phpunit; + } + public function testSuite(): \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection + { + return $this->testSuite; } } detect($filename); - if (!$origin->detected()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception(sprintf('"%s" is not a valid PHPUnit XML configuration file that can be migrated', $filename)); - } - $configurationDocument = (new XmlLoader())->loadFile($filename, \false, \true, \true); - foreach ((new \PHPUnit\TextUI\XmlConfiguration\MigrationBuilder())->build($origin->version()) as $migration) { - $migration->migrate($configurationDocument); - } - $configurationDocument->formatOutput = \true; - $configurationDocument->preserveWhiteSpace = \false; - return $configurationDocument->saveXML(); - } } name = $name; - $this->value = $value; - } - public function name() : string + private $path; + public function __construct(string $path) { - return $this->name; + $this->path = $path; } - public function value() + public function path(): string { - return $this->value; + return $this->path; } } + * @template-implements IteratorAggregate */ -final class ConstantCollection implements Countable, IteratorAggregate +final class DirectoryCollection implements Countable, IteratorAggregate { /** - * @var Constant[] + * @var Directory[] */ - private $constants; + private $directories; /** - * @param Constant[] $constants + * @param Directory[] $directories */ - public static function fromArray(array $constants) : self + public static function fromArray(array $directories): self { - return new self(...$constants); + return new self(...$directories); } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\Constant ...$constants) + private function __construct(\PHPUnit\TextUI\XmlConfiguration\Directory ...$directories) { - $this->constants = $constants; + $this->directories = $directories; } /** - * @return Constant[] + * @return Directory[] */ - public function asArray() : array + public function asArray(): array { - return $this->constants; + return $this->directories; } - public function count() : int + public function count(): int { - return count($this->constants); + return count($this->directories); } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\ConstantCollectionIterator + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\DirectoryCollectionIterator { - return new \PHPUnit\TextUI\XmlConfiguration\ConstantCollectionIterator($this); + return new \PHPUnit\TextUI\XmlConfiguration\DirectoryCollectionIterator($this); + } + public function isEmpty(): bool + { + return $this->count() === 0; } } + * @template-implements Iterator */ -final class ConstantCollectionIterator implements Countable, Iterator +final class DirectoryCollectionIterator implements Countable, Iterator { /** - * @var Constant[] + * @var Directory[] */ - private $constants; + private $directories; /** * @var int */ private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\ConstantCollection $constants) + public function __construct(\PHPUnit\TextUI\XmlConfiguration\DirectoryCollection $directories) { - $this->constants = $constants->asArray(); + $this->directories = $directories->asArray(); } - public function count() : int + public function count(): int { return iterator_count($this); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - public function valid() : bool + public function valid(): bool { - return $this->position < count($this->constants); + return $this->position < count($this->directories); } - public function key() : int + public function key(): int { return $this->position; } - public function current() : \PHPUnit\TextUI\XmlConfiguration\Constant + public function current(): \PHPUnit\TextUI\XmlConfiguration\Directory { - return $this->constants[$this->position]; + return $this->directories[$this->position]; } - public function next() : void + public function next(): void { $this->position++; } @@ -77466,28 +84218,19 @@ namespace PHPUnit\TextUI\XmlConfiguration; * * @psalm-immutable */ -final class IniSetting +final class File { /** * @var string */ - private $name; - /** - * @var string - */ - private $value; - public function __construct(string $name, string $value) - { - $this->name = $name; - $this->value = $value; - } - public function name() : string + private $path; + public function __construct(string $path) { - return $this->name; + $this->path = $path; } - public function value() : string + public function path(): string { - return $this->value; + return $this->path; } } + * @template-implements IteratorAggregate */ -final class IniSettingCollection implements Countable, IteratorAggregate +final class FileCollection implements Countable, IteratorAggregate { /** - * @var IniSetting[] + * @var File[] */ - private $iniSettings; + private $files; /** - * @param IniSetting[] $iniSettings + * @param File[] $files */ - public static function fromArray(array $iniSettings) : self + public static function fromArray(array $files): self { - return new self(...$iniSettings); + return new self(...$files); } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\IniSetting ...$iniSettings) + private function __construct(\PHPUnit\TextUI\XmlConfiguration\File ...$files) { - $this->iniSettings = $iniSettings; + $this->files = $files; } /** - * @return IniSetting[] + * @return File[] */ - public function asArray() : array + public function asArray(): array { - return $this->iniSettings; + return $this->files; } - public function count() : int + public function count(): int { - return count($this->iniSettings); + return count($this->files); } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\IniSettingCollectionIterator + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\FileCollectionIterator { - return new \PHPUnit\TextUI\XmlConfiguration\IniSettingCollectionIterator($this); + return new \PHPUnit\TextUI\XmlConfiguration\FileCollectionIterator($this); + } + public function isEmpty(): bool + { + return $this->count() === 0; } } + * @template-implements Iterator */ -final class IniSettingCollectionIterator implements Countable, Iterator +final class FileCollectionIterator implements Countable, Iterator { /** - * @var IniSetting[] + * @var File[] */ - private $iniSettings; + private $files; /** * @var int */ private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\IniSettingCollection $iniSettings) + public function __construct(\PHPUnit\TextUI\XmlConfiguration\FileCollection $files) { - $this->iniSettings = $iniSettings->asArray(); + $this->files = $files->asArray(); } - public function count() : int + public function count(): int { return iterator_count($this); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - public function valid() : bool + public function valid(): bool { - return $this->position < count($this->iniSettings); + return $this->position < count($this->files); } - public function key() : int + public function key(): int { return $this->position; } - public function current() : \PHPUnit\TextUI\XmlConfiguration\IniSetting + public function current(): \PHPUnit\TextUI\XmlConfiguration\File { - return $this->iniSettings[$this->position]; + return $this->files[$this->position]; } - public function next() : void + public function next(): void { $this->position++; } @@ -77620,217 +84367,48 @@ declare (strict_types=1); */ namespace PHPUnit\TextUI\XmlConfiguration; +use function str_replace; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @psalm-immutable */ -final class Php +final class Generator { /** - * @var DirectoryCollection + * @var string */ - private $includePaths; - /** - * @var IniSettingCollection - */ - private $iniSettings; - /** - * @var ConstantCollection - */ - private $constants; - /** - * @var VariableCollection - */ - private $globalVariables; - /** - * @var VariableCollection - */ - private $envVariables; - /** - * @var VariableCollection - */ - private $postVariables; - /** - * @var VariableCollection - */ - private $getVariables; - /** - * @var VariableCollection - */ - private $cookieVariables; - /** - * @var VariableCollection - */ - private $serverVariables; - /** - * @var VariableCollection - */ - private $filesVariables; - /** - * @var VariableCollection - */ - private $requestVariables; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\DirectoryCollection $includePaths, \PHPUnit\TextUI\XmlConfiguration\IniSettingCollection $iniSettings, \PHPUnit\TextUI\XmlConfiguration\ConstantCollection $constants, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $globalVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $envVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $postVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $getVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $cookieVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $serverVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $filesVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $requestVariables) - { - $this->includePaths = $includePaths; - $this->iniSettings = $iniSettings; - $this->constants = $constants; - $this->globalVariables = $globalVariables; - $this->envVariables = $envVariables; - $this->postVariables = $postVariables; - $this->getVariables = $getVariables; - $this->cookieVariables = $cookieVariables; - $this->serverVariables = $serverVariables; - $this->filesVariables = $filesVariables; - $this->requestVariables = $requestVariables; - } - public function includePaths() : \PHPUnit\TextUI\XmlConfiguration\DirectoryCollection - { - return $this->includePaths; - } - public function iniSettings() : \PHPUnit\TextUI\XmlConfiguration\IniSettingCollection - { - return $this->iniSettings; - } - public function constants() : \PHPUnit\TextUI\XmlConfiguration\ConstantCollection - { - return $this->constants; - } - public function globalVariables() : \PHPUnit\TextUI\XmlConfiguration\VariableCollection - { - return $this->globalVariables; - } - public function envVariables() : \PHPUnit\TextUI\XmlConfiguration\VariableCollection - { - return $this->envVariables; - } - public function postVariables() : \PHPUnit\TextUI\XmlConfiguration\VariableCollection - { - return $this->postVariables; - } - public function getVariables() : \PHPUnit\TextUI\XmlConfiguration\VariableCollection - { - return $this->getVariables; - } - public function cookieVariables() : \PHPUnit\TextUI\XmlConfiguration\VariableCollection - { - return $this->cookieVariables; - } - public function serverVariables() : \PHPUnit\TextUI\XmlConfiguration\VariableCollection - { - return $this->serverVariables; - } - public function filesVariables() : \PHPUnit\TextUI\XmlConfiguration\VariableCollection - { - return $this->filesVariables; - } - public function requestVariables() : \PHPUnit\TextUI\XmlConfiguration\VariableCollection - { - return $this->requestVariables; - } -} - + + + + {tests_directory} + + -declare (strict_types=1); -/* - * This file is part of PHPUnit. - * - * (c) Sebastian Bergmann - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; + + + {src_directory} + + + -use const PATH_SEPARATOR; -use function constant; -use function define; -use function defined; -use function getenv; -use function implode; -use function ini_get; -use function ini_set; -use function putenv; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class PhpHandler -{ - public function handle(\PHPUnit\TextUI\XmlConfiguration\Php $configuration) : void - { - $this->handleIncludePaths($configuration->includePaths()); - $this->handleIniSettings($configuration->iniSettings()); - $this->handleConstants($configuration->constants()); - $this->handleGlobalVariables($configuration->globalVariables()); - $this->handleServerVariables($configuration->serverVariables()); - $this->handleEnvVariables($configuration->envVariables()); - $this->handleVariables('_POST', $configuration->postVariables()); - $this->handleVariables('_GET', $configuration->getVariables()); - $this->handleVariables('_COOKIE', $configuration->cookieVariables()); - $this->handleVariables('_FILES', $configuration->filesVariables()); - $this->handleVariables('_REQUEST', $configuration->requestVariables()); - } - private function handleIncludePaths(\PHPUnit\TextUI\XmlConfiguration\DirectoryCollection $includePaths) : void - { - if (!$includePaths->isEmpty()) { - $includePathsAsStrings = []; - foreach ($includePaths as $includePath) { - $includePathsAsStrings[] = $includePath->path(); - } - ini_set('include_path', implode(PATH_SEPARATOR, $includePathsAsStrings) . PATH_SEPARATOR . ini_get('include_path')); - } - } - private function handleIniSettings(\PHPUnit\TextUI\XmlConfiguration\IniSettingCollection $iniSettings) : void - { - foreach ($iniSettings as $iniSetting) { - $value = $iniSetting->value(); - if (defined($value)) { - $value = (string) constant($value); - } - ini_set($iniSetting->name(), $value); - } - } - private function handleConstants(\PHPUnit\TextUI\XmlConfiguration\ConstantCollection $constants) : void - { - foreach ($constants as $constant) { - if (!defined($constant->name())) { - define($constant->name(), $constant->value()); - } - } - } - private function handleGlobalVariables(\PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables) : void - { - foreach ($variables as $variable) { - $GLOBALS[$variable->name()] = $variable->value(); - } - } - private function handleServerVariables(\PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables) : void - { - foreach ($variables as $variable) { - $_SERVER[$variable->name()] = $variable->value(); - } - } - private function handleVariables(string $target, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables) : void - { - foreach ($variables as $variable) { - $GLOBALS[$target][$variable->name()] = $variable->value(); - } - } - private function handleEnvVariables(\PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables) : void +EOT; + public function generateDefaultConfiguration(string $phpunitVersion, string $bootstrapScript, string $testsDirectory, string $srcDirectory, string $cacheDirectory): string { - foreach ($variables as $variable) { - $name = $variable->name(); - $value = $variable->value(); - $force = $variable->force(); - if ($force || getenv($name) === \false) { - putenv("{$name}={$value}"); - } - $value = getenv($name); - if ($force || !isset($_ENV[$name])) { - $_ENV[$name] = $value; - } - } + return str_replace(['{phpunit_version}', '{bootstrap_script}', '{tests_directory}', '{src_directory}', '{cache_directory}'], [$phpunitVersion, $bootstrapScript, $testsDirectory, $srcDirectory, $cacheDirectory], self::TEMPLATE); } } name = $name; - $this->value = $value; - $this->force = $force; } - public function name() : string + public function name(): string { return $this->name; } - public function value() - { - return $this->value; - } - public function force() : bool - { - return $this->force; - } } + * @template-implements IteratorAggregate */ -final class VariableCollection implements Countable, IteratorAggregate +final class GroupCollection implements IteratorAggregate { /** - * @var Variable[] + * @var Group[] */ - private $variables; + private $groups; /** - * @param Variable[] $variables + * @param Group[] $groups */ - public static function fromArray(array $variables) : self + public static function fromArray(array $groups): self { - return new self(...$variables); + return new self(...$groups); } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\Variable ...$variables) + private function __construct(\PHPUnit\TextUI\XmlConfiguration\Group ...$groups) { - $this->variables = $variables; + $this->groups = $groups; } /** - * @return Variable[] + * @return Group[] */ - public function asArray() : array + public function asArray(): array { - return $this->variables; + return $this->groups; } - public function count() : int + /** + * @return string[] + */ + public function asArrayOfStrings(): array { - return count($this->variables); + $result = []; + foreach ($this->groups as $group) { + $result[] = $group->name(); + } + return $result; } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\VariableCollectionIterator + public function isEmpty(): bool { - return new \PHPUnit\TextUI\XmlConfiguration\VariableCollectionIterator($this); + return empty($this->groups); + } + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\GroupCollectionIterator + { + return new \PHPUnit\TextUI\XmlConfiguration\GroupCollectionIterator($this); } } + * @template-implements Iterator */ -final class VariableCollectionIterator implements Countable, Iterator +final class GroupCollectionIterator implements Countable, Iterator { /** - * @var Variable[] + * @var Group[] */ - private $variables; + private $groups; /** * @var int */ private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables) + public function __construct(\PHPUnit\TextUI\XmlConfiguration\GroupCollection $groups) { - $this->variables = $variables->asArray(); + $this->groups = $groups->asArray(); } - public function count() : int + public function count(): int { return iterator_count($this); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - public function valid() : bool + public function valid(): bool { - return $this->position < count($this->variables); + return $this->position < count($this->groups); } - public function key() : int + public function key(): int { return $this->position; } - public function current() : \PHPUnit\TextUI\XmlConfiguration\Variable + public function current(): \PHPUnit\TextUI\XmlConfiguration\Group { - return $this->variables[$this->position]; + return $this->groups[$this->position]; } - public function next() : void + public function next(): void { $this->position++; } @@ -78019,53 +84588,36 @@ namespace PHPUnit\TextUI\XmlConfiguration; * * @psalm-immutable */ -final class Extension +final class Groups { /** - * @var string - * - * @psalm-var class-string - */ - private $className; - /** - * @var string - */ - private $sourceFile; - /** - * @var array - */ - private $arguments; - /** - * @psalm-param class-string $className + * @var GroupCollection */ - public function __construct(string $className, string $sourceFile, array $arguments) - { - $this->className = $className; - $this->sourceFile = $sourceFile; - $this->arguments = $arguments; - } + private $include; /** - * @psalm-return class-string + * @var GroupCollection */ - public function className() : string + private $exclude; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\GroupCollection $include, \PHPUnit\TextUI\XmlConfiguration\GroupCollection $exclude) { - return $this->className; + $this->include = $include; + $this->exclude = $exclude; } - public function hasSourceFile() : bool + public function hasInclude(): bool { - return $this->sourceFile !== ''; + return !$this->include->isEmpty(); } - public function sourceFile() : string + public function include(): \PHPUnit\TextUI\XmlConfiguration\GroupCollection { - return $this->sourceFile; + return $this->include; } - public function hasArguments() : bool + public function hasExclude(): bool { - return !empty($this->arguments); + return !$this->exclude->isEmpty(); } - public function arguments() : array + public function exclude(): \PHPUnit\TextUI\XmlConfiguration\GroupCollection { - return $this->arguments; + return $this->exclude; } } */ -final class ExtensionCollection implements IteratorAggregate +final class Loader { /** - * @var Extension[] - */ - private $extensions; - /** - * @param Extension[] $extensions + * @throws Exception */ - public static function fromArray(array $extensions) : self + public function load(string $filename): \PHPUnit\TextUI\XmlConfiguration\Configuration { - return new self(...$extensions); + try { + $document = (new XmlLoader())->loadFile($filename, \false, \true, \true); + } catch (XmlException $e) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception($e->getMessage(), $e->getCode(), $e); + } + $xpath = new DOMXPath($document); + try { + $xsdFilename = (new SchemaFinder())->find(Version::series()); + } catch (XmlException $e) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception($e->getMessage(), $e->getCode(), $e); + } + return new \PHPUnit\TextUI\XmlConfiguration\Configuration($filename, (new Validator())->validate($document, $xsdFilename), $this->extensions($filename, $xpath), $this->codeCoverage($filename, $xpath, $document), $this->groups($xpath), $this->testdoxGroups($xpath), $this->listeners($filename, $xpath), $this->logging($filename, $xpath), $this->php($filename, $xpath), $this->phpunit($filename, $document), $this->testSuite($filename, $xpath)); } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\Extension ...$extensions) + public function logging(string $filename, DOMXPath $xpath): Logging { - $this->extensions = $extensions; + if ($xpath->query('logging/log')->length !== 0) { + return $this->legacyLogging($filename, $xpath); + } + $junit = null; + $element = $this->element($xpath, 'logging/junit'); + if ($element) { + $junit = new Junit(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + $text = null; + $element = $this->element($xpath, 'logging/text'); + if ($element) { + $text = new Text(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + $teamCity = null; + $element = $this->element($xpath, 'logging/teamcity'); + if ($element) { + $teamCity = new TeamCity(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + $testDoxHtml = null; + $element = $this->element($xpath, 'logging/testdoxHtml'); + if ($element) { + $testDoxHtml = new TestDoxHtml(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + $testDoxText = null; + $element = $this->element($xpath, 'logging/testdoxText'); + if ($element) { + $testDoxText = new TestDoxText(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + $testDoxXml = null; + $element = $this->element($xpath, 'logging/testdoxXml'); + if ($element) { + $testDoxXml = new TestDoxXml(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + return new Logging($junit, $text, $teamCity, $testDoxHtml, $testDoxText, $testDoxXml); } - /** - * @return Extension[] - */ - public function asArray() : array + public function legacyLogging(string $filename, DOMXPath $xpath): Logging { - return $this->extensions; + $junit = null; + $teamCity = null; + $testDoxHtml = null; + $testDoxText = null; + $testDoxXml = null; + $text = null; + foreach ($xpath->query('logging/log') as $log) { + assert($log instanceof DOMElement); + $type = (string) $log->getAttribute('type'); + $target = (string) $log->getAttribute('target'); + if (!$target) { + continue; + } + $target = $this->toAbsolutePath($filename, $target); + switch ($type) { + case 'plain': + $text = new Text(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + case 'junit': + $junit = new Junit(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + case 'teamcity': + $teamCity = new TeamCity(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + case 'testdox-html': + $testDoxHtml = new TestDoxHtml(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + case 'testdox-text': + $testDoxText = new TestDoxText(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + case 'testdox-xml': + $testDoxXml = new TestDoxXml(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + } + } + return new Logging($junit, $text, $teamCity, $testDoxHtml, $testDoxText, $testDoxXml); } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\ExtensionCollectionIterator + private function extensions(string $filename, DOMXPath $xpath): \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection { - return new \PHPUnit\TextUI\XmlConfiguration\ExtensionCollectionIterator($this); + $extensions = []; + foreach ($xpath->query('extensions/extension') as $extension) { + assert($extension instanceof DOMElement); + $extensions[] = $this->getElementConfigurationParameters($filename, $extension); + } + return \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection::fromArray($extensions); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\TextUI\XmlConfiguration; - -use function count; -use function iterator_count; -use Countable; -use Iterator; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @template-implements Iterator - */ -final class ExtensionCollectionIterator implements Countable, Iterator -{ - /** - * @var Extension[] - */ - private $extensions; - /** - * @var int - */ - private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\ExtensionCollection $extensions) + private function getElementConfigurationParameters(string $filename, DOMElement $element): \PHPUnit\TextUI\XmlConfiguration\Extension { - $this->extensions = $extensions->asArray(); + /** @psalm-var class-string $class */ + $class = (string) $element->getAttribute('class'); + $file = ''; + $arguments = $this->getConfigurationArguments($filename, $element->childNodes); + if ($element->getAttribute('file')) { + $file = $this->toAbsolutePath($filename, (string) $element->getAttribute('file'), \true); + } + return new \PHPUnit\TextUI\XmlConfiguration\Extension($class, $file, $arguments); } - public function count() : int + private function toAbsolutePath(string $filename, string $path, bool $useIncludePath = \false): string { - return iterator_count($this); + $path = trim($path); + if (strpos($path, '/') === 0) { + return $path; + } + // Matches the following on Windows: + // - \\NetworkComputer\Path + // - \\.\D: + // - \\.\c: + // - C:\Windows + // - C:\windows + // - C:/windows + // - c:/windows + if (defined('PHP_WINDOWS_VERSION_BUILD') && ($path[0] === '\\' || strlen($path) >= 3 && preg_match('#^[A-Z]\:[/\\\\]#i', substr($path, 0, 3)))) { + return $path; + } + if (strpos($path, '://') !== \false) { + return $path; + } + $file = dirname($filename) . DIRECTORY_SEPARATOR . $path; + if ($useIncludePath && !is_file($file)) { + $includePathFile = stream_resolve_include_path($path); + if ($includePathFile) { + $file = $includePathFile; + } + } + return $file; } - public function rewind() : void + private function getConfigurationArguments(string $filename, DOMNodeList $nodes): array { - $this->position = 0; + $arguments = []; + if ($nodes->length === 0) { + return $arguments; + } + foreach ($nodes as $node) { + if (!$node instanceof DOMElement) { + continue; + } + if ($node->tagName !== 'arguments') { + continue; + } + foreach ($node->childNodes as $argument) { + if (!$argument instanceof DOMElement) { + continue; + } + if ($argument->tagName === 'file' || $argument->tagName === 'directory') { + $arguments[] = $this->toAbsolutePath($filename, (string) $argument->textContent); + } else { + $arguments[] = Xml::xmlToVariable($argument); + } + } + } + return $arguments; } - public function valid() : bool + private function codeCoverage(string $filename, DOMXPath $xpath, DOMDocument $document): CodeCoverage { - return $this->position < count($this->extensions); + if ($xpath->query('filter/whitelist')->length !== 0) { + return $this->legacyCodeCoverage($filename, $xpath, $document); + } + $cacheDirectory = null; + $pathCoverage = \false; + $includeUncoveredFiles = \true; + $processUncoveredFiles = \false; + $ignoreDeprecatedCodeUnits = \false; + $disableCodeCoverageIgnore = \false; + $element = $this->element($xpath, 'coverage'); + if ($element) { + $cacheDirectory = $this->getStringAttribute($element, 'cacheDirectory'); + if ($cacheDirectory !== null) { + $cacheDirectory = new \PHPUnit\TextUI\XmlConfiguration\Directory($this->toAbsolutePath($filename, $cacheDirectory)); + } + $pathCoverage = $this->getBooleanAttribute($element, 'pathCoverage', \false); + $includeUncoveredFiles = $this->getBooleanAttribute($element, 'includeUncoveredFiles', \true); + $processUncoveredFiles = $this->getBooleanAttribute($element, 'processUncoveredFiles', \false); + $ignoreDeprecatedCodeUnits = $this->getBooleanAttribute($element, 'ignoreDeprecatedCodeUnits', \false); + $disableCodeCoverageIgnore = $this->getBooleanAttribute($element, 'disableCodeCoverageIgnore', \false); + } + $clover = null; + $element = $this->element($xpath, 'coverage/report/clover'); + if ($element) { + $clover = new Clover(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + $cobertura = null; + $element = $this->element($xpath, 'coverage/report/cobertura'); + if ($element) { + $cobertura = new Cobertura(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + $crap4j = null; + $element = $this->element($xpath, 'coverage/report/crap4j'); + if ($element) { + $crap4j = new Crap4j(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))), $this->getIntegerAttribute($element, 'threshold', 30)); + } + $html = null; + $element = $this->element($xpath, 'coverage/report/html'); + if ($element) { + $html = new CodeCoverageHtml(new \PHPUnit\TextUI\XmlConfiguration\Directory($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputDirectory'))), $this->getIntegerAttribute($element, 'lowUpperBound', 50), $this->getIntegerAttribute($element, 'highLowerBound', 90)); + } + $php = null; + $element = $this->element($xpath, 'coverage/report/php'); + if ($element) { + $php = new CodeCoveragePhp(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile')))); + } + $text = null; + $element = $this->element($xpath, 'coverage/report/text'); + if ($element) { + $text = new CodeCoverageText(new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))), $this->getBooleanAttribute($element, 'showUncoveredFiles', \false), $this->getBooleanAttribute($element, 'showOnlySummary', \false)); + } + $xml = null; + $element = $this->element($xpath, 'coverage/report/xml'); + if ($element) { + $xml = new CodeCoverageXml(new \PHPUnit\TextUI\XmlConfiguration\Directory($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputDirectory')))); + } + return new CodeCoverage($cacheDirectory, $this->readFilterDirectories($filename, $xpath, 'coverage/include/directory'), $this->readFilterFiles($filename, $xpath, 'coverage/include/file'), $this->readFilterDirectories($filename, $xpath, 'coverage/exclude/directory'), $this->readFilterFiles($filename, $xpath, 'coverage/exclude/file'), $pathCoverage, $includeUncoveredFiles, $processUncoveredFiles, $ignoreDeprecatedCodeUnits, $disableCodeCoverageIgnore, $clover, $cobertura, $crap4j, $html, $php, $text, $xml); } - public function key() : int + /** + * @deprecated + */ + private function legacyCodeCoverage(string $filename, DOMXPath $xpath, DOMDocument $document): CodeCoverage { - return $this->position; + $ignoreDeprecatedCodeUnits = $this->getBooleanAttribute($document->documentElement, 'ignoreDeprecatedCodeUnitsFromCodeCoverage', \false); + $disableCodeCoverageIgnore = $this->getBooleanAttribute($document->documentElement, 'disableCodeCoverageIgnore', \false); + $includeUncoveredFiles = \true; + $processUncoveredFiles = \false; + $element = $this->element($xpath, 'filter/whitelist'); + if ($element) { + if ($element->hasAttribute('addUncoveredFilesFromWhitelist')) { + $includeUncoveredFiles = (bool) $this->getBoolean((string) $element->getAttribute('addUncoveredFilesFromWhitelist'), \true); + } + if ($element->hasAttribute('processUncoveredFilesFromWhitelist')) { + $processUncoveredFiles = (bool) $this->getBoolean((string) $element->getAttribute('processUncoveredFilesFromWhitelist'), \false); + } + } + $clover = null; + $cobertura = null; + $crap4j = null; + $html = null; + $php = null; + $text = null; + $xml = null; + foreach ($xpath->query('logging/log') as $log) { + assert($log instanceof DOMElement); + $type = (string) $log->getAttribute('type'); + $target = (string) $log->getAttribute('target'); + if (!$target) { + continue; + } + $target = $this->toAbsolutePath($filename, $target); + switch ($type) { + case 'coverage-clover': + $clover = new Clover(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + case 'coverage-cobertura': + $cobertura = new Cobertura(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + case 'coverage-crap4j': + $crap4j = new Crap4j(new \PHPUnit\TextUI\XmlConfiguration\File($target), $this->getIntegerAttribute($log, 'threshold', 30)); + break; + case 'coverage-html': + $html = new CodeCoverageHtml(new \PHPUnit\TextUI\XmlConfiguration\Directory($target), $this->getIntegerAttribute($log, 'lowUpperBound', 50), $this->getIntegerAttribute($log, 'highLowerBound', 90)); + break; + case 'coverage-php': + $php = new CodeCoveragePhp(new \PHPUnit\TextUI\XmlConfiguration\File($target)); + break; + case 'coverage-text': + $text = new CodeCoverageText(new \PHPUnit\TextUI\XmlConfiguration\File($target), $this->getBooleanAttribute($log, 'showUncoveredFiles', \false), $this->getBooleanAttribute($log, 'showOnlySummary', \false)); + break; + case 'coverage-xml': + $xml = new CodeCoverageXml(new \PHPUnit\TextUI\XmlConfiguration\Directory($target)); + break; + } + } + return new CodeCoverage(null, $this->readFilterDirectories($filename, $xpath, 'filter/whitelist/directory'), $this->readFilterFiles($filename, $xpath, 'filter/whitelist/file'), $this->readFilterDirectories($filename, $xpath, 'filter/whitelist/exclude/directory'), $this->readFilterFiles($filename, $xpath, 'filter/whitelist/exclude/file'), \false, $includeUncoveredFiles, $processUncoveredFiles, $ignoreDeprecatedCodeUnits, $disableCodeCoverageIgnore, $clover, $cobertura, $crap4j, $html, $php, $text, $xml); } - public function current() : \PHPUnit\TextUI\XmlConfiguration\Extension + /** + * If $value is 'false' or 'true', this returns the value that $value represents. + * Otherwise, returns $default, which may be a string in rare cases. + * + * @see \PHPUnit\TextUI\XmlConfigurationTest::testPHPConfigurationIsReadCorrectly + * + * @param bool|string $default + * + * @return bool|string + */ + private function getBoolean(string $value, $default) { - return $this->extensions[$this->position]; + if (strtolower($value) === 'false') { + return \false; + } + if (strtolower($value) === 'true') { + return \true; + } + return $default; } - public function next() : void + private function readFilterDirectories(string $filename, DOMXPath $xpath, string $query): FilterDirectoryCollection { - $this->position++; + $directories = []; + foreach ($xpath->query($query) as $directoryNode) { + assert($directoryNode instanceof DOMElement); + $directoryPath = (string) $directoryNode->textContent; + if (!$directoryPath) { + continue; + } + $directories[] = new FilterDirectory($this->toAbsolutePath($filename, $directoryPath), $directoryNode->hasAttribute('prefix') ? (string) $directoryNode->getAttribute('prefix') : '', $directoryNode->hasAttribute('suffix') ? (string) $directoryNode->getAttribute('suffix') : '.php', $directoryNode->hasAttribute('group') ? (string) $directoryNode->getAttribute('group') : 'DEFAULT'); + } + return FilterDirectoryCollection::fromArray($directories); + } + private function readFilterFiles(string $filename, DOMXPath $xpath, string $query): \PHPUnit\TextUI\XmlConfiguration\FileCollection + { + $files = []; + foreach ($xpath->query($query) as $file) { + assert($file instanceof DOMNode); + $filePath = (string) $file->textContent; + if ($filePath) { + $files[] = new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, $filePath)); + } + } + return \PHPUnit\TextUI\XmlConfiguration\FileCollection::fromArray($files); + } + private function groups(DOMXPath $xpath): \PHPUnit\TextUI\XmlConfiguration\Groups + { + return $this->parseGroupConfiguration($xpath, 'groups'); + } + private function testdoxGroups(DOMXPath $xpath): \PHPUnit\TextUI\XmlConfiguration\Groups + { + return $this->parseGroupConfiguration($xpath, 'testdoxGroups'); + } + private function parseGroupConfiguration(DOMXPath $xpath, string $root): \PHPUnit\TextUI\XmlConfiguration\Groups + { + $include = []; + $exclude = []; + foreach ($xpath->query($root . '/include/group') as $group) { + assert($group instanceof DOMNode); + $include[] = new \PHPUnit\TextUI\XmlConfiguration\Group((string) $group->textContent); + } + foreach ($xpath->query($root . '/exclude/group') as $group) { + assert($group instanceof DOMNode); + $exclude[] = new \PHPUnit\TextUI\XmlConfiguration\Group((string) $group->textContent); + } + return new \PHPUnit\TextUI\XmlConfiguration\Groups(\PHPUnit\TextUI\XmlConfiguration\GroupCollection::fromArray($include), \PHPUnit\TextUI\XmlConfiguration\GroupCollection::fromArray($exclude)); + } + private function listeners(string $filename, DOMXPath $xpath): \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection + { + $listeners = []; + foreach ($xpath->query('listeners/listener') as $listener) { + assert($listener instanceof DOMElement); + $listeners[] = $this->getElementConfigurationParameters($filename, $listener); + } + return \PHPUnit\TextUI\XmlConfiguration\ExtensionCollection::fromArray($listeners); + } + private function getBooleanAttribute(DOMElement $element, string $attribute, bool $default): bool + { + if (!$element->hasAttribute($attribute)) { + return $default; + } + return (bool) $this->getBoolean((string) $element->getAttribute($attribute), \false); + } + private function getIntegerAttribute(DOMElement $element, string $attribute, int $default): int + { + if (!$element->hasAttribute($attribute)) { + return $default; + } + return $this->getInteger((string) $element->getAttribute($attribute), $default); + } + private function getStringAttribute(DOMElement $element, string $attribute): ?string + { + if (!$element->hasAttribute($attribute)) { + return null; + } + return (string) $element->getAttribute($attribute); + } + private function getInteger(string $value, int $default): int + { + if (is_numeric($value)) { + return (int) $value; + } + return $default; + } + private function php(string $filename, DOMXPath $xpath): \PHPUnit\TextUI\XmlConfiguration\Php + { + $includePaths = []; + foreach ($xpath->query('php/includePath') as $includePath) { + assert($includePath instanceof DOMNode); + $path = (string) $includePath->textContent; + if ($path) { + $includePaths[] = new \PHPUnit\TextUI\XmlConfiguration\Directory($this->toAbsolutePath($filename, $path)); + } + } + $iniSettings = []; + foreach ($xpath->query('php/ini') as $ini) { + assert($ini instanceof DOMElement); + $iniSettings[] = new \PHPUnit\TextUI\XmlConfiguration\IniSetting((string) $ini->getAttribute('name'), (string) $ini->getAttribute('value')); + } + $constants = []; + foreach ($xpath->query('php/const') as $const) { + assert($const instanceof DOMElement); + $value = (string) $const->getAttribute('value'); + $constants[] = new \PHPUnit\TextUI\XmlConfiguration\Constant((string) $const->getAttribute('name'), $this->getBoolean($value, $value)); + } + $variables = ['var' => [], 'env' => [], 'post' => [], 'get' => [], 'cookie' => [], 'server' => [], 'files' => [], 'request' => []]; + foreach (['var', 'env', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) { + foreach ($xpath->query('php/' . $array) as $var) { + assert($var instanceof DOMElement); + $name = (string) $var->getAttribute('name'); + $value = (string) $var->getAttribute('value'); + $force = \false; + $verbatim = \false; + if ($var->hasAttribute('force')) { + $force = (bool) $this->getBoolean($var->getAttribute('force'), \false); + } + if ($var->hasAttribute('verbatim')) { + $verbatim = $this->getBoolean($var->getAttribute('verbatim'), \false); + } + if (!$verbatim) { + $value = $this->getBoolean($value, $value); + } + $variables[$array][] = new \PHPUnit\TextUI\XmlConfiguration\Variable($name, $value, $force); + } + } + return new \PHPUnit\TextUI\XmlConfiguration\Php(\PHPUnit\TextUI\XmlConfiguration\DirectoryCollection::fromArray($includePaths), \PHPUnit\TextUI\XmlConfiguration\IniSettingCollection::fromArray($iniSettings), \PHPUnit\TextUI\XmlConfiguration\ConstantCollection::fromArray($constants), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['var']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['env']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['post']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['get']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['cookie']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['server']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['files']), \PHPUnit\TextUI\XmlConfiguration\VariableCollection::fromArray($variables['request'])); + } + private function phpunit(string $filename, DOMDocument $document): \PHPUnit\TextUI\XmlConfiguration\PHPUnit + { + $executionOrder = TestSuiteSorter::ORDER_DEFAULT; + $defectsFirst = \false; + $resolveDependencies = $this->getBooleanAttribute($document->documentElement, 'resolveDependencies', \true); + if ($document->documentElement->hasAttribute('executionOrder')) { + foreach (explode(',', $document->documentElement->getAttribute('executionOrder')) as $order) { + switch ($order) { + case 'default': + $executionOrder = TestSuiteSorter::ORDER_DEFAULT; + $defectsFirst = \false; + $resolveDependencies = \true; + break; + case 'depends': + $resolveDependencies = \true; + break; + case 'no-depends': + $resolveDependencies = \false; + break; + case 'defects': + $defectsFirst = \true; + break; + case 'duration': + $executionOrder = TestSuiteSorter::ORDER_DURATION; + break; + case 'random': + $executionOrder = TestSuiteSorter::ORDER_RANDOMIZED; + break; + case 'reverse': + $executionOrder = TestSuiteSorter::ORDER_REVERSED; + break; + case 'size': + $executionOrder = TestSuiteSorter::ORDER_SIZE; + break; + } + } + } + $printerClass = $this->getStringAttribute($document->documentElement, 'printerClass'); + $testdox = $this->getBooleanAttribute($document->documentElement, 'testdox', \false); + $conflictBetweenPrinterClassAndTestdox = \false; + if ($testdox) { + if ($printerClass !== null) { + $conflictBetweenPrinterClassAndTestdox = \true; + } + $printerClass = CliTestDoxPrinter::class; + } + $cacheResultFile = $this->getStringAttribute($document->documentElement, 'cacheResultFile'); + if ($cacheResultFile !== null) { + $cacheResultFile = $this->toAbsolutePath($filename, $cacheResultFile); + } + $bootstrap = $this->getStringAttribute($document->documentElement, 'bootstrap'); + if ($bootstrap !== null) { + $bootstrap = $this->toAbsolutePath($filename, $bootstrap); + } + $extensionsDirectory = $this->getStringAttribute($document->documentElement, 'extensionsDirectory'); + if ($extensionsDirectory !== null) { + $extensionsDirectory = $this->toAbsolutePath($filename, $extensionsDirectory); + } + $testSuiteLoaderFile = $this->getStringAttribute($document->documentElement, 'testSuiteLoaderFile'); + if ($testSuiteLoaderFile !== null) { + $testSuiteLoaderFile = $this->toAbsolutePath($filename, $testSuiteLoaderFile); + } + $printerFile = $this->getStringAttribute($document->documentElement, 'printerFile'); + if ($printerFile !== null) { + $printerFile = $this->toAbsolutePath($filename, $printerFile); + } + return new \PHPUnit\TextUI\XmlConfiguration\PHPUnit($this->getBooleanAttribute($document->documentElement, 'cacheResult', \true), $cacheResultFile, $this->getColumns($document), $this->getColors($document), $this->getBooleanAttribute($document->documentElement, 'stderr', \false), $this->getBooleanAttribute($document->documentElement, 'noInteraction', \false), $this->getBooleanAttribute($document->documentElement, 'verbose', \false), $this->getBooleanAttribute($document->documentElement, 'reverseDefectList', \false), $this->getBooleanAttribute($document->documentElement, 'convertDeprecationsToExceptions', \false), $this->getBooleanAttribute($document->documentElement, 'convertErrorsToExceptions', \true), $this->getBooleanAttribute($document->documentElement, 'convertNoticesToExceptions', \true), $this->getBooleanAttribute($document->documentElement, 'convertWarningsToExceptions', \true), $this->getBooleanAttribute($document->documentElement, 'forceCoversAnnotation', \false), $bootstrap, $this->getBooleanAttribute($document->documentElement, 'processIsolation', \false), $this->getBooleanAttribute($document->documentElement, 'failOnEmptyTestSuite', \false), $this->getBooleanAttribute($document->documentElement, 'failOnIncomplete', \false), $this->getBooleanAttribute($document->documentElement, 'failOnRisky', \false), $this->getBooleanAttribute($document->documentElement, 'failOnSkipped', \false), $this->getBooleanAttribute($document->documentElement, 'failOnWarning', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnDefect', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnError', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnFailure', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnWarning', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnIncomplete', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnRisky', \false), $this->getBooleanAttribute($document->documentElement, 'stopOnSkipped', \false), $extensionsDirectory, $this->getStringAttribute($document->documentElement, 'testSuiteLoaderClass'), $testSuiteLoaderFile, $printerClass, $printerFile, $this->getBooleanAttribute($document->documentElement, 'beStrictAboutChangesToGlobalState', \false), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutOutputDuringTests', \false), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutResourceUsageDuringSmallTests', \false), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutTestsThatDoNotTestAnything', \true), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutTodoAnnotatedTests', \false), $this->getBooleanAttribute($document->documentElement, 'beStrictAboutCoversAnnotation', \false), $this->getBooleanAttribute($document->documentElement, 'enforceTimeLimit', \false), $this->getIntegerAttribute($document->documentElement, 'defaultTimeLimit', 1), $this->getIntegerAttribute($document->documentElement, 'timeoutForSmallTests', 1), $this->getIntegerAttribute($document->documentElement, 'timeoutForMediumTests', 10), $this->getIntegerAttribute($document->documentElement, 'timeoutForLargeTests', 60), $this->getStringAttribute($document->documentElement, 'defaultTestSuite'), $executionOrder, $resolveDependencies, $defectsFirst, $this->getBooleanAttribute($document->documentElement, 'backupGlobals', \false), $this->getBooleanAttribute($document->documentElement, 'backupStaticAttributes', \false), $this->getBooleanAttribute($document->documentElement, 'registerMockObjectsFromTestArgumentsRecursively', \false), $conflictBetweenPrinterClassAndTestdox); + } + private function getColors(DOMDocument $document): string + { + $colors = DefaultResultPrinter::COLOR_DEFAULT; + if ($document->documentElement->hasAttribute('colors')) { + /* only allow boolean for compatibility with previous versions + 'always' only allowed from command line */ + if ($this->getBoolean($document->documentElement->getAttribute('colors'), \false)) { + $colors = DefaultResultPrinter::COLOR_AUTO; + } else { + $colors = DefaultResultPrinter::COLOR_NEVER; + } + } + return $colors; + } + /** + * @return int|string + */ + private function getColumns(DOMDocument $document) + { + $columns = 80; + if ($document->documentElement->hasAttribute('columns')) { + $columns = (string) $document->documentElement->getAttribute('columns'); + if ($columns !== 'max') { + $columns = $this->getInteger($columns, 80); + } + } + return $columns; + } + private function testSuite(string $filename, DOMXPath $xpath): \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection + { + $testSuites = []; + foreach ($this->getTestSuiteElements($xpath) as $element) { + $exclude = []; + foreach ($element->getElementsByTagName('exclude') as $excludeNode) { + $excludeFile = (string) $excludeNode->textContent; + if ($excludeFile) { + $exclude[] = new \PHPUnit\TextUI\XmlConfiguration\File($this->toAbsolutePath($filename, $excludeFile)); + } + } + $directories = []; + foreach ($element->getElementsByTagName('directory') as $directoryNode) { + assert($directoryNode instanceof DOMElement); + $directory = (string) $directoryNode->textContent; + if (empty($directory)) { + continue; + } + $prefix = ''; + if ($directoryNode->hasAttribute('prefix')) { + $prefix = (string) $directoryNode->getAttribute('prefix'); + } + $suffix = 'Test.php'; + if ($directoryNode->hasAttribute('suffix')) { + $suffix = (string) $directoryNode->getAttribute('suffix'); + } + $phpVersion = PHP_VERSION; + if ($directoryNode->hasAttribute('phpVersion')) { + $phpVersion = (string) $directoryNode->getAttribute('phpVersion'); + } + $phpVersionOperator = new VersionComparisonOperator('>='); + if ($directoryNode->hasAttribute('phpVersionOperator')) { + $phpVersionOperator = new VersionComparisonOperator((string) $directoryNode->getAttribute('phpVersionOperator')); + } + $directories[] = new \PHPUnit\TextUI\XmlConfiguration\TestDirectory($this->toAbsolutePath($filename, $directory), $prefix, $suffix, $phpVersion, $phpVersionOperator); + } + $files = []; + foreach ($element->getElementsByTagName('file') as $fileNode) { + assert($fileNode instanceof DOMElement); + $file = (string) $fileNode->textContent; + if (empty($file)) { + continue; + } + $phpVersion = PHP_VERSION; + if ($fileNode->hasAttribute('phpVersion')) { + $phpVersion = (string) $fileNode->getAttribute('phpVersion'); + } + $phpVersionOperator = new VersionComparisonOperator('>='); + if ($fileNode->hasAttribute('phpVersionOperator')) { + $phpVersionOperator = new VersionComparisonOperator((string) $fileNode->getAttribute('phpVersionOperator')); + } + $files[] = new \PHPUnit\TextUI\XmlConfiguration\TestFile($this->toAbsolutePath($filename, $file), $phpVersion, $phpVersionOperator); + } + $testSuites[] = new TestSuiteConfiguration((string) $element->getAttribute('name'), \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollection::fromArray($directories), \PHPUnit\TextUI\XmlConfiguration\TestFileCollection::fromArray($files), \PHPUnit\TextUI\XmlConfiguration\FileCollection::fromArray($exclude)); + } + return \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection::fromArray($testSuites); + } + /** + * @return DOMElement[] + */ + private function getTestSuiteElements(DOMXPath $xpath): array + { + /** @var DOMElement[] $elements */ + $elements = []; + $testSuiteNodes = $xpath->query('testsuites/testsuite'); + if ($testSuiteNodes->length === 0) { + $testSuiteNodes = $xpath->query('testsuite'); + } + if ($testSuiteNodes->length === 1) { + $element = $testSuiteNodes->item(0); + assert($element instanceof DOMElement); + $elements[] = $element; + } else { + foreach ($testSuiteNodes as $testSuiteNode) { + assert($testSuiteNode instanceof DOMElement); + $elements[] = $testSuiteNode; + } + } + return $elements; + } + private function element(DOMXPath $xpath, string $element): ?DOMElement + { + $nodes = $xpath->query($element); + if ($nodes->length === 1) { + $node = $nodes->item(0); + assert($node instanceof DOMElement); + return $node; + } + return null; } } target = $target; + } + public function target(): File + { + return $this->target; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration\Logging; + +use PHPUnit\TextUI\XmlConfiguration\Exception; +use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Html as TestDoxHtml; +use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Text as TestDoxText; +use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Xml as TestDoxXml; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class Logging +{ /** - * @var bool + * @var ?Junit */ - private $resolveDependencies; + private $junit; /** - * @var bool + * @var ?Text */ - private $defectsFirst; + private $text; /** - * @var bool + * @var ?TeamCity */ - private $backupGlobals; + private $teamCity; /** - * @var bool + * @var ?TestDoxHtml */ - private $backupStaticAttributes; + private $testDoxHtml; /** - * @var bool + * @var ?TestDoxText */ - private $registerMockObjectsFromTestArgumentsRecursively; + private $testDoxText; /** - * @var bool + * @var ?TestDoxXml */ - private $conflictBetweenPrinterClassAndTestdox; - public function __construct(bool $cacheResult, ?string $cacheResultFile, $columns, string $colors, bool $stderr, bool $noInteraction, bool $verbose, bool $reverseDefectList, bool $convertDeprecationsToExceptions, bool $convertErrorsToExceptions, bool $convertNoticesToExceptions, bool $convertWarningsToExceptions, bool $forceCoversAnnotation, ?string $bootstrap, bool $processIsolation, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $stopOnDefect, bool $stopOnError, bool $stopOnFailure, bool $stopOnWarning, bool $stopOnIncomplete, bool $stopOnRisky, bool $stopOnSkipped, ?string $extensionsDirectory, ?string $testSuiteLoaderClass, ?string $testSuiteLoaderFile, ?string $printerClass, ?string $printerFile, bool $beStrictAboutChangesToGlobalState, bool $beStrictAboutOutputDuringTests, bool $beStrictAboutResourceUsageDuringSmallTests, bool $beStrictAboutTestsThatDoNotTestAnything, bool $beStrictAboutTodoAnnotatedTests, bool $beStrictAboutCoversAnnotation, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, ?string $defaultTestSuite, int $executionOrder, bool $resolveDependencies, bool $defectsFirst, bool $backupGlobals, bool $backupStaticAttributes, bool $registerMockObjectsFromTestArgumentsRecursively, bool $conflictBetweenPrinterClassAndTestdox) - { - $this->cacheResult = $cacheResult; - $this->cacheResultFile = $cacheResultFile; - $this->columns = $columns; - $this->colors = $colors; - $this->stderr = $stderr; - $this->noInteraction = $noInteraction; - $this->verbose = $verbose; - $this->reverseDefectList = $reverseDefectList; - $this->convertDeprecationsToExceptions = $convertDeprecationsToExceptions; - $this->convertErrorsToExceptions = $convertErrorsToExceptions; - $this->convertNoticesToExceptions = $convertNoticesToExceptions; - $this->convertWarningsToExceptions = $convertWarningsToExceptions; - $this->forceCoversAnnotation = $forceCoversAnnotation; - $this->bootstrap = $bootstrap; - $this->processIsolation = $processIsolation; - $this->failOnEmptyTestSuite = $failOnEmptyTestSuite; - $this->failOnIncomplete = $failOnIncomplete; - $this->failOnRisky = $failOnRisky; - $this->failOnSkipped = $failOnSkipped; - $this->failOnWarning = $failOnWarning; - $this->stopOnDefect = $stopOnDefect; - $this->stopOnError = $stopOnError; - $this->stopOnFailure = $stopOnFailure; - $this->stopOnWarning = $stopOnWarning; - $this->stopOnIncomplete = $stopOnIncomplete; - $this->stopOnRisky = $stopOnRisky; - $this->stopOnSkipped = $stopOnSkipped; - $this->extensionsDirectory = $extensionsDirectory; - $this->testSuiteLoaderClass = $testSuiteLoaderClass; - $this->testSuiteLoaderFile = $testSuiteLoaderFile; - $this->printerClass = $printerClass; - $this->printerFile = $printerFile; - $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; - $this->beStrictAboutOutputDuringTests = $beStrictAboutOutputDuringTests; - $this->beStrictAboutResourceUsageDuringSmallTests = $beStrictAboutResourceUsageDuringSmallTests; - $this->beStrictAboutTestsThatDoNotTestAnything = $beStrictAboutTestsThatDoNotTestAnything; - $this->beStrictAboutTodoAnnotatedTests = $beStrictAboutTodoAnnotatedTests; - $this->beStrictAboutCoversAnnotation = $beStrictAboutCoversAnnotation; - $this->enforceTimeLimit = $enforceTimeLimit; - $this->defaultTimeLimit = $defaultTimeLimit; - $this->timeoutForSmallTests = $timeoutForSmallTests; - $this->timeoutForMediumTests = $timeoutForMediumTests; - $this->timeoutForLargeTests = $timeoutForLargeTests; - $this->defaultTestSuite = $defaultTestSuite; - $this->executionOrder = $executionOrder; - $this->resolveDependencies = $resolveDependencies; - $this->defectsFirst = $defectsFirst; - $this->backupGlobals = $backupGlobals; - $this->backupStaticAttributes = $backupStaticAttributes; - $this->registerMockObjectsFromTestArgumentsRecursively = $registerMockObjectsFromTestArgumentsRecursively; - $this->conflictBetweenPrinterClassAndTestdox = $conflictBetweenPrinterClassAndTestdox; - } - public function cacheResult() : bool + private $testDoxXml; + public function __construct(?\PHPUnit\TextUI\XmlConfiguration\Logging\Junit $junit, ?\PHPUnit\TextUI\XmlConfiguration\Logging\Text $text, ?\PHPUnit\TextUI\XmlConfiguration\Logging\TeamCity $teamCity, ?TestDoxHtml $testDoxHtml, ?TestDoxText $testDoxText, ?TestDoxXml $testDoxXml) { - return $this->cacheResult; + $this->junit = $junit; + $this->text = $text; + $this->teamCity = $teamCity; + $this->testDoxHtml = $testDoxHtml; + $this->testDoxText = $testDoxText; + $this->testDoxXml = $testDoxXml; } - /** - * @psalm-assert-if-true !null $this->cacheResultFile - */ - public function hasCacheResultFile() : bool + public function hasJunit(): bool { - return $this->cacheResultFile !== null; + return $this->junit !== null; } - /** - * @throws Exception - */ - public function cacheResultFile() : string + public function junit(): \PHPUnit\TextUI\XmlConfiguration\Logging\Junit { - if (!$this->hasCacheResultFile()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception('Cache result file is not configured'); + if ($this->junit === null) { + throw new Exception('Logger "JUnit XML" is not configured'); } - return (string) $this->cacheResultFile; - } - public function columns() - { - return $this->columns; - } - public function colors() : string - { - return $this->colors; + return $this->junit; } - public function stderr() : bool + public function hasText(): bool { - return $this->stderr; + return $this->text !== null; } - public function noInteraction() : bool + public function text(): \PHPUnit\TextUI\XmlConfiguration\Logging\Text { - return $this->noInteraction; + if ($this->text === null) { + throw new Exception('Logger "Text" is not configured'); + } + return $this->text; } - public function verbose() : bool + public function hasTeamCity(): bool { - return $this->verbose; + return $this->teamCity !== null; } - public function reverseDefectList() : bool + public function teamCity(): \PHPUnit\TextUI\XmlConfiguration\Logging\TeamCity { - return $this->reverseDefectList; + if ($this->teamCity === null) { + throw new Exception('Logger "Team City" is not configured'); + } + return $this->teamCity; } - public function convertDeprecationsToExceptions() : bool + public function hasTestDoxHtml(): bool { - return $this->convertDeprecationsToExceptions; + return $this->testDoxHtml !== null; } - public function convertErrorsToExceptions() : bool + public function testDoxHtml(): TestDoxHtml { - return $this->convertErrorsToExceptions; + if ($this->testDoxHtml === null) { + throw new Exception('Logger "TestDox HTML" is not configured'); + } + return $this->testDoxHtml; } - public function convertNoticesToExceptions() : bool + public function hasTestDoxText(): bool { - return $this->convertNoticesToExceptions; + return $this->testDoxText !== null; } - public function convertWarningsToExceptions() : bool + public function testDoxText(): TestDoxText { - return $this->convertWarningsToExceptions; + if ($this->testDoxText === null) { + throw new Exception('Logger "TestDox Text" is not configured'); + } + return $this->testDoxText; } - public function forceCoversAnnotation() : bool + public function hasTestDoxXml(): bool { - return $this->forceCoversAnnotation; + return $this->testDoxXml !== null; } - /** - * @psalm-assert-if-true !null $this->bootstrap - */ - public function hasBootstrap() : bool + public function testDoxXml(): TestDoxXml { - return $this->bootstrap !== null; + if ($this->testDoxXml === null) { + throw new Exception('Logger "TestDox XML" is not configured'); + } + return $this->testDoxXml; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration\Logging; + +use PHPUnit\TextUI\XmlConfiguration\File; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class TeamCity +{ /** - * @throws Exception + * @var File */ - public function bootstrap() : string - { - if (!$this->hasBootstrap()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception('Bootstrap script is not configured'); - } - return (string) $this->bootstrap; - } - public function processIsolation() : bool - { - return $this->processIsolation; - } - public function failOnEmptyTestSuite() : bool - { - return $this->failOnEmptyTestSuite; - } - public function failOnIncomplete() : bool - { - return $this->failOnIncomplete; - } - public function failOnRisky() : bool - { - return $this->failOnRisky; - } - public function failOnSkipped() : bool - { - return $this->failOnSkipped; - } - public function failOnWarning() : bool - { - return $this->failOnWarning; - } - public function stopOnDefect() : bool - { - return $this->stopOnDefect; - } - public function stopOnError() : bool - { - return $this->stopOnError; - } - public function stopOnFailure() : bool - { - return $this->stopOnFailure; - } - public function stopOnWarning() : bool + private $target; + public function __construct(File $target) { - return $this->stopOnWarning; + $this->target = $target; } - public function stopOnIncomplete() : bool + public function target(): File { - return $this->stopOnIncomplete; + return $this->target; } - public function stopOnRisky() : bool +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration\Logging\TestDox; + +use PHPUnit\TextUI\XmlConfiguration\File; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class Html +{ + /** + * @var File + */ + private $target; + public function __construct(File $target) { - return $this->stopOnRisky; + $this->target = $target; } - public function stopOnSkipped() : bool + public function target(): File { - return $this->stopOnSkipped; + return $this->target; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration\Logging\TestDox; + +use PHPUnit\TextUI\XmlConfiguration\File; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class Text +{ /** - * @psalm-assert-if-true !null $this->extensionsDirectory + * @var File */ - public function hasExtensionsDirectory() : bool + private $target; + public function __construct(File $target) { - return $this->extensionsDirectory !== null; + $this->target = $target; } - /** - * @throws Exception - */ - public function extensionsDirectory() : string + public function target(): File { - if (!$this->hasExtensionsDirectory()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception('Extensions directory is not configured'); - } - return (string) $this->extensionsDirectory; + return $this->target; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration\Logging\TestDox; + +use PHPUnit\TextUI\XmlConfiguration\File; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class Xml +{ /** - * @psalm-assert-if-true !null $this->testSuiteLoaderClass - * - * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 + * @var File */ - public function hasTestSuiteLoaderClass() : bool + private $target; + public function __construct(File $target) { - return $this->testSuiteLoaderClass !== null; + $this->target = $target; } - /** - * @throws Exception - * - * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 - */ - public function testSuiteLoaderClass() : string + public function target(): File { - if (!$this->hasTestSuiteLoaderClass()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception('TestSuiteLoader class is not configured'); - } - return (string) $this->testSuiteLoaderClass; - } - /** - * @psalm-assert-if-true !null $this->testSuiteLoaderFile - * - * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 - */ - public function hasTestSuiteLoaderFile() : bool - { - return $this->testSuiteLoaderFile !== null; - } - /** - * @throws Exception - * - * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 - */ - public function testSuiteLoaderFile() : string - { - if (!$this->hasTestSuiteLoaderFile()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception('TestSuiteLoader sourcecode file is not configured'); - } - return (string) $this->testSuiteLoaderFile; - } - /** - * @psalm-assert-if-true !null $this->printerClass - */ - public function hasPrinterClass() : bool - { - return $this->printerClass !== null; - } - /** - * @throws Exception - */ - public function printerClass() : string - { - if (!$this->hasPrinterClass()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception('ResultPrinter class is not configured'); - } - return (string) $this->printerClass; - } - /** - * @psalm-assert-if-true !null $this->printerFile - */ - public function hasPrinterFile() : bool - { - return $this->printerFile !== null; - } - /** - * @throws Exception - */ - public function printerFile() : string - { - if (!$this->hasPrinterFile()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception('ResultPrinter sourcecode file is not configured'); - } - return (string) $this->printerFile; - } - public function beStrictAboutChangesToGlobalState() : bool - { - return $this->beStrictAboutChangesToGlobalState; - } - public function beStrictAboutOutputDuringTests() : bool - { - return $this->beStrictAboutOutputDuringTests; - } - public function beStrictAboutResourceUsageDuringSmallTests() : bool - { - return $this->beStrictAboutResourceUsageDuringSmallTests; - } - public function beStrictAboutTestsThatDoNotTestAnything() : bool - { - return $this->beStrictAboutTestsThatDoNotTestAnything; - } - public function beStrictAboutTodoAnnotatedTests() : bool - { - return $this->beStrictAboutTodoAnnotatedTests; - } - public function beStrictAboutCoversAnnotation() : bool - { - return $this->beStrictAboutCoversAnnotation; - } - public function enforceTimeLimit() : bool - { - return $this->enforceTimeLimit; - } - public function defaultTimeLimit() : int - { - return $this->defaultTimeLimit; - } - public function timeoutForSmallTests() : int - { - return $this->timeoutForSmallTests; - } - public function timeoutForMediumTests() : int - { - return $this->timeoutForMediumTests; - } - public function timeoutForLargeTests() : int - { - return $this->timeoutForLargeTests; - } - /** - * @psalm-assert-if-true !null $this->defaultTestSuite - */ - public function hasDefaultTestSuite() : bool - { - return $this->defaultTestSuite !== null; - } - /** - * @throws Exception - */ - public function defaultTestSuite() : string - { - if (!$this->hasDefaultTestSuite()) { - throw new \PHPUnit\TextUI\XmlConfiguration\Exception('Default test suite is not configured'); - } - return (string) $this->defaultTestSuite; - } - public function executionOrder() : int - { - return $this->executionOrder; - } - public function resolveDependencies() : bool - { - return $this->resolveDependencies; - } - public function defectsFirst() : bool - { - return $this->defectsFirst; - } - public function backupGlobals() : bool - { - return $this->backupGlobals; - } - public function backupStaticAttributes() : bool - { - return $this->backupStaticAttributes; - } - public function registerMockObjectsFromTestArgumentsRecursively() : bool - { - return $this->registerMockObjectsFromTestArgumentsRecursively; - } - public function conflictBetweenPrinterClassAndTestdox() : bool - { - return $this->conflictBetweenPrinterClassAndTestdox; + return $this->target; } } path = $path; - $this->prefix = $prefix; - $this->suffix = $suffix; - $this->phpVersion = $phpVersion; - $this->phpVersionOperator = $phpVersionOperator; - } - public function path() : string - { - return $this->path; - } - public function prefix() : string - { - return $this->prefix; - } - public function suffix() : string - { - return $this->suffix; - } - public function phpVersion() : string + private $target; + public function __construct(File $target) { - return $this->phpVersion; + $this->target = $target; } - public function phpVersionOperator() : VersionComparisonOperator + public function target(): File { - return $this->phpVersionOperator; + return $this->target; } } */ -final class TestDirectoryCollection implements Countable, IteratorAggregate +final class MigrationBuilder { + private const AVAILABLE_MIGRATIONS = ['8.5' => [\PHPUnit\TextUI\XmlConfiguration\RemoveLogTypes::class], '9.2' => [\PHPUnit\TextUI\XmlConfiguration\RemoveCacheTokensAttribute::class, \PHPUnit\TextUI\XmlConfiguration\IntroduceCoverageElement::class, \PHPUnit\TextUI\XmlConfiguration\MoveAttributesFromRootToCoverage::class, \PHPUnit\TextUI\XmlConfiguration\MoveAttributesFromFilterWhitelistToCoverage::class, \PHPUnit\TextUI\XmlConfiguration\MoveWhitelistIncludesToCoverage::class, \PHPUnit\TextUI\XmlConfiguration\MoveWhitelistExcludesToCoverage::class, \PHPUnit\TextUI\XmlConfiguration\RemoveEmptyFilter::class, \PHPUnit\TextUI\XmlConfiguration\CoverageCloverToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoverageCrap4jToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoverageHtmlToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoveragePhpToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoverageTextToReport::class, \PHPUnit\TextUI\XmlConfiguration\CoverageXmlToReport::class, \PHPUnit\TextUI\XmlConfiguration\ConvertLogTypes::class, \PHPUnit\TextUI\XmlConfiguration\UpdateSchemaLocationTo93::class]]; /** - * @var TestDirectory[] - */ - private $directories; - /** - * @param TestDirectory[] $directories - */ - public static function fromArray(array $directories) : self - { - return new self(...$directories); - } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\TestDirectory ...$directories) - { - $this->directories = $directories; - } - /** - * @return TestDirectory[] + * @throws MigrationBuilderException */ - public function asArray() : array - { - return $this->directories; - } - public function count() : int - { - return count($this->directories); - } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollectionIterator + public function build(string $fromVersion): array { - return new \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollectionIterator($this); - } - public function isEmpty() : bool - { - return $this->count() === 0; + $stack = []; + foreach (self::AVAILABLE_MIGRATIONS as $version => $migrations) { + if (version_compare($version, $fromVersion, '<')) { + continue; + } + foreach ($migrations as $migration) { + $stack[] = new $migration(); + } + } + return $stack; } } */ -final class TestDirectoryCollectionIterator implements Countable, Iterator +final class MigrationBuilderException extends RuntimeException implements Exception { - /** - * @var TestDirectory[] - */ - private $directories; - /** - * @var int - */ - private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollection $directories) - { - $this->directories = $directories->asArray(); - } - public function count() : int - { - return iterator_count($this); - } - public function rewind() : void - { - $this->position = 0; - } - public function valid() : bool - { - return $this->position < count($this->directories); - } - public function key() : int - { - return $this->position; - } - public function current() : \PHPUnit\TextUI\XmlConfiguration\TestDirectory - { - return $this->directories[$this->position]; - } - public function next() : void - { - $this->position++; - } } path = $path; - $this->phpVersion = $phpVersion; - $this->phpVersionOperator = $phpVersionOperator; - } - public function path() : string - { - return $this->path; - } - public function phpVersion() : string - { - return $this->phpVersion; - } - public function phpVersionOperator() : VersionComparisonOperator - { - return $this->phpVersionOperator; - } } */ -final class TestFileCollection implements Countable, IteratorAggregate +final class ConvertLogTypes implements \PHPUnit\TextUI\XmlConfiguration\Migration { - /** - * @var TestFile[] - */ - private $files; - /** - * @param TestFile[] $files - */ - public static function fromArray(array $files) : self - { - return new self(...$files); - } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\TestFile ...$files) - { - $this->files = $files; - } - /** - * @return TestFile[] - */ - public function asArray() : array - { - return $this->files; - } - public function count() : int - { - return count($this->files); - } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\TestFileCollectionIterator - { - return new \PHPUnit\TextUI\XmlConfiguration\TestFileCollectionIterator($this); - } - public function isEmpty() : bool + public function migrate(DOMDocument $document): void { - return $this->count() === 0; + $logging = $document->getElementsByTagName('logging')->item(0); + if (!$logging instanceof DOMElement) { + return; + } + $types = ['junit' => 'junit', 'teamcity' => 'teamcity', 'testdox-html' => 'testdoxHtml', 'testdox-text' => 'testdoxText', 'testdox-xml' => 'testdoxXml', 'plain' => 'text']; + $logNodes = []; + foreach ($logging->getElementsByTagName('log') as $logNode) { + if (!isset($types[$logNode->getAttribute('type')])) { + continue; + } + $logNodes[] = $logNode; + } + foreach ($logNodes as $oldNode) { + $newLogNode = $document->createElement($types[$oldNode->getAttribute('type')]); + $newLogNode->setAttribute('outputFile', $oldNode->getAttribute('target')); + $logging->replaceChild($newLogNode, $oldNode); + } } } */ -final class TestFileCollectionIterator implements Countable, Iterator +final class CoverageCloverToReport extends \PHPUnit\TextUI\XmlConfiguration\LogToReportMigration { - /** - * @var TestFile[] - */ - private $files; - /** - * @var int - */ - private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\TestFileCollection $files) - { - $this->files = $files->asArray(); - } - public function count() : int - { - return iterator_count($this); - } - public function rewind() : void - { - $this->position = 0; - } - public function valid() : bool - { - return $this->position < count($this->files); - } - public function key() : int - { - return $this->position; - } - public function current() : \PHPUnit\TextUI\XmlConfiguration\TestFile + protected function forType(): string { - return $this->files[$this->position]; + return 'coverage-clover'; } - public function next() : void + protected function toReportFormat(DOMElement $logNode): DOMElement { - $this->position++; + $clover = $logNode->ownerDocument->createElement('clover'); + $clover->setAttribute('outputFile', $logNode->getAttribute('target')); + return $clover; } } name = $name; - $this->directories = $directories; - $this->files = $files; - $this->exclude = $exclude; - } - public function name() : string - { - return $this->name; - } - public function directories() : \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollection - { - return $this->directories; - } - public function files() : \PHPUnit\TextUI\XmlConfiguration\TestFileCollection + protected function forType(): string { - return $this->files; + return 'coverage-crap4j'; } - public function exclude() : \PHPUnit\TextUI\XmlConfiguration\FileCollection + protected function toReportFormat(DOMElement $logNode): DOMElement { - return $this->exclude; + $crap4j = $logNode->ownerDocument->createElement('crap4j'); + $crap4j->setAttribute('outputFile', $logNode->getAttribute('target')); + $this->migrateAttributes($logNode, $crap4j, ['threshold']); + return $crap4j; } } */ -final class TestSuiteCollection implements Countable, IteratorAggregate +final class CoverageHtmlToReport extends \PHPUnit\TextUI\XmlConfiguration\LogToReportMigration { - /** - * @var TestSuite[] - */ - private $testSuites; - /** - * @param TestSuite[] $testSuites - */ - public static function fromArray(array $testSuites) : self - { - return new self(...$testSuites); - } - private function __construct(\PHPUnit\TextUI\XmlConfiguration\TestSuite ...$testSuites) - { - $this->testSuites = $testSuites; - } - /** - * @return TestSuite[] - */ - public function asArray() : array - { - return $this->testSuites; - } - public function count() : int - { - return count($this->testSuites); - } - public function getIterator() : \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollectionIterator + protected function forType(): string { - return new \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollectionIterator($this); + return 'coverage-html'; } - public function isEmpty() : bool + protected function toReportFormat(DOMElement $logNode): DOMElement { - return $this->count() === 0; + $html = $logNode->ownerDocument->createElement('html'); + $html->setAttribute('outputDirectory', $logNode->getAttribute('target')); + $this->migrateAttributes($logNode, $html, ['lowUpperBound', 'highLowerBound']); + return $html; } } */ -final class TestSuiteCollectionIterator implements Countable, Iterator +final class CoveragePhpToReport extends \PHPUnit\TextUI\XmlConfiguration\LogToReportMigration { - /** - * @var TestSuite[] - */ - private $testSuites; - /** - * @var int - */ - private $position; - public function __construct(\PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection $testSuites) - { - $this->testSuites = $testSuites->asArray(); - } - public function count() : int - { - return iterator_count($this); - } - public function rewind() : void - { - $this->position = 0; - } - public function valid() : bool - { - return $this->position < count($this->testSuites); - } - public function key() : int - { - return $this->position; - } - public function current() : \PHPUnit\TextUI\XmlConfiguration\TestSuite + protected function forType(): string { - return $this->testSuites[$this->position]; + return 'coverage-php'; } - public function next() : void + protected function toReportFormat(DOMElement $logNode): DOMElement { - $this->position++; + $php = $logNode->ownerDocument->createElement('php'); + $php->setAttribute('outputFile', $logNode->getAttribute('target')); + return $php; } } PHP(?:Unit)?)\\s+(?P[<>=!]{0,2})\\s*(?P[\\d\\.-]+(dev|(RC|alpha|beta)[\\d\\.])?)[ \\t]*\\r?$/m'; - private const REGEX_REQUIRES_VERSION_CONSTRAINT = '/@requires\\s+(?PPHP(?:Unit)?)\\s+(?P[\\d\\t \\-.|~^]+)[ \\t]*\\r?$/m'; - private const REGEX_REQUIRES_OS = '/@requires\\s+(?POS(?:FAMILY)?)\\s+(?P.+?)[ \\t]*\\r?$/m'; - private const REGEX_REQUIRES_SETTING = '/@requires\\s+(?Psetting)\\s+(?P([^ ]+?))\\s*(?P[\\w\\.-]+[\\w\\.]?)?[ \\t]*\\r?$/m'; - private const REGEX_REQUIRES = '/@requires\\s+(?Pfunction|extension)\\s+(?P([^\\s<>=!]+))\\s*(?P[<>=!]{0,2})\\s*(?P[\\d\\.-]+[\\d\\.]?)?[ \\t]*\\r?$/m'; - private const REGEX_TEST_WITH = '/@testWith\\s+/'; - /** @var string */ - private $docComment; - /** @var bool */ - private $isMethod; - /** @var array> pre-parsed annotations indexed by name and occurrence index */ - private $symbolAnnotations; - /** - * @var null|array - * - * @psalm-var null|(array{ - * __OFFSET: array&array{__FILE: string}, - * setting?: array, - * extension_versions?: array - * }&array< - * string, - * string|array{version: string, operator: string}|array{constraint: string}|array - * >) - */ - private $parsedRequirements; - /** @var int */ - private $startLine; - /** @var int */ - private $endLine; - /** @var string */ - private $fileName; - /** @var string */ - private $name; - /** - * @var string - * - * @psalm-var class-string - */ - private $className; - public static function ofClass(ReflectionClass $class) : self - { - $className = $class->getName(); - return new self((string) $class->getDocComment(), \false, self::extractAnnotationsFromReflector($class), $class->getStartLine(), $class->getEndLine(), $class->getFileName(), $className, $className); - } - /** - * @psalm-param class-string $classNameInHierarchy - */ - public static function ofMethod(ReflectionMethod $method, string $classNameInHierarchy) : self - { - return new self((string) $method->getDocComment(), \true, self::extractAnnotationsFromReflector($method), $method->getStartLine(), $method->getEndLine(), $method->getFileName(), $method->getName(), $classNameInHierarchy); - } - /** - * Note: we do not preserve an instance of the reflection object, since it cannot be safely (de-)serialized. - * - * @param array> $symbolAnnotations - * - * @psalm-param class-string $className - */ - private function __construct(string $docComment, bool $isMethod, array $symbolAnnotations, int $startLine, int $endLine, string $fileName, string $name, string $className) - { - $this->docComment = $docComment; - $this->isMethod = $isMethod; - $this->symbolAnnotations = $symbolAnnotations; - $this->startLine = $startLine; - $this->endLine = $endLine; - $this->fileName = $fileName; - $this->name = $name; - $this->className = $className; - } - /** - * @psalm-return array{ - * __OFFSET: array&array{__FILE: string}, - * setting?: array, - * extension_versions?: array - * }&array< - * string, - * string|array{version: string, operator: string}|array{constraint: string}|array - * > - * - * @throws Warning if the requirements version constraint is not well-formed - */ - public function requirements() : array - { - if ($this->parsedRequirements !== null) { - return $this->parsedRequirements; - } - $offset = $this->startLine; - $requires = []; - $recordedSettings = []; - $extensionVersions = []; - $recordedOffsets = ['__FILE' => realpath($this->fileName)]; - // Trim docblock markers, split it into lines and rewind offset to start of docblock - $lines = preg_replace(['#^/\\*{2}#', '#\\*/$#'], '', preg_split('/\\r\\n|\\r|\\n/', $this->docComment)); - $offset -= count($lines); - foreach ($lines as $line) { - if (preg_match(self::REGEX_REQUIRES_OS, $line, $matches)) { - $requires[$matches['name']] = $matches['value']; - $recordedOffsets[$matches['name']] = $offset; - } - if (preg_match(self::REGEX_REQUIRES_VERSION, $line, $matches)) { - $requires[$matches['name']] = ['version' => $matches['version'], 'operator' => $matches['operator']]; - $recordedOffsets[$matches['name']] = $offset; - } - if (preg_match(self::REGEX_REQUIRES_VERSION_CONSTRAINT, $line, $matches)) { - if (!empty($requires[$matches['name']])) { - $offset++; - continue; - } - try { - $versionConstraintParser = new VersionConstraintParser(); - $requires[$matches['name'] . '_constraint'] = ['constraint' => $versionConstraintParser->parse(trim($matches['constraint']))]; - $recordedOffsets[$matches['name'] . '_constraint'] = $offset; - } catch (\PHPUnit\PharIo\Version\Exception $e) { - throw new Warning($e->getMessage(), $e->getCode(), $e); - } - } - if (preg_match(self::REGEX_REQUIRES_SETTING, $line, $matches)) { - $recordedSettings[$matches['setting']] = $matches['value']; - $recordedOffsets['__SETTING_' . $matches['setting']] = $offset; - } - if (preg_match(self::REGEX_REQUIRES, $line, $matches)) { - $name = $matches['name'] . 's'; - if (!isset($requires[$name])) { - $requires[$name] = []; - } - $requires[$name][] = $matches['value']; - $recordedOffsets[$matches['name'] . '_' . $matches['value']] = $offset; - if ($name === 'extensions' && !empty($matches['version'])) { - $extensionVersions[$matches['value']] = ['version' => $matches['version'], 'operator' => $matches['operator']]; - } - } - $offset++; - } - return $this->parsedRequirements = array_merge($requires, ['__OFFSET' => $recordedOffsets], array_filter(['setting' => $recordedSettings, 'extension_versions' => $extensionVersions])); - } - /** - * Returns the provided data for a method. - * - * @throws Exception - */ - public function getProvidedData() : ?array - { - /** @noinspection SuspiciousBinaryOperationInspection */ - $data = $this->getDataFromDataProviderAnnotation($this->docComment) ?? $this->getDataFromTestWithAnnotation($this->docComment); - if ($data === null) { - return null; - } - if ($data === []) { - throw new SkippedTestError(); - } - foreach ($data as $key => $value) { - if (!is_array($value)) { - throw new InvalidDataSetException(sprintf('Data set %s is invalid.', is_int($key) ? '#' . $key : '"' . $key . '"')); - } - } - return $data; - } - /** - * @psalm-return array - */ - public function getInlineAnnotations() : array - { - $code = file($this->fileName); - $lineNumber = $this->startLine; - $startLine = $this->startLine - 1; - $endLine = $this->endLine - 1; - $codeLines = array_slice($code, $startLine, $endLine - $startLine + 1); - $annotations = []; - foreach ($codeLines as $line) { - if (preg_match('#/\\*\\*?\\s*@(?P[A-Za-z_-]+)(?:[ \\t]+(?P.*?))?[ \\t]*\\r?\\*/$#m', $line, $matches)) { - $annotations[strtolower($matches['name'])] = ['line' => $lineNumber, 'value' => $matches['value']]; - } - $lineNumber++; - } - return $annotations; - } - public function symbolAnnotations() : array - { - return $this->symbolAnnotations; - } - public function isHookToBeExecutedBeforeClass() : bool - { - return $this->isMethod && \false !== strpos($this->docComment, '@beforeClass'); - } - public function isHookToBeExecutedAfterClass() : bool - { - return $this->isMethod && \false !== strpos($this->docComment, '@afterClass'); - } - public function isToBeExecutedBeforeTest() : bool - { - return 1 === preg_match('/@before\\b/', $this->docComment); - } - public function isToBeExecutedAfterTest() : bool - { - return 1 === preg_match('/@after\\b/', $this->docComment); - } - public function isToBeExecutedAsPreCondition() : bool - { - return 1 === preg_match('/@preCondition\\b/', $this->docComment); - } - public function isToBeExecutedAsPostCondition() : bool - { - return 1 === preg_match('/@postCondition\\b/', $this->docComment); - } - private function getDataFromDataProviderAnnotation(string $docComment) : ?array - { - $methodName = null; - $className = $this->className; - if ($this->isMethod) { - $methodName = $this->name; - } - if (!preg_match_all(self::REGEX_DATA_PROVIDER, $docComment, $matches)) { - return null; - } - $result = []; - foreach ($matches[1] as $match) { - $dataProviderMethodNameNamespace = explode('\\', $match); - $leaf = explode('::', array_pop($dataProviderMethodNameNamespace)); - $dataProviderMethodName = array_pop($leaf); - if (empty($dataProviderMethodNameNamespace)) { - $dataProviderMethodNameNamespace = ''; - } else { - $dataProviderMethodNameNamespace = implode('\\', $dataProviderMethodNameNamespace) . '\\'; - } - if (empty($leaf)) { - $dataProviderClassName = $className; - } else { - /** @psalm-var class-string $dataProviderClassName */ - $dataProviderClassName = $dataProviderMethodNameNamespace . array_pop($leaf); - } - try { - $dataProviderClass = new ReflectionClass($dataProviderClassName); - $dataProviderMethod = $dataProviderClass->getMethod($dataProviderMethodName); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - // @codeCoverageIgnoreEnd - } - if ($dataProviderMethod->isStatic()) { - $object = null; - } else { - $object = $dataProviderClass->newInstance(); - } - if ($dataProviderMethod->getNumberOfParameters() === 0) { - $data = $dataProviderMethod->invoke($object); - } else { - $data = $dataProviderMethod->invoke($object, $methodName); - } - if ($data instanceof Traversable) { - $origData = $data; - $data = []; - foreach ($origData as $key => $value) { - if (is_int($key)) { - $data[] = $value; - } elseif (array_key_exists($key, $data)) { - throw new InvalidDataProviderException(sprintf('The key "%s" has already been defined in the data provider "%s".', $key, $match)); - } else { - $data[$key] = $value; - } - } - } - if (is_array($data)) { - $result = array_merge($result, $data); - } - } - return $result; - } - /** - * @throws Exception - */ - private function getDataFromTestWithAnnotation(string $docComment) : ?array + protected function forType(): string { - $docComment = $this->cleanUpMultiLineAnnotation($docComment); - if (!preg_match(self::REGEX_TEST_WITH, $docComment, $matches, PREG_OFFSET_CAPTURE)) { - return null; - } - $offset = strlen($matches[0][0]) + $matches[0][1]; - $annotationContent = substr($docComment, $offset); - $data = []; - foreach (explode("\n", $annotationContent) as $candidateRow) { - $candidateRow = trim($candidateRow); - if ($candidateRow[0] !== '[') { - break; - } - $dataSet = json_decode($candidateRow, \true); - if (json_last_error() !== JSON_ERROR_NONE) { - throw new Exception('The data set for the @testWith annotation cannot be parsed: ' . json_last_error_msg()); - } - $data[] = $dataSet; - } - if (!$data) { - throw new Exception('The data set for the @testWith annotation cannot be parsed.'); - } - return $data; + return 'coverage-text'; } - private function cleanUpMultiLineAnnotation(string $docComment) : string + protected function toReportFormat(DOMElement $logNode): DOMElement { - // removing initial ' * ' for docComment - $docComment = str_replace("\r\n", "\n", $docComment); - $docComment = preg_replace('/\\n\\s*\\*\\s?/', "\n", $docComment); - $docComment = (string) substr($docComment, 0, -1); - return rtrim($docComment, "\n"); + $text = $logNode->ownerDocument->createElement('text'); + $text->setAttribute('outputFile', $logNode->getAttribute('target')); + $this->migrateAttributes($logNode, $text, ['showUncoveredFiles', 'showOnlySummary']); + return $text; } - /** @return array> */ - private static function parseDocBlock(string $docBlock) : array +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use DOMElement; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class CoverageXmlToReport extends \PHPUnit\TextUI\XmlConfiguration\LogToReportMigration +{ + protected function forType(): string { - // Strip away the docblock header and footer to ease parsing of one line annotations - $docBlock = (string) substr($docBlock, 3, -2); - $annotations = []; - if (preg_match_all('/@(?P[A-Za-z_-]+)(?:[ \\t]+(?P.*?))?[ \\t]*\\r?$/m', $docBlock, $matches)) { - $numMatches = count($matches[0]); - for ($i = 0; $i < $numMatches; $i++) { - $annotations[$matches['name'][$i]][] = (string) $matches['value'][$i]; - } - } - return $annotations; + return 'coverage-xml'; } - /** @param ReflectionClass|ReflectionFunctionAbstract $reflector */ - private static function extractAnnotationsFromReflector(Reflector $reflector) : array + protected function toReportFormat(DOMElement $logNode): DOMElement { - $annotations = []; - if ($reflector instanceof ReflectionClass) { - $annotations = array_merge($annotations, ...array_map(static function (ReflectionClass $trait) : array { - return self::parseDocBlock((string) $trait->getDocComment()); - }, array_values($reflector->getTraits()))); - } - return array_merge($annotations, self::parseDocBlock((string) $reflector->getDocComment())); + $xml = $logNode->ownerDocument->createElement('xml'); + $xml->setAttribute('outputDirectory', $logNode->getAttribute('target')); + return $xml; } } indexed by class name */ - private $classDocBlocks = []; - /** @var array> indexed by class name and method name */ - private $methodDocBlocks = []; - public static function getInstance() : self - { - return self::$instance ?? (self::$instance = new self()); - } - private function __construct() + public function migrate(DOMDocument $document): void { + $coverage = $document->createElement('coverage'); + $document->documentElement->insertBefore($coverage, $document->documentElement->firstChild); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use function sprintf; +use DOMDocument; +use DOMElement; +use DOMXPath; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +abstract class LogToReportMigration implements \PHPUnit\TextUI\XmlConfiguration\Migration +{ /** - * @throws Exception - * - * @psalm-param class-string $class + * @throws MigrationException */ - public function forClassName(string $class) : \PHPUnit\Util\Annotation\DocBlock + public function migrate(DOMDocument $document): void { - if (array_key_exists($class, $this->classDocBlocks)) { - return $this->classDocBlocks[$class]; + $coverage = $document->getElementsByTagName('coverage')->item(0); + if (!$coverage instanceof DOMElement) { + throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); } - try { - $reflection = new ReflectionClass($class); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); + $logNode = $this->findLogNode($document); + if ($logNode === null) { + return; } - // @codeCoverageIgnoreEnd - return $this->classDocBlocks[$class] = \PHPUnit\Util\Annotation\DocBlock::ofClass($reflection); + $reportChild = $this->toReportFormat($logNode); + $report = $coverage->getElementsByTagName('report')->item(0); + if ($report === null) { + $report = $coverage->appendChild($document->createElement('report')); + } + $report->appendChild($reportChild); + $logNode->parentNode->removeChild($logNode); } - /** - * @throws Exception - * - * @psalm-param class-string $classInHierarchy - */ - public function forMethod(string $classInHierarchy, string $method) : \PHPUnit\Util\Annotation\DocBlock + protected function migrateAttributes(DOMElement $src, DOMElement $dest, array $attributes): void { - if (isset($this->methodDocBlocks[$classInHierarchy][$method])) { - return $this->methodDocBlocks[$classInHierarchy][$method]; + foreach ($attributes as $attr) { + if (!$src->hasAttribute($attr)) { + continue; + } + $dest->setAttribute($attr, $src->getAttribute($attr)); + $src->removeAttribute($attr); } - try { - $reflection = new ReflectionMethod($classInHierarchy, $method); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); + } + abstract protected function forType(): string; + abstract protected function toReportFormat(DOMElement $logNode): DOMElement; + private function findLogNode(DOMDocument $document): ?DOMElement + { + $logNode = (new DOMXPath($document))->query(sprintf('//logging/log[@type="%s"]', $this->forType()))->item(0); + if (!$logNode instanceof DOMElement) { + return null; } - // @codeCoverageIgnoreEnd - return $this->methodDocBlocks[$classInHierarchy][$method] = \PHPUnit\Util\Annotation\DocBlock::ofMethod($reflection, $classInHierarchy); + return $logNode; } } getExcludedDirectories(); - } - /** - * @throws Exception - */ - public function isBlacklisted(string $file) : bool - { - return (new \PHPUnit\Util\ExcludeList())->isExcluded($file); - } + public function migrate(DOMDocument $document): void; } getElementsByTagName('whitelist')->item(0); + if (!$whitelist) { + return; + } + $coverage = $document->getElementsByTagName('coverage')->item(0); + if (!$coverage instanceof DOMElement) { + throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); + } + $map = ['addUncoveredFilesFromWhitelist' => 'includeUncoveredFiles', 'processUncoveredFilesFromWhitelist' => 'processUncoveredFiles']; + foreach ($map as $old => $new) { + if (!$whitelist->hasAttribute($old)) { + continue; + } + $coverage->setAttribute($new, $whitelist->getAttribute($old)); + $whitelist->removeAttribute($old); } } } @@ -79886,93 +86103,92 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\Util; +namespace PHPUnit\TextUI\XmlConfiguration; -use const DIRECTORY_SEPARATOR; -use function array_keys; -use function array_map; -use function array_values; -use function count; -use function explode; -use function implode; -use function min; -use function preg_replace; -use function preg_replace_callback; -use function sprintf; -use function strtr; -use function trim; +use DOMDocument; +use DOMElement; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit */ -final class Color +final class MoveAttributesFromRootToCoverage implements \PHPUnit\TextUI\XmlConfiguration\Migration { /** - * @var array - */ - private const WHITESPACE_MAP = [' ' => '·', "\t" => '⇥']; - /** - * @var array - */ - private const WHITESPACE_EOL_MAP = [' ' => '·', "\t" => '⇥', "\n" => '↵', "\r" => '⟵']; - /** - * @var array + * @throws MigrationException */ - private static $ansiCodes = ['reset' => '0', 'bold' => '1', 'dim' => '2', 'dim-reset' => '22', 'underlined' => '4', 'fg-default' => '39', 'fg-black' => '30', 'fg-red' => '31', 'fg-green' => '32', 'fg-yellow' => '33', 'fg-blue' => '34', 'fg-magenta' => '35', 'fg-cyan' => '36', 'fg-white' => '37', 'bg-default' => '49', 'bg-black' => '40', 'bg-red' => '41', 'bg-green' => '42', 'bg-yellow' => '43', 'bg-blue' => '44', 'bg-magenta' => '45', 'bg-cyan' => '46', 'bg-white' => '47']; - public static function colorize(string $color, string $buffer) : string + public function migrate(DOMDocument $document): void { - if (trim($buffer) === '') { - return $buffer; + $map = ['disableCodeCoverageIgnore' => 'disableCodeCoverageIgnore', 'ignoreDeprecatedCodeUnitsFromCodeCoverage' => 'ignoreDeprecatedCodeUnits']; + $root = $document->documentElement; + $coverage = $document->getElementsByTagName('coverage')->item(0); + if (!$coverage instanceof DOMElement) { + throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); } - $codes = array_map('\\trim', explode(',', $color)); - $styles = []; - foreach ($codes as $code) { - if (isset(self::$ansiCodes[$code])) { - $styles[] = self::$ansiCodes[$code] ?? ''; + foreach ($map as $old => $new) { + if (!$root->hasAttribute($old)) { + continue; } + $coverage->setAttribute($new, $root->getAttribute($old)); + $root->removeAttribute($old); } - if (empty($styles)) { - return $buffer; - } - return self::optimizeColor(sprintf("\x1b[%sm", implode(';', $styles)) . $buffer . "\x1b[0m"); } - public static function colorizePath(string $path, ?string $prevPath = null, bool $colorizeFilename = \false) : string +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use function assert; +use function in_array; +use DOMDocument; +use DOMElement; +use PHPUnit\Util\Xml\SnapshotNodeList; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class MoveWhitelistExcludesToCoverage implements \PHPUnit\TextUI\XmlConfiguration\Migration +{ + /** + * @throws MigrationException + */ + public function migrate(DOMDocument $document): void { - if ($prevPath === null) { - $prevPath = ''; + $whitelist = $document->getElementsByTagName('whitelist')->item(0); + if ($whitelist === null) { + return; } - $path = explode(DIRECTORY_SEPARATOR, $path); - $prevPath = explode(DIRECTORY_SEPARATOR, $prevPath); - for ($i = 0; $i < min(count($path), count($prevPath)); $i++) { - if ($path[$i] == $prevPath[$i]) { - $path[$i] = self::dim($path[$i]); - } + $excludeNodes = SnapshotNodeList::fromNodeList($whitelist->getElementsByTagName('exclude')); + if ($excludeNodes->count() === 0) { + return; } - if ($colorizeFilename) { - $last = count($path) - 1; - $path[$last] = preg_replace_callback('/([\\-_\\.]+|phpt$)/', static function ($matches) { - return self::dim($matches[0]); - }, $path[$last]); + $coverage = $document->getElementsByTagName('coverage')->item(0); + if (!$coverage instanceof DOMElement) { + throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); } - return self::optimizeColor(implode(self::dim(DIRECTORY_SEPARATOR), $path)); - } - public static function dim(string $buffer) : string - { - if (trim($buffer) === '') { - return $buffer; + $targetExclude = $coverage->getElementsByTagName('exclude')->item(0); + if ($targetExclude === null) { + $targetExclude = $coverage->appendChild($document->createElement('exclude')); + } + foreach ($excludeNodes as $excludeNode) { + assert($excludeNode instanceof DOMElement); + foreach (SnapshotNodeList::fromNodeList($excludeNode->childNodes) as $child) { + if (!$child instanceof DOMElement || !in_array($child->nodeName, ['directory', 'file'], \true)) { + continue; + } + $targetExclude->appendChild($child); + } + if ($excludeNode->getElementsByTagName('*')->count() !== 0) { + throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Dangling child elements in exclude found.'); + } + $whitelist->removeChild($excludeNode); } - return "\x1b[2m{$buffer}\x1b[22m"; - } - public static function visualizeWhitespace(string $buffer, bool $visualizeEOL = \false) : string - { - $replaceMap = $visualizeEOL ? self::WHITESPACE_EOL_MAP : self::WHITESPACE_MAP; - return preg_replace_callback('/\\s+/', static function ($matches) use($replaceMap) { - return self::dim(strtr($matches[0], $replaceMap)); - }, $buffer); - } - private static function optimizeColor(string $buffer) : string - { - $patterns = ["/\x1b\\[22m\x1b\\[2m/" => '', "/\x1b\\[([^m]*)m\x1b\\[([1-9][0-9;]*)m/" => "\x1b[\$1;\$2m", "/(\x1b\\[[^m]*m)+(\x1b\\[0m)/" => '$2']; - return preg_replace(array_keys($patterns), array_values($patterns), $buffer); } } convertDeprecationsToExceptions = $convertDeprecationsToExceptions; - $this->convertErrorsToExceptions = $convertErrorsToExceptions; - $this->convertNoticesToExceptions = $convertNoticesToExceptions; - $this->convertWarningsToExceptions = $convertWarningsToExceptions; - } - public function __invoke(int $errorNumber, string $errorString, string $errorFile, int $errorLine) : bool - { - /* - * Do not raise an exception when the error suppression operator (@) was used. - * - * @see https://github.com/sebastianbergmann/phpunit/issues/3739 - */ - if (!($errorNumber & error_reporting())) { - return \false; - } - switch ($errorNumber) { - case E_NOTICE: - case E_USER_NOTICE: - case E_STRICT: - if (!$this->convertNoticesToExceptions) { - return \false; - } - throw new Notice($errorString, $errorNumber, $errorFile, $errorLine); - case E_WARNING: - case E_USER_WARNING: - if (!$this->convertWarningsToExceptions) { - return \false; - } - throw new Warning($errorString, $errorNumber, $errorFile, $errorLine); - case E_DEPRECATED: - case E_USER_DEPRECATED: - if (!$this->convertDeprecationsToExceptions) { - return \false; - } - throw new Deprecated($errorString, $errorNumber, $errorFile, $errorLine); - default: - if (!$this->convertErrorsToExceptions) { - return \false; - } - throw new Error($errorString, $errorNumber, $errorFile, $errorLine); - } - } - public function register() : void + public function migrate(DOMDocument $document): void { - if ($this->registered) { + $whitelist = $document->getElementsByTagName('whitelist')->item(0); + if ($whitelist === null) { return; } - $oldErrorHandler = set_error_handler($this); - if ($oldErrorHandler !== null) { - restore_error_handler(); - return; + $coverage = $document->getElementsByTagName('coverage')->item(0); + if (!$coverage instanceof DOMElement) { + throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException('Unexpected state - No coverage element'); } - $this->registered = \true; - } - public function unregister() : void - { - if (!$this->registered) { - return; + $include = $document->createElement('include'); + $coverage->appendChild($include); + foreach (SnapshotNodeList::fromNodeList($whitelist->childNodes) as $child) { + if (!$child instanceof DOMElement) { + continue; + } + if (!($child->nodeName === 'directory' || $child->nodeName === 'file')) { + continue; + } + $include->appendChild($child); } - restore_error_handler(); } } documentElement; + if ($root->hasAttribute('cacheTokens')) { + $root->removeAttribute('cacheTokens'); + } + } } - */ - private const EXCLUDED_CLASS_NAMES = [ - // composer - ClassLoader::class => 1, - // doctrine/instantiator - Instantiator::class => 1, - // myclabs/deepcopy - DeepCopy::class => 1, - // nikic/php-parser - Parser::class => 1, - // phar-io/manifest - Manifest::class => 1, - // phar-io/version - PharIoVersion::class => 1, - // phpdocumentor/type-resolver - \PHPUnit\Util\Type::class => 1, - // phpunit/phpunit - TestCase::class => 2, - // phpunit/php-code-coverage - CodeCoverage::class => 1, - // phpunit/php-file-iterator - FileIteratorFacade::class => 1, - // phpunit/php-invoker - Invoker::class => 1, - // phpunit/php-text-template - Template::class => 1, - // phpunit/php-timer - Timer::class => 1, - // sebastian/cli-parser - CliParser::class => 1, - // sebastian/code-unit - CodeUnit::class => 1, - // sebastian/code-unit-reverse-lookup - Wizard::class => 1, - // sebastian/comparator - Comparator::class => 1, - // sebastian/complexity - Calculator::class => 1, - // sebastian/diff - Diff::class => 1, - // sebastian/environment - Runtime::class => 1, - // sebastian/exporter - Exporter::class => 1, - // sebastian/global-state - Snapshot::class => 1, - // sebastian/lines-of-code - Counter::class => 1, - // sebastian/object-enumerator - Enumerator::class => 1, - // sebastian/recursion-context - Context::class => 1, - // sebastian/resource-operations - ResourceOperations::class => 1, - // sebastian/type - TypeName::class => 1, - // sebastian/version - Version::class => 1, - // theseer/tokenizer - Tokenizer::class => 1, - ]; - /** - * @var string[] - */ - private static $directories = []; - /** - * @var bool - */ - private static $initialized = \false; - public static function addDirectory(string $directory) : void - { - if (!is_dir($directory)) { - throw new \PHPUnit\Util\Exception(sprintf('"%s" is not a directory', $directory)); - } - self::$directories[] = realpath($directory); - } - /** - * @throws Exception - * - * @return string[] - */ - public function getExcludedDirectories() : array - { - $this->initialize(); - return self::$directories; - } - /** - * @throws Exception + * @throws MigrationException */ - public function isExcluded(string $file) : bool + public function migrate(DOMDocument $document): void { - if (defined('PHPUNIT_TESTSUITE')) { - return \false; + $whitelist = $document->getElementsByTagName('whitelist')->item(0); + if ($whitelist instanceof DOMElement) { + $this->ensureEmpty($whitelist); + $whitelist->parentNode->removeChild($whitelist); } - $this->initialize(); - foreach (self::$directories as $directory) { - if (strpos($file, $directory) === 0) { - return \true; - } + $filter = $document->getElementsByTagName('filter')->item(0); + if ($filter instanceof DOMElement) { + $this->ensureEmpty($filter); + $filter->parentNode->removeChild($filter); } - return \false; } /** - * @throws Exception + * @throws MigrationException */ - private function initialize() : void + private function ensureEmpty(DOMElement $element): void { - if (self::$initialized) { - return; - } - foreach (self::EXCLUDED_CLASS_NAMES as $className => $parent) { - if (!class_exists($className)) { - continue; - } - $directory = (new ReflectionClass($className))->getFileName(); - for ($i = 0; $i < $parent; $i++) { - $directory = dirname($directory); - } - self::$directories[] = $directory; + if ($element->attributes->length > 0) { + throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException(sprintf('%s element has unexpected attributes', $element->nodeName)); } - // Hide process isolation workaround on Windows. - if (DIRECTORY_SEPARATOR === '\\') { - // tempnam() prefix is limited to first 3 chars. - // @see https://php.net/manual/en/function.tempnam.php - self::$directories[] = sys_get_temp_dir() . '\\PHP'; + if ($element->getElementsByTagName('*')->length > 0) { + throw new \PHPUnit\TextUI\XmlConfiguration\MigrationException(sprintf('%s element has unexpected children', $element->nodeName)); } - self::$initialized = \true; } } getElementsByTagName('logging')->item(0); + if (!$logging instanceof DOMElement) { + return; } - self::load($includePathFilename); - return $includePathFilename; - } - /** - * Loads a PHP sourcefile. - */ - public static function load(string $filename) : void - { - $oldVariableNames = array_keys(get_defined_vars()); - /** - * @noinspection PhpIncludeInspection - * - * @psalm-suppress UnresolvableInclude - */ - include_once $filename; - $newVariables = get_defined_vars(); - foreach (array_diff(array_keys($newVariables), $oldVariableNames) as $variableName) { - if ($variableName !== 'oldVariableNames') { - $GLOBALS[$variableName] = $newVariables[$variableName]; + foreach (SnapshotNodeList::fromNodeList($logging->getElementsByTagName('log')) as $logNode) { + assert($logNode instanceof DOMElement); + switch ($logNode->getAttribute('type')) { + case 'json': + case 'tap': + $logging->removeChild($logNode); } } } - /** - * @see https://github.com/sebastianbergmann/phpunit/pull/2751 - */ - private static function isReadable(string $filename) : bool - { - return @fopen($filename, 'r') !== \false; - } } Foo/Bar/Baz.php - * - Namespace: Foo\Bar\Baz -> Foo/Bar/Baz.php - */ - public static function classNameToFilename(string $className) : string + public function migrate(DOMDocument $document): void { - return str_replace(['_', '\\'], DIRECTORY_SEPARATOR, $className) . '.php'; - } - public static function createDirectory(string $directory) : bool - { - return !(!is_dir($directory) && !@mkdir($directory, 0777, \true) && !is_dir($directory)); + $document->documentElement->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:noNamespaceSchemaLocation', 'https://schema.phpunit.de/9.3/phpunit.xsd'); } } getSyntheticTrace(); - $eFile = $t->getSyntheticFile(); - $eLine = $t->getSyntheticLine(); - } elseif ($t instanceof Exception) { - $eTrace = $t->getSerializableTrace(); - $eFile = $t->getFile(); - $eLine = $t->getLine(); - } else { - if ($t->getPrevious()) { - $t = $t->getPrevious(); - } - $eTrace = $t->getTrace(); - $eFile = $t->getFile(); - $eLine = $t->getLine(); - } - if (!self::frameExists($eTrace, $eFile, $eLine)) { - array_unshift($eTrace, ['file' => $eFile, 'line' => $eLine]); + $origin = (new SchemaDetector())->detect($filename); + if (!$origin->detected()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception(sprintf('"%s" is not a valid PHPUnit XML configuration file that can be migrated', $filename)); } - $prefix = defined('__PHPUNIT_PHAR_ROOT__') ? __PHPUNIT_PHAR_ROOT__ : \false; - $excludeList = new \PHPUnit\Util\ExcludeList(); - foreach ($eTrace as $frame) { - if (self::shouldPrintFrame($frame, $prefix, $excludeList)) { - $filteredStacktrace .= sprintf("%s:%s\n", $frame['file'], $frame['line'] ?? '?'); - } + $configurationDocument = (new XmlLoader())->loadFile($filename, \false, \true, \true); + foreach ((new \PHPUnit\TextUI\XmlConfiguration\MigrationBuilder())->build($origin->version()) as $migration) { + $migration->migrate($configurationDocument); } - return $filteredStacktrace; + $configurationDocument->formatOutput = \true; + $configurationDocument->preserveWhiteSpace = \false; + return $configurationDocument->saveXML(); } - private static function shouldPrintFrame(array $frame, $prefix, \PHPUnit\Util\ExcludeList $excludeList) : bool +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class Constant +{ + /** + * @var string + */ + private $name; + /** + * @var mixed + */ + private $value; + public function __construct(string $name, $value) { - if (!isset($frame['file'])) { - return \false; - } - $file = $frame['file']; - $fileIsNotPrefixed = $prefix === \false || strpos($file, $prefix) !== 0; - // @see https://github.com/sebastianbergmann/phpunit/issues/4033 - if (isset($GLOBALS['_SERVER']['SCRIPT_NAME'])) { - $script = realpath($GLOBALS['_SERVER']['SCRIPT_NAME']); - } else { - $script = ''; - } - return is_file($file) && self::fileIsExcluded($file, $excludeList) && $fileIsNotPrefixed && $file !== $script; + $this->name = $name; + $this->value = $value; } - private static function fileIsExcluded(string $file, \PHPUnit\Util\ExcludeList $excludeList) : bool + public function name(): string { - return (empty($GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST']) || !in_array($file, $GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'], \true)) && !$excludeList->isExcluded($file); + return $this->name; } - private static function frameExists(array $trace, string $file, int $line) : bool + public function value() { - foreach ($trace as $frame) { - if (isset($frame['file'], $frame['line']) && $frame['file'] === $file && $frame['line'] === $line) { - return \true; - } - } - return \false; + return $this->value; } } */ -final class GlobalState +final class ConstantCollection implements Countable, IteratorAggregate { /** - * @var string[] + * @var Constant[] */ - private const SUPER_GLOBAL_ARRAYS = ['_ENV', '_POST', '_GET', '_COOKIE', '_SERVER', '_FILES', '_REQUEST']; + private $constants; /** - * @psalm-var array> + * @param Constant[] $constants */ - private const DEPRECATED_INI_SETTINGS = ['7.3' => ['iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.func_overload' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'string.strip_tags' => \true], '7.4' => ['iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.func_overload' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'pdo_odbc.db2_instance_name' => \true, 'string.strip_tags' => \true], '8.0' => ['iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true], '8.1' => ['auto_detect_line_endings' => \true, 'filter.default' => \true, 'iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'oci8.old_oci_close_semantics' => \true], '8.2' => ['auto_detect_line_endings' => \true, 'filter.default' => \true, 'iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'oci8.old_oci_close_semantics' => \true], '8.3' => ['auto_detect_line_endings' => \true, 'filter.default' => \true, 'iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'oci8.old_oci_close_semantics' => \true]]; + public static function fromArray(array $constants): self + { + return new self(...$constants); + } + private function __construct(\PHPUnit\TextUI\XmlConfiguration\Constant ...$constants) + { + $this->constants = $constants; + } /** - * @throws Exception + * @return Constant[] */ - public static function getIncludedFilesAsString() : string + public function asArray(): array { - return self::processIncludedFilesAsString(get_included_files()); + return $this->constants; + } + public function count(): int + { + return count($this->constants); + } + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\ConstantCollectionIterator + { + return new \PHPUnit\TextUI\XmlConfiguration\ConstantCollectionIterator($this); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use function count; +use function iterator_count; +use Countable; +use Iterator; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @template-implements Iterator + */ +final class ConstantCollectionIterator implements Countable, Iterator +{ /** - * @param string[] $files - * - * @throws Exception + * @var Constant[] + */ + private $constants; + /** + * @var int */ - public static function processIncludedFilesAsString(array $files) : string + private $position; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\ConstantCollection $constants) { - $excludeList = new \PHPUnit\Util\ExcludeList(); - $prefix = \false; - $result = ''; - if (defined('__PHPUNIT_PHAR__')) { - $prefix = 'phar://' . __PHPUNIT_PHAR__ . '/'; - } - // Do not process bootstrap script - array_shift($files); - // If bootstrap script was a Composer bin proxy, skip the second entry as well - if (substr(strtr($files[0], '\\', '/'), -24) === '/phpunit/phpunit/phpunit') { - array_shift($files); - } - foreach (array_reverse($files) as $file) { - if (!empty($GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST']) && in_array($file, $GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'], \true)) { - continue; - } - if ($prefix !== \false && strpos($file, $prefix) === 0) { - continue; - } - // Skip virtual file system protocols - if (preg_match('/^(vfs|phpvfs[a-z0-9]+):/', $file)) { - continue; - } - if (!$excludeList->isExcluded($file) && is_file($file)) { - $result = 'require_once \'' . $file . "';\n" . $result; - } - } - return $result; + $this->constants = $constants->asArray(); } - public static function getIniSettingsAsString() : string + public function count(): int { - $result = ''; - foreach (ini_get_all(null, \false) as $key => $value) { - if (self::isIniSettingDeprecated($key)) { - continue; - } - $result .= sprintf('@ini_set(%s, %s);' . "\n", self::exportVariable($key), self::exportVariable((string) $value)); - } - return $result; + return iterator_count($this); } - public static function getConstantsAsString() : string + public function rewind(): void { - $constants = get_defined_constants(\true); - $result = ''; - if (isset($constants['user'])) { - foreach ($constants['user'] as $name => $value) { - $result .= sprintf('if (!defined(\'%s\')) define(\'%s\', %s);' . "\n", $name, $name, self::exportVariable($value)); - } - } - return $result; + $this->position = 0; } - public static function getGlobalsAsString() : string + public function valid(): bool { - $result = ''; - foreach (self::SUPER_GLOBAL_ARRAYS as $superGlobalArray) { - if (isset($GLOBALS[$superGlobalArray]) && is_array($GLOBALS[$superGlobalArray])) { - foreach (array_keys($GLOBALS[$superGlobalArray]) as $key) { - if ($GLOBALS[$superGlobalArray][$key] instanceof Closure) { - continue; - } - $result .= sprintf('$GLOBALS[\'%s\'][\'%s\'] = %s;' . "\n", $superGlobalArray, $key, self::exportVariable($GLOBALS[$superGlobalArray][$key])); - } - } - } - $excludeList = self::SUPER_GLOBAL_ARRAYS; - $excludeList[] = 'GLOBALS'; - foreach (array_keys($GLOBALS) as $key) { - if (!$GLOBALS[$key] instanceof Closure && !in_array($key, $excludeList, \true)) { - $result .= sprintf('$GLOBALS[\'%s\'] = %s;' . "\n", $key, self::exportVariable($GLOBALS[$key])); - } - } - return $result; + return $this->position < count($this->constants); } - private static function exportVariable($variable) : string + public function key(): int { - if (is_scalar($variable) || $variable === null || is_array($variable) && self::arrayOnlyContainsScalars($variable)) { - return var_export($variable, \true); - } - return 'unserialize(' . var_export(serialize($variable), \true) . ')'; + return $this->position; } - private static function arrayOnlyContainsScalars(array $array) : bool + public function current(): \PHPUnit\TextUI\XmlConfiguration\Constant { - $result = \true; - foreach ($array as $element) { - if (is_array($element)) { - $result = self::arrayOnlyContainsScalars($element); - } elseif (!is_scalar($element) && $element !== null) { - $result = \false; - } - if (!$result) { - break; - } - } - return $result; + return $this->constants[$this->position]; } - private static function isIniSettingDeprecated(string $iniSetting) : bool + public function next(): void { - return isset(self::DEPRECATED_INI_SETTINGS[PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION][$iniSetting]); + $this->position++; } } name = $name; + $this->value = $value; + } + public function name(): string + { + return $this->name; + } + public function value(): string + { + return $this->value; + } } */ -final class Json +final class IniSettingCollection implements Countable, IteratorAggregate { /** - * Prettify json string. - * - * @throws \PHPUnit\Framework\Exception + * @var IniSetting[] */ - public static function prettify(string $json) : string - { - $decodedJson = json_decode($json, \false); - if (json_last_error()) { - throw new Exception('Cannot prettify invalid json'); - } - return json_encode($decodedJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - } + private $iniSettings; /** - * To allow comparison of JSON strings, first process them into a consistent - * format so that they can be compared as strings. - * - * @return array ($error, $canonicalized_json) The $error parameter is used - * to indicate an error decoding the json. This is used to avoid ambiguity - * with JSON strings consisting entirely of 'null' or 'false'. + * @param IniSetting[] $iniSettings */ - public static function canonicalize(string $json) : array + public static function fromArray(array $iniSettings): self { - $decodedJson = json_decode($json); - if (json_last_error()) { - return [\true, null]; - } - self::recursiveSort($decodedJson); - $reencodedJson = json_encode($decodedJson); - return [\false, $reencodedJson]; + return new self(...$iniSettings); + } + private function __construct(\PHPUnit\TextUI\XmlConfiguration\IniSetting ...$iniSettings) + { + $this->iniSettings = $iniSettings; } /** - * JSON object keys are unordered while PHP array keys are ordered. - * - * Sort all array keys to ensure both the expected and actual values have - * their keys in the same order. + * @return IniSetting[] */ - private static function recursiveSort(&$json) : void + public function asArray(): array { - if (!is_array($json)) { - // If the object is not empty, change it to an associative array - // so we can sort the keys (and we will still re-encode it - // correctly, since PHP encodes associative arrays as JSON objects.) - // But EMPTY objects MUST remain empty objects. (Otherwise we will - // re-encode it as a JSON array rather than a JSON object.) - // See #2919. - if (is_object($json) && count((array) $json) > 0) { - $json = (array) $json; - } else { - return; - } - } - ksort($json); - foreach ($json as $key => &$value) { - self::recursiveSort($value); - } + return $this->iniSettings; + } + public function count(): int + { + return count($this->iniSettings); + } + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\IniSettingCollectionIterator + { + return new \PHPUnit\TextUI\XmlConfiguration\IniSettingCollectionIterator($this); } } */ -final class JUnit extends Printer implements TestListener +final class IniSettingCollectionIterator implements Countable, Iterator { /** - * @var DOMDocument - */ - private $document; - /** - * @var DOMElement - */ - private $root; - /** - * @var bool + * @var IniSetting[] */ - private $reportRiskyTests = \false; + private $iniSettings; /** - * @var DOMElement[] + * @var int */ - private $testSuites = []; + private $position; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\IniSettingCollection $iniSettings) + { + $this->iniSettings = $iniSettings->asArray(); + } + public function count(): int + { + return iterator_count($this); + } + public function rewind(): void + { + $this->position = 0; + } + public function valid(): bool + { + return $this->position < count($this->iniSettings); + } + public function key(): int + { + return $this->position; + } + public function current(): \PHPUnit\TextUI\XmlConfiguration\IniSetting + { + return $this->iniSettings[$this->position]; + } + public function next(): void + { + $this->position++; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class Php +{ /** - * @var int[] + * @var DirectoryCollection */ - private $testSuiteTests = [0]; + private $includePaths; /** - * @var int[] + * @var IniSettingCollection */ - private $testSuiteAssertions = [0]; + private $iniSettings; /** - * @var int[] + * @var ConstantCollection */ - private $testSuiteErrors = [0]; + private $constants; /** - * @var int[] + * @var VariableCollection */ - private $testSuiteWarnings = [0]; + private $globalVariables; /** - * @var int[] + * @var VariableCollection */ - private $testSuiteFailures = [0]; + private $envVariables; /** - * @var int[] + * @var VariableCollection */ - private $testSuiteSkipped = [0]; + private $postVariables; /** - * @var int[] + * @var VariableCollection */ - private $testSuiteTimes = [0]; + private $getVariables; /** - * @var int + * @var VariableCollection */ - private $testSuiteLevel = 0; + private $cookieVariables; /** - * @var DOMElement + * @var VariableCollection */ - private $currentTestCase; + private $serverVariables; /** - * @param null|mixed $out + * @var VariableCollection */ - public function __construct($out = null, bool $reportRiskyTests = \false) - { - $this->document = new DOMDocument('1.0', 'UTF-8'); - $this->document->formatOutput = \true; - $this->root = $this->document->createElement('testsuites'); - $this->document->appendChild($this->root); - parent::__construct($out); - $this->reportRiskyTests = $reportRiskyTests; - } + private $filesVariables; /** - * Flush buffer and close output. + * @var VariableCollection */ - public function flush() : void + private $requestVariables; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\DirectoryCollection $includePaths, \PHPUnit\TextUI\XmlConfiguration\IniSettingCollection $iniSettings, \PHPUnit\TextUI\XmlConfiguration\ConstantCollection $constants, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $globalVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $envVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $postVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $getVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $cookieVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $serverVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $filesVariables, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $requestVariables) { - $this->write($this->getXML()); - parent::flush(); - } - /** - * An error occurred. - */ - public function addError(Test $test, Throwable $t, float $time) : void - { - $this->doAddFault($test, $t, 'error'); - $this->testSuiteErrors[$this->testSuiteLevel]++; - } - /** - * A warning occurred. - */ - public function addWarning(Test $test, Warning $e, float $time) : void - { - $this->doAddFault($test, $e, 'warning'); - $this->testSuiteWarnings[$this->testSuiteLevel]++; + $this->includePaths = $includePaths; + $this->iniSettings = $iniSettings; + $this->constants = $constants; + $this->globalVariables = $globalVariables; + $this->envVariables = $envVariables; + $this->postVariables = $postVariables; + $this->getVariables = $getVariables; + $this->cookieVariables = $cookieVariables; + $this->serverVariables = $serverVariables; + $this->filesVariables = $filesVariables; + $this->requestVariables = $requestVariables; } - /** - * A failure occurred. - */ - public function addFailure(Test $test, AssertionFailedError $e, float $time) : void + public function includePaths(): \PHPUnit\TextUI\XmlConfiguration\DirectoryCollection { - $this->doAddFault($test, $e, 'failure'); - $this->testSuiteFailures[$this->testSuiteLevel]++; + return $this->includePaths; } - /** - * Incomplete test. - */ - public function addIncompleteTest(Test $test, Throwable $t, float $time) : void + public function iniSettings(): \PHPUnit\TextUI\XmlConfiguration\IniSettingCollection { - $this->doAddSkipped(); + return $this->iniSettings; } - /** - * Risky test. - */ - public function addRiskyTest(Test $test, Throwable $t, float $time) : void + public function constants(): \PHPUnit\TextUI\XmlConfiguration\ConstantCollection { - if (!$this->reportRiskyTests) { - return; - } - $this->doAddFault($test, $t, 'error'); - $this->testSuiteErrors[$this->testSuiteLevel]++; + return $this->constants; } - /** - * Skipped test. - */ - public function addSkippedTest(Test $test, Throwable $t, float $time) : void + public function globalVariables(): \PHPUnit\TextUI\XmlConfiguration\VariableCollection { - $this->doAddSkipped(); + return $this->globalVariables; } - /** - * A testsuite started. - */ - public function startTestSuite(TestSuite $suite) : void + public function envVariables(): \PHPUnit\TextUI\XmlConfiguration\VariableCollection { - $testSuite = $this->document->createElement('testsuite'); - $testSuite->setAttribute('name', $suite->getName()); - if (class_exists($suite->getName(), \false)) { - try { - $class = new ReflectionClass($suite->getName()); - $testSuite->setAttribute('file', $class->getFileName()); - } catch (ReflectionException $e) { - } - } - if ($this->testSuiteLevel > 0) { - $this->testSuites[$this->testSuiteLevel]->appendChild($testSuite); - } else { - $this->root->appendChild($testSuite); - } - $this->testSuiteLevel++; - $this->testSuites[$this->testSuiteLevel] = $testSuite; - $this->testSuiteTests[$this->testSuiteLevel] = 0; - $this->testSuiteAssertions[$this->testSuiteLevel] = 0; - $this->testSuiteErrors[$this->testSuiteLevel] = 0; - $this->testSuiteWarnings[$this->testSuiteLevel] = 0; - $this->testSuiteFailures[$this->testSuiteLevel] = 0; - $this->testSuiteSkipped[$this->testSuiteLevel] = 0; - $this->testSuiteTimes[$this->testSuiteLevel] = 0; + return $this->envVariables; } - /** - * A testsuite ended. - */ - public function endTestSuite(TestSuite $suite) : void + public function postVariables(): \PHPUnit\TextUI\XmlConfiguration\VariableCollection { - $this->testSuites[$this->testSuiteLevel]->setAttribute('tests', (string) $this->testSuiteTests[$this->testSuiteLevel]); - $this->testSuites[$this->testSuiteLevel]->setAttribute('assertions', (string) $this->testSuiteAssertions[$this->testSuiteLevel]); - $this->testSuites[$this->testSuiteLevel]->setAttribute('errors', (string) $this->testSuiteErrors[$this->testSuiteLevel]); - $this->testSuites[$this->testSuiteLevel]->setAttribute('warnings', (string) $this->testSuiteWarnings[$this->testSuiteLevel]); - $this->testSuites[$this->testSuiteLevel]->setAttribute('failures', (string) $this->testSuiteFailures[$this->testSuiteLevel]); - $this->testSuites[$this->testSuiteLevel]->setAttribute('skipped', (string) $this->testSuiteSkipped[$this->testSuiteLevel]); - $this->testSuites[$this->testSuiteLevel]->setAttribute('time', sprintf('%F', $this->testSuiteTimes[$this->testSuiteLevel])); - if ($this->testSuiteLevel > 1) { - $this->testSuiteTests[$this->testSuiteLevel - 1] += $this->testSuiteTests[$this->testSuiteLevel]; - $this->testSuiteAssertions[$this->testSuiteLevel - 1] += $this->testSuiteAssertions[$this->testSuiteLevel]; - $this->testSuiteErrors[$this->testSuiteLevel - 1] += $this->testSuiteErrors[$this->testSuiteLevel]; - $this->testSuiteWarnings[$this->testSuiteLevel - 1] += $this->testSuiteWarnings[$this->testSuiteLevel]; - $this->testSuiteFailures[$this->testSuiteLevel - 1] += $this->testSuiteFailures[$this->testSuiteLevel]; - $this->testSuiteSkipped[$this->testSuiteLevel - 1] += $this->testSuiteSkipped[$this->testSuiteLevel]; - $this->testSuiteTimes[$this->testSuiteLevel - 1] += $this->testSuiteTimes[$this->testSuiteLevel]; - } - $this->testSuiteLevel--; + return $this->postVariables; } - /** - * A test started. - */ - public function startTest(Test $test) : void + public function getVariables(): \PHPUnit\TextUI\XmlConfiguration\VariableCollection { - $usesDataprovider = \false; - if (method_exists($test, 'usesDataProvider')) { - $usesDataprovider = $test->usesDataProvider(); - } - $testCase = $this->document->createElement('testcase'); - $testCase->setAttribute('name', $test->getName()); - try { - $class = new ReflectionClass($test); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $methodName = $test->getName(!$usesDataprovider); - if ($class->hasMethod($methodName)) { - try { - $method = $class->getMethod($methodName); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $testCase->setAttribute('class', $class->getName()); - $testCase->setAttribute('classname', str_replace('\\', '.', $class->getName())); - $testCase->setAttribute('file', $class->getFileName()); - $testCase->setAttribute('line', (string) $method->getStartLine()); - } - $this->currentTestCase = $testCase; + return $this->getVariables; } - /** - * A test ended. - */ - public function endTest(Test $test, float $time) : void + public function cookieVariables(): \PHPUnit\TextUI\XmlConfiguration\VariableCollection { - $numAssertions = 0; - if (method_exists($test, 'getNumAssertions')) { - $numAssertions = $test->getNumAssertions(); - } - $this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions; - $this->currentTestCase->setAttribute('assertions', (string) $numAssertions); - $this->currentTestCase->setAttribute('time', sprintf('%F', $time)); - $this->testSuites[$this->testSuiteLevel]->appendChild($this->currentTestCase); - $this->testSuiteTests[$this->testSuiteLevel]++; - $this->testSuiteTimes[$this->testSuiteLevel] += $time; - $testOutput = ''; - if (method_exists($test, 'hasOutput') && method_exists($test, 'getActualOutput')) { - $testOutput = $test->hasOutput() ? $test->getActualOutput() : ''; - } - if (!empty($testOutput)) { - $systemOut = $this->document->createElement('system-out', Xml::prepareString($testOutput)); - $this->currentTestCase->appendChild($systemOut); - } - $this->currentTestCase = null; + return $this->cookieVariables; } - /** - * Returns the XML as a string. - */ - public function getXML() : string + public function serverVariables(): \PHPUnit\TextUI\XmlConfiguration\VariableCollection { - return $this->document->saveXML(); + return $this->serverVariables; } - private function doAddFault(Test $test, Throwable $t, string $type) : void + public function filesVariables(): \PHPUnit\TextUI\XmlConfiguration\VariableCollection { - if ($this->currentTestCase === null) { - return; - } - if ($test instanceof SelfDescribing) { - $buffer = $test->toString() . "\n"; - } else { - $buffer = ''; - } - $buffer .= trim(TestFailure::exceptionToString($t) . "\n" . Filter::getFilteredStacktrace($t)); - $fault = $this->document->createElement($type, Xml::prepareString($buffer)); - if ($t instanceof ExceptionWrapper) { - $fault->setAttribute('type', $t->getClassName()); - } else { - $fault->setAttribute('type', get_class($t)); - } - $this->currentTestCase->appendChild($fault); + return $this->filesVariables; } - private function doAddSkipped() : void + public function requestVariables(): \PHPUnit\TextUI\XmlConfiguration\VariableCollection { - if ($this->currentTestCase === null) { - return; - } - $skipped = $this->document->createElement('skipped'); - $this->currentTestCase->appendChild($skipped); - $this->testSuiteSkipped[$this->testSuiteLevel]++; + return $this->requestVariables; } } printHeader($result); - $this->printFooter($result); - } - /** - * An error occurred. - */ - public function addError(Test $test, Throwable $t, float $time) : void + public function handle(\PHPUnit\TextUI\XmlConfiguration\Php $configuration): void { - $this->printEvent('testFailed', ['name' => $test->getName(), 'message' => self::getMessage($t), 'details' => self::getDetails($t), 'duration' => self::toMilliseconds($time)]); + $this->handleIncludePaths($configuration->includePaths()); + $this->handleIniSettings($configuration->iniSettings()); + $this->handleConstants($configuration->constants()); + $this->handleGlobalVariables($configuration->globalVariables()); + $this->handleServerVariables($configuration->serverVariables()); + $this->handleEnvVariables($configuration->envVariables()); + $this->handleVariables('_POST', $configuration->postVariables()); + $this->handleVariables('_GET', $configuration->getVariables()); + $this->handleVariables('_COOKIE', $configuration->cookieVariables()); + $this->handleVariables('_FILES', $configuration->filesVariables()); + $this->handleVariables('_REQUEST', $configuration->requestVariables()); } - /** - * A warning occurred. - */ - public function addWarning(Test $test, Warning $e, float $time) : void + private function handleIncludePaths(\PHPUnit\TextUI\XmlConfiguration\DirectoryCollection $includePaths): void { - $this->write(self::getMessage($e) . \PHP_EOL); + if (!$includePaths->isEmpty()) { + $includePathsAsStrings = []; + foreach ($includePaths as $includePath) { + $includePathsAsStrings[] = $includePath->path(); + } + ini_set('include_path', implode(PATH_SEPARATOR, $includePathsAsStrings) . PATH_SEPARATOR . ini_get('include_path')); + } } - /** - * A failure occurred. - */ - public function addFailure(Test $test, AssertionFailedError $e, float $time) : void + private function handleIniSettings(\PHPUnit\TextUI\XmlConfiguration\IniSettingCollection $iniSettings): void { - $parameters = ['name' => $test->getName(), 'message' => self::getMessage($e), 'details' => self::getDetails($e), 'duration' => self::toMilliseconds($time)]; - if ($e instanceof ExpectationFailedException) { - $comparisonFailure = $e->getComparisonFailure(); - if ($comparisonFailure instanceof ComparisonFailure) { - $expectedString = $comparisonFailure->getExpectedAsString(); - if ($expectedString === null || empty($expectedString)) { - $expectedString = self::getPrimitiveValueAsString($comparisonFailure->getExpected()); - } - $actualString = $comparisonFailure->getActualAsString(); - if ($actualString === null || empty($actualString)) { - $actualString = self::getPrimitiveValueAsString($comparisonFailure->getActual()); - } - if ($actualString !== null && $expectedString !== null) { - $parameters['type'] = 'comparisonFailure'; - $parameters['actual'] = $actualString; - $parameters['expected'] = $expectedString; - } + foreach ($iniSettings as $iniSetting) { + $value = $iniSetting->value(); + if (defined($value)) { + $value = (string) constant($value); } + ini_set($iniSetting->name(), $value); } - $this->printEvent('testFailed', $parameters); } - /** - * Incomplete test. - */ - public function addIncompleteTest(Test $test, Throwable $t, float $time) : void + private function handleConstants(\PHPUnit\TextUI\XmlConfiguration\ConstantCollection $constants): void { - $this->printIgnoredTest($test->getName(), $t, $time); + foreach ($constants as $constant) { + if (!defined($constant->name())) { + define($constant->name(), $constant->value()); + } + } } - /** - * Risky test. - */ - public function addRiskyTest(Test $test, Throwable $t, float $time) : void + private function handleGlobalVariables(\PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables): void { - $this->addError($test, $t, $time); + foreach ($variables as $variable) { + $GLOBALS[$variable->name()] = $variable->value(); + } } - /** - * Skipped test. - */ - public function addSkippedTest(Test $test, Throwable $t, float $time) : void + private function handleServerVariables(\PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables): void { - $testName = $test->getName(); - if ($this->startedTestName !== $testName) { - $this->startTest($test); - $this->printIgnoredTest($testName, $t, $time); - $this->endTest($test, $time); - } else { - $this->printIgnoredTest($testName, $t, $time); + foreach ($variables as $variable) { + $_SERVER[$variable->name()] = $variable->value(); } } - public function printIgnoredTest(string $testName, Throwable $t, float $time) : void + private function handleVariables(string $target, \PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables): void { - $this->printEvent('testIgnored', ['name' => $testName, 'message' => self::getMessage($t), 'details' => self::getDetails($t), 'duration' => self::toMilliseconds($time)]); + foreach ($variables as $variable) { + $GLOBALS[$target][$variable->name()] = $variable->value(); + } } - /** - * A testsuite started. - */ - public function startTestSuite(TestSuite $suite) : void + private function handleEnvVariables(\PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables): void { - if (stripos(ini_get('disable_functions'), 'getmypid') === \false) { - $this->flowId = getmypid(); - } else { - $this->flowId = \false; - } - if (!$this->isSummaryTestCountPrinted) { - $this->isSummaryTestCountPrinted = \true; - $this->printEvent('testCount', ['count' => count($suite)]); - } - $suiteName = $suite->getName(); - if (empty($suiteName)) { - return; - } - $parameters = ['name' => $suiteName]; - if (class_exists($suiteName, \false)) { - $fileName = self::getFileName($suiteName); - $parameters['locationHint'] = "php_qn://{$fileName}::\\{$suiteName}"; - } else { - $split = explode('::', $suiteName); - if (count($split) === 2 && class_exists($split[0]) && method_exists($split[0], $split[1])) { - $fileName = self::getFileName($split[0]); - $parameters['locationHint'] = "php_qn://{$fileName}::\\{$suiteName}"; - $parameters['name'] = $split[1]; + foreach ($variables as $variable) { + $name = $variable->name(); + $value = $variable->value(); + $force = $variable->force(); + if ($force || getenv($name) === \false) { + putenv("{$name}={$value}"); + } + $value = getenv($name); + if ($force || !isset($_ENV[$name])) { + $_ENV[$name] = $value; } } - $this->printEvent('testSuiteStarted', $parameters); } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class Variable +{ /** - * A testsuite ended. + * @var string */ - public function endTestSuite(TestSuite $suite) : void - { - $suiteName = $suite->getName(); - if (empty($suiteName)) { - return; - } - $parameters = ['name' => $suiteName]; - if (!class_exists($suiteName, \false)) { - $split = explode('::', $suiteName); - if (count($split) === 2 && class_exists($split[0]) && method_exists($split[0], $split[1])) { - $parameters['name'] = $split[1]; - } - } - $this->printEvent('testSuiteFinished', $parameters); - } + private $name; /** - * A test started. + * @var mixed */ - public function startTest(Test $test) : void - { - $testName = $test->getName(); - $this->startedTestName = $testName; - $params = ['name' => $testName]; - if ($test instanceof TestCase) { - $className = get_class($test); - $fileName = self::getFileName($className); - $params['locationHint'] = "php_qn://{$fileName}::\\{$className}::{$testName}"; - } - $this->printEvent('testStarted', $params); - } + private $value; /** - * A test ended. + * @var bool */ - public function endTest(Test $test, float $time) : void - { - parent::endTest($test, $time); - $this->printEvent('testFinished', ['name' => $test->getName(), 'duration' => self::toMilliseconds($time)]); - } - protected function writeProgress(string $progress) : void + private $force; + public function __construct(string $name, $value, bool $force) { + $this->name = $name; + $this->value = $value; + $this->force = $force; } - private function printEvent(string $eventName, array $params = []) : void + public function name(): string { - $this->write("\n##teamcity[{$eventName}"); - if ($this->flowId) { - $params['flowId'] = $this->flowId; - } - foreach ($params as $key => $value) { - $escapedValue = self::escapeValue((string) $value); - $this->write(" {$key}='{$escapedValue}'"); - } - $this->write("]\n"); + return $this->name; } - private static function getMessage(Throwable $t) : string + public function value() { - $message = ''; - if ($t instanceof ExceptionWrapper) { - if ($t->getClassName() !== '') { - $message .= $t->getClassName(); - } - if ($message !== '' && $t->getMessage() !== '') { - $message .= ' : '; - } - } - return $message . $t->getMessage(); + return $this->value; } - private static function getDetails(Throwable $t) : string + public function force(): bool { - $stackTrace = Filter::getFilteredStacktrace($t); - $previous = $t instanceof ExceptionWrapper ? $t->getPreviousWrapped() : $t->getPrevious(); - while ($previous) { - $stackTrace .= "\nCaused by\n" . TestFailure::exceptionToString($previous) . "\n" . Filter::getFilteredStacktrace($previous); - $previous = $previous instanceof ExceptionWrapper ? $previous->getPreviousWrapped() : $previous->getPrevious(); - } - return ' ' . str_replace("\n", "\n ", $stackTrace); + return $this->force; } - private static function getPrimitiveValueAsString($value) : ?string +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use function count; +use Countable; +use IteratorAggregate; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + * + * @template-implements IteratorAggregate + */ +final class VariableCollection implements Countable, IteratorAggregate +{ + /** + * @var Variable[] + */ + private $variables; + /** + * @param Variable[] $variables + */ + public static function fromArray(array $variables): self { - if ($value === null) { - return 'null'; - } - if (is_bool($value)) { - return $value ? 'true' : 'false'; - } - if (is_scalar($value)) { - return print_r($value, \true); - } - return null; + return new self(...$variables); } - private static function escapeValue(string $text) : string + private function __construct(\PHPUnit\TextUI\XmlConfiguration\Variable ...$variables) { - return str_replace(['|', "'", "\n", "\r", ']', '['], ['||', "|'", '|n', '|r', '|]', '|['], $text); + $this->variables = $variables; } /** - * @param string $className + * @return Variable[] */ - private static function getFileName($className) : string + public function asArray(): array { - try { - return (new ReflectionClass($className))->getFileName(); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd + return $this->variables; } - /** - * @param float $time microseconds - */ - private static function toMilliseconds(float $time) : int + public function count(): int { - return (int) round($time * 1000); + return count($this->variables); + } + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\VariableCollectionIterator + { + return new \PHPUnit\TextUI\XmlConfiguration\VariableCollectionIterator($this); } } */ -abstract class AbstractPhpProcess +final class VariableCollectionIterator implements Countable, Iterator { /** - * @var Runtime - */ - protected $runtime; - /** - * @var bool - */ - protected $stderrRedirection = \false; - /** - * @var string - */ - protected $stdin = ''; - /** - * @var string - */ - protected $args = ''; - /** - * @var array + * @var Variable[] */ - protected $env = []; + private $variables; /** * @var int */ - protected $timeout = 0; - public static function factory() : self + private $position; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\VariableCollection $variables) { - if (DIRECTORY_SEPARATOR === '\\') { - return new \PHPUnit\Util\PHP\WindowsPhpProcess(); - } - return new \PHPUnit\Util\PHP\DefaultPhpProcess(); + $this->variables = $variables->asArray(); } - public function __construct() + public function count(): int { - $this->runtime = new Runtime(); + return iterator_count($this); } - /** - * Defines if should use STDERR redirection or not. - * - * Then $stderrRedirection is TRUE, STDERR is redirected to STDOUT. - */ - public function setUseStderrRedirection(bool $stderrRedirection) : void + public function rewind(): void { - $this->stderrRedirection = $stderrRedirection; + $this->position = 0; } - /** - * Returns TRUE if uses STDERR redirection or FALSE if not. - */ - public function useStderrRedirection() : bool + public function valid(): bool { - return $this->stderrRedirection; + return $this->position < count($this->variables); } - /** - * Sets the input string to be sent via STDIN. - */ - public function setStdin(string $stdin) : void + public function key(): int { - $this->stdin = $stdin; + return $this->position; } - /** - * Returns the input string to be sent via STDIN. - */ - public function getStdin() : string + public function current(): \PHPUnit\TextUI\XmlConfiguration\Variable { - return $this->stdin; + return $this->variables[$this->position]; } - /** - * Sets the string of arguments to pass to the php job. - */ - public function setArgs(string $args) : void + public function next(): void { - $this->args = $args; + $this->position++; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class Extension +{ /** - * Returns the string of arguments to pass to the php job. + * @var string + * + * @psalm-var class-string */ - public function getArgs() : string - { - return $this->args; - } + private $className; /** - * Sets the array of environment variables to start the child process with. - * - * @param array $env + * @var string */ - public function setEnv(array $env) : void - { - $this->env = $env; - } + private $sourceFile; /** - * Returns the array of environment variables to start the child process with. + * @var array */ - public function getEnv() : array - { - return $this->env; - } + private $arguments; /** - * Sets the amount of seconds to wait before timing out. + * @psalm-param class-string $className */ - public function setTimeout(int $timeout) : void + public function __construct(string $className, string $sourceFile, array $arguments) { - $this->timeout = $timeout; + $this->className = $className; + $this->sourceFile = $sourceFile; + $this->arguments = $arguments; } /** - * Returns the amount of seconds to wait before timing out. + * @psalm-return class-string */ - public function getTimeout() : int + public function className(): string { - return $this->timeout; + return $this->className; } - /** - * Runs a single test in a separate PHP process. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function runTestJob(string $job, Test $test, TestResult $result, string $processResultFile) : void + public function hasSourceFile(): bool { - $result->startTest($test); - $processResult = ''; - $_result = $this->runJob($job); - if (file_exists($processResultFile)) { - $processResult = file_get_contents($processResultFile); - @unlink($processResultFile); - } - $this->processChildResult($test, $result, $processResult, $_result['stderr']); + return $this->sourceFile !== ''; } - /** - * Returns the command based into the configurations. - */ - public function getCommand(array $settings, string $file = null) : string + public function sourceFile(): string { - $command = $this->runtime->getBinary(); - if ($this->runtime->hasPCOV()) { - $settings = array_merge($settings, $this->runtime->getCurrentSettings(array_keys(ini_get_all('pcov')))); - } elseif ($this->runtime->hasXdebug()) { - $settings = array_merge($settings, $this->runtime->getCurrentSettings(array_keys(ini_get_all('xdebug')))); - } - $command .= $this->settingsToParameters($settings); - if (PHP_SAPI === 'phpdbg') { - $command .= ' -qrr'; - if (!$file) { - $command .= 's='; - } - } - if ($file) { - $command .= ' ' . escapeshellarg($file); - } - if ($this->args) { - if (!$file) { - $command .= ' --'; - } - $command .= ' ' . $this->args; - } - if ($this->stderrRedirection) { - $command .= ' 2>&1'; - } - return $command; + return $this->sourceFile; } - /** - * Runs a single job (PHP code) using a separate PHP process. - */ - public abstract function runJob(string $job, array $settings = []) : array; - protected function settingsToParameters(array $settings) : string + public function hasArguments(): bool { - $buffer = ''; - foreach ($settings as $setting) { - $buffer .= ' -d ' . escapeshellarg($setting); - } - return $buffer; + return !empty($this->arguments); + } + public function arguments(): array + { + return $this->arguments; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use IteratorAggregate; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + * + * @template-implements IteratorAggregate + */ +final class ExtensionCollection implements IteratorAggregate +{ /** - * Processes the TestResult object from an isolated process. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @var Extension[] + */ + private $extensions; + /** + * @param Extension[] $extensions */ - private function processChildResult(Test $test, TestResult $result, string $stdout, string $stderr) : void + public static function fromArray(array $extensions): self { - $time = 0; - if (!empty($stderr)) { - $result->addError($test, new Exception(trim($stderr)), $time); - } else { - set_error_handler( - /** - * @throws ErrorException - */ - static function ($errno, $errstr, $errfile, $errline) : void { - throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); - } - ); - try { - if (strpos($stdout, "#!/usr/bin/env php\n") === 0) { - $stdout = substr($stdout, 19); - } - $childResult = unserialize(str_replace("#!/usr/bin/env php\n", '', $stdout)); - restore_error_handler(); - if ($childResult === \false) { - $result->addFailure($test, new AssertionFailedError('Test was run in child process and ended unexpectedly'), $time); - } - } catch (ErrorException $e) { - restore_error_handler(); - $childResult = \false; - $result->addError($test, new Exception(trim($stdout), 0, $e), $time); - } - if ($childResult !== \false) { - if (!empty($childResult['output'])) { - $output = $childResult['output']; - } - /* @var TestCase $test */ - $test->setResult($childResult['testResult']); - $test->addToAssertionCount($childResult['numAssertions']); - $childResult = $childResult['result']; - assert($childResult instanceof TestResult); - if ($result->getCollectCodeCoverageInformation()) { - $result->getCodeCoverage()->merge($childResult->getCodeCoverage()); - } - $time = $childResult->time(); - $notImplemented = $childResult->notImplemented(); - $risky = $childResult->risky(); - $skipped = $childResult->skipped(); - $errors = $childResult->errors(); - $warnings = $childResult->warnings(); - $failures = $childResult->failures(); - if (!empty($notImplemented)) { - $result->addError($test, $this->getException($notImplemented[0]), $time); - } elseif (!empty($risky)) { - $result->addError($test, $this->getException($risky[0]), $time); - } elseif (!empty($skipped)) { - $result->addError($test, $this->getException($skipped[0]), $time); - } elseif (!empty($errors)) { - $result->addError($test, $this->getException($errors[0]), $time); - } elseif (!empty($warnings)) { - $result->addWarning($test, $this->getException($warnings[0]), $time); - } elseif (!empty($failures)) { - $result->addFailure($test, $this->getException($failures[0]), $time); - } - } - } - $result->endTest($test, $time); - if (!empty($output)) { - print $output; - } + return new self(...$extensions); + } + private function __construct(\PHPUnit\TextUI\XmlConfiguration\Extension ...$extensions) + { + $this->extensions = $extensions; } /** - * Gets the thrown exception from a PHPUnit\Framework\TestFailure. - * - * @see https://github.com/sebastianbergmann/phpunit/issues/74 + * @return Extension[] */ - private function getException(TestFailure $error) : Exception + public function asArray(): array { - $exception = $error->thrownException(); - if ($exception instanceof __PHP_Incomplete_Class) { - $exceptionArray = []; - foreach ((array) $exception as $key => $value) { - $key = substr($key, strrpos($key, "\x00") + 1); - $exceptionArray[$key] = $value; - } - $exception = new SyntheticError(sprintf('%s: %s', $exceptionArray['_PHP_Incomplete_Class_Name'], $exceptionArray['message']), $exceptionArray['code'], $exceptionArray['file'], $exceptionArray['line'], $exceptionArray['trace']); - } - return $exception; + return $this->extensions; + } + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\ExtensionCollectionIterator + { + return new \PHPUnit\TextUI\XmlConfiguration\ExtensionCollectionIterator($this); } } */ -class DefaultPhpProcess extends \PHPUnit\Util\PHP\AbstractPhpProcess +final class ExtensionCollectionIterator implements Countable, Iterator { /** - * @var string + * @var Extension[] */ - protected $tempFile; + private $extensions; /** - * Runs a single job (PHP code) using a separate PHP process. - * - * @throws Exception + * @var int */ - public function runJob(string $job, array $settings = []) : array + private $position; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\ExtensionCollection $extensions) { - if ($this->stdin || $this->useTemporaryFile()) { - if (!($this->tempFile = tempnam(sys_get_temp_dir(), 'PHPUnit')) || file_put_contents($this->tempFile, $job) === \false) { - throw new Exception('Unable to write temporary file'); - } - $job = $this->stdin; - } - return $this->runProcess($job, $settings); + $this->extensions = $extensions->asArray(); } - /** - * Returns an array of file handles to be used in place of pipes. - */ - protected function getHandles() : array + public function count(): int { - return []; + return iterator_count($this); } - /** - * Handles creating the child process and returning the STDOUT and STDERR. - * - * @throws Exception - */ - protected function runProcess(string $job, array $settings) : array + public function rewind(): void { - $handles = $this->getHandles(); - $env = null; - if ($this->env) { - $env = $_SERVER ?? []; - unset($env['argv'], $env['argc']); - $env = array_merge($env, $this->env); - foreach ($env as $envKey => $envVar) { - if (is_array($envVar)) { - unset($env[$envKey]); - } - } - } - $pipeSpec = [0 => $handles[0] ?? ['pipe', 'r'], 1 => $handles[1] ?? ['pipe', 'w'], 2 => $handles[2] ?? ['pipe', 'w']]; - $process = proc_open($this->getCommand($settings, $this->tempFile), $pipeSpec, $pipes, null, $env); - if (!is_resource($process)) { - throw new Exception('Unable to spawn worker process'); - } - if ($job) { - $this->process($pipes[0], $job); - } - fclose($pipes[0]); - $stderr = $stdout = ''; - if ($this->timeout) { - unset($pipes[0]); - while (\true) { - $r = $pipes; - $w = null; - $e = null; - $n = @stream_select($r, $w, $e, $this->timeout); - if ($n === \false) { - break; - } - if ($n === 0) { - proc_terminate($process, 9); - throw new Exception(sprintf('Job execution aborted after %d seconds', $this->timeout)); - } - if ($n > 0) { - foreach ($r as $pipe) { - $pipeOffset = 0; - foreach ($pipes as $i => $origPipe) { - if ($pipe === $origPipe) { - $pipeOffset = $i; - break; - } - } - if (!$pipeOffset) { - break; - } - $line = fread($pipe, 8192); - if ($line === '' || $line === \false) { - fclose($pipes[$pipeOffset]); - unset($pipes[$pipeOffset]); - } elseif ($pipeOffset === 1) { - $stdout .= $line; - } else { - $stderr .= $line; - } - } - if (empty($pipes)) { - break; - } - } - } - } else { - if (isset($pipes[1])) { - $stdout = stream_get_contents($pipes[1]); - fclose($pipes[1]); - } - if (isset($pipes[2])) { - $stderr = stream_get_contents($pipes[2]); - fclose($pipes[2]); - } - } - if (isset($handles[1])) { - rewind($handles[1]); - $stdout = stream_get_contents($handles[1]); - fclose($handles[1]); - } - if (isset($handles[2])) { - rewind($handles[2]); - $stderr = stream_get_contents($handles[2]); - fclose($handles[2]); - } - proc_close($process); - $this->cleanup(); - return ['stdout' => $stdout, 'stderr' => $stderr]; + $this->position = 0; } - /** - * @param resource $pipe - */ - protected function process($pipe, string $job) : void + public function valid(): bool { - fwrite($pipe, $job); + return $this->position < count($this->extensions); } - protected function cleanup() : void + public function key(): int { - if ($this->tempFile) { - unlink($this->tempFile); - } + return $this->position; } - protected function useTemporaryFile() : bool + public function current(): \PHPUnit\TextUI\XmlConfiguration\Extension { - return \false; + return $this->extensions[$this->position]; + } + public function next(): void + { + $this->position++; } } + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; -if (class_exists('PHPUnit\SebastianBergmann\CodeCoverage\CodeCoverage')) { - $filter = new Filter; - - $coverage = new CodeCoverage( - (new Selector)->{driverMethod}($filter), - $filter - ); - - if ({codeCoverageCacheDirectory}) { - $coverage->cacheStaticAnalysis({codeCoverageCacheDirectory}); - } - - $coverage->start(__FILE__); -} - -register_shutdown_function( - function() use ($coverage) { - $output = null; - - if ($coverage) { - $output = $coverage->stop(); - } - - file_put_contents('{coverageFile}', serialize($output)); - } -); - -ob_end_clean(); - -require '{job}'; -{driverMethod}($filter), - $filter - ); - - if ({cachesStaticAnalysis}) { - $codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}')); - } - - $result->setCodeCoverage($codeCoverage); - } - - $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything}); - $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests}); - $result->enforceTimeLimit({enforcesTimeLimit}); - $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests}); - $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests}); - - $test = new {className}('{name}', unserialize('{data}'), '{dataName}'); - $test->setDependencyInput(unserialize('{dependencyInput}')); - $test->setInIsolation(true); - - ob_end_clean(); - $test->run($result); - $output = ''; - if (!$test->hasExpectationOnOutput()) { - $output = $test->getActualOutput(); - } - - ini_set('xdebug.scream', '0'); - - @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ - if ($stdout = @stream_get_contents(STDOUT)) { - $output = $stdout . $output; - $streamMetaData = stream_get_meta_data(STDOUT); - if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) { - @ftruncate(STDOUT, 0); - @rewind(STDOUT); - } - } - - file_put_contents( - '{processResultFile}', - serialize( - [ - 'testResult' => $test->getResult(), - 'numAssertions' => $test->getNumAssertions(), - 'result' => $result, - 'output' => $output - ] - ) - ); -} - -$configurationFilePath = '{configurationFilePath}'; - -if ('' !== $configurationFilePath) { - $configuration = (new Loader)->load($configurationFilePath); - - (new PhpHandler)->handle($configuration->php()); - - unset($configuration); -} - -function __phpunit_error_handler($errno, $errstr, $errfile, $errline) -{ - return true; -} - -set_error_handler('__phpunit_error_handler'); - -{constants} -{included_files} -{globals} - -restore_error_handler(); - -if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { - require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; - unset($GLOBALS['__PHPUNIT_BOOTSTRAP']); -} - -__phpunit_run_isolated_test(); -{driverMethod}($filter), - $filter - ); - - if ({cachesStaticAnalysis}) { - $codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}')); - } - - $result->setCodeCoverage($codeCoverage); - } - - $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything}); - $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests}); - $result->enforceTimeLimit({enforcesTimeLimit}); - $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests}); - $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests}); - - $test = new {className}('{methodName}', unserialize('{data}'), '{dataName}'); - \assert($test instanceof TestCase); - - $test->setDependencyInput(unserialize('{dependencyInput}')); - $test->setInIsolation(true); - - ob_end_clean(); - $test->run($result); - $output = ''; - if (!$test->hasExpectationOnOutput()) { - $output = $test->getActualOutput(); - } - - ini_set('xdebug.scream', '0'); - - @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ - if ($stdout = @stream_get_contents(STDOUT)) { - $output = $stdout . $output; - $streamMetaData = stream_get_meta_data(STDOUT); - if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) { - @ftruncate(STDOUT, 0); - @rewind(STDOUT); - } - } - - file_put_contents( - '{processResultFile}', - serialize( - [ - 'testResult' => $test->getResult(), - 'numAssertions' => $test->getNumAssertions(), - 'result' => $result, - 'output' => $output - ] - ) - ); -} - -$configurationFilePath = '{configurationFilePath}'; - -if ('' !== $configurationFilePath) { - $configuration = (new Loader)->load($configurationFilePath); - - (new PhpHandler)->handle($configuration->php()); - - unset($configuration); -} - -function __phpunit_error_handler($errno, $errstr, $errfile, $errline) -{ - return true; -} - -set_error_handler('__phpunit_error_handler'); - -{constants} -{included_files} -{globals} - -restore_error_handler(); - -if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { - require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; - unset($GLOBALS['__PHPUNIT_BOOTSTRAP']); -} - -__phpunit_run_isolated_test(); - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util\PHP; - -use const PHP_MAJOR_VERSION; -use function tmpfile; -use PHPUnit\Framework\Exception; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit * - * @see https://bugs.php.net/bug.php?id=51800 + * @psalm-immutable */ -final class WindowsPhpProcess extends \PHPUnit\Util\PHP\DefaultPhpProcess +final class PHPUnit { - public function getCommand(array $settings, string $file = null) : string - { - if (PHP_MAJOR_VERSION < 8) { - return '"' . parent::getCommand($settings, $file) . '"'; - } - return parent::getCommand($settings, $file); - } /** - * @throws Exception + * @var bool */ - protected function getHandles() : array - { - if (\false === ($stdout_handle = tmpfile())) { - throw new Exception('A temporary file could not be created; verify that your TEMP environment variable is writable'); - } - return [1 => $stdout_handle]; - } - protected function useTemporaryFile() : bool - { - return \true; - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util; - -use const ENT_COMPAT; -use const ENT_SUBSTITUTE; -use const PHP_SAPI; -use function assert; -use function count; -use function dirname; -use function explode; -use function fclose; -use function fopen; -use function fsockopen; -use function fwrite; -use function htmlspecialchars; -use function is_resource; -use function is_string; -use function sprintf; -use function str_replace; -use function strncmp; -use function strpos; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -class Printer -{ + private $cacheResult; /** - * @psalm-var closed-resource|resource + * @var ?string */ - private $stream; + private $cacheResultFile; + /** + * @var int|string + */ + private $columns; + /** + * @var string + */ + private $colors; /** * @var bool */ - private $isPhpStream; + private $stderr; /** - * @param null|resource|string $out - * - * @throws Exception + * @var bool */ - public function __construct($out = null) - { - if (is_resource($out)) { - $this->stream = $out; - return; - } - if (!is_string($out)) { - return; - } - if (strpos($out, 'socket://') === 0) { - $tmp = explode(':', str_replace('socket://', '', $out)); - if (count($tmp) !== 2) { - throw new \PHPUnit\Util\Exception(sprintf('"%s" does not match "socket://hostname:port" format', $out)); - } - $this->stream = fsockopen($tmp[0], (int) $tmp[1]); - return; - } - if (strpos($out, 'php://') === \false && !\PHPUnit\Util\Filesystem::createDirectory(dirname($out))) { - throw new \PHPUnit\Util\Exception(sprintf('Directory "%s" was not created', dirname($out))); - } - $this->stream = fopen($out, 'wb'); - $this->isPhpStream = strncmp($out, 'php://', 6) !== 0; - } - public function write(string $buffer) : void - { - if ($this->stream) { - assert(is_resource($this->stream)); - fwrite($this->stream, $buffer); - } else { - if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { - $buffer = htmlspecialchars($buffer, ENT_COMPAT | ENT_SUBSTITUTE); - } - print $buffer; - } - } - public function flush() : void - { - if ($this->stream && $this->isPhpStream) { - assert(is_resource($this->stream)); - fclose($this->stream); - } - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util; - -use PHPUnit\Framework\Assert; -use PHPUnit\Framework\TestCase; -use ReflectionClass; -use ReflectionMethod; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class Reflection -{ + private $noInteraction; /** - * @psalm-return list + * @var bool */ - public function publicMethodsInTestClass(ReflectionClass $class) : array - { - return $this->filterMethods($class, ReflectionMethod::IS_PUBLIC); - } + private $verbose; /** - * @psalm-return list + * @var bool */ - public function methodsInTestClass(ReflectionClass $class) : array - { - return $this->filterMethods($class, null); - } + private $reverseDefectList; /** - * @psalm-return list + * @var bool */ - private function filterMethods(ReflectionClass $class, ?int $filter) : array - { - $methods = []; - // PHP <7.3.5 throw error when null is passed - // to ReflectionClass::getMethods() when strict_types is enabled. - $classMethods = $filter === null ? $class->getMethods() : $class->getMethods($filter); - foreach ($classMethods as $method) { - if ($method->getDeclaringClass()->getName() === TestCase::class) { - continue; - } - if ($method->getDeclaringClass()->getName() === Assert::class) { - continue; - } - $methods[] = $method; - } - return $methods; - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util; - -use function preg_match; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class RegularExpression -{ + private $convertDeprecationsToExceptions; /** - * @return false|int + * @var bool */ - public static function safeMatch(string $pattern, string $subject) - { - return \PHPUnit\Util\ErrorHandler::invokeIgnoringWarnings(static function () use($pattern, $subject) { - return preg_match($pattern, $subject); - }); - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util; - -use const PHP_OS; -use const PHP_VERSION; -use function addcslashes; -use function array_flip; -use function array_key_exists; -use function array_merge; -use function array_unique; -use function array_unshift; -use function class_exists; -use function count; -use function explode; -use function extension_loaded; -use function function_exists; -use function get_class; -use function ini_get; -use function interface_exists; -use function is_array; -use function is_int; -use function method_exists; -use function phpversion; -use function preg_match; -use function preg_replace; -use function sprintf; -use function strncmp; -use function strpos; -use function strtolower; -use function trim; -use function version_compare; -use PHPUnit\Framework\CodeCoverageException; -use PHPUnit\Framework\ExecutionOrderDependency; -use PHPUnit\Framework\InvalidCoversTargetException; -use PHPUnit\Framework\SelfDescribing; -use PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Warning; -use PHPUnit\Runner\Version; -use PHPUnit\Util\Annotation\Registry; -use ReflectionClass; -use ReflectionException; -use ReflectionMethod; -use PHPUnit\SebastianBergmann\CodeUnit\CodeUnitCollection; -use PHPUnit\SebastianBergmann\CodeUnit\InvalidCodeUnitException; -use PHPUnit\SebastianBergmann\CodeUnit\Mapper; -use PHPUnit\SebastianBergmann\Environment\OperatingSystem; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class Test -{ + private $convertErrorsToExceptions; + /** + * @var bool + */ + private $convertNoticesToExceptions; + /** + * @var bool + */ + private $convertWarningsToExceptions; + /** + * @var bool + */ + private $forceCoversAnnotation; + /** + * @var ?string + */ + private $bootstrap; + /** + * @var bool + */ + private $processIsolation; + /** + * @var bool + */ + private $failOnEmptyTestSuite; + /** + * @var bool + */ + private $failOnIncomplete; + /** + * @var bool + */ + private $failOnRisky; + /** + * @var bool + */ + private $failOnSkipped; + /** + * @var bool + */ + private $failOnWarning; + /** + * @var bool + */ + private $stopOnDefect; + /** + * @var bool + */ + private $stopOnError; + /** + * @var bool + */ + private $stopOnFailure; + /** + * @var bool + */ + private $stopOnWarning; + /** + * @var bool + */ + private $stopOnIncomplete; + /** + * @var bool + */ + private $stopOnRisky; + /** + * @var bool + */ + private $stopOnSkipped; + /** + * @var ?string + */ + private $extensionsDirectory; + /** + * @var ?string + * + * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 + */ + private $testSuiteLoaderClass; + /** + * @var ?string + * + * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 + */ + private $testSuiteLoaderFile; + /** + * @var ?string + */ + private $printerClass; + /** + * @var ?string + */ + private $printerFile; + /** + * @var bool + */ + private $beStrictAboutChangesToGlobalState; + /** + * @var bool + */ + private $beStrictAboutOutputDuringTests; + /** + * @var bool + */ + private $beStrictAboutResourceUsageDuringSmallTests; + /** + * @var bool + */ + private $beStrictAboutTestsThatDoNotTestAnything; + /** + * @var bool + */ + private $beStrictAboutTodoAnnotatedTests; + /** + * @var bool + */ + private $beStrictAboutCoversAnnotation; + /** + * @var bool + */ + private $enforceTimeLimit; /** * @var int */ - public const UNKNOWN = -1; + private $defaultTimeLimit; /** * @var int */ - public const SMALL = 0; + private $timeoutForSmallTests; /** * @var int */ - public const MEDIUM = 1; + private $timeoutForMediumTests; /** * @var int */ - public const LARGE = 2; + private $timeoutForLargeTests; /** - * @var array + * @var ?string */ - private static $hookMethods = []; + private $defaultTestSuite; /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @var int + */ + private $executionOrder; + /** + * @var bool + */ + private $resolveDependencies; + /** + * @var bool + */ + private $defectsFirst; + /** + * @var bool + */ + private $backupGlobals; + /** + * @var bool + */ + private $backupStaticAttributes; + /** + * @var bool + */ + private $registerMockObjectsFromTestArgumentsRecursively; + /** + * @var bool */ - public static function describe(\PHPUnit\Framework\Test $test) : array + private $conflictBetweenPrinterClassAndTestdox; + public function __construct(bool $cacheResult, ?string $cacheResultFile, $columns, string $colors, bool $stderr, bool $noInteraction, bool $verbose, bool $reverseDefectList, bool $convertDeprecationsToExceptions, bool $convertErrorsToExceptions, bool $convertNoticesToExceptions, bool $convertWarningsToExceptions, bool $forceCoversAnnotation, ?string $bootstrap, bool $processIsolation, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $stopOnDefect, bool $stopOnError, bool $stopOnFailure, bool $stopOnWarning, bool $stopOnIncomplete, bool $stopOnRisky, bool $stopOnSkipped, ?string $extensionsDirectory, ?string $testSuiteLoaderClass, ?string $testSuiteLoaderFile, ?string $printerClass, ?string $printerFile, bool $beStrictAboutChangesToGlobalState, bool $beStrictAboutOutputDuringTests, bool $beStrictAboutResourceUsageDuringSmallTests, bool $beStrictAboutTestsThatDoNotTestAnything, bool $beStrictAboutTodoAnnotatedTests, bool $beStrictAboutCoversAnnotation, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, ?string $defaultTestSuite, int $executionOrder, bool $resolveDependencies, bool $defectsFirst, bool $backupGlobals, bool $backupStaticAttributes, bool $registerMockObjectsFromTestArgumentsRecursively, bool $conflictBetweenPrinterClassAndTestdox) { - if ($test instanceof TestCase) { - return [get_class($test), $test->getName()]; - } - if ($test instanceof SelfDescribing) { - return ['', $test->toString()]; - } - return ['', get_class($test)]; + $this->cacheResult = $cacheResult; + $this->cacheResultFile = $cacheResultFile; + $this->columns = $columns; + $this->colors = $colors; + $this->stderr = $stderr; + $this->noInteraction = $noInteraction; + $this->verbose = $verbose; + $this->reverseDefectList = $reverseDefectList; + $this->convertDeprecationsToExceptions = $convertDeprecationsToExceptions; + $this->convertErrorsToExceptions = $convertErrorsToExceptions; + $this->convertNoticesToExceptions = $convertNoticesToExceptions; + $this->convertWarningsToExceptions = $convertWarningsToExceptions; + $this->forceCoversAnnotation = $forceCoversAnnotation; + $this->bootstrap = $bootstrap; + $this->processIsolation = $processIsolation; + $this->failOnEmptyTestSuite = $failOnEmptyTestSuite; + $this->failOnIncomplete = $failOnIncomplete; + $this->failOnRisky = $failOnRisky; + $this->failOnSkipped = $failOnSkipped; + $this->failOnWarning = $failOnWarning; + $this->stopOnDefect = $stopOnDefect; + $this->stopOnError = $stopOnError; + $this->stopOnFailure = $stopOnFailure; + $this->stopOnWarning = $stopOnWarning; + $this->stopOnIncomplete = $stopOnIncomplete; + $this->stopOnRisky = $stopOnRisky; + $this->stopOnSkipped = $stopOnSkipped; + $this->extensionsDirectory = $extensionsDirectory; + $this->testSuiteLoaderClass = $testSuiteLoaderClass; + $this->testSuiteLoaderFile = $testSuiteLoaderFile; + $this->printerClass = $printerClass; + $this->printerFile = $printerFile; + $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + $this->beStrictAboutOutputDuringTests = $beStrictAboutOutputDuringTests; + $this->beStrictAboutResourceUsageDuringSmallTests = $beStrictAboutResourceUsageDuringSmallTests; + $this->beStrictAboutTestsThatDoNotTestAnything = $beStrictAboutTestsThatDoNotTestAnything; + $this->beStrictAboutTodoAnnotatedTests = $beStrictAboutTodoAnnotatedTests; + $this->beStrictAboutCoversAnnotation = $beStrictAboutCoversAnnotation; + $this->enforceTimeLimit = $enforceTimeLimit; + $this->defaultTimeLimit = $defaultTimeLimit; + $this->timeoutForSmallTests = $timeoutForSmallTests; + $this->timeoutForMediumTests = $timeoutForMediumTests; + $this->timeoutForLargeTests = $timeoutForLargeTests; + $this->defaultTestSuite = $defaultTestSuite; + $this->executionOrder = $executionOrder; + $this->resolveDependencies = $resolveDependencies; + $this->defectsFirst = $defectsFirst; + $this->backupGlobals = $backupGlobals; + $this->backupStaticAttributes = $backupStaticAttributes; + $this->registerMockObjectsFromTestArgumentsRecursively = $registerMockObjectsFromTestArgumentsRecursively; + $this->conflictBetweenPrinterClassAndTestdox = $conflictBetweenPrinterClassAndTestdox; } - public static function describeAsString(\PHPUnit\Framework\Test $test) : string + public function cacheResult(): bool { - if ($test instanceof SelfDescribing) { - return $test->toString(); - } - return get_class($test); + return $this->cacheResult; } /** - * @throws CodeCoverageException - * - * @return array|bool - * - * @psalm-param class-string $className + * @psalm-assert-if-true !null $this->cacheResultFile */ - public static function getLinesToBeCovered(string $className, string $methodName) + public function hasCacheResultFile(): bool { - $annotations = self::parseTestMethodAnnotations($className, $methodName); - if (!self::shouldCoversAnnotationBeUsed($annotations)) { - return \false; - } - return self::getLinesToBeCoveredOrUsed($className, $methodName, 'covers'); + return $this->cacheResultFile !== null; } /** - * Returns lines of code specified with the @uses annotation. - * - * @throws CodeCoverageException - * - * @psalm-param class-string $className + * @throws Exception */ - public static function getLinesToBeUsed(string $className, string $methodName) : array + public function cacheResultFile(): string { - return self::getLinesToBeCoveredOrUsed($className, $methodName, 'uses'); + if (!$this->hasCacheResultFile()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception('Cache result file is not configured'); + } + return (string) $this->cacheResultFile; } - public static function requiresCodeCoverageDataCollection(TestCase $test) : bool + public function columns() { - $annotations = self::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); - // If there is no @covers annotation but a @coversNothing annotation on - // the test method then code coverage data does not need to be collected - if (isset($annotations['method']['coversNothing'])) { - // @see https://github.com/sebastianbergmann/phpunit/issues/4947#issuecomment-1084480950 - // return false; - } - // If there is at least one @covers annotation then - // code coverage data needs to be collected - if (isset($annotations['method']['covers'])) { - return \true; - } - // If there is no @covers annotation but a @coversNothing annotation - // then code coverage data does not need to be collected - if (isset($annotations['class']['coversNothing'])) { - // @see https://github.com/sebastianbergmann/phpunit/issues/4947#issuecomment-1084480950 - // return false; - } - // If there is no @coversNothing annotation then - // code coverage data may be collected - return \true; + return $this->columns; + } + public function colors(): string + { + return $this->colors; + } + public function stderr(): bool + { + return $this->stderr; + } + public function noInteraction(): bool + { + return $this->noInteraction; + } + public function verbose(): bool + { + return $this->verbose; + } + public function reverseDefectList(): bool + { + return $this->reverseDefectList; + } + public function convertDeprecationsToExceptions(): bool + { + return $this->convertDeprecationsToExceptions; + } + public function convertErrorsToExceptions(): bool + { + return $this->convertErrorsToExceptions; + } + public function convertNoticesToExceptions(): bool + { + return $this->convertNoticesToExceptions; + } + public function convertWarningsToExceptions(): bool + { + return $this->convertWarningsToExceptions; + } + public function forceCoversAnnotation(): bool + { + return $this->forceCoversAnnotation; } /** - * @throws Exception - * - * @psalm-param class-string $className + * @psalm-assert-if-true !null $this->bootstrap */ - public static function getRequirements(string $className, string $methodName) : array + public function hasBootstrap(): bool { - return self::mergeArraysRecursively(Registry::getInstance()->forClassName($className)->requirements(), Registry::getInstance()->forMethod($className, $methodName)->requirements()); + return $this->bootstrap !== null; } /** - * Returns the missing requirements for a test. - * * @throws Exception - * @throws Warning - * - * @psalm-param class-string $className */ - public static function getMissingRequirements(string $className, string $methodName) : array + public function bootstrap(): string { - $required = self::getRequirements($className, $methodName); - $missing = []; - $hint = null; - if (!empty($required['PHP'])) { - $operator = new \PHPUnit\Util\VersionComparisonOperator(empty($required['PHP']['operator']) ? '>=' : $required['PHP']['operator']); - if (!version_compare(PHP_VERSION, $required['PHP']['version'], $operator->asString())) { - $missing[] = sprintf('PHP %s %s is required.', $operator->asString(), $required['PHP']['version']); - $hint = 'PHP'; - } - } elseif (!empty($required['PHP_constraint'])) { - $version = new \PHPUnit\PharIo\Version\Version(self::sanitizeVersionNumber(PHP_VERSION)); - if (!$required['PHP_constraint']['constraint']->complies($version)) { - $missing[] = sprintf('PHP version does not match the required constraint %s.', $required['PHP_constraint']['constraint']->asString()); - $hint = 'PHP_constraint'; - } - } - if (!empty($required['PHPUnit'])) { - $phpunitVersion = Version::id(); - $operator = new \PHPUnit\Util\VersionComparisonOperator(empty($required['PHPUnit']['operator']) ? '>=' : $required['PHPUnit']['operator']); - if (!version_compare($phpunitVersion, $required['PHPUnit']['version'], $operator->asString())) { - $missing[] = sprintf('PHPUnit %s %s is required.', $operator->asString(), $required['PHPUnit']['version']); - $hint = $hint ?? 'PHPUnit'; - } - } elseif (!empty($required['PHPUnit_constraint'])) { - $phpunitVersion = new \PHPUnit\PharIo\Version\Version(self::sanitizeVersionNumber(Version::id())); - if (!$required['PHPUnit_constraint']['constraint']->complies($phpunitVersion)) { - $missing[] = sprintf('PHPUnit version does not match the required constraint %s.', $required['PHPUnit_constraint']['constraint']->asString()); - $hint = $hint ?? 'PHPUnit_constraint'; - } - } - if (!empty($required['OSFAMILY']) && $required['OSFAMILY'] !== (new OperatingSystem())->getFamily()) { - $missing[] = sprintf('Operating system %s is required.', $required['OSFAMILY']); - $hint = $hint ?? 'OSFAMILY'; - } - if (!empty($required['OS'])) { - $requiredOsPattern = sprintf('/%s/i', addcslashes($required['OS'], '/')); - if (!preg_match($requiredOsPattern, PHP_OS)) { - $missing[] = sprintf('Operating system matching %s is required.', $requiredOsPattern); - $hint = $hint ?? 'OS'; - } - } - if (!empty($required['functions'])) { - foreach ($required['functions'] as $function) { - $pieces = explode('::', $function); - if (count($pieces) === 2 && class_exists($pieces[0]) && method_exists($pieces[0], $pieces[1])) { - continue; - } - if (function_exists($function)) { - continue; - } - $missing[] = sprintf('Function %s is required.', $function); - $hint = $hint ?? 'function_' . $function; - } - } - if (!empty($required['setting'])) { - foreach ($required['setting'] as $setting => $value) { - if (ini_get($setting) !== $value) { - $missing[] = sprintf('Setting "%s" must be "%s".', $setting, $value); - $hint = $hint ?? '__SETTING_' . $setting; - } - } - } - if (!empty($required['extensions'])) { - foreach ($required['extensions'] as $extension) { - if (isset($required['extension_versions'][$extension])) { - continue; - } - if (!extension_loaded($extension)) { - $missing[] = sprintf('Extension %s is required.', $extension); - $hint = $hint ?? 'extension_' . $extension; - } - } - } - if (!empty($required['extension_versions'])) { - foreach ($required['extension_versions'] as $extension => $req) { - $actualVersion = phpversion($extension); - $operator = new \PHPUnit\Util\VersionComparisonOperator(empty($req['operator']) ? '>=' : $req['operator']); - if ($actualVersion === \false || !version_compare($actualVersion, $req['version'], $operator->asString())) { - $missing[] = sprintf('Extension %s %s %s is required.', $extension, $operator->asString(), $req['version']); - $hint = $hint ?? 'extension_' . $extension; - } - } - } - if ($hint && isset($required['__OFFSET'])) { - array_unshift($missing, '__OFFSET_FILE=' . $required['__OFFSET']['__FILE']); - array_unshift($missing, '__OFFSET_LINE=' . ($required['__OFFSET'][$hint] ?? 1)); + if (!$this->hasBootstrap()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception('Bootstrap script is not configured'); } - return $missing; + return (string) $this->bootstrap; + } + public function processIsolation(): bool + { + return $this->processIsolation; + } + public function failOnEmptyTestSuite(): bool + { + return $this->failOnEmptyTestSuite; + } + public function failOnIncomplete(): bool + { + return $this->failOnIncomplete; + } + public function failOnRisky(): bool + { + return $this->failOnRisky; + } + public function failOnSkipped(): bool + { + return $this->failOnSkipped; + } + public function failOnWarning(): bool + { + return $this->failOnWarning; + } + public function stopOnDefect(): bool + { + return $this->stopOnDefect; + } + public function stopOnError(): bool + { + return $this->stopOnError; + } + public function stopOnFailure(): bool + { + return $this->stopOnFailure; + } + public function stopOnWarning(): bool + { + return $this->stopOnWarning; + } + public function stopOnIncomplete(): bool + { + return $this->stopOnIncomplete; + } + public function stopOnRisky(): bool + { + return $this->stopOnRisky; + } + public function stopOnSkipped(): bool + { + return $this->stopOnSkipped; } /** - * Returns the provided data for a method. - * - * @throws Exception - * - * @psalm-param class-string $className + * @psalm-assert-if-true !null $this->extensionsDirectory */ - public static function getProvidedData(string $className, string $methodName) : ?array + public function hasExtensionsDirectory(): bool { - return Registry::getInstance()->forMethod($className, $methodName)->getProvidedData(); + return $this->extensionsDirectory !== null; } /** - * @psalm-param class-string $className + * @throws Exception */ - public static function parseTestMethodAnnotations(string $className, ?string $methodName = null) : array + public function extensionsDirectory(): string { - $registry = Registry::getInstance(); - if ($methodName !== null) { - try { - return ['method' => $registry->forMethod($className, $methodName)->symbolAnnotations(), 'class' => $registry->forClassName($className)->symbolAnnotations()]; - } catch (\PHPUnit\Util\Exception $methodNotFound) { - // ignored - } + if (!$this->hasExtensionsDirectory()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception('Extensions directory is not configured'); } - return ['method' => null, 'class' => $registry->forClassName($className)->symbolAnnotations()]; + return (string) $this->extensionsDirectory; } /** - * @psalm-param class-string $className + * @psalm-assert-if-true !null $this->testSuiteLoaderClass + * + * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 */ - public static function getInlineAnnotations(string $className, string $methodName) : array - { - return Registry::getInstance()->forMethod($className, $methodName)->getInlineAnnotations(); - } - /** @psalm-param class-string $className */ - public static function getBackupSettings(string $className, string $methodName) : array + public function hasTestSuiteLoaderClass(): bool { - return ['backupGlobals' => self::getBooleanAnnotationSetting($className, $methodName, 'backupGlobals'), 'backupStaticAttributes' => self::getBooleanAnnotationSetting($className, $methodName, 'backupStaticAttributes')]; + return $this->testSuiteLoaderClass !== null; } /** - * @psalm-param class-string $className + * @throws Exception * - * @return ExecutionOrderDependency[] + * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 */ - public static function getDependencies(string $className, string $methodName) : array + public function testSuiteLoaderClass(): string { - $annotations = self::parseTestMethodAnnotations($className, $methodName); - $dependsAnnotations = $annotations['class']['depends'] ?? []; - if (isset($annotations['method']['depends'])) { - $dependsAnnotations = array_merge($dependsAnnotations, $annotations['method']['depends']); - } - // Normalize dependency name to className::methodName - $dependencies = []; - foreach ($dependsAnnotations as $value) { - $dependencies[] = ExecutionOrderDependency::createFromDependsAnnotation($className, $value); + if (!$this->hasTestSuiteLoaderClass()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception('TestSuiteLoader class is not configured'); } - return array_unique($dependencies); + return (string) $this->testSuiteLoaderClass; } - /** @psalm-param class-string $className */ - public static function getGroups(string $className, ?string $methodName = '') : array + /** + * @psalm-assert-if-true !null $this->testSuiteLoaderFile + * + * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 + */ + public function hasTestSuiteLoaderFile(): bool { - $annotations = self::parseTestMethodAnnotations($className, $methodName); - $groups = []; - if (isset($annotations['method']['author'])) { - $groups[] = $annotations['method']['author']; - } elseif (isset($annotations['class']['author'])) { - $groups[] = $annotations['class']['author']; - } - if (isset($annotations['class']['group'])) { - $groups[] = $annotations['class']['group']; - } - if (isset($annotations['method']['group'])) { - $groups[] = $annotations['method']['group']; - } - if (isset($annotations['class']['ticket'])) { - $groups[] = $annotations['class']['ticket']; - } - if (isset($annotations['method']['ticket'])) { - $groups[] = $annotations['method']['ticket']; - } - foreach (['method', 'class'] as $element) { - foreach (['small', 'medium', 'large'] as $size) { - if (isset($annotations[$element][$size])) { - $groups[] = [$size]; - break 2; - } - } - } - foreach (['method', 'class'] as $element) { - if (isset($annotations[$element]['covers'])) { - foreach ($annotations[$element]['covers'] as $coversTarget) { - $groups[] = ['__phpunit_covers_' . self::canonicalizeName($coversTarget)]; - } - } - if (isset($annotations[$element]['uses'])) { - foreach ($annotations[$element]['uses'] as $usesTarget) { - $groups[] = ['__phpunit_uses_' . self::canonicalizeName($usesTarget)]; - } - } - } - return array_unique(array_merge([], ...$groups)); + return $this->testSuiteLoaderFile !== null; } - /** @psalm-param class-string $className */ - public static function getSize(string $className, ?string $methodName) : int + /** + * @throws Exception + * + * @deprecated see https://github.com/sebastianbergmann/phpunit/issues/4039 + */ + public function testSuiteLoaderFile(): string { - $groups = array_flip(self::getGroups($className, $methodName)); - if (isset($groups['large'])) { - return self::LARGE; + if (!$this->hasTestSuiteLoaderFile()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception('TestSuiteLoader sourcecode file is not configured'); } - if (isset($groups['medium'])) { - return self::MEDIUM; + return (string) $this->testSuiteLoaderFile; + } + /** + * @psalm-assert-if-true !null $this->printerClass + */ + public function hasPrinterClass(): bool + { + return $this->printerClass !== null; + } + /** + * @throws Exception + */ + public function printerClass(): string + { + if (!$this->hasPrinterClass()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception('ResultPrinter class is not configured'); } - if (isset($groups['small'])) { - return self::SMALL; + return (string) $this->printerClass; + } + /** + * @psalm-assert-if-true !null $this->printerFile + */ + public function hasPrinterFile(): bool + { + return $this->printerFile !== null; + } + /** + * @throws Exception + */ + public function printerFile(): string + { + if (!$this->hasPrinterFile()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception('ResultPrinter sourcecode file is not configured'); } - return self::UNKNOWN; + return (string) $this->printerFile; } - /** @psalm-param class-string $className */ - public static function getProcessIsolationSettings(string $className, string $methodName) : bool + public function beStrictAboutChangesToGlobalState(): bool { - $annotations = self::parseTestMethodAnnotations($className, $methodName); - return isset($annotations['class']['runTestsInSeparateProcesses']) || isset($annotations['method']['runInSeparateProcess']); + return $this->beStrictAboutChangesToGlobalState; } - /** @psalm-param class-string $className */ - public static function getClassProcessIsolationSettings(string $className, string $methodName) : bool + public function beStrictAboutOutputDuringTests(): bool { - $annotations = self::parseTestMethodAnnotations($className, $methodName); - return isset($annotations['class']['runClassInSeparateProcess']); + return $this->beStrictAboutOutputDuringTests; } - /** @psalm-param class-string $className */ - public static function getPreserveGlobalStateSettings(string $className, string $methodName) : ?bool + public function beStrictAboutResourceUsageDuringSmallTests(): bool { - return self::getBooleanAnnotationSetting($className, $methodName, 'preserveGlobalState'); + return $this->beStrictAboutResourceUsageDuringSmallTests; } - /** @psalm-param class-string $className */ - public static function getHookMethods(string $className) : array + public function beStrictAboutTestsThatDoNotTestAnything(): bool { - if (!class_exists($className, \false)) { - return self::emptyHookMethodsArray(); - } - if (!isset(self::$hookMethods[$className])) { - self::$hookMethods[$className] = self::emptyHookMethodsArray(); - try { - foreach ((new \PHPUnit\Util\Reflection())->methodsInTestClass(new ReflectionClass($className)) as $method) { - $docBlock = Registry::getInstance()->forMethod($className, $method->getName()); - if ($method->isStatic()) { - if ($docBlock->isHookToBeExecutedBeforeClass()) { - array_unshift(self::$hookMethods[$className]['beforeClass'], $method->getName()); - } - if ($docBlock->isHookToBeExecutedAfterClass()) { - self::$hookMethods[$className]['afterClass'][] = $method->getName(); - } - } - if ($docBlock->isToBeExecutedBeforeTest()) { - array_unshift(self::$hookMethods[$className]['before'], $method->getName()); - } - if ($docBlock->isToBeExecutedAsPreCondition()) { - array_unshift(self::$hookMethods[$className]['preCondition'], $method->getName()); - } - if ($docBlock->isToBeExecutedAsPostCondition()) { - self::$hookMethods[$className]['postCondition'][] = $method->getName(); - } - if ($docBlock->isToBeExecutedAfterTest()) { - self::$hookMethods[$className]['after'][] = $method->getName(); - } - } - } catch (ReflectionException $e) { - } - } - return self::$hookMethods[$className]; + return $this->beStrictAboutTestsThatDoNotTestAnything; } - public static function isTestMethod(ReflectionMethod $method) : bool + public function beStrictAboutTodoAnnotatedTests(): bool { - if (!$method->isPublic()) { - return \false; - } - if (strpos($method->getName(), 'test') === 0) { - return \true; - } - return array_key_exists('test', Registry::getInstance()->forMethod($method->getDeclaringClass()->getName(), $method->getName())->symbolAnnotations()); + return $this->beStrictAboutTodoAnnotatedTests; } - /** - * @throws CodeCoverageException - * - * @psalm-param class-string $className - */ - private static function getLinesToBeCoveredOrUsed(string $className, string $methodName, string $mode) : array + public function beStrictAboutCoversAnnotation(): bool { - $annotations = self::parseTestMethodAnnotations($className, $methodName); - $classShortcut = null; - if (!empty($annotations['class'][$mode . 'DefaultClass'])) { - if (count($annotations['class'][$mode . 'DefaultClass']) > 1) { - throw new CodeCoverageException(sprintf('More than one @%sClass annotation in class or interface "%s".', $mode, $className)); - } - $classShortcut = $annotations['class'][$mode . 'DefaultClass'][0]; - } - $list = $annotations['class'][$mode] ?? []; - if (isset($annotations['method'][$mode])) { - $list = array_merge($list, $annotations['method'][$mode]); - } - $codeUnits = CodeUnitCollection::fromArray([]); - $mapper = new Mapper(); - foreach (array_unique($list) as $element) { - if ($classShortcut && strncmp($element, '::', 2) === 0) { - $element = $classShortcut . $element; - } - $element = preg_replace('/[\\s()]+$/', '', $element); - $element = explode(' ', $element); - $element = $element[0]; - if ($mode === 'covers' && interface_exists($element)) { - throw new InvalidCoversTargetException(sprintf('Trying to @cover interface "%s".', $element)); - } - try { - $codeUnits = $codeUnits->mergeWith($mapper->stringToCodeUnits($element)); - } catch (InvalidCodeUnitException $e) { - throw new InvalidCoversTargetException(sprintf('"@%s %s" is invalid', $mode, $element), $e->getCode(), $e); - } - } - return $mapper->codeUnitsToSourceLines($codeUnits); + return $this->beStrictAboutCoversAnnotation; } - private static function emptyHookMethodsArray() : array + public function enforceTimeLimit(): bool { - return ['beforeClass' => ['setUpBeforeClass'], 'before' => ['setUp'], 'preCondition' => ['assertPreConditions'], 'postCondition' => ['assertPostConditions'], 'after' => ['tearDown'], 'afterClass' => ['tearDownAfterClass']]; + return $this->enforceTimeLimit; } - /** @psalm-param class-string $className */ - private static function getBooleanAnnotationSetting(string $className, ?string $methodName, string $settingName) : ?bool + public function defaultTimeLimit(): int { - $annotations = self::parseTestMethodAnnotations($className, $methodName); - if (isset($annotations['method'][$settingName])) { - if ($annotations['method'][$settingName][0] === 'enabled') { - return \true; - } - if ($annotations['method'][$settingName][0] === 'disabled') { - return \false; - } - } - if (isset($annotations['class'][$settingName])) { - if ($annotations['class'][$settingName][0] === 'enabled') { - return \true; - } - if ($annotations['class'][$settingName][0] === 'disabled') { - return \false; - } - } - return null; + return $this->defaultTimeLimit; } - /** - * Trims any extensions from version string that follows after - * the .[.] format. - */ - private static function sanitizeVersionNumber(string $version) + public function timeoutForSmallTests(): int { - return preg_replace('/^(\\d+\\.\\d+(?:.\\d+)?).*$/', '$1', $version); + return $this->timeoutForSmallTests; } - private static function shouldCoversAnnotationBeUsed(array $annotations) : bool + public function timeoutForMediumTests(): int { - if (isset($annotations['method']['coversNothing'])) { - return \false; - } - if (isset($annotations['method']['covers'])) { - return \true; - } - if (isset($annotations['class']['coversNothing'])) { - return \false; - } - return \true; + return $this->timeoutForMediumTests; + } + public function timeoutForLargeTests(): int + { + return $this->timeoutForLargeTests; } /** - * Merge two arrays together. - * - * If an integer key exists in both arrays and preserveNumericKeys is false, the value - * from the second array will be appended to the first array. If both values are arrays, they - * are merged together, else the value of the second array overwrites the one of the first array. - * - * This implementation is copied from https://github.com/zendframework/zend-stdlib/blob/76b653c5e99b40eccf5966e3122c90615134ae46/src/ArrayUtils.php - * - * Zend Framework (http://framework.zend.com/) - * - * @see http://github.com/zendframework/zf2 for the canonical source repository - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License + * @psalm-assert-if-true !null $this->defaultTestSuite */ - private static function mergeArraysRecursively(array $a, array $b) : array + public function hasDefaultTestSuite(): bool { - foreach ($b as $key => $value) { - if (array_key_exists($key, $a)) { - if (is_int($key)) { - $a[] = $value; - } elseif (is_array($value) && is_array($a[$key])) { - $a[$key] = self::mergeArraysRecursively($a[$key], $value); - } else { - $a[$key] = $value; - } - } else { - $a[$key] = $value; - } + return $this->defaultTestSuite !== null; + } + /** + * @throws Exception + */ + public function defaultTestSuite(): string + { + if (!$this->hasDefaultTestSuite()) { + throw new \PHPUnit\TextUI\XmlConfiguration\Exception('Default test suite is not configured'); } - return $a; + return (string) $this->defaultTestSuite; } - private static function canonicalizeName(string $name) : string + public function executionOrder(): int { - return strtolower(trim($name, '\\')); + return $this->executionOrder; + } + public function resolveDependencies(): bool + { + return $this->resolveDependencies; + } + public function defectsFirst(): bool + { + return $this->defectsFirst; + } + public function backupGlobals(): bool + { + return $this->backupGlobals; + } + public function backupStaticAttributes(): bool + { + return $this->backupStaticAttributes; + } + public function registerMockObjectsFromTestArgumentsRecursively(): bool + { + return $this->registerMockObjectsFromTestArgumentsRecursively; + } + public function conflictBetweenPrinterClassAndTestdox(): bool + { + return $this->conflictBetweenPrinterClassAndTestdox; } } '│', 'start' => '│', 'message' => '│', 'diff' => '│', 'trace' => '│', 'last' => '│']; + private $path; /** - * Colored Testdox use box-drawing for a more textured map of the message. + * @var string */ - private const PREFIX_DECORATED = ['default' => '│', 'start' => '┐', 'message' => '├', 'diff' => '┊', 'trace' => '╵', 'last' => '┴']; - private const SPINNER_ICONS = [" \x1b[36m◐\x1b[0m running tests", " \x1b[36m◓\x1b[0m running tests", " \x1b[36m◑\x1b[0m running tests", " \x1b[36m◒\x1b[0m running tests"]; - private const STATUS_STYLES = [BaseTestRunner::STATUS_PASSED => ['symbol' => '✔', 'color' => 'fg-green'], BaseTestRunner::STATUS_ERROR => ['symbol' => '✘', 'color' => 'fg-yellow', 'message' => 'bg-yellow,fg-black'], BaseTestRunner::STATUS_FAILURE => ['symbol' => '✘', 'color' => 'fg-red', 'message' => 'bg-red,fg-white'], BaseTestRunner::STATUS_SKIPPED => ['symbol' => '↩', 'color' => 'fg-cyan', 'message' => 'fg-cyan'], BaseTestRunner::STATUS_RISKY => ['symbol' => '☢', 'color' => 'fg-yellow', 'message' => 'fg-yellow'], BaseTestRunner::STATUS_INCOMPLETE => ['symbol' => '∅', 'color' => 'fg-yellow', 'message' => 'fg-yellow'], BaseTestRunner::STATUS_WARNING => ['symbol' => '⚠', 'color' => 'fg-yellow', 'message' => 'fg-yellow'], BaseTestRunner::STATUS_UNKNOWN => ['symbol' => '?', 'color' => 'fg-blue', 'message' => 'fg-white,bg-blue']]; + private $prefix; /** - * @var int[] + * @var string */ - private $nonSuccessfulTestResults = []; + private $suffix; /** - * @var Timer + * @var string */ - private $timer; + private $phpVersion; /** - * @param null|resource|string $out - * @param int|string $numberOfColumns - * - * @throws \PHPUnit\Framework\Exception + * @var VersionComparisonOperator */ - public function __construct($out = null, bool $verbose = \false, string $colors = self::COLOR_DEFAULT, bool $debug = \false, $numberOfColumns = 80, bool $reverse = \false) + private $phpVersionOperator; + public function __construct(string $path, string $prefix, string $suffix, string $phpVersion, VersionComparisonOperator $phpVersionOperator) { - parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns, $reverse); - $this->timer = new Timer(); - $this->timer->start(); + $this->path = $path; + $this->prefix = $prefix; + $this->suffix = $suffix; + $this->phpVersion = $phpVersion; + $this->phpVersionOperator = $phpVersionOperator; } - public function printResult(TestResult $result) : void + public function path(): string { - $this->printHeader($result); - $this->printNonSuccessfulTestsSummary($result->count()); - $this->printFooter($result); + return $this->path; } - protected function printHeader(TestResult $result) : void + public function prefix(): string { - $this->write("\n" . (new ResourceUsageFormatter())->resourceUsage($this->timer->stop()) . "\n\n"); + return $this->prefix; } - protected function formatClassName(Test $test) : string + public function suffix(): string { - if ($test instanceof TestCase) { - return $this->prettifier->prettifyTestClass(get_class($test)); - } - return get_class($test); + return $this->suffix; } + public function phpVersion(): string + { + return $this->phpVersion; + } + public function phpVersionOperator(): VersionComparisonOperator + { + return $this->phpVersionOperator; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use function count; +use Countable; +use IteratorAggregate; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + * + * @template-implements IteratorAggregate + */ +final class TestDirectoryCollection implements Countable, IteratorAggregate +{ /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @var TestDirectory[] + */ + private $directories; + /** + * @param TestDirectory[] $directories */ - protected function registerTestResult(Test $test, ?Throwable $t, int $status, float $time, bool $verbose) : void + public static function fromArray(array $directories): self { - if ($status !== BaseTestRunner::STATUS_PASSED) { - $this->nonSuccessfulTestResults[] = $this->testIndex; - } - parent::registerTestResult($test, $t, $status, $time, $verbose); + return new self(...$directories); + } + private function __construct(\PHPUnit\TextUI\XmlConfiguration\TestDirectory ...$directories) + { + $this->directories = $directories; } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @return TestDirectory[] */ - protected function formatTestName(Test $test) : string + public function asArray(): array { - if ($test instanceof TestCase) { - return $this->prettifier->prettifyTestCase($test); - } - return parent::formatTestName($test); + return $this->directories; } - protected function writeTestResult(array $prevResult, array $result) : void + public function count(): int { - // spacer line for new suite headers and after verbose messages - if ($prevResult['testName'] !== '' && (!empty($prevResult['message']) || $prevResult['className'] !== $result['className'])) { - $this->write(PHP_EOL); - } - // suite header - if ($prevResult['className'] !== $result['className']) { - $this->write($this->colorizeTextBox('underlined', $result['className']) . PHP_EOL); - } - // test result line - if ($this->colors && $result['className'] === PhptTestCase::class) { - $testName = Color::colorizePath($result['testName'], $prevResult['testName'], \true); - } else { - $testName = $result['testMethod']; - } - $style = self::STATUS_STYLES[$result['status']]; - $line = sprintf(' %s %s%s' . PHP_EOL, $this->colorizeTextBox($style['color'], $style['symbol']), $testName, $this->verbose ? ' ' . $this->formatRuntime($result['time'], $style['color']) : ''); - $this->write($line); - // additional information when verbose - $this->write($result['message']); + return count($this->directories); } - protected function formatThrowable(Throwable $t, ?int $status = null) : string + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollectionIterator { - return trim(\PHPUnit\Framework\TestFailure::exceptionToString($t)); + return new \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollectionIterator($this); } - protected function colorizeMessageAndDiff(string $style, string $buffer) : array + public function isEmpty(): bool { - $lines = $buffer ? array_map('\\rtrim', explode(PHP_EOL, $buffer)) : []; - $message = []; - $diff = []; - $insideDiff = \false; - foreach ($lines as $line) { - if ($line === '--- Expected') { - $insideDiff = \true; - } - if (!$insideDiff) { - $message[] = $line; - } else { - if (strpos($line, '-') === 0) { - $line = Color::colorize('fg-red', Color::visualizeWhitespace($line, \true)); - } elseif (strpos($line, '+') === 0) { - $line = Color::colorize('fg-green', Color::visualizeWhitespace($line, \true)); - } elseif ($line === '@@ @@') { - $line = Color::colorize('fg-cyan', $line); - } - $diff[] = $line; - } - } - $diff = implode(PHP_EOL, $diff); - if (!empty($message)) { - $message = $this->colorizeTextBox($style, implode(PHP_EOL, $message)); - } - return [$message, $diff]; + return $this->count() === 0; } - protected function formatStacktrace(Throwable $t) : string +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use function count; +use function iterator_count; +use Countable; +use Iterator; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @template-implements Iterator + */ +final class TestDirectoryCollectionIterator implements Countable, Iterator +{ + /** + * @var TestDirectory[] + */ + private $directories; + /** + * @var int + */ + private $position; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollection $directories) { - $trace = \PHPUnit\Util\Filter::getFilteredStacktrace($t); - if (!$this->colors) { - return $trace; - } - $lines = []; - $prevPath = ''; - foreach (explode(PHP_EOL, $trace) as $line) { - if (preg_match('/^(.*):(\\d+)$/', $line, $matches)) { - $lines[] = Color::colorizePath($matches[1], $prevPath) . Color::dim(':') . Color::colorize('fg-blue', $matches[2]) . "\n"; - $prevPath = $matches[1]; - } else { - $lines[] = $line; - $prevPath = ''; - } - } - return implode('', $lines); + $this->directories = $directories->asArray(); } - protected function formatTestResultMessage(Throwable $t, array $result, ?string $prefix = null) : string + public function count(): int { - $message = $this->formatThrowable($t, $result['status']); - $diff = ''; - if (!($this->verbose || $result['verbose'])) { - return ''; - } - if ($message && $this->colors) { - $style = self::STATUS_STYLES[$result['status']]['message'] ?? ''; - [$message, $diff] = $this->colorizeMessageAndDiff($style, $message); - } - if ($prefix === null || !$this->colors) { - $prefix = self::PREFIX_SIMPLE; - } - if ($this->colors) { - $color = self::STATUS_STYLES[$result['status']]['color'] ?? ''; - $prefix = array_map(static function ($p) use($color) { - return Color::colorize($color, $p); - }, self::PREFIX_DECORATED); - } - $trace = $this->formatStacktrace($t); - $out = $this->prefixLines($prefix['start'], PHP_EOL) . PHP_EOL; - if ($message) { - $out .= $this->prefixLines($prefix['message'], $message . PHP_EOL) . PHP_EOL; - } - if ($diff) { - $out .= $this->prefixLines($prefix['diff'], $diff . PHP_EOL) . PHP_EOL; - } - if ($trace) { - if ($message || $diff) { - $out .= $this->prefixLines($prefix['default'], PHP_EOL) . PHP_EOL; - } - $out .= $this->prefixLines($prefix['trace'], $trace . PHP_EOL) . PHP_EOL; - } - $out .= $this->prefixLines($prefix['last'], PHP_EOL) . PHP_EOL; - return $out; + return iterator_count($this); } - protected function drawSpinner() : void + public function rewind(): void { - if ($this->colors) { - $id = $this->spinState % count(self::SPINNER_ICONS); - $this->write(self::SPINNER_ICONS[$id]); - } + $this->position = 0; } - protected function undrawSpinner() : void + public function valid(): bool { - if ($this->colors) { - $id = $this->spinState % count(self::SPINNER_ICONS); - $this->write("\x1b[1K\x1b[" . strlen(self::SPINNER_ICONS[$id]) . 'D'); - } + return $this->position < count($this->directories); } - private function formatRuntime(float $time, string $color = '') : string + public function key(): int { - if (!$this->colors) { - return sprintf('[%.2f ms]', $time * 1000); - } - if ($time > 1) { - $color = 'fg-magenta'; - } - return Color::colorize($color, ' ' . (int) ceil($time * 1000) . ' ' . Color::dim('ms')); + return $this->position; } - private function printNonSuccessfulTestsSummary(int $numberOfExecutedTests) : void + public function current(): \PHPUnit\TextUI\XmlConfiguration\TestDirectory { - if (empty($this->nonSuccessfulTestResults)) { - return; - } - if (count($this->nonSuccessfulTestResults) / $numberOfExecutedTests >= 0.7) { - return; - } - $this->write("Summary of non-successful tests:\n\n"); - $prevResult = $this->getEmptyTestResult(); - foreach ($this->nonSuccessfulTestResults as $testIndex) { - $result = $this->testResults[$testIndex]; - $this->writeTestResult($prevResult, $result); - $prevResult = $result; - } + return $this->directories[$this->position]; + } + public function next(): void + { + $this->position++; } } - - - - Test Documentation - - - -EOT; + private $path; /** * @var string */ - private const CLASS_HEADER = <<<'EOT' + private $phpVersion; + /** + * @var VersionComparisonOperator + */ + private $phpVersionOperator; + public function __construct(string $path, string $phpVersion, VersionComparisonOperator $phpVersionOperator) + { + $this->path = $path; + $this->phpVersion = $phpVersion; + $this->phpVersionOperator = $phpVersionOperator; + } + public function path(): string + { + return $this->path; + } + public function phpVersion(): string + { + return $this->phpVersion; + } + public function phpVersionOperator(): VersionComparisonOperator + { + return $this->phpVersionOperator; + } +} +%s -
    +declare (strict_types=1); +/* + * This file is part of PHPUnit. + * + * (c) Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; -EOT; +use function count; +use Countable; +use IteratorAggregate; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + * + * @template-implements IteratorAggregate + */ +final class TestFileCollection implements Countable, IteratorAggregate +{ /** - * @var string + * @var TestFile[] */ - private const CLASS_FOOTER = <<<'EOT' -
-EOT; + private $files; /** - * @var string + * @param TestFile[] $files */ - private const PAGE_FOOTER = <<<'EOT' - - - -EOT; - public function printResult(TestResult $result) : void + public static function fromArray(array $files): self { + return new self(...$files); } - /** - * Handler for 'start run' event. - */ - protected function startRun() : void + private function __construct(\PHPUnit\TextUI\XmlConfiguration\TestFile ...$files) { - $this->write(self::PAGE_HEADER); + $this->files = $files; } /** - * Handler for 'start class' event. + * @return TestFile[] */ - protected function startClass(string $name) : void + public function asArray(): array { - $this->write(sprintf(self::CLASS_HEADER, $this->currentTestClassPrettified)); + return $this->files; } - /** - * Handler for 'on test' event. - */ - protected function onTest(string $name, bool $success = \true) : void + public function count(): int { - $this->write(sprintf("
  • %s
  • \n", $success ? 'success' : 'defect', $name)); + return count($this->files); } - /** - * Handler for 'end class' event. - */ - protected function endClass(string $name) : void + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\TestFileCollectionIterator { - $this->write(self::CLASS_FOOTER); + return new \PHPUnit\TextUI\XmlConfiguration\TestFileCollectionIterator($this); } - /** - * Handler for 'end run' event. - */ - protected function endRun() : void + public function isEmpty(): bool { - $this->write(self::PAGE_FOOTER); + return $this->count() === 0; } } */ -final class NamePrettifier +final class TestFileCollectionIterator implements Countable, Iterator { /** - * @var string[] + * @var TestFile[] */ - private $strings = []; + private $files; /** - * @var bool + * @var int */ - private $useColor; - public function __construct(bool $useColor = \false) + private $position; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\TestFileCollection $files) { - $this->useColor = $useColor; + $this->files = $files->asArray(); } - /** - * Prettifies the name of a test class. - * - * @psalm-param class-string $className - */ - public function prettifyTestClass(string $className) : string + public function count(): int { - try { - $annotations = Test::parseTestMethodAnnotations($className); - if (isset($annotations['class']['testdox'][0])) { - return $annotations['class']['testdox'][0]; - } - } catch (UtilException $e) { - // ignore, determine className by parsing the provided name - } - $parts = explode('\\', $className); - $className = array_pop($parts); - if (substr($className, -1 * strlen('Test')) === 'Test') { - $className = substr($className, 0, strlen($className) - strlen('Test')); - } - if (strpos($className, 'Tests') === 0) { - $className = substr($className, strlen('Tests')); - } elseif (strpos($className, 'Test') === 0) { - $className = substr($className, strlen('Test')); - } - if (empty($className)) { - $className = 'UnnamedTests'; - } - if (!empty($parts)) { - $parts[] = $className; - $fullyQualifiedName = implode('\\', $parts); - } else { - $fullyQualifiedName = $className; - } - $result = preg_replace('/(?<=[[:lower:]])(?=[[:upper:]])/u', ' ', $className); - if ($fullyQualifiedName !== $className) { - return $result . ' (' . $fullyQualifiedName . ')'; - } - return $result; + return iterator_count($this); } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function prettifyTestCase(TestCase $test) : string + public function rewind(): void { - $annotations = Test::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); - $annotationWithPlaceholders = \false; - $callback = static function (string $variable) : string { - return sprintf('/%s(?=\\b)/', preg_quote($variable, '/')); - }; - if (isset($annotations['method']['testdox'][0])) { - $result = $annotations['method']['testdox'][0]; - if (strpos($result, '$') !== \false) { - $annotation = $annotations['method']['testdox'][0]; - $providedData = $this->mapTestMethodParameterNamesToProvidedDataValues($test); - $variables = array_map($callback, array_keys($providedData)); - $result = trim(preg_replace($variables, $providedData, $annotation)); - $annotationWithPlaceholders = \true; - } - } else { - $result = $this->prettifyTestMethod($test->getName(\false)); - } - if (!$annotationWithPlaceholders && $test->usesDataProvider()) { - $result .= $this->prettifyDataSet($test); - } - return $result; + $this->position = 0; } - public function prettifyDataSet(TestCase $test) : string + public function valid(): bool { - if (!$this->useColor) { - return $test->getDataSetAsString(\false); - } - if (is_int($test->dataName())) { - $data = Color::dim(' with data set ') . Color::colorize('fg-cyan', (string) $test->dataName()); - } else { - $data = Color::dim(' with ') . Color::colorize('fg-cyan', Color::visualizeWhitespace((string) $test->dataName())); - } - return $data; + return $this->position < count($this->files); } - /** - * Prettifies the name of a test method. - */ - public function prettifyTestMethod(string $name) : string + public function key(): int { - $buffer = ''; - if ($name === '') { - return $buffer; - } - $string = (string) preg_replace('#\\d+$#', '', $name, -1, $count); - if (in_array($string, $this->strings, \true)) { - $name = $string; - } elseif ($count === 0) { - $this->strings[] = $string; - } - if (strpos($name, 'test_') === 0) { - $name = substr($name, 5); - } elseif (strpos($name, 'test') === 0) { - $name = substr($name, 4); - } - if ($name === '') { - return $buffer; - } - $name[0] = strtoupper($name[0]); - if (strpos($name, '_') !== \false) { - return trim(str_replace('_', ' ', $name)); - } - $wasNumeric = \false; - foreach (range(0, strlen($name) - 1) as $i) { - if ($i > 0 && ord($name[$i]) >= 65 && ord($name[$i]) <= 90) { - $buffer .= ' ' . strtolower($name[$i]); - } else { - $isNumeric = is_numeric($name[$i]); - if (!$wasNumeric && $isNumeric) { - $buffer .= ' '; - $wasNumeric = \true; - } - if ($wasNumeric && !$isNumeric) { - $wasNumeric = \false; - } - $buffer .= $name[$i]; - } - } - return $buffer; + return $this->position; } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - private function mapTestMethodParameterNamesToProvidedDataValues(TestCase $test) : array + public function current(): \PHPUnit\TextUI\XmlConfiguration\TestFile { - try { - $reflector = new ReflectionMethod(get_class($test), $test->getName(\false)); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new UtilException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - $providedData = []; - $providedDataValues = array_values($test->getProvidedData()); - $i = 0; - $providedData['$_dataName'] = $test->dataName(); - foreach ($reflector->getParameters() as $parameter) { - if (!array_key_exists($i, $providedDataValues) && $parameter->isDefaultValueAvailable()) { - try { - $providedDataValues[$i] = $parameter->getDefaultValue(); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new UtilException($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - } - $value = $providedDataValues[$i++] ?? null; - if (is_object($value)) { - $reflector = new ReflectionObject($value); - if ($reflector->hasMethod('__toString')) { - $value = (string) $value; - } else { - $value = get_class($value); - } - } - if (!is_scalar($value)) { - $value = gettype($value); - } - if (is_bool($value) || is_int($value) || is_float($value)) { - $value = (new Exporter())->export($value); - } - if (is_string($value) && $value === '') { - if ($this->useColor) { - $value = Color::colorize('dim,underlined', 'empty'); - } else { - $value = "''"; - } - } - $providedData['$' . $parameter->getName()] = $value; - } - if ($this->useColor) { - $providedData = array_map(static function ($value) { - return Color::colorize('fg-cyan', Color::visualizeWhitespace((string) $value, \true)); - }, $providedData); - } - return $providedData; + return $this->files[$this->position]; + } + public function next(): void + { + $this->position++; } } groups = $groups; - $this->excludeGroups = $excludeGroups; - $this->prettifier = new \PHPUnit\Util\TestDox\NamePrettifier(); - $this->startRun(); - } - /** - * Flush buffer and close output. - */ - public function flush() : void + private $exclude; + public function __construct(string $name, \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollection $directories, \PHPUnit\TextUI\XmlConfiguration\TestFileCollection $files, \PHPUnit\TextUI\XmlConfiguration\FileCollection $exclude) { - $this->doEndClass(); - $this->endRun(); - parent::flush(); + $this->name = $name; + $this->directories = $directories; + $this->files = $files; + $this->exclude = $exclude; } - /** - * An error occurred. - */ - public function addError(Test $test, Throwable $t, float $time) : void + public function name(): string { - if (!$this->isOfInterest($test)) { - return; - } - $this->testStatus = BaseTestRunner::STATUS_ERROR; - $this->failed++; + return $this->name; } - /** - * A warning occurred. - */ - public function addWarning(Test $test, Warning $e, float $time) : void + public function directories(): \PHPUnit\TextUI\XmlConfiguration\TestDirectoryCollection { - if (!$this->isOfInterest($test)) { - return; - } - $this->testStatus = BaseTestRunner::STATUS_WARNING; - $this->warned++; + return $this->directories; } - /** - * A failure occurred. - */ - public function addFailure(Test $test, AssertionFailedError $e, float $time) : void + public function files(): \PHPUnit\TextUI\XmlConfiguration\TestFileCollection { - if (!$this->isOfInterest($test)) { - return; - } - $this->testStatus = BaseTestRunner::STATUS_FAILURE; - $this->failed++; + return $this->files; } - /** - * Incomplete test. - */ - public function addIncompleteTest(Test $test, Throwable $t, float $time) : void + public function exclude(): \PHPUnit\TextUI\XmlConfiguration\FileCollection { - if (!$this->isOfInterest($test)) { - return; - } - $this->testStatus = BaseTestRunner::STATUS_INCOMPLETE; - $this->incomplete++; + return $this->exclude; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use function count; +use Countable; +use IteratorAggregate; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + * + * @template-implements IteratorAggregate + */ +final class TestSuiteCollection implements Countable, IteratorAggregate +{ /** - * Risky test. + * @var TestSuite[] */ - public function addRiskyTest(Test $test, Throwable $t, float $time) : void - { - if (!$this->isOfInterest($test)) { - return; - } - $this->testStatus = BaseTestRunner::STATUS_RISKY; - $this->risky++; - } + private $testSuites; /** - * Skipped test. + * @param TestSuite[] $testSuites */ - public function addSkippedTest(Test $test, Throwable $t, float $time) : void + public static function fromArray(array $testSuites): self { - if (!$this->isOfInterest($test)) { - return; - } - $this->testStatus = BaseTestRunner::STATUS_SKIPPED; - $this->skipped++; + return new self(...$testSuites); } - /** - * A testsuite started. - */ - public function startTestSuite(TestSuite $suite) : void + private function __construct(\PHPUnit\TextUI\XmlConfiguration\TestSuite ...$testSuites) { + $this->testSuites = $testSuites; } /** - * A testsuite ended. + * @return TestSuite[] */ - public function endTestSuite(TestSuite $suite) : void + public function asArray(): array { + return $this->testSuites; } - /** - * A test started. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function startTest(Test $test) : void + public function count(): int { - if (!$this->isOfInterest($test)) { - return; - } - $class = get_class($test); - if ($this->testClass !== $class) { - if ($this->testClass !== '') { - $this->doEndClass(); - } - $this->currentTestClassPrettified = $this->prettifier->prettifyTestClass($class); - $this->testClass = $class; - $this->tests = []; - $this->startClass($class); - } - if ($test instanceof TestCase) { - $this->currentTestMethodPrettified = $this->prettifier->prettifyTestCase($test); - } - $this->testStatus = BaseTestRunner::STATUS_PASSED; + return count($this->testSuites); } - /** - * A test ended. - */ - public function endTest(Test $test, float $time) : void + public function getIterator(): \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollectionIterator { - if (!$this->isOfInterest($test)) { - return; - } - $this->tests[] = [$this->currentTestMethodPrettified, $this->testStatus]; - $this->currentTestClassPrettified = null; - $this->currentTestMethodPrettified = null; + return new \PHPUnit\TextUI\XmlConfiguration\TestSuiteCollectionIterator($this); } - protected function doEndClass() : void + public function isEmpty(): bool { - foreach ($this->tests as $test) { - $this->onTest($test[0], $test[1] === BaseTestRunner::STATUS_PASSED); - } - $this->endClass($this->testClass); + return $this->count() === 0; } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI\XmlConfiguration; + +use function count; +use function iterator_count; +use Countable; +use Iterator; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @template-implements Iterator + */ +final class TestSuiteCollectionIterator implements Countable, Iterator +{ /** - * Handler for 'start run' event. + * @var TestSuite[] */ - protected function startRun() : void - { - } + private $testSuites; /** - * Handler for 'start class' event. + * @var int */ - protected function startClass(string $name) : void + private $position; + public function __construct(\PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection $testSuites) { + $this->testSuites = $testSuites->asArray(); } - /** - * Handler for 'on test' event. - */ - protected function onTest(string $name, bool $success = \true) : void + public function count(): int { + return iterator_count($this); } - /** - * Handler for 'end class' event. - */ - protected function endClass(string $name) : void + public function rewind(): void { + $this->position = 0; } - /** - * Handler for 'end run' event. - */ - protected function endRun() : void + public function valid(): bool { + return $this->position < count($this->testSuites); } - private function isOfInterest(Test $test) : bool + public function key(): int { - if (!$test instanceof TestCase) { - return \false; - } - if ($test instanceof ErrorTestCase || $test instanceof WarningTestCase) { - return \false; - } - if (!empty($this->groups)) { - foreach ($test->getGroups() as $group) { - if (in_array($group, $this->groups, \true)) { - return \true; - } - } - return \false; - } - if (!empty($this->excludeGroups)) { - foreach ($test->getGroups() as $group) { - if (in_array($group, $this->excludeGroups, \true)) { - return \false; - } - } - return \true; - } - return \true; + return $this->position; + } + public function current(): \PHPUnit\TextUI\XmlConfiguration\TestSuite + { + return $this->testSuites[$this->position]; + } + public function next(): void + { + $this->position++; } } Buffer for test results - */ - protected $testResults = []; - /** - * @var array Lookup table for testname to testResults[index] - */ - protected $testNameResultIndex = []; - /** - * @var bool - */ - protected $enableOutputBuffer = \false; - /** - * @var array array - */ - protected $originalExecutionOrder = []; - /** - * @var int + * @todo This constant should be private (it's public because of TestTest::testGetProvidedDataRegEx) */ - protected $spinState = 0; + public const REGEX_DATA_PROVIDER = '/@dataProvider\s+([a-zA-Z0-9._:-\\\\x7f-\xff]+)/'; + private const REGEX_REQUIRES_VERSION = '/@requires\s+(?PPHP(?:Unit)?)\s+(?P[<>=!]{0,2})\s*(?P[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m'; + private const REGEX_REQUIRES_VERSION_CONSTRAINT = '/@requires\s+(?PPHP(?:Unit)?)\s+(?P[\d\t \-.|~^]+)[ \t]*\r?$/m'; + private const REGEX_REQUIRES_OS = '/@requires\s+(?POS(?:FAMILY)?)\s+(?P.+?)[ \t]*\r?$/m'; + private const REGEX_REQUIRES_SETTING = '/@requires\s+(?Psetting)\s+(?P([^ ]+?))\s*(?P[\w\.-]+[\w\.]?)?[ \t]*\r?$/m'; + private const REGEX_REQUIRES = '/@requires\s+(?Pfunction|extension)\s+(?P([^\s<>=!]+))\s*(?P[<>=!]{0,2})\s*(?P[\d\.-]+[\d\.]?)?[ \t]*\r?$/m'; + private const REGEX_TEST_WITH = '/@testWith\s+/'; + /** @var string */ + private $docComment; + /** @var bool */ + private $isMethod; + /** @var array> pre-parsed annotations indexed by name and occurrence index */ + private $symbolAnnotations; /** - * @var bool + * @var null|array + * + * @psalm-var null|(array{ + * __OFFSET: array&array{__FILE: string}, + * setting?: array, + * extension_versions?: array + * }&array< + * string, + * string|array{version: string, operator: string}|array{constraint: string}|array + * >) */ - protected $showProgress = \true; + private $parsedRequirements; + /** @var int */ + private $startLine; + /** @var int */ + private $endLine; + /** @var string */ + private $fileName; + /** @var string */ + private $name; /** - * @param null|resource|string $out - * @param int|string $numberOfColumns + * @var string * - * @throws \PHPUnit\Framework\Exception + * @psalm-var class-string */ - public function __construct($out = null, bool $verbose = \false, string $colors = self::COLOR_DEFAULT, bool $debug = \false, $numberOfColumns = 80, bool $reverse = \false) + private $className; + public static function ofClass(ReflectionClass $class): self { - parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns, $reverse); - $this->prettifier = new \PHPUnit\Util\TestDox\NamePrettifier($this->colors); + $className = $class->getName(); + return new self((string) $class->getDocComment(), \false, self::extractAnnotationsFromReflector($class), $class->getStartLine(), $class->getEndLine(), $class->getFileName(), $className, $className); } - public function setOriginalExecutionOrder(array $order) : void + /** + * @psalm-param class-string $classNameInHierarchy + */ + public static function ofMethod(ReflectionMethod $method, string $classNameInHierarchy): self { - $this->originalExecutionOrder = $order; - $this->enableOutputBuffer = !empty($order); + return new self((string) $method->getDocComment(), \true, self::extractAnnotationsFromReflector($method), $method->getStartLine(), $method->getEndLine(), $method->getFileName(), $method->getName(), $classNameInHierarchy); } - public function setShowProgressAnimation(bool $showProgress) : void + /** + * Note: we do not preserve an instance of the reflection object, since it cannot be safely (de-)serialized. + * + * @param array> $symbolAnnotations + * + * @psalm-param class-string $className + */ + private function __construct(string $docComment, bool $isMethod, array $symbolAnnotations, int $startLine, int $endLine, string $fileName, string $name, string $className) { - $this->showProgress = $showProgress; + $this->docComment = $docComment; + $this->isMethod = $isMethod; + $this->symbolAnnotations = $symbolAnnotations; + $this->startLine = $startLine; + $this->endLine = $endLine; + $this->fileName = $fileName; + $this->name = $name; + $this->className = $className; } - public function printResult(TestResult $result) : void + /** + * @psalm-return array{ + * __OFFSET: array&array{__FILE: string}, + * setting?: array, + * extension_versions?: array + * }&array< + * string, + * string|array{version: string, operator: string}|array{constraint: string}|array + * > + * + * @throws Warning if the requirements version constraint is not well-formed + */ + public function requirements(): array { + if ($this->parsedRequirements !== null) { + return $this->parsedRequirements; + } + $offset = $this->startLine; + $requires = []; + $recordedSettings = []; + $extensionVersions = []; + $recordedOffsets = ['__FILE' => realpath($this->fileName)]; + // Trim docblock markers, split it into lines and rewind offset to start of docblock + $lines = preg_replace(['#^/\*{2}#', '#\*/$#'], '', preg_split('/\r\n|\r|\n/', $this->docComment)); + $offset -= count($lines); + foreach ($lines as $line) { + if (preg_match(self::REGEX_REQUIRES_OS, $line, $matches)) { + $requires[$matches['name']] = $matches['value']; + $recordedOffsets[$matches['name']] = $offset; + } + if (preg_match(self::REGEX_REQUIRES_VERSION, $line, $matches)) { + $requires[$matches['name']] = ['version' => $matches['version'], 'operator' => $matches['operator']]; + $recordedOffsets[$matches['name']] = $offset; + } + if (preg_match(self::REGEX_REQUIRES_VERSION_CONSTRAINT, $line, $matches)) { + if (!empty($requires[$matches['name']])) { + $offset++; + continue; + } + try { + $versionConstraintParser = new VersionConstraintParser(); + $requires[$matches['name'] . '_constraint'] = ['constraint' => $versionConstraintParser->parse(trim($matches['constraint']))]; + $recordedOffsets[$matches['name'] . '_constraint'] = $offset; + } catch (\PHPUnitPHAR\PharIo\Version\Exception $e) { + throw new Warning($e->getMessage(), $e->getCode(), $e); + } + } + if (preg_match(self::REGEX_REQUIRES_SETTING, $line, $matches)) { + $recordedSettings[$matches['setting']] = $matches['value']; + $recordedOffsets['__SETTING_' . $matches['setting']] = $offset; + } + if (preg_match(self::REGEX_REQUIRES, $line, $matches)) { + $name = $matches['name'] . 's'; + if (!isset($requires[$name])) { + $requires[$name] = []; + } + $requires[$name][] = $matches['value']; + $recordedOffsets[$matches['name'] . '_' . $matches['value']] = $offset; + if ($name === 'extensions' && !empty($matches['version'])) { + $extensionVersions[$matches['value']] = ['version' => $matches['version'], 'operator' => $matches['operator']]; + } + } + $offset++; + } + return $this->parsedRequirements = array_merge($requires, ['__OFFSET' => $recordedOffsets], array_filter(['setting' => $recordedSettings, 'extension_versions' => $extensionVersions])); } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * Returns the provided data for a method. + * + * @throws Exception */ - public function endTest(Test $test, float $time) : void + public function getProvidedData(): ?array { - if (!$test instanceof TestCase && !$test instanceof PhptTestCase && !$test instanceof TestSuite) { - return; + /** @noinspection SuspiciousBinaryOperationInspection */ + $data = $this->getDataFromDataProviderAnnotation($this->docComment) ?? $this->getDataFromTestWithAnnotation($this->docComment); + if ($data === null) { + return null; } - if ($this->testHasPassed()) { - $this->registerTestResult($test, null, BaseTestRunner::STATUS_PASSED, $time, \false); + if ($data === []) { + throw new SkippedTestError(); } - if ($test instanceof TestCase || $test instanceof PhptTestCase) { - $this->testIndex++; + foreach ($data as $key => $value) { + if (!is_array($value)) { + throw new InvalidDataSetException(sprintf('Data set %s is invalid.', is_int($key) ? '#' . $key : ('"' . $key . '"'))); + } } - parent::endTest($test, $time); + return $data; } /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @psalm-return array */ - public function addError(Test $test, Throwable $t, float $time) : void + public function getInlineAnnotations(): array { - $this->registerTestResult($test, $t, BaseTestRunner::STATUS_ERROR, $time, \true); + $code = file($this->fileName); + $lineNumber = $this->startLine; + $startLine = $this->startLine - 1; + $endLine = $this->endLine - 1; + $codeLines = array_slice($code, $startLine, $endLine - $startLine + 1); + $annotations = []; + foreach ($codeLines as $line) { + if (preg_match('#/\*\*?\s*@(?P[A-Za-z_-]+)(?:[ \t]+(?P.*?))?[ \t]*\r?\*/$#m', $line, $matches)) { + $annotations[strtolower($matches['name'])] = ['line' => $lineNumber, 'value' => $matches['value']]; + } + $lineNumber++; + } + return $annotations; } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function addWarning(Test $test, Warning $e, float $time) : void + public function symbolAnnotations(): array { - $this->registerTestResult($test, $e, BaseTestRunner::STATUS_WARNING, $time, \true); + return $this->symbolAnnotations; } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function addFailure(Test $test, AssertionFailedError $e, float $time) : void + public function isHookToBeExecutedBeforeClass(): bool { - $this->registerTestResult($test, $e, BaseTestRunner::STATUS_FAILURE, $time, \true); + return $this->isMethod && \false !== strpos($this->docComment, '@beforeClass'); } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function addIncompleteTest(Test $test, Throwable $t, float $time) : void + public function isHookToBeExecutedAfterClass(): bool { - $this->registerTestResult($test, $t, BaseTestRunner::STATUS_INCOMPLETE, $time, \false); + return $this->isMethod && \false !== strpos($this->docComment, '@afterClass'); } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function addRiskyTest(Test $test, Throwable $t, float $time) : void + public function isToBeExecutedBeforeTest(): bool { - $this->registerTestResult($test, $t, BaseTestRunner::STATUS_RISKY, $time, \false); + return 1 === preg_match('/@before\b/', $this->docComment); } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - public function addSkippedTest(Test $test, Throwable $t, float $time) : void + public function isToBeExecutedAfterTest(): bool { - $this->registerTestResult($test, $t, BaseTestRunner::STATUS_SKIPPED, $time, \false); + return 1 === preg_match('/@after\b/', $this->docComment); } - public function writeProgress(string $progress) : void + public function isToBeExecutedAsPreCondition(): bool { - $this->flushOutputBuffer(); + return 1 === preg_match('/@preCondition\b/', $this->docComment); } - public function flush() : void + public function isToBeExecutedAsPostCondition(): bool { - $this->flushOutputBuffer(\true); + return 1 === preg_match('/@postCondition\b/', $this->docComment); } - /** - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException - */ - protected function registerTestResult(Test $test, ?Throwable $t, int $status, float $time, bool $verbose) : void + private function getDataFromDataProviderAnnotation(string $docComment): ?array { - $testName = $test instanceof Reorderable ? $test->sortId() : $test->getName(); - $result = ['className' => $this->formatClassName($test), 'testName' => $testName, 'testMethod' => $this->formatTestName($test), 'message' => '', 'status' => $status, 'time' => $time, 'verbose' => $verbose]; - if ($t !== null) { - $result['message'] = $this->formatTestResultMessage($t, $result); - } - $this->testResults[$this->testIndex] = $result; - $this->testNameResultIndex[$testName] = $this->testIndex; - } - protected function formatTestName(Test $test) : string - { - return method_exists($test, 'getName') ? $test->getName() : ''; - } - protected function formatClassName(Test $test) : string - { - return get_class($test); - } - protected function testHasPassed() : bool - { - if (!isset($this->testResults[$this->testIndex]['status'])) { - return \true; - } - if ($this->testResults[$this->testIndex]['status'] === BaseTestRunner::STATUS_PASSED) { - return \true; + $methodName = null; + $className = $this->className; + if ($this->isMethod) { + $methodName = $this->name; } - return \false; - } - protected function flushOutputBuffer(bool $forceFlush = \false) : void - { - if ($this->testFlushIndex === $this->testIndex) { - return; + if (!preg_match_all(self::REGEX_DATA_PROVIDER, $docComment, $matches)) { + return null; } - if ($this->testFlushIndex > 0) { - if ($this->enableOutputBuffer && isset($this->originalExecutionOrder[$this->testFlushIndex - 1])) { - $prevResult = $this->getTestResultByName($this->originalExecutionOrder[$this->testFlushIndex - 1]); + $result = []; + foreach ($matches[1] as $match) { + $dataProviderMethodNameNamespace = explode('\\', $match); + $leaf = explode('::', array_pop($dataProviderMethodNameNamespace)); + $dataProviderMethodName = array_pop($leaf); + if (empty($dataProviderMethodNameNamespace)) { + $dataProviderMethodNameNamespace = ''; } else { - $prevResult = $this->testResults[$this->testFlushIndex - 1]; + $dataProviderMethodNameNamespace = implode('\\', $dataProviderMethodNameNamespace) . '\\'; } - } else { - $prevResult = $this->getEmptyTestResult(); - } - if (!$this->enableOutputBuffer) { - $this->writeTestResult($prevResult, $this->testResults[$this->testFlushIndex++]); - } else { - do { - $flushed = \false; - if (!$forceFlush && isset($this->originalExecutionOrder[$this->testFlushIndex])) { - $result = $this->getTestResultByName($this->originalExecutionOrder[$this->testFlushIndex]); - } else { - // This test(name) cannot found in original execution order, - // flush result to output stream right away - $result = $this->testResults[$this->testFlushIndex]; - } - if (!empty($result)) { - $this->hideSpinner(); - $this->writeTestResult($prevResult, $result); - $this->testFlushIndex++; - $prevResult = $result; - $flushed = \true; - } else { - $this->showSpinner(); + if (empty($leaf)) { + $dataProviderClassName = $className; + } else { + /** @psalm-var class-string $dataProviderClassName */ + $dataProviderClassName = $dataProviderMethodNameNamespace . array_pop($leaf); + } + try { + $dataProviderClass = new ReflectionClass($dataProviderClassName); + $dataProviderMethod = $dataProviderClass->getMethod($dataProviderMethodName); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + // @codeCoverageIgnoreEnd + } + if ($dataProviderMethod->isStatic()) { + $object = null; + } else { + $object = $dataProviderClass->newInstance(); + } + if ($dataProviderMethod->getNumberOfParameters() === 0) { + $data = $dataProviderMethod->invoke($object); + } else { + $data = $dataProviderMethod->invoke($object, $methodName); + } + if ($data instanceof Traversable) { + $origData = $data; + $data = []; + foreach ($origData as $key => $value) { + if (is_int($key)) { + $data[] = $value; + } elseif (array_key_exists($key, $data)) { + throw new InvalidDataProviderException(sprintf('The key "%s" has already been defined in the data provider "%s".', $key, $match)); + } else { + $data[$key] = $value; + } } - } while ($flushed && $this->testFlushIndex < $this->testIndex); + } + if (is_array($data)) { + $result = array_merge($result, $data); + } } + return $result; } - protected function showSpinner() : void + /** + * @throws Exception + */ + private function getDataFromTestWithAnnotation(string $docComment): ?array { - if (!$this->showProgress) { - return; - } - if ($this->spinState) { - $this->undrawSpinner(); + $docComment = $this->cleanUpMultiLineAnnotation($docComment); + if (!preg_match(self::REGEX_TEST_WITH, $docComment, $matches, PREG_OFFSET_CAPTURE)) { + return null; } - $this->spinState++; - $this->drawSpinner(); - } - protected function hideSpinner() : void - { - if (!$this->showProgress) { - return; + $offset = strlen($matches[0][0]) + $matches[0][1]; + $annotationContent = substr($docComment, $offset); + $data = []; + foreach (explode("\n", $annotationContent) as $candidateRow) { + $candidateRow = trim($candidateRow); + if ($candidateRow[0] !== '[') { + break; + } + $dataSet = json_decode($candidateRow, \true); + if (json_last_error() !== JSON_ERROR_NONE) { + throw new Exception('The data set for the @testWith annotation cannot be parsed: ' . json_last_error_msg()); + } + $data[] = $dataSet; } - if ($this->spinState) { - $this->undrawSpinner(); + if (!$data) { + throw new Exception('The data set for the @testWith annotation cannot be parsed.'); } - $this->spinState = 0; - } - protected function drawSpinner() : void - { - // optional for CLI printers: show the user a 'buffering output' spinner - } - protected function undrawSpinner() : void - { - // remove the spinner from the current line - } - protected function writeTestResult(array $prevResult, array $result) : void - { - } - protected function getEmptyTestResult() : array - { - return ['className' => '', 'testName' => '', 'message' => '', 'failed' => '', 'verbose' => '']; + return $data; } - protected function getTestResultByName(?string $testName) : array + private function cleanUpMultiLineAnnotation(string $docComment): string { - if (isset($this->testNameResultIndex[$testName])) { - return $this->testResults[$this->testNameResultIndex[$testName]]; - } - return []; + // removing initial ' * ' for docComment + $docComment = str_replace("\r\n", "\n", $docComment); + $docComment = preg_replace('/\n\s*\*\s?/', "\n", $docComment); + $docComment = (string) substr($docComment, 0, -1); + return rtrim($docComment, "\n"); } - protected function formatThrowable(Throwable $t, ?int $status = null) : string + /** @return array> */ + private static function parseDocBlock(string $docBlock): array { - $message = trim(\PHPUnit\Framework\TestFailure::exceptionToString($t)); - if ($message) { - $message .= PHP_EOL . PHP_EOL . $this->formatStacktrace($t); - } else { - $message = $this->formatStacktrace($t); + // Strip away the docblock header and footer to ease parsing of one line annotations + $docBlock = (string) substr($docBlock, 3, -2); + $annotations = []; + if (preg_match_all('/@(?P[A-Za-z_-]+)(?:[ \t]+(?P.*?))?[ \t]*\r?$/m', $docBlock, $matches)) { + $numMatches = count($matches[0]); + for ($i = 0; $i < $numMatches; $i++) { + $annotations[$matches['name'][$i]][] = (string) $matches['value'][$i]; + } } - return $message; - } - protected function formatStacktrace(Throwable $t) : string - { - return \PHPUnit\Util\Filter::getFilteredStacktrace($t); + return $annotations; } - protected function formatTestResultMessage(Throwable $t, array $result, string $prefix = '│') : string + /** @param ReflectionClass|ReflectionFunctionAbstract $reflector */ + private static function extractAnnotationsFromReflector(Reflector $reflector): array { - $message = $this->formatThrowable($t, $result['status']); - if ($message === '') { - return ''; - } - if (!($this->verbose || $result['verbose'])) { - return ''; + $annotations = []; + if ($reflector instanceof ReflectionClass) { + $annotations = array_merge($annotations, ...array_map(static function (ReflectionClass $trait): array { + return self::parseDocBlock((string) $trait->getDocComment()); + }, array_values($reflector->getTraits()))); } - return $this->prefixLines($prefix, $message); - } - protected function prefixLines(string $prefix, string $message) : string - { - $message = trim($message); - return implode(PHP_EOL, array_map(static function (string $text) use($prefix) { - return ' ' . $prefix . ($text ? ' ' . $text : ''); - }, preg_split('/\\r\\n|\\r|\\n/', $message))); + return array_merge($annotations, self::parseDocBlock((string) $reflector->getDocComment())); } } indexed by class name */ + private $classDocBlocks = []; + /** @var array> indexed by class name and method name */ + private $methodDocBlocks = []; + public static function getInstance(): self { + return self::$instance ?? self::$instance = new self(); } - /** - * Handler for 'start class' event. - */ - protected function startClass(string $name) : void + private function __construct() { - $this->write($this->currentTestClassPrettified . "\n"); } /** - * Handler for 'on test' event. + * @throws Exception + * + * @psalm-param class-string $class */ - protected function onTest(string $name, bool $success = \true) : void + public function forClassName(string $class): \PHPUnit\Util\Annotation\DocBlock { - if ($success) { - $this->write(' [x] '); - } else { - $this->write(' [ ] '); + if (array_key_exists($class, $this->classDocBlocks)) { + return $this->classDocBlocks[$class]; } - $this->write($name . "\n"); + try { + $reflection = new ReflectionClass($class); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + return $this->classDocBlocks[$class] = \PHPUnit\Util\Annotation\DocBlock::ofClass($reflection); } /** - * Handler for 'end class' event. + * @throws Exception + * + * @psalm-param class-string $classInHierarchy */ - protected function endClass(string $name) : void + public function forMethod(string $classInHierarchy, string $method): \PHPUnit\Util\Annotation\DocBlock { - $this->write("\n"); + if (isset($this->methodDocBlocks[$classInHierarchy][$method])) { + return $this->methodDocBlocks[$classInHierarchy][$method]; + } + try { + $reflection = new ReflectionMethod($classInHierarchy, $method); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + return $this->methodDocBlocks[$classInHierarchy][$method] = \PHPUnit\Util\Annotation\DocBlock::ofMethod($reflection, $classInHierarchy); } } document = new DOMDocument('1.0', 'UTF-8'); - $this->document->formatOutput = \true; - $this->root = $this->document->createElement('tests'); - $this->document->appendChild($this->root); - $this->prettifier = new \PHPUnit\Util\TestDox\NamePrettifier(); - parent::__construct($out); - } - /** - * Flush buffer and close output. - */ - public function flush() : void - { - $this->write($this->document->saveXML()); - parent::flush(); - } - /** - * An error occurred. - */ - public function addError(Test $test, Throwable $t, float $time) : void - { - $this->exception = $t; - } - /** - * A warning occurred. - */ - public function addWarning(Test $test, Warning $e, float $time) : void - { - } - /** - * A failure occurred. - */ - public function addFailure(Test $test, AssertionFailedError $e, float $time) : void - { - $this->exception = $e; - } - /** - * Incomplete test. - */ - public function addIncompleteTest(Test $test, Throwable $t, float $time) : void - { - } - /** - * Risky test. - */ - public function addRiskyTest(Test $test, Throwable $t, float $time) : void - { - } - /** - * Skipped test. - */ - public function addSkippedTest(Test $test, Throwable $t, float $time) : void - { - } - /** - * A test suite started. - */ - public function startTestSuite(TestSuite $suite) : void - { - } - /** - * A test suite ended. - */ - public function endTestSuite(TestSuite $suite) : void + public static function addDirectory(string $directory): void { + \PHPUnit\Util\ExcludeList::addDirectory($directory); } /** - * A test started. + * @throws Exception + * + * @return string[] */ - public function startTest(Test $test) : void + public function getBlacklistedDirectories(): array { - $this->exception = null; + return (new \PHPUnit\Util\ExcludeList())->getExcludedDirectories(); } /** - * A test ended. - * - * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception */ - public function endTest(Test $test, float $time) : void + public function isBlacklisted(string $file): bool { - if (!$test instanceof TestCase || $test instanceof WarningTestCase) { - return; - } - $groups = array_filter($test->getGroups(), static function ($group) { - return !($group === 'small' || $group === 'medium' || $group === 'large' || strpos($group, '__phpunit_') === 0); - }); - $testNode = $this->document->createElement('test'); - $testNode->setAttribute('className', get_class($test)); - $testNode->setAttribute('methodName', $test->getName()); - $testNode->setAttribute('prettifiedClassName', $this->prettifier->prettifyTestClass(get_class($test))); - $testNode->setAttribute('prettifiedMethodName', $this->prettifier->prettifyTestCase($test)); - $testNode->setAttribute('status', (string) $test->getStatus()); - $testNode->setAttribute('time', (string) $time); - $testNode->setAttribute('size', (string) $test->getSize()); - $testNode->setAttribute('groups', implode(',', $groups)); - foreach ($groups as $group) { - $groupNode = $this->document->createElement('group'); - $groupNode->setAttribute('name', $group); - $testNode->appendChild($groupNode); - } - $annotations = TestUtil::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); - foreach (['class', 'method'] as $type) { - foreach ($annotations[$type] as $annotation => $values) { - if ($annotation !== 'covers' && $annotation !== 'uses') { - continue; - } - foreach ($values as $value) { - $coversNode = $this->document->createElement($annotation); - $coversNode->setAttribute('target', $value); - $testNode->appendChild($coversNode); - } - } - } - foreach ($test->doubledTypes() as $doubledType) { - $testDoubleNode = $this->document->createElement('testDouble'); - $testDoubleNode->setAttribute('type', $doubledType); - $testNode->appendChild($testDoubleNode); - } - $inlineAnnotations = \PHPUnit\Util\Test::getInlineAnnotations(get_class($test), $test->getName(\false)); - if (isset($inlineAnnotations['given'], $inlineAnnotations['when'], $inlineAnnotations['then'])) { - $testNode->setAttribute('given', $inlineAnnotations['given']['value']); - $testNode->setAttribute('givenStartLine', (string) $inlineAnnotations['given']['line']); - $testNode->setAttribute('when', $inlineAnnotations['when']['value']); - $testNode->setAttribute('whenStartLine', (string) $inlineAnnotations['when']['line']); - $testNode->setAttribute('then', $inlineAnnotations['then']['value']); - $testNode->setAttribute('thenStartLine', (string) $inlineAnnotations['then']['line']); - } - if ($this->exception !== null) { - if ($this->exception instanceof Exception) { - $steps = $this->exception->getSerializableTrace(); - } else { - $steps = $this->exception->getTrace(); - } - try { - $file = (new ReflectionClass($test))->getFileName(); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - foreach ($steps as $step) { - if (isset($step['file']) && $step['file'] === $file) { - $testNode->setAttribute('exceptionLine', (string) $step['line']); - break; - } - } - $testNode->setAttribute('exceptionMessage', $this->exception->getMessage()); - } - $this->root->appendChild($testNode); + return (new \PHPUnit\Util\ExcludeList())->isExcluded($file); } } getIterator()) as $test) { - if ($test instanceof TestCase) { - $name = sprintf('%s::%s', get_class($test), str_replace(' with data set ', '', $test->getName())); - } elseif ($test instanceof PhptTestCase) { - $name = $test->getName(); - } else { - continue; - } - $buffer .= sprintf(' - %s' . PHP_EOL, $name); + try { + return clone $original; + } catch (Throwable $t) { + return $original; } - return $buffer; } } + */ + private const WHITESPACE_MAP = [' ' => '·', "\t" => '⇥']; + /** + * @var array + */ + private const WHITESPACE_EOL_MAP = [' ' => '·', "\t" => '⇥', "\n" => '↵', "\r" => '⟵']; + /** + * @var array + */ + private static $ansiCodes = ['reset' => '0', 'bold' => '1', 'dim' => '2', 'dim-reset' => '22', 'underlined' => '4', 'fg-default' => '39', 'fg-black' => '30', 'fg-red' => '31', 'fg-green' => '32', 'fg-yellow' => '33', 'fg-blue' => '34', 'fg-magenta' => '35', 'fg-cyan' => '36', 'fg-white' => '37', 'bg-default' => '49', 'bg-black' => '40', 'bg-red' => '41', 'bg-green' => '42', 'bg-yellow' => '43', 'bg-blue' => '44', 'bg-magenta' => '45', 'bg-cyan' => '46', 'bg-white' => '47']; + public static function colorize(string $color, string $buffer): string { - switch ($type) { - case 'numeric': - case 'integer': - case 'int': - case 'iterable': - case 'float': - case 'string': - case 'boolean': - case 'bool': - case 'null': - case 'array': - case 'object': - case 'resource': - case 'scalar': - return \true; - default: - return \false; + if (trim($buffer) === '') { + return $buffer; + } + $codes = array_map('\trim', explode(',', $color)); + $styles = []; + foreach ($codes as $code) { + if (isset(self::$ansiCodes[$code])) { + $styles[] = self::$ansiCodes[$code] ?? ''; + } + } + if (empty($styles)) { + return $buffer; + } + return self::optimizeColor(sprintf("\x1b[%sm", implode(';', $styles)) . $buffer . "\x1b[0m"); + } + public static function colorizePath(string $path, ?string $prevPath = null, bool $colorizeFilename = \false): string + { + if ($prevPath === null) { + $prevPath = ''; + } + $path = explode(DIRECTORY_SEPARATOR, $path); + $prevPath = explode(DIRECTORY_SEPARATOR, $prevPath); + for ($i = 0; $i < min(count($path), count($prevPath)); $i++) { + if ($path[$i] == $prevPath[$i]) { + $path[$i] = self::dim($path[$i]); + } + } + if ($colorizeFilename) { + $last = count($path) - 1; + $path[$last] = preg_replace_callback('/([\-_\.]+|phpt$)/', static function ($matches) { + return self::dim($matches[0]); + }, $path[$last]); + } + return self::optimizeColor(implode(self::dim(DIRECTORY_SEPARATOR), $path)); + } + public static function dim(string $buffer): string + { + if (trim($buffer) === '') { + return $buffer; } + return "\x1b[2m{$buffer}\x1b[22m"; + } + public static function visualizeWhitespace(string $buffer, bool $visualizeEOL = \false): string + { + $replaceMap = $visualizeEOL ? self::WHITESPACE_EOL_MAP : self::WHITESPACE_MAP; + return preg_replace_callback('/\s+/', static function ($matches) use ($replaceMap) { + return self::dim(strtr($matches[0], $replaceMap)); + }, $buffer); + } + private static function optimizeColor(string $buffer): string + { + $patterns = ["/\x1b\\[22m\x1b\\[2m/" => '', "/\x1b\\[([^m]*)m\x1b\\[([1-9][0-9;]*)m/" => "\x1b[\$1;\$2m", "/(\x1b\\[[^m]*m)+(\x1b\\[0m)/" => '$2']; + return preg_replace(array_keys($patterns), array_values($patterns), $buffer); } } '|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' + * @var bool */ - private $operator; - public function __construct(string $operator) - { - $this->ensureOperatorIsValid($operator); - $this->operator = $operator; - } + private $convertDeprecationsToExceptions; /** - * @return '!='|'<'|'<='|'<>'|'='|'=='|'>'|'>='|'eq'|'ge'|'gt'|'le'|'lt'|'ne' + * @var bool */ - public function asString() : string - { - return $this->operator; - } + private $convertErrorsToExceptions; /** - * @throws Exception - * - * @psalm-assert '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' $operator + * @var bool + */ + private $convertNoticesToExceptions; + /** + * @var bool */ - private function ensureOperatorIsValid(string $operator) : void + private $convertWarningsToExceptions; + /** + * @var bool + */ + private $registered = \false; + public static function invokeIgnoringWarnings(callable $callable) { - if (!in_array($operator, ['<', 'lt', '<=', 'le', '>', 'gt', '>=', 'ge', '==', '=', 'eq', '!=', '<>', 'ne'], \true)) { - throw new \PHPUnit\Util\Exception(sprintf('"%s" is not a valid version_compare() operator', $operator)); + set_error_handler(static function ($errorNumber, $errorString) { + if ($errorNumber === E_WARNING) { + return; + } + return \false; + }); + $result = $callable(); + restore_error_handler(); + return $result; + } + public function __construct(bool $convertDeprecationsToExceptions, bool $convertErrorsToExceptions, bool $convertNoticesToExceptions, bool $convertWarningsToExceptions) + { + $this->convertDeprecationsToExceptions = $convertDeprecationsToExceptions; + $this->convertErrorsToExceptions = $convertErrorsToExceptions; + $this->convertNoticesToExceptions = $convertNoticesToExceptions; + $this->convertWarningsToExceptions = $convertWarningsToExceptions; + } + public function __invoke(int $errorNumber, string $errorString, string $errorFile, int $errorLine): bool + { + /* + * Do not raise an exception when the error suppression operator (@) was used. + * + * @see https://github.com/sebastianbergmann/phpunit/issues/3739 + */ + if (!($errorNumber & error_reporting())) { + return \false; + } + switch ($errorNumber) { + case E_NOTICE: + case E_USER_NOTICE: + case E_STRICT: + if (!$this->convertNoticesToExceptions) { + return \false; + } + throw new Notice($errorString, $errorNumber, $errorFile, $errorLine); + case E_WARNING: + case E_USER_WARNING: + if (!$this->convertWarningsToExceptions) { + return \false; + } + throw new Warning($errorString, $errorNumber, $errorFile, $errorLine); + case E_DEPRECATED: + case E_USER_DEPRECATED: + if (!$this->convertDeprecationsToExceptions) { + return \false; + } + throw new Deprecated($errorString, $errorNumber, $errorFile, $errorLine); + default: + if (!$this->convertErrorsToExceptions) { + return \false; + } + throw new Error($errorString, $errorNumber, $errorFile, $errorLine); + } + } + public function register(): void + { + if ($this->registered) { + return; + } + $oldErrorHandler = set_error_handler($this); + if ($oldErrorHandler !== null) { + restore_error_handler(); + return; + } + $this->registered = \true; + } + public function unregister(): void + { + if (!$this->registered) { + return; } + restore_error_handler(); } } getItems($filter)); - $files = implode(",\n", $files); - return <<directories() as $directory) { - $path = realpath($directory->path()); - if (is_string($path)) { - $files[] = sprintf(addslashes('%s' . DIRECTORY_SEPARATOR), $path); - } - } - foreach ($filter->files() as $file) { - $files[] = $file->path(); - } - return $files; - } } */ - public static function import(DOMElement $element) : DOMElement - { - return (new DOMDocument())->importNode($element, \true); - } + private const EXCLUDED_CLASS_NAMES = [ + // composer + ClassLoader::class => 1, + // doctrine/instantiator + Instantiator::class => 1, + // myclabs/deepcopy + DeepCopy::class => 1, + // nikic/php-parser + Parser::class => 1, + // phar-io/manifest + Manifest::class => 1, + // phar-io/version + PharIoVersion::class => 1, + // phpdocumentor/type-resolver + \PHPUnit\Util\Type::class => 1, + // phpunit/phpunit + TestCase::class => 2, + // phpunit/php-code-coverage + CodeCoverage::class => 1, + // phpunit/php-file-iterator + FileIteratorFacade::class => 1, + // phpunit/php-invoker + Invoker::class => 1, + // phpunit/php-text-template + Template::class => 1, + // phpunit/php-timer + Timer::class => 1, + // sebastian/cli-parser + CliParser::class => 1, + // sebastian/code-unit + CodeUnit::class => 1, + // sebastian/code-unit-reverse-lookup + Wizard::class => 1, + // sebastian/comparator + Comparator::class => 1, + // sebastian/complexity + Calculator::class => 1, + // sebastian/diff + Diff::class => 1, + // sebastian/environment + Runtime::class => 1, + // sebastian/exporter + Exporter::class => 1, + // sebastian/global-state + Snapshot::class => 1, + // sebastian/lines-of-code + Counter::class => 1, + // sebastian/object-enumerator + Enumerator::class => 1, + // sebastian/object-reflector + ObjectReflector::class => 1, + // sebastian/recursion-context + Context::class => 1, + // sebastian/resource-operations + ResourceOperations::class => 1, + // sebastian/type + TypeName::class => 1, + // sebastian/version + Version::class => 1, + // theseer/tokenizer + Tokenizer::class => 1, + ]; /** - * @deprecated Only used by assertEqualXMLStructure() + * @var string[] + */ + private static $directories = []; + /** + * @var bool */ - public static function removeCharacterDataNodes(DOMNode $node) : void + private static $initialized = \false; + public static function addDirectory(string $directory): void { - if ($node->hasChildNodes()) { - for ($i = $node->childNodes->length - 1; $i >= 0; $i--) { - if (($child = $node->childNodes->item($i)) instanceof DOMCharacterData) { - $node->removeChild($child); - } - } + if (!is_dir($directory)) { + throw new \PHPUnit\Util\Exception(sprintf('"%s" is not a directory', $directory)); } + self::$directories[] = realpath($directory); } /** - * Escapes a string for the use in XML documents. - * - * Any Unicode character is allowed, excluding the surrogate blocks, FFFE, - * and FFFF (not even as character reference). + * @throws Exception * - * @see https://www.w3.org/TR/xml/#charsets + * @return string[] */ - public static function prepareString(string $string) : string + public function getExcludedDirectories(): array { - return preg_replace('/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]/', '', htmlspecialchars(self::convertToUtf8($string), ENT_QUOTES)); + $this->initialize(); + return self::$directories; } /** - * "Convert" a DOMElement object into a PHP variable. + * @throws Exception */ - public static function xmlToVariable(DOMElement $element) + public function isExcluded(string $file): bool { - $variable = null; - switch ($element->tagName) { - case 'array': - $variable = []; - foreach ($element->childNodes as $entry) { - if (!$entry instanceof DOMElement || $entry->tagName !== 'element') { - continue; - } - $item = $entry->childNodes->item(0); - if ($item instanceof DOMText) { - $item = $entry->childNodes->item(1); - } - $value = self::xmlToVariable($item); - if ($entry->hasAttribute('key')) { - $variable[(string) $entry->getAttribute('key')] = $value; - } else { - $variable[] = $value; - } - } - break; - case 'object': - $className = $element->getAttribute('class'); - if ($element->hasChildNodes()) { - $arguments = $element->childNodes->item(0)->childNodes; - $constructorArgs = []; - foreach ($arguments as $argument) { - if ($argument instanceof DOMElement) { - $constructorArgs[] = self::xmlToVariable($argument); - } - } - try { - assert(class_exists($className)); - $variable = (new ReflectionClass($className))->newInstanceArgs($constructorArgs); - // @codeCoverageIgnoreStart - } catch (ReflectionException $e) { - throw new \PHPUnit\Util\Exception($e->getMessage(), $e->getCode(), $e); - } - // @codeCoverageIgnoreEnd - } else { - $variable = new $className(); - } - break; - case 'boolean': - $variable = $element->textContent === 'true'; - break; - case 'integer': - case 'double': - case 'string': - $variable = $element->textContent; - settype($variable, $element->tagName); - break; + if (defined('PHPUNIT_TESTSUITE')) { + return \false; } - return $variable; - } - private static function convertToUtf8(string $string) : string - { - if (!self::isUtf8($string)) { - $string = mb_convert_encoding($string, 'UTF-8'); + $this->initialize(); + foreach (self::$directories as $directory) { + if (strpos($file, $directory) === 0) { + return \true; + } } - return $string; + return \false; } - private static function isUtf8(string $string) : bool + /** + * @throws Exception + */ + private function initialize(): void { - $length = strlen($string); - for ($i = 0; $i < $length; $i++) { - if (ord($string[$i]) < 0x80) { - $n = 0; - } elseif ((ord($string[$i]) & 0xe0) === 0xc0) { - $n = 1; - } elseif ((ord($string[$i]) & 0xf0) === 0xe0) { - $n = 2; - } elseif ((ord($string[$i]) & 0xf0) === 0xf0) { - $n = 3; - } else { - return \false; + if (self::$initialized) { + return; + } + foreach (self::EXCLUDED_CLASS_NAMES as $className => $parent) { + if (!class_exists($className)) { + continue; } - for ($j = 0; $j < $n; $j++) { - if (++$i === $length || (ord($string[$i]) & 0xc0) !== 0x80) { - return \false; - } + $directory = (new ReflectionClass($className))->getFileName(); + for ($i = 0; $i < $parent; $i++) { + $directory = dirname($directory); } + self::$directories[] = $directory; } - return \true; + // Hide process isolation workaround on Windows. + if (DIRECTORY_SEPARATOR === '\\') { + // tempnam() prefix is limited to first 3 chars. + // @see https://php.net/manual/en/function.tempnam.php + self::$directories[] = sys_get_temp_dir() . '\PHP'; + } + self::$initialized = \true; } } Foo/Bar/Baz.php + * - Namespace: Foo\Bar\Baz -> Foo/Bar/Baz.php + */ + public static function classNameToFilename(string $className): string + { + return str_replace(['_', '\\'], DIRECTORY_SEPARATOR, $className) . '.php'; + } + public static function createDirectory(string $directory): bool + { + return !(!is_dir($directory) && !@mkdir($directory, 0777, \true) && !is_dir($directory)); + } } getSyntheticTrace(); + $eFile = $t->getSyntheticFile(); + $eLine = $t->getSyntheticLine(); + } elseif ($t instanceof Exception) { + $eTrace = $t->getSerializableTrace(); + $eFile = $t->getFile(); + $eLine = $t->getLine(); + } else { + if ($t->getPrevious()) { + $t = $t->getPrevious(); + } + $eTrace = $t->getTrace(); + $eFile = $t->getFile(); + $eLine = $t->getLine(); } - return $this->load($contents, $isHtml, $filename, $xinclude, $strict); - } - /** - * @throws Exception - */ - public function load(string $actual, bool $isHtml = \false, string $filename = '', bool $xinclude = \false, bool $strict = \false) : DOMDocument - { - if ($actual === '') { - throw new \PHPUnit\Util\Xml\Exception('Could not load XML from empty string'); + if (!self::frameExists($eTrace, $eFile, $eLine)) { + array_unshift($eTrace, ['file' => $eFile, 'line' => $eLine]); } - // Required for XInclude on Windows. - if ($xinclude) { - $cwd = getcwd(); - @chdir(dirname($filename)); + $prefix = defined('__PHPUNIT_PHAR_ROOT__') ? __PHPUNIT_PHAR_ROOT__ : \false; + $excludeList = new \PHPUnit\Util\ExcludeList(); + foreach ($eTrace as $frame) { + if (self::shouldPrintFrame($frame, $prefix, $excludeList)) { + $filteredStacktrace .= sprintf("%s:%s\n", $frame['file'], $frame['line'] ?? '?'); + } } - $document = new DOMDocument(); - $document->preserveWhiteSpace = \false; - $internal = libxml_use_internal_errors(\true); - $message = ''; - $reporting = error_reporting(0); - if ($filename !== '') { - // Required for XInclude - $document->documentURI = $filename; + return $filteredStacktrace; + } + private static function shouldPrintFrame(array $frame, $prefix, \PHPUnit\Util\ExcludeList $excludeList): bool + { + if (!isset($frame['file'])) { + return \false; } - if ($isHtml) { - $loaded = $document->loadHTML($actual); + $file = $frame['file']; + $fileIsNotPrefixed = $prefix === \false || strpos($file, $prefix) !== 0; + // @see https://github.com/sebastianbergmann/phpunit/issues/4033 + if (isset($GLOBALS['_SERVER']['SCRIPT_NAME'])) { + $script = realpath($GLOBALS['_SERVER']['SCRIPT_NAME']); } else { - $loaded = $document->loadXML($actual); - } - if (!$isHtml && $xinclude) { - $document->xinclude(); - } - foreach (libxml_get_errors() as $error) { - $message .= "\n" . $error->message; - } - libxml_use_internal_errors($internal); - error_reporting($reporting); - if (isset($cwd)) { - @chdir($cwd); + $script = ''; } - if ($loaded === \false || $strict && $message !== '') { - if ($filename !== '') { - throw new \PHPUnit\Util\Xml\Exception(sprintf('Could not load "%s".%s', $filename, $message !== '' ? "\n" . $message : '')); - } - if ($message === '') { - $message = 'Could not load XML for unknown reason'; + return is_file($file) && self::fileIsExcluded($file, $excludeList) && $fileIsNotPrefixed && $file !== $script; + } + private static function fileIsExcluded(string $file, \PHPUnit\Util\ExcludeList $excludeList): bool + { + return (empty($GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST']) || !in_array($file, $GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'], \true)) && !$excludeList->isExcluded($file); + } + private static function frameExists(array $trace, string $file, int $line): bool + { + foreach ($trace as $frame) { + if (isset($frame['file'], $frame['line']) && $frame['file'] === $file && $frame['line'] === $line) { + return \true; } - throw new \PHPUnit\Util\Xml\Exception($message); } - return $document; + return \false; } } > + */ + private const DEPRECATED_INI_SETTINGS = ['7.3' => ['iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.func_overload' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'string.strip_tags' => \true], '7.4' => ['iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.func_overload' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'pdo_odbc.db2_instance_name' => \true, 'string.strip_tags' => \true], '8.0' => ['iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true], '8.1' => ['auto_detect_line_endings' => \true, 'filter.default' => \true, 'iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'oci8.old_oci_close_semantics' => \true], '8.2' => ['auto_detect_line_endings' => \true, 'filter.default' => \true, 'iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'oci8.old_oci_close_semantics' => \true], '8.3' => ['auto_detect_line_endings' => \true, 'filter.default' => \true, 'iconv.input_encoding' => \true, 'iconv.output_encoding' => \true, 'iconv.internal_encoding' => \true, 'mbstring.http_input' => \true, 'mbstring.http_output' => \true, 'mbstring.internal_encoding' => \true, 'oci8.old_oci_close_semantics' => \true]]; /** * @throws Exception */ - public function version() : string + public static function getIncludedFilesAsString(): string { - throw new \PHPUnit\Util\Xml\Exception('No supported schema was detected'); + return self::processIncludedFilesAsString(get_included_files()); } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util\Xml; - -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class SchemaDetector -{ /** + * @param string[] $files + * * @throws Exception */ - public function detect(string $filename) : \PHPUnit\Util\Xml\SchemaDetectionResult + public static function processIncludedFilesAsString(array $files): string { - $document = (new \PHPUnit\Util\Xml\Loader())->loadFile($filename, \false, \true, \true); - foreach (['9.2', '8.5'] as $candidate) { - $schema = (new \PHPUnit\Util\Xml\SchemaFinder())->find($candidate); - if (!(new \PHPUnit\Util\Xml\Validator())->validate($document, $schema)->hasValidationErrors()) { - return new \PHPUnit\Util\Xml\SuccessfulSchemaDetectionResult($candidate); + $excludeList = new \PHPUnit\Util\ExcludeList(); + $prefix = \false; + $result = ''; + if (defined('__PHPUNIT_PHAR__')) { + $prefix = 'phar://' . __PHPUNIT_PHAR__ . '/'; + } + // Do not process bootstrap script + array_shift($files); + // If bootstrap script was a Composer bin proxy, skip the second entry as well + if (substr(strtr($files[0], '\\', '/'), -24) === '/phpunit/phpunit/phpunit') { + array_shift($files); + } + foreach (array_reverse($files) as $file) { + if (!empty($GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST']) && in_array($file, $GLOBALS['__PHPUNIT_ISOLATION_EXCLUDE_LIST'], \true)) { + continue; + } + if ($prefix !== \false && strpos($file, $prefix) === 0) { + continue; + } + // Skip virtual file system protocols + if (preg_match('/^(vfs|phpvfs[a-z0-9]+):/', $file)) { + continue; + } + if (!$excludeList->isExcluded($file) && is_file($file)) { + $result = 'require_once \'' . $file . "';\n" . $result; } } - return new \PHPUnit\Util\Xml\FailedSchemaDetectionResult(); + return $result; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util\Xml; - -use function defined; -use function is_file; -use function sprintf; -use PHPUnit\Runner\Version; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class SchemaFinder -{ - /** - * @throws Exception - */ - public function find(string $version) : string + public static function getIniSettingsAsString(): string { - if ($version === Version::series()) { - $filename = $this->path() . 'phpunit.xsd'; - } else { - $filename = $this->path() . 'schema/' . $version . '.xsd'; + $result = ''; + foreach (ini_get_all(null, \false) as $key => $value) { + if (self::isIniSettingDeprecated($key)) { + continue; + } + $result .= sprintf('@ini_set(%s, %s);' . "\n", self::exportVariable($key), self::exportVariable((string) $value)); } - if (!is_file($filename)) { - throw new \PHPUnit\Util\Xml\Exception(sprintf('Schema for PHPUnit %s is not available', $version)); + return $result; + } + public static function getConstantsAsString(): string + { + $constants = get_defined_constants(\true); + $result = ''; + if (isset($constants['user'])) { + foreach ($constants['user'] as $name => $value) { + $result .= sprintf('if (!defined(\'%s\')) define(\'%s\', %s);' . "\n", $name, $name, self::exportVariable($value)); + } } - return $filename; + return $result; } - private function path() : string + public static function getGlobalsAsString(): string { - if (defined('__PHPUNIT_PHAR_ROOT__')) { - return __PHPUNIT_PHAR_ROOT__ . '/'; + $result = ''; + foreach (self::SUPER_GLOBAL_ARRAYS as $superGlobalArray) { + if (isset($GLOBALS[$superGlobalArray]) && is_array($GLOBALS[$superGlobalArray])) { + foreach (array_keys($GLOBALS[$superGlobalArray]) as $key) { + if ($GLOBALS[$superGlobalArray][$key] instanceof Closure) { + continue; + } + $result .= sprintf('$GLOBALS[\'%s\'][\'%s\'] = %s;' . "\n", $superGlobalArray, $key, self::exportVariable($GLOBALS[$superGlobalArray][$key])); + } + } } - return __DIR__ . '/../../../'; + $excludeList = self::SUPER_GLOBAL_ARRAYS; + $excludeList[] = 'GLOBALS'; + foreach (array_keys($GLOBALS) as $key) { + if (!$GLOBALS[$key] instanceof Closure && !in_array($key, $excludeList, \true)) { + $result .= sprintf('$GLOBALS[\'%s\'] = %s;' . "\n", $key, self::exportVariable($GLOBALS[$key])); + } + } + return $result; } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util\Xml; - -use function count; -use ArrayIterator; -use Countable; -use DOMNode; -use DOMNodeList; -use IteratorAggregate; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - * - * @template-implements IteratorAggregate - */ -final class SnapshotNodeList implements Countable, IteratorAggregate -{ - /** - * @var DOMNode[] - */ - private $nodes = []; - public static function fromNodeList(DOMNodeList $list) : self + private static function exportVariable($variable): string { - $snapshot = new self(); - foreach ($list as $node) { - $snapshot->nodes[] = $node; + if (is_scalar($variable) || $variable === null || is_array($variable) && self::arrayOnlyContainsScalars($variable)) { + return var_export($variable, \true); } - return $snapshot; + return 'unserialize(' . var_export(serialize($variable), \true) . ')'; } - public function count() : int + private static function arrayOnlyContainsScalars(array $array): bool { - return count($this->nodes); + $result = \true; + foreach ($array as $element) { + if (is_array($element)) { + $result = self::arrayOnlyContainsScalars($element); + } elseif (!is_scalar($element) && $element !== null) { + $result = \false; + } + if (!$result) { + break; + } + } + return $result; } - public function getIterator() : ArrayIterator + private static function isIniSettingDeprecated(string $iniSetting): bool { - return new ArrayIterator($this->nodes); + return isset(self::DEPRECATED_INI_SETTINGS[PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION][$iniSetting]); } } version = $version; - } - public function detected() : bool - { - return \true; - } - public function version() : string - { - return $this->version; - } } > - */ - private $validationErrors = []; - /** - * @psalm-param array $errors + * Prettify json string. + * + * @throws Exception */ - public static function fromArray(array $errors) : self + public static function prettify(string $json): string { - $validationErrors = []; - foreach ($errors as $error) { - if (!isset($validationErrors[$error->line])) { - $validationErrors[$error->line] = []; - } - $validationErrors[$error->line][] = trim($error->message); + $decodedJson = json_decode($json, \false); + if (json_last_error()) { + throw new Exception('Cannot prettify invalid json'); } - return new self($validationErrors); - } - private function __construct(array $validationErrors) - { - $this->validationErrors = $validationErrors; + return json_encode($decodedJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); } - public function hasValidationErrors() : bool + /** + * To allow comparison of JSON strings, first process them into a consistent + * format so that they can be compared as strings. + * + * @return array ($error, $canonicalized_json) The $error parameter is used + * to indicate an error decoding the json. This is used to avoid ambiguity + * with JSON strings consisting entirely of 'null' or 'false'. + */ + public static function canonicalize(string $json): array { - return !empty($this->validationErrors); + $decodedJson = json_decode($json); + if (json_last_error()) { + return [\true, null]; + } + self::recursiveSort($decodedJson); + $reencodedJson = json_encode($decodedJson); + return [\false, $reencodedJson]; } - public function asString() : string + /** + * JSON object keys are unordered while PHP array keys are ordered. + * + * Sort all array keys to ensure both the expected and actual values have + * their keys in the same order. + */ + private static function recursiveSort(&$json): void { - $buffer = ''; - foreach ($this->validationErrors as $line => $validationErrorsOnLine) { - $buffer .= sprintf(\PHP_EOL . ' Line %d:' . \PHP_EOL, $line); - foreach ($validationErrorsOnLine as $validationError) { - $buffer .= sprintf(' - %s' . \PHP_EOL, $validationError); + if (!is_array($json)) { + // If the object is not empty, change it to an associative array + // so we can sort the keys (and we will still re-encode it + // correctly, since PHP encodes associative arrays as JSON objects.) + // But EMPTY objects MUST remain empty objects. (Otherwise we will + // re-encode it as a JSON array rather than a JSON object.) + // See #2919. + if (is_object($json) && count((array) $json) > 0) { + $json = (array) $json; + } else { + return; } } - return $buffer; - } -} - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Util\Xml; - -use function file_get_contents; -use function libxml_clear_errors; -use function libxml_get_errors; -use function libxml_use_internal_errors; -use DOMDocument; -/** - * @internal This class is not covered by the backward compatibility promise for PHPUnit - */ -final class Validator -{ - public function validate(DOMDocument $document, string $xsdFilename) : \PHPUnit\Util\Xml\ValidationResult - { - $originalErrorHandling = libxml_use_internal_errors(\true); - $document->schemaValidateSource(file_get_contents($xsdFilename)); - $errors = libxml_get_errors(); - libxml_clear_errors(); - libxml_use_internal_errors($originalErrorHandling); - return \PHPUnit\Util\Xml\ValidationResult::fromArray($errors); + ksort($json); + foreach ($json as $key => &$value) { + self::recursiveSort($value); + } } } openMemory(); - $writer->setIndent(\true); - $writer->startDocument('1.0', 'UTF-8'); - $writer->startElement('tests'); - $currentTestCase = null; - foreach (new RecursiveIteratorIterator($suite->getIterator()) as $test) { - if ($test instanceof TestCase) { - if (get_class($test) !== $currentTestCase) { - if ($currentTestCase !== null) { - $writer->endElement(); - } - $writer->startElement('testCaseClass'); - $writer->writeAttribute('name', get_class($test)); - $currentTestCase = get_class($test); - } - $writer->startElement('testCaseMethod'); - $writer->writeAttribute('name', $test->getName(\false)); - $writer->writeAttribute('groups', implode(',', $test->getGroups())); - if (!empty($test->getDataSetAsString(\false))) { - $writer->writeAttribute('dataSet', str_replace(' with data set ', '', $test->getDataSetAsString(\false))); + private $document; + /** + * @var DOMElement + */ + private $root; + /** + * @var bool + */ + private $reportRiskyTests = \false; + /** + * @var DOMElement[] + */ + private $testSuites = []; + /** + * @var int[] + */ + private $testSuiteTests = [0]; + /** + * @var int[] + */ + private $testSuiteAssertions = [0]; + /** + * @var int[] + */ + private $testSuiteErrors = [0]; + /** + * @var int[] + */ + private $testSuiteWarnings = [0]; + /** + * @var int[] + */ + private $testSuiteFailures = [0]; + /** + * @var int[] + */ + private $testSuiteSkipped = [0]; + /** + * @var int[] + */ + private $testSuiteTimes = [0]; + /** + * @var int + */ + private $testSuiteLevel = 0; + /** + * @var DOMElement + */ + private $currentTestCase; + /** + * @param null|mixed $out + */ + public function __construct($out = null, bool $reportRiskyTests = \false) + { + $this->document = new DOMDocument('1.0', 'UTF-8'); + $this->document->formatOutput = \true; + $this->root = $this->document->createElement('testsuites'); + $this->document->appendChild($this->root); + parent::__construct($out); + $this->reportRiskyTests = $reportRiskyTests; + } + /** + * Flush buffer and close output. + */ + public function flush(): void + { + $this->write($this->getXML()); + parent::flush(); + } + /** + * An error occurred. + */ + public function addError(Test $test, Throwable $t, float $time): void + { + $this->doAddFault($test, $t, 'error'); + $this->testSuiteErrors[$this->testSuiteLevel]++; + } + /** + * A warning occurred. + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + $this->doAddFault($test, $e, 'warning'); + $this->testSuiteWarnings[$this->testSuiteLevel]++; + } + /** + * A failure occurred. + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + $this->doAddFault($test, $e, 'failure'); + $this->testSuiteFailures[$this->testSuiteLevel]++; + } + /** + * Incomplete test. + */ + public function addIncompleteTest(Test $test, Throwable $t, float $time): void + { + $this->doAddSkipped(); + } + /** + * Risky test. + */ + public function addRiskyTest(Test $test, Throwable $t, float $time): void + { + if (!$this->reportRiskyTests) { + return; + } + $this->doAddFault($test, $t, 'error'); + $this->testSuiteErrors[$this->testSuiteLevel]++; + } + /** + * Skipped test. + */ + public function addSkippedTest(Test $test, Throwable $t, float $time): void + { + $this->doAddSkipped(); + } + /** + * A testsuite started. + */ + public function startTestSuite(TestSuite $suite): void + { + $testSuite = $this->document->createElement('testsuite'); + $testSuite->setAttribute('name', $suite->getName()); + if (class_exists($suite->getName(), \false)) { + try { + $class = new ReflectionClass($suite->getName()); + $testSuite->setAttribute('file', $class->getFileName()); + } catch (ReflectionException $e) { + } + } + if ($this->testSuiteLevel > 0) { + $this->testSuites[$this->testSuiteLevel]->appendChild($testSuite); + } else { + $this->root->appendChild($testSuite); + } + $this->testSuiteLevel++; + $this->testSuites[$this->testSuiteLevel] = $testSuite; + $this->testSuiteTests[$this->testSuiteLevel] = 0; + $this->testSuiteAssertions[$this->testSuiteLevel] = 0; + $this->testSuiteErrors[$this->testSuiteLevel] = 0; + $this->testSuiteWarnings[$this->testSuiteLevel] = 0; + $this->testSuiteFailures[$this->testSuiteLevel] = 0; + $this->testSuiteSkipped[$this->testSuiteLevel] = 0; + $this->testSuiteTimes[$this->testSuiteLevel] = 0; + } + /** + * A testsuite ended. + */ + public function endTestSuite(TestSuite $suite): void + { + $this->testSuites[$this->testSuiteLevel]->setAttribute('tests', (string) $this->testSuiteTests[$this->testSuiteLevel]); + $this->testSuites[$this->testSuiteLevel]->setAttribute('assertions', (string) $this->testSuiteAssertions[$this->testSuiteLevel]); + $this->testSuites[$this->testSuiteLevel]->setAttribute('errors', (string) $this->testSuiteErrors[$this->testSuiteLevel]); + $this->testSuites[$this->testSuiteLevel]->setAttribute('warnings', (string) $this->testSuiteWarnings[$this->testSuiteLevel]); + $this->testSuites[$this->testSuiteLevel]->setAttribute('failures', (string) $this->testSuiteFailures[$this->testSuiteLevel]); + $this->testSuites[$this->testSuiteLevel]->setAttribute('skipped', (string) $this->testSuiteSkipped[$this->testSuiteLevel]); + $this->testSuites[$this->testSuiteLevel]->setAttribute('time', sprintf('%F', $this->testSuiteTimes[$this->testSuiteLevel])); + if ($this->testSuiteLevel > 1) { + $this->testSuiteTests[$this->testSuiteLevel - 1] += $this->testSuiteTests[$this->testSuiteLevel]; + $this->testSuiteAssertions[$this->testSuiteLevel - 1] += $this->testSuiteAssertions[$this->testSuiteLevel]; + $this->testSuiteErrors[$this->testSuiteLevel - 1] += $this->testSuiteErrors[$this->testSuiteLevel]; + $this->testSuiteWarnings[$this->testSuiteLevel - 1] += $this->testSuiteWarnings[$this->testSuiteLevel]; + $this->testSuiteFailures[$this->testSuiteLevel - 1] += $this->testSuiteFailures[$this->testSuiteLevel]; + $this->testSuiteSkipped[$this->testSuiteLevel - 1] += $this->testSuiteSkipped[$this->testSuiteLevel]; + $this->testSuiteTimes[$this->testSuiteLevel - 1] += $this->testSuiteTimes[$this->testSuiteLevel]; + } + $this->testSuiteLevel--; + } + /** + * A test started. + */ + public function startTest(Test $test): void + { + $usesDataprovider = \false; + if (method_exists($test, 'usesDataProvider')) { + $usesDataprovider = $test->usesDataProvider(); + } + $testCase = $this->document->createElement('testcase'); + $testCase->setAttribute('name', $test->getName()); + try { + $class = new ReflectionClass($test); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $methodName = $test->getName(!$usesDataprovider); + if ($class->hasMethod($methodName)) { + try { + $method = $class->getMethod($methodName); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $testCase->setAttribute('class', $class->getName()); + $testCase->setAttribute('classname', str_replace('\\', '.', $class->getName())); + $testCase->setAttribute('file', $class->getFileName()); + $testCase->setAttribute('line', (string) $method->getStartLine()); + } + $this->currentTestCase = $testCase; + } + /** + * A test ended. + */ + public function endTest(Test $test, float $time): void + { + $numAssertions = 0; + if (method_exists($test, 'getNumAssertions')) { + $numAssertions = $test->getNumAssertions(); + } + $this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions; + $this->currentTestCase->setAttribute('assertions', (string) $numAssertions); + $this->currentTestCase->setAttribute('time', sprintf('%F', $time)); + $this->testSuites[$this->testSuiteLevel]->appendChild($this->currentTestCase); + $this->testSuiteTests[$this->testSuiteLevel]++; + $this->testSuiteTimes[$this->testSuiteLevel] += $time; + $testOutput = ''; + if (method_exists($test, 'hasOutput') && method_exists($test, 'getActualOutput')) { + $testOutput = $test->hasOutput() ? $test->getActualOutput() : ''; + } + if (!empty($testOutput)) { + $systemOut = $this->document->createElement('system-out', Xml::prepareString($testOutput)); + $this->currentTestCase->appendChild($systemOut); + } + $this->currentTestCase = null; + } + /** + * Returns the XML as a string. + */ + public function getXML(): string + { + return $this->document->saveXML(); + } + private function doAddFault(Test $test, Throwable $t, string $type): void + { + if ($this->currentTestCase === null) { + return; + } + if ($test instanceof SelfDescribing) { + $buffer = $test->toString() . "\n"; + } else { + $buffer = ''; + } + $buffer .= trim(TestFailure::exceptionToString($t) . "\n" . Filter::getFilteredStacktrace($t)); + $fault = $this->document->createElement($type, Xml::prepareString($buffer)); + if ($t instanceof ExceptionWrapper) { + $fault->setAttribute('type', $t->getClassName()); + } else { + $fault->setAttribute('type', get_class($t)); + } + $this->currentTestCase->appendChild($fault); + } + private function doAddSkipped(): void + { + if ($this->currentTestCase === null) { + return; + } + $skipped = $this->document->createElement('skipped'); + $this->currentTestCase->appendChild($skipped); + $this->testSuiteSkipped[$this->testSuiteLevel]++; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Log; + +use function class_exists; +use function count; +use function explode; +use function get_class; +use function getmypid; +use function ini_get; +use function is_bool; +use function is_scalar; +use function method_exists; +use function print_r; +use function round; +use function str_replace; +use function stripos; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\ExceptionWrapper; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestResult; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\TextUI\DefaultResultPrinter; +use PHPUnit\Util\Exception; +use PHPUnit\Util\Filter; +use ReflectionClass; +use ReflectionException; +use PHPUnitPHAR\SebastianBergmann\Comparator\ComparisonFailure; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class TeamCity extends DefaultResultPrinter +{ + /** + * @var bool + */ + private $isSummaryTestCountPrinted = \false; + /** + * @var string + */ + private $startedTestName; + /** + * @var false|int + */ + private $flowId; + public function printResult(TestResult $result): void + { + $this->printHeader($result); + $this->printFooter($result); + } + /** + * An error occurred. + */ + public function addError(Test $test, Throwable $t, float $time): void + { + $this->printEvent('testFailed', ['name' => $test->getName(), 'message' => self::getMessage($t), 'details' => self::getDetails($t), 'duration' => self::toMilliseconds($time)]); + } + /** + * A warning occurred. + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + $this->write(self::getMessage($e) . \PHP_EOL); + } + /** + * A failure occurred. + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + $parameters = ['name' => $test->getName(), 'message' => self::getMessage($e), 'details' => self::getDetails($e), 'duration' => self::toMilliseconds($time)]; + if ($e instanceof ExpectationFailedException) { + $comparisonFailure = $e->getComparisonFailure(); + if ($comparisonFailure instanceof ComparisonFailure) { + $expectedString = $comparisonFailure->getExpectedAsString(); + if ($expectedString === null || empty($expectedString)) { + $expectedString = self::getPrimitiveValueAsString($comparisonFailure->getExpected()); } - $writer->endElement(); - } elseif ($test instanceof PhptTestCase) { - if ($currentTestCase !== null) { - $writer->endElement(); - $currentTestCase = null; + $actualString = $comparisonFailure->getActualAsString(); + if ($actualString === null || empty($actualString)) { + $actualString = self::getPrimitiveValueAsString($comparisonFailure->getActual()); + } + if ($actualString !== null && $expectedString !== null) { + $parameters['type'] = 'comparisonFailure'; + $parameters['actual'] = $actualString; + $parameters['expected'] = $expectedString; } - $writer->startElement('phptFile'); - $writer->writeAttribute('path', $test->getName()); - $writer->endElement(); } } - if ($currentTestCase !== null) { - $writer->endElement(); + $this->printEvent('testFailed', $parameters); + } + /** + * Incomplete test. + */ + public function addIncompleteTest(Test $test, Throwable $t, float $time): void + { + $this->printIgnoredTest($test->getName(), $t, $time); + } + /** + * Risky test. + */ + public function addRiskyTest(Test $test, Throwable $t, float $time): void + { + $this->addError($test, $t, $time); + } + /** + * Skipped test. + */ + public function addSkippedTest(Test $test, Throwable $t, float $time): void + { + $testName = $test->getName(); + if ($this->startedTestName !== $testName) { + $this->startTest($test); + $this->printIgnoredTest($testName, $t, $time); + $this->endTest($test, $time); + } else { + $this->printIgnoredTest($testName, $t, $time); } - $writer->endElement(); - $writer->endDocument(); - return $writer->outputMemory(); } -} - - - - - phpunit - phpunit - 9.6.13 - The PHP Unit Testing framework. - - - BSD-3-Clause - - - pkg:composer/phpunit/phpunit@9.6.13 - - - doctrine - instantiator - 1.5.0 - A small, lightweight utility to instantiate objects in PHP without invoking their constructors - - - MIT - - - pkg:composer/doctrine/instantiator@1.5.0 - - - myclabs - deep-copy - 1.11.1 - Create deep copies (clones) of your objects - - - MIT - - - pkg:composer/myclabs/deep-copy@1.11.1 - - - nikic - php-parser - v4.17.1 - A PHP parser written in PHP - - - BSD-3-Clause - - - pkg:composer/nikic/php-parser@v4.17.1 - - - phar-io - manifest - 2.0.3 - Component for reading phar.io manifest information from a PHP Archive (PHAR) - - - BSD-3-Clause - - - pkg:composer/phar-io/manifest@2.0.3 - - - phar-io - version - 3.2.1 - Library for handling version information and constraints - - - BSD-3-Clause - - - pkg:composer/phar-io/version@3.2.1 - - - phpdocumentor - reflection-common - 2.2.0 - Common reflection classes used by phpdocumentor to reflect the code structure - - - MIT - - - pkg:composer/phpdocumentor/reflection-common@2.2.0 - - - phpdocumentor - reflection-docblock - 5.3.0 - With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock. - - - MIT - - - pkg:composer/phpdocumentor/reflection-docblock@5.3.0 - - - phpdocumentor - type-resolver - 1.6.1 - A PSR-5 based resolver of Class names, Types and Structural Element Names - - - MIT - - - pkg:composer/phpdocumentor/type-resolver@1.6.1 - - - phpspec - prophecy - v1.17.0 - Highly opinionated mocking framework for PHP 5.3+ - - - MIT - - - pkg:composer/phpspec/prophecy@v1.17.0 - - - phpunit - php-code-coverage - 9.2.29 - Library that provides collection, processing, and rendering functionality for PHP code coverage information. - - - BSD-3-Clause - - - pkg:composer/phpunit/php-code-coverage@9.2.29 - - - phpunit - php-file-iterator - 3.0.6 - FilterIterator implementation that filters files based on a list of suffixes. + public function printIgnoredTest(string $testName, Throwable $t, float $time): void + { + $this->printEvent('testIgnored', ['name' => $testName, 'message' => self::getMessage($t), 'details' => self::getDetails($t), 'duration' => self::toMilliseconds($time)]); + } + /** + * A testsuite started. + */ + public function startTestSuite(TestSuite $suite): void + { + if (stripos(ini_get('disable_functions'), 'getmypid') === \false) { + $this->flowId = getmypid(); + } else { + $this->flowId = \false; + } + if (!$this->isSummaryTestCountPrinted) { + $this->isSummaryTestCountPrinted = \true; + $this->printEvent('testCount', ['count' => count($suite)]); + } + $suiteName = $suite->getName(); + if (empty($suiteName)) { + return; + } + $parameters = ['name' => $suiteName]; + if (class_exists($suiteName, \false)) { + $fileName = self::getFileName($suiteName); + $parameters['locationHint'] = "php_qn://{$fileName}::\\{$suiteName}"; + } else { + $split = explode('::', $suiteName); + if (count($split) === 2 && class_exists($split[0]) && method_exists($split[0], $split[1])) { + $fileName = self::getFileName($split[0]); + $parameters['locationHint'] = "php_qn://{$fileName}::\\{$suiteName}"; + $parameters['name'] = $split[1]; + } + } + $this->printEvent('testSuiteStarted', $parameters); + } + /** + * A testsuite ended. + */ + public function endTestSuite(TestSuite $suite): void + { + $suiteName = $suite->getName(); + if (empty($suiteName)) { + return; + } + $parameters = ['name' => $suiteName]; + if (!class_exists($suiteName, \false)) { + $split = explode('::', $suiteName); + if (count($split) === 2 && class_exists($split[0]) && method_exists($split[0], $split[1])) { + $parameters['name'] = $split[1]; + } + } + $this->printEvent('testSuiteFinished', $parameters); + } + /** + * A test started. + */ + public function startTest(Test $test): void + { + $testName = $test->getName(); + $this->startedTestName = $testName; + $params = ['name' => $testName]; + if ($test instanceof TestCase) { + $className = get_class($test); + $fileName = self::getFileName($className); + $params['locationHint'] = "php_qn://{$fileName}::\\{$className}::{$testName}"; + } + $this->printEvent('testStarted', $params); + } + /** + * A test ended. + */ + public function endTest(Test $test, float $time): void + { + parent::endTest($test, $time); + $this->printEvent('testFinished', ['name' => $test->getName(), 'duration' => self::toMilliseconds($time)]); + } + protected function writeProgress(string $progress): void + { + } + private function printEvent(string $eventName, array $params = []): void + { + $this->write("\n##teamcity[{$eventName}"); + if ($this->flowId) { + $params['flowId'] = $this->flowId; + } + foreach ($params as $key => $value) { + $escapedValue = self::escapeValue((string) $value); + $this->write(" {$key}='{$escapedValue}'"); + } + $this->write("]\n"); + } + private static function getMessage(Throwable $t): string + { + $message = ''; + if ($t instanceof ExceptionWrapper) { + if ($t->getClassName() !== '') { + $message .= $t->getClassName(); + } + if ($message !== '' && $t->getMessage() !== '') { + $message .= ' : '; + } + } + return $message . $t->getMessage(); + } + private static function getDetails(Throwable $t): string + { + $stackTrace = Filter::getFilteredStacktrace($t); + $previous = ($t instanceof ExceptionWrapper) ? $t->getPreviousWrapped() : $t->getPrevious(); + while ($previous) { + $stackTrace .= "\nCaused by\n" . TestFailure::exceptionToString($previous) . "\n" . Filter::getFilteredStacktrace($previous); + $previous = ($previous instanceof ExceptionWrapper) ? $previous->getPreviousWrapped() : $previous->getPrevious(); + } + return ' ' . str_replace("\n", "\n ", $stackTrace); + } + private static function getPrimitiveValueAsString($value): ?string + { + if ($value === null) { + return 'null'; + } + if (is_bool($value)) { + return $value ? 'true' : 'false'; + } + if (is_scalar($value)) { + return print_r($value, \true); + } + return null; + } + private static function escapeValue(string $text): string + { + return str_replace(['|', "'", "\n", "\r", ']', '['], ['||', "|'", '|n', '|r', '|]', '|['], $text); + } + /** + * @param string $className + */ + private static function getFileName($className): string + { + try { + return (new ReflectionClass($className))->getFileName(); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + } + /** + * @param float $time microseconds + */ + private static function toMilliseconds(float $time): int + { + return (int) round($time * 1000); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\PHP; + +use const DIRECTORY_SEPARATOR; +use const PHP_SAPI; +use function array_keys; +use function array_merge; +use function assert; +use function escapeshellarg; +use function file_exists; +use function file_get_contents; +use function ini_get_all; +use function restore_error_handler; +use function set_error_handler; +use function sprintf; +use function str_replace; +use function strpos; +use function strrpos; +use function substr; +use function trim; +use function unlink; +use function unserialize; +use __PHP_Incomplete_Class; +use ErrorException; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\SyntheticError; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestResult; +use PHPUnitPHAR\SebastianBergmann\Environment\Runtime; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +abstract class AbstractPhpProcess +{ + /** + * @var Runtime + */ + protected $runtime; + /** + * @var bool + */ + protected $stderrRedirection = \false; + /** + * @var string + */ + protected $stdin = ''; + /** + * @var string + */ + protected $args = ''; + /** + * @var array + */ + protected $env = []; + /** + * @var int + */ + protected $timeout = 0; + public static function factory(): self + { + if (DIRECTORY_SEPARATOR === '\\') { + return new \PHPUnit\Util\PHP\WindowsPhpProcess(); + } + return new \PHPUnit\Util\PHP\DefaultPhpProcess(); + } + public function __construct() + { + $this->runtime = new Runtime(); + } + /** + * Defines if should use STDERR redirection or not. + * + * Then $stderrRedirection is TRUE, STDERR is redirected to STDOUT. + */ + public function setUseStderrRedirection(bool $stderrRedirection): void + { + $this->stderrRedirection = $stderrRedirection; + } + /** + * Returns TRUE if uses STDERR redirection or FALSE if not. + */ + public function useStderrRedirection(): bool + { + return $this->stderrRedirection; + } + /** + * Sets the input string to be sent via STDIN. + */ + public function setStdin(string $stdin): void + { + $this->stdin = $stdin; + } + /** + * Returns the input string to be sent via STDIN. + */ + public function getStdin(): string + { + return $this->stdin; + } + /** + * Sets the string of arguments to pass to the php job. + */ + public function setArgs(string $args): void + { + $this->args = $args; + } + /** + * Returns the string of arguments to pass to the php job. + */ + public function getArgs(): string + { + return $this->args; + } + /** + * Sets the array of environment variables to start the child process with. + * + * @param array $env + */ + public function setEnv(array $env): void + { + $this->env = $env; + } + /** + * Returns the array of environment variables to start the child process with. + */ + public function getEnv(): array + { + return $this->env; + } + /** + * Sets the amount of seconds to wait before timing out. + */ + public function setTimeout(int $timeout): void + { + $this->timeout = $timeout; + } + /** + * Returns the amount of seconds to wait before timing out. + */ + public function getTimeout(): int + { + return $this->timeout; + } + /** + * Runs a single test in a separate PHP process. + * + * @throws InvalidArgumentException + */ + public function runTestJob(string $job, Test $test, TestResult $result, string $processResultFile): void + { + $result->startTest($test); + $processResult = ''; + $_result = $this->runJob($job); + if (file_exists($processResultFile)) { + $processResult = file_get_contents($processResultFile); + @unlink($processResultFile); + } + $this->processChildResult($test, $result, $processResult, $_result['stderr']); + } + /** + * Returns the command based into the configurations. + */ + public function getCommand(array $settings, ?string $file = null): string + { + $command = $this->runtime->getBinary(); + if ($this->runtime->hasPCOV()) { + $settings = array_merge($settings, $this->runtime->getCurrentSettings(array_keys(ini_get_all('pcov')))); + } elseif ($this->runtime->hasXdebug()) { + $settings = array_merge($settings, $this->runtime->getCurrentSettings(array_keys(ini_get_all('xdebug')))); + } + $command .= $this->settingsToParameters($settings); + if (PHP_SAPI === 'phpdbg') { + $command .= ' -qrr'; + if (!$file) { + $command .= 's='; + } + } + if ($file) { + $command .= ' ' . escapeshellarg($file); + } + if ($this->args) { + if (!$file) { + $command .= ' --'; + } + $command .= ' ' . $this->args; + } + if ($this->stderrRedirection) { + $command .= ' 2>&1'; + } + return $command; + } + /** + * Runs a single job (PHP code) using a separate PHP process. + */ + abstract public function runJob(string $job, array $settings = []): array; + protected function settingsToParameters(array $settings): string + { + $buffer = ''; + foreach ($settings as $setting) { + $buffer .= ' -d ' . escapeshellarg($setting); + } + return $buffer; + } + /** + * Processes the TestResult object from an isolated process. + * + * @throws InvalidArgumentException + */ + private function processChildResult(Test $test, TestResult $result, string $stdout, string $stderr): void + { + $time = 0; + if (!empty($stderr)) { + $result->addError($test, new Exception(trim($stderr)), $time); + } else { + set_error_handler( + /** + * @throws ErrorException + */ + static function ($errno, $errstr, $errfile, $errline): void { + throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); + } + ); + try { + if (strpos($stdout, "#!/usr/bin/env php\n") === 0) { + $stdout = substr($stdout, 19); + } + $childResult = unserialize(str_replace("#!/usr/bin/env php\n", '', $stdout)); + restore_error_handler(); + if ($childResult === \false) { + $result->addFailure($test, new AssertionFailedError('Test was run in child process and ended unexpectedly'), $time); + } + } catch (ErrorException $e) { + restore_error_handler(); + $childResult = \false; + $result->addError($test, new Exception(trim($stdout), 0, $e), $time); + } + if ($childResult !== \false) { + if (!empty($childResult['output'])) { + $output = $childResult['output']; + } + /* @var TestCase $test */ + $test->setResult($childResult['testResult']); + $test->addToAssertionCount($childResult['numAssertions']); + $childResult = $childResult['result']; + assert($childResult instanceof TestResult); + if ($result->getCollectCodeCoverageInformation()) { + $result->getCodeCoverage()->merge($childResult->getCodeCoverage()); + } + $time = $childResult->time(); + $notImplemented = $childResult->notImplemented(); + $risky = $childResult->risky(); + $skipped = $childResult->skipped(); + $errors = $childResult->errors(); + $warnings = $childResult->warnings(); + $failures = $childResult->failures(); + if (!empty($notImplemented)) { + $result->addError($test, $this->getException($notImplemented[0]), $time); + } elseif (!empty($risky)) { + $result->addError($test, $this->getException($risky[0]), $time); + } elseif (!empty($skipped)) { + $result->addError($test, $this->getException($skipped[0]), $time); + } elseif (!empty($errors)) { + $result->addError($test, $this->getException($errors[0]), $time); + } elseif (!empty($warnings)) { + $result->addWarning($test, $this->getException($warnings[0]), $time); + } elseif (!empty($failures)) { + $result->addFailure($test, $this->getException($failures[0]), $time); + } + } + } + $result->endTest($test, $time); + if (!empty($output)) { + print $output; + } + } + /** + * Gets the thrown exception from a PHPUnit\Framework\TestFailure. + * + * @see https://github.com/sebastianbergmann/phpunit/issues/74 + */ + private function getException(TestFailure $error): Exception + { + $exception = $error->thrownException(); + if ($exception instanceof __PHP_Incomplete_Class) { + $exceptionArray = []; + foreach ((array) $exception as $key => $value) { + $key = substr($key, strrpos($key, "\x00") + 1); + $exceptionArray[$key] = $value; + } + $exception = new SyntheticError(sprintf('%s: %s', $exceptionArray['_PHP_Incomplete_Class_Name'], $exceptionArray['message']), $exceptionArray['code'], $exceptionArray['file'], $exceptionArray['line'], $exceptionArray['trace']); + } + return $exception; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\PHP; + +use function array_merge; +use function fclose; +use function file_put_contents; +use function fread; +use function fwrite; +use function is_array; +use function is_resource; +use function proc_close; +use function proc_open; +use function proc_terminate; +use function rewind; +use function sprintf; +use function stream_get_contents; +use function stream_select; +use function sys_get_temp_dir; +use function tempnam; +use function unlink; +use PHPUnit\Framework\Exception; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +class DefaultPhpProcess extends \PHPUnit\Util\PHP\AbstractPhpProcess +{ + /** + * @var string + */ + protected $tempFile; + /** + * Runs a single job (PHP code) using a separate PHP process. + * + * @throws Exception + */ + public function runJob(string $job, array $settings = []): array + { + if ($this->stdin || $this->useTemporaryFile()) { + if (!($this->tempFile = tempnam(sys_get_temp_dir(), 'PHPUnit')) || file_put_contents($this->tempFile, $job) === \false) { + throw new Exception('Unable to write temporary file'); + } + $job = $this->stdin; + } + return $this->runProcess($job, $settings); + } + /** + * Returns an array of file handles to be used in place of pipes. + */ + protected function getHandles(): array + { + return []; + } + /** + * Handles creating the child process and returning the STDOUT and STDERR. + * + * @throws Exception + */ + protected function runProcess(string $job, array $settings): array + { + $handles = $this->getHandles(); + $env = null; + if ($this->env) { + $env = $_SERVER ?? []; + unset($env['argv'], $env['argc']); + $env = array_merge($env, $this->env); + foreach ($env as $envKey => $envVar) { + if (is_array($envVar)) { + unset($env[$envKey]); + } + } + } + $pipeSpec = [0 => $handles[0] ?? ['pipe', 'r'], 1 => $handles[1] ?? ['pipe', 'w'], 2 => $handles[2] ?? ['pipe', 'w']]; + $process = proc_open($this->getCommand($settings, $this->tempFile), $pipeSpec, $pipes, null, $env); + if (!is_resource($process)) { + throw new Exception('Unable to spawn worker process'); + } + if ($job) { + $this->process($pipes[0], $job); + } + fclose($pipes[0]); + $stderr = $stdout = ''; + if ($this->timeout) { + unset($pipes[0]); + while (\true) { + $r = $pipes; + $w = null; + $e = null; + $n = @stream_select($r, $w, $e, $this->timeout); + if ($n === \false) { + break; + } + if ($n === 0) { + proc_terminate($process, 9); + throw new Exception(sprintf('Job execution aborted after %d seconds', $this->timeout)); + } + if ($n > 0) { + foreach ($r as $pipe) { + $pipeOffset = 0; + foreach ($pipes as $i => $origPipe) { + if ($pipe === $origPipe) { + $pipeOffset = $i; + break; + } + } + if (!$pipeOffset) { + break; + } + $line = fread($pipe, 8192); + if ($line === '' || $line === \false) { + fclose($pipes[$pipeOffset]); + unset($pipes[$pipeOffset]); + } elseif ($pipeOffset === 1) { + $stdout .= $line; + } else { + $stderr .= $line; + } + } + if (empty($pipes)) { + break; + } + } + } + } else { + if (isset($pipes[1])) { + $stdout = stream_get_contents($pipes[1]); + fclose($pipes[1]); + } + if (isset($pipes[2])) { + $stderr = stream_get_contents($pipes[2]); + fclose($pipes[2]); + } + } + if (isset($handles[1])) { + rewind($handles[1]); + $stdout = stream_get_contents($handles[1]); + fclose($handles[1]); + } + if (isset($handles[2])) { + rewind($handles[2]); + $stderr = stream_get_contents($handles[2]); + fclose($handles[2]); + } + proc_close($process); + $this->cleanup(); + return ['stdout' => $stdout, 'stderr' => $stderr]; + } + /** + * @param resource $pipe + */ + protected function process($pipe, string $job): void + { + fwrite($pipe, $job); + } + protected function cleanup(): void + { + if ($this->tempFile) { + unlink($this->tempFile); + } + } + protected function useTemporaryFile(): bool + { + return \false; + } +} +{driverMethod}($filter), + $filter + ); + + if ({codeCoverageCacheDirectory}) { + $coverage->cacheStaticAnalysis({codeCoverageCacheDirectory}); + } + + $coverage->start(__FILE__); +} + +register_shutdown_function( + function() use ($coverage) { + $output = null; + + if ($coverage) { + $output = $coverage->stop(); + } + + file_put_contents('{coverageFile}', serialize($output)); + } +); + +ob_end_clean(); + +require '{job}'; +{driverMethod}($filter), + $filter + ); + + if ({cachesStaticAnalysis}) { + $codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}')); + } + + $result->setCodeCoverage($codeCoverage); + } + + $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything}); + $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests}); + $result->enforceTimeLimit({enforcesTimeLimit}); + $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests}); + $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests}); + + $test = new {className}('{name}', unserialize('{data}'), '{dataName}'); + $test->setDependencyInput(unserialize('{dependencyInput}')); + $test->setInIsolation(true); + + ob_end_clean(); + $test->run($result); + $output = ''; + if (!$test->hasExpectationOnOutput()) { + $output = $test->getActualOutput(); + } + + ini_set('xdebug.scream', '0'); + + @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ + if ($stdout = @stream_get_contents(STDOUT)) { + $output = $stdout . $output; + $streamMetaData = stream_get_meta_data(STDOUT); + if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) { + @ftruncate(STDOUT, 0); + @rewind(STDOUT); + } + } + + file_put_contents( + '{processResultFile}', + serialize( + [ + 'testResult' => $test->getResult(), + 'numAssertions' => $test->getNumAssertions(), + 'result' => $result, + 'output' => $output + ] + ) + ); +} + +$configurationFilePath = '{configurationFilePath}'; + +if ('' !== $configurationFilePath) { + $configuration = (new Loader)->load($configurationFilePath); + + (new PhpHandler)->handle($configuration->php()); + + unset($configuration); +} + +function __phpunit_error_handler($errno, $errstr, $errfile, $errline) +{ + return true; +} + +set_error_handler('__phpunit_error_handler'); + +{constants} +{included_files} +{globals} + +restore_error_handler(); + +if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { + require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; + unset($GLOBALS['__PHPUNIT_BOOTSTRAP']); +} + +__phpunit_run_isolated_test(); +{driverMethod}($filter), + $filter + ); + + if ({cachesStaticAnalysis}) { + $codeCoverage->cacheStaticAnalysis(unserialize('{codeCoverageCacheDirectory}')); + } + + $result->setCodeCoverage($codeCoverage); + } + + $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything}); + $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests}); + $result->enforceTimeLimit({enforcesTimeLimit}); + $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests}); + $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests}); + + $test = new {className}('{methodName}', unserialize('{data}'), '{dataName}'); + \assert($test instanceof TestCase); + + $test->setDependencyInput(unserialize('{dependencyInput}')); + $test->setInIsolation(true); + + ob_end_clean(); + $test->run($result); + $output = ''; + if (!$test->hasExpectationOnOutput()) { + $output = $test->getActualOutput(); + } + + ini_set('xdebug.scream', '0'); + + @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ + if ($stdout = @stream_get_contents(STDOUT)) { + $output = $stdout . $output; + $streamMetaData = stream_get_meta_data(STDOUT); + if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) { + @ftruncate(STDOUT, 0); + @rewind(STDOUT); + } + } + + file_put_contents( + '{processResultFile}', + serialize( + [ + 'testResult' => $test->getResult(), + 'numAssertions' => $test->getNumAssertions(), + 'result' => $result, + 'output' => $output + ] + ) + ); +} + +$configurationFilePath = '{configurationFilePath}'; + +if ('' !== $configurationFilePath) { + $configuration = (new Loader)->load($configurationFilePath); + + (new PhpHandler)->handle($configuration->php()); + + unset($configuration); +} + +function __phpunit_error_handler($errno, $errstr, $errfile, $errline) +{ + return true; +} + +set_error_handler('__phpunit_error_handler'); + +{constants} +{included_files} +{globals} + +restore_error_handler(); + +if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { + require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; + unset($GLOBALS['__PHPUNIT_BOOTSTRAP']); +} + +__phpunit_run_isolated_test(); + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\PHP; + +use const PHP_MAJOR_VERSION; +use function tmpfile; +use PHPUnit\Framework\Exception; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @see https://bugs.php.net/bug.php?id=51800 + */ +final class WindowsPhpProcess extends \PHPUnit\Util\PHP\DefaultPhpProcess +{ + public function getCommand(array $settings, ?string $file = null): string + { + if (PHP_MAJOR_VERSION < 8) { + return '"' . parent::getCommand($settings, $file) . '"'; + } + return parent::getCommand($settings, $file); + } + /** + * @throws Exception + */ + protected function getHandles(): array + { + if (\false === $stdout_handle = tmpfile()) { + throw new Exception('A temporary file could not be created; verify that your TEMP environment variable is writable'); + } + return [1 => $stdout_handle]; + } + protected function useTemporaryFile(): bool + { + return \true; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use const ENT_COMPAT; +use const ENT_SUBSTITUTE; +use const PHP_SAPI; +use function assert; +use function count; +use function dirname; +use function explode; +use function fclose; +use function fopen; +use function fsockopen; +use function fwrite; +use function htmlspecialchars; +use function is_resource; +use function is_string; +use function sprintf; +use function str_replace; +use function strncmp; +use function strpos; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +class Printer +{ + /** + * @psalm-var closed-resource|resource + */ + private $stream; + /** + * @var bool + */ + private $isPhpStream; + /** + * @param null|resource|string $out + * + * @throws Exception + */ + public function __construct($out = null) + { + if (is_resource($out)) { + $this->stream = $out; + return; + } + if (!is_string($out)) { + return; + } + if (strpos($out, 'socket://') === 0) { + $tmp = explode(':', str_replace('socket://', '', $out)); + if (count($tmp) !== 2) { + throw new \PHPUnit\Util\Exception(sprintf('"%s" does not match "socket://hostname:port" format', $out)); + } + $this->stream = fsockopen($tmp[0], (int) $tmp[1]); + return; + } + if (strpos($out, 'php://') === \false && !\PHPUnit\Util\Filesystem::createDirectory(dirname($out))) { + throw new \PHPUnit\Util\Exception(sprintf('Directory "%s" was not created', dirname($out))); + } + $this->stream = fopen($out, 'wb'); + $this->isPhpStream = strncmp($out, 'php://', 6) !== 0; + } + public function write(string $buffer): void + { + if ($this->stream) { + assert(is_resource($this->stream)); + fwrite($this->stream, $buffer); + } else { + if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { + $buffer = htmlspecialchars($buffer, ENT_COMPAT | ENT_SUBSTITUTE); + } + print $buffer; + } + } + public function flush(): void + { + if ($this->stream && $this->isPhpStream) { + assert(is_resource($this->stream)); + fclose($this->stream); + } + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PHPUnit\Framework\Assert; +use PHPUnit\Framework\TestCase; +use ReflectionClass; +use ReflectionMethod; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Reflection +{ + /** + * @psalm-return list + */ + public function publicMethodsInTestClass(ReflectionClass $class): array + { + return $this->filterMethods($class, ReflectionMethod::IS_PUBLIC); + } + /** + * @psalm-return list + */ + public function methodsInTestClass(ReflectionClass $class): array + { + return $this->filterMethods($class, null); + } + /** + * @psalm-return list + */ + private function filterMethods(ReflectionClass $class, ?int $filter): array + { + $methods = []; + // PHP <7.3.5 throw error when null is passed + // to ReflectionClass::getMethods() when strict_types is enabled. + $classMethods = ($filter === null) ? $class->getMethods() : $class->getMethods($filter); + foreach ($classMethods as $method) { + if ($method->getDeclaringClass()->getName() === TestCase::class) { + continue; + } + if ($method->getDeclaringClass()->getName() === Assert::class) { + continue; + } + $methods[] = $method; + } + return $methods; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use function preg_match; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class RegularExpression +{ + /** + * @return false|int + */ + public static function safeMatch(string $pattern, string $subject) + { + return \PHPUnit\Util\ErrorHandler::invokeIgnoringWarnings(static function () use ($pattern, $subject) { + return preg_match($pattern, $subject); + }); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use const PHP_OS; +use const PHP_VERSION; +use function addcslashes; +use function array_flip; +use function array_key_exists; +use function array_merge; +use function array_unique; +use function array_unshift; +use function class_exists; +use function count; +use function explode; +use function extension_loaded; +use function function_exists; +use function get_class; +use function ini_get; +use function interface_exists; +use function is_array; +use function is_int; +use function method_exists; +use function phpversion; +use function preg_match; +use function preg_replace; +use function sprintf; +use function strncmp; +use function strpos; +use function strtolower; +use function trim; +use function version_compare; +use PHPUnit\Framework\CodeCoverageException; +use PHPUnit\Framework\ExecutionOrderDependency; +use PHPUnit\Framework\InvalidCoversTargetException; +use PHPUnit\Framework\SelfDescribing; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Warning; +use PHPUnit\Runner\Version; +use PHPUnit\Util\Annotation\Registry; +use ReflectionClass; +use ReflectionException; +use ReflectionMethod; +use PHPUnitPHAR\SebastianBergmann\CodeUnit\CodeUnitCollection; +use PHPUnitPHAR\SebastianBergmann\CodeUnit\InvalidCodeUnitException; +use PHPUnitPHAR\SebastianBergmann\CodeUnit\Mapper; +use PHPUnitPHAR\SebastianBergmann\Environment\OperatingSystem; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Test +{ + /** + * @var int + */ + public const UNKNOWN = -1; + /** + * @var int + */ + public const SMALL = 0; + /** + * @var int + */ + public const MEDIUM = 1; + /** + * @var int + */ + public const LARGE = 2; + /** + * @var array + */ + private static $hookMethods = []; + /** + * @throws InvalidArgumentException + */ + public static function describe(\PHPUnit\Framework\Test $test): array + { + if ($test instanceof TestCase) { + return [get_class($test), $test->getName()]; + } + if ($test instanceof SelfDescribing) { + return ['', $test->toString()]; + } + return ['', get_class($test)]; + } + public static function describeAsString(\PHPUnit\Framework\Test $test): string + { + if ($test instanceof SelfDescribing) { + return $test->toString(); + } + return get_class($test); + } + /** + * @throws CodeCoverageException + * + * @return array|bool + * + * @psalm-param class-string $className + */ + public static function getLinesToBeCovered(string $className, string $methodName) + { + $annotations = self::parseTestMethodAnnotations($className, $methodName); + if (!self::shouldCoversAnnotationBeUsed($annotations)) { + return \false; + } + return self::getLinesToBeCoveredOrUsed($className, $methodName, 'covers'); + } + /** + * Returns lines of code specified with the @uses annotation. + * + * @throws CodeCoverageException + * + * @psalm-param class-string $className + */ + public static function getLinesToBeUsed(string $className, string $methodName): array + { + return self::getLinesToBeCoveredOrUsed($className, $methodName, 'uses'); + } + public static function requiresCodeCoverageDataCollection(TestCase $test): bool + { + $annotations = self::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); + // If there is no @covers annotation but a @coversNothing annotation on + // the test method then code coverage data does not need to be collected + if (isset($annotations['method']['coversNothing'])) { + // @see https://github.com/sebastianbergmann/phpunit/issues/4947#issuecomment-1084480950 + // return false; + } + // If there is at least one @covers annotation then + // code coverage data needs to be collected + if (isset($annotations['method']['covers'])) { + return \true; + } + // If there is no @covers annotation but a @coversNothing annotation + // then code coverage data does not need to be collected + if (isset($annotations['class']['coversNothing'])) { + // @see https://github.com/sebastianbergmann/phpunit/issues/4947#issuecomment-1084480950 + // return false; + } + // If there is no @coversNothing annotation then + // code coverage data may be collected + return \true; + } + /** + * @throws Exception + * + * @psalm-param class-string $className + */ + public static function getRequirements(string $className, string $methodName): array + { + return self::mergeArraysRecursively(Registry::getInstance()->forClassName($className)->requirements(), Registry::getInstance()->forMethod($className, $methodName)->requirements()); + } + /** + * Returns the missing requirements for a test. + * + * @throws Exception + * @throws Warning + * + * @psalm-param class-string $className + */ + public static function getMissingRequirements(string $className, string $methodName): array + { + $required = self::getRequirements($className, $methodName); + $missing = []; + $hint = null; + if (!empty($required['PHP'])) { + $operator = new \PHPUnit\Util\VersionComparisonOperator(empty($required['PHP']['operator']) ? '>=' : $required['PHP']['operator']); + if (!version_compare(PHP_VERSION, $required['PHP']['version'], $operator->asString())) { + $missing[] = sprintf('PHP %s %s is required.', $operator->asString(), $required['PHP']['version']); + $hint = 'PHP'; + } + } elseif (!empty($required['PHP_constraint'])) { + $version = new \PHPUnitPHAR\PharIo\Version\Version(self::sanitizeVersionNumber(PHP_VERSION)); + if (!$required['PHP_constraint']['constraint']->complies($version)) { + $missing[] = sprintf('PHP version does not match the required constraint %s.', $required['PHP_constraint']['constraint']->asString()); + $hint = 'PHP_constraint'; + } + } + if (!empty($required['PHPUnit'])) { + $phpunitVersion = Version::id(); + $operator = new \PHPUnit\Util\VersionComparisonOperator(empty($required['PHPUnit']['operator']) ? '>=' : $required['PHPUnit']['operator']); + if (!version_compare($phpunitVersion, $required['PHPUnit']['version'], $operator->asString())) { + $missing[] = sprintf('PHPUnit %s %s is required.', $operator->asString(), $required['PHPUnit']['version']); + $hint = $hint ?? 'PHPUnit'; + } + } elseif (!empty($required['PHPUnit_constraint'])) { + $phpunitVersion = new \PHPUnitPHAR\PharIo\Version\Version(self::sanitizeVersionNumber(Version::id())); + if (!$required['PHPUnit_constraint']['constraint']->complies($phpunitVersion)) { + $missing[] = sprintf('PHPUnit version does not match the required constraint %s.', $required['PHPUnit_constraint']['constraint']->asString()); + $hint = $hint ?? 'PHPUnit_constraint'; + } + } + if (!empty($required['OSFAMILY']) && $required['OSFAMILY'] !== (new OperatingSystem())->getFamily()) { + $missing[] = sprintf('Operating system %s is required.', $required['OSFAMILY']); + $hint = $hint ?? 'OSFAMILY'; + } + if (!empty($required['OS'])) { + $requiredOsPattern = sprintf('/%s/i', addcslashes($required['OS'], '/')); + if (!preg_match($requiredOsPattern, PHP_OS)) { + $missing[] = sprintf('Operating system matching %s is required.', $requiredOsPattern); + $hint = $hint ?? 'OS'; + } + } + if (!empty($required['functions'])) { + foreach ($required['functions'] as $function) { + $pieces = explode('::', $function); + if (count($pieces) === 2 && class_exists($pieces[0]) && method_exists($pieces[0], $pieces[1])) { + continue; + } + if (function_exists($function)) { + continue; + } + $missing[] = sprintf('Function %s is required.', $function); + $hint = $hint ?? 'function_' . $function; + } + } + if (!empty($required['setting'])) { + foreach ($required['setting'] as $setting => $value) { + if (ini_get($setting) !== $value) { + $missing[] = sprintf('Setting "%s" must be "%s".', $setting, $value); + $hint = $hint ?? '__SETTING_' . $setting; + } + } + } + if (!empty($required['extensions'])) { + foreach ($required['extensions'] as $extension) { + if (isset($required['extension_versions'][$extension])) { + continue; + } + if (!extension_loaded($extension)) { + $missing[] = sprintf('Extension %s is required.', $extension); + $hint = $hint ?? 'extension_' . $extension; + } + } + } + if (!empty($required['extension_versions'])) { + foreach ($required['extension_versions'] as $extension => $req) { + $actualVersion = phpversion($extension); + $operator = new \PHPUnit\Util\VersionComparisonOperator(empty($req['operator']) ? '>=' : $req['operator']); + if ($actualVersion === \false || !version_compare($actualVersion, $req['version'], $operator->asString())) { + $missing[] = sprintf('Extension %s %s %s is required.', $extension, $operator->asString(), $req['version']); + $hint = $hint ?? 'extension_' . $extension; + } + } + } + if ($hint && isset($required['__OFFSET'])) { + array_unshift($missing, '__OFFSET_FILE=' . $required['__OFFSET']['__FILE']); + array_unshift($missing, '__OFFSET_LINE=' . ($required['__OFFSET'][$hint] ?? 1)); + } + return $missing; + } + /** + * Returns the provided data for a method. + * + * @throws Exception + * + * @psalm-param class-string $className + */ + public static function getProvidedData(string $className, string $methodName): ?array + { + return Registry::getInstance()->forMethod($className, $methodName)->getProvidedData(); + } + /** + * @psalm-param class-string $className + */ + public static function parseTestMethodAnnotations(string $className, ?string $methodName = null): array + { + $registry = Registry::getInstance(); + if ($methodName !== null) { + try { + return ['method' => $registry->forMethod($className, $methodName)->symbolAnnotations(), 'class' => $registry->forClassName($className)->symbolAnnotations()]; + } catch (\PHPUnit\Util\Exception $methodNotFound) { + // ignored + } + } + return ['method' => null, 'class' => $registry->forClassName($className)->symbolAnnotations()]; + } + /** + * @psalm-param class-string $className + */ + public static function getInlineAnnotations(string $className, string $methodName): array + { + return Registry::getInstance()->forMethod($className, $methodName)->getInlineAnnotations(); + } + /** @psalm-param class-string $className */ + public static function getBackupSettings(string $className, string $methodName): array + { + return ['backupGlobals' => self::getBooleanAnnotationSetting($className, $methodName, 'backupGlobals'), 'backupStaticAttributes' => self::getBooleanAnnotationSetting($className, $methodName, 'backupStaticAttributes')]; + } + /** + * @psalm-param class-string $className + * + * @return ExecutionOrderDependency[] + */ + public static function getDependencies(string $className, string $methodName): array + { + $annotations = self::parseTestMethodAnnotations($className, $methodName); + $dependsAnnotations = $annotations['class']['depends'] ?? []; + if (isset($annotations['method']['depends'])) { + $dependsAnnotations = array_merge($dependsAnnotations, $annotations['method']['depends']); + } + // Normalize dependency name to className::methodName + $dependencies = []; + foreach ($dependsAnnotations as $value) { + $dependencies[] = ExecutionOrderDependency::createFromDependsAnnotation($className, $value); + } + return array_unique($dependencies); + } + /** @psalm-param class-string $className */ + public static function getGroups(string $className, ?string $methodName = ''): array + { + $annotations = self::parseTestMethodAnnotations($className, $methodName); + $groups = []; + if (isset($annotations['method']['author'])) { + $groups[] = $annotations['method']['author']; + } elseif (isset($annotations['class']['author'])) { + $groups[] = $annotations['class']['author']; + } + if (isset($annotations['class']['group'])) { + $groups[] = $annotations['class']['group']; + } + if (isset($annotations['method']['group'])) { + $groups[] = $annotations['method']['group']; + } + if (isset($annotations['class']['ticket'])) { + $groups[] = $annotations['class']['ticket']; + } + if (isset($annotations['method']['ticket'])) { + $groups[] = $annotations['method']['ticket']; + } + foreach (['method', 'class'] as $element) { + foreach (['small', 'medium', 'large'] as $size) { + if (isset($annotations[$element][$size])) { + $groups[] = [$size]; + break 2; + } + } + } + foreach (['method', 'class'] as $element) { + if (isset($annotations[$element]['covers'])) { + foreach ($annotations[$element]['covers'] as $coversTarget) { + $groups[] = ['__phpunit_covers_' . self::canonicalizeName($coversTarget)]; + } + } + if (isset($annotations[$element]['uses'])) { + foreach ($annotations[$element]['uses'] as $usesTarget) { + $groups[] = ['__phpunit_uses_' . self::canonicalizeName($usesTarget)]; + } + } + } + return array_unique(array_merge([], ...$groups)); + } + /** @psalm-param class-string $className */ + public static function getSize(string $className, ?string $methodName): int + { + $groups = array_flip(self::getGroups($className, $methodName)); + if (isset($groups['large'])) { + return self::LARGE; + } + if (isset($groups['medium'])) { + return self::MEDIUM; + } + if (isset($groups['small'])) { + return self::SMALL; + } + return self::UNKNOWN; + } + /** @psalm-param class-string $className */ + public static function getProcessIsolationSettings(string $className, string $methodName): bool + { + $annotations = self::parseTestMethodAnnotations($className, $methodName); + return isset($annotations['class']['runTestsInSeparateProcesses']) || isset($annotations['method']['runInSeparateProcess']); + } + /** @psalm-param class-string $className */ + public static function getClassProcessIsolationSettings(string $className, string $methodName): bool + { + $annotations = self::parseTestMethodAnnotations($className, $methodName); + return isset($annotations['class']['runClassInSeparateProcess']); + } + /** @psalm-param class-string $className */ + public static function getPreserveGlobalStateSettings(string $className, string $methodName): ?bool + { + return self::getBooleanAnnotationSetting($className, $methodName, 'preserveGlobalState'); + } + /** @psalm-param class-string $className */ + public static function getHookMethods(string $className): array + { + if (!class_exists($className, \false)) { + return self::emptyHookMethodsArray(); + } + if (!isset(self::$hookMethods[$className])) { + self::$hookMethods[$className] = self::emptyHookMethodsArray(); + try { + foreach ((new \PHPUnit\Util\Reflection())->methodsInTestClass(new ReflectionClass($className)) as $method) { + $docBlock = Registry::getInstance()->forMethod($className, $method->getName()); + if ($method->isStatic()) { + if ($docBlock->isHookToBeExecutedBeforeClass()) { + array_unshift(self::$hookMethods[$className]['beforeClass'], $method->getName()); + } + if ($docBlock->isHookToBeExecutedAfterClass()) { + self::$hookMethods[$className]['afterClass'][] = $method->getName(); + } + } + if ($docBlock->isToBeExecutedBeforeTest()) { + array_unshift(self::$hookMethods[$className]['before'], $method->getName()); + } + if ($docBlock->isToBeExecutedAsPreCondition()) { + array_unshift(self::$hookMethods[$className]['preCondition'], $method->getName()); + } + if ($docBlock->isToBeExecutedAsPostCondition()) { + self::$hookMethods[$className]['postCondition'][] = $method->getName(); + } + if ($docBlock->isToBeExecutedAfterTest()) { + self::$hookMethods[$className]['after'][] = $method->getName(); + } + } + } catch (ReflectionException $e) { + } + } + return self::$hookMethods[$className]; + } + public static function isTestMethod(ReflectionMethod $method): bool + { + if (!$method->isPublic()) { + return \false; + } + if (strpos($method->getName(), 'test') === 0) { + return \true; + } + return array_key_exists('test', Registry::getInstance()->forMethod($method->getDeclaringClass()->getName(), $method->getName())->symbolAnnotations()); + } + /** + * @throws CodeCoverageException + * + * @psalm-param class-string $className + */ + private static function getLinesToBeCoveredOrUsed(string $className, string $methodName, string $mode): array + { + $annotations = self::parseTestMethodAnnotations($className, $methodName); + $classShortcut = null; + if (!empty($annotations['class'][$mode . 'DefaultClass'])) { + if (count($annotations['class'][$mode . 'DefaultClass']) > 1) { + throw new CodeCoverageException(sprintf('More than one @%sClass annotation in class or interface "%s".', $mode, $className)); + } + $classShortcut = $annotations['class'][$mode . 'DefaultClass'][0]; + } + $list = $annotations['class'][$mode] ?? []; + if (isset($annotations['method'][$mode])) { + $list = array_merge($list, $annotations['method'][$mode]); + } + $codeUnits = CodeUnitCollection::fromArray([]); + $mapper = new Mapper(); + foreach (array_unique($list) as $element) { + if ($classShortcut && strncmp($element, '::', 2) === 0) { + $element = $classShortcut . $element; + } + $element = preg_replace('/[\s()]+$/', '', $element); + $element = explode(' ', $element); + $element = $element[0]; + if ($mode === 'covers' && interface_exists($element)) { + throw new InvalidCoversTargetException(sprintf('Trying to @cover interface "%s".', $element)); + } + try { + $codeUnits = $codeUnits->mergeWith($mapper->stringToCodeUnits($element)); + } catch (InvalidCodeUnitException $e) { + throw new InvalidCoversTargetException(sprintf('"@%s %s" is invalid', $mode, $element), $e->getCode(), $e); + } + } + return $mapper->codeUnitsToSourceLines($codeUnits); + } + private static function emptyHookMethodsArray(): array + { + return ['beforeClass' => ['setUpBeforeClass'], 'before' => ['setUp'], 'preCondition' => ['assertPreConditions'], 'postCondition' => ['assertPostConditions'], 'after' => ['tearDown'], 'afterClass' => ['tearDownAfterClass']]; + } + /** @psalm-param class-string $className */ + private static function getBooleanAnnotationSetting(string $className, ?string $methodName, string $settingName): ?bool + { + $annotations = self::parseTestMethodAnnotations($className, $methodName); + if (isset($annotations['method'][$settingName])) { + if ($annotations['method'][$settingName][0] === 'enabled') { + return \true; + } + if ($annotations['method'][$settingName][0] === 'disabled') { + return \false; + } + } + if (isset($annotations['class'][$settingName])) { + if ($annotations['class'][$settingName][0] === 'enabled') { + return \true; + } + if ($annotations['class'][$settingName][0] === 'disabled') { + return \false; + } + } + return null; + } + /** + * Trims any extensions from version string that follows after + * the .[.] format. + */ + private static function sanitizeVersionNumber(string $version) + { + return preg_replace('/^(\d+\.\d+(?:.\d+)?).*$/', '$1', $version); + } + private static function shouldCoversAnnotationBeUsed(array $annotations): bool + { + if (isset($annotations['method']['coversNothing'])) { + return \false; + } + if (isset($annotations['method']['covers'])) { + return \true; + } + if (isset($annotations['class']['coversNothing'])) { + return \false; + } + return \true; + } + /** + * Merge two arrays together. + * + * If an integer key exists in both arrays and preserveNumericKeys is false, the value + * from the second array will be appended to the first array. If both values are arrays, they + * are merged together, else the value of the second array overwrites the one of the first array. + * + * This implementation is copied from https://github.com/zendframework/zend-stdlib/blob/76b653c5e99b40eccf5966e3122c90615134ae46/src/ArrayUtils.php + * + * Zend Framework (http://framework.zend.com/) + * + * @see http://github.com/zendframework/zf2 for the canonical source repository + * + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + private static function mergeArraysRecursively(array $a, array $b): array + { + foreach ($b as $key => $value) { + if (array_key_exists($key, $a)) { + if (is_int($key)) { + $a[] = $value; + } elseif (is_array($value) && is_array($a[$key])) { + $a[$key] = self::mergeArraysRecursively($a[$key], $value); + } else { + $a[$key] = $value; + } + } else { + $a[$key] = $value; + } + } + return $a; + } + private static function canonicalizeName(string $name): string + { + return strtolower(trim($name, '\\')); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +use const PHP_EOL; +use function array_map; +use function ceil; +use function count; +use function explode; +use function get_class; +use function implode; +use function preg_match; +use function sprintf; +use function strlen; +use function strpos; +use function trim; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestResult; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\Color; +use PHPUnit\Util\Filter; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +use PHPUnitPHAR\SebastianBergmann\Timer\ResourceUsageFormatter; +use PHPUnitPHAR\SebastianBergmann\Timer\Timer; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +class CliTestDoxPrinter extends \PHPUnit\Util\TestDox\TestDoxPrinter +{ + /** + * The default Testdox left margin for messages is a vertical line. + */ + private const PREFIX_SIMPLE = ['default' => '│', 'start' => '│', 'message' => '│', 'diff' => '│', 'trace' => '│', 'last' => '│']; + /** + * Colored Testdox use box-drawing for a more textured map of the message. + */ + private const PREFIX_DECORATED = ['default' => '│', 'start' => '┐', 'message' => '├', 'diff' => '┊', 'trace' => '╵', 'last' => '┴']; + private const SPINNER_ICONS = [" \x1b[36m◐\x1b[0m running tests", " \x1b[36m◓\x1b[0m running tests", " \x1b[36m◑\x1b[0m running tests", " \x1b[36m◒\x1b[0m running tests"]; + private const STATUS_STYLES = [BaseTestRunner::STATUS_PASSED => ['symbol' => '✔', 'color' => 'fg-green'], BaseTestRunner::STATUS_ERROR => ['symbol' => '✘', 'color' => 'fg-yellow', 'message' => 'bg-yellow,fg-black'], BaseTestRunner::STATUS_FAILURE => ['symbol' => '✘', 'color' => 'fg-red', 'message' => 'bg-red,fg-white'], BaseTestRunner::STATUS_SKIPPED => ['symbol' => '↩', 'color' => 'fg-cyan', 'message' => 'fg-cyan'], BaseTestRunner::STATUS_RISKY => ['symbol' => '☢', 'color' => 'fg-yellow', 'message' => 'fg-yellow'], BaseTestRunner::STATUS_INCOMPLETE => ['symbol' => '∅', 'color' => 'fg-yellow', 'message' => 'fg-yellow'], BaseTestRunner::STATUS_WARNING => ['symbol' => '⚠', 'color' => 'fg-yellow', 'message' => 'fg-yellow'], BaseTestRunner::STATUS_UNKNOWN => ['symbol' => '?', 'color' => 'fg-blue', 'message' => 'fg-white,bg-blue']]; + /** + * @var int[] + */ + private $nonSuccessfulTestResults = []; + /** + * @var Timer + */ + private $timer; + /** + * @param null|resource|string $out + * @param int|string $numberOfColumns + * + * @throws Exception + */ + public function __construct($out = null, bool $verbose = \false, string $colors = self::COLOR_DEFAULT, bool $debug = \false, $numberOfColumns = 80, bool $reverse = \false) + { + parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns, $reverse); + $this->timer = new Timer(); + $this->timer->start(); + } + public function printResult(TestResult $result): void + { + $this->printHeader($result); + $this->printNonSuccessfulTestsSummary($result->count()); + $this->printFooter($result); + } + protected function printHeader(TestResult $result): void + { + $this->write("\n" . (new ResourceUsageFormatter())->resourceUsage($this->timer->stop()) . "\n\n"); + } + protected function formatClassName(Test $test): string + { + if ($test instanceof TestCase) { + return $this->prettifier->prettifyTestClass(get_class($test)); + } + return get_class($test); + } + /** + * @throws InvalidArgumentException + */ + protected function registerTestResult(Test $test, ?Throwable $t, int $status, float $time, bool $verbose): void + { + if ($status !== BaseTestRunner::STATUS_PASSED) { + $this->nonSuccessfulTestResults[] = $this->testIndex; + } + parent::registerTestResult($test, $t, $status, $time, $verbose); + } + /** + * @throws InvalidArgumentException + */ + protected function formatTestName(Test $test): string + { + if ($test instanceof TestCase) { + return $this->prettifier->prettifyTestCase($test); + } + return parent::formatTestName($test); + } + protected function writeTestResult(array $prevResult, array $result): void + { + // spacer line for new suite headers and after verbose messages + if ($prevResult['testName'] !== '' && (!empty($prevResult['message']) || $prevResult['className'] !== $result['className'])) { + $this->write(PHP_EOL); + } + // suite header + if ($prevResult['className'] !== $result['className']) { + $this->write($this->colorizeTextBox('underlined', $result['className']) . PHP_EOL); + } + // test result line + if ($this->colors && $result['className'] === PhptTestCase::class) { + $testName = Color::colorizePath($result['testName'], $prevResult['testName'], \true); + } else { + $testName = $result['testMethod']; + } + $style = self::STATUS_STYLES[$result['status']]; + $line = sprintf(' %s %s%s' . PHP_EOL, $this->colorizeTextBox($style['color'], $style['symbol']), $testName, $this->verbose ? ' ' . $this->formatRuntime($result['time'], $style['color']) : ''); + $this->write($line); + // additional information when verbose + $this->write($result['message']); + } + protected function formatThrowable(Throwable $t, ?int $status = null): string + { + return trim(TestFailure::exceptionToString($t)); + } + protected function colorizeMessageAndDiff(string $style, string $buffer): array + { + $lines = $buffer ? array_map('\rtrim', explode(PHP_EOL, $buffer)) : []; + $message = []; + $diff = []; + $insideDiff = \false; + foreach ($lines as $line) { + if ($line === '--- Expected') { + $insideDiff = \true; + } + if (!$insideDiff) { + $message[] = $line; + } else { + if (strpos($line, '-') === 0) { + $line = Color::colorize('fg-red', Color::visualizeWhitespace($line, \true)); + } elseif (strpos($line, '+') === 0) { + $line = Color::colorize('fg-green', Color::visualizeWhitespace($line, \true)); + } elseif ($line === '@@ @@') { + $line = Color::colorize('fg-cyan', $line); + } + $diff[] = $line; + } + } + $diff = implode(PHP_EOL, $diff); + if (!empty($message)) { + $message = $this->colorizeTextBox($style, implode(PHP_EOL, $message)); + } + return [$message, $diff]; + } + protected function formatStacktrace(Throwable $t): string + { + $trace = Filter::getFilteredStacktrace($t); + if (!$this->colors) { + return $trace; + } + $lines = []; + $prevPath = ''; + foreach (explode(PHP_EOL, $trace) as $line) { + if (preg_match('/^(.*):(\d+)$/', $line, $matches)) { + $lines[] = Color::colorizePath($matches[1], $prevPath) . Color::dim(':') . Color::colorize('fg-blue', $matches[2]) . "\n"; + $prevPath = $matches[1]; + } else { + $lines[] = $line; + $prevPath = ''; + } + } + return implode('', $lines); + } + protected function formatTestResultMessage(Throwable $t, array $result, ?string $prefix = null): string + { + $message = $this->formatThrowable($t, $result['status']); + $diff = ''; + if (!($this->verbose || $result['verbose'])) { + return ''; + } + if ($message && $this->colors) { + $style = self::STATUS_STYLES[$result['status']]['message'] ?? ''; + [$message, $diff] = $this->colorizeMessageAndDiff($style, $message); + } + if ($prefix === null || !$this->colors) { + $prefix = self::PREFIX_SIMPLE; + } + if ($this->colors) { + $color = self::STATUS_STYLES[$result['status']]['color'] ?? ''; + $prefix = array_map(static function ($p) use ($color) { + return Color::colorize($color, $p); + }, self::PREFIX_DECORATED); + } + $trace = $this->formatStacktrace($t); + $out = $this->prefixLines($prefix['start'], PHP_EOL) . PHP_EOL; + if ($message) { + $out .= $this->prefixLines($prefix['message'], $message . PHP_EOL) . PHP_EOL; + } + if ($diff) { + $out .= $this->prefixLines($prefix['diff'], $diff . PHP_EOL) . PHP_EOL; + } + if ($trace) { + if ($message || $diff) { + $out .= $this->prefixLines($prefix['default'], PHP_EOL) . PHP_EOL; + } + $out .= $this->prefixLines($prefix['trace'], $trace . PHP_EOL) . PHP_EOL; + } + $out .= $this->prefixLines($prefix['last'], PHP_EOL) . PHP_EOL; + return $out; + } + protected function drawSpinner(): void + { + if ($this->colors) { + $id = $this->spinState % count(self::SPINNER_ICONS); + $this->write(self::SPINNER_ICONS[$id]); + } + } + protected function undrawSpinner(): void + { + if ($this->colors) { + $id = $this->spinState % count(self::SPINNER_ICONS); + $this->write("\x1b[1K\x1b[" . strlen(self::SPINNER_ICONS[$id]) . 'D'); + } + } + private function formatRuntime(float $time, string $color = ''): string + { + if (!$this->colors) { + return sprintf('[%.2f ms]', $time * 1000); + } + if ($time > 1) { + $color = 'fg-magenta'; + } + return Color::colorize($color, ' ' . (int) ceil($time * 1000) . ' ' . Color::dim('ms')); + } + private function printNonSuccessfulTestsSummary(int $numberOfExecutedTests): void + { + if (empty($this->nonSuccessfulTestResults)) { + return; + } + if (count($this->nonSuccessfulTestResults) / $numberOfExecutedTests >= 0.7) { + return; + } + $this->write("Summary of non-successful tests:\n\n"); + $prevResult = $this->getEmptyTestResult(); + foreach ($this->nonSuccessfulTestResults as $testIndex) { + $result = $this->testResults[$testIndex]; + $this->writeTestResult($prevResult, $result); + $prevResult = $result; + } + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +use function sprintf; +use PHPUnit\Framework\TestResult; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class HtmlResultPrinter extends \PHPUnit\Util\TestDox\ResultPrinter +{ + /** + * @var string + */ + private const PAGE_HEADER = <<<'EOT' + + + + + Test Documentation + + + +EOT; + /** + * @var string + */ + private const CLASS_HEADER = <<<'EOT' + +

    %s

    +
      + +EOT; + /** + * @var string + */ + private const CLASS_FOOTER = <<<'EOT' +
    +EOT; + /** + * @var string + */ + private const PAGE_FOOTER = <<<'EOT' + + + +EOT; + public function printResult(TestResult $result): void + { + } + /** + * Handler for 'start run' event. + */ + protected function startRun(): void + { + $this->write(self::PAGE_HEADER); + } + /** + * Handler for 'start class' event. + */ + protected function startClass(string $name): void + { + $this->write(sprintf(self::CLASS_HEADER, $this->currentTestClassPrettified)); + } + /** + * Handler for 'on test' event. + */ + protected function onTest(string $name, bool $success = \true): void + { + $this->write(sprintf("
  • %s
  • \n", $success ? 'success' : 'defect', $name)); + } + /** + * Handler for 'end class' event. + */ + protected function endClass(string $name): void + { + $this->write(self::CLASS_FOOTER); + } + /** + * Handler for 'end run' event. + */ + protected function endRun(): void + { + $this->write(self::PAGE_FOOTER); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +use function array_key_exists; +use function array_keys; +use function array_map; +use function array_pop; +use function array_values; +use function explode; +use function get_class; +use function gettype; +use function implode; +use function in_array; +use function is_bool; +use function is_float; +use function is_int; +use function is_numeric; +use function is_object; +use function is_scalar; +use function is_string; +use function ord; +use function preg_quote; +use function preg_replace; +use function range; +use function sprintf; +use function str_replace; +use function strlen; +use function strpos; +use function strtolower; +use function strtoupper; +use function substr; +use function trim; +use PHPUnit\Framework\TestCase; +use PHPUnit\Util\Color; +use PHPUnit\Util\Exception as UtilException; +use PHPUnit\Util\Test; +use ReflectionException; +use ReflectionMethod; +use ReflectionObject; +use PHPUnitPHAR\SebastianBergmann\Exporter\Exporter; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class NamePrettifier +{ + /** + * @var string[] + */ + private $strings = []; + /** + * @var bool + */ + private $useColor; + public function __construct(bool $useColor = \false) + { + $this->useColor = $useColor; + } + /** + * Prettifies the name of a test class. + * + * @psalm-param class-string $className + */ + public function prettifyTestClass(string $className): string + { + try { + $annotations = Test::parseTestMethodAnnotations($className); + if (isset($annotations['class']['testdox'][0])) { + return $annotations['class']['testdox'][0]; + } + } catch (UtilException $e) { + // ignore, determine className by parsing the provided name + } + $parts = explode('\\', $className); + $className = array_pop($parts); + if (substr($className, -1 * strlen('Test')) === 'Test') { + $className = substr($className, 0, strlen($className) - strlen('Test')); + } + if (strpos($className, 'Tests') === 0) { + $className = substr($className, strlen('Tests')); + } elseif (strpos($className, 'Test') === 0) { + $className = substr($className, strlen('Test')); + } + if (empty($className)) { + $className = 'UnnamedTests'; + } + if (!empty($parts)) { + $parts[] = $className; + $fullyQualifiedName = implode('\\', $parts); + } else { + $fullyQualifiedName = $className; + } + $result = preg_replace('/(?<=[[:lower:]])(?=[[:upper:]])/u', ' ', $className); + if ($fullyQualifiedName !== $className) { + return $result . ' (' . $fullyQualifiedName . ')'; + } + return $result; + } + /** + * @throws InvalidArgumentException + */ + public function prettifyTestCase(TestCase $test): string + { + $annotations = Test::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); + $annotationWithPlaceholders = \false; + $callback = static function (string $variable): string { + return sprintf('/%s(?=\b)/', preg_quote($variable, '/')); + }; + if (isset($annotations['method']['testdox'][0])) { + $result = $annotations['method']['testdox'][0]; + if (strpos($result, '$') !== \false) { + $annotation = $annotations['method']['testdox'][0]; + $providedData = $this->mapTestMethodParameterNamesToProvidedDataValues($test); + $variables = array_map($callback, array_keys($providedData)); + $result = trim(preg_replace($variables, $providedData, $annotation)); + $annotationWithPlaceholders = \true; + } + } else { + $result = $this->prettifyTestMethod($test->getName(\false)); + } + if (!$annotationWithPlaceholders && $test->usesDataProvider()) { + $result .= $this->prettifyDataSet($test); + } + return $result; + } + public function prettifyDataSet(TestCase $test): string + { + if (!$this->useColor) { + return $test->getDataSetAsString(\false); + } + if (is_int($test->dataName())) { + $data = Color::dim(' with data set ') . Color::colorize('fg-cyan', (string) $test->dataName()); + } else { + $data = Color::dim(' with ') . Color::colorize('fg-cyan', Color::visualizeWhitespace((string) $test->dataName())); + } + return $data; + } + /** + * Prettifies the name of a test method. + */ + public function prettifyTestMethod(string $name): string + { + $buffer = ''; + if ($name === '') { + return $buffer; + } + $string = (string) preg_replace('#\d+$#', '', $name, -1, $count); + if (in_array($string, $this->strings, \true)) { + $name = $string; + } elseif ($count === 0) { + $this->strings[] = $string; + } + if (strpos($name, 'test_') === 0) { + $name = substr($name, 5); + } elseif (strpos($name, 'test') === 0) { + $name = substr($name, 4); + } + if ($name === '') { + return $buffer; + } + $name[0] = strtoupper($name[0]); + if (strpos($name, '_') !== \false) { + return trim(str_replace('_', ' ', $name)); + } + $wasNumeric = \false; + foreach (range(0, strlen($name) - 1) as $i) { + if ($i > 0 && ord($name[$i]) >= 65 && ord($name[$i]) <= 90) { + $buffer .= ' ' . strtolower($name[$i]); + } else { + $isNumeric = is_numeric($name[$i]); + if (!$wasNumeric && $isNumeric) { + $buffer .= ' '; + $wasNumeric = \true; + } + if ($wasNumeric && !$isNumeric) { + $wasNumeric = \false; + } + $buffer .= $name[$i]; + } + } + return $buffer; + } + /** + * @throws InvalidArgumentException + */ + private function mapTestMethodParameterNamesToProvidedDataValues(TestCase $test): array + { + try { + $reflector = new ReflectionMethod(get_class($test), $test->getName(\false)); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new UtilException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + $providedData = []; + $providedDataValues = array_values($test->getProvidedData()); + $i = 0; + $providedData['$_dataName'] = $test->dataName(); + foreach ($reflector->getParameters() as $parameter) { + if (!array_key_exists($i, $providedDataValues) && $parameter->isDefaultValueAvailable()) { + try { + $providedDataValues[$i] = $parameter->getDefaultValue(); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new UtilException($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + } + $value = $providedDataValues[$i++] ?? null; + if (is_object($value)) { + $reflector = new ReflectionObject($value); + if ($reflector->hasMethod('__toString')) { + $value = (string) $value; + } else { + $value = get_class($value); + } + } + if (!is_scalar($value)) { + $value = gettype($value); + } + if (is_bool($value) || is_int($value) || is_float($value)) { + $value = (new Exporter())->export($value); + } + if (is_string($value) && $value === '') { + if ($this->useColor) { + $value = Color::colorize('dim,underlined', 'empty'); + } else { + $value = "''"; + } + } + $providedData['$' . $parameter->getName()] = $value; + } + if ($this->useColor) { + $providedData = array_map(static function ($value) { + return Color::colorize('fg-cyan', Color::visualizeWhitespace((string) $value, \true)); + }, $providedData); + } + return $providedData; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +use function get_class; +use function in_array; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\ErrorTestCase; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Framework\WarningTestCase; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\TextUI\ResultPrinter as ResultPrinterInterface; +use PHPUnit\Util\Printer; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +abstract class ResultPrinter extends Printer implements ResultPrinterInterface +{ + /** + * @var NamePrettifier + */ + protected $prettifier; + /** + * @var string + */ + protected $testClass = ''; + /** + * @var int + */ + protected $testStatus; + /** + * @var array + */ + protected $tests = []; + /** + * @var int + */ + protected $successful = 0; + /** + * @var int + */ + protected $warned = 0; + /** + * @var int + */ + protected $failed = 0; + /** + * @var int + */ + protected $risky = 0; + /** + * @var int + */ + protected $skipped = 0; + /** + * @var int + */ + protected $incomplete = 0; + /** + * @var null|string + */ + protected $currentTestClassPrettified; + /** + * @var null|string + */ + protected $currentTestMethodPrettified; + /** + * @var array + */ + private $groups; + /** + * @var array + */ + private $excludeGroups; + /** + * @param resource $out + * + * @throws Exception + */ + public function __construct($out = null, array $groups = [], array $excludeGroups = []) + { + parent::__construct($out); + $this->groups = $groups; + $this->excludeGroups = $excludeGroups; + $this->prettifier = new \PHPUnit\Util\TestDox\NamePrettifier(); + $this->startRun(); + } + /** + * Flush buffer and close output. + */ + public function flush(): void + { + $this->doEndClass(); + $this->endRun(); + parent::flush(); + } + /** + * An error occurred. + */ + public function addError(Test $test, Throwable $t, float $time): void + { + if (!$this->isOfInterest($test)) { + return; + } + $this->testStatus = BaseTestRunner::STATUS_ERROR; + $this->failed++; + } + /** + * A warning occurred. + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + if (!$this->isOfInterest($test)) { + return; + } + $this->testStatus = BaseTestRunner::STATUS_WARNING; + $this->warned++; + } + /** + * A failure occurred. + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + if (!$this->isOfInterest($test)) { + return; + } + $this->testStatus = BaseTestRunner::STATUS_FAILURE; + $this->failed++; + } + /** + * Incomplete test. + */ + public function addIncompleteTest(Test $test, Throwable $t, float $time): void + { + if (!$this->isOfInterest($test)) { + return; + } + $this->testStatus = BaseTestRunner::STATUS_INCOMPLETE; + $this->incomplete++; + } + /** + * Risky test. + */ + public function addRiskyTest(Test $test, Throwable $t, float $time): void + { + if (!$this->isOfInterest($test)) { + return; + } + $this->testStatus = BaseTestRunner::STATUS_RISKY; + $this->risky++; + } + /** + * Skipped test. + */ + public function addSkippedTest(Test $test, Throwable $t, float $time): void + { + if (!$this->isOfInterest($test)) { + return; + } + $this->testStatus = BaseTestRunner::STATUS_SKIPPED; + $this->skipped++; + } + /** + * A testsuite started. + */ + public function startTestSuite(TestSuite $suite): void + { + } + /** + * A testsuite ended. + */ + public function endTestSuite(TestSuite $suite): void + { + } + /** + * A test started. + * + * @throws InvalidArgumentException + */ + public function startTest(Test $test): void + { + if (!$this->isOfInterest($test)) { + return; + } + $class = get_class($test); + if ($this->testClass !== $class) { + if ($this->testClass !== '') { + $this->doEndClass(); + } + $this->currentTestClassPrettified = $this->prettifier->prettifyTestClass($class); + $this->testClass = $class; + $this->tests = []; + $this->startClass($class); + } + if ($test instanceof TestCase) { + $this->currentTestMethodPrettified = $this->prettifier->prettifyTestCase($test); + } + $this->testStatus = BaseTestRunner::STATUS_PASSED; + } + /** + * A test ended. + */ + public function endTest(Test $test, float $time): void + { + if (!$this->isOfInterest($test)) { + return; + } + $this->tests[] = [$this->currentTestMethodPrettified, $this->testStatus]; + $this->currentTestClassPrettified = null; + $this->currentTestMethodPrettified = null; + } + protected function doEndClass(): void + { + foreach ($this->tests as $test) { + $this->onTest($test[0], $test[1] === BaseTestRunner::STATUS_PASSED); + } + $this->endClass($this->testClass); + } + /** + * Handler for 'start run' event. + */ + protected function startRun(): void + { + } + /** + * Handler for 'start class' event. + */ + protected function startClass(string $name): void + { + } + /** + * Handler for 'on test' event. + */ + protected function onTest(string $name, bool $success = \true): void + { + } + /** + * Handler for 'end class' event. + */ + protected function endClass(string $name): void + { + } + /** + * Handler for 'end run' event. + */ + protected function endRun(): void + { + } + private function isOfInterest(Test $test): bool + { + if (!$test instanceof TestCase) { + return \false; + } + if ($test instanceof ErrorTestCase || $test instanceof WarningTestCase) { + return \false; + } + if (!empty($this->groups)) { + foreach ($test->getGroups() as $group) { + if (in_array($group, $this->groups, \true)) { + return \true; + } + } + return \false; + } + if (!empty($this->excludeGroups)) { + foreach ($test->getGroups() as $group) { + if (in_array($group, $this->excludeGroups, \true)) { + return \false; + } + } + return \true; + } + return \true; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +use const PHP_EOL; +use function array_map; +use function get_class; +use function implode; +use function method_exists; +use function preg_split; +use function trim; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\Reorderable; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestResult; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\TextUI\DefaultResultPrinter; +use PHPUnit\Util\Filter; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +class TestDoxPrinter extends DefaultResultPrinter +{ + /** + * @var NamePrettifier + */ + protected $prettifier; + /** + * @var int The number of test results received from the TestRunner + */ + protected $testIndex = 0; + /** + * @var int The number of test results already sent to the output + */ + protected $testFlushIndex = 0; + /** + * @var array Buffer for test results + */ + protected $testResults = []; + /** + * @var array Lookup table for testname to testResults[index] + */ + protected $testNameResultIndex = []; + /** + * @var bool + */ + protected $enableOutputBuffer = \false; + /** + * @var array array + */ + protected $originalExecutionOrder = []; + /** + * @var int + */ + protected $spinState = 0; + /** + * @var bool + */ + protected $showProgress = \true; + /** + * @param null|resource|string $out + * @param int|string $numberOfColumns + * + * @throws Exception + */ + public function __construct($out = null, bool $verbose = \false, string $colors = self::COLOR_DEFAULT, bool $debug = \false, $numberOfColumns = 80, bool $reverse = \false) + { + parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns, $reverse); + $this->prettifier = new \PHPUnit\Util\TestDox\NamePrettifier($this->colors); + } + public function setOriginalExecutionOrder(array $order): void + { + $this->originalExecutionOrder = $order; + $this->enableOutputBuffer = !empty($order); + } + public function setShowProgressAnimation(bool $showProgress): void + { + $this->showProgress = $showProgress; + } + public function printResult(TestResult $result): void + { + } + /** + * @throws InvalidArgumentException + */ + public function endTest(Test $test, float $time): void + { + if (!$test instanceof TestCase && !$test instanceof PhptTestCase && !$test instanceof TestSuite) { + return; + } + if ($this->testHasPassed()) { + $this->registerTestResult($test, null, BaseTestRunner::STATUS_PASSED, $time, \false); + } + if ($test instanceof TestCase || $test instanceof PhptTestCase) { + $this->testIndex++; + } + parent::endTest($test, $time); + } + /** + * @throws InvalidArgumentException + */ + public function addError(Test $test, Throwable $t, float $time): void + { + $this->registerTestResult($test, $t, BaseTestRunner::STATUS_ERROR, $time, \true); + } + /** + * @throws InvalidArgumentException + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + $this->registerTestResult($test, $e, BaseTestRunner::STATUS_WARNING, $time, \true); + } + /** + * @throws InvalidArgumentException + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + $this->registerTestResult($test, $e, BaseTestRunner::STATUS_FAILURE, $time, \true); + } + /** + * @throws InvalidArgumentException + */ + public function addIncompleteTest(Test $test, Throwable $t, float $time): void + { + $this->registerTestResult($test, $t, BaseTestRunner::STATUS_INCOMPLETE, $time, \false); + } + /** + * @throws InvalidArgumentException + */ + public function addRiskyTest(Test $test, Throwable $t, float $time): void + { + $this->registerTestResult($test, $t, BaseTestRunner::STATUS_RISKY, $time, \false); + } + /** + * @throws InvalidArgumentException + */ + public function addSkippedTest(Test $test, Throwable $t, float $time): void + { + $this->registerTestResult($test, $t, BaseTestRunner::STATUS_SKIPPED, $time, \false); + } + public function writeProgress(string $progress): void + { + $this->flushOutputBuffer(); + } + public function flush(): void + { + $this->flushOutputBuffer(\true); + } + /** + * @throws InvalidArgumentException + */ + protected function registerTestResult(Test $test, ?Throwable $t, int $status, float $time, bool $verbose): void + { + $testName = ($test instanceof Reorderable) ? $test->sortId() : $test->getName(); + $result = ['className' => $this->formatClassName($test), 'testName' => $testName, 'testMethod' => $this->formatTestName($test), 'message' => '', 'status' => $status, 'time' => $time, 'verbose' => $verbose]; + if ($t !== null) { + $result['message'] = $this->formatTestResultMessage($t, $result); + } + $this->testResults[$this->testIndex] = $result; + $this->testNameResultIndex[$testName] = $this->testIndex; + } + protected function formatTestName(Test $test): string + { + return method_exists($test, 'getName') ? $test->getName() : ''; + } + protected function formatClassName(Test $test): string + { + return get_class($test); + } + protected function testHasPassed(): bool + { + if (!isset($this->testResults[$this->testIndex]['status'])) { + return \true; + } + if ($this->testResults[$this->testIndex]['status'] === BaseTestRunner::STATUS_PASSED) { + return \true; + } + return \false; + } + protected function flushOutputBuffer(bool $forceFlush = \false): void + { + if ($this->testFlushIndex === $this->testIndex) { + return; + } + if ($this->testFlushIndex > 0) { + if ($this->enableOutputBuffer && isset($this->originalExecutionOrder[$this->testFlushIndex - 1])) { + $prevResult = $this->getTestResultByName($this->originalExecutionOrder[$this->testFlushIndex - 1]); + } else { + $prevResult = $this->testResults[$this->testFlushIndex - 1]; + } + } else { + $prevResult = $this->getEmptyTestResult(); + } + if (!$this->enableOutputBuffer) { + $this->writeTestResult($prevResult, $this->testResults[$this->testFlushIndex++]); + } else { + do { + $flushed = \false; + if (!$forceFlush && isset($this->originalExecutionOrder[$this->testFlushIndex])) { + $result = $this->getTestResultByName($this->originalExecutionOrder[$this->testFlushIndex]); + } else { + // This test(name) cannot found in original execution order, + // flush result to output stream right away + $result = $this->testResults[$this->testFlushIndex]; + } + if (!empty($result)) { + $this->hideSpinner(); + $this->writeTestResult($prevResult, $result); + $this->testFlushIndex++; + $prevResult = $result; + $flushed = \true; + } else { + $this->showSpinner(); + } + } while ($flushed && $this->testFlushIndex < $this->testIndex); + } + } + protected function showSpinner(): void + { + if (!$this->showProgress) { + return; + } + if ($this->spinState) { + $this->undrawSpinner(); + } + $this->spinState++; + $this->drawSpinner(); + } + protected function hideSpinner(): void + { + if (!$this->showProgress) { + return; + } + if ($this->spinState) { + $this->undrawSpinner(); + } + $this->spinState = 0; + } + protected function drawSpinner(): void + { + // optional for CLI printers: show the user a 'buffering output' spinner + } + protected function undrawSpinner(): void + { + // remove the spinner from the current line + } + protected function writeTestResult(array $prevResult, array $result): void + { + } + protected function getEmptyTestResult(): array + { + return ['className' => '', 'testName' => '', 'message' => '', 'failed' => '', 'verbose' => '']; + } + protected function getTestResultByName(?string $testName): array + { + if (isset($this->testNameResultIndex[$testName])) { + return $this->testResults[$this->testNameResultIndex[$testName]]; + } + return []; + } + protected function formatThrowable(Throwable $t, ?int $status = null): string + { + $message = trim(TestFailure::exceptionToString($t)); + if ($message) { + $message .= PHP_EOL . PHP_EOL . $this->formatStacktrace($t); + } else { + $message = $this->formatStacktrace($t); + } + return $message; + } + protected function formatStacktrace(Throwable $t): string + { + return Filter::getFilteredStacktrace($t); + } + protected function formatTestResultMessage(Throwable $t, array $result, string $prefix = '│'): string + { + $message = $this->formatThrowable($t, $result['status']); + if ($message === '') { + return ''; + } + if (!($this->verbose || $result['verbose'])) { + return ''; + } + return $this->prefixLines($prefix, $message); + } + protected function prefixLines(string $prefix, string $message): string + { + $message = trim($message); + return implode(PHP_EOL, array_map(static function (string $text) use ($prefix) { + return ' ' . $prefix . ($text ? ' ' . $text : ''); + }, preg_split('/\r\n|\r|\n/', $message))); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +use PHPUnit\Framework\TestResult; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class TextResultPrinter extends \PHPUnit\Util\TestDox\ResultPrinter +{ + public function printResult(TestResult $result): void + { + } + /** + * Handler for 'start class' event. + */ + protected function startClass(string $name): void + { + $this->write($this->currentTestClassPrettified . "\n"); + } + /** + * Handler for 'on test' event. + */ + protected function onTest(string $name, bool $success = \true): void + { + if ($success) { + $this->write(' [x] '); + } else { + $this->write(' [ ] '); + } + $this->write($name . "\n"); + } + /** + * Handler for 'end class' event. + */ + protected function endClass(string $name): void + { + $this->write("\n"); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +use function array_filter; +use function get_class; +use function implode; +use function strpos; +use DOMDocument; +use DOMElement; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestListener; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Framework\WarningTestCase; +use PHPUnit\Util\Printer; +use PHPUnit\Util\Test as TestUtil; +use ReflectionClass; +use ReflectionException; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +use Throwable; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class XmlResultPrinter extends Printer implements TestListener +{ + /** + * @var DOMDocument + */ + private $document; + /** + * @var DOMElement + */ + private $root; + /** + * @var NamePrettifier + */ + private $prettifier; + /** + * @var null|Throwable + */ + private $exception; + /** + * @param resource|string $out + * + * @throws Exception + */ + public function __construct($out = null) + { + $this->document = new DOMDocument('1.0', 'UTF-8'); + $this->document->formatOutput = \true; + $this->root = $this->document->createElement('tests'); + $this->document->appendChild($this->root); + $this->prettifier = new \PHPUnit\Util\TestDox\NamePrettifier(); + parent::__construct($out); + } + /** + * Flush buffer and close output. + */ + public function flush(): void + { + $this->write($this->document->saveXML()); + parent::flush(); + } + /** + * An error occurred. + */ + public function addError(Test $test, Throwable $t, float $time): void + { + $this->exception = $t; + } + /** + * A warning occurred. + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + } + /** + * A failure occurred. + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + $this->exception = $e; + } + /** + * Incomplete test. + */ + public function addIncompleteTest(Test $test, Throwable $t, float $time): void + { + } + /** + * Risky test. + */ + public function addRiskyTest(Test $test, Throwable $t, float $time): void + { + } + /** + * Skipped test. + */ + public function addSkippedTest(Test $test, Throwable $t, float $time): void + { + } + /** + * A test suite started. + */ + public function startTestSuite(TestSuite $suite): void + { + } + /** + * A test suite ended. + */ + public function endTestSuite(TestSuite $suite): void + { + } + /** + * A test started. + */ + public function startTest(Test $test): void + { + $this->exception = null; + } + /** + * A test ended. + * + * @throws InvalidArgumentException + */ + public function endTest(Test $test, float $time): void + { + if (!$test instanceof TestCase || $test instanceof WarningTestCase) { + return; + } + $groups = array_filter($test->getGroups(), static function ($group) { + return !($group === 'small' || $group === 'medium' || $group === 'large' || strpos($group, '__phpunit_') === 0); + }); + $testNode = $this->document->createElement('test'); + $testNode->setAttribute('className', get_class($test)); + $testNode->setAttribute('methodName', $test->getName()); + $testNode->setAttribute('prettifiedClassName', $this->prettifier->prettifyTestClass(get_class($test))); + $testNode->setAttribute('prettifiedMethodName', $this->prettifier->prettifyTestCase($test)); + $testNode->setAttribute('status', (string) $test->getStatus()); + $testNode->setAttribute('time', (string) $time); + $testNode->setAttribute('size', (string) $test->getSize()); + $testNode->setAttribute('groups', implode(',', $groups)); + foreach ($groups as $group) { + $groupNode = $this->document->createElement('group'); + $groupNode->setAttribute('name', $group); + $testNode->appendChild($groupNode); + } + $annotations = TestUtil::parseTestMethodAnnotations(get_class($test), $test->getName(\false)); + foreach (['class', 'method'] as $type) { + foreach ($annotations[$type] as $annotation => $values) { + if ($annotation !== 'covers' && $annotation !== 'uses') { + continue; + } + foreach ($values as $value) { + $coversNode = $this->document->createElement($annotation); + $coversNode->setAttribute('target', $value); + $testNode->appendChild($coversNode); + } + } + } + foreach ($test->doubledTypes() as $doubledType) { + $testDoubleNode = $this->document->createElement('testDouble'); + $testDoubleNode->setAttribute('type', $doubledType); + $testNode->appendChild($testDoubleNode); + } + $inlineAnnotations = TestUtil::getInlineAnnotations(get_class($test), $test->getName(\false)); + if (isset($inlineAnnotations['given'], $inlineAnnotations['when'], $inlineAnnotations['then'])) { + $testNode->setAttribute('given', $inlineAnnotations['given']['value']); + $testNode->setAttribute('givenStartLine', (string) $inlineAnnotations['given']['line']); + $testNode->setAttribute('when', $inlineAnnotations['when']['value']); + $testNode->setAttribute('whenStartLine', (string) $inlineAnnotations['when']['line']); + $testNode->setAttribute('then', $inlineAnnotations['then']['value']); + $testNode->setAttribute('thenStartLine', (string) $inlineAnnotations['then']['line']); + } + if ($this->exception !== null) { + if ($this->exception instanceof Exception) { + $steps = $this->exception->getSerializableTrace(); + } else { + $steps = $this->exception->getTrace(); + } + try { + $file = (new ReflectionClass($test))->getFileName(); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + foreach ($steps as $step) { + if (isset($step['file']) && $step['file'] === $file) { + $testNode->setAttribute('exceptionLine', (string) $step['line']); + break; + } + } + $testNode->setAttribute('exceptionMessage', $this->exception->getMessage()); + } + $this->root->appendChild($testNode); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use const PHP_EOL; +use function get_class; +use function sprintf; +use function str_replace; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Runner\PhptTestCase; +use RecursiveIteratorIterator; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class TextTestListRenderer +{ + /** + * @throws InvalidArgumentException + */ + public function render(TestSuite $suite): string + { + $buffer = 'Available test(s):' . PHP_EOL; + foreach (new RecursiveIteratorIterator($suite->getIterator()) as $test) { + if ($test instanceof TestCase) { + $name = sprintf('%s::%s', get_class($test), str_replace(' with data set ', '', $test->getName())); + } elseif ($test instanceof PhptTestCase) { + $name = $test->getName(); + } else { + continue; + } + $buffer .= sprintf(' - %s' . PHP_EOL, $name); + } + return $buffer; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Type +{ + public static function isType(string $type): bool + { + switch ($type) { + case 'numeric': + case 'integer': + case 'int': + case 'iterable': + case 'float': + case 'string': + case 'boolean': + case 'bool': + case 'null': + case 'array': + case 'object': + case 'resource': + case 'scalar': + return \true; + default: + return \false; + } + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use function in_array; +use function sprintf; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class VersionComparisonOperator +{ + /** + * @psalm-var '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' + */ + private $operator; + public function __construct(string $operator) + { + $this->ensureOperatorIsValid($operator); + $this->operator = $operator; + } + /** + * @return '!='|'<'|'<='|'<>'|'='|'=='|'>'|'>='|'eq'|'ge'|'gt'|'le'|'lt'|'ne' + */ + public function asString(): string + { + return $this->operator; + } + /** + * @throws Exception + * + * @psalm-assert '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' $operator + */ + private function ensureOperatorIsValid(string $operator): void + { + if (!in_array($operator, ['<', 'lt', '<=', 'le', '>', 'gt', '>=', 'ge', '==', '=', 'eq', '!=', '<>', 'ne'], \true)) { + throw new \PHPUnit\Util\Exception(sprintf('"%s" is not a valid version_compare() operator', $operator)); + } + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use const DIRECTORY_SEPARATOR; +use function addslashes; +use function array_map; +use function implode; +use function is_string; +use function realpath; +use function sprintf; +use PHPUnit\TextUI\XmlConfiguration\CodeCoverage\CodeCoverage as FilterConfiguration; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @deprecated + */ +final class XdebugFilterScriptGenerator +{ + public function generate(FilterConfiguration $filter): string + { + $files = array_map(static function ($item) { + return sprintf(" '%s'", $item); + }, $this->getItems($filter)); + $files = implode(",\n", $files); + return <<directories() as $directory) { + $path = realpath($directory->path()); + if (is_string($path)) { + $files[] = sprintf(addslashes('%s' . DIRECTORY_SEPARATOR), $path); + } + } + foreach ($filter->files() as $file) { + $files[] = $file->path(); + } + return $files; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use const ENT_QUOTES; +use function assert; +use function class_exists; +use function htmlspecialchars; +use function mb_convert_encoding; +use function ord; +use function preg_replace; +use function settype; +use function strlen; +use DOMCharacterData; +use DOMDocument; +use DOMElement; +use DOMNode; +use DOMText; +use ReflectionClass; +use ReflectionException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Xml +{ + /** + * @deprecated Only used by assertEqualXMLStructure() + */ + public static function import(DOMElement $element): DOMElement + { + return (new DOMDocument())->importNode($element, \true); + } + /** + * @deprecated Only used by assertEqualXMLStructure() + */ + public static function removeCharacterDataNodes(DOMNode $node): void + { + if ($node->hasChildNodes()) { + for ($i = $node->childNodes->length - 1; $i >= 0; $i--) { + if (($child = $node->childNodes->item($i)) instanceof DOMCharacterData) { + $node->removeChild($child); + } + } + } + } + /** + * Escapes a string for the use in XML documents. + * + * Any Unicode character is allowed, excluding the surrogate blocks, FFFE, + * and FFFF (not even as character reference). + * + * @see https://www.w3.org/TR/xml/#charsets + */ + public static function prepareString(string $string): string + { + return preg_replace('/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/', '', htmlspecialchars(self::convertToUtf8($string), ENT_QUOTES)); + } + /** + * "Convert" a DOMElement object into a PHP variable. + */ + public static function xmlToVariable(DOMElement $element) + { + $variable = null; + switch ($element->tagName) { + case 'array': + $variable = []; + foreach ($element->childNodes as $entry) { + if (!$entry instanceof DOMElement || $entry->tagName !== 'element') { + continue; + } + $item = $entry->childNodes->item(0); + if ($item instanceof DOMText) { + $item = $entry->childNodes->item(1); + } + $value = self::xmlToVariable($item); + if ($entry->hasAttribute('key')) { + $variable[(string) $entry->getAttribute('key')] = $value; + } else { + $variable[] = $value; + } + } + break; + case 'object': + $className = $element->getAttribute('class'); + if ($element->hasChildNodes()) { + $arguments = $element->childNodes->item(0)->childNodes; + $constructorArgs = []; + foreach ($arguments as $argument) { + if ($argument instanceof DOMElement) { + $constructorArgs[] = self::xmlToVariable($argument); + } + } + try { + assert(class_exists($className)); + $variable = (new ReflectionClass($className))->newInstanceArgs($constructorArgs); + // @codeCoverageIgnoreStart + } catch (ReflectionException $e) { + throw new \PHPUnit\Util\Exception($e->getMessage(), $e->getCode(), $e); + } + // @codeCoverageIgnoreEnd + } else { + $variable = new $className(); + } + break; + case 'boolean': + $variable = $element->textContent === 'true'; + break; + case 'integer': + case 'double': + case 'string': + $variable = $element->textContent; + settype($variable, $element->tagName); + break; + } + return $variable; + } + private static function convertToUtf8(string $string): string + { + if (!self::isUtf8($string)) { + $string = mb_convert_encoding($string, 'UTF-8'); + } + return $string; + } + private static function isUtf8(string $string): bool + { + $length = strlen($string); + for ($i = 0; $i < $length; $i++) { + if (ord($string[$i]) < 0x80) { + $n = 0; + } elseif ((ord($string[$i]) & 0xe0) === 0xc0) { + $n = 1; + } elseif ((ord($string[$i]) & 0xf0) === 0xe0) { + $n = 2; + } elseif ((ord($string[$i]) & 0xf0) === 0xf0) { + $n = 3; + } else { + return \false; + } + for ($j = 0; $j < $n; $j++) { + if (++$i === $length || (ord($string[$i]) & 0xc0) !== 0x80) { + return \false; + } + } + } + return \true; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +use RuntimeException; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Exception extends RuntimeException implements \PHPUnit\Exception +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class FailedSchemaDetectionResult extends \PHPUnit\Util\Xml\SchemaDetectionResult +{ +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +use function chdir; +use function dirname; +use function error_reporting; +use function file_get_contents; +use function getcwd; +use function libxml_get_errors; +use function libxml_use_internal_errors; +use function sprintf; +use DOMDocument; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Loader +{ + /** + * @throws Exception + */ + public function loadFile(string $filename, bool $isHtml = \false, bool $xinclude = \false, bool $strict = \false): DOMDocument + { + $reporting = error_reporting(0); + $contents = file_get_contents($filename); + error_reporting($reporting); + if ($contents === \false) { + throw new \PHPUnit\Util\Xml\Exception(sprintf('Could not read "%s".', $filename)); + } + return $this->load($contents, $isHtml, $filename, $xinclude, $strict); + } + /** + * @throws Exception + */ + public function load(string $actual, bool $isHtml = \false, string $filename = '', bool $xinclude = \false, bool $strict = \false): DOMDocument + { + if ($actual === '') { + throw new \PHPUnit\Util\Xml\Exception('Could not load XML from empty string'); + } + // Required for XInclude on Windows. + if ($xinclude) { + $cwd = getcwd(); + @chdir(dirname($filename)); + } + $document = new DOMDocument(); + $document->preserveWhiteSpace = \false; + $internal = libxml_use_internal_errors(\true); + $message = ''; + $reporting = error_reporting(0); + if ($filename !== '') { + // Required for XInclude + $document->documentURI = $filename; + } + if ($isHtml) { + $loaded = $document->loadHTML($actual); + } else { + $loaded = $document->loadXML($actual); + } + if (!$isHtml && $xinclude) { + $document->xinclude(); + } + foreach (libxml_get_errors() as $error) { + $message .= "\n" . $error->message; + } + libxml_use_internal_errors($internal); + error_reporting($reporting); + if (isset($cwd)) { + @chdir($cwd); + } + if ($loaded === \false || $strict && $message !== '') { + if ($filename !== '') { + throw new \PHPUnit\Util\Xml\Exception(sprintf('Could not load "%s".%s', $filename, ($message !== '') ? "\n" . $message : '')); + } + if ($message === '') { + $message = 'Could not load XML for unknown reason'; + } + throw new \PHPUnit\Util\Xml\Exception($message); + } + return $document; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +abstract class SchemaDetectionResult +{ + /** + * @psalm-assert-if-true SuccessfulSchemaDetectionResult $this + */ + public function detected(): bool + { + return \false; + } + /** + * @throws Exception + */ + public function version(): string + { + throw new \PHPUnit\Util\Xml\Exception('No supported schema was detected'); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class SchemaDetector +{ + /** + * @throws Exception + */ + public function detect(string $filename): \PHPUnit\Util\Xml\SchemaDetectionResult + { + $document = (new \PHPUnit\Util\Xml\Loader())->loadFile($filename, \false, \true, \true); + $schemaFinder = new \PHPUnit\Util\Xml\SchemaFinder(); + foreach ($schemaFinder->available() as $candidate) { + $schema = (new \PHPUnit\Util\Xml\SchemaFinder())->find($candidate); + if (!(new \PHPUnit\Util\Xml\Validator())->validate($document, $schema)->hasValidationErrors()) { + return new \PHPUnit\Util\Xml\SuccessfulSchemaDetectionResult($candidate); + } + } + return new \PHPUnit\Util\Xml\FailedSchemaDetectionResult(); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +use function assert; +use function defined; +use function is_file; +use function rsort; +use function sprintf; +use DirectoryIterator; +use PHPUnit\Runner\Version; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class SchemaFinder +{ + /** + * @psalm-return non-empty-list + */ + public function available(): array + { + $result = [Version::series()]; + foreach (new DirectoryIterator($this->path() . 'schema') as $file) { + if ($file->isDot()) { + continue; + } + $version = $file->getBasename('.xsd'); + assert(!empty($version)); + $result[] = $version; + } + rsort($result); + return $result; + } + /** + * @throws Exception + */ + public function find(string $version): string + { + if ($version === Version::series()) { + $filename = $this->path() . 'phpunit.xsd'; + } else { + $filename = $this->path() . 'schema/' . $version . '.xsd'; + } + if (!is_file($filename)) { + throw new \PHPUnit\Util\Xml\Exception(sprintf('Schema for PHPUnit %s is not available', $version)); + } + return $filename; + } + private function path(): string + { + if (defined('__PHPUNIT_PHAR_ROOT__')) { + return __PHPUNIT_PHAR_ROOT__ . '/'; + } + return __DIR__ . '/../../../'; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +use function count; +use ArrayIterator; +use Countable; +use DOMNode; +use DOMNodeList; +use IteratorAggregate; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @template-implements IteratorAggregate + */ +final class SnapshotNodeList implements Countable, IteratorAggregate +{ + /** + * @var DOMNode[] + */ + private $nodes = []; + public static function fromNodeList(DOMNodeList $list): self + { + $snapshot = new self(); + foreach ($list as $node) { + $snapshot->nodes[] = $node; + } + return $snapshot; + } + public function count(): int + { + return count($this->nodes); + } + public function getIterator(): ArrayIterator + { + return new ArrayIterator($this->nodes); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class SuccessfulSchemaDetectionResult extends \PHPUnit\Util\Xml\SchemaDetectionResult +{ + /** + * @psalm-var non-empty-string + */ + private $version; + /** + * @psalm-param non-empty-string $version + */ + public function __construct(string $version) + { + $this->version = $version; + } + /** + * @psalm-assert-if-true SuccessfulSchemaDetectionResult $this + */ + public function detected(): bool + { + return \true; + } + /** + * @psalm-return non-empty-string + */ + public function version(): string + { + return $this->version; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +use function sprintf; +use function trim; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + * + * @psalm-immutable + */ +final class ValidationResult +{ + /** + * @psalm-var array> + */ + private $validationErrors = []; + /** + * @psalm-param array $errors + */ + public static function fromArray(array $errors): self + { + $validationErrors = []; + foreach ($errors as $error) { + if (!isset($validationErrors[$error->line])) { + $validationErrors[$error->line] = []; + } + $validationErrors[$error->line][] = trim($error->message); + } + return new self($validationErrors); + } + private function __construct(array $validationErrors) + { + $this->validationErrors = $validationErrors; + } + public function hasValidationErrors(): bool + { + return !empty($this->validationErrors); + } + public function asString(): string + { + $buffer = ''; + foreach ($this->validationErrors as $line => $validationErrorsOnLine) { + $buffer .= sprintf(\PHP_EOL . ' Line %d:' . \PHP_EOL, $line); + foreach ($validationErrorsOnLine as $validationError) { + $buffer .= sprintf(' - %s' . \PHP_EOL, $validationError); + } + } + return $buffer; + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Xml; + +use function file_get_contents; +use function libxml_clear_errors; +use function libxml_get_errors; +use function libxml_use_internal_errors; +use DOMDocument; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class Validator +{ + public function validate(DOMDocument $document, string $xsdFilename): \PHPUnit\Util\Xml\ValidationResult + { + $originalErrorHandling = libxml_use_internal_errors(\true); + $document->schemaValidateSource(file_get_contents($xsdFilename)); + $errors = libxml_get_errors(); + libxml_clear_errors(); + libxml_use_internal_errors($originalErrorHandling); + return \PHPUnit\Util\Xml\ValidationResult::fromArray($errors); + } +} + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use function get_class; +use function implode; +use function str_replace; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Runner\PhptTestCase; +use RecursiveIteratorIterator; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\InvalidArgumentException; +use XMLWriter; +/** + * @internal This class is not covered by the backward compatibility promise for PHPUnit + */ +final class XmlTestListRenderer +{ + /** + * @throws InvalidArgumentException + */ + public function render(TestSuite $suite): string + { + $writer = new XMLWriter(); + $writer->openMemory(); + $writer->setIndent(\true); + $writer->startDocument('1.0', 'UTF-8'); + $writer->startElement('tests'); + $currentTestCase = null; + foreach (new RecursiveIteratorIterator($suite->getIterator()) as $test) { + if ($test instanceof TestCase) { + if (get_class($test) !== $currentTestCase) { + if ($currentTestCase !== null) { + $writer->endElement(); + } + $writer->startElement('testCaseClass'); + $writer->writeAttribute('name', get_class($test)); + $currentTestCase = get_class($test); + } + $writer->startElement('testCaseMethod'); + $writer->writeAttribute('name', $test->getName(\false)); + $writer->writeAttribute('groups', implode(',', $test->getGroups())); + if (!empty($test->getDataSetAsString(\false))) { + $writer->writeAttribute('dataSet', str_replace(' with data set ', '', $test->getDataSetAsString(\false))); + } + $writer->endElement(); + } elseif ($test instanceof PhptTestCase) { + if ($currentTestCase !== null) { + $writer->endElement(); + $currentTestCase = null; + } + $writer->startElement('phptFile'); + $writer->writeAttribute('path', $test->getName()); + $writer->endElement(); + } + } + if ($currentTestCase !== null) { + $writer->endElement(); + } + $writer->endElement(); + $writer->endDocument(); + return $writer->outputMemory(); + } +} + + + + + phpunit + phpunit + 9.6.20 + The PHP Unit Testing framework. + + + BSD-3-Clause + + + pkg:composer/phpunit/phpunit@9.6.20 + + + doctrine + deprecations + 1.1.3 + A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages. + + + MIT + + + pkg:composer/doctrine/deprecations@1.1.3 + + + doctrine + instantiator + 1.5.0 + A small, lightweight utility to instantiate objects in PHP without invoking their constructors + + + MIT + + + pkg:composer/doctrine/instantiator@1.5.0 + + + myclabs + deep-copy + 1.12.0 + Create deep copies (clones) of your objects + + + MIT + + + pkg:composer/myclabs/deep-copy@1.12.0 + + + nikic + php-parser + v4.19.1 + A PHP parser written in PHP + + + BSD-3-Clause + + + pkg:composer/nikic/php-parser@v4.19.1 + + + phar-io + manifest + 2.0.4 + Component for reading phar.io manifest information from a PHP Archive (PHAR) + + + BSD-3-Clause + + + pkg:composer/phar-io/manifest@2.0.4 + + + phar-io + version + 3.2.1 + Library for handling version information and constraints + + + BSD-3-Clause + + + pkg:composer/phar-io/version@3.2.1 + + + phpdocumentor + reflection-common + 2.2.0 + Common reflection classes used by phpdocumentor to reflect the code structure + + + MIT + + + pkg:composer/phpdocumentor/reflection-common@2.2.0 + + + phpdocumentor + reflection-docblock + 5.3.0 + With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock. + + + MIT + + + pkg:composer/phpdocumentor/reflection-docblock@5.3.0 + + + phpdocumentor + type-resolver + 1.8.2 + A PSR-5 based resolver of Class names, Types and Structural Element Names + + + MIT + + + pkg:composer/phpdocumentor/type-resolver@1.8.2 + + + phpspec + prophecy + v1.19.0 + Highly opinionated mocking framework for PHP 5.3+ + + + MIT + + + pkg:composer/phpspec/prophecy@v1.19.0 + + + phpstan + phpdoc-parser + 1.29.1 + PHPDoc parser with support for nullable, intersection and generic types + + + MIT + + + pkg:composer/phpstan/phpdoc-parser@1.29.1 + + + phpunit + php-code-coverage + 9.2.31 + Library that provides collection, processing, and rendering functionality for PHP code coverage information. + + + BSD-3-Clause + + + pkg:composer/phpunit/php-code-coverage@9.2.31 + + + phpunit + php-file-iterator + 3.0.6 + FilterIterator implementation that filters files based on a list of suffixes. BSD-3-Clause @@ -85477,14 +94685,14 @@ final class XmlTestListRenderer sebastian cli-parser - 1.0.1 + 1.0.2 Library for parsing CLI options BSD-3-Clause - pkg:composer/sebastian/cli-parser@1.0.1 + pkg:composer/sebastian/cli-parser@1.0.2 sebastian @@ -85525,26 +94733,26 @@ final class XmlTestListRenderer sebastian complexity - 2.0.2 + 2.0.3 Library for calculating the complexity of PHP code units BSD-3-Clause - pkg:composer/sebastian/complexity@2.0.2 + pkg:composer/sebastian/complexity@2.0.3 sebastian diff - 4.0.5 + 4.0.6 Diff implementation BSD-3-Clause - pkg:composer/sebastian/diff@4.0.5 + pkg:composer/sebastian/diff@4.0.6 sebastian @@ -85561,38 +94769,38 @@ final class XmlTestListRenderer sebastian exporter - 4.0.5 + 4.0.6 Provides the functionality to export PHP variables for visualization BSD-3-Clause - pkg:composer/sebastian/exporter@4.0.5 + pkg:composer/sebastian/exporter@4.0.6 sebastian global-state - 5.0.6 + 5.0.7 Snapshotting of global state BSD-3-Clause - pkg:composer/sebastian/global-state@5.0.6 + pkg:composer/sebastian/global-state@5.0.7 sebastian lines-of-code - 1.0.3 + 1.0.4 Library for counting the lines of code in PHP source code BSD-3-Clause - pkg:composer/sebastian/lines-of-code@1.0.3 + pkg:composer/sebastian/lines-of-code@1.0.4 sebastian @@ -85633,14 +94841,14 @@ final class XmlTestListRenderer sebastian resource-operations - 3.0.3 + 3.0.4 Provides a list of PHP built-in functions that operate on resources BSD-3-Clause - pkg:composer/sebastian/resource-operations@3.0.3 + pkg:composer/sebastian/resource-operations@3.0.4 sebastian @@ -85669,14 +94877,14 @@ final class XmlTestListRenderer theseer tokenizer - 1.2.1 + 1.2.3 A small library for converting tokenized PHP source code into XML and potentially other formats BSD-3-Clause - pkg:composer/theseer/tokenizer@1.2.1 + pkg:composer/theseer/tokenizer@1.2.3 webmozart @@ -85696,7 +94904,1602 @@ final class XmlTestListRenderer - This Schema file defines the rules by which the XML configuration file of PHPUnit 8.5 may be structured. + This Schema file defines the rules by which the XML configuration file of PHPUnit 8.5 may be structured. + + + + + + Root Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The main type specifying the document structure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This Schema file defines the rules by which the XML configuration file of PHPUnit 9.0 may be structured. + + + + + + Root Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The main type specifying the document structure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This Schema file defines the rules by which the XML configuration file of PHPUnit 9.0 may be structured. + + + + + + Root Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The main type specifying the document structure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This Schema file defines the rules by which the XML configuration file of PHPUnit 9.2 may be structured. + + + + + + Root Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The main type specifying the document structure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This Schema file defines the rules by which the XML configuration file of PHPUnit 9.3 may be structured. + + + + + + Root Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The main type specifying the document structure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This Schema file defines the rules by which the XML configuration file of PHPUnit 9.4 may be structured. @@ -85705,30 +96508,33 @@ final class XmlTestListRenderer Root Element - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + @@ -85816,39 +96622,334 @@ final class XmlTestListRenderer - + - + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The main type specifying the document structure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This Schema file defines the rules by which the XML configuration file of PHPUnit 9.5 may be structured. + + + + + + Root Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + - - - - - - - - + + @@ -85935,16 +97036,14 @@ final class XmlTestListRenderer - - + - - + @@ -85954,7 +97053,10 @@ final class XmlTestListRenderer + + + @@ -85964,7 +97066,6 @@ final class XmlTestListRenderer - @@ -85986,8 +97087,8 @@ final class XmlTestListRenderer - - + + @@ -86003,327 +97104,53 @@ final class XmlTestListRenderer - - - - - - - - - - - This Schema file defines the rules by which the XML configuration file of PHPUnit 9.2 may be structured. - - - - - - Root Element - - - - - - - - - - + - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + + - - - The main type specifying the document structure - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - + + + + sebastian/cli-parser @@ -86370,7 +97197,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CliParser; +namespace PHPUnitPHAR\SebastianBergmann\CliParser; use function array_map; use function array_merge; @@ -86403,7 +97230,7 @@ final class Parser * @throws OptionDoesNotAllowArgumentException * @throws UnknownOptionException */ - public function parse(array $argv, string $shortOptions, array $longOptions = null) : array + public function parse(array $argv, string $shortOptions, ?array $longOptions = null): array { if (empty($argv)) { return [[], []]; @@ -86418,7 +97245,7 @@ final class Parser } reset($argv); $argv = array_map('trim', $argv); - while (\false !== ($arg = current($argv))) { + while (\false !== $arg = current($argv)) { $i = key($argv); assert(is_int($i)); next($argv); @@ -86444,7 +97271,7 @@ final class Parser /** * @throws RequiredOptionArgumentMissingException */ - private function parseShortOption(string $arg, string $shortOptions, array &$opts, array &$args) : void + private function parseShortOption(string $arg, string $shortOptions, array &$opts, array &$args): void { $argLength = strlen($arg); for ($i = 0; $i < $argLength; $i++) { @@ -86479,7 +97306,7 @@ final class Parser * @throws OptionDoesNotAllowArgumentException * @throws UnknownOptionException */ - private function parseLongOption(string $arg, array $longOptions, array &$opts, array &$args) : void + private function parseLongOption(string $arg, array $longOptions, array &$opts, array &$args): void { $count = count($longOptions); $list = explode('=', $arg); @@ -86501,7 +97328,7 @@ final class Parser if (substr($longOption, -1) === '=') { /* @noinspection StrlenInEmptyStringCheckContextInspection */ if (substr($longOption, -2) !== '==' && !strlen((string) $optionArgument)) { - if (\false === ($optionArgument = current($args))) { + if (\false === $optionArgument = current($args)) { throw new RequiredOptionArgumentMissingException('--' . $option); } next($args); @@ -86527,7 +97354,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CliParser; +namespace PHPUnitPHAR\SebastianBergmann\CliParser; use function sprintf; use RuntimeException; @@ -86549,7 +97376,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CliParser; +namespace PHPUnitPHAR\SebastianBergmann\CliParser; use Throwable; interface Exception extends Throwable @@ -86566,7 +97393,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CliParser; +namespace PHPUnitPHAR\SebastianBergmann\CliParser; use function sprintf; use RuntimeException; @@ -86588,7 +97415,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CliParser; +namespace PHPUnitPHAR\SebastianBergmann\CliParser; use function sprintf; use RuntimeException; @@ -86610,7 +97437,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CliParser; +namespace PHPUnitPHAR\SebastianBergmann\CliParser; use function sprintf; use RuntimeException; @@ -86665,7 +97492,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnitReverseLookup; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnitReverseLookup; use function array_merge; use function assert; @@ -86711,12 +97538,12 @@ class Wizard } return $filename . ':' . $lineNumber; } - private function updateLookupTable() : void + private function updateLookupTable(): void { $this->processClassesAndTraits(); $this->processFunctions(); } - private function processClassesAndTraits() : void + private function processClassesAndTraits(): void { $classes = get_declared_classes(); $traits = get_declared_traits(); @@ -86733,7 +97560,7 @@ class Wizard $this->processedClasses[$classOrTrait] = \true; } } - private function processFunctions() : void + private function processFunctions(): void { foreach (get_defined_functions()['user'] as $function) { if (isset($this->processedFunctions[$function])) { @@ -86743,7 +97570,7 @@ class Wizard $this->processedFunctions[$function] = \true; } } - private function processFunctionOrMethod(ReflectionFunctionAbstract $functionOrMethod) : void + private function processFunctionOrMethod(ReflectionFunctionAbstract $functionOrMethod): void { if ($functionOrMethod->isInternal()) { return; @@ -86771,7 +97598,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; /** * @psalm-immutable @@ -86781,7 +97608,7 @@ final class ClassMethodUnit extends CodeUnit /** * @psalm-assert-if-true ClassMethodUnit $this */ - public function isClassMethod() : bool + public function isClassMethod(): bool { return \true; } @@ -86797,7 +97624,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; /** * @psalm-immutable @@ -86807,7 +97634,7 @@ final class ClassUnit extends CodeUnit /** * @psalm-assert-if-true ClassUnit $this */ - public function isClass() : bool + public function isClass(): bool { return \true; } @@ -86823,7 +97650,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; use function range; use function sprintf; @@ -86854,7 +97681,7 @@ abstract class CodeUnit * @throws InvalidCodeUnitException * @throws ReflectionException */ - public static function forClass(string $className) : ClassUnit + public static function forClass(string $className): ClassUnit { self::ensureUserDefinedClass($className); $reflector = self::reflectorForClass($className); @@ -86866,7 +97693,7 @@ abstract class CodeUnit * @throws InvalidCodeUnitException * @throws ReflectionException */ - public static function forClassMethod(string $className, string $methodName) : ClassMethodUnit + public static function forClassMethod(string $className, string $methodName): ClassMethodUnit { self::ensureUserDefinedClass($className); $reflector = self::reflectorForClassMethod($className, $methodName); @@ -86878,7 +97705,7 @@ abstract class CodeUnit * @throws InvalidCodeUnitException * @throws ReflectionException */ - public static function forInterface(string $interfaceName) : InterfaceUnit + public static function forInterface(string $interfaceName): InterfaceUnit { self::ensureUserDefinedInterface($interfaceName); $reflector = self::reflectorForClass($interfaceName); @@ -86890,7 +97717,7 @@ abstract class CodeUnit * @throws InvalidCodeUnitException * @throws ReflectionException */ - public static function forInterfaceMethod(string $interfaceName, string $methodName) : InterfaceMethodUnit + public static function forInterfaceMethod(string $interfaceName, string $methodName): InterfaceMethodUnit { self::ensureUserDefinedInterface($interfaceName); $reflector = self::reflectorForClassMethod($interfaceName, $methodName); @@ -86902,7 +97729,7 @@ abstract class CodeUnit * @throws InvalidCodeUnitException * @throws ReflectionException */ - public static function forTrait(string $traitName) : TraitUnit + public static function forTrait(string $traitName): TraitUnit { self::ensureUserDefinedTrait($traitName); $reflector = self::reflectorForClass($traitName); @@ -86914,7 +97741,7 @@ abstract class CodeUnit * @throws InvalidCodeUnitException * @throws ReflectionException */ - public static function forTraitMethod(string $traitName, string $methodName) : TraitMethodUnit + public static function forTraitMethod(string $traitName, string $methodName): TraitMethodUnit { self::ensureUserDefinedTrait($traitName); $reflector = self::reflectorForClassMethod($traitName, $methodName); @@ -86926,7 +97753,7 @@ abstract class CodeUnit * @throws InvalidCodeUnitException * @throws ReflectionException */ - public static function forFunction(string $functionName) : FunctionUnit + public static function forFunction(string $functionName): FunctionUnit { $reflector = self::reflectorForFunction($functionName); if (!$reflector->isUserDefined()) { @@ -86943,46 +97770,46 @@ abstract class CodeUnit $this->sourceFileName = $sourceFileName; $this->sourceLines = $sourceLines; } - public function name() : string + public function name(): string { return $this->name; } - public function sourceFileName() : string + public function sourceFileName(): string { return $this->sourceFileName; } /** * @psalm-return list */ - public function sourceLines() : array + public function sourceLines(): array { return $this->sourceLines; } - public function isClass() : bool + public function isClass(): bool { return \false; } - public function isClassMethod() : bool + public function isClassMethod(): bool { return \false; } - public function isInterface() : bool + public function isInterface(): bool { return \false; } - public function isInterfaceMethod() : bool + public function isInterfaceMethod(): bool { return \false; } - public function isTrait() : bool + public function isTrait(): bool { return \false; } - public function isTraitMethod() : bool + public function isTraitMethod(): bool { return \false; } - public function isFunction() : bool + public function isFunction(): bool { return \false; } @@ -86991,7 +97818,7 @@ abstract class CodeUnit * * @throws InvalidCodeUnitException */ - private static function ensureUserDefinedClass(string $className) : void + private static function ensureUserDefinedClass(string $className): void { try { $reflector = new ReflectionClass($className); @@ -87015,7 +97842,7 @@ abstract class CodeUnit * * @throws InvalidCodeUnitException */ - private static function ensureUserDefinedInterface(string $interfaceName) : void + private static function ensureUserDefinedInterface(string $interfaceName): void { try { $reflector = new ReflectionClass($interfaceName); @@ -87036,7 +97863,7 @@ abstract class CodeUnit * * @throws InvalidCodeUnitException */ - private static function ensureUserDefinedTrait(string $traitName) : void + private static function ensureUserDefinedTrait(string $traitName): void { try { $reflector = new ReflectionClass($traitName); @@ -87057,7 +97884,7 @@ abstract class CodeUnit * * @throws ReflectionException */ - private static function reflectorForClass(string $className) : ReflectionClass + private static function reflectorForClass(string $className): ReflectionClass { try { return new ReflectionClass($className); @@ -87072,7 +97899,7 @@ abstract class CodeUnit * * @throws ReflectionException */ - private static function reflectorForClassMethod(string $className, string $methodName) : ReflectionMethod + private static function reflectorForClassMethod(string $className, string $methodName): ReflectionMethod { try { return new ReflectionMethod($className, $methodName); @@ -87087,7 +97914,7 @@ abstract class CodeUnit * * @throws ReflectionException */ - private static function reflectorForFunction(string $functionName) : ReflectionFunction + private static function reflectorForFunction(string $functionName): ReflectionFunction { try { return new ReflectionFunction($functionName); @@ -87109,7 +97936,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; use function array_merge; use function count; @@ -87124,7 +97951,7 @@ final class CodeUnitCollection implements Countable, IteratorAggregate /** * @psalm-param list $items */ - public static function fromArray(array $items) : self + public static function fromArray(array $items): self { $collection = new self(); foreach ($items as $item) { @@ -87132,7 +97959,7 @@ final class CodeUnitCollection implements Countable, IteratorAggregate } return $collection; } - public static function fromList(CodeUnit ...$items) : self + public static function fromList(CodeUnit ...$items): self { return self::fromArray($items); } @@ -87142,27 +97969,27 @@ final class CodeUnitCollection implements Countable, IteratorAggregate /** * @psalm-return list */ - public function asArray() : array + public function asArray(): array { return $this->codeUnits; } - public function getIterator() : CodeUnitCollectionIterator + public function getIterator(): CodeUnitCollectionIterator { return new CodeUnitCollectionIterator($this); } - public function count() : int + public function count(): int { return count($this->codeUnits); } - public function isEmpty() : bool + public function isEmpty(): bool { return empty($this->codeUnits); } - public function mergeWith(self $other) : self + public function mergeWith(self $other): self { return self::fromArray(array_merge($this->asArray(), $other->asArray())); } - private function add(CodeUnit $item) : void + private function add(CodeUnit $item): void { $this->codeUnits[] = $item; } @@ -87178,7 +98005,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; use Iterator; final class CodeUnitCollectionIterator implements Iterator @@ -87195,23 +98022,23 @@ final class CodeUnitCollectionIterator implements Iterator { $this->codeUnits = $collection->asArray(); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - public function valid() : bool + public function valid(): bool { return isset($this->codeUnits[$this->position]); } - public function key() : int + public function key(): int { return $this->position; } - public function current() : CodeUnit + public function current(): CodeUnit { return $this->codeUnits[$this->position]; } - public function next() : void + public function next(): void { $this->position++; } @@ -87227,7 +98054,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; /** * @psalm-immutable @@ -87237,7 +98064,7 @@ final class FunctionUnit extends CodeUnit /** * @psalm-assert-if-true FunctionUnit $this */ - public function isFunction() : bool + public function isFunction(): bool { return \true; } @@ -87253,7 +98080,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; /** * @psalm-immutable @@ -87263,7 +98090,7 @@ final class InterfaceMethodUnit extends CodeUnit /** * @psalm-assert-if-true InterfaceMethod $this */ - public function isInterfaceMethod() : bool + public function isInterfaceMethod(): bool { return \true; } @@ -87279,7 +98106,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; /** * @psalm-immutable @@ -87289,7 +98116,7 @@ final class InterfaceUnit extends CodeUnit /** * @psalm-assert-if-true InterfaceUnit $this */ - public function isInterface() : bool + public function isInterface(): bool { return \true; } @@ -87338,7 +98165,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; use function array_keys; use function array_merge; @@ -87363,7 +98190,7 @@ final class Mapper /** * @psalm-return array> */ - public function codeUnitsToSourceLines(CodeUnitCollection $codeUnits) : array + public function codeUnitsToSourceLines(CodeUnitCollection $codeUnits): array { $result = []; foreach ($codeUnits as $codeUnit) { @@ -87384,7 +98211,7 @@ final class Mapper * @throws InvalidCodeUnitException * @throws ReflectionException */ - public function stringToCodeUnits(string $unit) : CodeUnitCollection + public function stringToCodeUnits(string $unit): CodeUnitCollection { if (strpos($unit, '::') !== \false) { [$firstPart, $secondPart] = explode('::', $unit); @@ -87454,7 +98281,7 @@ final class Mapper * * @throws ReflectionException */ - private function publicMethodsOfClass(string $className) : CodeUnitCollection + private function publicMethodsOfClass(string $className): CodeUnitCollection { return $this->methodsOfClass($className, ReflectionMethod::IS_PUBLIC); } @@ -87463,7 +98290,7 @@ final class Mapper * * @throws ReflectionException */ - private function publicAndProtectedMethodsOfClass(string $className) : CodeUnitCollection + private function publicAndProtectedMethodsOfClass(string $className): CodeUnitCollection { return $this->methodsOfClass($className, ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED); } @@ -87472,7 +98299,7 @@ final class Mapper * * @throws ReflectionException */ - private function publicAndPrivateMethodsOfClass(string $className) : CodeUnitCollection + private function publicAndPrivateMethodsOfClass(string $className): CodeUnitCollection { return $this->methodsOfClass($className, ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PRIVATE); } @@ -87481,7 +98308,7 @@ final class Mapper * * @throws ReflectionException */ - private function protectedMethodsOfClass(string $className) : CodeUnitCollection + private function protectedMethodsOfClass(string $className): CodeUnitCollection { return $this->methodsOfClass($className, ReflectionMethod::IS_PROTECTED); } @@ -87490,7 +98317,7 @@ final class Mapper * * @throws ReflectionException */ - private function protectedAndPrivateMethodsOfClass(string $className) : CodeUnitCollection + private function protectedAndPrivateMethodsOfClass(string $className): CodeUnitCollection { return $this->methodsOfClass($className, ReflectionMethod::IS_PROTECTED | ReflectionMethod::IS_PRIVATE); } @@ -87499,7 +98326,7 @@ final class Mapper * * @throws ReflectionException */ - private function privateMethodsOfClass(string $className) : CodeUnitCollection + private function privateMethodsOfClass(string $className): CodeUnitCollection { return $this->methodsOfClass($className, ReflectionMethod::IS_PRIVATE); } @@ -87508,7 +98335,7 @@ final class Mapper * * @throws ReflectionException */ - private function methodsOfClass(string $className, int $filter) : CodeUnitCollection + private function methodsOfClass(string $className, int $filter): CodeUnitCollection { $units = []; foreach ($this->reflectorForClass($className)->getMethods($filter) as $method) { @@ -87524,7 +98351,7 @@ final class Mapper * * @throws ReflectionException */ - private function classAndParentClassesAndTraits(string $className) : CodeUnitCollection + private function classAndParentClassesAndTraits(string $className): CodeUnitCollection { $units = [CodeUnit::forClass($className)]; $reflector = $this->reflectorForClass($className); @@ -87557,7 +98384,7 @@ final class Mapper * * @throws ReflectionException */ - private function reflectorForClass(string $className) : ReflectionClass + private function reflectorForClass(string $className): ReflectionClass { try { return new ReflectionClass($className); @@ -87570,7 +98397,7 @@ final class Mapper /** * @throws ReflectionException */ - private function isUserDefinedFunction(string $functionName) : bool + private function isUserDefinedFunction(string $functionName): bool { if (!function_exists($functionName)) { return \false; @@ -87586,7 +98413,7 @@ final class Mapper /** * @throws ReflectionException */ - private function isUserDefinedClass(string $className) : bool + private function isUserDefinedClass(string $className): bool { if (!class_exists($className)) { return \false; @@ -87602,7 +98429,7 @@ final class Mapper /** * @throws ReflectionException */ - private function isUserDefinedInterface(string $interfaceName) : bool + private function isUserDefinedInterface(string $interfaceName): bool { if (!interface_exists($interfaceName)) { return \false; @@ -87618,7 +98445,7 @@ final class Mapper /** * @throws ReflectionException */ - private function isUserDefinedTrait(string $traitName) : bool + private function isUserDefinedTrait(string $traitName): bool { if (!trait_exists($traitName)) { return \false; @@ -87634,7 +98461,7 @@ final class Mapper /** * @throws ReflectionException */ - private function isUserDefinedMethod(string $className, string $methodName) : bool + private function isUserDefinedMethod(string $className, string $methodName): bool { if (!class_exists($className)) { // @codeCoverageIgnoreStart @@ -87666,7 +98493,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; /** * @psalm-immutable @@ -87676,7 +98503,7 @@ final class TraitMethodUnit extends CodeUnit /** * @psalm-assert-if-true TraitMethodUnit $this */ - public function isTraitMethod() : bool + public function isTraitMethod(): bool { return \true; } @@ -87692,7 +98519,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; /** * @psalm-immutable @@ -87702,7 +98529,7 @@ final class TraitUnit extends CodeUnit /** * @psalm-assert-if-true TraitUnit $this */ - public function isTrait() : bool + public function isTrait(): bool { return \true; } @@ -87718,7 +98545,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; use Throwable; interface Exception extends Throwable @@ -87735,7 +98562,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; use RuntimeException; final class InvalidCodeUnitException extends RuntimeException implements Exception @@ -87752,7 +98579,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; use RuntimeException; final class NoTraitException extends RuntimeException implements Exception @@ -87769,7 +98596,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\CodeUnit; +namespace PHPUnitPHAR\SebastianBergmann\CodeUnit; use RuntimeException; final class ReflectionException extends RuntimeException implements Exception @@ -87786,7 +98613,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function array_key_exists; use function is_array; @@ -87881,9 +98708,9 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; -use PHPUnit\SebastianBergmann\Exporter\Exporter; +use PHPUnitPHAR\SebastianBergmann\Exporter\Exporter; /** * Abstract base class for comparators which compare values for equality. */ @@ -87913,7 +98740,7 @@ abstract class Comparator * * @return bool */ - public abstract function accepts($expected, $actual); + abstract public function accepts($expected, $actual); /** * Asserts that two values are equal. * @@ -87925,7 +98752,7 @@ abstract class Comparator * * @throws ComparisonFailure */ - public abstract function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = \false, $ignoreCase = \false); + abstract public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = \false, $ignoreCase = \false); } nodeToText($expected, \true, $ignoreCase); $actualAsString = $this->nodeToText($actual, \true, $ignoreCase); if ($expectedAsString !== $actualAsString) { - $type = $expected instanceof DOMDocument ? 'documents' : 'nodes'; + $type = ($expected instanceof DOMDocument) ? 'documents' : 'nodes'; throw new ComparisonFailure($expected, $actual, $expectedAsString, $actualAsString, \false, sprintf("Failed asserting that two DOM %s are equal.\n", $type)); } } @@ -88103,7 +98930,7 @@ class DOMNodeComparator extends ObjectComparator * Returns the normalized, whitespace-cleaned, and indented textual * representation of a DOMNode. */ - private function nodeToText(DOMNode $node, bool $canonicalize, bool $ignoreCase) : string + private function nodeToText(DOMNode $node, bool $canonicalize, bool $ignoreCase): string { if ($canonicalize) { $document = new DOMDocument(); @@ -88113,10 +98940,10 @@ class DOMNodeComparator extends ObjectComparator } $node = $document; } - $document = $node instanceof DOMDocument ? $node : $node->ownerDocument; + $document = ($node instanceof DOMDocument) ? $node : $node->ownerDocument; $document->formatOutput = \true; $document->normalizeDocument(); - $text = $node instanceof DOMDocument ? $node->saveXML() : $document->saveXML($node); + $text = ($node instanceof DOMDocument) ? $node->saveXML() : $document->saveXML($node); return $ignoreCase ? strtolower($text) : $text; } } @@ -88131,7 +98958,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function abs; use function floor; @@ -88190,9 +99017,9 @@ class DateTimeComparator extends ObjectComparator * 'Invalid DateTimeInterface object' if the provided DateTimeInterface was not properly * initialized. */ - private function dateTimeToString(DateTimeInterface $datetime) : string + private function dateTimeToString(DateTimeInterface $datetime): string { - $string = $datetime->format('Y-m-d\\TH:i:s.uO'); + $string = $datetime->format('Y-m-d\TH:i:s.uO'); return $string ?: 'Invalid DateTimeInterface object'; } } @@ -88207,7 +99034,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function is_float; use function is_numeric; @@ -88266,7 +99093,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use Exception; /** @@ -88312,7 +99139,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function array_unshift; /** @@ -88409,7 +99236,7 @@ class Factory { $this->customComparators = []; } - private function registerDefaultComparators() : void + private function registerDefaultComparators(): void { $this->registerDefaultComparator(new MockObjectComparator()); $this->registerDefaultComparator(new DateTimeComparator()); @@ -88423,7 +99250,7 @@ class Factory $this->registerDefaultComparator(new ScalarComparator()); $this->registerDefaultComparator(new TypeComparator()); } - private function registerDefaultComparator(Comparator $comparator) : void + private function registerDefaultComparator(Comparator $comparator): void { $this->defaultComparators[] = $comparator; $comparator->setFactory($this); @@ -88473,7 +99300,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use PHPUnit\Framework\MockObject\MockObject; /** @@ -88519,7 +99346,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function abs; use function is_float; @@ -88566,11 +99393,11 @@ class NumericComparator extends ScalarComparator throw new ComparisonFailure($expected, $actual, '', '', \false, sprintf('Failed asserting that %s matches expected %s.', $this->exporter->export($actual), $this->exporter->export($expected))); } } - private function isInfinite($value) : bool + private function isInfinite($value): bool { return is_float($value) && is_infinite($value); } - private function isNan($value) : bool + private function isNan($value): bool { return is_float($value) && is_nan($value); } @@ -88586,7 +99413,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function get_class; use function in_array; @@ -88675,7 +99502,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function is_resource; /** @@ -88724,7 +99551,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function is_bool; use function is_object; @@ -88804,7 +99631,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use SplObjectStorage; /** @@ -88860,7 +99687,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use function gettype; use function sprintf; @@ -88918,7 +99745,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; use Throwable; interface Exception extends Throwable @@ -88935,7 +99762,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Comparator; +namespace PHPUnitPHAR\SebastianBergmann\Comparator; final class RuntimeException extends \RuntimeException implements Exception { @@ -88951,33 +99778,31 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Complexity; +namespace PHPUnitPHAR\SebastianBergmann\Complexity; -use PHPUnit\PhpParser\Error; -use PHPUnit\PhpParser\Lexer; -use PHPUnit\PhpParser\Node; -use PHPUnit\PhpParser\NodeTraverser; -use PHPUnit\PhpParser\NodeVisitor\NameResolver; -use PHPUnit\PhpParser\NodeVisitor\ParentConnectingVisitor; -use PHPUnit\PhpParser\Parser; -use PHPUnit\PhpParser\ParserFactory; +use PHPUnitPHAR\PhpParser\Error; +use PHPUnitPHAR\PhpParser\Node; +use PHPUnitPHAR\PhpParser\NodeTraverser; +use PHPUnitPHAR\PhpParser\NodeVisitor\NameResolver; +use PHPUnitPHAR\PhpParser\NodeVisitor\ParentConnectingVisitor; +use PHPUnitPHAR\PhpParser\ParserFactory; final class Calculator { /** * @throws RuntimeException */ - public function calculateForSourceFile(string $sourceFile) : ComplexityCollection + public function calculateForSourceFile(string $sourceFile): ComplexityCollection { - return $this->calculateForSourceString(\file_get_contents($sourceFile)); + return $this->calculateForSourceString(file_get_contents($sourceFile)); } /** * @throws RuntimeException */ - public function calculateForSourceString(string $source) : ComplexityCollection + public function calculateForSourceString(string $source): ComplexityCollection { try { - $nodes = $this->parser()->parse($source); - \assert($nodes !== null); + $nodes = (new ParserFactory())->createForHostVersion()->parse($source); + assert($nodes !== null); return $this->calculateForAbstractSyntaxTree($nodes); // @codeCoverageIgnoreStart } catch (Error $error) { @@ -88990,7 +99815,7 @@ final class Calculator * * @throws RuntimeException */ - public function calculateForAbstractSyntaxTree(array $nodes) : ComplexityCollection + public function calculateForAbstractSyntaxTree(array $nodes): ComplexityCollection { $traverser = new NodeTraverser(); $complexityCalculatingVisitor = new ComplexityCalculatingVisitor(\true); @@ -89007,10 +99832,6 @@ final class Calculator // @codeCoverageIgnoreEnd return $complexityCalculatingVisitor->result(); } - private function parser() : Parser - { - return (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer()); - } } name = $name; $this->cyclomaticComplexity = $cyclomaticComplexity; } - public function name() : string + public function name(): string { return $this->name; } - public function cyclomaticComplexity() : int + public function cyclomaticComplexity(): int { return $this->cyclomaticComplexity; } @@ -89063,7 +99884,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Complexity; +namespace PHPUnitPHAR\SebastianBergmann\Complexity; use function count; use Countable; @@ -89077,7 +99898,7 @@ final class ComplexityCollection implements Countable, IteratorAggregate * @psalm-var list */ private $items = []; - public static function fromList(Complexity ...$items) : self + public static function fromList(Complexity ...$items): self { return new self($items); } @@ -89091,23 +99912,23 @@ final class ComplexityCollection implements Countable, IteratorAggregate /** * @psalm-return list */ - public function asArray() : array + public function asArray(): array { return $this->items; } - public function getIterator() : ComplexityCollectionIterator + public function getIterator(): ComplexityCollectionIterator { return new ComplexityCollectionIterator($this); } - public function count() : int + public function count(): int { return count($this->items); } - public function isEmpty() : bool + public function isEmpty(): bool { return empty($this->items); } - public function cyclomaticComplexity() : int + public function cyclomaticComplexity(): int { $cyclomaticComplexity = 0; foreach ($this as $item) { @@ -89127,7 +99948,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Complexity; +namespace PHPUnitPHAR\SebastianBergmann\Complexity; use Iterator; final class ComplexityCollectionIterator implements Iterator @@ -89144,23 +99965,23 @@ final class ComplexityCollectionIterator implements Iterator { $this->items = $items->asArray(); } - public function rewind() : void + public function rewind(): void { $this->position = 0; } - public function valid() : bool + public function valid(): bool { return isset($this->items[$this->position]); } - public function key() : int + public function key(): int { return $this->position; } - public function current() : Complexity + public function current(): Complexity { return $this->items[$this->position]; } - public function next() : void + public function next(): void { $this->position++; } @@ -89176,7 +99997,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Complexity; +namespace PHPUnitPHAR\SebastianBergmann\Complexity; use Throwable; interface Exception extends Throwable @@ -89193,7 +100014,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Complexity; +namespace PHPUnitPHAR\SebastianBergmann\Complexity; final class RuntimeException extends \RuntimeException implements Exception { @@ -89242,19 +100063,19 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Complexity; +namespace PHPUnitPHAR\SebastianBergmann\Complexity; use function assert; use function is_array; -use PHPUnit\PhpParser\Node; -use PHPUnit\PhpParser\Node\Name; -use PHPUnit\PhpParser\Node\Stmt; -use PHPUnit\PhpParser\Node\Stmt\Class_; -use PHPUnit\PhpParser\Node\Stmt\ClassMethod; -use PHPUnit\PhpParser\Node\Stmt\Function_; -use PHPUnit\PhpParser\Node\Stmt\Trait_; -use PHPUnit\PhpParser\NodeTraverser; -use PHPUnit\PhpParser\NodeVisitorAbstract; +use PHPUnitPHAR\PhpParser\Node; +use PHPUnitPHAR\PhpParser\Node\Name; +use PHPUnitPHAR\PhpParser\Node\Stmt; +use PHPUnitPHAR\PhpParser\Node\Stmt\Class_; +use PHPUnitPHAR\PhpParser\Node\Stmt\ClassMethod; +use PHPUnitPHAR\PhpParser\Node\Stmt\Function_; +use PHPUnitPHAR\PhpParser\Node\Stmt\Trait_; +use PHPUnitPHAR\PhpParser\NodeTraverser; +use PHPUnitPHAR\PhpParser\NodeVisitorAbstract; final class ComplexityCalculatingVisitor extends NodeVisitorAbstract { /** @@ -89269,7 +100090,7 @@ final class ComplexityCalculatingVisitor extends NodeVisitorAbstract { $this->shortCircuitTraversal = $shortCircuitTraversal; } - public function enterNode(Node $node) : ?int + public function enterNode(Node $node): ?int { if (!$node instanceof ClassMethod && !$node instanceof Function_) { return null; @@ -89287,14 +100108,14 @@ final class ComplexityCalculatingVisitor extends NodeVisitorAbstract } return null; } - public function result() : ComplexityCollection + public function result(): ComplexityCollection { return ComplexityCollection::fromList(...$this->result); } /** * @param Stmt[] $statements */ - private function cyclomaticComplexity(array $statements) : int + private function cyclomaticComplexity(array $statements): int { $traverser = new NodeTraverser(); $cyclomaticComplexityCalculatingVisitor = new CyclomaticComplexityCalculatingVisitor(); @@ -89303,7 +100124,7 @@ final class ComplexityCalculatingVisitor extends NodeVisitorAbstract $traverser->traverse($statements); return $cyclomaticComplexityCalculatingVisitor->cyclomaticComplexity(); } - private function classMethodName(ClassMethod $node) : string + private function classMethodName(ClassMethod $node): string { $parent = $node->getAttribute('parent'); assert($parent instanceof Class_ || $parent instanceof Trait_); @@ -89311,7 +100132,7 @@ final class ComplexityCalculatingVisitor extends NodeVisitorAbstract assert($parent->namespacedName instanceof Name); return $parent->namespacedName->toString() . '::' . $node->name->toString(); } - private function functionName(Function_ $node) : string + private function functionName(Function_ $node): string { assert(isset($node->namespacedName)); assert($node->namespacedName instanceof Name); @@ -89329,30 +100150,30 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Complexity; +namespace PHPUnitPHAR\SebastianBergmann\Complexity; use function get_class; -use PHPUnit\PhpParser\Node; -use PHPUnit\PhpParser\Node\Expr\BinaryOp\BooleanAnd; -use PHPUnit\PhpParser\Node\Expr\BinaryOp\BooleanOr; -use PHPUnit\PhpParser\Node\Expr\BinaryOp\LogicalAnd; -use PHPUnit\PhpParser\Node\Expr\BinaryOp\LogicalOr; -use PHPUnit\PhpParser\Node\Expr\Ternary; -use PHPUnit\PhpParser\Node\Stmt\Case_; -use PHPUnit\PhpParser\Node\Stmt\Catch_; -use PHPUnit\PhpParser\Node\Stmt\ElseIf_; -use PHPUnit\PhpParser\Node\Stmt\For_; -use PHPUnit\PhpParser\Node\Stmt\Foreach_; -use PHPUnit\PhpParser\Node\Stmt\If_; -use PHPUnit\PhpParser\Node\Stmt\While_; -use PHPUnit\PhpParser\NodeVisitorAbstract; +use PHPUnitPHAR\PhpParser\Node; +use PHPUnitPHAR\PhpParser\Node\Expr\BinaryOp\BooleanAnd; +use PHPUnitPHAR\PhpParser\Node\Expr\BinaryOp\BooleanOr; +use PHPUnitPHAR\PhpParser\Node\Expr\BinaryOp\LogicalAnd; +use PHPUnitPHAR\PhpParser\Node\Expr\BinaryOp\LogicalOr; +use PHPUnitPHAR\PhpParser\Node\Expr\Ternary; +use PHPUnitPHAR\PhpParser\Node\Stmt\Case_; +use PHPUnitPHAR\PhpParser\Node\Stmt\Catch_; +use PHPUnitPHAR\PhpParser\Node\Stmt\ElseIf_; +use PHPUnitPHAR\PhpParser\Node\Stmt\For_; +use PHPUnitPHAR\PhpParser\Node\Stmt\Foreach_; +use PHPUnitPHAR\PhpParser\Node\Stmt\If_; +use PHPUnitPHAR\PhpParser\Node\Stmt\While_; +use PHPUnitPHAR\PhpParser\NodeVisitorAbstract; final class CyclomaticComplexityCalculatingVisitor extends NodeVisitorAbstract { /** * @var int */ private $cyclomaticComplexity = 1; - public function enterNode(Node $node) : void + public function enterNode(Node $node): void { /* @noinspection GetClassMissUseInspection */ switch (get_class($node)) { @@ -89371,7 +100192,7 @@ final class CyclomaticComplexityCalculatingVisitor extends NodeVisitorAbstract $this->cyclomaticComplexity++; } } - public function cyclomaticComplexity() : int + public function cyclomaticComplexity(): int { return $this->cyclomaticComplexity; } @@ -89387,7 +100208,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff; +namespace PHPUnitPHAR\SebastianBergmann\Diff; final class Chunk { @@ -89419,33 +100240,33 @@ final class Chunk $this->endRange = $endRange; $this->lines = $lines; } - public function getStart() : int + public function getStart(): int { return $this->start; } - public function getStartRange() : int + public function getStartRange(): int { return $this->startRange; } - public function getEnd() : int + public function getEnd(): int { return $this->end; } - public function getEndRange() : int + public function getEndRange(): int { return $this->endRange; } /** * @return Line[] */ - public function getLines() : array + public function getLines(): array { return $this->lines; } /** * @param Line[] $lines */ - public function setLines(array $lines) : void + public function setLines(array $lines): void { foreach ($lines as $line) { if (!$line instanceof Line) { @@ -89466,7 +100287,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff; +namespace PHPUnitPHAR\SebastianBergmann\Diff; final class Diff { @@ -89491,25 +100312,25 @@ final class Diff $this->to = $to; $this->chunks = $chunks; } - public function getFrom() : string + public function getFrom(): string { return $this->from; } - public function getTo() : string + public function getTo(): string { return $this->to; } /** * @return Chunk[] */ - public function getChunks() : array + public function getChunks(): array { return $this->chunks; } /** * @param Chunk[] $chunks */ - public function setChunks(array $chunks) : void + public function setChunks(array $chunks): void { $this->chunks = $chunks; } @@ -89525,7 +100346,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff; +namespace PHPUnitPHAR\SebastianBergmann\Diff; use const PHP_INT_SIZE; use const PREG_SPLIT_DELIM_CAPTURE; @@ -89548,8 +100369,8 @@ use function prev; use function reset; use function sprintf; use function substr; -use PHPUnit\SebastianBergmann\Diff\Output\DiffOutputBuilderInterface; -use PHPUnit\SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder; +use PHPUnitPHAR\SebastianBergmann\Diff\Output\DiffOutputBuilderInterface; +use PHPUnitPHAR\SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder; final class Differ { public const OLD = 0; @@ -89578,7 +100399,7 @@ final class Differ // @deprecated $this->outputBuilder = new UnifiedDiffOutputBuilder($outputBuilder); } else { - throw new InvalidArgumentException(sprintf('Expected builder to be an instance of DiffOutputBuilderInterface, or a string, got %s.', is_object($outputBuilder) ? 'instance of "' . get_class($outputBuilder) . '"' : gettype($outputBuilder) . ' "' . $outputBuilder . '"')); + throw new InvalidArgumentException(sprintf('Expected builder to be an instance of DiffOutputBuilderInterface, or a string, got %s.', is_object($outputBuilder) ? 'instance of "' . get_class($outputBuilder) . '"' : (gettype($outputBuilder) . ' "' . $outputBuilder . '"'))); } } /** @@ -89587,7 +100408,7 @@ final class Differ * @param array|string $from * @param array|string $to */ - public function diff($from, $to, LongestCommonSubsequenceCalculator $lcs = null) : string + public function diff($from, $to, ?LongestCommonSubsequenceCalculator $lcs = null): string { $diff = $this->diffToArray($this->normalizeDiffInput($from), $this->normalizeDiffInput($to), $lcs); return $this->outputBuilder->getDiff($diff); @@ -89607,7 +100428,7 @@ final class Differ * @param array|string $to * @param LongestCommonSubsequenceCalculator $lcs */ - public function diffToArray($from, $to, LongestCommonSubsequenceCalculator $lcs = null) : array + public function diffToArray($from, $to, ?LongestCommonSubsequenceCalculator $lcs = null): array { if (is_string($from)) { $from = $this->splitStringByLines($from); @@ -89670,11 +100491,11 @@ final class Differ /** * Checks if input is string, if so it will split it line-by-line. */ - private function splitStringByLines(string $input) : array + private function splitStringByLines(string $input): array { - return preg_split('/(.*\\R)/', $input, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + return preg_split('/(.*\R)/', $input, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); } - private function selectLcsImplementation(array $from, array $to) : LongestCommonSubsequenceCalculator + private function selectLcsImplementation(array $from, array $to): LongestCommonSubsequenceCalculator { // We do not want to use the time-efficient implementation if its memory // footprint will probably exceed this value. Note that the footprint @@ -89693,13 +100514,13 @@ final class Differ */ private function calculateEstimatedFootprint(array $from, array $to) { - $itemSize = PHP_INT_SIZE === 4 ? 76 : 144; + $itemSize = (PHP_INT_SIZE === 4) ? 76 : 144; return $itemSize * min(count($from), count($to)) ** 2; } /** * Returns true if line ends don't match in a diff. */ - private function detectUnmatchedLineEndings(array $diff) : bool + private function detectUnmatchedLineEndings(array $diff): bool { $newLineBreaks = ['' => \true]; $oldLineBreaks = ['' => \true]; @@ -89731,7 +100552,7 @@ final class Differ } return \false; } - private function getLinebreak($line) : string + private function getLinebreak($line): string { if (!is_string($line)) { return ''; @@ -89748,7 +100569,7 @@ final class Differ } return "\n"; } - private static function getArrayDiffParted(array &$from, array &$to) : array + private static function getArrayDiffParted(array &$from, array &$to): array { $start = []; $end = []; @@ -89789,7 +100610,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff; +namespace PHPUnitPHAR\SebastianBergmann\Diff; use function get_class; use function gettype; @@ -89798,9 +100619,9 @@ use function sprintf; use Exception; final class ConfigurationException extends InvalidArgumentException { - public function __construct(string $option, string $expected, $value, int $code = 0, Exception $previous = null) + public function __construct(string $option, string $expected, $value, int $code = 0, ?Exception $previous = null) { - parent::__construct(sprintf('Option "%s" must be %s, got "%s".', $option, $expected, is_object($value) ? get_class($value) : (null === $value ? '' : gettype($value) . '#' . $value)), $code, $previous); + parent::__construct(sprintf('Option "%s" must be %s, got "%s".', $option, $expected, is_object($value) ? get_class($value) : ((null === $value) ? '' : (gettype($value) . '#' . $value))), $code, $previous); } } type = $type; $this->content = $content; } - public function getContent() : string + public function getContent(): string { return $this->content; } - public function getType() : int + public function getType(): int { return $this->type; } @@ -89920,14 +100741,14 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff; +namespace PHPUnitPHAR\SebastianBergmann\Diff; interface LongestCommonSubsequenceCalculator { /** * Calculates the longest common subsequence of two arrays. */ - public function calculate(array $from, array $to) : array; + public function calculate(array $from, array $to): array; } calculate($fromStart, $toStart), $this->calculate($fromEnd, $toEnd)); } - private function length(array $from, array $to) : array + private function length(array $from, array $to): array { $current = array_fill(0, count($to) + 1, 0); $cFrom = count($from); @@ -89995,13 +100816,10 @@ final class MemoryEfficientLongestCommonSubsequenceCalculator implements Longest for ($j = 0; $j < $cTo; $j++) { if ($from[$i] === $to[$j]) { $current[$j + 1] = $prev[$j] + 1; + } else if ($current[$j] > $prev[$j + 1]) { + $current[$j + 1] = $current[$j]; } else { - // don't use max() to avoid function call overhead - if ($current[$j] > $prev[$j + 1]) { - $current[$j + 1] = $current[$j]; - } else { - $current[$j + 1] = $prev[$j + 1]; - } + $current[$j + 1] = $prev[$j + 1]; } } } @@ -90019,7 +100837,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff\Output; +namespace PHPUnitPHAR\SebastianBergmann\Diff\Output; use function count; abstract class AbstractChunkOutputBuilder implements DiffOutputBuilderInterface @@ -90028,7 +100846,7 @@ abstract class AbstractChunkOutputBuilder implements DiffOutputBuilderInterface * Takes input of the diff array and returns the common parts. * Iterates through diff line by line. */ - protected function getCommonChunks(array $diff, int $lineThreshold = 5) : array + protected function getCommonChunks(array $diff, int $lineThreshold = 5): array { $diffSize = count($diff); $capturing = \false; @@ -90068,14 +100886,14 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff\Output; +namespace PHPUnitPHAR\SebastianBergmann\Diff\Output; use function fclose; use function fopen; use function fwrite; use function stream_get_contents; use function substr; -use PHPUnit\SebastianBergmann\Diff\Differ; +use PHPUnitPHAR\SebastianBergmann\Diff\Differ; /** * Builds a diff string representation in a loose unified diff format * listing only changes lines. Does not include line numbers. @@ -90090,7 +100908,7 @@ final class DiffOnlyOutputBuilder implements DiffOutputBuilderInterface { $this->header = $header; } - public function getDiff(array $diff) : string + public function getDiff(array $diff): string { $buffer = fopen('php://memory', 'r+b'); if ('' !== $this->header) { @@ -90135,7 +100953,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff\Output; +namespace PHPUnitPHAR\SebastianBergmann\Diff\Output; /** * Defines how an output builder should take a generated @@ -90143,7 +100961,7 @@ namespace PHPUnit\SebastianBergmann\Diff\Output; */ interface DiffOutputBuilderInterface { - public function getDiff(array $diff) : string; + public function getDiff(array $diff): string; } assertString($options, 'toFile'); $this->assertStringOrNull($options, 'fromFileDate'); $this->assertStringOrNull($options, 'toFileDate'); - $this->header = sprintf("--- %s%s\n+++ %s%s\n", $options['fromFile'], null === $options['fromFileDate'] ? '' : "\t" . $options['fromFileDate'], $options['toFile'], null === $options['toFileDate'] ? '' : "\t" . $options['toFileDate']); + $this->header = sprintf("--- %s%s\n+++ %s%s\n", $options['fromFile'], (null === $options['fromFileDate']) ? '' : ("\t" . $options['fromFileDate']), $options['toFile'], (null === $options['toFileDate']) ? '' : ("\t" . $options['toFileDate'])); $this->collapseRanges = $options['collapseRanges']; $this->commonLineThreshold = $options['commonLineThreshold']; $this->contextLines = $options['contextLines']; } - public function getDiff(array $diff) : string + public function getDiff(array $diff): string { if (0 === count($diff)) { return ''; @@ -90252,9 +101070,9 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface // If the last char is not a linebreak: add it. // This might happen when both the `from` and `to` do not have a trailing linebreak $last = substr($diff, -1); - return "\n" !== $last && "\r" !== $last ? $diff . "\n" : $diff; + return ("\n" !== $last && "\r" !== $last) ? $diff . "\n" : $diff; } - private function writeDiffHunks($output, array $diff) : void + private function writeDiffHunks($output, array $diff): void { // detect "No newline at end of file" and insert into `$diff` if needed $upperLimit = count($diff); @@ -90299,7 +101117,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface ++$toRange; ++$fromRange; if ($sameCount === $cutOff) { - $contextStartOffset = $hunkCapture - $this->contextLines < 0 ? $hunkCapture : $this->contextLines; + $contextStartOffset = ($hunkCapture - $this->contextLines < 0) ? $hunkCapture : $this->contextLines; // note: $contextEndOffset = $this->contextLines; // // because we never go beyond the end of the diff. @@ -90340,7 +101158,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface } // we end here when cutoff (commonLineThreshold) was not reached, but we where capturing a hunk, // do not render hunk till end automatically because the number of context lines might be less than the commonLineThreshold - $contextStartOffset = $hunkCapture - $this->contextLines < 0 ? $hunkCapture : $this->contextLines; + $contextStartOffset = ($hunkCapture - $this->contextLines < 0) ? $hunkCapture : $this->contextLines; // prevent trying to write out more common lines than there are in the diff _and_ // do not write more than configured through the context lines $contextEndOffset = min($sameCount, $this->contextLines); @@ -90348,7 +101166,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface $toRange -= $sameCount; $this->writeHunk($diff, $hunkCapture - $contextStartOffset, $i - $sameCount + $contextEndOffset + 1, $fromStart - $contextStartOffset, $fromRange + $contextStartOffset + $contextEndOffset, $toStart - $contextStartOffset, $toRange + $contextStartOffset + $contextEndOffset, $output); } - private function writeHunk(array $diff, int $diffStartIndex, int $diffEndIndex, int $fromStart, int $fromRange, int $toStart, int $toRange, $output) : void + private function writeHunk(array $diff, int $diffStartIndex, int $diffEndIndex, int $fromStart, int $fromRange, int $toStart, int $toRange, $output): void { fwrite($output, '@@ -' . $fromStart); if (!$this->collapseRanges || 1 !== $fromRange) { @@ -90379,13 +101197,13 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface //} } } - private function assertString(array $options, string $option) : void + private function assertString(array $options, string $option): void { if (!is_string($options[$option])) { throw new ConfigurationException($option, 'a string', $options[$option]); } } - private function assertStringOrNull(array $options, string $option) : void + private function assertStringOrNull(array $options, string $option): void { if (null !== $options[$option] && !is_string($options[$option])) { throw new ConfigurationException($option, 'a string or ', $options[$option]); @@ -90403,7 +101221,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff\Output; +namespace PHPUnitPHAR\SebastianBergmann\Diff\Output; use function array_splice; use function count; @@ -90415,7 +101233,7 @@ use function min; use function stream_get_contents; use function strlen; use function substr; -use PHPUnit\SebastianBergmann\Diff\Differ; +use PHPUnitPHAR\SebastianBergmann\Diff\Differ; /** * Builds a diff string representation in unified diff format in chunks. */ @@ -90446,7 +101264,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder $this->header = $header; $this->addLineNumbers = $addLineNumbers; } - public function getDiff(array $diff) : string + public function getDiff(array $diff): string { $buffer = fopen('php://memory', 'r+b'); if ('' !== $this->header) { @@ -90463,9 +101281,9 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder // If the diff is non-empty and last char is not a linebreak: add it. // This might happen when both the `from` and `to` do not have a trailing linebreak $last = substr($diff, -1); - return 0 !== strlen($diff) && "\n" !== $last && "\r" !== $last ? $diff . "\n" : $diff; + return (0 !== strlen($diff) && "\n" !== $last && "\r" !== $last) ? $diff . "\n" : $diff; } - private function writeDiffHunks($output, array $diff) : void + private function writeDiffHunks($output, array $diff): void { // detect "No newline at end of file" and insert into `$diff` if needed $upperLimit = count($diff); @@ -90510,7 +101328,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder ++$toRange; ++$fromRange; if ($sameCount === $cutOff) { - $contextStartOffset = $hunkCapture - $this->contextLines < 0 ? $hunkCapture : $this->contextLines; + $contextStartOffset = ($hunkCapture - $this->contextLines < 0) ? $hunkCapture : $this->contextLines; // note: $contextEndOffset = $this->contextLines; // // because we never go beyond the end of the diff. @@ -90548,7 +101366,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder } // we end here when cutoff (commonLineThreshold) was not reached, but we where capturing a hunk, // do not render hunk till end automatically because the number of context lines might be less than the commonLineThreshold - $contextStartOffset = $hunkCapture - $this->contextLines < 0 ? $hunkCapture : $this->contextLines; + $contextStartOffset = ($hunkCapture - $this->contextLines < 0) ? $hunkCapture : $this->contextLines; // prevent trying to write out more common lines than there are in the diff _and_ // do not write more than configured through the context lines $contextEndOffset = min($sameCount, $this->contextLines); @@ -90556,7 +101374,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder $toRange -= $sameCount; $this->writeHunk($diff, $hunkCapture - $contextStartOffset, $i - $sameCount + $contextEndOffset + 1, $fromStart - $contextStartOffset, $fromRange + $contextStartOffset + $contextEndOffset, $toStart - $contextStartOffset, $toRange + $contextStartOffset + $contextEndOffset, $output); } - private function writeHunk(array $diff, int $diffStartIndex, int $diffEndIndex, int $fromStart, int $fromRange, int $toStart, int $toRange, $output) : void + private function writeHunk(array $diff, int $diffStartIndex, int $diffEndIndex, int $fromStart, int $fromRange, int $toStart, int $toRange, $output): void { if ($this->addLineNumbers) { fwrite($output, '@@ -' . $fromStart); @@ -90599,7 +101417,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff; +namespace PHPUnitPHAR\SebastianBergmann\Diff; use function array_pop; use function count; @@ -90614,9 +101432,9 @@ final class Parser /** * @return Diff[] */ - public function parse(string $string) : array + public function parse(string $string): array { - $lines = preg_split('(\\r\\n|\\r|\\n)', $string); + $lines = preg_split('(\r\n|\r|\n)', $string); if (!empty($lines) && $lines[count($lines) - 1] === '') { array_pop($lines); } @@ -90625,7 +101443,7 @@ final class Parser $diff = null; $collected = []; for ($i = 0; $i < $lineCount; ++$i) { - if (preg_match('#^---\\h+"?(?P[^\\v\\t"]+)#', $lines[$i], $fromMatch) && preg_match('#^\\+\\+\\+\\h+"?(?P[^\\v\\t"]+)#', $lines[$i + 1], $toMatch)) { + if (preg_match('#^---\h+"?(?P[^\v\t"]+)#', $lines[$i], $fromMatch) && preg_match('#^\+\+\+\h+"?(?P[^\v\t"]+)#', $lines[$i + 1], $toMatch)) { if ($diff !== null) { $this->parseFileDiff($diff, $collected); $diffs[] = $diff; @@ -90634,7 +101452,7 @@ final class Parser $diff = new Diff($fromMatch['file'], $toMatch['file']); ++$i; } else { - if (preg_match('/^(?:diff --git |index [\\da-f\\.]+|[+-]{3} [ab])/', $lines[$i])) { + if (preg_match('/^(?:diff --git |index [\da-f\.]+|[+-]{3} [ab])/', $lines[$i])) { continue; } $collected[] = $lines[$i]; @@ -90646,13 +101464,13 @@ final class Parser } return $diffs; } - private function parseFileDiff(Diff $diff, array $lines) : void + private function parseFileDiff(Diff $diff, array $lines): void { $chunks = []; $chunk = null; $diffLines = []; foreach ($lines as $line) { - if (preg_match('/^@@\\s+-(?P\\d+)(?:,\\s*(?P\\d+))?\\s+\\+(?P\\d+)(?:,\\s*(?P\\d+))?\\s+@@/', $line, $match)) { + if (preg_match('/^@@\s+-(?P\d+)(?:,\s*(?P\d+))?\s+\+(?P\d+)(?:,\s*(?P\d+))?\s+@@/', $line, $match)) { $chunk = new Chunk((int) $match['start'], isset($match['startrange']) ? max(1, (int) $match['startrange']) : 1, (int) $match['end'], isset($match['endrange']) ? max(1, (int) $match['endrange']) : 1); $chunks[] = $chunk; $diffLines = []; @@ -90685,7 +101503,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Diff; +namespace PHPUnitPHAR\SebastianBergmann\Diff; use function array_reverse; use function count; @@ -90696,7 +101514,7 @@ final class TimeEfficientLongestCommonSubsequenceCalculator implements LongestCo /** * {@inheritdoc} */ - public function calculate(array $from, array $to) : array + public function calculate(array $from, array $to): array { $common = []; $fromLength = count($from); @@ -90713,19 +101531,17 @@ final class TimeEfficientLongestCommonSubsequenceCalculator implements LongestCo for ($j = 1; $j <= $toLength; ++$j) { $o = $j * $width + $i; // don't use max() to avoid function call overhead - $firstOrLast = $from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0; + $firstOrLast = ($from[$i - 1] === $to[$j - 1]) ? $matrix[$o - $width - 1] + 1 : 0; if ($matrix[$o - 1] > $matrix[$o - $width]) { if ($firstOrLast > $matrix[$o - 1]) { $matrix[$o] = $firstOrLast; } else { $matrix[$o] = $matrix[$o - 1]; } + } else if ($firstOrLast > $matrix[$o - $width]) { + $matrix[$o] = $firstOrLast; } else { - if ($firstOrLast > $matrix[$o - $width]) { - $matrix[$o] = $firstOrLast; - } else { - $matrix[$o] = $matrix[$o - $width]; - } + $matrix[$o] = $matrix[$o - $width]; } } } @@ -90759,7 +101575,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Environment; +namespace PHPUnitPHAR\SebastianBergmann\Environment; use const DIRECTORY_SEPARATOR; use const STDIN; @@ -90800,7 +101616,7 @@ final class Console * This code has been copied and adapted from * Symfony\Component\Console\Output\StreamOutput. */ - public function hasColorSupport() : bool + public function hasColorSupport(): bool { if ('Hyper' === getenv('TERM_PROGRAM')) { return \true; @@ -90822,7 +101638,7 @@ final class Console * * @codeCoverageIgnore */ - public function getNumberOfColumns() : int + public function getNumberOfColumns(): int { if (!$this->isInteractive(defined('STDIN') ? STDIN : self::STDIN)) { return 80; @@ -90840,7 +101656,7 @@ final class Console * * @param int|resource $fileDescriptor */ - public function isInteractive($fileDescriptor = self::STDOUT) : bool + public function isInteractive($fileDescriptor = self::STDOUT): bool { if (is_resource($fileDescriptor)) { if (function_exists('stream_isatty') && @stream_isatty($fileDescriptor)) { @@ -90854,21 +101670,21 @@ final class Console } return function_exists('posix_isatty') && @posix_isatty($fileDescriptor); } - private function isWindows() : bool + private function isWindows(): bool { return DIRECTORY_SEPARATOR === '\\'; } /** * @codeCoverageIgnore */ - private function getNumberOfColumnsInteractive() : int + private function getNumberOfColumnsInteractive(): int { - if (function_exists('shell_exec') && preg_match('#\\d+ (\\d+)#', shell_exec('stty size') ?: '', $match) === 1) { + if (function_exists('shell_exec') && preg_match('#\d+ (\d+)#', shell_exec('stty size') ?: '', $match) === 1) { if ((int) $match[1] > 0) { return (int) $match[1]; } } - if (function_exists('shell_exec') && preg_match('#columns = (\\d+);#', shell_exec('stty') ?: '', $match) === 1) { + if (function_exists('shell_exec') && preg_match('#columns = (\d+);#', shell_exec('stty') ?: '', $match) === 1) { if ((int) $match[1] > 0) { return (int) $match[1]; } @@ -90878,11 +101694,11 @@ final class Console /** * @codeCoverageIgnore */ - private function getNumberOfColumnsWindows() : int + private function getNumberOfColumnsWindows(): int { $ansicon = getenv('ANSICON'); $columns = 80; - if (is_string($ansicon) && preg_match('/^(\\d+)x\\d+ \\(\\d+x(\\d+)\\)$/', trim($ansicon), $matches)) { + if (is_string($ansicon) && preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim($ansicon), $matches)) { $columns = (int) $matches[1]; } elseif (function_exists('proc_open')) { $process = proc_open('mode CON', [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes, null, null, ['suppress_errors' => \true]); @@ -90891,7 +101707,7 @@ final class Console fclose($pipes[1]); fclose($pipes[2]); proc_close($process); - if (preg_match('/--------+\\r?\\n.+?(\\d+)\\r?\\n.+?(\\d+)\\r?\\n/', $info, $matches)) { + if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { $columns = (int) $matches[2]; } } @@ -90943,7 +101759,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Environment; +namespace PHPUnitPHAR\SebastianBergmann\Environment; use const DIRECTORY_SEPARATOR; use const PHP_OS; @@ -90955,7 +101771,7 @@ final class OperatingSystem * Returns PHP_OS_FAMILY (if defined (which it is on PHP >= 7.2)). * Returns a string (compatible with PHP_OS_FAMILY) derived from PHP_OS otherwise. */ - public function getFamily() : string + public function getFamily(): string { if (defined('PHP_OS_FAMILY')) { return PHP_OS_FAMILY; @@ -90991,7 +101807,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Environment; +namespace PHPUnitPHAR\SebastianBergmann\Environment; use const PHP_BINARY; use const PHP_BINDIR; @@ -91026,7 +101842,7 @@ final class Runtime * Returns true when Xdebug or PCOV is available or * the runtime used is PHPDBG. */ - public function canCollectCodeCoverage() : bool + public function canCollectCodeCoverage(): bool { return $this->hasXdebug() || $this->hasPCOV() || $this->hasPHPDBGCodeCoverage(); } @@ -91034,7 +101850,7 @@ final class Runtime * Returns true when Zend OPcache is loaded, enabled, * and is configured to discard comments. */ - public function discardsComments() : bool + public function discardsComments(): bool { if (!$this->isOpcacheActive()) { return \false; @@ -91048,7 +101864,7 @@ final class Runtime * Returns true when Zend OPcache is loaded, enabled, * and is configured to perform just-in-time compilation. */ - public function performsJustInTimeCompilation() : bool + public function performsJustInTimeCompilation(): bool { if (PHP_MAJOR_VERSION < 8) { return \false; @@ -91065,7 +101881,7 @@ final class Runtime * Returns the path to the binary of the current runtime. * Appends ' --php' to the path when the runtime is HHVM. */ - public function getBinary() : string + public function getBinary(): string { // HHVM if (self::$binary === null && $this->isHHVM()) { @@ -91097,11 +101913,11 @@ final class Runtime } return self::$binary; } - public function getNameWithVersion() : string + public function getNameWithVersion(): string { return $this->getName() . ' ' . $this->getVersion(); } - public function getNameWithVersionAndCodeCoverageDriver() : string + public function getNameWithVersionAndCodeCoverageDriver(): string { if (!$this->canCollectCodeCoverage() || $this->hasPHPDBGCodeCoverage()) { return $this->getNameWithVersion(); @@ -91113,7 +101929,7 @@ final class Runtime return sprintf('%s with Xdebug %s', $this->getNameWithVersion(), phpversion('xdebug')); } } - public function getName() : string + public function getName(): string { if ($this->isHHVM()) { // @codeCoverageIgnoreStart @@ -91127,7 +101943,7 @@ final class Runtime } return 'PHP'; } - public function getVendorUrl() : string + public function getVendorUrl(): string { if ($this->isHHVM()) { // @codeCoverageIgnoreStart @@ -91136,7 +101952,7 @@ final class Runtime } return 'https://secure.php.net/'; } - public function getVersion() : string + public function getVersion(): string { if ($this->isHHVM()) { // @codeCoverageIgnoreStart @@ -91148,28 +101964,28 @@ final class Runtime /** * Returns true when the runtime used is PHP and Xdebug is loaded. */ - public function hasXdebug() : bool + public function hasXdebug(): bool { return ($this->isPHP() || $this->isHHVM()) && extension_loaded('xdebug'); } /** * Returns true when the runtime used is HHVM. */ - public function isHHVM() : bool + public function isHHVM(): bool { return defined('HHVM_VERSION'); } /** * Returns true when the runtime used is PHP without the PHPDBG SAPI. */ - public function isPHP() : bool + public function isPHP(): bool { return !$this->isHHVM() && !$this->isPHPDBG(); } /** * Returns true when the runtime used is PHP with the PHPDBG SAPI. */ - public function isPHPDBG() : bool + public function isPHPDBG(): bool { return PHP_SAPI === 'phpdbg' && !$this->isHHVM(); } @@ -91177,14 +101993,14 @@ final class Runtime * Returns true when the runtime used is PHP with the PHPDBG SAPI * and the phpdbg_*_oplog() functions are available (PHP >= 7.0). */ - public function hasPHPDBGCodeCoverage() : bool + public function hasPHPDBGCodeCoverage(): bool { return $this->isPHPDBG(); } /** * Returns true when the runtime used is PHP with PCOV loaded and enabled. */ - public function hasPCOV() : bool + public function hasPCOV(): bool { return $this->isPHP() && extension_loaded('pcov') && ini_get('pcov.enabled'); } @@ -91200,7 +102016,7 @@ final class Runtime * * @return string[] */ - public function getCurrentSettings(array $values) : array + public function getCurrentSettings(array $values): array { $diff = []; $files = []; @@ -91224,7 +102040,7 @@ final class Runtime } return $diff; } - private function isOpcacheActive() : bool + private function isOpcacheActive(): bool { if (!extension_loaded('Zend OPcache')) { return \false; @@ -91249,7 +102065,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Exporter; +namespace PHPUnitPHAR\SebastianBergmann\Exporter; use function bin2hex; use function count; @@ -91275,7 +102091,7 @@ use function str_replace; use function strlen; use function substr; use function var_export; -use PHPUnit\SebastianBergmann\RecursionContext\Context; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\Context; use SplObjectStorage; /** * A nifty utility for visualizing PHP variables. @@ -91317,7 +102133,7 @@ class Exporter * * @return string */ - public function shortenedRecursiveExport(&$data, Context $context = null) + public function shortenedRecursiveExport(&$data, ?Context $context = null) { $result = []; $exporter = new self(); @@ -91360,18 +102176,16 @@ class Exporter if (mb_strlen($string) > 40) { $string = mb_substr($string, 0, 30) . '...' . mb_substr($string, -7); } - } else { - if (strlen($string) > 40) { - $string = substr($string, 0, 30) . '...' . substr($string, -7); - } + } else if (strlen($string) > 40) { + $string = substr($string, 0, 30) . '...' . substr($string, -7); } return $string; } if (is_object($value)) { - return sprintf('%s Object (%s)', get_class($value), count($this->toArray($value)) > 0 ? '...' : ''); + return sprintf('%s Object (%s)', get_class($value), (count($this->toArray($value)) > 0) ? '...' : ''); } if (is_array($value)) { - return sprintf('Array (%s)', count($value) > 0 ? '...' : ''); + return sprintf('Array (%s)', (count($value) > 0) ? '...' : ''); } return $this->export($value); } @@ -91398,7 +102212,7 @@ class Exporter // private $property => "\0Classname\0property" // protected $property => "\0*\0property" // public $property => "property" - if (preg_match('/^\\0.+\\0(.+)$/', (string) $key, $matches)) { + if (preg_match('/^\0.+\0(.+)$/', (string) $key, $matches)) { $key = $matches[1]; } // See https://github.com/php/php-src/commit/5721132 @@ -91460,10 +102274,10 @@ class Exporter } if (is_string($value)) { // Match for most non printable chars somewhat taking multibyte chars into account - if (preg_match('/[^\\x09-\\x0d\\x1b\\x20-\\xff]/', $value)) { + if (preg_match('/[^\x09-\x0d\x1b\x20-\xff]/', $value)) { return 'Binary String: 0x' . bin2hex($value); } - return "'" . str_replace('', "\n", str_replace(["\r\n", "\n\r", "\r", "\n"], ['\\r\\n', '\\n\\r', '\\r', '\\n'], $value)) . "'"; + return "'" . str_replace('', "\n", str_replace(["\r\n", "\n\r", "\r", "\n"], ['\r\n', '\n\r', '\r', '\n'], $value)) . "'"; } $whitespace = str_repeat(' ', 4 * $indentation); if (!$processed) { @@ -91547,7 +102361,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\GlobalState; +namespace PHPUnitPHAR\SebastianBergmann\GlobalState; use const PHP_EOL; use function is_array; @@ -91560,7 +102374,7 @@ use function var_export; */ final class CodeExporter { - public function constants(Snapshot $snapshot) : string + public function constants(Snapshot $snapshot): string { $result = ''; foreach ($snapshot->constants() as $name => $value) { @@ -91568,7 +102382,7 @@ final class CodeExporter } return $result; } - public function globalVariables(Snapshot $snapshot) : string + public function globalVariables(Snapshot $snapshot): string { $result = <<<'EOT' call_user_func( @@ -91587,7 +102401,7 @@ EOT; } return $result; } - public function iniSettings(Snapshot $snapshot) : string + public function iniSettings(Snapshot $snapshot): string { $result = ''; foreach ($snapshot->iniSettings() as $key => $value) { @@ -91595,14 +102409,14 @@ EOT; } return $result; } - private function exportVariable($variable) : string + private function exportVariable($variable): string { if (is_scalar($variable) || null === $variable || is_array($variable) && $this->arrayOnlyContainsScalars($variable)) { return var_export($variable, \true); } return 'unserialize(' . var_export(serialize($variable), \true) . ')'; } - private function arrayOnlyContainsScalars(array $array) : bool + private function arrayOnlyContainsScalars(array $array): bool { $result = \true; foreach ($array as $element) { @@ -91629,7 +102443,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\GlobalState; +namespace PHPUnitPHAR\SebastianBergmann\GlobalState; use function in_array; use function strpos; @@ -91660,38 +102474,38 @@ final class ExcludeList * @var array */ private $staticAttributes = []; - public function addGlobalVariable(string $variableName) : void + public function addGlobalVariable(string $variableName): void { $this->globalVariables[$variableName] = \true; } - public function addClass(string $className) : void + public function addClass(string $className): void { $this->classes[] = $className; } - public function addSubclassesOf(string $className) : void + public function addSubclassesOf(string $className): void { $this->parentClasses[] = $className; } - public function addImplementorsOf(string $interfaceName) : void + public function addImplementorsOf(string $interfaceName): void { $this->interfaces[] = $interfaceName; } - public function addClassNamePrefix(string $classNamePrefix) : void + public function addClassNamePrefix(string $classNamePrefix): void { $this->classNamePrefixes[] = $classNamePrefix; } - public function addStaticAttribute(string $className, string $attributeName) : void + public function addStaticAttribute(string $className, string $attributeName): void { if (!isset($this->staticAttributes[$className])) { $this->staticAttributes[$className] = []; } $this->staticAttributes[$className][$attributeName] = \true; } - public function isGlobalVariableExcluded(string $variableName) : bool + public function isGlobalVariableExcluded(string $variableName): bool { return isset($this->globalVariables[$variableName]); } - public function isStaticAttributeExcluded(string $className, string $attributeName) : bool + public function isStaticAttributeExcluded(string $className, string $attributeName): bool { if (in_array($className, $this->classes, \true)) { return \true; @@ -91762,7 +102576,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\GlobalState; +namespace PHPUnitPHAR\SebastianBergmann\GlobalState; use function array_diff; use function array_key_exists; @@ -91786,9 +102600,9 @@ class Restorer * * @see https://github.com/krakjoe/uopz */ - public function restoreFunctions(Snapshot $snapshot) : void + public function restoreFunctions(Snapshot $snapshot): void { - if (!function_exists('PHPUnit\\uopz_delete')) { + if (!function_exists('PHPUnitPHAR\uopz_delete')) { throw new RuntimeException('The uopz_delete() function is required for this operation'); } $functions = get_defined_functions(); @@ -91799,7 +102613,7 @@ class Restorer /** * Restores all global and super-global variables from a snapshot. */ - public function restoreGlobalVariables(Snapshot $snapshot) : void + public function restoreGlobalVariables(Snapshot $snapshot): void { $superGlobalArrays = $snapshot->superGlobalArrays(); foreach ($superGlobalArrays as $superGlobalArray) { @@ -91819,7 +102633,7 @@ class Restorer /** * Restores all static attributes in user-defined classes from this snapshot. */ - public function restoreStaticAttributes(Snapshot $snapshot) : void + public function restoreStaticAttributes(Snapshot $snapshot): void { $current = new Snapshot($snapshot->excludeList(), \false, \false, \false, \false, \true, \false, \false, \false, \false); $newClasses = array_diff($current->classes(), $snapshot->classes()); @@ -91853,7 +102667,7 @@ class Restorer /** * Restores a super-global variable array from this snapshot. */ - private function restoreSuperGlobalArray(Snapshot $snapshot, string $superGlobalArray) : void + private function restoreSuperGlobalArray(Snapshot $snapshot, string $superGlobalArray): void { $superGlobalVariables = $snapshot->superGlobalVariables(); if (isset($GLOBALS[$superGlobalArray]) && is_array($GLOBALS[$superGlobalArray]) && isset($superGlobalVariables[$superGlobalArray])) { @@ -91879,7 +102693,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\GlobalState; +namespace PHPUnitPHAR\SebastianBergmann\GlobalState; use const PHP_VERSION_ID; use function array_keys; @@ -91901,8 +102715,8 @@ use function is_scalar; use function serialize; use function unserialize; use ReflectionClass; -use PHPUnit\SebastianBergmann\ObjectReflector\ObjectReflector; -use PHPUnit\SebastianBergmann\RecursionContext\Context; +use PHPUnitPHAR\SebastianBergmann\ObjectReflector\ObjectReflector; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\Context; use Throwable; /** * A snapshot of global state. @@ -91960,7 +102774,7 @@ class Snapshot /** * Creates a snapshot of the current global state. */ - public function __construct(ExcludeList $excludeList = null, bool $includeGlobalVariables = \true, bool $includeStaticAttributes = \true, bool $includeConstants = \true, bool $includeFunctions = \true, bool $includeClasses = \true, bool $includeInterfaces = \true, bool $includeTraits = \true, bool $includeIniSettings = \true, bool $includeIncludedFiles = \true) + public function __construct(?ExcludeList $excludeList = null, bool $includeGlobalVariables = \true, bool $includeStaticAttributes = \true, bool $includeConstants = \true, bool $includeFunctions = \true, bool $includeClasses = \true, bool $includeInterfaces = \true, bool $includeTraits = \true, bool $includeIniSettings = \true, bool $includeIncludedFiles = \true) { $this->excludeList = $excludeList ?: new ExcludeList(); if ($includeConstants) { @@ -91992,58 +102806,58 @@ class Snapshot $this->traits = get_declared_traits(); } } - public function excludeList() : ExcludeList + public function excludeList(): ExcludeList { return $this->excludeList; } - public function globalVariables() : array + public function globalVariables(): array { return $this->globalVariables; } - public function superGlobalVariables() : array + public function superGlobalVariables(): array { return $this->superGlobalVariables; } - public function superGlobalArrays() : array + public function superGlobalArrays(): array { return $this->superGlobalArrays; } - public function staticAttributes() : array + public function staticAttributes(): array { return $this->staticAttributes; } - public function iniSettings() : array + public function iniSettings(): array { return $this->iniSettings; } - public function includedFiles() : array + public function includedFiles(): array { return $this->includedFiles; } - public function constants() : array + public function constants(): array { return $this->constants; } - public function functions() : array + public function functions(): array { return $this->functions; } - public function interfaces() : array + public function interfaces(): array { return $this->interfaces; } - public function classes() : array + public function classes(): array { return $this->classes; } - public function traits() : array + public function traits(): array { return $this->traits; } /** * Creates a snapshot user-defined constants. */ - private function snapshotConstants() : void + private function snapshotConstants(): void { $constants = get_defined_constants(\true); if (isset($constants['user'])) { @@ -92053,7 +102867,7 @@ class Snapshot /** * Creates a snapshot user-defined functions. */ - private function snapshotFunctions() : void + private function snapshotFunctions(): void { $functions = get_defined_functions(); $this->functions = $functions['user']; @@ -92061,7 +102875,7 @@ class Snapshot /** * Creates a snapshot user-defined classes. */ - private function snapshotClasses() : void + private function snapshotClasses(): void { foreach (array_reverse(get_declared_classes()) as $className) { $class = new ReflectionClass($className); @@ -92075,7 +102889,7 @@ class Snapshot /** * Creates a snapshot user-defined interfaces. */ - private function snapshotInterfaces() : void + private function snapshotInterfaces(): void { foreach (array_reverse(get_declared_interfaces()) as $interfaceName) { $class = new ReflectionClass($interfaceName); @@ -92089,7 +102903,7 @@ class Snapshot /** * Creates a snapshot of all global and super-global variables. */ - private function snapshotGlobals() : void + private function snapshotGlobals(): void { $superGlobalArrays = $this->superGlobalArrays(); foreach ($superGlobalArrays as $superGlobalArray) { @@ -92105,7 +102919,7 @@ class Snapshot /** * Creates a snapshot a super-global variable array. */ - private function snapshotSuperGlobalArray(string $superGlobalArray) : void + private function snapshotSuperGlobalArray(string $superGlobalArray): void { $this->superGlobalVariables[$superGlobalArray] = []; if (isset($GLOBALS[$superGlobalArray]) && is_array($GLOBALS[$superGlobalArray])) { @@ -92118,7 +102932,7 @@ class Snapshot /** * Creates a snapshot of all static attributes in user-defined classes. */ - private function snapshotStaticAttributes() : void + private function snapshotStaticAttributes(): void { foreach ($this->classes as $className) { $class = new ReflectionClass($className); @@ -92148,11 +102962,11 @@ class Snapshot /** * Returns a list of all super-global variable arrays. */ - private function setupSuperGlobalArrays() : void + private function setupSuperGlobalArrays(): void { $this->superGlobalArrays = ['_ENV', '_POST', '_GET', '_COOKIE', '_SERVER', '_FILES', '_REQUEST']; } - private function canBeSerialized($variable) : bool + private function canBeSerialized($variable): bool { if (is_scalar($variable) || $variable === null) { return \true; @@ -92178,7 +102992,7 @@ class Snapshot } return \true; } - private function enumerateObjectsAndResources($variable) : array + private function enumerateObjectsAndResources($variable): array { if (isset(func_get_args()[1])) { $processed = func_get_args()[1]; @@ -92231,7 +103045,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\GlobalState; +namespace PHPUnitPHAR\SebastianBergmann\GlobalState; use Throwable; interface Exception extends Throwable @@ -92248,7 +103062,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\GlobalState; +namespace PHPUnitPHAR\SebastianBergmann\GlobalState; final class RuntimeException extends \RuntimeException implements Exception { @@ -92264,36 +103078,34 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\LinesOfCode; +namespace PHPUnitPHAR\SebastianBergmann\LinesOfCode; use function substr_count; -use PHPUnit\PhpParser\Error; -use PHPUnit\PhpParser\Lexer; -use PHPUnit\PhpParser\Node; -use PHPUnit\PhpParser\NodeTraverser; -use PHPUnit\PhpParser\Parser; -use PHPUnit\PhpParser\ParserFactory; +use PHPUnitPHAR\PhpParser\Error; +use PHPUnitPHAR\PhpParser\Node; +use PHPUnitPHAR\PhpParser\NodeTraverser; +use PHPUnitPHAR\PhpParser\ParserFactory; final class Counter { /** * @throws RuntimeException */ - public function countInSourceFile(string $sourceFile) : LinesOfCode + public function countInSourceFile(string $sourceFile): LinesOfCode { - return $this->countInSourceString(\file_get_contents($sourceFile)); + return $this->countInSourceString(file_get_contents($sourceFile)); } /** * @throws RuntimeException */ - public function countInSourceString(string $source) : LinesOfCode + public function countInSourceString(string $source): LinesOfCode { $linesOfCode = substr_count($source, "\n"); if ($linesOfCode === 0 && !empty($source)) { $linesOfCode = 1; } try { - $nodes = $this->parser()->parse($source); - \assert($nodes !== null); + $nodes = (new ParserFactory())->createForHostVersion()->parse($source); + assert($nodes !== null); return $this->countInAbstractSyntaxTree($linesOfCode, $nodes); // @codeCoverageIgnoreStart } catch (Error $error) { @@ -92306,7 +103118,7 @@ final class Counter * * @throws RuntimeException */ - public function countInAbstractSyntaxTree(int $linesOfCode, array $nodes) : LinesOfCode + public function countInAbstractSyntaxTree(int $linesOfCode, array $nodes): LinesOfCode { $traverser = new NodeTraverser(); $visitor = new LineCountingVisitor($linesOfCode); @@ -92321,10 +103133,6 @@ final class Counter // @codeCoverageIgnoreEnd return $visitor->result(); } - private function parser() : Parser - { - return (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer()); - } } linesOfCode = $linesOfCode; } - public function enterNode(Node $node) : void + public function enterNode(Node $node): void { $this->comments = array_merge($this->comments, $node->getComments()); if (!$node instanceof Expr) { @@ -92472,7 +103280,7 @@ final class LineCountingVisitor extends NodeVisitorAbstract } $this->linesWithStatements[] = $node->getStartLine(); } - public function result() : LinesOfCode + public function result(): LinesOfCode { $commentLinesOfCode = 0; foreach ($this->comments() as $comment) { @@ -92483,7 +103291,7 @@ final class LineCountingVisitor extends NodeVisitorAbstract /** * @return Comment[] */ - private function comments() : array + private function comments(): array { $comments = []; foreach ($this->comments as $comment) { @@ -92503,7 +103311,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\LinesOfCode; +namespace PHPUnitPHAR\SebastianBergmann\LinesOfCode; /** * @psalm-immutable @@ -92552,23 +103360,23 @@ final class LinesOfCode $this->nonCommentLinesOfCode = $nonCommentLinesOfCode; $this->logicalLinesOfCode = $logicalLinesOfCode; } - public function linesOfCode() : int + public function linesOfCode(): int { return $this->linesOfCode; } - public function commentLinesOfCode() : int + public function commentLinesOfCode(): int { return $this->commentLinesOfCode; } - public function nonCommentLinesOfCode() : int + public function nonCommentLinesOfCode(): int { return $this->nonCommentLinesOfCode; } - public function logicalLinesOfCode() : int + public function logicalLinesOfCode(): int { return $this->logicalLinesOfCode; } - public function plus(self $other) : self + public function plus(self $other): self { return new self($this->linesOfCode() + $other->linesOfCode(), $this->commentLinesOfCode() + $other->commentLinesOfCode(), $this->nonCommentLinesOfCode() + $other->nonCommentLinesOfCode(), $this->logicalLinesOfCode() + $other->logicalLinesOfCode()); } @@ -92584,14 +103392,14 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\ObjectEnumerator; +namespace PHPUnitPHAR\SebastianBergmann\ObjectEnumerator; use function array_merge; use function func_get_args; use function is_array; use function is_object; -use PHPUnit\SebastianBergmann\ObjectReflector\ObjectReflector; -use PHPUnit\SebastianBergmann\RecursionContext\Context; +use PHPUnitPHAR\SebastianBergmann\ObjectReflector\ObjectReflector; +use PHPUnitPHAR\SebastianBergmann\RecursionContext\Context; /** * Traverses array structures and object graphs * to enumerate all referenced objects. @@ -92656,7 +103464,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\ObjectEnumerator; +namespace PHPUnitPHAR\SebastianBergmann\ObjectEnumerator; use Throwable; interface Exception extends Throwable @@ -92673,7 +103481,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\ObjectEnumerator; +namespace PHPUnitPHAR\SebastianBergmann\ObjectEnumerator; class InvalidArgumentException extends \InvalidArgumentException implements Exception { @@ -92689,7 +103497,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\ObjectReflector; +namespace PHPUnitPHAR\SebastianBergmann\ObjectReflector; use Throwable; interface Exception extends Throwable @@ -92706,7 +103514,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\ObjectReflector; +namespace PHPUnitPHAR\SebastianBergmann\ObjectReflector; class InvalidArgumentException extends \InvalidArgumentException implements Exception { @@ -92722,7 +103530,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\ObjectReflector; +namespace PHPUnitPHAR\SebastianBergmann\ObjectReflector; use function count; use function explode; @@ -92735,7 +103543,7 @@ class ObjectReflector * * @throws InvalidArgumentException */ - public function getAttributes($object) : array + public function getAttributes($object): array { if (!is_object($object)) { throw new InvalidArgumentException(); @@ -92746,12 +103554,10 @@ class ObjectReflector $name = explode("\x00", (string) $name); if (count($name) === 1) { $name = $name[0]; + } else if ($name[1] !== $className) { + $name = $name[1] . '::' . $name[2]; } else { - if ($name[1] !== $className) { - $name = $name[1] . '::' . $name[2]; - } else { - $name = $name[2]; - } + $name = $name[2]; } $attributes[$name] = $value; } @@ -92769,7 +103575,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\RecursionContext; +namespace PHPUnitPHAR\SebastianBergmann\RecursionContext; use const PHP_INT_MAX; use const PHP_INT_MIN; @@ -92896,7 +103702,7 @@ final class Context /** * @param object $object */ - private function addObject($object) : string + private function addObject($object): string { if (!$this->objects->contains($object)) { $this->objects->attach($object); @@ -92909,7 +103715,7 @@ final class Context private function containsArray(array &$array) { $end = array_slice($array, -2); - return isset($end[1]) && $end[1] === $this->objects ? $end[0] : \false; + return (isset($end[1]) && $end[1] === $this->objects) ? $end[0] : \false; } /** * @param object $value @@ -92935,7 +103741,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\RecursionContext; +namespace PHPUnitPHAR\SebastianBergmann\RecursionContext; use Throwable; interface Exception extends Throwable @@ -92952,7 +103758,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\RecursionContext; +namespace PHPUnitPHAR\SebastianBergmann\RecursionContext; final class InvalidArgumentException extends \InvalidArgumentException implements Exception { @@ -93034,16 +103840,16 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\ResourceOperations; +namespace PHPUnitPHAR\SebastianBergmann\ResourceOperations; final class ResourceOperations { /** * @return string[] */ - public static function getFunctions() : array + public static function getFunctions(): array { - return ['Directory::close', 'Directory::read', 'Directory::rewind', 'DirectoryIterator::openFile', 'FilesystemIterator::openFile', 'Gmagick::readimagefile', 'HttpResponse::getRequestBodyStream', 'HttpResponse::getStream', 'HttpResponse::setStream', 'Imagick::pingImageFile', 'Imagick::readImageFile', 'Imagick::writeImageFile', 'Imagick::writeImagesFile', 'MongoGridFSCursor::__construct', 'MongoGridFSFile::getResource', 'MysqlndUhConnection::stmtInit', 'MysqlndUhConnection::storeResult', 'MysqlndUhConnection::useResult', 'PDF_activate_item', 'PDF_add_launchlink', 'PDF_add_locallink', 'PDF_add_nameddest', 'PDF_add_note', 'PDF_add_pdflink', 'PDF_add_table_cell', 'PDF_add_textflow', 'PDF_add_thumbnail', 'PDF_add_weblink', 'PDF_arc', 'PDF_arcn', 'PDF_attach_file', 'PDF_begin_document', 'PDF_begin_font', 'PDF_begin_glyph', 'PDF_begin_item', 'PDF_begin_layer', 'PDF_begin_page', 'PDF_begin_page_ext', 'PDF_begin_pattern', 'PDF_begin_template', 'PDF_begin_template_ext', 'PDF_circle', 'PDF_clip', 'PDF_close', 'PDF_close_image', 'PDF_close_pdi', 'PDF_close_pdi_page', 'PDF_closepath', 'PDF_closepath_fill_stroke', 'PDF_closepath_stroke', 'PDF_concat', 'PDF_continue_text', 'PDF_create_3dview', 'PDF_create_action', 'PDF_create_annotation', 'PDF_create_bookmark', 'PDF_create_field', 'PDF_create_fieldgroup', 'PDF_create_gstate', 'PDF_create_pvf', 'PDF_create_textflow', 'PDF_curveto', 'PDF_define_layer', 'PDF_delete', 'PDF_delete_pvf', 'PDF_delete_table', 'PDF_delete_textflow', 'PDF_encoding_set_char', 'PDF_end_document', 'PDF_end_font', 'PDF_end_glyph', 'PDF_end_item', 'PDF_end_layer', 'PDF_end_page', 'PDF_end_page_ext', 'PDF_end_pattern', 'PDF_end_template', 'PDF_endpath', 'PDF_fill', 'PDF_fill_imageblock', 'PDF_fill_pdfblock', 'PDF_fill_stroke', 'PDF_fill_textblock', 'PDF_findfont', 'PDF_fit_image', 'PDF_fit_pdi_page', 'PDF_fit_table', 'PDF_fit_textflow', 'PDF_fit_textline', 'PDF_get_apiname', 'PDF_get_buffer', 'PDF_get_errmsg', 'PDF_get_errnum', 'PDF_get_parameter', 'PDF_get_pdi_parameter', 'PDF_get_pdi_value', 'PDF_get_value', 'PDF_info_font', 'PDF_info_matchbox', 'PDF_info_table', 'PDF_info_textflow', 'PDF_info_textline', 'PDF_initgraphics', 'PDF_lineto', 'PDF_load_3ddata', 'PDF_load_font', 'PDF_load_iccprofile', 'PDF_load_image', 'PDF_makespotcolor', 'PDF_moveto', 'PDF_new', 'PDF_open_ccitt', 'PDF_open_file', 'PDF_open_image', 'PDF_open_image_file', 'PDF_open_memory_image', 'PDF_open_pdi', 'PDF_open_pdi_document', 'PDF_open_pdi_page', 'PDF_pcos_get_number', 'PDF_pcos_get_stream', 'PDF_pcos_get_string', 'PDF_place_image', 'PDF_place_pdi_page', 'PDF_process_pdi', 'PDF_rect', 'PDF_restore', 'PDF_resume_page', 'PDF_rotate', 'PDF_save', 'PDF_scale', 'PDF_set_border_color', 'PDF_set_border_dash', 'PDF_set_border_style', 'PDF_set_gstate', 'PDF_set_info', 'PDF_set_layer_dependency', 'PDF_set_parameter', 'PDF_set_text_pos', 'PDF_set_value', 'PDF_setcolor', 'PDF_setdash', 'PDF_setdashpattern', 'PDF_setflat', 'PDF_setfont', 'PDF_setgray', 'PDF_setgray_fill', 'PDF_setgray_stroke', 'PDF_setlinecap', 'PDF_setlinejoin', 'PDF_setlinewidth', 'PDF_setmatrix', 'PDF_setmiterlimit', 'PDF_setrgbcolor', 'PDF_setrgbcolor_fill', 'PDF_setrgbcolor_stroke', 'PDF_shading', 'PDF_shading_pattern', 'PDF_shfill', 'PDF_show', 'PDF_show_boxed', 'PDF_show_xy', 'PDF_skew', 'PDF_stringwidth', 'PDF_stroke', 'PDF_suspend_page', 'PDF_translate', 'PDF_utf16_to_utf8', 'PDF_utf32_to_utf16', 'PDF_utf8_to_utf16', 'PDO::pgsqlLOBOpen', 'RarEntry::getStream', 'SQLite3::openBlob', 'SWFMovie::saveToFile', 'SplFileInfo::openFile', 'SplFileObject::openFile', 'SplTempFileObject::openFile', 'V8Js::compileString', 'V8Js::executeScript', 'PHPUnit\\Vtiful\\Kernel\\Excel::setColumn', 'PHPUnit\\Vtiful\\Kernel\\Excel::setRow', 'PHPUnit\\Vtiful\\Kernel\\Format::align', 'PHPUnit\\Vtiful\\Kernel\\Format::bold', 'PHPUnit\\Vtiful\\Kernel\\Format::italic', 'PHPUnit\\Vtiful\\Kernel\\Format::underline', 'XMLWriter::openMemory', 'XMLWriter::openURI', 'ZipArchive::getStream', 'Zookeeper::setLogStream', 'apc_bin_dumpfile', 'apc_bin_loadfile', 'bbcode_add_element', 'bbcode_add_smiley', 'bbcode_create', 'bbcode_destroy', 'bbcode_parse', 'bbcode_set_arg_parser', 'bbcode_set_flags', 'bcompiler_read', 'bcompiler_write_class', 'bcompiler_write_constant', 'bcompiler_write_exe_footer', 'bcompiler_write_file', 'bcompiler_write_footer', 'bcompiler_write_function', 'bcompiler_write_functions_from_file', 'bcompiler_write_header', 'bcompiler_write_included_filename', 'bzclose', 'bzerrno', 'bzerror', 'bzerrstr', 'bzflush', 'bzopen', 'bzread', 'bzwrite', 'cairo_surface_write_to_png', 'closedir', 'copy', 'crack_closedict', 'crack_opendict', 'cubrid_bind', 'cubrid_close_prepare', 'cubrid_close_request', 'cubrid_col_get', 'cubrid_col_size', 'cubrid_column_names', 'cubrid_column_types', 'cubrid_commit', 'cubrid_connect', 'cubrid_connect_with_url', 'cubrid_current_oid', 'cubrid_db_parameter', 'cubrid_disconnect', 'cubrid_drop', 'cubrid_fetch', 'cubrid_free_result', 'cubrid_get', 'cubrid_get_autocommit', 'cubrid_get_charset', 'cubrid_get_class_name', 'cubrid_get_db_parameter', 'cubrid_get_query_timeout', 'cubrid_get_server_info', 'cubrid_insert_id', 'cubrid_is_instance', 'cubrid_lob2_bind', 'cubrid_lob2_close', 'cubrid_lob2_export', 'cubrid_lob2_import', 'cubrid_lob2_new', 'cubrid_lob2_read', 'cubrid_lob2_seek', 'cubrid_lob2_seek64', 'cubrid_lob2_size', 'cubrid_lob2_size64', 'cubrid_lob2_tell', 'cubrid_lob2_tell64', 'cubrid_lob2_write', 'cubrid_lob_export', 'cubrid_lob_get', 'cubrid_lob_send', 'cubrid_lob_size', 'cubrid_lock_read', 'cubrid_lock_write', 'cubrid_move_cursor', 'cubrid_next_result', 'cubrid_num_cols', 'cubrid_num_rows', 'cubrid_pconnect', 'cubrid_pconnect_with_url', 'cubrid_prepare', 'cubrid_put', 'cubrid_query', 'cubrid_rollback', 'cubrid_schema', 'cubrid_seq_add', 'cubrid_seq_drop', 'cubrid_seq_insert', 'cubrid_seq_put', 'cubrid_set_add', 'cubrid_set_autocommit', 'cubrid_set_db_parameter', 'cubrid_set_drop', 'cubrid_set_query_timeout', 'cubrid_unbuffered_query', 'curl_close', 'curl_copy_handle', 'curl_errno', 'curl_error', 'curl_escape', 'curl_exec', 'curl_getinfo', 'curl_multi_add_handle', 'curl_multi_close', 'curl_multi_errno', 'curl_multi_exec', 'curl_multi_getcontent', 'curl_multi_info_read', 'curl_multi_remove_handle', 'curl_multi_select', 'curl_multi_setopt', 'curl_pause', 'curl_reset', 'curl_setopt', 'curl_setopt_array', 'curl_share_close', 'curl_share_errno', 'curl_share_init', 'curl_share_setopt', 'curl_unescape', 'cyrus_authenticate', 'cyrus_bind', 'cyrus_close', 'cyrus_connect', 'cyrus_query', 'cyrus_unbind', 'db2_autocommit', 'db2_bind_param', 'db2_client_info', 'db2_close', 'db2_column_privileges', 'db2_columns', 'db2_commit', 'db2_conn_error', 'db2_conn_errormsg', 'db2_connect', 'db2_cursor_type', 'db2_exec', 'db2_execute', 'db2_fetch_array', 'db2_fetch_assoc', 'db2_fetch_both', 'db2_fetch_object', 'db2_fetch_row', 'db2_field_display_size', 'db2_field_name', 'db2_field_num', 'db2_field_precision', 'db2_field_scale', 'db2_field_type', 'db2_field_width', 'db2_foreign_keys', 'db2_free_result', 'db2_free_stmt', 'db2_get_option', 'db2_last_insert_id', 'db2_lob_read', 'db2_next_result', 'db2_num_fields', 'db2_num_rows', 'db2_pclose', 'db2_pconnect', 'db2_prepare', 'db2_primary_keys', 'db2_procedure_columns', 'db2_procedures', 'db2_result', 'db2_rollback', 'db2_server_info', 'db2_set_option', 'db2_special_columns', 'db2_statistics', 'db2_stmt_error', 'db2_stmt_errormsg', 'db2_table_privileges', 'db2_tables', 'dba_close', 'dba_delete', 'dba_exists', 'dba_fetch', 'dba_firstkey', 'dba_insert', 'dba_nextkey', 'dba_open', 'dba_optimize', 'dba_popen', 'dba_replace', 'dba_sync', 'dbplus_add', 'dbplus_aql', 'dbplus_close', 'dbplus_curr', 'dbplus_find', 'dbplus_first', 'dbplus_flush', 'dbplus_freelock', 'dbplus_freerlocks', 'dbplus_getlock', 'dbplus_getunique', 'dbplus_info', 'dbplus_last', 'dbplus_lockrel', 'dbplus_next', 'dbplus_open', 'dbplus_prev', 'dbplus_rchperm', 'dbplus_rcreate', 'dbplus_rcrtexact', 'dbplus_rcrtlike', 'dbplus_restorepos', 'dbplus_rkeys', 'dbplus_ropen', 'dbplus_rquery', 'dbplus_rrename', 'dbplus_rsecindex', 'dbplus_runlink', 'dbplus_rzap', 'dbplus_savepos', 'dbplus_setindex', 'dbplus_setindexbynumber', 'dbplus_sql', 'dbplus_tremove', 'dbplus_undo', 'dbplus_undoprepare', 'dbplus_unlockrel', 'dbplus_unselect', 'dbplus_update', 'dbplus_xlockrel', 'dbplus_xunlockrel', 'deflate_add', 'dio_close', 'dio_fcntl', 'dio_open', 'dio_read', 'dio_seek', 'dio_stat', 'dio_tcsetattr', 'dio_truncate', 'dio_write', 'dir', 'eio_busy', 'eio_cancel', 'eio_chmod', 'eio_chown', 'eio_close', 'eio_custom', 'eio_dup2', 'eio_fallocate', 'eio_fchmod', 'eio_fchown', 'eio_fdatasync', 'eio_fstat', 'eio_fstatvfs', 'eio_fsync', 'eio_ftruncate', 'eio_futime', 'eio_get_last_error', 'eio_grp', 'eio_grp_add', 'eio_grp_cancel', 'eio_grp_limit', 'eio_link', 'eio_lstat', 'eio_mkdir', 'eio_mknod', 'eio_nop', 'eio_open', 'eio_read', 'eio_readahead', 'eio_readdir', 'eio_readlink', 'eio_realpath', 'eio_rename', 'eio_rmdir', 'eio_seek', 'eio_sendfile', 'eio_stat', 'eio_statvfs', 'eio_symlink', 'eio_sync', 'eio_sync_file_range', 'eio_syncfs', 'eio_truncate', 'eio_unlink', 'eio_utime', 'eio_write', 'enchant_broker_describe', 'enchant_broker_dict_exists', 'enchant_broker_free', 'enchant_broker_free_dict', 'enchant_broker_get_dict_path', 'enchant_broker_get_error', 'enchant_broker_init', 'enchant_broker_list_dicts', 'enchant_broker_request_dict', 'enchant_broker_request_pwl_dict', 'enchant_broker_set_dict_path', 'enchant_broker_set_ordering', 'enchant_dict_add_to_personal', 'enchant_dict_add_to_session', 'enchant_dict_check', 'enchant_dict_describe', 'enchant_dict_get_error', 'enchant_dict_is_in_session', 'enchant_dict_quick_check', 'enchant_dict_store_replacement', 'enchant_dict_suggest', 'event_add', 'event_base_free', 'event_base_loop', 'event_base_loopbreak', 'event_base_loopexit', 'event_base_new', 'event_base_priority_init', 'event_base_reinit', 'event_base_set', 'event_buffer_base_set', 'event_buffer_disable', 'event_buffer_enable', 'event_buffer_fd_set', 'event_buffer_free', 'event_buffer_new', 'event_buffer_priority_set', 'event_buffer_read', 'event_buffer_set_callback', 'event_buffer_timeout_set', 'event_buffer_watermark_set', 'event_buffer_write', 'event_del', 'event_free', 'event_new', 'event_priority_set', 'event_set', 'event_timer_add', 'event_timer_del', 'event_timer_pending', 'event_timer_set', 'expect_expectl', 'expect_popen', 'fam_cancel_monitor', 'fam_close', 'fam_monitor_collection', 'fam_monitor_directory', 'fam_monitor_file', 'fam_next_event', 'fam_open', 'fam_pending', 'fam_resume_monitor', 'fam_suspend_monitor', 'fann_cascadetrain_on_data', 'fann_cascadetrain_on_file', 'fann_clear_scaling_params', 'fann_copy', 'fann_create_from_file', 'fann_create_shortcut_array', 'fann_create_standard', 'fann_create_standard_array', 'fann_create_train', 'fann_create_train_from_callback', 'fann_descale_input', 'fann_descale_output', 'fann_descale_train', 'fann_destroy', 'fann_destroy_train', 'fann_duplicate_train_data', 'fann_get_MSE', 'fann_get_activation_function', 'fann_get_activation_steepness', 'fann_get_bias_array', 'fann_get_bit_fail', 'fann_get_bit_fail_limit', 'fann_get_cascade_activation_functions', 'fann_get_cascade_activation_functions_count', 'fann_get_cascade_activation_steepnesses', 'fann_get_cascade_activation_steepnesses_count', 'fann_get_cascade_candidate_change_fraction', 'fann_get_cascade_candidate_limit', 'fann_get_cascade_candidate_stagnation_epochs', 'fann_get_cascade_max_cand_epochs', 'fann_get_cascade_max_out_epochs', 'fann_get_cascade_min_cand_epochs', 'fann_get_cascade_min_out_epochs', 'fann_get_cascade_num_candidate_groups', 'fann_get_cascade_num_candidates', 'fann_get_cascade_output_change_fraction', 'fann_get_cascade_output_stagnation_epochs', 'fann_get_cascade_weight_multiplier', 'fann_get_connection_array', 'fann_get_connection_rate', 'fann_get_errno', 'fann_get_errstr', 'fann_get_layer_array', 'fann_get_learning_momentum', 'fann_get_learning_rate', 'fann_get_network_type', 'fann_get_num_input', 'fann_get_num_layers', 'fann_get_num_output', 'fann_get_quickprop_decay', 'fann_get_quickprop_mu', 'fann_get_rprop_decrease_factor', 'fann_get_rprop_delta_max', 'fann_get_rprop_delta_min', 'fann_get_rprop_delta_zero', 'fann_get_rprop_increase_factor', 'fann_get_sarprop_step_error_shift', 'fann_get_sarprop_step_error_threshold_factor', 'fann_get_sarprop_temperature', 'fann_get_sarprop_weight_decay_shift', 'fann_get_total_connections', 'fann_get_total_neurons', 'fann_get_train_error_function', 'fann_get_train_stop_function', 'fann_get_training_algorithm', 'fann_init_weights', 'fann_length_train_data', 'fann_merge_train_data', 'fann_num_input_train_data', 'fann_num_output_train_data', 'fann_randomize_weights', 'fann_read_train_from_file', 'fann_reset_errno', 'fann_reset_errstr', 'fann_run', 'fann_save', 'fann_save_train', 'fann_scale_input', 'fann_scale_input_train_data', 'fann_scale_output', 'fann_scale_output_train_data', 'fann_scale_train', 'fann_scale_train_data', 'fann_set_activation_function', 'fann_set_activation_function_hidden', 'fann_set_activation_function_layer', 'fann_set_activation_function_output', 'fann_set_activation_steepness', 'fann_set_activation_steepness_hidden', 'fann_set_activation_steepness_layer', 'fann_set_activation_steepness_output', 'fann_set_bit_fail_limit', 'fann_set_callback', 'fann_set_cascade_activation_functions', 'fann_set_cascade_activation_steepnesses', 'fann_set_cascade_candidate_change_fraction', 'fann_set_cascade_candidate_limit', 'fann_set_cascade_candidate_stagnation_epochs', 'fann_set_cascade_max_cand_epochs', 'fann_set_cascade_max_out_epochs', 'fann_set_cascade_min_cand_epochs', 'fann_set_cascade_min_out_epochs', 'fann_set_cascade_num_candidate_groups', 'fann_set_cascade_output_change_fraction', 'fann_set_cascade_output_stagnation_epochs', 'fann_set_cascade_weight_multiplier', 'fann_set_error_log', 'fann_set_input_scaling_params', 'fann_set_learning_momentum', 'fann_set_learning_rate', 'fann_set_output_scaling_params', 'fann_set_quickprop_decay', 'fann_set_quickprop_mu', 'fann_set_rprop_decrease_factor', 'fann_set_rprop_delta_max', 'fann_set_rprop_delta_min', 'fann_set_rprop_delta_zero', 'fann_set_rprop_increase_factor', 'fann_set_sarprop_step_error_shift', 'fann_set_sarprop_step_error_threshold_factor', 'fann_set_sarprop_temperature', 'fann_set_sarprop_weight_decay_shift', 'fann_set_scaling_params', 'fann_set_train_error_function', 'fann_set_train_stop_function', 'fann_set_training_algorithm', 'fann_set_weight', 'fann_set_weight_array', 'fann_shuffle_train_data', 'fann_subset_train_data', 'fann_test', 'fann_test_data', 'fann_train', 'fann_train_epoch', 'fann_train_on_data', 'fann_train_on_file', 'fbsql_affected_rows', 'fbsql_autocommit', 'fbsql_blob_size', 'fbsql_change_user', 'fbsql_clob_size', 'fbsql_close', 'fbsql_commit', 'fbsql_connect', 'fbsql_create_blob', 'fbsql_create_clob', 'fbsql_create_db', 'fbsql_data_seek', 'fbsql_database', 'fbsql_database_password', 'fbsql_db_query', 'fbsql_db_status', 'fbsql_drop_db', 'fbsql_errno', 'fbsql_error', 'fbsql_fetch_array', 'fbsql_fetch_assoc', 'fbsql_fetch_field', 'fbsql_fetch_lengths', 'fbsql_fetch_object', 'fbsql_fetch_row', 'fbsql_field_flags', 'fbsql_field_len', 'fbsql_field_name', 'fbsql_field_seek', 'fbsql_field_table', 'fbsql_field_type', 'fbsql_free_result', 'fbsql_get_autostart_info', 'fbsql_hostname', 'fbsql_insert_id', 'fbsql_list_dbs', 'fbsql_list_fields', 'fbsql_list_tables', 'fbsql_next_result', 'fbsql_num_fields', 'fbsql_num_rows', 'fbsql_password', 'fbsql_pconnect', 'fbsql_query', 'fbsql_read_blob', 'fbsql_read_clob', 'fbsql_result', 'fbsql_rollback', 'fbsql_rows_fetched', 'fbsql_select_db', 'fbsql_set_characterset', 'fbsql_set_lob_mode', 'fbsql_set_password', 'fbsql_set_transaction', 'fbsql_start_db', 'fbsql_stop_db', 'fbsql_table_name', 'fbsql_username', 'fclose', 'fdf_add_doc_javascript', 'fdf_add_template', 'fdf_close', 'fdf_create', 'fdf_enum_values', 'fdf_get_ap', 'fdf_get_attachment', 'fdf_get_encoding', 'fdf_get_file', 'fdf_get_flags', 'fdf_get_opt', 'fdf_get_status', 'fdf_get_value', 'fdf_get_version', 'fdf_next_field_name', 'fdf_open', 'fdf_open_string', 'fdf_remove_item', 'fdf_save', 'fdf_save_string', 'fdf_set_ap', 'fdf_set_encoding', 'fdf_set_file', 'fdf_set_flags', 'fdf_set_javascript_action', 'fdf_set_on_import_javascript', 'fdf_set_opt', 'fdf_set_status', 'fdf_set_submit_form_action', 'fdf_set_target_frame', 'fdf_set_value', 'fdf_set_version', 'feof', 'fflush', 'ffmpeg_frame::__construct', 'ffmpeg_frame::toGDImage', 'fgetc', 'fgetcsv', 'fgets', 'fgetss', 'file', 'file_get_contents', 'file_put_contents', 'finfo::buffer', 'finfo::file', 'finfo_buffer', 'finfo_close', 'finfo_file', 'finfo_open', 'finfo_set_flags', 'flock', 'fopen', 'fpassthru', 'fprintf', 'fputcsv', 'fputs', 'fread', 'fscanf', 'fseek', 'fstat', 'ftell', 'ftp_alloc', 'ftp_append', 'ftp_cdup', 'ftp_chdir', 'ftp_chmod', 'ftp_close', 'ftp_delete', 'ftp_exec', 'ftp_fget', 'ftp_fput', 'ftp_get', 'ftp_get_option', 'ftp_login', 'ftp_mdtm', 'ftp_mkdir', 'ftp_mlsd', 'ftp_nb_continue', 'ftp_nb_fget', 'ftp_nb_fput', 'ftp_nb_get', 'ftp_nb_put', 'ftp_nlist', 'ftp_pasv', 'ftp_put', 'ftp_pwd', 'ftp_quit', 'ftp_raw', 'ftp_rawlist', 'ftp_rename', 'ftp_rmdir', 'ftp_set_option', 'ftp_site', 'ftp_size', 'ftp_systype', 'ftruncate', 'fwrite', 'get_resource_type', 'gmp_div', 'gnupg::init', 'gnupg_adddecryptkey', 'gnupg_addencryptkey', 'gnupg_addsignkey', 'gnupg_cleardecryptkeys', 'gnupg_clearencryptkeys', 'gnupg_clearsignkeys', 'gnupg_decrypt', 'gnupg_decryptverify', 'gnupg_encrypt', 'gnupg_encryptsign', 'gnupg_export', 'gnupg_geterror', 'gnupg_getprotocol', 'gnupg_import', 'gnupg_init', 'gnupg_keyinfo', 'gnupg_setarmor', 'gnupg_seterrormode', 'gnupg_setsignmode', 'gnupg_sign', 'gnupg_verify', 'gupnp_context_get_host_ip', 'gupnp_context_get_port', 'gupnp_context_get_subscription_timeout', 'gupnp_context_host_path', 'gupnp_context_new', 'gupnp_context_set_subscription_timeout', 'gupnp_context_timeout_add', 'gupnp_context_unhost_path', 'gupnp_control_point_browse_start', 'gupnp_control_point_browse_stop', 'gupnp_control_point_callback_set', 'gupnp_control_point_new', 'gupnp_device_action_callback_set', 'gupnp_device_info_get', 'gupnp_device_info_get_service', 'gupnp_root_device_get_available', 'gupnp_root_device_get_relative_location', 'gupnp_root_device_new', 'gupnp_root_device_set_available', 'gupnp_root_device_start', 'gupnp_root_device_stop', 'gupnp_service_action_get', 'gupnp_service_action_return', 'gupnp_service_action_return_error', 'gupnp_service_action_set', 'gupnp_service_freeze_notify', 'gupnp_service_info_get', 'gupnp_service_info_get_introspection', 'gupnp_service_introspection_get_state_variable', 'gupnp_service_notify', 'gupnp_service_proxy_action_get', 'gupnp_service_proxy_action_set', 'gupnp_service_proxy_add_notify', 'gupnp_service_proxy_callback_set', 'gupnp_service_proxy_get_subscribed', 'gupnp_service_proxy_remove_notify', 'gupnp_service_proxy_send_action', 'gupnp_service_proxy_set_subscribed', 'gupnp_service_thaw_notify', 'gzclose', 'gzeof', 'gzgetc', 'gzgets', 'gzgetss', 'gzpassthru', 'gzputs', 'gzread', 'gzrewind', 'gzseek', 'gztell', 'gzwrite', 'hash_update_stream', 'PHPUnit\\http\\Env\\Response::send', 'http_get_request_body_stream', 'ibase_add_user', 'ibase_affected_rows', 'ibase_backup', 'ibase_blob_add', 'ibase_blob_cancel', 'ibase_blob_close', 'ibase_blob_create', 'ibase_blob_get', 'ibase_blob_open', 'ibase_close', 'ibase_commit', 'ibase_commit_ret', 'ibase_connect', 'ibase_db_info', 'ibase_delete_user', 'ibase_drop_db', 'ibase_execute', 'ibase_fetch_assoc', 'ibase_fetch_object', 'ibase_fetch_row', 'ibase_field_info', 'ibase_free_event_handler', 'ibase_free_query', 'ibase_free_result', 'ibase_gen_id', 'ibase_maintain_db', 'ibase_modify_user', 'ibase_name_result', 'ibase_num_fields', 'ibase_num_params', 'ibase_param_info', 'ibase_pconnect', 'ibase_prepare', 'ibase_query', 'ibase_restore', 'ibase_rollback', 'ibase_rollback_ret', 'ibase_server_info', 'ibase_service_attach', 'ibase_service_detach', 'ibase_set_event_handler', 'ibase_trans', 'ifx_affected_rows', 'ifx_close', 'ifx_connect', 'ifx_do', 'ifx_error', 'ifx_fetch_row', 'ifx_fieldproperties', 'ifx_fieldtypes', 'ifx_free_result', 'ifx_getsqlca', 'ifx_htmltbl_result', 'ifx_num_fields', 'ifx_num_rows', 'ifx_pconnect', 'ifx_prepare', 'ifx_query', 'image2wbmp', 'imageaffine', 'imagealphablending', 'imageantialias', 'imagearc', 'imagebmp', 'imagechar', 'imagecharup', 'imagecolorallocate', 'imagecolorallocatealpha', 'imagecolorat', 'imagecolorclosest', 'imagecolorclosestalpha', 'imagecolorclosesthwb', 'imagecolordeallocate', 'imagecolorexact', 'imagecolorexactalpha', 'imagecolormatch', 'imagecolorresolve', 'imagecolorresolvealpha', 'imagecolorset', 'imagecolorsforindex', 'imagecolorstotal', 'imagecolortransparent', 'imageconvolution', 'imagecopy', 'imagecopymerge', 'imagecopymergegray', 'imagecopyresampled', 'imagecopyresized', 'imagecrop', 'imagecropauto', 'imagedashedline', 'imagedestroy', 'imageellipse', 'imagefill', 'imagefilledarc', 'imagefilledellipse', 'imagefilledpolygon', 'imagefilledrectangle', 'imagefilltoborder', 'imagefilter', 'imageflip', 'imagefttext', 'imagegammacorrect', 'imagegd', 'imagegd2', 'imagegetclip', 'imagegif', 'imagegrabscreen', 'imagegrabwindow', 'imageinterlace', 'imageistruecolor', 'imagejpeg', 'imagelayereffect', 'imageline', 'imageopenpolygon', 'imagepalettecopy', 'imagepalettetotruecolor', 'imagepng', 'imagepolygon', 'imagepsencodefont', 'imagepsextendfont', 'imagepsfreefont', 'imagepsloadfont', 'imagepsslantfont', 'imagepstext', 'imagerectangle', 'imageresolution', 'imagerotate', 'imagesavealpha', 'imagescale', 'imagesetbrush', 'imagesetclip', 'imagesetinterpolation', 'imagesetpixel', 'imagesetstyle', 'imagesetthickness', 'imagesettile', 'imagestring', 'imagestringup', 'imagesx', 'imagesy', 'imagetruecolortopalette', 'imagettftext', 'imagewbmp', 'imagewebp', 'imagexbm', 'imap_append', 'imap_body', 'imap_bodystruct', 'imap_check', 'imap_clearflag_full', 'imap_close', 'imap_create', 'imap_createmailbox', 'imap_delete', 'imap_deletemailbox', 'imap_expunge', 'imap_fetch_overview', 'imap_fetchbody', 'imap_fetchheader', 'imap_fetchmime', 'imap_fetchstructure', 'imap_fetchtext', 'imap_gc', 'imap_get_quota', 'imap_get_quotaroot', 'imap_getacl', 'imap_getmailboxes', 'imap_getsubscribed', 'imap_header', 'imap_headerinfo', 'imap_headers', 'imap_list', 'imap_listmailbox', 'imap_listscan', 'imap_listsubscribed', 'imap_lsub', 'imap_mail_copy', 'imap_mail_move', 'imap_mailboxmsginfo', 'imap_msgno', 'imap_num_msg', 'imap_num_recent', 'imap_ping', 'imap_rename', 'imap_renamemailbox', 'imap_reopen', 'imap_savebody', 'imap_scan', 'imap_scanmailbox', 'imap_search', 'imap_set_quota', 'imap_setacl', 'imap_setflag_full', 'imap_sort', 'imap_status', 'imap_subscribe', 'imap_thread', 'imap_uid', 'imap_undelete', 'imap_unsubscribe', 'inflate_add', 'inflate_get_read_len', 'inflate_get_status', 'ingres_autocommit', 'ingres_autocommit_state', 'ingres_charset', 'ingres_close', 'ingres_commit', 'ingres_connect', 'ingres_cursor', 'ingres_errno', 'ingres_error', 'ingres_errsqlstate', 'ingres_escape_string', 'ingres_execute', 'ingres_fetch_array', 'ingres_fetch_assoc', 'ingres_fetch_object', 'ingres_fetch_proc_return', 'ingres_fetch_row', 'ingres_field_length', 'ingres_field_name', 'ingres_field_nullable', 'ingres_field_precision', 'ingres_field_scale', 'ingres_field_type', 'ingres_free_result', 'ingres_next_error', 'ingres_num_fields', 'ingres_num_rows', 'ingres_pconnect', 'ingres_prepare', 'ingres_query', 'ingres_result_seek', 'ingres_rollback', 'ingres_set_environment', 'ingres_unbuffered_query', 'inotify_add_watch', 'inotify_init', 'inotify_queue_len', 'inotify_read', 'inotify_rm_watch', 'kadm5_chpass_principal', 'kadm5_create_principal', 'kadm5_delete_principal', 'kadm5_destroy', 'kadm5_flush', 'kadm5_get_policies', 'kadm5_get_principal', 'kadm5_get_principals', 'kadm5_init_with_password', 'kadm5_modify_principal', 'ldap_add', 'ldap_bind', 'ldap_close', 'ldap_compare', 'ldap_control_paged_result', 'ldap_control_paged_result_response', 'ldap_count_entries', 'ldap_delete', 'ldap_errno', 'ldap_error', 'ldap_exop', 'ldap_exop_passwd', 'ldap_exop_refresh', 'ldap_exop_whoami', 'ldap_first_attribute', 'ldap_first_entry', 'ldap_first_reference', 'ldap_free_result', 'ldap_get_attributes', 'ldap_get_dn', 'ldap_get_entries', 'ldap_get_option', 'ldap_get_values', 'ldap_get_values_len', 'ldap_mod_add', 'ldap_mod_del', 'ldap_mod_replace', 'ldap_modify', 'ldap_modify_batch', 'ldap_next_attribute', 'ldap_next_entry', 'ldap_next_reference', 'ldap_parse_exop', 'ldap_parse_reference', 'ldap_parse_result', 'ldap_rename', 'ldap_sasl_bind', 'ldap_set_option', 'ldap_set_rebind_proc', 'ldap_sort', 'ldap_start_tls', 'ldap_unbind', 'libxml_set_streams_context', 'm_checkstatus', 'm_completeauthorizations', 'm_connect', 'm_connectionerror', 'm_deletetrans', 'm_destroyconn', 'm_getcell', 'm_getcellbynum', 'm_getcommadelimited', 'm_getheader', 'm_initconn', 'm_iscommadelimited', 'm_maxconntimeout', 'm_monitor', 'm_numcolumns', 'm_numrows', 'm_parsecommadelimited', 'm_responsekeys', 'm_responseparam', 'm_returnstatus', 'm_setblocking', 'm_setdropfile', 'm_setip', 'm_setssl', 'm_setssl_cafile', 'm_setssl_files', 'm_settimeout', 'm_transactionssent', 'm_transinqueue', 'm_transkeyval', 'm_transnew', 'm_transsend', 'm_validateidentifier', 'm_verifyconnection', 'm_verifysslcert', 'mailparse_determine_best_xfer_encoding', 'mailparse_msg_create', 'mailparse_msg_extract_part', 'mailparse_msg_extract_part_file', 'mailparse_msg_extract_whole_part_file', 'mailparse_msg_free', 'mailparse_msg_get_part', 'mailparse_msg_get_part_data', 'mailparse_msg_get_structure', 'mailparse_msg_parse', 'mailparse_msg_parse_file', 'mailparse_stream_encode', 'mailparse_uudecode_all', 'maxdb::use_result', 'maxdb_affected_rows', 'maxdb_connect', 'maxdb_disable_rpl_parse', 'maxdb_dump_debug_info', 'maxdb_embedded_connect', 'maxdb_enable_reads_from_master', 'maxdb_enable_rpl_parse', 'maxdb_errno', 'maxdb_error', 'maxdb_fetch_lengths', 'maxdb_field_tell', 'maxdb_get_host_info', 'maxdb_get_proto_info', 'maxdb_get_server_info', 'maxdb_get_server_version', 'maxdb_info', 'maxdb_init', 'maxdb_insert_id', 'maxdb_master_query', 'maxdb_more_results', 'maxdb_next_result', 'maxdb_num_fields', 'maxdb_num_rows', 'maxdb_rpl_parse_enabled', 'maxdb_rpl_probe', 'maxdb_select_db', 'maxdb_sqlstate', 'maxdb_stmt::result_metadata', 'maxdb_stmt_affected_rows', 'maxdb_stmt_errno', 'maxdb_stmt_error', 'maxdb_stmt_num_rows', 'maxdb_stmt_param_count', 'maxdb_stmt_result_metadata', 'maxdb_stmt_sqlstate', 'maxdb_thread_id', 'maxdb_use_result', 'maxdb_warning_count', 'mcrypt_enc_get_algorithms_name', 'mcrypt_enc_get_block_size', 'mcrypt_enc_get_iv_size', 'mcrypt_enc_get_key_size', 'mcrypt_enc_get_modes_name', 'mcrypt_enc_get_supported_key_sizes', 'mcrypt_enc_is_block_algorithm', 'mcrypt_enc_is_block_algorithm_mode', 'mcrypt_enc_is_block_mode', 'mcrypt_enc_self_test', 'mcrypt_generic', 'mcrypt_generic_deinit', 'mcrypt_generic_end', 'mcrypt_generic_init', 'mcrypt_module_close', 'mcrypt_module_open', 'mdecrypt_generic', 'mkdir', 'mqseries_back', 'mqseries_begin', 'mqseries_close', 'mqseries_cmit', 'mqseries_conn', 'mqseries_connx', 'mqseries_disc', 'mqseries_get', 'mqseries_inq', 'mqseries_open', 'mqseries_put', 'mqseries_put1', 'mqseries_set', 'msg_get_queue', 'msg_receive', 'msg_remove_queue', 'msg_send', 'msg_set_queue', 'msg_stat_queue', 'msql_affected_rows', 'msql_close', 'msql_connect', 'msql_create_db', 'msql_data_seek', 'msql_db_query', 'msql_drop_db', 'msql_fetch_array', 'msql_fetch_field', 'msql_fetch_object', 'msql_fetch_row', 'msql_field_flags', 'msql_field_len', 'msql_field_name', 'msql_field_seek', 'msql_field_table', 'msql_field_type', 'msql_free_result', 'msql_list_dbs', 'msql_list_fields', 'msql_list_tables', 'msql_num_fields', 'msql_num_rows', 'msql_pconnect', 'msql_query', 'msql_result', 'msql_select_db', 'mssql_bind', 'mssql_close', 'mssql_connect', 'mssql_data_seek', 'mssql_execute', 'mssql_fetch_array', 'mssql_fetch_assoc', 'mssql_fetch_batch', 'mssql_fetch_field', 'mssql_fetch_object', 'mssql_fetch_row', 'mssql_field_length', 'mssql_field_name', 'mssql_field_seek', 'mssql_field_type', 'mssql_free_result', 'mssql_free_statement', 'mssql_init', 'mssql_next_result', 'mssql_num_fields', 'mssql_num_rows', 'mssql_pconnect', 'mssql_query', 'mssql_result', 'mssql_rows_affected', 'mssql_select_db', 'mysql_affected_rows', 'mysql_client_encoding', 'mysql_close', 'mysql_connect', 'mysql_create_db', 'mysql_data_seek', 'mysql_db_name', 'mysql_db_query', 'mysql_drop_db', 'mysql_errno', 'mysql_error', 'mysql_fetch_array', 'mysql_fetch_assoc', 'mysql_fetch_field', 'mysql_fetch_lengths', 'mysql_fetch_object', 'mysql_fetch_row', 'mysql_field_flags', 'mysql_field_len', 'mysql_field_name', 'mysql_field_seek', 'mysql_field_table', 'mysql_field_type', 'mysql_free_result', 'mysql_get_host_info', 'mysql_get_proto_info', 'mysql_get_server_info', 'mysql_info', 'mysql_insert_id', 'mysql_list_dbs', 'mysql_list_fields', 'mysql_list_processes', 'mysql_list_tables', 'mysql_num_fields', 'mysql_num_rows', 'mysql_pconnect', 'mysql_ping', 'mysql_query', 'mysql_real_escape_string', 'mysql_result', 'mysql_select_db', 'mysql_set_charset', 'mysql_stat', 'mysql_tablename', 'mysql_thread_id', 'mysql_unbuffered_query', 'mysqlnd_uh_convert_to_mysqlnd', 'ncurses_bottom_panel', 'ncurses_del_panel', 'ncurses_delwin', 'ncurses_getmaxyx', 'ncurses_getyx', 'ncurses_hide_panel', 'ncurses_keypad', 'ncurses_meta', 'ncurses_move_panel', 'ncurses_mvwaddstr', 'ncurses_new_panel', 'ncurses_newpad', 'ncurses_newwin', 'ncurses_panel_above', 'ncurses_panel_below', 'ncurses_panel_window', 'ncurses_pnoutrefresh', 'ncurses_prefresh', 'ncurses_replace_panel', 'ncurses_show_panel', 'ncurses_top_panel', 'ncurses_waddch', 'ncurses_waddstr', 'ncurses_wattroff', 'ncurses_wattron', 'ncurses_wattrset', 'ncurses_wborder', 'ncurses_wclear', 'ncurses_wcolor_set', 'ncurses_werase', 'ncurses_wgetch', 'ncurses_whline', 'ncurses_wmouse_trafo', 'ncurses_wmove', 'ncurses_wnoutrefresh', 'ncurses_wrefresh', 'ncurses_wstandend', 'ncurses_wstandout', 'ncurses_wvline', 'newt_button', 'newt_button_bar', 'newt_checkbox', 'newt_checkbox_get_value', 'newt_checkbox_set_flags', 'newt_checkbox_set_value', 'newt_checkbox_tree', 'newt_checkbox_tree_add_item', 'newt_checkbox_tree_find_item', 'newt_checkbox_tree_get_current', 'newt_checkbox_tree_get_entry_value', 'newt_checkbox_tree_get_multi_selection', 'newt_checkbox_tree_get_selection', 'newt_checkbox_tree_multi', 'newt_checkbox_tree_set_current', 'newt_checkbox_tree_set_entry', 'newt_checkbox_tree_set_entry_value', 'newt_checkbox_tree_set_width', 'newt_compact_button', 'newt_component_add_callback', 'newt_component_takes_focus', 'newt_create_grid', 'newt_draw_form', 'newt_entry', 'newt_entry_get_value', 'newt_entry_set', 'newt_entry_set_filter', 'newt_entry_set_flags', 'newt_form', 'newt_form_add_component', 'newt_form_add_components', 'newt_form_add_hot_key', 'newt_form_destroy', 'newt_form_get_current', 'newt_form_run', 'newt_form_set_background', 'newt_form_set_height', 'newt_form_set_size', 'newt_form_set_timer', 'newt_form_set_width', 'newt_form_watch_fd', 'newt_grid_add_components_to_form', 'newt_grid_basic_window', 'newt_grid_free', 'newt_grid_get_size', 'newt_grid_h_close_stacked', 'newt_grid_h_stacked', 'newt_grid_place', 'newt_grid_set_field', 'newt_grid_simple_window', 'newt_grid_v_close_stacked', 'newt_grid_v_stacked', 'newt_grid_wrapped_window', 'newt_grid_wrapped_window_at', 'newt_label', 'newt_label_set_text', 'newt_listbox', 'newt_listbox_append_entry', 'newt_listbox_clear', 'newt_listbox_clear_selection', 'newt_listbox_delete_entry', 'newt_listbox_get_current', 'newt_listbox_get_selection', 'newt_listbox_insert_entry', 'newt_listbox_item_count', 'newt_listbox_select_item', 'newt_listbox_set_current', 'newt_listbox_set_current_by_key', 'newt_listbox_set_data', 'newt_listbox_set_entry', 'newt_listbox_set_width', 'newt_listitem', 'newt_listitem_get_data', 'newt_listitem_set', 'newt_radio_get_current', 'newt_radiobutton', 'newt_run_form', 'newt_scale', 'newt_scale_set', 'newt_scrollbar_set', 'newt_textbox', 'newt_textbox_get_num_lines', 'newt_textbox_reflowed', 'newt_textbox_set_height', 'newt_textbox_set_text', 'newt_vertical_scrollbar', 'oci_bind_array_by_name', 'oci_bind_by_name', 'oci_cancel', 'oci_close', 'oci_commit', 'oci_connect', 'oci_define_by_name', 'oci_error', 'oci_execute', 'oci_fetch', 'oci_fetch_all', 'oci_fetch_array', 'oci_fetch_assoc', 'oci_fetch_object', 'oci_fetch_row', 'oci_field_is_null', 'oci_field_name', 'oci_field_precision', 'oci_field_scale', 'oci_field_size', 'oci_field_type', 'oci_field_type_raw', 'oci_free_cursor', 'oci_free_statement', 'oci_get_implicit_resultset', 'oci_new_collection', 'oci_new_connect', 'oci_new_cursor', 'oci_new_descriptor', 'oci_num_fields', 'oci_num_rows', 'oci_parse', 'oci_pconnect', 'oci_register_taf_callback', 'oci_result', 'oci_rollback', 'oci_server_version', 'oci_set_action', 'oci_set_client_identifier', 'oci_set_client_info', 'oci_set_module_name', 'oci_set_prefetch', 'oci_statement_type', 'oci_unregister_taf_callback', 'odbc_autocommit', 'odbc_close', 'odbc_columnprivileges', 'odbc_columns', 'odbc_commit', 'odbc_connect', 'odbc_cursor', 'odbc_data_source', 'odbc_do', 'odbc_error', 'odbc_errormsg', 'odbc_exec', 'odbc_execute', 'odbc_fetch_array', 'odbc_fetch_into', 'odbc_fetch_row', 'odbc_field_len', 'odbc_field_name', 'odbc_field_num', 'odbc_field_precision', 'odbc_field_scale', 'odbc_field_type', 'odbc_foreignkeys', 'odbc_free_result', 'odbc_gettypeinfo', 'odbc_next_result', 'odbc_num_fields', 'odbc_num_rows', 'odbc_pconnect', 'odbc_prepare', 'odbc_primarykeys', 'odbc_procedurecolumns', 'odbc_procedures', 'odbc_result', 'odbc_result_all', 'odbc_rollback', 'odbc_setoption', 'odbc_specialcolumns', 'odbc_statistics', 'odbc_tableprivileges', 'odbc_tables', 'openal_buffer_create', 'openal_buffer_data', 'openal_buffer_destroy', 'openal_buffer_get', 'openal_buffer_loadwav', 'openal_context_create', 'openal_context_current', 'openal_context_destroy', 'openal_context_process', 'openal_context_suspend', 'openal_device_close', 'openal_device_open', 'openal_source_create', 'openal_source_destroy', 'openal_source_get', 'openal_source_pause', 'openal_source_play', 'openal_source_rewind', 'openal_source_set', 'openal_source_stop', 'openal_stream', 'opendir', 'openssl_csr_new', 'openssl_dh_compute_key', 'openssl_free_key', 'openssl_pkey_export', 'openssl_pkey_free', 'openssl_pkey_get_details', 'openssl_spki_new', 'openssl_x509_free', 'pclose', 'pfsockopen', 'pg_affected_rows', 'pg_cancel_query', 'pg_client_encoding', 'pg_close', 'pg_connect_poll', 'pg_connection_busy', 'pg_connection_reset', 'pg_connection_status', 'pg_consume_input', 'pg_convert', 'pg_copy_from', 'pg_copy_to', 'pg_dbname', 'pg_delete', 'pg_end_copy', 'pg_escape_bytea', 'pg_escape_identifier', 'pg_escape_literal', 'pg_escape_string', 'pg_execute', 'pg_fetch_all', 'pg_fetch_all_columns', 'pg_fetch_array', 'pg_fetch_assoc', 'pg_fetch_row', 'pg_field_name', 'pg_field_num', 'pg_field_size', 'pg_field_table', 'pg_field_type', 'pg_field_type_oid', 'pg_flush', 'pg_free_result', 'pg_get_notify', 'pg_get_pid', 'pg_get_result', 'pg_host', 'pg_insert', 'pg_last_error', 'pg_last_notice', 'pg_last_oid', 'pg_lo_close', 'pg_lo_create', 'pg_lo_export', 'pg_lo_import', 'pg_lo_open', 'pg_lo_read', 'pg_lo_read_all', 'pg_lo_seek', 'pg_lo_tell', 'pg_lo_truncate', 'pg_lo_unlink', 'pg_lo_write', 'pg_meta_data', 'pg_num_fields', 'pg_num_rows', 'pg_options', 'pg_parameter_status', 'pg_ping', 'pg_port', 'pg_prepare', 'pg_put_line', 'pg_query', 'pg_query_params', 'pg_result_error', 'pg_result_error_field', 'pg_result_seek', 'pg_result_status', 'pg_select', 'pg_send_execute', 'pg_send_prepare', 'pg_send_query', 'pg_send_query_params', 'pg_set_client_encoding', 'pg_set_error_verbosity', 'pg_socket', 'pg_trace', 'pg_transaction_status', 'pg_tty', 'pg_untrace', 'pg_update', 'pg_version', 'php_user_filter::filter', 'proc_close', 'proc_get_status', 'proc_terminate', 'ps_add_bookmark', 'ps_add_launchlink', 'ps_add_locallink', 'ps_add_note', 'ps_add_pdflink', 'ps_add_weblink', 'ps_arc', 'ps_arcn', 'ps_begin_page', 'ps_begin_pattern', 'ps_begin_template', 'ps_circle', 'ps_clip', 'ps_close', 'ps_close_image', 'ps_closepath', 'ps_closepath_stroke', 'ps_continue_text', 'ps_curveto', 'ps_delete', 'ps_end_page', 'ps_end_pattern', 'ps_end_template', 'ps_fill', 'ps_fill_stroke', 'ps_findfont', 'ps_get_buffer', 'ps_get_parameter', 'ps_get_value', 'ps_hyphenate', 'ps_include_file', 'ps_lineto', 'ps_makespotcolor', 'ps_moveto', 'ps_new', 'ps_open_file', 'ps_open_image', 'ps_open_image_file', 'ps_open_memory_image', 'ps_place_image', 'ps_rect', 'ps_restore', 'ps_rotate', 'ps_save', 'ps_scale', 'ps_set_border_color', 'ps_set_border_dash', 'ps_set_border_style', 'ps_set_info', 'ps_set_parameter', 'ps_set_text_pos', 'ps_set_value', 'ps_setcolor', 'ps_setdash', 'ps_setflat', 'ps_setfont', 'ps_setgray', 'ps_setlinecap', 'ps_setlinejoin', 'ps_setlinewidth', 'ps_setmiterlimit', 'ps_setoverprintmode', 'ps_setpolydash', 'ps_shading', 'ps_shading_pattern', 'ps_shfill', 'ps_show', 'ps_show2', 'ps_show_boxed', 'ps_show_xy', 'ps_show_xy2', 'ps_string_geometry', 'ps_stringwidth', 'ps_stroke', 'ps_symbol', 'ps_symbol_name', 'ps_symbol_width', 'ps_translate', 'px_close', 'px_create_fp', 'px_date2string', 'px_delete', 'px_delete_record', 'px_get_field', 'px_get_info', 'px_get_parameter', 'px_get_record', 'px_get_schema', 'px_get_value', 'px_insert_record', 'px_new', 'px_numfields', 'px_numrecords', 'px_open_fp', 'px_put_record', 'px_retrieve_record', 'px_set_blob_file', 'px_set_parameter', 'px_set_tablename', 'px_set_targetencoding', 'px_set_value', 'px_timestamp2string', 'px_update_record', 'radius_acct_open', 'radius_add_server', 'radius_auth_open', 'radius_close', 'radius_config', 'radius_create_request', 'radius_demangle', 'radius_demangle_mppe_key', 'radius_get_attr', 'radius_put_addr', 'radius_put_attr', 'radius_put_int', 'radius_put_string', 'radius_put_vendor_addr', 'radius_put_vendor_attr', 'radius_put_vendor_int', 'radius_put_vendor_string', 'radius_request_authenticator', 'radius_salt_encrypt_attr', 'radius_send_request', 'radius_server_secret', 'radius_strerror', 'readdir', 'readfile', 'recode_file', 'rename', 'rewind', 'rewinddir', 'rmdir', 'rpm_close', 'rpm_get_tag', 'rpm_open', 'sapi_windows_vt100_support', 'scandir', 'sem_acquire', 'sem_get', 'sem_release', 'sem_remove', 'set_file_buffer', 'shm_attach', 'shm_detach', 'shm_get_var', 'shm_has_var', 'shm_put_var', 'shm_remove', 'shm_remove_var', 'shmop_close', 'shmop_delete', 'shmop_open', 'shmop_read', 'shmop_size', 'shmop_write', 'socket_accept', 'socket_addrinfo_bind', 'socket_addrinfo_connect', 'socket_addrinfo_explain', 'socket_bind', 'socket_clear_error', 'socket_close', 'socket_connect', 'socket_export_stream', 'socket_get_option', 'socket_get_status', 'socket_getopt', 'socket_getpeername', 'socket_getsockname', 'socket_import_stream', 'socket_last_error', 'socket_listen', 'socket_read', 'socket_recv', 'socket_recvfrom', 'socket_recvmsg', 'socket_send', 'socket_sendmsg', 'socket_sendto', 'socket_set_block', 'socket_set_blocking', 'socket_set_nonblock', 'socket_set_option', 'socket_set_timeout', 'socket_shutdown', 'socket_write', 'sqlite_close', 'sqlite_fetch_string', 'sqlite_has_more', 'sqlite_open', 'sqlite_popen', 'sqlsrv_begin_transaction', 'sqlsrv_cancel', 'sqlsrv_client_info', 'sqlsrv_close', 'sqlsrv_commit', 'sqlsrv_connect', 'sqlsrv_execute', 'sqlsrv_fetch', 'sqlsrv_fetch_array', 'sqlsrv_fetch_object', 'sqlsrv_field_metadata', 'sqlsrv_free_stmt', 'sqlsrv_get_field', 'sqlsrv_has_rows', 'sqlsrv_next_result', 'sqlsrv_num_fields', 'sqlsrv_num_rows', 'sqlsrv_prepare', 'sqlsrv_query', 'sqlsrv_rollback', 'sqlsrv_rows_affected', 'sqlsrv_send_stream_data', 'sqlsrv_server_info', 'ssh2_auth_agent', 'ssh2_auth_hostbased_file', 'ssh2_auth_none', 'ssh2_auth_password', 'ssh2_auth_pubkey_file', 'ssh2_disconnect', 'ssh2_exec', 'ssh2_fetch_stream', 'ssh2_fingerprint', 'ssh2_methods_negotiated', 'ssh2_publickey_add', 'ssh2_publickey_init', 'ssh2_publickey_list', 'ssh2_publickey_remove', 'ssh2_scp_recv', 'ssh2_scp_send', 'ssh2_sftp', 'ssh2_sftp_chmod', 'ssh2_sftp_lstat', 'ssh2_sftp_mkdir', 'ssh2_sftp_readlink', 'ssh2_sftp_realpath', 'ssh2_sftp_rename', 'ssh2_sftp_rmdir', 'ssh2_sftp_stat', 'ssh2_sftp_symlink', 'ssh2_sftp_unlink', 'ssh2_shell', 'ssh2_tunnel', 'stomp_connect', 'streamWrapper::stream_cast', 'stream_bucket_append', 'stream_bucket_make_writeable', 'stream_bucket_new', 'stream_bucket_prepend', 'stream_context_create', 'stream_context_get_default', 'stream_context_get_options', 'stream_context_get_params', 'stream_context_set_default', 'stream_context_set_params', 'stream_copy_to_stream', 'stream_encoding', 'stream_filter_append', 'stream_filter_prepend', 'stream_filter_remove', 'stream_get_contents', 'stream_get_line', 'stream_get_meta_data', 'stream_isatty', 'stream_set_blocking', 'stream_set_chunk_size', 'stream_set_read_buffer', 'stream_set_timeout', 'stream_set_write_buffer', 'stream_socket_accept', 'stream_socket_client', 'stream_socket_enable_crypto', 'stream_socket_get_name', 'stream_socket_recvfrom', 'stream_socket_sendto', 'stream_socket_server', 'stream_socket_shutdown', 'stream_supports_lock', 'svn_fs_abort_txn', 'svn_fs_apply_text', 'svn_fs_begin_txn2', 'svn_fs_change_node_prop', 'svn_fs_check_path', 'svn_fs_contents_changed', 'svn_fs_copy', 'svn_fs_delete', 'svn_fs_dir_entries', 'svn_fs_file_contents', 'svn_fs_file_length', 'svn_fs_is_dir', 'svn_fs_is_file', 'svn_fs_make_dir', 'svn_fs_make_file', 'svn_fs_node_created_rev', 'svn_fs_node_prop', 'svn_fs_props_changed', 'svn_fs_revision_prop', 'svn_fs_revision_root', 'svn_fs_txn_root', 'svn_fs_youngest_rev', 'svn_repos_create', 'svn_repos_fs', 'svn_repos_fs_begin_txn_for_commit', 'svn_repos_fs_commit_txn', 'svn_repos_open', 'sybase_affected_rows', 'sybase_close', 'sybase_connect', 'sybase_data_seek', 'sybase_fetch_array', 'sybase_fetch_assoc', 'sybase_fetch_field', 'sybase_fetch_object', 'sybase_fetch_row', 'sybase_field_seek', 'sybase_free_result', 'sybase_num_fields', 'sybase_num_rows', 'sybase_pconnect', 'sybase_query', 'sybase_result', 'sybase_select_db', 'sybase_set_message_handler', 'sybase_unbuffered_query', 'tmpfile', 'udm_add_search_limit', 'udm_alloc_agent', 'udm_alloc_agent_array', 'udm_cat_list', 'udm_cat_path', 'udm_check_charset', 'udm_clear_search_limits', 'udm_crc32', 'udm_errno', 'udm_error', 'udm_find', 'udm_free_agent', 'udm_free_res', 'udm_get_doc_count', 'udm_get_res_field', 'udm_get_res_param', 'udm_hash32', 'udm_load_ispell_data', 'udm_set_agent_param', 'unlink', 'vfprintf', 'w32api_init_dtype', 'wddx_add_vars', 'wddx_packet_end', 'wddx_packet_start', 'xml_get_current_byte_index', 'xml_get_current_column_number', 'xml_get_current_line_number', 'xml_get_error_code', 'xml_parse', 'xml_parse_into_struct', 'xml_parser_create', 'xml_parser_create_ns', 'xml_parser_free', 'xml_parser_get_option', 'xml_parser_set_option', 'xml_set_character_data_handler', 'xml_set_default_handler', 'xml_set_element_handler', 'xml_set_end_namespace_decl_handler', 'xml_set_external_entity_ref_handler', 'xml_set_notation_decl_handler', 'xml_set_object', 'xml_set_processing_instruction_handler', 'xml_set_start_namespace_decl_handler', 'xml_set_unparsed_entity_decl_handler', 'xmlrpc_server_add_introspection_data', 'xmlrpc_server_call_method', 'xmlrpc_server_create', 'xmlrpc_server_destroy', 'xmlrpc_server_register_introspection_callback', 'xmlrpc_server_register_method', 'xmlwriter_end_attribute', 'xmlwriter_end_cdata', 'xmlwriter_end_comment', 'xmlwriter_end_document', 'xmlwriter_end_dtd', 'xmlwriter_end_dtd_attlist', 'xmlwriter_end_dtd_element', 'xmlwriter_end_dtd_entity', 'xmlwriter_end_element', 'xmlwriter_end_pi', 'xmlwriter_flush', 'xmlwriter_full_end_element', 'xmlwriter_open_memory', 'xmlwriter_open_uri', 'xmlwriter_output_memory', 'xmlwriter_set_indent', 'xmlwriter_set_indent_string', 'xmlwriter_start_attribute', 'xmlwriter_start_attribute_ns', 'xmlwriter_start_cdata', 'xmlwriter_start_comment', 'xmlwriter_start_document', 'xmlwriter_start_dtd', 'xmlwriter_start_dtd_attlist', 'xmlwriter_start_dtd_element', 'xmlwriter_start_dtd_entity', 'xmlwriter_start_element', 'xmlwriter_start_element_ns', 'xmlwriter_start_pi', 'xmlwriter_text', 'xmlwriter_write_attribute', 'xmlwriter_write_attribute_ns', 'xmlwriter_write_cdata', 'xmlwriter_write_comment', 'xmlwriter_write_dtd', 'xmlwriter_write_dtd_attlist', 'xmlwriter_write_dtd_element', 'xmlwriter_write_dtd_entity', 'xmlwriter_write_element', 'xmlwriter_write_element_ns', 'xmlwriter_write_pi', 'xmlwriter_write_raw', 'xslt_create', 'yaz_addinfo', 'yaz_ccl_conf', 'yaz_ccl_parse', 'yaz_close', 'yaz_database', 'yaz_element', 'yaz_errno', 'yaz_error', 'yaz_es', 'yaz_es_result', 'yaz_get_option', 'yaz_hits', 'yaz_itemorder', 'yaz_present', 'yaz_range', 'yaz_record', 'yaz_scan', 'yaz_scan_result', 'yaz_schema', 'yaz_search', 'yaz_sort', 'yaz_syntax', 'zip_close', 'zip_entry_close', 'zip_entry_compressedsize', 'zip_entry_compressionmethod', 'zip_entry_filesize', 'zip_entry_name', 'zip_entry_open', 'zip_entry_read', 'zip_open', 'zip_read']; + return ['Directory::close', 'Directory::read', 'Directory::rewind', 'DirectoryIterator::openFile', 'FilesystemIterator::openFile', 'Gmagick::readimagefile', 'HttpResponse::getRequestBodyStream', 'HttpResponse::getStream', 'HttpResponse::setStream', 'Imagick::pingImageFile', 'Imagick::readImageFile', 'Imagick::writeImageFile', 'Imagick::writeImagesFile', 'MongoGridFSCursor::__construct', 'MongoGridFSFile::getResource', 'MysqlndUhConnection::stmtInit', 'MysqlndUhConnection::storeResult', 'MysqlndUhConnection::useResult', 'PDF_activate_item', 'PDF_add_launchlink', 'PDF_add_locallink', 'PDF_add_nameddest', 'PDF_add_note', 'PDF_add_pdflink', 'PDF_add_table_cell', 'PDF_add_textflow', 'PDF_add_thumbnail', 'PDF_add_weblink', 'PDF_arc', 'PDF_arcn', 'PDF_attach_file', 'PDF_begin_document', 'PDF_begin_font', 'PDF_begin_glyph', 'PDF_begin_item', 'PDF_begin_layer', 'PDF_begin_page', 'PDF_begin_page_ext', 'PDF_begin_pattern', 'PDF_begin_template', 'PDF_begin_template_ext', 'PDF_circle', 'PDF_clip', 'PDF_close', 'PDF_close_image', 'PDF_close_pdi', 'PDF_close_pdi_page', 'PDF_closepath', 'PDF_closepath_fill_stroke', 'PDF_closepath_stroke', 'PDF_concat', 'PDF_continue_text', 'PDF_create_3dview', 'PDF_create_action', 'PDF_create_annotation', 'PDF_create_bookmark', 'PDF_create_field', 'PDF_create_fieldgroup', 'PDF_create_gstate', 'PDF_create_pvf', 'PDF_create_textflow', 'PDF_curveto', 'PDF_define_layer', 'PDF_delete', 'PDF_delete_pvf', 'PDF_delete_table', 'PDF_delete_textflow', 'PDF_encoding_set_char', 'PDF_end_document', 'PDF_end_font', 'PDF_end_glyph', 'PDF_end_item', 'PDF_end_layer', 'PDF_end_page', 'PDF_end_page_ext', 'PDF_end_pattern', 'PDF_end_template', 'PDF_endpath', 'PDF_fill', 'PDF_fill_imageblock', 'PDF_fill_pdfblock', 'PDF_fill_stroke', 'PDF_fill_textblock', 'PDF_findfont', 'PDF_fit_image', 'PDF_fit_pdi_page', 'PDF_fit_table', 'PDF_fit_textflow', 'PDF_fit_textline', 'PDF_get_apiname', 'PDF_get_buffer', 'PDF_get_errmsg', 'PDF_get_errnum', 'PDF_get_parameter', 'PDF_get_pdi_parameter', 'PDF_get_pdi_value', 'PDF_get_value', 'PDF_info_font', 'PDF_info_matchbox', 'PDF_info_table', 'PDF_info_textflow', 'PDF_info_textline', 'PDF_initgraphics', 'PDF_lineto', 'PDF_load_3ddata', 'PDF_load_font', 'PDF_load_iccprofile', 'PDF_load_image', 'PDF_makespotcolor', 'PDF_moveto', 'PDF_new', 'PDF_open_ccitt', 'PDF_open_file', 'PDF_open_image', 'PDF_open_image_file', 'PDF_open_memory_image', 'PDF_open_pdi', 'PDF_open_pdi_document', 'PDF_open_pdi_page', 'PDF_pcos_get_number', 'PDF_pcos_get_stream', 'PDF_pcos_get_string', 'PDF_place_image', 'PDF_place_pdi_page', 'PDF_process_pdi', 'PDF_rect', 'PDF_restore', 'PDF_resume_page', 'PDF_rotate', 'PDF_save', 'PDF_scale', 'PDF_set_border_color', 'PDF_set_border_dash', 'PDF_set_border_style', 'PDF_set_gstate', 'PDF_set_info', 'PDF_set_layer_dependency', 'PDF_set_parameter', 'PDF_set_text_pos', 'PDF_set_value', 'PDF_setcolor', 'PDF_setdash', 'PDF_setdashpattern', 'PDF_setflat', 'PDF_setfont', 'PDF_setgray', 'PDF_setgray_fill', 'PDF_setgray_stroke', 'PDF_setlinecap', 'PDF_setlinejoin', 'PDF_setlinewidth', 'PDF_setmatrix', 'PDF_setmiterlimit', 'PDF_setrgbcolor', 'PDF_setrgbcolor_fill', 'PDF_setrgbcolor_stroke', 'PDF_shading', 'PDF_shading_pattern', 'PDF_shfill', 'PDF_show', 'PDF_show_boxed', 'PDF_show_xy', 'PDF_skew', 'PDF_stringwidth', 'PDF_stroke', 'PDF_suspend_page', 'PDF_translate', 'PDF_utf16_to_utf8', 'PDF_utf32_to_utf16', 'PDF_utf8_to_utf16', 'PDO::pgsqlLOBOpen', 'RarEntry::getStream', 'SQLite3::openBlob', 'SWFMovie::saveToFile', 'SplFileInfo::openFile', 'SplFileObject::openFile', 'SplTempFileObject::openFile', 'V8Js::compileString', 'V8Js::executeScript', 'PHPUnitPHAR\Vtiful\Kernel\Excel::setColumn', 'PHPUnitPHAR\Vtiful\Kernel\Excel::setRow', 'PHPUnitPHAR\Vtiful\Kernel\Format::align', 'PHPUnitPHAR\Vtiful\Kernel\Format::bold', 'PHPUnitPHAR\Vtiful\Kernel\Format::italic', 'PHPUnitPHAR\Vtiful\Kernel\Format::underline', 'XMLWriter::openMemory', 'XMLWriter::openURI', 'ZipArchive::getStream', 'Zookeeper::setLogStream', 'apc_bin_dumpfile', 'apc_bin_loadfile', 'bbcode_add_element', 'bbcode_add_smiley', 'bbcode_create', 'bbcode_destroy', 'bbcode_parse', 'bbcode_set_arg_parser', 'bbcode_set_flags', 'bcompiler_read', 'bcompiler_write_class', 'bcompiler_write_constant', 'bcompiler_write_exe_footer', 'bcompiler_write_file', 'bcompiler_write_footer', 'bcompiler_write_function', 'bcompiler_write_functions_from_file', 'bcompiler_write_header', 'bcompiler_write_included_filename', 'bzclose', 'bzerrno', 'bzerror', 'bzerrstr', 'bzflush', 'bzopen', 'bzread', 'bzwrite', 'cairo_surface_write_to_png', 'closedir', 'copy', 'crack_closedict', 'crack_opendict', 'cubrid_bind', 'cubrid_close_prepare', 'cubrid_close_request', 'cubrid_col_get', 'cubrid_col_size', 'cubrid_column_names', 'cubrid_column_types', 'cubrid_commit', 'cubrid_connect', 'cubrid_connect_with_url', 'cubrid_current_oid', 'cubrid_db_parameter', 'cubrid_disconnect', 'cubrid_drop', 'cubrid_fetch', 'cubrid_free_result', 'cubrid_get', 'cubrid_get_autocommit', 'cubrid_get_charset', 'cubrid_get_class_name', 'cubrid_get_db_parameter', 'cubrid_get_query_timeout', 'cubrid_get_server_info', 'cubrid_insert_id', 'cubrid_is_instance', 'cubrid_lob2_bind', 'cubrid_lob2_close', 'cubrid_lob2_export', 'cubrid_lob2_import', 'cubrid_lob2_new', 'cubrid_lob2_read', 'cubrid_lob2_seek', 'cubrid_lob2_seek64', 'cubrid_lob2_size', 'cubrid_lob2_size64', 'cubrid_lob2_tell', 'cubrid_lob2_tell64', 'cubrid_lob2_write', 'cubrid_lob_export', 'cubrid_lob_get', 'cubrid_lob_send', 'cubrid_lob_size', 'cubrid_lock_read', 'cubrid_lock_write', 'cubrid_move_cursor', 'cubrid_next_result', 'cubrid_num_cols', 'cubrid_num_rows', 'cubrid_pconnect', 'cubrid_pconnect_with_url', 'cubrid_prepare', 'cubrid_put', 'cubrid_query', 'cubrid_rollback', 'cubrid_schema', 'cubrid_seq_add', 'cubrid_seq_drop', 'cubrid_seq_insert', 'cubrid_seq_put', 'cubrid_set_add', 'cubrid_set_autocommit', 'cubrid_set_db_parameter', 'cubrid_set_drop', 'cubrid_set_query_timeout', 'cubrid_unbuffered_query', 'curl_close', 'curl_copy_handle', 'curl_errno', 'curl_error', 'curl_escape', 'curl_exec', 'curl_getinfo', 'curl_multi_add_handle', 'curl_multi_close', 'curl_multi_errno', 'curl_multi_exec', 'curl_multi_getcontent', 'curl_multi_info_read', 'curl_multi_remove_handle', 'curl_multi_select', 'curl_multi_setopt', 'curl_pause', 'curl_reset', 'curl_setopt', 'curl_setopt_array', 'curl_share_close', 'curl_share_errno', 'curl_share_init', 'curl_share_setopt', 'curl_unescape', 'cyrus_authenticate', 'cyrus_bind', 'cyrus_close', 'cyrus_connect', 'cyrus_query', 'cyrus_unbind', 'db2_autocommit', 'db2_bind_param', 'db2_client_info', 'db2_close', 'db2_column_privileges', 'db2_columns', 'db2_commit', 'db2_conn_error', 'db2_conn_errormsg', 'db2_connect', 'db2_cursor_type', 'db2_exec', 'db2_execute', 'db2_fetch_array', 'db2_fetch_assoc', 'db2_fetch_both', 'db2_fetch_object', 'db2_fetch_row', 'db2_field_display_size', 'db2_field_name', 'db2_field_num', 'db2_field_precision', 'db2_field_scale', 'db2_field_type', 'db2_field_width', 'db2_foreign_keys', 'db2_free_result', 'db2_free_stmt', 'db2_get_option', 'db2_last_insert_id', 'db2_lob_read', 'db2_next_result', 'db2_num_fields', 'db2_num_rows', 'db2_pclose', 'db2_pconnect', 'db2_prepare', 'db2_primary_keys', 'db2_procedure_columns', 'db2_procedures', 'db2_result', 'db2_rollback', 'db2_server_info', 'db2_set_option', 'db2_special_columns', 'db2_statistics', 'db2_stmt_error', 'db2_stmt_errormsg', 'db2_table_privileges', 'db2_tables', 'dba_close', 'dba_delete', 'dba_exists', 'dba_fetch', 'dba_firstkey', 'dba_insert', 'dba_nextkey', 'dba_open', 'dba_optimize', 'dba_popen', 'dba_replace', 'dba_sync', 'dbplus_add', 'dbplus_aql', 'dbplus_close', 'dbplus_curr', 'dbplus_find', 'dbplus_first', 'dbplus_flush', 'dbplus_freelock', 'dbplus_freerlocks', 'dbplus_getlock', 'dbplus_getunique', 'dbplus_info', 'dbplus_last', 'dbplus_lockrel', 'dbplus_next', 'dbplus_open', 'dbplus_prev', 'dbplus_rchperm', 'dbplus_rcreate', 'dbplus_rcrtexact', 'dbplus_rcrtlike', 'dbplus_restorepos', 'dbplus_rkeys', 'dbplus_ropen', 'dbplus_rquery', 'dbplus_rrename', 'dbplus_rsecindex', 'dbplus_runlink', 'dbplus_rzap', 'dbplus_savepos', 'dbplus_setindex', 'dbplus_setindexbynumber', 'dbplus_sql', 'dbplus_tremove', 'dbplus_undo', 'dbplus_undoprepare', 'dbplus_unlockrel', 'dbplus_unselect', 'dbplus_update', 'dbplus_xlockrel', 'dbplus_xunlockrel', 'deflate_add', 'dio_close', 'dio_fcntl', 'dio_open', 'dio_read', 'dio_seek', 'dio_stat', 'dio_tcsetattr', 'dio_truncate', 'dio_write', 'dir', 'eio_busy', 'eio_cancel', 'eio_chmod', 'eio_chown', 'eio_close', 'eio_custom', 'eio_dup2', 'eio_fallocate', 'eio_fchmod', 'eio_fchown', 'eio_fdatasync', 'eio_fstat', 'eio_fstatvfs', 'eio_fsync', 'eio_ftruncate', 'eio_futime', 'eio_get_last_error', 'eio_grp', 'eio_grp_add', 'eio_grp_cancel', 'eio_grp_limit', 'eio_link', 'eio_lstat', 'eio_mkdir', 'eio_mknod', 'eio_nop', 'eio_open', 'eio_read', 'eio_readahead', 'eio_readdir', 'eio_readlink', 'eio_realpath', 'eio_rename', 'eio_rmdir', 'eio_seek', 'eio_sendfile', 'eio_stat', 'eio_statvfs', 'eio_symlink', 'eio_sync', 'eio_sync_file_range', 'eio_syncfs', 'eio_truncate', 'eio_unlink', 'eio_utime', 'eio_write', 'enchant_broker_describe', 'enchant_broker_dict_exists', 'enchant_broker_free', 'enchant_broker_free_dict', 'enchant_broker_get_dict_path', 'enchant_broker_get_error', 'enchant_broker_init', 'enchant_broker_list_dicts', 'enchant_broker_request_dict', 'enchant_broker_request_pwl_dict', 'enchant_broker_set_dict_path', 'enchant_broker_set_ordering', 'enchant_dict_add_to_personal', 'enchant_dict_add_to_session', 'enchant_dict_check', 'enchant_dict_describe', 'enchant_dict_get_error', 'enchant_dict_is_in_session', 'enchant_dict_quick_check', 'enchant_dict_store_replacement', 'enchant_dict_suggest', 'event_add', 'event_base_free', 'event_base_loop', 'event_base_loopbreak', 'event_base_loopexit', 'event_base_new', 'event_base_priority_init', 'event_base_reinit', 'event_base_set', 'event_buffer_base_set', 'event_buffer_disable', 'event_buffer_enable', 'event_buffer_fd_set', 'event_buffer_free', 'event_buffer_new', 'event_buffer_priority_set', 'event_buffer_read', 'event_buffer_set_callback', 'event_buffer_timeout_set', 'event_buffer_watermark_set', 'event_buffer_write', 'event_del', 'event_free', 'event_new', 'event_priority_set', 'event_set', 'event_timer_add', 'event_timer_del', 'event_timer_pending', 'event_timer_set', 'expect_expectl', 'expect_popen', 'fam_cancel_monitor', 'fam_close', 'fam_monitor_collection', 'fam_monitor_directory', 'fam_monitor_file', 'fam_next_event', 'fam_open', 'fam_pending', 'fam_resume_monitor', 'fam_suspend_monitor', 'fann_cascadetrain_on_data', 'fann_cascadetrain_on_file', 'fann_clear_scaling_params', 'fann_copy', 'fann_create_from_file', 'fann_create_shortcut_array', 'fann_create_standard', 'fann_create_standard_array', 'fann_create_train', 'fann_create_train_from_callback', 'fann_descale_input', 'fann_descale_output', 'fann_descale_train', 'fann_destroy', 'fann_destroy_train', 'fann_duplicate_train_data', 'fann_get_MSE', 'fann_get_activation_function', 'fann_get_activation_steepness', 'fann_get_bias_array', 'fann_get_bit_fail', 'fann_get_bit_fail_limit', 'fann_get_cascade_activation_functions', 'fann_get_cascade_activation_functions_count', 'fann_get_cascade_activation_steepnesses', 'fann_get_cascade_activation_steepnesses_count', 'fann_get_cascade_candidate_change_fraction', 'fann_get_cascade_candidate_limit', 'fann_get_cascade_candidate_stagnation_epochs', 'fann_get_cascade_max_cand_epochs', 'fann_get_cascade_max_out_epochs', 'fann_get_cascade_min_cand_epochs', 'fann_get_cascade_min_out_epochs', 'fann_get_cascade_num_candidate_groups', 'fann_get_cascade_num_candidates', 'fann_get_cascade_output_change_fraction', 'fann_get_cascade_output_stagnation_epochs', 'fann_get_cascade_weight_multiplier', 'fann_get_connection_array', 'fann_get_connection_rate', 'fann_get_errno', 'fann_get_errstr', 'fann_get_layer_array', 'fann_get_learning_momentum', 'fann_get_learning_rate', 'fann_get_network_type', 'fann_get_num_input', 'fann_get_num_layers', 'fann_get_num_output', 'fann_get_quickprop_decay', 'fann_get_quickprop_mu', 'fann_get_rprop_decrease_factor', 'fann_get_rprop_delta_max', 'fann_get_rprop_delta_min', 'fann_get_rprop_delta_zero', 'fann_get_rprop_increase_factor', 'fann_get_sarprop_step_error_shift', 'fann_get_sarprop_step_error_threshold_factor', 'fann_get_sarprop_temperature', 'fann_get_sarprop_weight_decay_shift', 'fann_get_total_connections', 'fann_get_total_neurons', 'fann_get_train_error_function', 'fann_get_train_stop_function', 'fann_get_training_algorithm', 'fann_init_weights', 'fann_length_train_data', 'fann_merge_train_data', 'fann_num_input_train_data', 'fann_num_output_train_data', 'fann_randomize_weights', 'fann_read_train_from_file', 'fann_reset_errno', 'fann_reset_errstr', 'fann_run', 'fann_save', 'fann_save_train', 'fann_scale_input', 'fann_scale_input_train_data', 'fann_scale_output', 'fann_scale_output_train_data', 'fann_scale_train', 'fann_scale_train_data', 'fann_set_activation_function', 'fann_set_activation_function_hidden', 'fann_set_activation_function_layer', 'fann_set_activation_function_output', 'fann_set_activation_steepness', 'fann_set_activation_steepness_hidden', 'fann_set_activation_steepness_layer', 'fann_set_activation_steepness_output', 'fann_set_bit_fail_limit', 'fann_set_callback', 'fann_set_cascade_activation_functions', 'fann_set_cascade_activation_steepnesses', 'fann_set_cascade_candidate_change_fraction', 'fann_set_cascade_candidate_limit', 'fann_set_cascade_candidate_stagnation_epochs', 'fann_set_cascade_max_cand_epochs', 'fann_set_cascade_max_out_epochs', 'fann_set_cascade_min_cand_epochs', 'fann_set_cascade_min_out_epochs', 'fann_set_cascade_num_candidate_groups', 'fann_set_cascade_output_change_fraction', 'fann_set_cascade_output_stagnation_epochs', 'fann_set_cascade_weight_multiplier', 'fann_set_error_log', 'fann_set_input_scaling_params', 'fann_set_learning_momentum', 'fann_set_learning_rate', 'fann_set_output_scaling_params', 'fann_set_quickprop_decay', 'fann_set_quickprop_mu', 'fann_set_rprop_decrease_factor', 'fann_set_rprop_delta_max', 'fann_set_rprop_delta_min', 'fann_set_rprop_delta_zero', 'fann_set_rprop_increase_factor', 'fann_set_sarprop_step_error_shift', 'fann_set_sarprop_step_error_threshold_factor', 'fann_set_sarprop_temperature', 'fann_set_sarprop_weight_decay_shift', 'fann_set_scaling_params', 'fann_set_train_error_function', 'fann_set_train_stop_function', 'fann_set_training_algorithm', 'fann_set_weight', 'fann_set_weight_array', 'fann_shuffle_train_data', 'fann_subset_train_data', 'fann_test', 'fann_test_data', 'fann_train', 'fann_train_epoch', 'fann_train_on_data', 'fann_train_on_file', 'fbsql_affected_rows', 'fbsql_autocommit', 'fbsql_blob_size', 'fbsql_change_user', 'fbsql_clob_size', 'fbsql_close', 'fbsql_commit', 'fbsql_connect', 'fbsql_create_blob', 'fbsql_create_clob', 'fbsql_create_db', 'fbsql_data_seek', 'fbsql_database', 'fbsql_database_password', 'fbsql_db_query', 'fbsql_db_status', 'fbsql_drop_db', 'fbsql_errno', 'fbsql_error', 'fbsql_fetch_array', 'fbsql_fetch_assoc', 'fbsql_fetch_field', 'fbsql_fetch_lengths', 'fbsql_fetch_object', 'fbsql_fetch_row', 'fbsql_field_flags', 'fbsql_field_len', 'fbsql_field_name', 'fbsql_field_seek', 'fbsql_field_table', 'fbsql_field_type', 'fbsql_free_result', 'fbsql_get_autostart_info', 'fbsql_hostname', 'fbsql_insert_id', 'fbsql_list_dbs', 'fbsql_list_fields', 'fbsql_list_tables', 'fbsql_next_result', 'fbsql_num_fields', 'fbsql_num_rows', 'fbsql_password', 'fbsql_pconnect', 'fbsql_query', 'fbsql_read_blob', 'fbsql_read_clob', 'fbsql_result', 'fbsql_rollback', 'fbsql_rows_fetched', 'fbsql_select_db', 'fbsql_set_characterset', 'fbsql_set_lob_mode', 'fbsql_set_password', 'fbsql_set_transaction', 'fbsql_start_db', 'fbsql_stop_db', 'fbsql_table_name', 'fbsql_username', 'fclose', 'fdf_add_doc_javascript', 'fdf_add_template', 'fdf_close', 'fdf_create', 'fdf_enum_values', 'fdf_get_ap', 'fdf_get_attachment', 'fdf_get_encoding', 'fdf_get_file', 'fdf_get_flags', 'fdf_get_opt', 'fdf_get_status', 'fdf_get_value', 'fdf_get_version', 'fdf_next_field_name', 'fdf_open', 'fdf_open_string', 'fdf_remove_item', 'fdf_save', 'fdf_save_string', 'fdf_set_ap', 'fdf_set_encoding', 'fdf_set_file', 'fdf_set_flags', 'fdf_set_javascript_action', 'fdf_set_on_import_javascript', 'fdf_set_opt', 'fdf_set_status', 'fdf_set_submit_form_action', 'fdf_set_target_frame', 'fdf_set_value', 'fdf_set_version', 'feof', 'fflush', 'ffmpeg_frame::__construct', 'ffmpeg_frame::toGDImage', 'fgetc', 'fgetcsv', 'fgets', 'fgetss', 'file', 'file_get_contents', 'file_put_contents', 'finfo::buffer', 'finfo::file', 'finfo_buffer', 'finfo_close', 'finfo_file', 'finfo_open', 'finfo_set_flags', 'flock', 'fopen', 'fpassthru', 'fprintf', 'fputcsv', 'fputs', 'fread', 'fscanf', 'fseek', 'fstat', 'ftell', 'ftp_alloc', 'ftp_append', 'ftp_cdup', 'ftp_chdir', 'ftp_chmod', 'ftp_close', 'ftp_delete', 'ftp_exec', 'ftp_fget', 'ftp_fput', 'ftp_get', 'ftp_get_option', 'ftp_login', 'ftp_mdtm', 'ftp_mkdir', 'ftp_mlsd', 'ftp_nb_continue', 'ftp_nb_fget', 'ftp_nb_fput', 'ftp_nb_get', 'ftp_nb_put', 'ftp_nlist', 'ftp_pasv', 'ftp_put', 'ftp_pwd', 'ftp_quit', 'ftp_raw', 'ftp_rawlist', 'ftp_rename', 'ftp_rmdir', 'ftp_set_option', 'ftp_site', 'ftp_size', 'ftp_systype', 'ftruncate', 'fwrite', 'get_resource_type', 'gmp_div', 'gnupg::init', 'gnupg_adddecryptkey', 'gnupg_addencryptkey', 'gnupg_addsignkey', 'gnupg_cleardecryptkeys', 'gnupg_clearencryptkeys', 'gnupg_clearsignkeys', 'gnupg_decrypt', 'gnupg_decryptverify', 'gnupg_encrypt', 'gnupg_encryptsign', 'gnupg_export', 'gnupg_geterror', 'gnupg_getprotocol', 'gnupg_import', 'gnupg_init', 'gnupg_keyinfo', 'gnupg_setarmor', 'gnupg_seterrormode', 'gnupg_setsignmode', 'gnupg_sign', 'gnupg_verify', 'gupnp_context_get_host_ip', 'gupnp_context_get_port', 'gupnp_context_get_subscription_timeout', 'gupnp_context_host_path', 'gupnp_context_new', 'gupnp_context_set_subscription_timeout', 'gupnp_context_timeout_add', 'gupnp_context_unhost_path', 'gupnp_control_point_browse_start', 'gupnp_control_point_browse_stop', 'gupnp_control_point_callback_set', 'gupnp_control_point_new', 'gupnp_device_action_callback_set', 'gupnp_device_info_get', 'gupnp_device_info_get_service', 'gupnp_root_device_get_available', 'gupnp_root_device_get_relative_location', 'gupnp_root_device_new', 'gupnp_root_device_set_available', 'gupnp_root_device_start', 'gupnp_root_device_stop', 'gupnp_service_action_get', 'gupnp_service_action_return', 'gupnp_service_action_return_error', 'gupnp_service_action_set', 'gupnp_service_freeze_notify', 'gupnp_service_info_get', 'gupnp_service_info_get_introspection', 'gupnp_service_introspection_get_state_variable', 'gupnp_service_notify', 'gupnp_service_proxy_action_get', 'gupnp_service_proxy_action_set', 'gupnp_service_proxy_add_notify', 'gupnp_service_proxy_callback_set', 'gupnp_service_proxy_get_subscribed', 'gupnp_service_proxy_remove_notify', 'gupnp_service_proxy_send_action', 'gupnp_service_proxy_set_subscribed', 'gupnp_service_thaw_notify', 'gzclose', 'gzeof', 'gzgetc', 'gzgets', 'gzgetss', 'gzpassthru', 'gzputs', 'gzread', 'gzrewind', 'gzseek', 'gztell', 'gzwrite', 'hash_update_stream', 'PHPUnitPHAR\http\Env\Response::send', 'http_get_request_body_stream', 'ibase_add_user', 'ibase_affected_rows', 'ibase_backup', 'ibase_blob_add', 'ibase_blob_cancel', 'ibase_blob_close', 'ibase_blob_create', 'ibase_blob_get', 'ibase_blob_open', 'ibase_close', 'ibase_commit', 'ibase_commit_ret', 'ibase_connect', 'ibase_db_info', 'ibase_delete_user', 'ibase_drop_db', 'ibase_execute', 'ibase_fetch_assoc', 'ibase_fetch_object', 'ibase_fetch_row', 'ibase_field_info', 'ibase_free_event_handler', 'ibase_free_query', 'ibase_free_result', 'ibase_gen_id', 'ibase_maintain_db', 'ibase_modify_user', 'ibase_name_result', 'ibase_num_fields', 'ibase_num_params', 'ibase_param_info', 'ibase_pconnect', 'ibase_prepare', 'ibase_query', 'ibase_restore', 'ibase_rollback', 'ibase_rollback_ret', 'ibase_server_info', 'ibase_service_attach', 'ibase_service_detach', 'ibase_set_event_handler', 'ibase_trans', 'ifx_affected_rows', 'ifx_close', 'ifx_connect', 'ifx_do', 'ifx_error', 'ifx_fetch_row', 'ifx_fieldproperties', 'ifx_fieldtypes', 'ifx_free_result', 'ifx_getsqlca', 'ifx_htmltbl_result', 'ifx_num_fields', 'ifx_num_rows', 'ifx_pconnect', 'ifx_prepare', 'ifx_query', 'image2wbmp', 'imageaffine', 'imagealphablending', 'imageantialias', 'imagearc', 'imagebmp', 'imagechar', 'imagecharup', 'imagecolorallocate', 'imagecolorallocatealpha', 'imagecolorat', 'imagecolorclosest', 'imagecolorclosestalpha', 'imagecolorclosesthwb', 'imagecolordeallocate', 'imagecolorexact', 'imagecolorexactalpha', 'imagecolormatch', 'imagecolorresolve', 'imagecolorresolvealpha', 'imagecolorset', 'imagecolorsforindex', 'imagecolorstotal', 'imagecolortransparent', 'imageconvolution', 'imagecopy', 'imagecopymerge', 'imagecopymergegray', 'imagecopyresampled', 'imagecopyresized', 'imagecrop', 'imagecropauto', 'imagedashedline', 'imagedestroy', 'imageellipse', 'imagefill', 'imagefilledarc', 'imagefilledellipse', 'imagefilledpolygon', 'imagefilledrectangle', 'imagefilltoborder', 'imagefilter', 'imageflip', 'imagefttext', 'imagegammacorrect', 'imagegd', 'imagegd2', 'imagegetclip', 'imagegif', 'imagegrabscreen', 'imagegrabwindow', 'imageinterlace', 'imageistruecolor', 'imagejpeg', 'imagelayereffect', 'imageline', 'imageopenpolygon', 'imagepalettecopy', 'imagepalettetotruecolor', 'imagepng', 'imagepolygon', 'imagepsencodefont', 'imagepsextendfont', 'imagepsfreefont', 'imagepsloadfont', 'imagepsslantfont', 'imagepstext', 'imagerectangle', 'imageresolution', 'imagerotate', 'imagesavealpha', 'imagescale', 'imagesetbrush', 'imagesetclip', 'imagesetinterpolation', 'imagesetpixel', 'imagesetstyle', 'imagesetthickness', 'imagesettile', 'imagestring', 'imagestringup', 'imagesx', 'imagesy', 'imagetruecolortopalette', 'imagettftext', 'imagewbmp', 'imagewebp', 'imagexbm', 'imap_append', 'imap_body', 'imap_bodystruct', 'imap_check', 'imap_clearflag_full', 'imap_close', 'imap_create', 'imap_createmailbox', 'imap_delete', 'imap_deletemailbox', 'imap_expunge', 'imap_fetch_overview', 'imap_fetchbody', 'imap_fetchheader', 'imap_fetchmime', 'imap_fetchstructure', 'imap_fetchtext', 'imap_gc', 'imap_get_quota', 'imap_get_quotaroot', 'imap_getacl', 'imap_getmailboxes', 'imap_getsubscribed', 'imap_header', 'imap_headerinfo', 'imap_headers', 'imap_list', 'imap_listmailbox', 'imap_listscan', 'imap_listsubscribed', 'imap_lsub', 'imap_mail_copy', 'imap_mail_move', 'imap_mailboxmsginfo', 'imap_msgno', 'imap_num_msg', 'imap_num_recent', 'imap_ping', 'imap_rename', 'imap_renamemailbox', 'imap_reopen', 'imap_savebody', 'imap_scan', 'imap_scanmailbox', 'imap_search', 'imap_set_quota', 'imap_setacl', 'imap_setflag_full', 'imap_sort', 'imap_status', 'imap_subscribe', 'imap_thread', 'imap_uid', 'imap_undelete', 'imap_unsubscribe', 'inflate_add', 'inflate_get_read_len', 'inflate_get_status', 'ingres_autocommit', 'ingres_autocommit_state', 'ingres_charset', 'ingres_close', 'ingres_commit', 'ingres_connect', 'ingres_cursor', 'ingres_errno', 'ingres_error', 'ingres_errsqlstate', 'ingres_escape_string', 'ingres_execute', 'ingres_fetch_array', 'ingres_fetch_assoc', 'ingres_fetch_object', 'ingres_fetch_proc_return', 'ingres_fetch_row', 'ingres_field_length', 'ingres_field_name', 'ingres_field_nullable', 'ingres_field_precision', 'ingres_field_scale', 'ingres_field_type', 'ingres_free_result', 'ingres_next_error', 'ingres_num_fields', 'ingres_num_rows', 'ingres_pconnect', 'ingres_prepare', 'ingres_query', 'ingres_result_seek', 'ingres_rollback', 'ingres_set_environment', 'ingres_unbuffered_query', 'inotify_add_watch', 'inotify_init', 'inotify_queue_len', 'inotify_read', 'inotify_rm_watch', 'kadm5_chpass_principal', 'kadm5_create_principal', 'kadm5_delete_principal', 'kadm5_destroy', 'kadm5_flush', 'kadm5_get_policies', 'kadm5_get_principal', 'kadm5_get_principals', 'kadm5_init_with_password', 'kadm5_modify_principal', 'ldap_add', 'ldap_bind', 'ldap_close', 'ldap_compare', 'ldap_control_paged_result', 'ldap_control_paged_result_response', 'ldap_count_entries', 'ldap_delete', 'ldap_errno', 'ldap_error', 'ldap_exop', 'ldap_exop_passwd', 'ldap_exop_refresh', 'ldap_exop_whoami', 'ldap_first_attribute', 'ldap_first_entry', 'ldap_first_reference', 'ldap_free_result', 'ldap_get_attributes', 'ldap_get_dn', 'ldap_get_entries', 'ldap_get_option', 'ldap_get_values', 'ldap_get_values_len', 'ldap_mod_add', 'ldap_mod_del', 'ldap_mod_replace', 'ldap_modify', 'ldap_modify_batch', 'ldap_next_attribute', 'ldap_next_entry', 'ldap_next_reference', 'ldap_parse_exop', 'ldap_parse_reference', 'ldap_parse_result', 'ldap_rename', 'ldap_sasl_bind', 'ldap_set_option', 'ldap_set_rebind_proc', 'ldap_sort', 'ldap_start_tls', 'ldap_unbind', 'libxml_set_streams_context', 'm_checkstatus', 'm_completeauthorizations', 'm_connect', 'm_connectionerror', 'm_deletetrans', 'm_destroyconn', 'm_getcell', 'm_getcellbynum', 'm_getcommadelimited', 'm_getheader', 'm_initconn', 'm_iscommadelimited', 'm_maxconntimeout', 'm_monitor', 'm_numcolumns', 'm_numrows', 'm_parsecommadelimited', 'm_responsekeys', 'm_responseparam', 'm_returnstatus', 'm_setblocking', 'm_setdropfile', 'm_setip', 'm_setssl', 'm_setssl_cafile', 'm_setssl_files', 'm_settimeout', 'm_transactionssent', 'm_transinqueue', 'm_transkeyval', 'm_transnew', 'm_transsend', 'm_validateidentifier', 'm_verifyconnection', 'm_verifysslcert', 'mailparse_determine_best_xfer_encoding', 'mailparse_msg_create', 'mailparse_msg_extract_part', 'mailparse_msg_extract_part_file', 'mailparse_msg_extract_whole_part_file', 'mailparse_msg_free', 'mailparse_msg_get_part', 'mailparse_msg_get_part_data', 'mailparse_msg_get_structure', 'mailparse_msg_parse', 'mailparse_msg_parse_file', 'mailparse_stream_encode', 'mailparse_uudecode_all', 'maxdb::use_result', 'maxdb_affected_rows', 'maxdb_connect', 'maxdb_disable_rpl_parse', 'maxdb_dump_debug_info', 'maxdb_embedded_connect', 'maxdb_enable_reads_from_master', 'maxdb_enable_rpl_parse', 'maxdb_errno', 'maxdb_error', 'maxdb_fetch_lengths', 'maxdb_field_tell', 'maxdb_get_host_info', 'maxdb_get_proto_info', 'maxdb_get_server_info', 'maxdb_get_server_version', 'maxdb_info', 'maxdb_init', 'maxdb_insert_id', 'maxdb_master_query', 'maxdb_more_results', 'maxdb_next_result', 'maxdb_num_fields', 'maxdb_num_rows', 'maxdb_rpl_parse_enabled', 'maxdb_rpl_probe', 'maxdb_select_db', 'maxdb_sqlstate', 'maxdb_stmt::result_metadata', 'maxdb_stmt_affected_rows', 'maxdb_stmt_errno', 'maxdb_stmt_error', 'maxdb_stmt_num_rows', 'maxdb_stmt_param_count', 'maxdb_stmt_result_metadata', 'maxdb_stmt_sqlstate', 'maxdb_thread_id', 'maxdb_use_result', 'maxdb_warning_count', 'mcrypt_enc_get_algorithms_name', 'mcrypt_enc_get_block_size', 'mcrypt_enc_get_iv_size', 'mcrypt_enc_get_key_size', 'mcrypt_enc_get_modes_name', 'mcrypt_enc_get_supported_key_sizes', 'mcrypt_enc_is_block_algorithm', 'mcrypt_enc_is_block_algorithm_mode', 'mcrypt_enc_is_block_mode', 'mcrypt_enc_self_test', 'mcrypt_generic', 'mcrypt_generic_deinit', 'mcrypt_generic_end', 'mcrypt_generic_init', 'mcrypt_module_close', 'mcrypt_module_open', 'mdecrypt_generic', 'mkdir', 'mqseries_back', 'mqseries_begin', 'mqseries_close', 'mqseries_cmit', 'mqseries_conn', 'mqseries_connx', 'mqseries_disc', 'mqseries_get', 'mqseries_inq', 'mqseries_open', 'mqseries_put', 'mqseries_put1', 'mqseries_set', 'msg_get_queue', 'msg_receive', 'msg_remove_queue', 'msg_send', 'msg_set_queue', 'msg_stat_queue', 'msql_affected_rows', 'msql_close', 'msql_connect', 'msql_create_db', 'msql_data_seek', 'msql_db_query', 'msql_drop_db', 'msql_fetch_array', 'msql_fetch_field', 'msql_fetch_object', 'msql_fetch_row', 'msql_field_flags', 'msql_field_len', 'msql_field_name', 'msql_field_seek', 'msql_field_table', 'msql_field_type', 'msql_free_result', 'msql_list_dbs', 'msql_list_fields', 'msql_list_tables', 'msql_num_fields', 'msql_num_rows', 'msql_pconnect', 'msql_query', 'msql_result', 'msql_select_db', 'mssql_bind', 'mssql_close', 'mssql_connect', 'mssql_data_seek', 'mssql_execute', 'mssql_fetch_array', 'mssql_fetch_assoc', 'mssql_fetch_batch', 'mssql_fetch_field', 'mssql_fetch_object', 'mssql_fetch_row', 'mssql_field_length', 'mssql_field_name', 'mssql_field_seek', 'mssql_field_type', 'mssql_free_result', 'mssql_free_statement', 'mssql_init', 'mssql_next_result', 'mssql_num_fields', 'mssql_num_rows', 'mssql_pconnect', 'mssql_query', 'mssql_result', 'mssql_rows_affected', 'mssql_select_db', 'mysql_affected_rows', 'mysql_client_encoding', 'mysql_close', 'mysql_connect', 'mysql_create_db', 'mysql_data_seek', 'mysql_db_name', 'mysql_db_query', 'mysql_drop_db', 'mysql_errno', 'mysql_error', 'mysql_fetch_array', 'mysql_fetch_assoc', 'mysql_fetch_field', 'mysql_fetch_lengths', 'mysql_fetch_object', 'mysql_fetch_row', 'mysql_field_flags', 'mysql_field_len', 'mysql_field_name', 'mysql_field_seek', 'mysql_field_table', 'mysql_field_type', 'mysql_free_result', 'mysql_get_host_info', 'mysql_get_proto_info', 'mysql_get_server_info', 'mysql_info', 'mysql_insert_id', 'mysql_list_dbs', 'mysql_list_fields', 'mysql_list_processes', 'mysql_list_tables', 'mysql_num_fields', 'mysql_num_rows', 'mysql_pconnect', 'mysql_ping', 'mysql_query', 'mysql_real_escape_string', 'mysql_result', 'mysql_select_db', 'mysql_set_charset', 'mysql_stat', 'mysql_tablename', 'mysql_thread_id', 'mysql_unbuffered_query', 'mysqlnd_uh_convert_to_mysqlnd', 'ncurses_bottom_panel', 'ncurses_del_panel', 'ncurses_delwin', 'ncurses_getmaxyx', 'ncurses_getyx', 'ncurses_hide_panel', 'ncurses_keypad', 'ncurses_meta', 'ncurses_move_panel', 'ncurses_mvwaddstr', 'ncurses_new_panel', 'ncurses_newpad', 'ncurses_newwin', 'ncurses_panel_above', 'ncurses_panel_below', 'ncurses_panel_window', 'ncurses_pnoutrefresh', 'ncurses_prefresh', 'ncurses_replace_panel', 'ncurses_show_panel', 'ncurses_top_panel', 'ncurses_waddch', 'ncurses_waddstr', 'ncurses_wattroff', 'ncurses_wattron', 'ncurses_wattrset', 'ncurses_wborder', 'ncurses_wclear', 'ncurses_wcolor_set', 'ncurses_werase', 'ncurses_wgetch', 'ncurses_whline', 'ncurses_wmouse_trafo', 'ncurses_wmove', 'ncurses_wnoutrefresh', 'ncurses_wrefresh', 'ncurses_wstandend', 'ncurses_wstandout', 'ncurses_wvline', 'newt_button', 'newt_button_bar', 'newt_checkbox', 'newt_checkbox_get_value', 'newt_checkbox_set_flags', 'newt_checkbox_set_value', 'newt_checkbox_tree', 'newt_checkbox_tree_add_item', 'newt_checkbox_tree_find_item', 'newt_checkbox_tree_get_current', 'newt_checkbox_tree_get_entry_value', 'newt_checkbox_tree_get_multi_selection', 'newt_checkbox_tree_get_selection', 'newt_checkbox_tree_multi', 'newt_checkbox_tree_set_current', 'newt_checkbox_tree_set_entry', 'newt_checkbox_tree_set_entry_value', 'newt_checkbox_tree_set_width', 'newt_compact_button', 'newt_component_add_callback', 'newt_component_takes_focus', 'newt_create_grid', 'newt_draw_form', 'newt_entry', 'newt_entry_get_value', 'newt_entry_set', 'newt_entry_set_filter', 'newt_entry_set_flags', 'newt_form', 'newt_form_add_component', 'newt_form_add_components', 'newt_form_add_hot_key', 'newt_form_destroy', 'newt_form_get_current', 'newt_form_run', 'newt_form_set_background', 'newt_form_set_height', 'newt_form_set_size', 'newt_form_set_timer', 'newt_form_set_width', 'newt_form_watch_fd', 'newt_grid_add_components_to_form', 'newt_grid_basic_window', 'newt_grid_free', 'newt_grid_get_size', 'newt_grid_h_close_stacked', 'newt_grid_h_stacked', 'newt_grid_place', 'newt_grid_set_field', 'newt_grid_simple_window', 'newt_grid_v_close_stacked', 'newt_grid_v_stacked', 'newt_grid_wrapped_window', 'newt_grid_wrapped_window_at', 'newt_label', 'newt_label_set_text', 'newt_listbox', 'newt_listbox_append_entry', 'newt_listbox_clear', 'newt_listbox_clear_selection', 'newt_listbox_delete_entry', 'newt_listbox_get_current', 'newt_listbox_get_selection', 'newt_listbox_insert_entry', 'newt_listbox_item_count', 'newt_listbox_select_item', 'newt_listbox_set_current', 'newt_listbox_set_current_by_key', 'newt_listbox_set_data', 'newt_listbox_set_entry', 'newt_listbox_set_width', 'newt_listitem', 'newt_listitem_get_data', 'newt_listitem_set', 'newt_radio_get_current', 'newt_radiobutton', 'newt_run_form', 'newt_scale', 'newt_scale_set', 'newt_scrollbar_set', 'newt_textbox', 'newt_textbox_get_num_lines', 'newt_textbox_reflowed', 'newt_textbox_set_height', 'newt_textbox_set_text', 'newt_vertical_scrollbar', 'oci_bind_array_by_name', 'oci_bind_by_name', 'oci_cancel', 'oci_close', 'oci_commit', 'oci_connect', 'oci_define_by_name', 'oci_error', 'oci_execute', 'oci_fetch', 'oci_fetch_all', 'oci_fetch_array', 'oci_fetch_assoc', 'oci_fetch_object', 'oci_fetch_row', 'oci_field_is_null', 'oci_field_name', 'oci_field_precision', 'oci_field_scale', 'oci_field_size', 'oci_field_type', 'oci_field_type_raw', 'oci_free_cursor', 'oci_free_statement', 'oci_get_implicit_resultset', 'oci_new_collection', 'oci_new_connect', 'oci_new_cursor', 'oci_new_descriptor', 'oci_num_fields', 'oci_num_rows', 'oci_parse', 'oci_pconnect', 'oci_register_taf_callback', 'oci_result', 'oci_rollback', 'oci_server_version', 'oci_set_action', 'oci_set_client_identifier', 'oci_set_client_info', 'oci_set_module_name', 'oci_set_prefetch', 'oci_statement_type', 'oci_unregister_taf_callback', 'odbc_autocommit', 'odbc_close', 'odbc_columnprivileges', 'odbc_columns', 'odbc_commit', 'odbc_connect', 'odbc_cursor', 'odbc_data_source', 'odbc_do', 'odbc_error', 'odbc_errormsg', 'odbc_exec', 'odbc_execute', 'odbc_fetch_array', 'odbc_fetch_into', 'odbc_fetch_row', 'odbc_field_len', 'odbc_field_name', 'odbc_field_num', 'odbc_field_precision', 'odbc_field_scale', 'odbc_field_type', 'odbc_foreignkeys', 'odbc_free_result', 'odbc_gettypeinfo', 'odbc_next_result', 'odbc_num_fields', 'odbc_num_rows', 'odbc_pconnect', 'odbc_prepare', 'odbc_primarykeys', 'odbc_procedurecolumns', 'odbc_procedures', 'odbc_result', 'odbc_result_all', 'odbc_rollback', 'odbc_setoption', 'odbc_specialcolumns', 'odbc_statistics', 'odbc_tableprivileges', 'odbc_tables', 'openal_buffer_create', 'openal_buffer_data', 'openal_buffer_destroy', 'openal_buffer_get', 'openal_buffer_loadwav', 'openal_context_create', 'openal_context_current', 'openal_context_destroy', 'openal_context_process', 'openal_context_suspend', 'openal_device_close', 'openal_device_open', 'openal_source_create', 'openal_source_destroy', 'openal_source_get', 'openal_source_pause', 'openal_source_play', 'openal_source_rewind', 'openal_source_set', 'openal_source_stop', 'openal_stream', 'opendir', 'openssl_csr_new', 'openssl_dh_compute_key', 'openssl_free_key', 'openssl_pkey_export', 'openssl_pkey_free', 'openssl_pkey_get_details', 'openssl_spki_new', 'openssl_x509_free', 'pclose', 'pfsockopen', 'pg_affected_rows', 'pg_cancel_query', 'pg_client_encoding', 'pg_close', 'pg_connect_poll', 'pg_connection_busy', 'pg_connection_reset', 'pg_connection_status', 'pg_consume_input', 'pg_convert', 'pg_copy_from', 'pg_copy_to', 'pg_dbname', 'pg_delete', 'pg_end_copy', 'pg_escape_bytea', 'pg_escape_identifier', 'pg_escape_literal', 'pg_escape_string', 'pg_execute', 'pg_fetch_all', 'pg_fetch_all_columns', 'pg_fetch_array', 'pg_fetch_assoc', 'pg_fetch_row', 'pg_field_name', 'pg_field_num', 'pg_field_size', 'pg_field_table', 'pg_field_type', 'pg_field_type_oid', 'pg_flush', 'pg_free_result', 'pg_get_notify', 'pg_get_pid', 'pg_get_result', 'pg_host', 'pg_insert', 'pg_last_error', 'pg_last_notice', 'pg_last_oid', 'pg_lo_close', 'pg_lo_create', 'pg_lo_export', 'pg_lo_import', 'pg_lo_open', 'pg_lo_read', 'pg_lo_read_all', 'pg_lo_seek', 'pg_lo_tell', 'pg_lo_truncate', 'pg_lo_unlink', 'pg_lo_write', 'pg_meta_data', 'pg_num_fields', 'pg_num_rows', 'pg_options', 'pg_parameter_status', 'pg_ping', 'pg_port', 'pg_prepare', 'pg_put_line', 'pg_query', 'pg_query_params', 'pg_result_error', 'pg_result_error_field', 'pg_result_seek', 'pg_result_status', 'pg_select', 'pg_send_execute', 'pg_send_prepare', 'pg_send_query', 'pg_send_query_params', 'pg_set_client_encoding', 'pg_set_error_verbosity', 'pg_socket', 'pg_trace', 'pg_transaction_status', 'pg_tty', 'pg_untrace', 'pg_update', 'pg_version', 'php_user_filter::filter', 'proc_close', 'proc_get_status', 'proc_terminate', 'ps_add_bookmark', 'ps_add_launchlink', 'ps_add_locallink', 'ps_add_note', 'ps_add_pdflink', 'ps_add_weblink', 'ps_arc', 'ps_arcn', 'ps_begin_page', 'ps_begin_pattern', 'ps_begin_template', 'ps_circle', 'ps_clip', 'ps_close', 'ps_close_image', 'ps_closepath', 'ps_closepath_stroke', 'ps_continue_text', 'ps_curveto', 'ps_delete', 'ps_end_page', 'ps_end_pattern', 'ps_end_template', 'ps_fill', 'ps_fill_stroke', 'ps_findfont', 'ps_get_buffer', 'ps_get_parameter', 'ps_get_value', 'ps_hyphenate', 'ps_include_file', 'ps_lineto', 'ps_makespotcolor', 'ps_moveto', 'ps_new', 'ps_open_file', 'ps_open_image', 'ps_open_image_file', 'ps_open_memory_image', 'ps_place_image', 'ps_rect', 'ps_restore', 'ps_rotate', 'ps_save', 'ps_scale', 'ps_set_border_color', 'ps_set_border_dash', 'ps_set_border_style', 'ps_set_info', 'ps_set_parameter', 'ps_set_text_pos', 'ps_set_value', 'ps_setcolor', 'ps_setdash', 'ps_setflat', 'ps_setfont', 'ps_setgray', 'ps_setlinecap', 'ps_setlinejoin', 'ps_setlinewidth', 'ps_setmiterlimit', 'ps_setoverprintmode', 'ps_setpolydash', 'ps_shading', 'ps_shading_pattern', 'ps_shfill', 'ps_show', 'ps_show2', 'ps_show_boxed', 'ps_show_xy', 'ps_show_xy2', 'ps_string_geometry', 'ps_stringwidth', 'ps_stroke', 'ps_symbol', 'ps_symbol_name', 'ps_symbol_width', 'ps_translate', 'px_close', 'px_create_fp', 'px_date2string', 'px_delete', 'px_delete_record', 'px_get_field', 'px_get_info', 'px_get_parameter', 'px_get_record', 'px_get_schema', 'px_get_value', 'px_insert_record', 'px_new', 'px_numfields', 'px_numrecords', 'px_open_fp', 'px_put_record', 'px_retrieve_record', 'px_set_blob_file', 'px_set_parameter', 'px_set_tablename', 'px_set_targetencoding', 'px_set_value', 'px_timestamp2string', 'px_update_record', 'radius_acct_open', 'radius_add_server', 'radius_auth_open', 'radius_close', 'radius_config', 'radius_create_request', 'radius_demangle', 'radius_demangle_mppe_key', 'radius_get_attr', 'radius_put_addr', 'radius_put_attr', 'radius_put_int', 'radius_put_string', 'radius_put_vendor_addr', 'radius_put_vendor_attr', 'radius_put_vendor_int', 'radius_put_vendor_string', 'radius_request_authenticator', 'radius_salt_encrypt_attr', 'radius_send_request', 'radius_server_secret', 'radius_strerror', 'readdir', 'readfile', 'recode_file', 'rename', 'rewind', 'rewinddir', 'rmdir', 'rpm_close', 'rpm_get_tag', 'rpm_open', 'sapi_windows_vt100_support', 'scandir', 'sem_acquire', 'sem_get', 'sem_release', 'sem_remove', 'set_file_buffer', 'shm_attach', 'shm_detach', 'shm_get_var', 'shm_has_var', 'shm_put_var', 'shm_remove', 'shm_remove_var', 'shmop_close', 'shmop_delete', 'shmop_open', 'shmop_read', 'shmop_size', 'shmop_write', 'socket_accept', 'socket_addrinfo_bind', 'socket_addrinfo_connect', 'socket_addrinfo_explain', 'socket_bind', 'socket_clear_error', 'socket_close', 'socket_connect', 'socket_export_stream', 'socket_get_option', 'socket_get_status', 'socket_getopt', 'socket_getpeername', 'socket_getsockname', 'socket_import_stream', 'socket_last_error', 'socket_listen', 'socket_read', 'socket_recv', 'socket_recvfrom', 'socket_recvmsg', 'socket_send', 'socket_sendmsg', 'socket_sendto', 'socket_set_block', 'socket_set_blocking', 'socket_set_nonblock', 'socket_set_option', 'socket_set_timeout', 'socket_shutdown', 'socket_write', 'sqlite_close', 'sqlite_fetch_string', 'sqlite_has_more', 'sqlite_open', 'sqlite_popen', 'sqlsrv_begin_transaction', 'sqlsrv_cancel', 'sqlsrv_client_info', 'sqlsrv_close', 'sqlsrv_commit', 'sqlsrv_connect', 'sqlsrv_execute', 'sqlsrv_fetch', 'sqlsrv_fetch_array', 'sqlsrv_fetch_object', 'sqlsrv_field_metadata', 'sqlsrv_free_stmt', 'sqlsrv_get_field', 'sqlsrv_has_rows', 'sqlsrv_next_result', 'sqlsrv_num_fields', 'sqlsrv_num_rows', 'sqlsrv_prepare', 'sqlsrv_query', 'sqlsrv_rollback', 'sqlsrv_rows_affected', 'sqlsrv_send_stream_data', 'sqlsrv_server_info', 'ssh2_auth_agent', 'ssh2_auth_hostbased_file', 'ssh2_auth_none', 'ssh2_auth_password', 'ssh2_auth_pubkey_file', 'ssh2_disconnect', 'ssh2_exec', 'ssh2_fetch_stream', 'ssh2_fingerprint', 'ssh2_methods_negotiated', 'ssh2_publickey_add', 'ssh2_publickey_init', 'ssh2_publickey_list', 'ssh2_publickey_remove', 'ssh2_scp_recv', 'ssh2_scp_send', 'ssh2_sftp', 'ssh2_sftp_chmod', 'ssh2_sftp_lstat', 'ssh2_sftp_mkdir', 'ssh2_sftp_readlink', 'ssh2_sftp_realpath', 'ssh2_sftp_rename', 'ssh2_sftp_rmdir', 'ssh2_sftp_stat', 'ssh2_sftp_symlink', 'ssh2_sftp_unlink', 'ssh2_shell', 'ssh2_tunnel', 'stomp_connect', 'streamWrapper::stream_cast', 'stream_bucket_append', 'stream_bucket_make_writeable', 'stream_bucket_new', 'stream_bucket_prepend', 'stream_context_create', 'stream_context_get_default', 'stream_context_get_options', 'stream_context_get_params', 'stream_context_set_default', 'stream_context_set_params', 'stream_copy_to_stream', 'stream_encoding', 'stream_filter_append', 'stream_filter_prepend', 'stream_filter_remove', 'stream_get_contents', 'stream_get_line', 'stream_get_meta_data', 'stream_isatty', 'stream_set_blocking', 'stream_set_chunk_size', 'stream_set_read_buffer', 'stream_set_timeout', 'stream_set_write_buffer', 'stream_socket_accept', 'stream_socket_client', 'stream_socket_enable_crypto', 'stream_socket_get_name', 'stream_socket_recvfrom', 'stream_socket_sendto', 'stream_socket_server', 'stream_socket_shutdown', 'stream_supports_lock', 'svn_fs_abort_txn', 'svn_fs_apply_text', 'svn_fs_begin_txn2', 'svn_fs_change_node_prop', 'svn_fs_check_path', 'svn_fs_contents_changed', 'svn_fs_copy', 'svn_fs_delete', 'svn_fs_dir_entries', 'svn_fs_file_contents', 'svn_fs_file_length', 'svn_fs_is_dir', 'svn_fs_is_file', 'svn_fs_make_dir', 'svn_fs_make_file', 'svn_fs_node_created_rev', 'svn_fs_node_prop', 'svn_fs_props_changed', 'svn_fs_revision_prop', 'svn_fs_revision_root', 'svn_fs_txn_root', 'svn_fs_youngest_rev', 'svn_repos_create', 'svn_repos_fs', 'svn_repos_fs_begin_txn_for_commit', 'svn_repos_fs_commit_txn', 'svn_repos_open', 'sybase_affected_rows', 'sybase_close', 'sybase_connect', 'sybase_data_seek', 'sybase_fetch_array', 'sybase_fetch_assoc', 'sybase_fetch_field', 'sybase_fetch_object', 'sybase_fetch_row', 'sybase_field_seek', 'sybase_free_result', 'sybase_num_fields', 'sybase_num_rows', 'sybase_pconnect', 'sybase_query', 'sybase_result', 'sybase_select_db', 'sybase_set_message_handler', 'sybase_unbuffered_query', 'tmpfile', 'udm_add_search_limit', 'udm_alloc_agent', 'udm_alloc_agent_array', 'udm_cat_list', 'udm_cat_path', 'udm_check_charset', 'udm_clear_search_limits', 'udm_crc32', 'udm_errno', 'udm_error', 'udm_find', 'udm_free_agent', 'udm_free_res', 'udm_get_doc_count', 'udm_get_res_field', 'udm_get_res_param', 'udm_hash32', 'udm_load_ispell_data', 'udm_set_agent_param', 'unlink', 'vfprintf', 'w32api_init_dtype', 'wddx_add_vars', 'wddx_packet_end', 'wddx_packet_start', 'xml_get_current_byte_index', 'xml_get_current_column_number', 'xml_get_current_line_number', 'xml_get_error_code', 'xml_parse', 'xml_parse_into_struct', 'xml_parser_create', 'xml_parser_create_ns', 'xml_parser_free', 'xml_parser_get_option', 'xml_parser_set_option', 'xml_set_character_data_handler', 'xml_set_default_handler', 'xml_set_element_handler', 'xml_set_end_namespace_decl_handler', 'xml_set_external_entity_ref_handler', 'xml_set_notation_decl_handler', 'xml_set_object', 'xml_set_processing_instruction_handler', 'xml_set_start_namespace_decl_handler', 'xml_set_unparsed_entity_decl_handler', 'xmlrpc_server_add_introspection_data', 'xmlrpc_server_call_method', 'xmlrpc_server_create', 'xmlrpc_server_destroy', 'xmlrpc_server_register_introspection_callback', 'xmlrpc_server_register_method', 'xmlwriter_end_attribute', 'xmlwriter_end_cdata', 'xmlwriter_end_comment', 'xmlwriter_end_document', 'xmlwriter_end_dtd', 'xmlwriter_end_dtd_attlist', 'xmlwriter_end_dtd_element', 'xmlwriter_end_dtd_entity', 'xmlwriter_end_element', 'xmlwriter_end_pi', 'xmlwriter_flush', 'xmlwriter_full_end_element', 'xmlwriter_open_memory', 'xmlwriter_open_uri', 'xmlwriter_output_memory', 'xmlwriter_set_indent', 'xmlwriter_set_indent_string', 'xmlwriter_start_attribute', 'xmlwriter_start_attribute_ns', 'xmlwriter_start_cdata', 'xmlwriter_start_comment', 'xmlwriter_start_document', 'xmlwriter_start_dtd', 'xmlwriter_start_dtd_attlist', 'xmlwriter_start_dtd_element', 'xmlwriter_start_dtd_entity', 'xmlwriter_start_element', 'xmlwriter_start_element_ns', 'xmlwriter_start_pi', 'xmlwriter_text', 'xmlwriter_write_attribute', 'xmlwriter_write_attribute_ns', 'xmlwriter_write_cdata', 'xmlwriter_write_comment', 'xmlwriter_write_dtd', 'xmlwriter_write_dtd_attlist', 'xmlwriter_write_dtd_element', 'xmlwriter_write_dtd_entity', 'xmlwriter_write_element', 'xmlwriter_write_element_ns', 'xmlwriter_write_pi', 'xmlwriter_write_raw', 'xslt_create', 'yaz_addinfo', 'yaz_ccl_conf', 'yaz_ccl_parse', 'yaz_close', 'yaz_database', 'yaz_element', 'yaz_errno', 'yaz_error', 'yaz_es', 'yaz_es_result', 'yaz_get_option', 'yaz_hits', 'yaz_itemorder', 'yaz_present', 'yaz_range', 'yaz_record', 'yaz_scan', 'yaz_scan_result', 'yaz_schema', 'yaz_search', 'yaz_sort', 'yaz_syntax', 'zip_close', 'zip_entry_close', 'zip_entry_compressedsize', 'zip_entry_compressionmethod', 'zip_entry_filesize', 'zip_entry_name', 'zip_entry_open', 'zip_entry_read', 'zip_open', 'zip_read']; } } sebastian/type @@ -93090,7 +103896,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class Parameter { @@ -93110,11 +103916,11 @@ final class Parameter $this->name = $name; $this->type = $type; } - public function name() : string + public function name(): string { return $this->name; } - public function type() : Type + public function type(): Type { return $this->type; } @@ -93130,7 +103936,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use function assert; use ReflectionFunctionAbstract; @@ -93144,7 +103950,7 @@ final class ReflectionMapper /** * @psalm-return list */ - public function fromParameterTypes(ReflectionFunctionAbstract $functionOrMethod) : array + public function fromParameterTypes(ReflectionFunctionAbstract $functionOrMethod): array { $parameters = []; foreach ($functionOrMethod->getParameters() as $parameter) { @@ -93169,7 +103975,7 @@ final class ReflectionMapper } return $parameters; } - public function fromReturnType(ReflectionFunctionAbstract $functionOrMethod) : Type + public function fromReturnType(ReflectionFunctionAbstract $functionOrMethod): Type { if (!$this->hasReturnType($functionOrMethod)) { return new UnknownType(); @@ -93186,7 +103992,7 @@ final class ReflectionMapper return $this->mapIntersectionType($returnType, $functionOrMethod); } } - private function mapNamedType(ReflectionNamedType $type, ReflectionFunctionAbstract $functionOrMethod) : Type + private function mapNamedType(ReflectionNamedType $type, ReflectionFunctionAbstract $functionOrMethod): Type { if ($functionOrMethod instanceof ReflectionMethod && $type->getName() === 'self') { return ObjectType::fromName($functionOrMethod->getDeclaringClass()->getName(), $type->allowsNull()); @@ -93202,7 +104008,7 @@ final class ReflectionMapper } return Type::fromName($type->getName(), $type->allowsNull()); } - private function mapUnionType(ReflectionUnionType $type, ReflectionFunctionAbstract $functionOrMethod) : Type + private function mapUnionType(ReflectionUnionType $type, ReflectionFunctionAbstract $functionOrMethod): Type { $types = []; foreach ($type->getTypes() as $_type) { @@ -93215,7 +104021,7 @@ final class ReflectionMapper } return new UnionType(...$types); } - private function mapIntersectionType(ReflectionIntersectionType $type, ReflectionFunctionAbstract $functionOrMethod) : Type + private function mapIntersectionType(ReflectionIntersectionType $type, ReflectionFunctionAbstract $functionOrMethod): Type { $types = []; foreach ($type->getTypes() as $_type) { @@ -93224,22 +104030,22 @@ final class ReflectionMapper } return new IntersectionType(...$types); } - private function hasReturnType(ReflectionFunctionAbstract $functionOrMethod) : bool + private function hasReturnType(ReflectionFunctionAbstract $functionOrMethod): bool { if ($functionOrMethod->hasReturnType()) { return \true; } - if (!\method_exists($functionOrMethod, 'hasTentativeReturnType')) { + if (!method_exists($functionOrMethod, 'hasTentativeReturnType')) { return \false; } return $functionOrMethod->hasTentativeReturnType(); } - private function returnType(ReflectionFunctionAbstract $functionOrMethod) : ?ReflectionType + private function returnType(ReflectionFunctionAbstract $functionOrMethod): ?ReflectionType { if ($functionOrMethod->hasReturnType()) { return $functionOrMethod->getReturnType(); } - if (!\method_exists($functionOrMethod, 'getTentativeReturnType')) { + if (!method_exists($functionOrMethod, 'getTentativeReturnType')) { return null; } return $functionOrMethod->getTentativeReturnType(); @@ -93256,7 +104062,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use function array_pop; use function explode; @@ -93273,7 +104079,7 @@ final class TypeName * @var string */ private $simpleName; - public static function fromQualifiedName(string $fullClassName) : self + public static function fromQualifiedName(string $fullClassName): self { if ($fullClassName[0] === '\\') { $fullClassName = substr($fullClassName, 1); @@ -93283,7 +104089,7 @@ final class TypeName $namespaceName = implode('\\', $classNameParts); return new self($namespaceName, $simpleName); } - public static function fromReflection(ReflectionClass $type) : self + public static function fromReflection(ReflectionClass $type): self { return new self($type->getNamespaceName(), $type->getShortName()); } @@ -93295,19 +104101,19 @@ final class TypeName $this->namespaceName = $namespaceName; $this->simpleName = $simpleName; } - public function namespaceName() : ?string + public function namespaceName(): ?string { return $this->namespaceName; } - public function simpleName() : string + public function simpleName(): string { return $this->simpleName; } - public function qualifiedName() : string + public function qualifiedName(): string { - return $this->namespaceName === null ? $this->simpleName : $this->namespaceName . '\\' . $this->simpleName; + return ($this->namespaceName === null) ? $this->simpleName : ($this->namespaceName . '\\' . $this->simpleName); } - public function isNamespaced() : bool + public function isNamespaced(): bool { return $this->namespaceName !== null; } @@ -93323,7 +104129,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use Throwable; interface Exception extends Throwable @@ -93340,7 +104146,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class RuntimeException extends \RuntimeException implements Exception { @@ -93356,7 +104162,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use function assert; use function class_exists; @@ -93383,7 +104189,7 @@ final class CallableType extends Type /** * @throws RuntimeException */ - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { if ($this->allowsNull && $other instanceof NullType) { return \true; @@ -93412,29 +104218,29 @@ final class CallableType extends Type } return \false; } - public function name() : string + public function name(): string { return 'callable'; } - public function allowsNull() : bool + public function allowsNull(): bool { return $this->allowsNull; } /** * @psalm-assert-if-true CallableType $this */ - public function isCallable() : bool + public function isCallable(): bool { return \true; } - private function isClosure(ObjectType $type) : bool + private function isClosure(ObjectType $type): bool { return !$type->className()->isNamespaced() && $type->className()->simpleName() === Closure::class; } /** * @throws RuntimeException */ - private function hasInvokeMethod(ObjectType $type) : bool + private function hasInvokeMethod(ObjectType $type): bool { $className = $type->className()->qualifiedName(); assert(class_exists($className)); @@ -93450,14 +104256,14 @@ final class CallableType extends Type } return \false; } - private function isFunction(SimpleType $type) : bool + private function isFunction(SimpleType $type): bool { if (!is_string($type->value())) { return \false; } return function_exists($type->value()); } - private function isObjectCallback(SimpleType $type) : bool + private function isObjectCallback(SimpleType $type): bool { if (!is_array($type->value())) { return \false; @@ -93474,13 +104280,13 @@ final class CallableType extends Type [$object, $methodName] = $type->value(); return (new ReflectionObject($object))->hasMethod($methodName); } - private function isClassCallback(SimpleType $type) : bool + private function isClassCallback(SimpleType $type): bool { if (!is_string($type->value()) && !is_array($type->value())) { return \false; } if (is_string($type->value())) { - if (\strpos($type->value(), '::') === \false) { + if (strpos($type->value(), '::') === \false) { return \false; } [$className, $methodName] = explode('::', $type->value()); @@ -93524,29 +104330,29 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class FalseType extends Type { - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { if ($other instanceof self) { return \true; } return $other instanceof SimpleType && $other->name() === 'bool' && $other->value() === \false; } - public function name() : string + public function name(): string { return 'false'; } - public function allowsNull() : bool + public function allowsNull(): bool { return \false; } /** * @psalm-assert-if-true FalseType $this */ - public function isFalse() : bool + public function isFalse(): bool { return \true; } @@ -93562,7 +104368,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class GenericObjectType extends Type { @@ -93574,7 +104380,7 @@ final class GenericObjectType extends Type { $this->allowsNull = $nullable; } - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { if ($this->allowsNull && $other instanceof NullType) { return \true; @@ -93584,18 +104390,18 @@ final class GenericObjectType extends Type } return \true; } - public function name() : string + public function name(): string { return 'object'; } - public function allowsNull() : bool + public function allowsNull(): bool { return $this->allowsNull; } /** * @psalm-assert-if-true GenericObjectType $this */ - public function isGenericObject() : bool + public function isGenericObject(): bool { return \true; } @@ -93611,7 +104417,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use function assert; use function count; @@ -93634,15 +104440,15 @@ final class IntersectionType extends Type $this->ensureNoDuplicateTypes(...$types); $this->types = $types; } - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { return $other->isObject(); } - public function asString() : string + public function asString(): string { return $this->name(); } - public function name() : string + public function name(): string { $types = []; foreach ($this->types as $type) { @@ -93651,28 +104457,28 @@ final class IntersectionType extends Type sort($types); return implode('&', $types); } - public function allowsNull() : bool + public function allowsNull(): bool { return \false; } /** * @psalm-assert-if-true IntersectionType $this */ - public function isIntersection() : bool + public function isIntersection(): bool { return \true; } /** * @psalm-return non-empty-list */ - public function types() : array + public function types(): array { return $this->types; } /** * @throws RuntimeException */ - private function ensureMinimumOfTwoTypes(Type ...$types) : void + private function ensureMinimumOfTwoTypes(Type ...$types): void { if (count($types) < 2) { throw new RuntimeException('An intersection type must be composed of at least two types'); @@ -93681,7 +104487,7 @@ final class IntersectionType extends Type /** * @throws RuntimeException */ - private function ensureOnlyValidTypes(Type ...$types) : void + private function ensureOnlyValidTypes(Type ...$types): void { foreach ($types as $type) { if (!$type->isObject()) { @@ -93692,7 +104498,7 @@ final class IntersectionType extends Type /** * @throws RuntimeException */ - private function ensureNoDuplicateTypes(Type ...$types) : void + private function ensureNoDuplicateTypes(Type ...$types): void { $names = []; foreach ($types as $type) { @@ -93716,7 +104522,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use function assert; use function class_exists; @@ -93736,7 +104542,7 @@ final class IterableType extends Type /** * @throws RuntimeException */ - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { if ($this->allowsNull && $other instanceof NullType) { return \true; @@ -93760,18 +104566,18 @@ final class IterableType extends Type } return \false; } - public function name() : string + public function name(): string { return 'iterable'; } - public function allowsNull() : bool + public function allowsNull(): bool { return $this->allowsNull; } /** * @psalm-assert-if-true IterableType $this */ - public function isIterable() : bool + public function isIterable(): bool { return \true; } @@ -93787,30 +104593,30 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class MixedType extends Type { - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { return !$other instanceof VoidType; } - public function asString() : string + public function asString(): string { return 'mixed'; } - public function name() : string + public function name(): string { return 'mixed'; } - public function allowsNull() : bool + public function allowsNull(): bool { return \true; } /** * @psalm-assert-if-true MixedType $this */ - public function isMixed() : bool + public function isMixed(): bool { return \true; } @@ -93826,26 +104632,26 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class NeverType extends Type { - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { return $other instanceof self; } - public function name() : string + public function name(): string { return 'never'; } - public function allowsNull() : bool + public function allowsNull(): bool { return \false; } /** * @psalm-assert-if-true NeverType $this */ - public function isNever() : bool + public function isNever(): bool { return \true; } @@ -93861,30 +104667,30 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class NullType extends Type { - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { return !$other instanceof VoidType; } - public function name() : string + public function name(): string { return 'null'; } - public function asString() : string + public function asString(): string { return 'null'; } - public function allowsNull() : bool + public function allowsNull(): bool { return \true; } /** * @psalm-assert-if-true NullType $this */ - public function isNull() : bool + public function isNull(): bool { return \true; } @@ -93900,7 +104706,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use function is_subclass_of; use function strcasecmp; @@ -93919,7 +104725,7 @@ final class ObjectType extends Type $this->className = $className; $this->allowsNull = $allowsNull; } - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { if ($this->allowsNull && $other instanceof NullType) { return \true; @@ -93934,22 +104740,22 @@ final class ObjectType extends Type } return \false; } - public function name() : string + public function name(): string { return $this->className->qualifiedName(); } - public function allowsNull() : bool + public function allowsNull(): bool { return $this->allowsNull; } - public function className() : TypeName + public function className(): TypeName { return $this->className; } /** * @psalm-assert-if-true ObjectType $this */ - public function isObject() : bool + public function isObject(): bool { return \true; } @@ -93965,7 +104771,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use function strtolower; final class SimpleType extends Type @@ -93988,7 +104794,7 @@ final class SimpleType extends Type $this->allowsNull = $nullable; $this->value = $value; } - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { if ($this->allowsNull && $other instanceof NullType) { return \true; @@ -94004,11 +104810,11 @@ final class SimpleType extends Type } return \false; } - public function name() : string + public function name(): string { return $this->name; } - public function allowsNull() : bool + public function allowsNull(): bool { return $this->allowsNull; } @@ -94019,11 +104825,11 @@ final class SimpleType extends Type /** * @psalm-assert-if-true SimpleType $this */ - public function isSimple() : bool + public function isSimple(): bool { return \true; } - private function normalize(string $name) : string + private function normalize(string $name): string { $name = strtolower($name); switch ($name) { @@ -94052,7 +104858,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class StaticType extends Type { @@ -94069,7 +104875,7 @@ final class StaticType extends Type $this->className = $className; $this->allowsNull = $allowsNull; } - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { if ($this->allowsNull && $other instanceof NullType) { return \true; @@ -94077,26 +104883,26 @@ final class StaticType extends Type if (!$other instanceof ObjectType) { return \false; } - if (0 === \strcasecmp($this->className->qualifiedName(), $other->className()->qualifiedName())) { + if (0 === strcasecmp($this->className->qualifiedName(), $other->className()->qualifiedName())) { return \true; } - if (\is_subclass_of($other->className()->qualifiedName(), $this->className->qualifiedName(), \true)) { + if (is_subclass_of($other->className()->qualifiedName(), $this->className->qualifiedName(), \true)) { return \true; } return \false; } - public function name() : string + public function name(): string { return 'static'; } - public function allowsNull() : bool + public function allowsNull(): bool { return $this->allowsNull; } /** * @psalm-assert-if-true StaticType $this */ - public function isStatic() : bool + public function isStatic(): bool { return \true; } @@ -94112,29 +104918,29 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class TrueType extends Type { - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { if ($other instanceof self) { return \true; } return $other instanceof SimpleType && $other->name() === 'bool' && $other->value() === \true; } - public function name() : string + public function name(): string { return 'true'; } - public function allowsNull() : bool + public function allowsNull(): bool { return \false; } /** * @psalm-assert-if-true TrueType $this */ - public function isTrue() : bool + public function isTrue(): bool { return \true; } @@ -94150,7 +104956,7 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; use const PHP_VERSION; use function get_class; @@ -94159,7 +104965,7 @@ use function strtolower; use function version_compare; abstract class Type { - public static function fromValue($value, bool $allowsNull) : self + public static function fromValue($value, bool $allowsNull): self { if ($allowsNull === \false) { if ($value === \true) { @@ -94179,7 +104985,7 @@ abstract class Type } return $type; } - public static function fromName(string $typeName, bool $allowsNull) : self + public static function fromName(string $typeName, bool $allowsNull): self { if (version_compare(PHP_VERSION, '8.1.0-dev', '>=') && strtolower($typeName) === 'never') { return new NeverType(); @@ -94217,118 +105023,118 @@ abstract class Type return new ObjectType(TypeName::fromQualifiedName($typeName), $allowsNull); } } - public function asString() : string + public function asString(): string { return ($this->allowsNull() ? '?' : '') . $this->name(); } /** * @psalm-assert-if-true CallableType $this */ - public function isCallable() : bool + public function isCallable(): bool { return \false; } /** * @psalm-assert-if-true TrueType $this */ - public function isTrue() : bool + public function isTrue(): bool { return \false; } /** * @psalm-assert-if-true FalseType $this */ - public function isFalse() : bool + public function isFalse(): bool { return \false; } /** * @psalm-assert-if-true GenericObjectType $this */ - public function isGenericObject() : bool + public function isGenericObject(): bool { return \false; } /** * @psalm-assert-if-true IntersectionType $this */ - public function isIntersection() : bool + public function isIntersection(): bool { return \false; } /** * @psalm-assert-if-true IterableType $this */ - public function isIterable() : bool + public function isIterable(): bool { return \false; } /** * @psalm-assert-if-true MixedType $this */ - public function isMixed() : bool + public function isMixed(): bool { return \false; } /** * @psalm-assert-if-true NeverType $this */ - public function isNever() : bool + public function isNever(): bool { return \false; } /** * @psalm-assert-if-true NullType $this */ - public function isNull() : bool + public function isNull(): bool { return \false; } /** * @psalm-assert-if-true ObjectType $this */ - public function isObject() : bool + public function isObject(): bool { return \false; } /** * @psalm-assert-if-true SimpleType $this */ - public function isSimple() : bool + public function isSimple(): bool { return \false; } /** * @psalm-assert-if-true StaticType $this */ - public function isStatic() : bool + public function isStatic(): bool { return \false; } /** * @psalm-assert-if-true UnionType $this */ - public function isUnion() : bool + public function isUnion(): bool { return \false; } /** * @psalm-assert-if-true UnknownType $this */ - public function isUnknown() : bool + public function isUnknown(): bool { return \false; } /** * @psalm-assert-if-true VoidType $this */ - public function isVoid() : bool + public function isVoid(): bool { return \false; } - public abstract function isAssignable(self $other) : bool; - public abstract function name() : string; - public abstract function allowsNull() : bool; + abstract public function isAssignable(self $other): bool; + abstract public function name(): string; + abstract public function allowsNull(): bool; } ensureOnlyValidTypes(...$types); $this->types = $types; } - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { foreach ($this->types as $type) { if ($type->isAssignable($other)) { @@ -94370,11 +105176,11 @@ final class UnionType extends Type } return \false; } - public function asString() : string + public function asString(): string { return $this->name(); } - public function name() : string + public function name(): string { $types = []; foreach ($this->types as $type) { @@ -94387,7 +105193,7 @@ final class UnionType extends Type sort($types); return implode('|', $types); } - public function allowsNull() : bool + public function allowsNull(): bool { foreach ($this->types as $type) { if ($type instanceof NullType) { @@ -94399,11 +105205,11 @@ final class UnionType extends Type /** * @psalm-assert-if-true UnionType $this */ - public function isUnion() : bool + public function isUnion(): bool { return \true; } - public function containsIntersectionTypes() : bool + public function containsIntersectionTypes(): bool { foreach ($this->types as $type) { if ($type->isIntersection()) { @@ -94415,14 +105221,14 @@ final class UnionType extends Type /** * @psalm-return non-empty-list */ - public function types() : array + public function types(): array { return $this->types; } /** * @throws RuntimeException */ - private function ensureMinimumOfTwoTypes(Type ...$types) : void + private function ensureMinimumOfTwoTypes(Type ...$types): void { if (count($types) < 2) { throw new RuntimeException('A union type must be composed of at least two types'); @@ -94431,7 +105237,7 @@ final class UnionType extends Type /** * @throws RuntimeException */ - private function ensureOnlyValidTypes(Type ...$types) : void + private function ensureOnlyValidTypes(Type ...$types): void { foreach ($types as $type) { if ($type instanceof UnknownType) { @@ -94454,30 +105260,30 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class UnknownType extends Type { - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { return \true; } - public function name() : string + public function name(): string { return 'unknown type'; } - public function asString() : string + public function asString(): string { return ''; } - public function allowsNull() : bool + public function allowsNull(): bool { return \true; } /** * @psalm-assert-if-true UnknownType $this */ - public function isUnknown() : bool + public function isUnknown(): bool { return \true; } @@ -94493,26 +105299,26 @@ declare (strict_types=1); * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann\Type; +namespace PHPUnitPHAR\SebastianBergmann\Type; final class VoidType extends Type { - public function isAssignable(Type $other) : bool + public function isAssignable(Type $other): bool { return $other instanceof self; } - public function name() : string + public function name(): string { return 'void'; } - public function allowsNull() : bool + public function allowsNull(): bool { return \false; } /** * @psalm-assert-if-true VoidType $this */ - public function isVoid() : bool + public function isVoid(): bool { return \true; } @@ -94560,7 +105366,7 @@ POSSIBILITY OF SUCH DAMAGE. * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\SebastianBergmann; +namespace PHPUnitPHAR\SebastianBergmann; final class Version { @@ -94581,7 +105387,7 @@ final class Version $this->release = $release; $this->path = $path; } - public function getVersion() : string + public function getVersion(): string { if ($this->version === null) { if (\substr_count($this->release, '.') + 1 === 3) { @@ -94626,7 +105432,7 @@ final class Version ensureValidUri($value); $this->value = $value; } - public function asString() : string + public function asString(): string { return $this->value; } - private function ensureValidUri($value) : void + private function ensureValidUri($value): void { if (\strpos($value, ':') === \false) { throw new NamespaceUriException(\sprintf("Namespace URI '%s' must contain at least one colon", $value)); @@ -94689,7 +105495,7 @@ class NamespaceUri name = $name; $this->value = $value; } - public function getLine() : int + public function getLine(): int { return $this->line; } - public function getName() : string + public function getName(): string { return $this->name; } - public function getValue() : string + public function getValue(): string { return $this->value; } @@ -94732,7 +105538,7 @@ class Token tokens[] = $token; } - public function current() : Token + public function current(): Token { return \current($this->tokens); } - public function key() : int + public function key(): int { return \key($this->tokens); } - public function next() : void + public function next(): void { \next($this->tokens); $this->pos++; } - public function valid() : bool + public function valid(): bool { return $this->count() > $this->pos; } - public function rewind() : void + public function rewind(): void { \reset($this->tokens); $this->pos = 0; } - public function count() : int + public function count(): int { return \count($this->tokens); } - public function offsetExists($offset) : bool + public function offsetExists($offset): bool { return isset($this->tokens[$offset]); } /** * @throws TokenCollectionException */ - public function offsetGet($offset) : Token + public function offsetGet($offset): Token { if (!$this->offsetExists($offset)) { throw new TokenCollectionException(\sprintf('No Token at offest %s', $offset)); @@ -94789,19 +105595,19 @@ class TokenCollection implements \ArrayAccess, \Iterator, \Countable * * @throws TokenCollectionException */ - public function offsetSet($offset, $value) : void + public function offsetSet($offset, $value): void { if (!\is_int($offset)) { $type = \gettype($offset); - throw new TokenCollectionException(\sprintf('Offset must be of type integer, %s given', $type === 'object' ? \get_class($value) : $type)); + throw new TokenCollectionException(\sprintf('Offset must be of type integer, %s given', ($type === 'object') ? \get_class($value) : $type)); } if (!$value instanceof Token) { $type = \gettype($value); - throw new TokenCollectionException(\sprintf('Value must be of type %s, %s given', Token::class, $type === 'object' ? \get_class($value) : $type)); + throw new TokenCollectionException(\sprintf('Value must be of type %s, %s given', Token::class, ($type === 'object') ? \get_class($value) : $type)); } $this->tokens[$offset] = $value; } - public function offsetUnset($offset) : void + public function offsetUnset($offset): void { unset($this->tokens[$offset]); } @@ -94809,7 +105615,7 @@ class TokenCollection implements \ArrayAccess, \Iterator, \Countable 'T_OPEN_BRACKET', ')' => 'T_CLOSE_BRACKET', '[' => 'T_OPEN_SQUARE', ']' => 'T_CLOSE_SQUARE', '{' => 'T_OPEN_CURLY', '}' => 'T_CLOSE_CURLY', ';' => 'T_SEMICOLON', '.' => 'T_DOT', ',' => 'T_COMMA', '=' => 'T_EQUAL', '<' => 'T_LT', '>' => 'T_GT', '+' => 'T_PLUS', '-' => 'T_MINUS', '*' => 'T_MULT', '/' => 'T_DIV', '?' => 'T_QUESTION_MARK', '!' => 'T_EXCLAMATION_MARK', ':' => 'T_COLON', '"' => 'T_DOUBLE_QUOTES', '@' => 'T_AT', '&' => 'T_AMPERSAND', '%' => 'T_PERCENT', '|' => 'T_PIPE', '$' => 'T_DOLLAR', '^' => 'T_CARET', '~' => 'T_TILDE', '`' => 'T_BACKTICK']; - public function parse(string $source) : TokenCollection + public function parse(string $source): TokenCollection { $result = new TokenCollection(); if ($source === '') { @@ -94843,7 +105649,11 @@ class Tokenizer continue; } $line = $tok[2]; - $values = \preg_split('/\\R+/Uu', $tok[1]); + $values = \preg_split('/\R+/Uu', $tok[1]); + if (!$values) { + $result->addToken(new Token($line, \token_name($tok[0]), '{binary data}')); + continue; + } foreach ($values as $v) { $token = new Token($line, \token_name($tok[0]), $v); $lastToken = $token; @@ -94856,16 +105666,11 @@ class Tokenizer } return $this->fillBlanks($result, $lastToken->getLine()); } - private function fillBlanks(TokenCollection $tokens, int $maxLine) : TokenCollection + private function fillBlanks(TokenCollection $tokens, int $maxLine): TokenCollection { $prev = new Token(0, 'Placeholder', ''); $final = new TokenCollection(); foreach ($tokens as $token) { - if ($prev === null) { - $final->addToken($token); - $prev = $token; - continue; - } $gap = $token->getLine() - $prev->getLine(); while ($gap > 1) { $linebreak = new Token($prev->getLine() + 1, 'T_WHITESPACE', ''); @@ -94889,7 +105694,7 @@ class Tokenizer xmlns = $xmlns; } - public function toDom(TokenCollection $tokens) : DOMDocument + public function toDom(TokenCollection $tokens): DOMDocument { $dom = new DOMDocument(); $dom->preserveWhiteSpace = \false; $dom->loadXML($this->toXML($tokens)); return $dom; } - public function toXML(TokenCollection $tokens) : string + public function toXML(TokenCollection $tokens): string { $this->writer = new \XMLWriter(); $this->writer->openMemory(); @@ -94940,7 +105745,7 @@ class XMLSerializer $this->writer->endDocument(); return $this->writer->outputMemory(); } - private function addToken(Token $token) : void + private function addToken(Token $token): void { if ($this->previousToken->getLine() < $token->getLine()) { $this->writer->endElement(); @@ -94966,7 +105771,7 @@ class XMLSerializer * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\Webmozart\Assert; +namespace PHPUnitPHAR\Webmozart\Assert; use ArrayAccess; use BadMethodCallException; @@ -95336,7 +106141,7 @@ class Assert { static::string($class, 'Expected class as a string. Got: %s'); if (!\is_a($value, $class, \is_string($value))) { - static::reportInvalidArgument(\sprintf($message ?: 'Expected an instance of this class or to this class among its parents "%2$s". Got: %s', static::valueToString($value), $class)); + static::reportInvalidArgument(sprintf($message ?: 'Expected an instance of this class or to this class among its parents "%2$s". Got: %s', static::valueToString($value), $class)); } } /** @@ -95356,7 +106161,7 @@ class Assert { static::string($class, 'Expected class as a string. Got: %s'); if (\is_a($value, $class, \is_string($value))) { - static::reportInvalidArgument(\sprintf($message ?: 'Expected an instance of this class or to this class among its parents other than "%2$s". Got: %s', static::valueToString($value), $class)); + static::reportInvalidArgument(sprintf($message ?: 'Expected an instance of this class or to this class among its parents other than "%2$s". Got: %s', static::valueToString($value), $class)); } } /** @@ -95377,7 +106182,7 @@ class Assert return; } } - static::reportInvalidArgument(\sprintf($message ?: 'Expected an instance of any of this classes or any of those classes among their parents "%2$s". Got: %s', static::valueToString($value), \implode(', ', $classes))); + static::reportInvalidArgument(sprintf($message ?: 'Expected an instance of any of this classes or any of those classes among their parents "%2$s". Got: %s', static::valueToString($value), \implode(', ', $classes))); } /** * @psalm-pure @@ -95546,7 +106351,7 @@ class Assert $uniqueValues = \count(\array_unique($values)); if ($allValues !== $uniqueValues) { $difference = $allValues - $uniqueValues; - static::reportInvalidArgument(\sprintf($message ?: 'Expected an array of unique values, but %s of them %s duplicated', $difference, 1 === $difference ? 'is' : 'are')); + static::reportInvalidArgument(\sprintf($message ?: 'Expected an array of unique values, but %s of them %s duplicated', $difference, (1 === $difference) ? 'is' : 'are')); } } /** @@ -95755,7 +106560,7 @@ class Assert */ public static function notWhitespaceOnly($value, $message = '') { - if (\preg_match('/^\\s*$/', $value)) { + if (\preg_match('/^\s*$/', $value)) { static::reportInvalidArgument(\sprintf($message ?: 'Expected a non-whitespace string. Got: %s', static::valueToString($value))); } } @@ -95882,7 +106687,7 @@ class Assert public static function unicodeLetters($value, $message = '') { static::string($value); - if (!\preg_match('/^\\p{L}+$/u', $value)) { + if (!\preg_match('/^\p{L}+$/u', $value)) { static::reportInvalidArgument(\sprintf($message ?: 'Expected a value to contain only Unicode letters. Got: %s', static::valueToString($value))); } } @@ -96398,7 +107203,7 @@ class Assert */ public static function isMap($array, $message = '') { - if (!\is_array($array) || \array_keys($array) !== \array_filter(\array_keys($array), '\\is_string')) { + if (!\is_array($array) || \array_keys($array) !== \array_filter(\array_keys($array), '\is_string')) { static::reportInvalidArgument($message ?: 'Expected map - associative array with string keys.'); } } @@ -96538,10 +107343,10 @@ class Assert } protected static function strlen($value) { - if (!\function_exists('mb_detect_encoding')) { + if (!\function_exists('mb_detect_encoding') && !\function_exists('PHPUnitPHAR\mb_detect_encoding')) { return \strlen($value); } - if (\false === ($encoding = \mb_detect_encoding($value))) { + if (\false === $encoding = \mb_detect_encoding($value)) { return \strlen($value); } return \mb_strlen($value, $encoding); @@ -96572,7 +107377,7 @@ class Assert * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace PHPUnit\Webmozart\Assert; +namespace PHPUnitPHAR\Webmozart\Assert; class InvalidArgumentException extends \InvalidArgumentException { @@ -96599,7 +107404,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. "$0"]) ); } -RJ _q@jSY i܄ӟ6|4l=ﶉ)z0GBMB \ No newline at end of file +5i,&!8طS:;v>3ID=S xE SM9lm7#GBMB \ No newline at end of file diff --git a/tools/psalm.phar b/tools/psalm.phar index 2e4956a..bcdc582 100755 Binary files a/tools/psalm.phar and b/tools/psalm.phar differ