@@ -84,7 +84,7 @@ public function getUses(): array
8484 */
8585 public function addConstant (PhpConstant $ constant ): static
8686 {
87- if ($ this ->constants ->contains ($ constant ->getIdentifier ())) {
87+ if ($ this ->constants ->offsetExists ($ constant ->getIdentifier ())) {
8888 throw new DuplicateValue (sprintf (
8989 'A constant of the name (%s) does already exist. ' ,
9090 $ constant ->getIdentifier ()->getName (),
@@ -131,7 +131,7 @@ public function addVariable(PhpVariable $variable, bool $createGetterSetter = fa
131131 */
132132 public function addMethod (PhpMethod $ method ): static
133133 {
134- if ($ this ->methods ->contains ($ method ->getIdentifier ())) {
134+ if ($ this ->methods ->offsetExists ($ method ->getIdentifier ())) {
135135 throw new DuplicateValue (sprintf (
136136 'A method of the name (%s) is already defined. ' ,
137137 $ method ->getIdentifier ()->getName (),
@@ -160,7 +160,7 @@ public function replaceMethod(Identifier|string $identifier, PhpMethod $method):
160160 public function hasVariable (Identifier |string $ identifier ): bool
161161 {
162162 $ identifier = Identifier::fromUnknown ($ identifier );
163- return $ this ->variables ->contains ($ identifier );
163+ return $ this ->variables ->offsetExists ($ identifier );
164164 }
165165
166166 /**
@@ -169,7 +169,7 @@ public function hasVariable(Identifier|string $identifier): bool
169169 public function hasMethod (Identifier |string $ identifier ): bool
170170 {
171171 $ identifier = Identifier::fromUnknown ($ identifier );
172- return $ this ->methods ->contains ($ identifier );
172+ return $ this ->methods ->offsetExists ($ identifier );
173173 }
174174
175175 /**
@@ -178,7 +178,7 @@ public function hasMethod(Identifier|string $identifier): bool
178178 public function hasConstant (Identifier |string $ identifier ): bool
179179 {
180180 $ identifier = Identifier::fromUnknown ($ identifier );
181- return $ this ->constants ->contains ($ identifier );
181+ return $ this ->constants ->offsetExists ($ identifier );
182182 }
183183
184184 public function getVariable (Identifier |string $ identifier ): ?PhpVariable
0 commit comments