@@ -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 }
@@ -340,7 +340,7 @@ public function getContext(object $annotation): ?Context
340340 if ($ annotation instanceof OA \AbstractAnnotation) {
341341 return $ annotation ->_context ;
342342 }
343- if ($ this ->annotations ->contains ($ annotation ) === false ) {
343+ if ($ this ->annotations ->offsetExists ($ annotation ) === false ) {
344344 throw new OpenApiException ('Annotation not found ' );
345345 }
346346 $ context = $ this ->annotations [$ annotation ];
@@ -387,8 +387,8 @@ public function split(): \stdClass
387387 $ result ->merged = $ this ->merged ();
388388 $ result ->unmerged = new Analysis ([], $ this ->context );
389389 foreach ($ this ->annotations as $ annotation ) {
390- if ($ result ->merged ->annotations ->contains ($ annotation ) === false ) {
391- $ result ->unmerged ->annotations ->attach ($ annotation , $ this ->annotations [$ annotation ]);
390+ if ($ result ->merged ->annotations ->offsetExists ($ annotation ) === false ) {
391+ $ result ->unmerged ->annotations ->offsetSet ($ annotation , $ this ->annotations [$ annotation ]);
392392 }
393393 }
394394
0 commit comments