PHP 8.0: New `PHPCompatibility.FunctionDeclarations.RemovedCallingDestructAfterConstructorExit` sniff by jrfnl · Pull Request #1200 · PHPCompatibility/PHPCompatibility

@jrfnl

…estructAfterConstructorExit` sniff

> If an object constructor exit()s, the object destructor will no longer be
> called. This matches the behavior when the constructor throws.

Notes:
* This sniff will throw an error, even when there is no destructor as a destructor may be declared in a parent class.
    We could reduce the potential noise from this sniff a little further by only throwing the error when the class either contains a `__destruct()` method or extends a parent class.
* The name for the sniff feels a bit long. Suggestions for a better/shorter name welcome.

Opinions ?

Refs:
* https://github.com/php/php-src/blob/71bfa5344ab207072f4cd25745d7023096338385/UPGRADING#L200-L201
* php/php-src#5768 (I suspect, but not 100% sure)
* php/php-src@75a04ea

wimg

wimg approved these changes Aug 18, 2020

@wimg wimg deleted the php-8.0/new-removeddestructafterconstructorexit-sniff branch

August 18, 2020 15:03

@jrfnl jrfnl mentioned this pull request

Oct 2, 2020