Closed stpnkcrk closed 4 years ago
Well, the issue here is we try to guess the name of repository. What is FQN name of LogsRepository?
App\Model\System\Log (Entity) App\Model\System\LogMapper App\Model\System\LogRepository
It seems it's failing on $mapperClass = \get_parent_class($mapperClass);
in the MapperMethodReturnTypeExtension.php
as that returns false on my machine and therefore it falls into infinite loop.
$mapperClass = $mapper->getClassName();
do {
/** @phpstan-var class-string<\Nextras\Orm\Repository\Repository> $repositoryClass */
$repositoryClass = \str_replace('Mapper', 'Repository', $mapperClass);
$mapperClass = \get_parent_class($mapperClass);
assert(is_string($mapperClass));
} while (!\class_exists($repositoryClass) && $mapperClass !== DbalMapper::class);
$repositoryClass
is recognised correctly as App\Model\System\LogRepository
.
What is your definition of LogRepository? What does it extend?
<?php declare(strict_types=1);
namespace App\Model\System;
use Nextras\Orm\Collection\ICollection;
use Nextras\Orm\Repository\Repository;
/**
* @method ICollection|Log[] findAllWithTranslatedIps()
*/
final class LogRepository extends Repository
{
public static function getEntityClassNames(): array
{
return [Log::class];
}
}
I somehow know where the bug is, will try to fix asap. Thanks for reporting.
Thank you very much!!!
PHPStan 0.12.40 Nextras\Orm 4.0-RC1 Nextras\Orm-PHPStan dev-master
This makes PHPStan with active nextras/orm-phpstan extension to freeze when analysing the file.
The issue persists even with just
$this->builder()
suggesting error isn't in the custom select part.