@@ -395,7 +395,7 @@ public function addMember($member): self
395395 if ($ this ->isInterface ()) {
396396 $ member ->setBody (null );
397397 }
398- $ this ->methods [$ member ->getName ()] = $ member ;
398+ $ this ->methods [strtolower ( $ member ->getName () )] = $ member ;
399399
400400 } elseif ($ member instanceof Property) {
401401 $ this ->properties [$ member ->getName ()] = $ member ;
@@ -563,8 +563,8 @@ public function setMethods(array $methods): self
563563 {
564564 (function (Method ...$ methods ) {})(...array_values ($ methods ));
565565 $ this ->methods = [];
566- foreach ($ methods as $ v ) {
567- $ this ->methods [$ v ->getName ()] = $ v ;
566+ foreach ($ methods as $ m ) {
567+ $ this ->methods [strtolower ( $ m ->getName ()) ] = $ m ;
568568 }
569569 return $ this ;
570570 }
@@ -573,16 +573,21 @@ public function setMethods(array $methods): self
573573 /** @return Method[] */
574574 public function getMethods (): array
575575 {
576- return $ this ->methods ;
576+ $ res = [];
577+ foreach ($ this ->methods as $ m ) {
578+ $ res [$ m ->getName ()] = $ m ;
579+ }
580+ return $ res ;
577581 }
578582
579583
580584 public function getMethod (string $ name ): Method
581585 {
582- if (!isset ($ this ->methods [$ name ])) {
586+ $ m = $ this ->methods [strtolower ($ name )] ?? null ;
587+ if (!$ m ) {
583588 throw new Nette \InvalidArgumentException ("Method ' $ name' not found. " );
584589 }
585- return $ this -> methods [ $ name ] ;
590+ return $ m ;
586591 }
587592
588593
@@ -594,21 +599,21 @@ public function addMethod(string $name): Method
594599 } else {
595600 $ method ->setPublic ();
596601 }
597- return $ this ->methods [$ name ] = $ method ;
602+ return $ this ->methods [strtolower ( $ name) ] = $ method ;
598603 }
599604
600605
601606 /** @return static */
602607 public function removeMethod (string $ name ): self
603608 {
604- unset($ this ->methods [$ name ]);
609+ unset($ this ->methods [strtolower ( $ name) ]);
605610 return $ this ;
606611 }
607612
608613
609614 public function hasMethod (string $ name ): bool
610615 {
611- return isset ($ this ->methods [$ name ]);
616+ return isset ($ this ->methods [strtolower ( $ name) ]);
612617 }
613618
614619
0 commit comments