PHP 8.0 | Add support for and detection of union types in param, return and property types by jrfnl · Pull Request #1444 · PHPCompatibility/PHPCompatibility

added 14 commits

December 25, 2022 04:41
The `try-catch` is no longer needed now support for PHPCS < 3.7.1 has been dropped.
* Add tests with union types.
* Add the new `false` and `null` types to the `$newTypes` array.
* Explode the type received from the `FunctionDeclarations::getParameters()` method on the `|` bitwise or operator and do the existing checks for each type found.

This maintains the existing behaviour, while allowing for union types.
Detect stand-alone `false`/`null` types and throw an error when these are encountered.
The `try-catch` is no longer needed now support for PHPCS < 3.7.1 has been dropped.
* Add tests with union types.
* Add the new `false` and `null` types to the `$newTypes` array.
* Explode the type received from the `FunctionDeclarations::getProperties()` method on the `|` bitwise or operator and do the existing checks for each type found.

This maintains the existing behaviour, while allowing for union types.
Detect stand-alone `false`/`null` types and throw an error when these are encountered.
* Add tests with union types.
* Add the new `false` and `null` types to the `$newTypes` array.
* Explode the type received from the `Variables::getMemberProperties()` method on the `|` bitwise or operator and do the existing checks for each type found.

This maintains the existing behaviour, while allowing for union types.
Detect stand-alone `false`/`null` types and throw an error when these are encountered.

@jrfnl jrfnl mentioned this pull request

Dec 25, 2022

40 tasks

wimg

wimg approved these changes Dec 25, 2022

@wimg wimg deleted the php-8.0/various-support-and-detect-union-types branch

December 25, 2022 15:32

@jrfnl jrfnl mentioned this pull request

Dec 26, 2022