Skip to content

Commit 37d9a93

Browse files
committed
fix issue #2 - we must be able to define a parameter using a namespaced variable
1 parent 7687dc7 commit 37d9a93

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Element/PhpFunctionParameter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function setType($type)
3737
*/
3838
public static function typeIsValid($type)
3939
{
40-
return $type === null || self::stringIsValid($type) || $type instanceof PhpClass;
40+
return $type === null || self::stringIsValid($type, true, true) || $type instanceof PhpClass;
4141
}
4242
/**
4343
* @return string|PhpClass

Tests/Element/PhpFunctionParameterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,11 @@ public function testToStringEmptyArrayValue()
4848

4949
$this->assertSame('array $foo = array()', $functionParameter->toString());
5050
}
51+
52+
public function testToStringWithNamespace()
53+
{
54+
$functionParameter = new PhpFunctionParameter('foo', null, 'My\Name\Space');
55+
56+
$this->assertSame('My\Name\Space $foo = null', $functionParameter->toString());
57+
}
5158
}

0 commit comments

Comments
 (0)