Skip to content

Conversation

@jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Jan 15, 2025

In line with the new minimum of PHPUnit 7.x, the assertions in the PHPUnit Polyfills will now have both parameter as well as return type declarations (wherever possible considering the minimum supported PHP version of PHP 7.1).

Additional type declarations will be added in future majors if/when the minimum supported PHP version allows for it.

Includes removing polyfilled inline type checks for assertions which were introduced in PHPUnit with declared types, but for which the polyfills couldn't type the parameters prior to this.

Includes minor adjustments to exception expectations in the tests to allow for the PHP native TypeErrors - in contrast to the emulated ones.

Notes:

  • AssertObjectProperty: the string type for the $propertyName parameter for the assertObject[Not]HasProperty() has not been applied as it would invalidate the type check (as we can't enforce strict_types for tests using the assertion).

Refs:

In line with the new minimum of PHPUnit 7.x, the assertions in the PHPUnit Polyfills will now have both parameter as well as return type declarations (wherever possible considering the minimum supported PHP version of PHP 7.1).

Additional type declarations will be added in future majors if/when the minimum supported PHP version allows for it.

Includes removing polyfilled inline type checks for assertions which were introduced in PHPUnit with declared types, but for which the polyfills couldn't type the parameters prior to this.

Includes minor adjustments to exception expectations in the tests to allow for the PHP native `TypeError`s - in contrast to the emulated ones.

Notes:
* `AssertObjectProperty`: the `string` type for the `$propertyName` parameter for the `assertObject[Not]HasProperty()` has not been applied as it would invalidate the type check (as we can't enforce `strict_types` for tests using the assertion).

Refs:
* sebastianbergmann/phpunit@852e540
* sebastianbergmann/phpunit@a7ab2b9
@coveralls
Copy link

Coverage Status

coverage: 98.331% (-0.1%) from 98.445%
when pulling e1a3029 on feature/modernize-type-declarations
into d6cf070 on 4.x.

@jrfnl jrfnl mentioned this pull request Jan 15, 2025
9 tasks
@jrfnl jrfnl changed the title Modernizer: add scalar + return type declarations (wherever possible) Modernize: add scalar + return type declarations (wherever possible) Jan 28, 2025
@jrfnl jrfnl merged commit 052a54b into 4.x Feb 7, 2025
135 checks passed
@jrfnl jrfnl deleted the feature/modernize-type-declarations branch February 7, 2025 15:57
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