Skip to content

Commit 11232c4

Browse files
committed
Add "@ignore" tag support
1 parent 841a43e commit 11232c4

File tree

5 files changed

+55
-2
lines changed

5 files changed

+55
-2
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ composer require type-lang/phpdoc
4343
- [ ] `@filesource` - TODO
4444
- [x] `@final` - Declare any _Symbol_ as final
4545
- [ ] `@global` - TODO
46-
- [ ] `@ignore` - TODO
46+
- [x] `@ignore` - Used to tell documentation systems that _Symbol_ are not to be processed.
4747
- [x] `@implements` - Allows to extend templated interfaces
4848
- [ ] `@inheritdoc` - TODO
4949
- [x] `@inherits` - An alias of `@extends` tag

Diff for: src/DocBlock/Tag/AbstractTag/AbstractTagFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* This class is responsible for creating "`@abstract`" tags.
1313
*
14-
* See {@see AbstractTag} for details about this tag.
14+
* See {@see IgnoreTag} for details about this tag.
1515
*/
1616
final class AbstractTagFactory implements TagFactoryInterface
1717
{

Diff for: src/DocBlock/Tag/IgnoreTag/IgnoreTag.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace TypeLang\PHPDoc\DocBlock\Tag\IgnoreTag;
6+
7+
use TypeLang\PHPDoc\DocBlock\Tag\Tag;
8+
9+
/**
10+
* Used to tell documentation systems that _Symbol_ are not to be processed.
11+
*
12+
* ```
13+
* "@ignore" [<description>]
14+
* ```
15+
*/
16+
final class IgnoreTag extends Tag
17+
{
18+
public function __construct(
19+
string $name,
20+
\Stringable|string|null $description = null,
21+
) {
22+
parent::__construct($name, $description);
23+
}
24+
}

Diff for: src/DocBlock/Tag/IgnoreTag/IgnoreTagFactory.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace TypeLang\PHPDoc\DocBlock\Tag\IgnoreTag;
6+
7+
use TypeLang\PHPDoc\DocBlock\Tag\Factory\TagFactoryInterface;
8+
use TypeLang\PHPDoc\Parser\Content\Stream;
9+
use TypeLang\PHPDoc\Parser\Description\DescriptionParserInterface;
10+
11+
/**
12+
* This class is responsible for creating "`@ignore`" tags.
13+
*
14+
* See {@see IgnoreTag} for details about this tag.
15+
*/
16+
final class IgnoreTagFactory implements TagFactoryInterface
17+
{
18+
public function create(string $tag, string $content, DescriptionParserInterface $descriptions): IgnoreTag
19+
{
20+
$stream = new Stream($tag, $content);
21+
22+
return new IgnoreTag(
23+
name: $tag,
24+
description: $stream->toOptionalDescription($descriptions),
25+
);
26+
}
27+
}

Diff for: src/Platform/StandardPlatform.php

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use TypeLang\PHPDoc\DocBlock\Tag\AbstractTag\AbstractTagFactory;
99
use TypeLang\PHPDoc\DocBlock\Tag\Factory\TagFactoryInterface;
1010
use TypeLang\PHPDoc\DocBlock\Tag\FinalTag\FinalTagFactory;
11+
use TypeLang\PHPDoc\DocBlock\Tag\IgnoreTag\IgnoreTagFactory;
1112
use TypeLang\PHPDoc\DocBlock\Tag\LinkTag\LinkTagFactory;
1213
use TypeLang\PHPDoc\DocBlock\Tag\MethodTag\MethodTagFactory;
1314
use TypeLang\PHPDoc\DocBlock\Tag\ParamTag\ParamTagFactory;
@@ -37,6 +38,7 @@ protected function load(TypesParserInterface $types): iterable
3738
yield 'extends' => new TemplateExtendsTagFactory($types);
3839
yield 'final' => new FinalTagFactory();
3940
yield 'implements' => new TemplateImplementsTagFactory($types);
41+
yield 'ignore' => new IgnoreTagFactory();
4042
yield 'link' => new LinkTagFactory();
4143
yield 'method' => new MethodTagFactory($types);
4244
yield 'param' => new ParamTagFactory($types);

0 commit comments

Comments
 (0)