Skip to content

Instantly share code, notes, and snippets.

@kanian
Created March 21, 2019 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanian/1fdc2b389bb6333064fbae71c7397e7c to your computer and use it in GitHub Desktop.
Save kanian/1fdc2b389bb6333064fbae71c7397e7c to your computer and use it in GitHub Desktop.
Example implementation of PSR-11 ContainerExceptionInterface
<?php
namespace Kanian\ContainerX\Exceptions;
use Exception;
use Psr\Container\ContainerExceptionInterface;
class DependencyIsNotInstantiableException extends Exception implements ContainerExceptionInterface
{
public function __construct($dependency, $code = 0, Exception $previous = null)
{
$message = "Dependency {$dependency} is not instantiable";
parent::__construct($message, $code, $previous);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment