Skip to content

PHP 8.1 compatibility: fix deprecation notice#1276

Merged
wimg merged 1 commit intodevelopfrom
php-8.1/various-compatibility-fixes
Apr 6, 2021
Merged

PHP 8.1 compatibility: fix deprecation notice#1276
wimg merged 1 commit intodevelopfrom
php-8.1/various-compatibility-fixes

Conversation

@jrfnl
Copy link
Copy Markdown
Member

@jrfnl jrfnl commented Apr 4, 2021

PHP 8.1 deprecates passing null to PHP native functions where the parameter(s) is not explicitly nullable.

While in PHP 8.1 this is only a deprecation, it should, of course, still be fixed.

This commit contains a fix for the one issue in PHPCompatibility found related to this so far (based on the unit tests).

Passing null to trim() is now deprecated, so more defensive coding or explicit type casting is needed.
This comes into play for the TestVersionTrait::getTestVersion() method.

Includes removing a stray line of commented out (test) code.

PHP 8.1 deprecates passing `null` to PHP native functions where the parameter(s) is not explicitly nullable.

While in PHP 8.1 this is only a deprecation, it should, of course, still be fixed.

This commit contains a fix for the one issue in PHPCompatibility found related to this so far (based on the unit tests).

Passing `null` to `trim()` is now deprecated, so more defensive coding or explicit type casting is needed.
This comes into play for the `TestVersionTrait::getTestVersion()` method.

Includes removing a stray line of commented out code.
@jrfnl jrfnl added Type: bug PR: quick merge PR only contains relatively simple changes PR: ready for review labels Apr 4, 2021
@jrfnl jrfnl added this to the 10.0.0 milestone Apr 4, 2021
@jrfnl jrfnl requested a review from wimg April 4, 2021 15:54
@jrfnl
Copy link
Copy Markdown
Member Author

jrfnl commented Apr 4, 2021

Just confirmed: with this fix alone, the unit tests are passing again on PHP 8.1. (I pulled some other fixes to PHPCS itself previously which probably helped as well)

@wimg wimg merged commit 55bcb00 into develop Apr 6, 2021
@wimg wimg deleted the php-8.1/various-compatibility-fixes branch April 6, 2021 14:31
@jrfnl jrfnl removed PR: quick merge PR only contains relatively simple changes PR: ready for review labels Apr 11, 2021
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