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

Call to undefined method PHPStan\Type\UnionType::getClassName() #19

Closed
mrceperka opened this issue Dec 10, 2020 · 0 comments
Closed

Call to undefined method PHPStan\Type\UnionType::getClassName() #19

mrceperka opened this issue Dec 10, 2020 · 0 comments

Comments

@mrceperka
Copy link
Contributor

mrceperka commented Dec 10, 2020

nextras/orm 4.0, nextras/orm-phpstan 0.6.1, phpstan/phpstan 0.12.30

Fatal error: Uncaught Error: Call to undefined method PHPStan\Type\UnionType::getClassName() in /var/docker/vendor/nextras/orm-phpstan/src/Types/RepositoryReturnTypeExtension.php:76
Stack trace:
#0 phar:///var/docker/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(2527): Nextras\OrmPhpStan\Types\RepositoryReturnTypeExtension->getTypeFromMethodCall(Object(PHPStan\Reflection\ObjectTypeMethodReflection), Object(PhpParser\Node\Expr\MethodCall), Object(PHPStan\Analyser\MutatingScope))
#1 phar:///var/docker/vendor/phpstan/phpstan/phpstan/src/Analyser/MutatingScope.php(1196): PHPStan\Analyser\MutatingScope->methodCallReturnType(Object(PHPStan\Type\ObjectType), Object(PHPStan\Type\ObjectType), 'findAll', Object(PhpParser\Node\Expr\MethodCall))
#2 phar:///var/docker/vendor/phpstan/phpstan/phpstan/src/Type/TypeTraverser.php(47): PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}(Object(PHPStan\Type\ObjectType), Array)
#3 phar:///var/docker/vendor/phpstan/phpstan/phpstan/src/Type/UnionType.php(415): PHPStan\Typ in /var/docker/vendor/nextras/orm-phpstan/src/Types/RepositoryReturnTypeExtension.php on line 76

I don't get it why this error even occurs. This should not ever happen, because it's protected by assert right?
https://github.com/nextras/orm-phpstan/blob/master/src/Types/RepositoryReturnTypeExtension.php#L74

But for some WEIRD reason, assert passes.
image
image

Code that probably caused this error:

/** @var ChannelPredefinedDataAdformFormatRepository|ChannelPredefinedDataSmartRepository|null $repository */
$repository = null;
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