Skip to content

Commit 02f9ed7

Browse files
committed
Remove deprecated code paths
Typed tags are no longer creatable via the create method. The parsing has become to complex to handle per tag. This logic has been moved into factories.
1 parent 889d86b commit 02f9ed7

38 files changed

+44
-1447
lines changed

src/DocBlock/Tags/Author.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* Reflection class for an {@}author tag in a Docblock.
2626
*/
27-
final class Author extends BaseTag implements Factory\StaticMethod
27+
final class Author extends BaseTag
2828
{
2929
/** @var string register that this is the author tag. */
3030
protected string $name = 'author';

src/DocBlock/Tags/Covers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/**
2828
* Reflection class for a @covers tag in a Docblock.
2929
*/
30-
final class Covers extends BaseTag implements Factory\StaticMethod
30+
final class Covers extends BaseTag
3131
{
3232
protected string $name = 'covers';
3333

src/DocBlock/Tags/Deprecated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* Reflection class for a {@}deprecated tag in a Docblock.
2525
*/
26-
final class Deprecated extends BaseTag implements Factory\StaticMethod
26+
final class Deprecated extends BaseTag
2727
{
2828
protected string $name = 'deprecated';
2929

src/DocBlock/Tags/Example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* Reflection class for a {@}example tag in a Docblock.
2828
*/
29-
final class Example implements Tag, Factory\StaticMethod
29+
final class Example implements Tag
3030
{
3131
/** @var string Path to a file to use as an example. May also be an absolute URI. */
3232
private string $filePath;

src/DocBlock/Tags/Extends_.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313

1414
namespace phpDocumentor\Reflection\DocBlock\Tags;
1515

16-
use Doctrine\Deprecations\Deprecation;
1716
use phpDocumentor\Reflection\DocBlock\Description;
18-
use phpDocumentor\Reflection\DocBlock\Tag;
1917
use phpDocumentor\Reflection\Type;
2018

2119
/**
@@ -29,20 +27,4 @@ public function __construct(Type $type, ?Description $description = null)
2927
$this->type = $type;
3028
$this->description = $description;
3129
}
32-
33-
/**
34-
* @deprecated Create using static factory is deprecated,
35-
* this method should not be called directly by library consumers
36-
*/
37-
public static function create(string $body): ?Tag
38-
{
39-
Deprecation::trigger(
40-
'phpdocumentor/reflection-docblock',
41-
'https://github.com/phpDocumentor/ReflectionDocBlock/issues/361',
42-
'Create using static factory is deprecated, this method should not be called directly
43-
by library consumers',
44-
);
45-
46-
return null;
47-
}
4830
}

src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use PHPStan\PhpDocParser\ParserConfig;
2525
use RuntimeException;
2626

27-
use function class_exists;
2827
use function ltrim;
2928
use function property_exists;
3029
use function rtrim;

src/DocBlock/Tags/Factory/ParamFactory.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
66

7-
use Doctrine\Deprecations\Deprecation;
87
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
98
use phpDocumentor\Reflection\DocBlock\Tag;
109
use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag;
@@ -20,7 +19,6 @@
2019
use Webmozart\Assert\Assert;
2120

2221
use function is_string;
23-
use function sprintf;
2422
use function trim;
2523

2624
/**
@@ -42,16 +40,7 @@ public function create(PhpDocTagNode $node, Context $context): Tag
4240
$tagValue = $node->value;
4341

4442
if ($tagValue instanceof InvalidTagValueNode) {
45-
Deprecation::trigger(
46-
'phpdocumentor/reflection-docblock',
47-
'https://github.com/phpDocumentor/ReflectionDocBlock/issues/362',
48-
sprintf(
49-
'Param tag value "%s" is invalid, falling back to legacy parsing. Please update your docblocks.',
50-
$tagValue->value
51-
)
52-
);
53-
54-
return Param::create($tagValue->value, $this->typeResolver, $this->descriptionFactory, $context);
43+
return InvalidTag::create($tagValue->value, 'param')->withError($tagValue->exception);
5544
}
5645

5746
Assert::isInstanceOfAny(

src/DocBlock/Tags/Factory/StaticMethod.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/DocBlock/Tags/Generic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/**
2626
* Parses a tag definition for a DocBlock.
2727
*/
28-
final class Generic extends BaseTag implements Factory\StaticMethod
28+
final class Generic extends BaseTag
2929
{
3030
/**
3131
* Parses a tag and populates the member variables.

src/DocBlock/Tags/Implements_.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313

1414
namespace phpDocumentor\Reflection\DocBlock\Tags;
1515

16-
use Doctrine\Deprecations\Deprecation;
1716
use phpDocumentor\Reflection\DocBlock\Description;
18-
use phpDocumentor\Reflection\DocBlock\Tag;
1917
use phpDocumentor\Reflection\Type;
2018

2119
/**
@@ -29,20 +27,4 @@ public function __construct(Type $type, ?Description $description = null)
2927
$this->type = $type;
3028
$this->description = $description;
3129
}
32-
33-
/**
34-
* @deprecated Create using static factory is deprecated,
35-
* this method should not be called directly by library consumers
36-
*/
37-
public static function create(string $body): ?Tag
38-
{
39-
Deprecation::trigger(
40-
'phpdocumentor/reflection-docblock',
41-
'https://github.com/phpDocumentor/ReflectionDocBlock/issues/361',
42-
'Create using static factory is deprecated, this method should not be called directly
43-
by library consumers',
44-
);
45-
46-
return null;
47-
}
4830
}

0 commit comments

Comments
 (0)