1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Remove ReflectionType::getName(), move ReflectionType::isBuiltin() (#5090)

* Remove ReflectionType::getName(), move ReflectionType::isBuiltin()

* `ReflectionType::getName()` was never there: https://3v4l.org/1iZt4
* `ReflectionType::isBuiltin()` was moved to
`ReflectionNamedType::isBuiltin()` in PHP 8

Fixes vimeo/psalm#5089

* Fix test

* Mark test as php 8.0 only
This commit is contained in:
Bruce Weirdan 2021-01-24 20:31:10 +02:00 committed by Daniil Gentili
parent 0aa4f2044c
commit 9292316073
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
3 changed files with 16 additions and 5 deletions

View File

@ -11479,9 +11479,9 @@ return [
'ReflectionMethod::setAccessible' => ['void', 'visible'=>'bool'], 'ReflectionMethod::setAccessible' => ['void', 'visible'=>'bool'],
'ReflectionNamedType::__clone' => ['void'], 'ReflectionNamedType::__clone' => ['void'],
'ReflectionNamedType::__toString' => ['string'], 'ReflectionNamedType::__toString' => ['string'],
'ReflectionNamedType::allowsNull' => [''], 'ReflectionNamedType::allowsNull' => ['bool'],
'ReflectionNamedType::getName' => ['string'], 'ReflectionNamedType::getName' => ['string'],
'ReflectionNamedType::isBuiltin' => [''], 'ReflectionNamedType::isBuiltin' => ['bool'],
'ReflectionObject::__clone' => ['void'], 'ReflectionObject::__clone' => ['void'],
'ReflectionObject::__construct' => ['void', 'argument'=>'object'], 'ReflectionObject::__construct' => ['void', 'argument'=>'object'],
'ReflectionObject::__toString' => ['string'], 'ReflectionObject::__toString' => ['string'],
@ -11579,8 +11579,6 @@ return [
'ReflectionType::__clone' => ['void'], 'ReflectionType::__clone' => ['void'],
'ReflectionType::__toString' => ['string'], 'ReflectionType::__toString' => ['string'],
'ReflectionType::allowsNull' => ['bool'], 'ReflectionType::allowsNull' => ['bool'],
'ReflectionType::getName' => ['string'],
'ReflectionType::isBuiltin' => ['bool'],
'ReflectionZendExtension::__clone' => ['void'], 'ReflectionZendExtension::__clone' => ['void'],
'ReflectionZendExtension::__construct' => ['void', 'name'=>'string'], 'ReflectionZendExtension::__construct' => ['void', 'name'=>'string'],
'ReflectionZendExtension::__toString' => ['string'], 'ReflectionZendExtension::__toString' => ['string'],

View File

@ -100,6 +100,7 @@ return [
'PhpToken::is' => ['bool', 'kind'=>'string|int|string[]|int[]'], 'PhpToken::is' => ['bool', 'kind'=>'string|int|string[]|int[]'],
'PhpToken::isIgnorable' => ['bool'], 'PhpToken::isIgnorable' => ['bool'],
'PhpToken::getTokenName' => ['string'], 'PhpToken::getTokenName' => ['string'],
'ReflectionNamedType::isBuiltin' => ['bool'],
'proc_get_status' => ['array<string,int|string|bool>', 'process'=>'resource'], 'proc_get_status' => ['array<string,int|string|bool>', 'process'=>'resource'],
'socket_accept' => ['Socket|false', 'socket'=>'Socket'], 'socket_accept' => ['Socket|false', 'socket'=>'Socket'],
'socket_addrinfo_bind' => ['?Socket', 'addrinfo'=>'AddressInfo'], 'socket_addrinfo_bind' => ['?Socket', 'addrinfo'=>'AddressInfo'],
@ -289,6 +290,7 @@ return [
'png2wbmp' => ['bool', 'pngname'=>'string', 'wbmpname'=>'string', 'dest_height'=>'int', 'dest_width'=>'int', 'threshold'=>'int'], 'png2wbmp' => ['bool', 'pngname'=>'string', 'wbmpname'=>'string', 'dest_height'=>'int', 'dest_width'=>'int', 'threshold'=>'int'],
'proc_get_status' => ['array<string,int|string|bool>|false', 'process'=>'resource'], 'proc_get_status' => ['array<string,int|string|bool>|false', 'process'=>'resource'],
'read_exif_data' => ['array', 'filename'=>'string', 'sections_needed='=>'string', 'sub_arrays='=>'bool', 'read_thumbnail='=>'bool'], 'read_exif_data' => ['array', 'filename'=>'string', 'sections_needed='=>'string', 'sub_arrays='=>'bool', 'read_thumbnail='=>'bool'],
'ReflectionType::isBuiltin' => ['bool'],
'socket_addrinfo_lookup' => ['resource[]', 'node'=>'string', 'service='=>'mixed', 'hints='=>'array'], 'socket_addrinfo_lookup' => ['resource[]', 'node'=>'string', 'service='=>'mixed', 'hints='=>'array'],
'socket_accept' => ['resource|false', 'socket'=>'resource'], 'socket_accept' => ['resource|false', 'socket'=>'resource'],
'socket_addrinfo_bind' => ['?resource', 'addrinfo'=>'resource'], 'socket_addrinfo_bind' => ['?resource', 'addrinfo'=>'resource'],

View File

@ -402,8 +402,19 @@ class MethodCallTest extends TestCase
return "mixed"; return "mixed";
} }
return $type->getName(); if ($type instanceof ReflectionUnionType) {
return "union";
}
if ($type instanceof ReflectionNamedType) {
return $type->getName();
}
throw new RuntimeException("unexpected type");
}', }',
'assertions' => [],
'error_levels' => [],
'php_version' => '8.0'
], ],
'PDOMethod' => [ 'PDOMethod' => [
'<?php '<?php