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

Tests: tweaks to work round PHP 8.4 deprecation #159

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Apr 4, 2024

PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameter with a null default value, which are not explicitly declared as nullable.

The ValueObject fixture used in these tests used one such implicitly nullable parameters.

The tests for the AssertObjectEquals trait already needed two test classes to allow the method to be fully tests cross-version:

  • One set which was run on PHPUnit < 9.4.0.
  • One set which runs against PHP 7.0+.

As the nullability operator was introduced in PHP 7.1 and the particular test affected does need to be typed to still test what it is supposed to test, I'm changing the requirements both test sets:

  • The requirement for the first set of tests will now be PHPUnit < 9.4.0 AND PHP < 8.4.
  • The requirement for the second set of test will now be PHP 7.1+.

This way the tests still covers the trait sufficiently.

Note: the trait itself is not affected by the deprecation.

PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameter with a `null` default value, which are not explicitly declared as nullable.

The `ValueObject` fixture used in these tests used one such implicitly nullable parameters.

The tests for the `AssertObjectEquals` trait already needed two test classes to allow the method to be fully tests cross-version:
* One set which was run on PHPUnit < 9.4.0.
* One set which runs against PHP 7.0+.

As the nullability operator was introduced in PHP 7.1 and the particular test affected _does_ need to be typed to still test what it is supposed to test, I'm changing the requirements both test sets:
* The requirement for the first set of tests will now be PHPUnit < 9.4.0 AND PHP < 8.4.
* The requirement for the second set of test will now be PHP 7.1+.

This way the tests still covers the trait sufficiently.

_Note: the trait itself is not affected by the deprecation._
@jrfnl jrfnl added this to the 1.x Next milestone Apr 4, 2024
@jrfnl jrfnl merged commit 3ac4954 into 1.x Apr 4, 2024
84 checks passed
@jrfnl jrfnl deleted the feature/assertobjectequalstests-fix-php-8.4-deprecation branch April 4, 2024 02:55
@coveralls
Copy link

Coverage Status

coverage: 96.232% (-1.0%) from 97.254%
when pulling cee3353 on feature/assertobjectequalstests-fix-php-8.4-deprecation
into e3a5bad on 1.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants