mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Be more strict about type definitions on param
Throw on invalid type definitions and unexpected type definitions. Not all types resolved by phpstan's parser are valid for docblocks, they might in a more complex type system but I do not see how these types would ever apply to param tags.
This commit is contained in:
@@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Param;
|
||||
use phpDocumentor\Reflection\Fqsen;
|
||||
use phpDocumentor\Reflection\PseudoTypes\IntegerValue;
|
||||
@@ -33,7 +35,7 @@ final class ParamFactoryTest extends TagFactoryTestCase
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory::supports
|
||||
* @dataProvider paramInputProvider
|
||||
*/
|
||||
public function testParamIsCreated(string $input, Param $expected): void
|
||||
public function testParamIsCreated(string $input, Tag $expected): void
|
||||
{
|
||||
$ast = $this->parseTag($input);
|
||||
$factory = new ParamFactory($this->giveTypeResolver(), $this->givenDescriptionFactory());
|
||||
@@ -122,6 +124,10 @@ final class ParamFactoryTest extends TagFactoryTestCase
|
||||
false
|
||||
),
|
||||
],
|
||||
[
|
||||
'@param array[\Illuminate\Notifications\Channels\Notification] $notification',
|
||||
InvalidTag::create('array[\Illuminate\Notifications\Channels\Notification] $notification', 'param'),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user