diff --git a/web/modules/custom/example/src/PostWrapper.php b/web/modules/custom/example/src/PostWrapper.php index 849dcba..75e4309 100644 --- a/web/modules/custom/example/src/PostWrapper.php +++ b/web/modules/custom/example/src/PostWrapper.php @@ -6,7 +6,13 @@ use Drupal\node\NodeInterface; final class PostWrapper { + /** + * @throws \InvalidArgumentException + */ public function __construct(private NodeInterface $post) { + if ($post->bundle() !== 'post') { + throw new \InvalidArgumentException(); + } } public function getType(): string {