Closed zacharylund closed 2 months ago
/cc @VincentLanglet
I'm not sure but I think it's coming from @janedbal PR https://github.com/phpstan/phpstan-doctrine/pull/590/files
Before the PR
return $this->getMethodReturnTypeForHydrationMode
was called with the logic
$isVoidType = (new VoidType())->isSuperTypeOf($queryResultType);
if ($isVoidType->yes()) {
// A void query result type indicates an UPDATE or DELETE query.
// In this case all methods return the number of affected rows.
return new IntegerType();
}
if ($isVoidType->maybe()) {
// We can't be sure what the query type is, so we return the
// declared return type of the method.
return null;
}
if (!$hydrationMode instanceof ConstantIntegerType) {
return null;
}
// Do things
But after the PR, the check
if (!$hydrationMode instanceof ConstantIntegerType) {
return null;
}
was moved before calling $this->hydrationModeReturnTypeResolver->getMethodReturnTypeForHydrationMode(
Maybe I failed rebase conflicts. I separated the logic before your revert...
Can you try https://github.com/phpstan/phpstan-doctrine/pull/597 @zacharylund ?
I'm taking one week of vacations, so I'm unusure finding time for test soon. I'll see
That fixes my errors out outputs Dumped type: int<0, max>
across the board. Thanks for tracking that down!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Calls to Query::execute() for update and delete statements without a hydration mode now return mixed. Specifying any hydration mode causes it to return int. Given that these are void statement types, it makes sense that the execute method should always return int.