@@ -55,7 +55,7 @@ public function __construct(array $annotations = [], ?Context $context = null)
5555
5656 public function addAnnotation (object $ annotation , Context $ context ): void
5757 {
58- if ($ this ->annotations ->contains ($ annotation )) {
58+ if ($ this ->annotations ->offsetExists ($ annotation )) {
5959 return ;
6060 }
6161
@@ -72,7 +72,7 @@ public function addAnnotation(object $annotation, Context $context): void
7272 $ context ->annotations [] = $ annotation ;
7373 }
7474 }
75- $ this ->annotations ->attach ($ annotation , $ context );
75+ $ this ->annotations ->offsetSet ($ annotation , $ context );
7676 $ blacklist = property_exists ($ annotation , '_blacklist ' ) ? $ annotation ::$ _blacklist : [];
7777 foreach ($ annotation as $ property => $ value ) {
7878 if (in_array ($ property , $ blacklist )) {
@@ -297,8 +297,8 @@ public function getAnnotationsOfType($classes, bool $strict = false): array
297297 foreach ((array ) $ classes as $ class ) {
298298 /** @var OA\AbstractAnnotation $annotation */
299299 foreach ($ this ->annotations as $ annotation ) {
300- if ($ annotation instanceof $ class && (!$ strict || ($ annotation ->isRoot ($ class ) && !$ unique ->contains ($ annotation )))) {
301- $ unique ->attach ($ annotation );
300+ if ($ annotation instanceof $ class && (!$ strict || ($ annotation ->isRoot ($ class ) && !$ unique ->offsetExists ($ annotation )))) {
301+ $ unique ->offsetSet ($ annotation );
302302 $ annotations [] = $ annotation ;
303303 }
304304 }
@@ -349,7 +349,7 @@ public function getContext(object $annotation): ?Context
349349 if ($ annotation instanceof OA \AbstractAnnotation) {
350350 return $ annotation ->_context ;
351351 }
352- if ($ this ->annotations ->contains ($ annotation ) === false ) {
352+ if ($ this ->annotations ->offsetExists ($ annotation ) === false ) {
353353 throw new OpenApiException ('Annotation not found ' );
354354 }
355355 $ context = $ this ->annotations [$ annotation ];
@@ -396,8 +396,8 @@ public function split(): \stdClass
396396 $ result ->merged = $ this ->merged ();
397397 $ result ->unmerged = new Analysis ([], $ this ->context );
398398 foreach ($ this ->annotations as $ annotation ) {
399- if ($ result ->merged ->annotations ->contains ($ annotation ) === false ) {
400- $ result ->unmerged ->annotations ->attach ($ annotation , $ this ->annotations [$ annotation ]);
399+ if ($ result ->merged ->annotations ->offsetExists ($ annotation ) === false ) {
400+ $ result ->unmerged ->annotations ->offsetSet ($ annotation , $ this ->annotations [$ annotation ]);
401401 }
402402 }
403403
0 commit comments