Throw an Exception if it is the wrong type

This commit is contained in:
Oliver Davies 2020-11-14 12:52:22 +00:00
parent 4be8e02246
commit 0c6fa6e60f

View file

@ -9,6 +9,10 @@ class Post {
private $node;
public function __construct(NodeInterface $node) {
if ($node->bundle() != 'article') {
throw new \InvalidArgumentException();
}
$this->node = $node;
}