Add MethodNotFoundInClassException::constructFromCollection()

parent c0502e8e
......@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace Hgraca\AppMapper\Infrastructure\Parser\NikicPhpParser\Exception;
use Hgraca\AppMapper\Core\Port\Parser\Exception\ParserException;
use Hgraca\AppMapper\Infrastructure\Parser\NikicPhpParser\Visitor\TypeCollection;
final class MethodNotFoundInClassException extends ParserException
{
......@@ -25,4 +26,12 @@ final class MethodNotFoundInClassException extends ParserException
{
return new self("Method '$methodName' not found in class '$classFqcn'.");
}
public static function constructFromCollection(string $methodName, TypeCollection $typeCollection): self
{
return new self(
"Method '$methodName' not found in any of the classes '{$typeCollection->implodeKeys(', ')}'. "
. 'It should have been found in at least one.'
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment