#6068 hardened test logic to verify that nothing is present after the |null
in @var
and @return
types
This commit is contained in:
parent
a4f76bda34
commit
f8002ca27e
@ -1080,17 +1080,25 @@ class
|
|||||||
*/
|
*/
|
||||||
private function assertPhpDocVarType($type, \ReflectionProperty $property)
|
private function assertPhpDocVarType($type, \ReflectionProperty $property)
|
||||||
{
|
{
|
||||||
$this->assertEquals(1, preg_match('/@var\s+([^\s]+)/',$property->getDocComment(), $matches));
|
$docComment = $property->getDocComment();
|
||||||
|
$regex = '/@var\s+([\S]+)$/m';
|
||||||
|
|
||||||
|
$this->assertRegExp($regex, $docComment);
|
||||||
|
$this->assertEquals(1, preg_match($regex, $docComment, $matches));
|
||||||
$this->assertEquals($type, $matches[1]);
|
$this->assertEquals($type, $matches[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @param \ReflectionProperty $method
|
* @param \ReflectionMethod $method
|
||||||
*/
|
*/
|
||||||
private function assertPhpDocReturnType($type, \ReflectionMethod $method)
|
private function assertPhpDocReturnType($type, \ReflectionMethod $method)
|
||||||
{
|
{
|
||||||
$this->assertEquals(1, preg_match('/@return\s+([^\s]+)/', $method->getDocComment(), $matches));
|
$docComment = $method->getDocComment();
|
||||||
|
$regex = '/@return\s+([\S]+)(\s+.*)$/m';
|
||||||
|
|
||||||
|
$this->assertRegExp($regex, $docComment);
|
||||||
|
$this->assertEquals(1, preg_match($regex, $docComment, $matches));
|
||||||
$this->assertEquals($type, $matches[1]);
|
$this->assertEquals($type, $matches[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user