Throw an Exception if it is the wrong type
This commit is contained in:
parent
4be8e02246
commit
0c6fa6e60f
|
@ -9,6 +9,10 @@ class Post {
|
|||
private $node;
|
||||
|
||||
public function __construct(NodeInterface $node) {
|
||||
if ($node->bundle() != 'article') {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
$this->node = $node;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue