Skip to content

Commit aeae59d

Browse files
authored
Merge pull request barryvdh#740 from JeppeKnockaert/fix-cannot-redeclare-method
bugfix - Prevent redeclaring methods inside Aliases
2 parents 99226c9 + 0017192 commit aeae59d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Alias.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ public function getNamespace()
176176
*/
177177
public function getMethods()
178178
{
179+
if (count($this->methods) > 0) {
180+
return $this->methods;
181+
}
182+
179183
$this->addMagicMethods();
180184
$this->detectMethods();
181185
return $this->methods;
@@ -411,10 +415,9 @@ public function getDocComment($prefix = "\t\t")
411415
*/
412416
protected function removeDuplicateMethodsFromPhpDoc()
413417
{
414-
$methods = count($this->methods) > 0 ? $this->methods : $this->getMethods();
415418
$methodNames = array_map(function (Method $method) {
416419
return $method->getName();
417-
}, $methods);
420+
}, $this->getMethods());
418421

419422
foreach ($this->phpdoc->getTags() as $tag) {
420423
if ($tag instanceof MethodTag && in_array($tag->getMethodName(), $methodNames)) {

0 commit comments

Comments
 (0)