-
-
Notifications
You must be signed in to change notification settings - Fork 205
PHP 8.0 | Add support for and detection of union types in param, return and property types #1444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wimg
merged 14 commits into
develop
from
php-8.0/various-support-and-detect-union-types
Dec 25, 2022
Merged
PHP 8.0 | Add support for and detection of union types in param, return and property types #1444
wimg
merged 14 commits into
develop
from
php-8.0/various-support-and-detect-union-types
Dec 25, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
> Union Types > > Support for union types has been added. Detect whether a type is a union type and throw an error if PHP < 8 needs to be supported. Ref: * https://wiki.php.net/rfc/union_types_v2 * https://www.php.net/manual/en/migration80.new-features.php#migration80.new-features.core.union-types * https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.composite.union * php/php-src#4838 * php/php-src@999e32b
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.
> Union Types > > Support for union types has been added. Detect whether a type is a union type and throw an error if PHP < 8 needs to be supported. Ref: * https://wiki.php.net/rfc/union_types_v2 * https://www.php.net/manual/en/migration80.new-features.php#migration80.new-features.core.union-types * https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.composite.union * php/php-src#4838 * php/php-src@999e32b
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.
> Union Types > > Support for union types has been added. Detect whether a type is a union type and throw an error if PHP < 8 needs to be supported. Ref: * https://wiki.php.net/rfc/union_types_v2 * https://www.php.net/manual/en/migration80.new-features.php#migration80.new-features.core.union-types * https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.composite.union * php/php-src#4838 * php/php-src@999e32b
Detect stand-alone `false`/`null` types and throw an error when these are encountered.
40 tasks
wimg
approved these changes
Dec 25, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NewParamTypeDeclarations: various minor doc fixes
NewParamTypeDeclarations: remove redundant try/catch
The
try-catchis no longer needed now support for PHPCS < 3.7.1 has been dropped.PHP 8.0 | NewParamTypeDeclarations: add support for union types [1]
falseandnulltypes to the$newTypesarray.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.
PHP 8.0 | NewParamTypeDeclarations: add support for union types [2]
Detect whether a type is a union type and throw an error if PHP < 8 needs to be supported.
Ref:
PHP 8.0 | NewParamTypeDeclarations: add support for union types [3]
Detect stand-alone
false/nulltypes and throw an error when these are encountered.NewReturnTypeDeclarations: various minor doc fixes
NewReturnTypeDeclarations: remove redundant try/catch
The
try-catchis no longer needed now support for PHPCS < 3.7.1 has been dropped.PHP 8.0 | NewReturnTypeDeclarations: add support for union types [1]
falseandnulltypes to the$newTypesarray.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.
PHP 8.0 | NewReturnTypeDeclarations: add support for union types [2]
Detect whether a type is a union type and throw an error if PHP < 8 needs to be supported.
Ref:
PHP 8.0 | NewReturnTypeDeclarations: add support for union types [3]
Detect stand-alone
false/nulltypes and throw an error when these are encountered.NewTypedProperties: various minor doc fixes
PHP 8.0 | NewTypedProperties: add support for union types [1]
falseandnulltypes to the$newTypesarray.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.
PHP 8.0 | NewTypedProperties: add support for union types [2]
Detect whether a type is a union type and throw an error if PHP < 8 needs to be supported.
Ref:
PHP 8.0 | NewTypedProperties: add support for union types [3]
Detect stand-alone
false/nulltypes and throw an error when these are encountered.Related to #809
Fixes #1444