Skip to content
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

undefined offset in type analyzer leads to TypeError in isContainedBy #1474

Closed
SignpostMarv opened this issue Mar 16, 2019 · 1 comment
Closed

Comments

@SignpostMarv
Copy link
Contributor

I've tried various workarounds, but https://github.com/SignpostMarv/Daft-Schema.org/blob/6dc9af7a21c0a6972e42758d46b7b4089415ebe6/Tests/DaftObjectSchemaOrg/DaftObjectFuzzingTest.php#L255 causes an undefined offset in psalm:

$container_param = $container_type_part->type_params[$i];
which then leads to a TypeError in
public static function isContainedBy(

Notice: Undefined offset: 2 in .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php on line 1480
PHP Fatal error: Uncaught TypeError: Argument 3 passed to Psalm\Internal\Analyzer\TypeAnalyzer::isContainedBy() must be an instance of Psalm\Type\Union, null given, called in .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php on line 1502 and defined in .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php:63
Stack trace:
#0 .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php(1502): Psalm\Internal\Analyzer\TypeAnalyzer::isContainedBy(Object(Psalm\Codebase), Object(Psalm\Type\Union), NULL, false, false, true, NULL, NULL, false, NULL, false)
#1 .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php(557): Psalm\Internal\Analyzer\TypeAnalyzer::isMatchingTypeContainedBy(Object(Psalm\Codebase), Object(Psalm\Type\Atomic\TArray), Object(Psalm\Type\Atomic\TArray), true, NULL, NULL, false, false)
#2 .\v in .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php on line 63

Fatal error: Uncaught TypeError: Argument 3 passed to Psalm\Internal\Analyzer\TypeAnalyzer::isContainedBy() must be an instance of Psalm\Type\Union, null given, called in .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php on line 1502 and defined in .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php:63
Stack trace:
#0 .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php(1502): Psalm\Internal\Analyzer\TypeAnalyzer::isContainedBy(Object(Psalm\Codebase), Object(Psalm\Type\Union), NULL, false, false, true, NULL, NULL, false, NULL, false)
#1 .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php(557): Psalm\Internal\Analyzer\TypeAnalyzer::isMatchingTypeContainedBy(Object(Psalm\Codebase), Object(Psalm\Type\Atomic\TArray), Object(Psalm\Type\Atomic\TArray), true, NULL, NULL, false, false)
#2 .\v in .\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\TypeAnalyzer.php on line 63

@SignpostMarv
Copy link
Contributor Author

looks like i type-hinted something wrongly and broke psalm:P SignpostMarv/Daft-Schema.org@7172062#diff-aba7e1ae04c4d190393723926f96c1ba

@muglug muglug closed this as completed in ca765cb Mar 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant