@@ -121,6 +121,48 @@ public function getName(): ?string
121121 }
122122
123123
124+ /** @return static */
125+ public function setClass (): self
126+ {
127+ $ this ->type = self ::TYPE_CLASS ;
128+ return $ this ;
129+ }
130+
131+
132+ public function isClass (): bool
133+ {
134+ return $ this ->type === self ::TYPE_CLASS ;
135+ }
136+
137+
138+ /** @return static */
139+ public function setInterface (): self
140+ {
141+ $ this ->type = self ::TYPE_INTERFACE ;
142+ return $ this ;
143+ }
144+
145+
146+ public function isInterface (): bool
147+ {
148+ return $ this ->type === self ::TYPE_INTERFACE ;
149+ }
150+
151+
152+ /** @return static */
153+ public function setTrait (): self
154+ {
155+ $ this ->type = self ::TYPE_TRAIT ;
156+ return $ this ;
157+ }
158+
159+
160+ public function isTrait (): bool
161+ {
162+ return $ this ->type === self ::TYPE_TRAIT ;
163+ }
164+
165+
124166 /** @return static */
125167 public function setType (string $ type ): self
126168 {
@@ -268,7 +310,7 @@ public function addTrait(string $name, array $resolutions = []): self
268310 public function addMember ($ member ): self
269311 {
270312 if ($ member instanceof Method) {
271- if ($ this ->type === self :: TYPE_INTERFACE ) {
313+ if ($ this ->isInterface () ) {
272314 $ member ->setBody (null );
273315 }
274316 $ this ->methods [$ member ->getName ()] = $ member ;
@@ -418,7 +460,7 @@ public function getMethod(string $name): Method
418460 public function addMethod (string $ name ): Method
419461 {
420462 $ method = new Method ($ name );
421- if ($ this ->type === self :: TYPE_INTERFACE ) {
463+ if ($ this ->isInterface () ) {
422464 $ method ->setBody (null );
423465 } else {
424466 $ method ->setPublic ();
0 commit comments