I there,
I'm using translatable from Knp and I have this error :
Uncaught Knp\DoctrineBehaviors\PHPStan\Exception\PHPStanTypeException: Unable to find the Translation class associated to the Translatable class "App\Entity\ExposeTranslatableFieldsInterface". in /dev/app/vendor/knplabs/doctrine-behaviors/utils/phpstan-behaviors/src/Type/StaticTranslationTypeHelper.php:45
#0 /dev/app/vendor/knplabs/doctrine-behaviors/utils/phpstan-behaviors/src/Type/TranslatableTranslateDynamicMethodReturnTypeExtension.php(39): Knp\DoctrineBehaviors\PHPStan\Type\StaticTranslationTypeHelper::getTranslationClass(Object(PHPStan\Reflection\ReflectionProvider\MemoizingReflectionProvider), Object(PhpParser\Node\Expr\MethodCall), Object(PHPStan\Analyser\MutatingScope))
#1 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(3574): Knp\DoctrineBehaviors\PHPStan\Type\TranslatableTranslateDynamicMethodReturnTypeExtension->getTypeFromMethodCall(Object(PHPStan\Reflection\ResolvedMethodReflection), Object(PhpParser\Node\Expr\MethodCall), Object(PHPStan\Analyser\MutatingScope))
#2 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1413): PHPStan\Analyser\MutatingScope->methodCallReturnType(Object(PHPStan\Type\UnionType), 'translate', Object(PhpParser\Node\Expr\MethodCall))
#3 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1419): PHPStan\Analyser\MutatingScope->PHPStan\Analyser\{closure}()
#4 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(574): PHPStan\Analyser\MutatingScope->resolveType(Object(PhpParser\Node\Expr\MethodCall))
#5 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1345): PHPStan\Analyser\MutatingScope->getType(Object(PhpParser\Node\Expr\MethodCall))
#6 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1364): PHPStan\Analyser\NodeScopeResolver->ensureShallowNonNullability(Object(PHPStan\Analyser\MutatingScope), Object(PHPStan\Analyser\MutatingScope), Object(PhpParser\Node\Expr\MethodCall))
#7 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1325): PHPStan\Analyser\NodeScopeResolver->PHPStan\Analyser\{closure}(Object(PHPStan\Analyser\MutatingScope), Object(PhpParser\Node\Expr\MethodCall))
#8 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1330): PHPStan\Analyser\NodeScopeResolver->lookForExpressionCallback(Object(PHPStan\Analyser\MutatingScope), Object(PhpParser\Node\Expr\MethodCall), Object(Closure))
#9 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1369): PHPStan\Analyser\NodeScopeResolver->lookForExpressionCallback(Object(PHPStan\Analyser\MutatingScope), Object(PhpParser\Node\Expr\PropertyFetch), Object(Closure))
#10 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1928): PHPStan\Analyser\NodeScopeResolver->ensureNonNullability(Object(PHPStan\Analyser\MutatingScope), Object(PhpParser\Node\Expr\PropertyFetch))
#11 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1460): PHPStan\Analyser\NodeScopeResolver->processExprNode(Object(PhpParser\Node\Expr\BinaryOp\Coalesce), Object(PHPStan\Analyser\MutatingScope), Object(Closure), Object(PHPStan\Analyser\ExpressionContext))
#12 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(2716): PHPStan\Analyser\NodeScopeResolver->PHPStan\Analyser\{closure}(Object(PHPStan\Analyser\MutatingScope))
#13 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(1468): PHPStan\Analyser\NodeScopeResolver->processAssignVar(Object(PHPStan\Analyser\MutatingScope), Object(PhpParser\Node\Expr\Variable), Object(PhpParser\Node\Expr\BinaryOp\Coalesce), Object(Closure), Object(PHPStan\Analyser\ExpressionContext), Object(Closure), true)
#14 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(554): PHPStan\Analyser\NodeScopeResolver->processExprNode(Object(PhpParser\Node\Expr\Assign), Object(PHPStan\Analyser\MutatingScope), Object(Closure), Object(PHPStan\Analyser\ExpressionContext))
#15 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(356): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Expression), Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#16 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(710): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Foreach_), Array, Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#17 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(356): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Foreach_), Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#18 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(710): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Foreach_), Array, Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#19 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(356): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Foreach_), Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#20 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(517): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\ClassMethod), Array, Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#21 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(356): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\ClassMethod), Object(PHPStan\Analyser\MutatingScope), Object(PHPStan\Node\ClassStatementsGatherer))
#22 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(595): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Class_), Array, Object(PHPStan\Analyser\MutatingScope), Object(PHPStan\Node\ClassStatementsGatherer))
#23 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(356): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Class_), Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#24 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(567): PHPStan\Analyser\NodeScopeResolver->processStmtNodes(Object(PhpParser\Node\Stmt\Namespace_), Array, Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#25 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(326): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpParser\Node\Stmt\Namespace_), Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#26 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(175): PHPStan\Analyser\NodeScopeResolver->processNodes(Array, Object(PHPStan\Analyser\MutatingScope), Object(Closure))
#27 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/Analyser.php(71): PHPStan\Analyser\FileAnalyser->analyseFile('/dev/app...', Array, Object(PHPStan\Rules\LazyRegistry), Object(PHPStan\Collectors\Registry), NULL)
#28 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyserRunner.php(63): PHPStan\Analyser\Analyser->analyse(Array, Object(Closure), NULL, true, Array)
#29 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(207): PHPStan\Command\AnalyserRunner->runAnalyser(Array, Array, Object(Closure), NULL, true, true, '/dev/app...', NULL, NULL, Object(_PHPStan_ff82193c2\Symfony\Component\Console\Input\ArgvInput))
#30 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseApplication.php(101): PHPStan\Command\AnalyseApplication->runAnalyser(Array, Array, true, '/dev/app...', Object(PHPStan\Command\Symfony\SymfonyOutput), Object(PHPStan\Command\Symfony\SymfonyOutput), Object(_PHPStan_ff82193c2\Symfony\Component\Console\Input\ArgvInput))
#31 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/src/Command/AnalyseCommand.php(168): PHPStan\Command\AnalyseApplication->analyse(Array, false, Object(PHPStan\Command\Symfony\SymfonyOutput), Object(PHPStan\Command\Symfony\SymfonyOutput), false, true, '/dev/app...', Array, Object(_PHPStan_ff82193c2\Symfony\Component\Console\Input\ArgvInput))
#32 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\AnalyseCommand->execute(Object(_PHPStan_ff82193c2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_ff82193c2\Symfony\Component\Console\Output\ConsoleOutput))
#33 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(868): _PHPStan_ff82193c2\Symfony\Component\Console\Command\Command->run(Object(_PHPStan_ff82193c2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_ff82193c2\Symfony\Component\Console\Output\ConsoleOutput))
#34 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(259): _PHPStan_ff82193c2\Symfony\Component\Console\Application->doRunCommand(Object(PHPStan\Command\AnalyseCommand), Object(_PHPStan_ff82193c2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_ff82193c2\Symfony\Component\Console\Output\ConsoleOutput))
#35 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157): _PHPStan_ff82193c2\Symfony\Component\Console\Application->doRun(Object(_PHPStan_ff82193c2\Symfony\Component\Console\Input\ArgvInput), Object(_PHPStan_ff82193c2\Symfony\Component\Console\Output\ConsoleOutput))
#36 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(124): _PHPStan_ff82193c2\Symfony\Component\Console\Application->run()
#37 phar:///dev/app/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan(125): _PHPStan_ff82193c2\{closure}()
#38 /dev/app/vendor/phpstan/phpstan/phpstan(8): require('phar:///dev/app...')
#39 /dev/app/bin/phpstan(120): include('/dev/app...')
#40 {main}
I have this in my composer.json :
...
"config": {
"bin-dir": "bin",
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true,
"symfony/flex": true,
"symfony/runtime": true
}
},
So the file vendor/knplabs/doctrine-behaviors/phpstan-extension.neon
is already included (related to #516
How can I fix it ?