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

Ignore union types for now

This commit is contained in:
Matthew Brown 2019-11-27 00:00:46 -05:00
parent d1fbd1fa26
commit 2c08321603
2 changed files with 10 additions and 1 deletions

View File

@ -11,7 +11,7 @@
], ],
"require": { "require": {
"php": "^7.1.3", "php": "^7.1.3",
"nikic/php-parser": "^4.2.3||^4.3", "nikic/php-parser": "^4.3",
"openlss/lib-array2xml": "^1.0", "openlss/lib-array2xml": "^1.0",
"ocramius/package-versions": "^1.2", "ocramius/package-versions": "^1.2",
"composer/xdebug-handler": "^1.1", "composer/xdebug-handler": "^1.1",

View File

@ -1945,6 +1945,9 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
if ($parser_return_type instanceof PhpParser\Node\Identifier) { if ($parser_return_type instanceof PhpParser\Node\Identifier) {
$return_type_string = $parser_return_type->name . $suffix; $return_type_string = $parser_return_type->name . $suffix;
} elseif ($parser_return_type instanceof PhpParser\Node\UnionType) {
// for now unsupported
$return_type_string = 'mixed';
} else { } else {
$return_type_fq_classlike_name = ClassLikeAnalyzer::getFQCLNFromNameObject( $return_type_fq_classlike_name = ClassLikeAnalyzer::getFQCLNFromNameObject(
$parser_return_type, $parser_return_type,
@ -2691,6 +2694,9 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
$this->codebase->scanner->queueClassLikeForScanning($param_type_string, $this->file_path); $this->codebase->scanner->queueClassLikeForScanning($param_type_string, $this->file_path);
$this->file_storage->referenced_classlikes[strtolower($param_type_string)] = $param_type_string; $this->file_storage->referenced_classlikes[strtolower($param_type_string)] = $param_type_string;
} elseif ($param_typehint instanceof PhpParser\Node\UnionType) {
// not yet supported
$param_type_string = 'mixed';
} else { } else {
if ($this->classlike_storages if ($this->classlike_storages
&& strtolower($param_typehint->parts[0]) === 'self' && strtolower($param_typehint->parts[0]) === 'self'
@ -3060,6 +3066,9 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
if ($parser_property_type instanceof PhpParser\Node\Identifier) { if ($parser_property_type instanceof PhpParser\Node\Identifier) {
$property_type_string = $parser_property_type->name . $suffix; $property_type_string = $parser_property_type->name . $suffix;
} elseif ($parser_property_type instanceof PhpParser\Node\UnionType) {
// not yet supported
$property_type_string = 'mixed';
} else { } else {
$property_type_fq_classlike_name = ClassLikeAnalyzer::getFQCLNFromNameObject( $property_type_fq_classlike_name = ClassLikeAnalyzer::getFQCLNFromNameObject(
$parser_property_type, $parser_property_type,