Skip to content

PHP 7.2: New PHPCompatibility.ParameterValues.RemovedAssertStringAssertion sniff#1028

Merged
wimg merged 2 commits intodevelopfrom
php-7.2/new-removedassertstringassertion-sniff
May 20, 2020
Merged

PHP 7.2: New PHPCompatibility.ParameterValues.RemovedAssertStringAssertion sniff#1028
wimg merged 2 commits intodevelopfrom
php-7.2/new-removedassertstringassertion-sniff

Conversation

@jrfnl
Copy link
Copy Markdown
Member

@jrfnl jrfnl commented May 2, 2020

Usage of a string as the assertion became deprecated. It now emits an E_DEPRECATED
notice when both assert.active and zend.assertions are set to 1.

Refs:

This sniff addresses that change.

Includes unit tests.

Partially addresses #908


PHP 8.0: RemovedAssertStringAssertion: account for support being completely removed

assert() will no longer evaluate string arguments, instead they will be
treated like any other argument. assert($a == $b) should be used instead of
assert('$a == $b').

Ref:

Includes adjusted unit tests.

@jrfnl jrfnl added this to the 10.0.0 milestone May 2, 2020
@jrfnl jrfnl requested a review from wimg May 2, 2020 01:04
@jrfnl jrfnl changed the title New PHPCompatibility.ParameterValues.RemovedAssertStringAssertion sniff PHP 7.2: New PHPCompatibility.ParameterValues.RemovedAssertStringAssertion sniff May 2, 2020
…ssertion` sniff

> Usage of a string as the assertion became deprecated. It now emits an E_DEPRECATED
> notice when both assert.active and zend.assertions are set to 1.

Refs:
* https://wiki.php.net/rfc/deprecations_php_7_2#assert_with_string_argument
* https://www.php.net/manual/en/function.assert.php#refsect1-function.assert-changelog

This sniff addresses that change.

Includes unit tests.

Partially addressed 908
@jrfnl jrfnl force-pushed the php-7.2/new-removedassertstringassertion-sniff branch from 398ea25 to e572a56 Compare May 2, 2020 17:07
…letely removed

> `assert()` will no longer evaluate string arguments, instead they will be
> treated like any other argument. `assert($a == $b)` should be used instead of
`assert('$a == $b')`.

Ref:
* https://github.com/php/php-src/blob/69888c3ff1f2301ead8e37b23ff8481d475e29d2/UPGRADING#L350-L354

Includes adjusted unit tests.
@jrfnl jrfnl force-pushed the php-7.2/new-removedassertstringassertion-sniff branch from 42ff32a to 782a301 Compare May 4, 2020 11:02
@wimg wimg merged commit dfb04f8 into develop May 20, 2020
@wimg wimg deleted the php-7.2/new-removedassertstringassertion-sniff branch May 20, 2020 15: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.

2 participants