Add support for the mixed type by kocsismate · Pull Request #5313 · php/php-src
kocsismate
changed the title
[WIP] Add support for the mixed type
Add support for the mixed type
nikic
mentioned this pull request
2 tasks
TysonAndre added a commit to TysonAndre/php-src that referenced this pull request
May 25, 2020Fixes an edge case overlooked in php#5313 Generators are objects, so `object` should have also been allowed in addition to `iterable` and `Traversable`
php-pulls pushed a commit that referenced this pull request
May 26, 2020jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request
Aug 23, 2020As of PHP 8.0, `mixed` can be used as a parameter type for function declarations. The RFC explicitly does not allow for the `mixed` type to be combined with the nullability indicator. While in itself, that is not a cross-version compatibility issue, I have made a very conscious choice to add a check for this anyway as - while discouraged with `mixed` being a soft reserved keyword -, prior to PHP 8, a class _could_ be named `mixed`, so a `?Mixed` type hint referring to such a class could exist in code and would be a cross-version compatibility issue as since PHP 8 that will throw a "Fatal error: Mixed types cannot be nullable". Refs: * https://wiki.php.net/rfc/mixed_type_v2 * php/php-src#5313 * php/php-src@aec4c0f Includes unit tests.
jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request
Aug 23, 2020As of PHP 8.0, `mixed` can be used as a return type for function declarations. The RFC explicitly does not allow for the `mixed` type to be combined with the nullability indicator. While in itself, that is not a cross-version compatibility issue, I have made a very conscious choice to add a check for this anyway as - while discouraged with `mixed` being a soft reserved keyword -, prior to PHP 8, a class _could_ be named `mixed`, so a `?Mixed` type hint referring to such a class could exist in code and would be a cross-version compatibility issue as since PHP 8 that will throw a "Fatal error: Mixed types cannot be nullable". Refs: * https://wiki.php.net/rfc/mixed_type_v2 * php/php-src#5313 * php/php-src@aec4c0f Includes unit tests. Includes removing the `testNoViolationsInFileOnValidVersion()` test as the sniff will now throw errors either way.
jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request
Aug 23, 2020As of PHP 8.0, `mixed` can be used as a type for property declarations. The RFC explicitly does not allow for the `mixed` type to be combined with the nullability indicator. While in itself, that is not a cross-version compatibility issue, I have made a very conscious choice to add a check for this anyway as - while discouraged with `mixed` being a soft reserved keyword -, prior to PHP 8, a class _could_ be named `mixed`, so a `?Mixed` type hint referring to such a class could exist in code and would be a cross-version compatibility issue as since PHP 8 that will throw a "Fatal error: Mixed types cannot be nullable". Refs: * https://wiki.php.net/rfc/mixed_type_v2 * php/php-src#5313 * php/php-src@aec4c0f Includes unit tests.
jrfnl
mentioned this pull request
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