Refactor MethodNotFoundInClassException constructor

Into a named constructor.
parent eb691ee6
......@@ -21,8 +21,8 @@ use Hgraca\AppMapper\Core\Port\Parser\Exception\ParserException;
final class MethodNotFoundInClassException extends ParserException
{
public function __construct(string $methodName, string $classFqcn)
public function constructFromFqcn(string $methodName, string $classFqcn): self
{
parent::__construct("Method '$methodName' not found in class '$classFqcn'.");
return new self("Method '$methodName' not found in class '$classFqcn'.");
}
}
......@@ -94,7 +94,7 @@ final class ClassAdapter implements ClassInterface
}
}
throw new MethodNotFoundInClassException($methodName, $this->getFullyQualifiedType());
throw MethodNotFoundInClassException::constructFromFqcn($methodName, $this->getFullyQualifiedType());
}
/**
......
......@@ -96,7 +96,7 @@ final class Type
}
}
throw new MethodNotFoundInClassException($methodName, $this->typeAsString);
throw MethodNotFoundInClassException::constructFromFqcn($methodName, $this->typeAsString);
}
public function hasAstMethod(string $methodName): bool
......
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