File tree Expand file tree Collapse file tree 4 files changed +62
-1
lines changed
DocBlock/Tag/CopyrightTag Expand file tree Collapse file tree 4 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ composer require type-lang/phpdoc
3636- [x] `@api` - Highlight _Symbol_ as being part of the public API
3737- [ ] `@author` - TODO
3838- [ ] `@category` - TODO
39- - [ ] `@copyright` - TODO
39+ - [x ] `@copyright` - Used to document the copyright information of any _Symbol_.
4040- [ ] `@deprecated` - TODO
4141- [ ] `@example` - TODO
4242- [x] `@extends` - Allows to extend templated classes and interfaces
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare(strict_types=1);
4+
5+ namespace TypeLang\PHPDoc\DocBlock\Tag\CopyrightTag;
6+
7+ use TypeLang\PHPDoc\DocBlock\Tag\Tag;
8+
9+ /**
10+ * Used to document the copyright information of any _Symbol_.
11+ *
12+ * The "`@copyright`" tag defines who holds the copyright over the _Symbol_.
13+ * The copyright indicated with this tag applies to the _Symbol_ with which
14+ * it is associated and all child elements unless otherwise noted.
15+ *
16+ * The format of the description is governed by the coding standard of each
17+ * individual project. It is RECOMMENDED to mention the year or years which
18+ * are covered by this copyright and the organization involved.
19+ *
20+ * ```
21+ * "@copyright" [<description>]
22+ * ```
23+ */
24+ final class CopyrightTag extends Tag
25+ {
26+ public function __construct(
27+ string $name,
28+ \Stringable|string|null $description = null,
29+ ) {
30+ parent::__construct($name, $description);
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare(strict_types=1);
4+
5+ namespace TypeLang\PHPDoc\DocBlock\Tag\CopyrightTag;
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 "`@copyright`" tags.
13+ *
14+ * See {@see CopyrightTag} for details about this tag.
15+ */
16+ final class CopyrightTagFactory implements TagFactoryInterface
17+ {
18+ public function create(string $tag, string $content, DescriptionParserInterface $descriptions): CopyrightTag
19+ {
20+ $stream = new Stream($tag, $content);
21+
22+ return new CopyrightTag(
23+ name: $tag,
24+ description: $stream->toOptionalDescription($descriptions),
25+ );
26+ }
27+ }
Original file line number Diff line number Diff line change 77use TypeLang\Parser\ParserInterface as TypesParserInterface;
88use TypeLang\PHPDoc\DocBlock\Tag\AbstractTag\AbstractTagFactory;
99use TypeLang\PHPDoc\DocBlock\Tag\ApiTag\ApiTagFactory;
10+ use TypeLang\PHPDoc\DocBlock\Tag\CopyrightTag\CopyrightTagFactory;
1011use TypeLang\PHPDoc\DocBlock\Tag\Factory\TagFactoryInterface;
1112use TypeLang\PHPDoc\DocBlock\Tag\FinalTag\FinalTagFactory;
1213use TypeLang\PHPDoc\DocBlock\Tag\IgnoreTag\IgnoreTagFactory;
@@ -41,6 +42,7 @@ protected function load(TypesParserInterface $types): iterable
4142 {
4243 yield 'abstract' => new AbstractTagFactory();
4344 yield 'api' => new ApiTagFactory();
45+ yield 'copyright' => new CopyrightTagFactory();
4446 yield 'extends' => new TemplateExtendsTagFactory($types);
4547 yield 'final' => new FinalTagFactory();
4648 yield 'implements' => new TemplateImplementsTagFactory($types);
You can’t perform that action at this time.
0 commit comments