Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
TraitSymbol
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getUses
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAutoloadAliasArray
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace BrianHenryIE\Strauss\Types;
4
5use BrianHenryIE\Strauss\Composer\ComposerPackage;
6use BrianHenryIE\Strauss\Files\FileBase;
7
8/**
9 * @phpstan-import-type TraitAliasArray from AutoloadAliasInterface
10 */
11class TraitSymbol extends DiscoveredSymbol implements AutoloadAliasInterface
12{
13    /**
14     * @var string[]
15     */
16    protected array $uses;
17
18    /**
19     * @param string $fqdnClassname
20     * @param FileBase $sourceFile
21     * @param ?string $namespace
22     * @param ?ComposerPackage $composerPackage
23     * @param ?string[] $uses
24     */
25    public function __construct(
26        string $fqdnClassname,
27        FileBase $sourceFile,
28        ?string $namespace = null,
29        ?ComposerPackage $composerPackage = null,
30        ?array $uses = null
31    ) {
32        parent::__construct($fqdnClassname, $sourceFile, $namespace ?? '\\', $composerPackage);
33
34        $this->uses = (array) $uses;
35    }
36
37    /**
38     * @return string[]
39     */
40    public function getUses(): array
41    {
42        return $this->uses;
43    }
44
45    /**
46     * @return TraitAliasArray
47     */
48    public function getAutoloadAliasArray(): array
49    {
50        return array (
51            'type' => 'trait',
52            'traitname' => $this->getOriginalLocalName(),
53            'namespace' => $this->namespace,
54            'use' => [$this->getReplacement()],
55        );
56    }
57}