diff --git a/.travis.yml b/.travis.yml index 74621ea3f..047a67836 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,10 @@ before_script: - rm composer.lock - travis_retry composer update --prefer-dist $DEPENDENCIES +matrix: + allow_failures: + - php: 7.4snapshot + jobs: include: - stage: Test @@ -76,6 +80,16 @@ jobs: - echo "memory_limit=1G" >> /c/tools/php/php.ini script: vendor/bin/phpunit + - stage: Test + php: 7.4snapshot + env: DEPENDENCIES="" + script: vendor/bin/phpunit + + - stage: Test + php: 7.4snapshot + env: DEPENDENCIES="--prefer-lowest --prefer-stable" + script: vendor/bin/phpunit + - stage: Test Compatibility php: 7.2 env: DEPENDENCIES="" @@ -144,6 +158,16 @@ jobs: - echo "memory_limit=1G" >> /c/tools/php/php.ini script: vendor/bin/phpunit test/compat + - stage: Test Compatibility + php: 7.4snapshot + env: DEPENDENCIES="" + script: vendor/bin/phpunit test/compat + + - stage: Test Compatibility + php: 7.4snapshot + env: DEPENDENCIES="--prefer-lowest --prefer-stable" + script: vendor/bin/phpunit test/compat + - stage: Check Demo Scripts php: 7.2 env: DEPENDENCIES="" @@ -164,6 +188,16 @@ jobs: env: DEPENDENCIES="--prefer-lowest --prefer-stable" script: test/demo/check-demo.sh + - stage: Check Demo Scripts + php: 7.4snapshot + env: DEPENDENCIES="" + script: test/demo/check-demo.sh + + - stage: Check Demo Scripts + php: 7.4snapshot + env: DEPENDENCIES="--prefer-lowest --prefer-stable" + script: test/demo/check-demo.sh + - stage: Check Coding Standard php: 7.3 env: DEPENDENCIES="" diff --git a/composer.json b/composer.json index 7159846dc..877af92b0 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Better Reflection - an improved code reflection API", "license": "MIT", "require": { - "php": ">=7.2.0,<7.4.0", + "php": ">=7.2.0,<7.5.0", "ext-json": "*", "jetbrains/phpstorm-stubs": "2019.1", "nikic/php-parser": "^4.2.1", diff --git a/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php b/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php index 0b58ec9da..db5cd3884 100644 --- a/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php +++ b/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php @@ -79,13 +79,20 @@ public function internalClassesProvider() : array get_declared_traits() ); + // Needs fixes in JetBrains/phpstorm-stubs + $missingClassesInStubs = ['WeakReference']; + return array_map( static function (string $className) : array { return [$className]; }, array_filter( $classNames, - static function (string $className) : bool { + static function (string $className) use ($missingClassesInStubs) : bool { + if (in_array($className, $missingClassesInStubs, true)) { + return false; + } + $reflection = new CoreReflectionClass($className); if (! $reflection->isInternal()) { @@ -159,6 +166,11 @@ private function assertSameClassAttributes(CoreReflectionClass $original, Reflec continue; } + // Added in PHP 7.4.0 + if (PHP_VERSION_ID >= 70400 && $method->getShortName() === '__unserialize') { + return; + } + $this->assertSameMethodAttributes($method, $stubbed->getMethod($method->getName())); } @@ -272,7 +284,7 @@ public function internalFunctionsProvider() : array $functionNames = get_defined_functions()['internal']; // Needs fixes in JetBrains/phpstorm-stubs - $missingFunctionsInStubs = ['sapi_windows_vt100_support']; + $missingFunctionsInStubs = ['password_algos', 'sapi_windows_vt100_support', 'sapi_windows_set_ctrl_handler', 'sapi_windows_generate_ctrl_event']; return array_map( static function (string $functionName) : array { @@ -361,6 +373,11 @@ public function testInternalFunctions(string $functionName) : void return; } + // Changed in PHP 7.4.0 + if (PHP_VERSION_ID >= 70400 && $functionName === 'preg_replace_callback') { + return; + } + // Needs fixes in JetBrains/phpstorm-stubs or PHP if (in_array($functionName, ['get_resources', 'sapi_windows_cp_get', 'stream_context_set_option'], true)) { return;