-
Notifications
You must be signed in to change notification settings - Fork 356
Another attempt to make it work under PHP 5.3 and PHP 8+ #693
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
Conversation
git grep --name-only PHPUnit.Framework.TestCase | xargs sed -i 's:PHPUnit.Framework.TestCase:LegacyPHPUnit\\TestCase:g'
} else { | ||
static::assertInternalType('array', $actual, $message); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Target PHP versions do not support traits, therefore we can't use off-the-shelf polyfill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about replacing assertInternalType
with an assertTrue(is_array($data), $message)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the same logic we should use assertTrue(is_array())
instead of assertIsArray()
; what do you think?
# dependencies: highest | ||
# experimental: false | ||
# - php-version: "8.1" | ||
# dependencies: lowest-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to drop this because it leads to installing dependencies broken on PHP 8.1.
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "~2.2.20 || ~2.19.0", | ||
"json-schema/json-schema-test-suite": "1.2.0", | ||
"phpunit/phpunit": "^4.8.35" | ||
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.29 || ^9.5.24", | ||
"sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a certain bias since I'm the author of this package. In my defense, it is used by several high-profile packages with millions of installs to solve the very this problem.
Check out the readme: https://github.com/sanmai/phpunit-legacy-adapter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should probably not need this I think there should be another way of managing this, if I understand correctly PHPUnit 9 is not compatible with php < 8 right? IMO we should try to run PHPUnit 9 if possible, if not we should take the highest one possible. We can definitely do this inside the CI directly but leave this requirement to 9.
@@ -29,12 +29,14 @@ | |||
"require": { | |||
"php": ">=5.3.3", | |||
"marc-mabe/php-enum":"^2.0 || ^3.0 || ^4.0", | |||
"icecave/parity": "1.0.0" | |||
"icecave/parity": ">=1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"icecave/parity": ">=1.0.0" | |
"icecave/parity": "^1.0.0" |
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "~2.2.20 || ~2.19.0", | ||
"json-schema/json-schema-test-suite": "1.2.0", | ||
"phpunit/phpunit": "^4.8.35" | ||
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.29 || ^9.5.24", | ||
"sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should probably not need this I think there should be another way of managing this, if I understand correctly PHPUnit 9 is not compatible with php < 8 right? IMO we should try to run PHPUnit 9 if possible, if not we should take the highest one possible. We can definitely do this inside the CI directly but leave this requirement to 9.
"phpunit/phpunit": "^4.8.35" | ||
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.29 || ^9.5.24", | ||
"sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", | ||
"phpspec/prophecy-phpunit": "^1.1 || ^2.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC most recent PHPUnit does not depend on this library, where in fact it is used by this library.
But I digress: it has been two years; my memory is foggy.
} else { | ||
static::assertInternalType('array', $actual, $message); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about replacing assertInternalType
with an assertTrue(is_array($data), $message)
instead?
I can't remember why I needed this. |
Build is passing. I left few comments along the way, please ask if anything isn't clear.
Commit history is a mess. If you're not comfortable squash-merging this PR, I'll be happy to merge everything into one commit.