Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Issue #31: function::getArguments: fixed function name mistakenly use…

…d as typehint for first typehint-less argument
  • Loading branch information...
commit 5a54d90329786b34165eb596e796bbc26389dab8 1 parent 5220af2
@soxofaan soxofaan authored
View
7 PHP/Token.php
@@ -376,10 +376,15 @@ public function getArguments()
}
$this->arguments = array();
- $i = $this->id + 2;
$tokens = $this->tokenStream->tokens();
$typeHint = NULL;
+ // Search for first token inside brackets
+ $i = $this->id + 2;
+ while (!$tokens[$i-1] instanceof PHP_Token_OPEN_BRACKET) {
+ $i++;
+ }
+
while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) {
if ($tokens[$i] instanceof PHP_Token_STRING) {
$typeHint = (string)$tokens[$i];
View
2  Tests/Token/FunctionTest.php
@@ -99,6 +99,8 @@ public function testGetArguments()
);
$this->assertEquals(array(), $this->functions[4]->getArguments());
+
+ $this->assertEquals(array('$x' => null, '$y' => null), $this->functions[5]->getArguments());
}
/**
View
4 Tests/_files/source.php
@@ -29,4 +29,8 @@ public function barfoo(Barfoo $barfoo)
public function baz()
{
}
+
+ public function blaz($x, $y)
+ {
+ }
}

0 comments on commit 5a54d90

Please sign in to comment.
Something went wrong with that request. Please try again.