• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

voku / Simple-PHP-Code-Parser / 12186673668

05 Dec 2024 07:26PM UTC coverage: 79.926% (-2.3%) from 82.259%
12186673668

Pull #54

github

web-flow
Merge 30436eb42 into 898f2c327
Pull Request #54: Update actions/cache action to v4

1302 of 1629 relevant lines covered (79.93%)

6.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.96
/src/voku/SimplePhpParser/Model/PHPDocElement.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace voku\SimplePhpParser\Model;
6

7
use PhpParser\Node;
8
use voku\SimplePhpParser\Parsers\Helper\DocFactoryProvider;
9

10
trait PHPDocElement
11
{
12
    /**
13
     * @var \phpDocumentor\Reflection\DocBlock\Tag[]
14
     */
15
    public array $linkTags = [];
16

17
    /**
18
     * @var \phpDocumentor\Reflection\DocBlock\Tag[]
19
     */
20
    public array $seeTags = [];
21

22
    /**
23
     * @var \phpDocumentor\Reflection\DocBlock\Tag[]
24
     */
25
    public array $sinceTags = [];
26

27
    /**
28
     * @var \phpDocumentor\Reflection\DocBlock\Tag[]
29
     */
30
    public array $deprecatedTags = [];
31

32
    /**
33
     * @var \phpDocumentor\Reflection\DocBlock\Tag[]
34
     */
35
    public array $metaTags = [];
36

37
    /**
38
     * @var \phpDocumentor\Reflection\DocBlock\Tag[]
39
     */
40
    public array $internalTags = [];
41

42
    /**
43
     * @var \phpDocumentor\Reflection\DocBlock\Tag[]
44
     */
45
    public array $removedTags = [];
46

47
    /**
48
     * @var string[]
49
     *
50
     * @phpstan-var array<string, string>
51
     */
52
    public array $tagNames = [];
53

54
    public bool $hasLinkTag = false;
55

56
    public bool $hasSeeTag = false;
57

58
    public bool $hasSinceTag = false;
59

60
    public bool $hasDeprecatedTag = false;
61

62
    public bool $hasMetaTag = false;
63

64
    /**
65
     * @var bool
66
     */
67
    public bool $hasInternalTag = false;
68

69
    public bool $hasRemovedTag = false;
70

71
    protected function collectTags(Node $node): void
72
    {
73
        $docComment = $node->getDocComment();
16✔
74
        if ($docComment) {
16✔
75
            try {
76
                $phpDoc = DocFactoryProvider::getDocFactory()->create((string)$docComment->getText());
14✔
77

78
                $tags = $phpDoc->getTags();
14✔
79
                foreach ($tags as $tag) {
14✔
80
                    $this->tagNames[$tag->getName()] = $tag->render();
14✔
81
                }
82

83
                $this->linkTags = $phpDoc->getTagsByName('link');
14✔
84
                $this->seeTags = $phpDoc->getTagsByName('see');
14✔
85
                $this->sinceTags = $phpDoc->getTagsByName('since');
14✔
86
                $this->deprecatedTags = $phpDoc->getTagsByName('deprecated');
14✔
87
                $this->metaTags = $phpDoc->getTagsByName('meta');
14✔
88
                $this->internalTags = $phpDoc->getTagsByName('internal');
14✔
89
                $this->removedTags = $phpDoc->getTagsByName('removed');
14✔
90

91
                $this->hasLinkTag = $phpDoc->hasTag('link');
14✔
92
                $this->hasSeeTag = $phpDoc->hasTag('see');
14✔
93
                $this->hasSinceTag = $phpDoc->hasTag('since');
14✔
94
                $this->hasDeprecatedTag = $phpDoc->hasTag('deprecated');
14✔
95
                $this->hasMetaTag = $phpDoc->hasTag('meta');
14✔
96
                $this->hasInternalTag = $phpDoc->hasTag('internal');
14✔
97
                $this->hasRemovedTag = $phpDoc->hasTag('removed');
14✔
98
            } catch (\Exception $e) {
×
99
                $tmpErrorMessage = $this->name . ':' . ($this->line ?? '?') . ' | ' . \print_r($e->getMessage(), true);
×
100
                $this->parseError[\md5($tmpErrorMessage)] = $tmpErrorMessage;
×
101
            }
102
        }
103
    }
104
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc