TypeifyTypeNotFoundException
Thrown when switching to a type that is not registered in the registry (e.g. when calling type('unknown')).
Namespace
JobMetric\Typeify\Exceptions\TypeifyTypeNotFoundException
Constructor
public function __construct(string $service, string $type, int $code = 400, ?Throwable $previous = null)
- $service – The container key (value of
typeName()). - $type – The type key that was not found.
- $code – HTTP-style code (default 400).
- $previous – Optional previous throwable.
Message
"Type [$type] is not available in service [$service]."
When It Is Thrown
- When you call
type('key')andkeyhas not been defined withdefine('key').
Example
$postType = new PostType();
$postType->define('blog');
$postType->type('blog');
$postType->type('news');
The second type('news') throws TypeifyTypeNotFoundException because news was never defined.