diff --git a/src/Element/TypeHintedElementTrait.php b/src/Element/TypeHintedElementTrait.php index b737c4c..9db14da 100644 --- a/src/Element/TypeHintedElementTrait.php +++ b/src/Element/TypeHintedElementTrait.php @@ -34,7 +34,7 @@ public static function typeIsValid($type): bool return is_null($type) || $type instanceof PhpClass - || (is_string($type) && class_exists($type)) + || (is_string($type) && class_exists($type, false)) || in_array($type, TypeHintedElementInterface::TYPES, true) || static::stringIsValid($type, true, true); } diff --git a/tests/Element/PhpFunctionParameterTest.php b/tests/Element/PhpFunctionParameterTest.php index ab0c21a..77114e3 100755 --- a/tests/Element/PhpFunctionParameterTest.php +++ b/tests/Element/PhpFunctionParameterTest.php @@ -46,6 +46,11 @@ public function testTypeIsValidAccentuated() $this->assertTrue(PhpFunctionParameter::typeIsValid('Partagé')); } + public function testTypeIsValidWithUnloadedFullyQualifiedClassName() + { + $this->assertTrue(PhpFunctionParameter::typeIsValid('\\Some\\Namespace\\NonExistentClass')); + } + public function testFloatValueForDeclaration() { $initialSerializePrecision = ini_get('serialize_precision');