File tree 4 files changed +62
-1
lines changed
DocBlock/Tag/CopyrightTag
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
36
36
- [x] ` @api ` - Highlight _ Symbol_ as being part of the public API
37
37
- [ ] ` @author ` - TODO
38
38
- [ ] ` @category ` - TODO
39
- - [ ] ` @copyright ` - TODO
39
+ - [x ] ` @copyright ` - Used to document the copyright information of any _ Symbol _ .
40
40
- [ ] ` @deprecated ` - TODO
41
41
- [ ] ` @example ` - TODO
42
42
- [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 7
7
use TypeLang \Parser \ParserInterface as TypesParserInterface ;
8
8
use TypeLang \PHPDoc \DocBlock \Tag \AbstractTag \AbstractTagFactory ;
9
9
use TypeLang \PHPDoc \DocBlock \Tag \ApiTag \ApiTagFactory ;
10
+ use TypeLang \PHPDoc \DocBlock \Tag \CopyrightTag \CopyrightTagFactory ;
10
11
use TypeLang \PHPDoc \DocBlock \Tag \Factory \TagFactoryInterface ;
11
12
use TypeLang \PHPDoc \DocBlock \Tag \FinalTag \FinalTagFactory ;
12
13
use TypeLang \PHPDoc \DocBlock \Tag \IgnoreTag \IgnoreTagFactory ;
@@ -41,6 +42,7 @@ protected function load(TypesParserInterface $types): iterable
41
42
{
42
43
yield 'abstract ' => new AbstractTagFactory ();
43
44
yield 'api ' => new ApiTagFactory ();
45
+ yield 'copyright ' => new CopyrightTagFactory ();
44
46
yield 'extends ' => new TemplateExtendsTagFactory ($ types );
45
47
yield 'final ' => new FinalTagFactory ();
46
48
yield 'implements ' => new TemplateImplementsTagFactory ($ types );
You can’t perform that action at this time.
0 commit comments