@@ -395,7 +395,7 @@ public function addMember($member): self
395
395
if ($ this ->isInterface ()) {
396
396
$ member ->setBody (null );
397
397
}
398
- $ this ->methods [$ member ->getName ()] = $ member ;
398
+ $ this ->methods [strtolower ( $ member ->getName () )] = $ member ;
399
399
400
400
} elseif ($ member instanceof Property) {
401
401
$ this ->properties [$ member ->getName ()] = $ member ;
@@ -563,8 +563,8 @@ public function setMethods(array $methods): self
563
563
{
564
564
(function (Method ...$ methods ) {})(...array_values ($ methods ));
565
565
$ 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 ;
568
568
}
569
569
return $ this ;
570
570
}
@@ -573,16 +573,21 @@ public function setMethods(array $methods): self
573
573
/** @return Method[] */
574
574
public function getMethods (): array
575
575
{
576
- return $ this ->methods ;
576
+ $ res = [];
577
+ foreach ($ this ->methods as $ m ) {
578
+ $ res [$ m ->getName ()] = $ m ;
579
+ }
580
+ return $ res ;
577
581
}
578
582
579
583
580
584
public function getMethod (string $ name ): Method
581
585
{
582
- if (!isset ($ this ->methods [$ name ])) {
586
+ $ m = $ this ->methods [strtolower ($ name )] ?? null ;
587
+ if (!$ m ) {
583
588
throw new Nette \InvalidArgumentException ("Method ' $ name' not found. " );
584
589
}
585
- return $ this -> methods [ $ name ] ;
590
+ return $ m ;
586
591
}
587
592
588
593
@@ -594,21 +599,21 @@ public function addMethod(string $name): Method
594
599
} else {
595
600
$ method ->setPublic ();
596
601
}
597
- return $ this ->methods [$ name ] = $ method ;
602
+ return $ this ->methods [strtolower ( $ name) ] = $ method ;
598
603
}
599
604
600
605
601
606
/** @return static */
602
607
public function removeMethod (string $ name ): self
603
608
{
604
- unset($ this ->methods [$ name ]);
609
+ unset($ this ->methods [strtolower ( $ name) ]);
605
610
return $ this ;
606
611
}
607
612
608
613
609
614
public function hasMethod (string $ name ): bool
610
615
{
611
- return isset ($ this ->methods [$ name ]);
616
+ return isset ($ this ->methods [strtolower ( $ name) ]);
612
617
}
613
618
614
619
0 commit comments