Issues (11)

src/Fqn.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jerowork\ClassDependenciesParser;
6
7
use Stringable;
8
9
final class Fqn implements Stringable
10
{
11
    private const NAMESPACE_DIVIDER = '\\';
12
13 19
    public function __construct(
14
        public readonly string $fqn,
15
    ) {
16 19
    }
17
18
    /**
19
     * @param list<string> $parts
0 ignored issues
show
The type Jerowork\ClassDependenciesParser\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
     */
21 4
    public static function createFromParts(array $parts): self
22
    {
23 4
        return new self(implode(self::NAMESPACE_DIVIDER, $parts));
24
    }
25
26 12
    public function __toString(): string
27
    {
28 12
        return $this->fqn;
29
    }
30
31
    /**
32
     * @return list<string>
33
     */
34 8
    public function getParts(): array
35
    {
36 8
        return explode(self::NAMESPACE_DIVIDER, $this->fqn);
0 ignored issues
show
Bug Best Practice introduced by
The expression return explode(self::NAM...CE_DIVIDER, $this->fqn) returns the type string[] which is incompatible with the documented return type Jerowork\ClassDependenciesParser\list.
Loading history...
37
    }
38
39 5
    public function getFullFqnWithoutLastPart(): string
40
    {
41 5
        $parts = $this->getParts();
42 5
        array_pop($parts);
43
44 5
        return implode(self::NAMESPACE_DIVIDER, $parts);
45
    }
46
47 6
    public function getLastPart(): string
48
    {
49 6
        $parts = $this->getParts();
50
51 6
        return (string) array_pop($parts);
52
    }
53
54 4
    public function equals(self $that): bool
55
    {
56 4
        return $this->fqn === $that->fqn;
57
    }
58
}
59