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

3.0 | Drop support for PHP < 7.0 #192

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Sep 6, 2024

Drop support for PHP < 7.0 [1]

  • Update Composer version requirements.
  • Remove PHP 5.x specific Composer script.
  • Stop running tests/linting in CI against PHP 5.6.
  • Update documentation.
  • Update some tests.

Drop support for PHP < 7.0 [2]

Remove two polyfilled PHP native classes, which are no longer needed.

Drop support for PHP < 7.0 [3]

Simplify the tests for the AssertObjectEquals trait.

These tests had two flavours:

  • The base test class which is compatible with PHP 7.0 and higher.
    This test class uses fixtures with return type declarations.
  • A mirror test class which is compatible with PHP 5.6+ with PHPUnit < 9.4.0.
    This test class uses fixtures without return type declarations to make the tests runnable on PHP < 7.0.

This mirror test class, and its associated test fixtures, are no longer needed now support for PHP < 7.0 is being dropped.

Drop support for PHP < 7.0 [4]

In the original implementation of the assertObjectEquals() polyfill, the polyfill could not mirror the PHPUnit native implementation completely as that required support for return types, which was only added in PHP 7.0, while the polyfill was introduced in PHPUnit Polyfills 1.0, which still supported PHP 5.5.

So instead of checking whether the "comparator" method had a return type declared and verifying that this return type complied with the requirements set by PHPUnit, the polyfill originally checked whether the returned value complied with the required type.

Now support for PHP < 7.0 is being dropped, the assertObjectEquals() polyfill can be updated to fix this implementation difference.

Includes unit tests for the changed functionality/new logic paths throwing exceptions.
Includes updated documentation in the README.

Refs:

* Update Composer version requirements.
* Remove PHP 5.x specific Composer script.
* Stop running tests/linting in CI against PHP 5.6.
* Update documentation.
* Update some tests.
Remove two polyfilled PHP native classes, which are no longer needed.
Simplify the tests for the `AssertObjectEquals` trait.

These tests had two flavours:
* The base test class which is compatible with PHP 7.0 and higher.
    This test class uses fixtures with return type declarations.
* A mirror test class which is compatible with PHP 5.6+ with PHPUnit < 9.4.0.
    This test class uses fixtures without return type declarations to make the tests runnable on PHP < 7.0.

This mirror test class, and its associated test fixtures, are no longer needed now support for PHP < 7.0 is being dropped.
In the original implementation of the `assertObjectEquals()` polyfill, the polyfill could not mirror the PHPUnit native implementation completely as that required support for return types, which was only added in PHP 7.0, while the polyfill was introduced in PHPUnit Polyfills 1.0, which still supported PHP 5.5.

So instead of checking whether the "comparator" method had a return type declared and verifying that this return type complied with the requirements set by PHPUnit, the polyfill originally checked whether the _returned value_ complied with the required type.

Now support for PHP < 7.0 is being dropped, the `assertObjectEquals()` polyfill can be updated to fix this implementation difference.

Includes unit tests for the changed functionality/new logic paths throwing exceptions.
Includes updated documentation in the README.

Refs:
* 38
* sebastianbergmann/phpunit 4707
* sebastianbergmann/phpunit 4467
* sebastianbergmann/phpunit 4707
* sebastianbergmann/phpunit@1dba8c3
* sebastianbergmann/phpunit@6099c5e
@coveralls
Copy link

Coverage Status

coverage: 96.423% (+0.6%) from 95.846%
when pulling 8de2ad1 on feature/3.x/drop-support-for-php-7.0
into 61623d6 on 3.x.

Copy link
Collaborator

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow a lot of great work here! Thanks @jrfnl

@hellofromtonya hellofromtonya merged commit 805f0ba into 3.x Sep 6, 2024
152 checks passed
@hellofromtonya hellofromtonya deleted the feature/3.x/drop-support-for-php-7.0 branch September 6, 2024 19:13
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.

3 participants