Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on PHP 7.4 #474

Merged
merged 3 commits into from
May 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -76,6 +80,16 @@ jobs:
- echo "memory_limit=1G" >> /c/tools/php/php.ini
script: vendor/bin/phpunit

- stage: Test
php: 7.4snapshot
Ocramius marked this conversation as resolved.
Show resolved Hide resolved
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=""
Expand Down Expand Up @@ -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=""
Expand All @@ -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=""
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,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()) {
Expand Down Expand Up @@ -152,6 +159,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()));
}

Expand Down Expand Up @@ -265,7 +277,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 {
Expand Down Expand Up @@ -354,6 +366,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;
Expand Down