From 32648ab5ab313cad7328b47ef240e15e6ee1f104 Mon Sep 17 00:00:00 2001 From: Andrew Nagy <564256+tm1000@users.noreply.github.com> Date: Tue, 10 Sep 2024 02:02:09 -0700 Subject: [PATCH] Add hasTrait method (#163) Add hasTrait method copying other Aware Traits --- src/PhpGenerator/Traits/TraitsAware.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PhpGenerator/Traits/TraitsAware.php b/src/PhpGenerator/Traits/TraitsAware.php index adf2ad4f..23bdc4e2 100644 --- a/src/PhpGenerator/Traits/TraitsAware.php +++ b/src/PhpGenerator/Traits/TraitsAware.php @@ -67,4 +67,9 @@ public function removeTrait(string $name): static unset($this->traits[$name]); return $this; } + + public function hasTrait(string $name): bool + { + return isset($this->traits[$name]); + } }