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

Exception with latest release #4111

Closed
dereuromark opened this issue Sep 2, 2020 · 10 comments
Closed

Exception with latest release #4111

dereuromark opened this issue Sep 2, 2020 · 10 comments

Comments

@dereuromark
Copy link
Contributor

Uncaught UnexpectedValueException: $storage should not be null for Zend\Filter\Word\CamelCaseToDash::__invoke in phar:///home/travis/build/spryker/suite-nonsplit/vendor/psalm/phar/psalm.phar/src/Psalm/Internal/Codebase/Methods.php:645

Stack trace:

#0 phar:///home/travis/build/spryker/suite-nonsplit/vendor/psalm/phar/psalm.phar/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php(196): Psalm\Internal\Codebase\Methods->getStorage(Object(Psalm\Internal\MethodIdentifier))

#1 phar:///home/travis/build/spryker/suite-nonsplit/vendor/psalm/phar/psalm.phar/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php(139): Psalm\Internal\Type\Comparator\CallableTypeComparator::getCallableFromAtomic(Object(Psalm\Codebase), Object(Psalm\Type\Atomic\TNamedObject), Object(Psalm\Type\Atomic\TCallable))

#2 phar:///home/travis/build/spryker/suite-nonsplit/vendor/psalm/phar/psalm.phar/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php(255): Psalm\Internal\Type\Comparator\CallableTypeComparator::isNotExplicitlyCallableTypeCallable(Object(Psalm\Codebase), Object(Psalm\Type\Atomic\TNamedObject), Object(Psalm\Type\Atomic\TCallable), Object(Psalm\Internal\Type\Comparator\TypeComparisonResult))

#3 phar:///home/travis/build/spryker/suite-nonsplit/vendor/psalm/phar/psalm.phar/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php(71): Psalm\Internal\Type\Comparator\AtomicTypeComparator::isContainedBy(Object(Psalm\Codebase), Object(Psalm\Type\Atomic\TNamedObject), Object(Psalm\Type\Atomic\TCallable), false, true, Object(Psalm\Internal\Type\Comparator\TypeComparisonResult))

#4 phar:///home/travis/build/spryker/suite-nonsplit/vendor/psalm/phar/psalm.phar/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php(282): Psalm\Internal\Type\Comparator\UnionTypeComparator::isContainedBy(Object(Psalm\Codebase), Object(Psalm\Type\Union), Object(Psalm\Type\Union), true, true, Object(Psalm\Internal\Type\Comparator\TypeComparisonResult))

#5 phar:///home/travis/build/spryker/suite-nonsplit/vendor/psalm/phar/psalm.phar/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php(210): Psalm\Internal\Analyzer\Statements\Expression\Call\ArgumentAnalyzer::verifyType(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Type\Union), Object(Psalm\Type\Union), NULL, 'Zend\\Filter\\Fil...', 0, Object(Psalm\CodeLocation), Object(_HumbugBoxc22010bd12b9\PhpParser\Node\Expr\New_), Object(Psalm\Context), Object(Psalm\Storage\FunctionLikeParameter), false, NULL, false, false, Object(Psalm\CodeLocation))
@psalm-github-bot
Copy link

Hey @dereuromark, can you reproduce the issue on https://psalm.dev ?

@muglug
Copy link
Collaborator

muglug commented Sep 2, 2020

Do you still get the error when running without the Phar? All that code in CallableTypeComparator is wrapped in a try/catch block, so this is at little mystifying

@weirdan
Copy link
Collaborator

weirdan commented Sep 2, 2020

All that code in CallableTypeComparator is wrapped in a try/catch block

Is it? The exception comes from here:

$input_callable = self::getCallableFromAtomic($codebase, $input_type_part, $container_type_part);

and it doesn't seem to be wrapped into try/catch.

@muglug
Copy link
Collaborator

muglug commented Sep 2, 2020

Really? Not

$codebase->methods->getStorage($method_id);
?

@weirdan
Copy link
Collaborator

weirdan commented Sep 2, 2020

Nope. The code in phar has a lot of empty lines stripped and multi-line calls collapsed to single line. So the line 196 in phar corresponds to this:

$method_storage = $codebase->methods->getStorage($invoke_id);

and line 139 (one stack frame above that) - to this:

$input_callable = self::getCallableFromAtomic($codebase, $input_type_part, $container_type_part);

You can unpack the phar file with phar extract -f psalm.phar if you're interested.

@muglug
Copy link
Collaborator

muglug commented Sep 2, 2020

You can unpack the phar file with phar extract -f psalm.phar if you're interested.

Oh awesome, did not know about this

@muglug
Copy link
Collaborator

muglug commented Sep 3, 2020

@dereuromark are you running PHP 7.1 by any chance?

@muglug
Copy link
Collaborator

muglug commented Sep 3, 2020

Yeah, this was fixed in PHP 7.2.19: https://bugs.php.net/bug.php?id=75186

@dereuromark
Copy link
Contributor Author

dereuromark commented Sep 3, 2020

7.2
but also fails for travis in
PHP 7.4.2 (cli) (built: Jan 24 2020 13:44:53) ( ZTS )

@drupol
Copy link
Contributor

drupol commented Sep 3, 2020

Thanks @muglug !

danog pushed a commit to danog/psalm that referenced this issue Jan 29, 2021
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

4 participants