Passed
Push — 0.6.x ( ecdcc4...abcf7f )
by Shinji
02:26 queued 47s
created

TargetPhpSettings::isDecided()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * This file is part of the sj-i/php-profiler package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace PhpProfiler\Inspector\Settings\TargetPhpSettings;
15
16
use PhpProfiler\Lib\PhpInternals\ZendTypeReader;
17
18
/**
19
 * @psalm-type VersionDecided=value-of<ZendTypeReader::ALL_SUPPORTED_VERSIONS>
20
 * @template TVersion of VersionDecided|'auto'
21
 */
22
final class TargetPhpSettings
23
{
24
    public const PHP_REGEX_DEFAULT = '.*/(php(74|7.4|80|8.0|81|8.1)?|php-fpm|libphp[78]?.*\.so)$';
25
    public const LIBPTHREAD_REGEX_DEFAULT = '.*/libpthread.*\.so';
26
    public const TARGET_PHP_VERSION_DEFAULT = 'auto';
27
28
    /** @param TVersion $php_version */
0 ignored issues
show
Bug introduced by
The type PhpProfiler\Inspector\Se...getPhpSettings\TVersion 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...
29
    public function __construct(
30
        public string $php_regex = self::PHP_REGEX_DEFAULT,
31
        public string $libpthread_regex = self::LIBPTHREAD_REGEX_DEFAULT,
32
        public string $php_version = self::TARGET_PHP_VERSION_DEFAULT,
33
        public ?string $php_path = null,
34
        public ?string $libpthread_path = null
35
    ) {
36
    }
37
38
    /** @psalm-assert-if-true self<'v70'|'v71'|'v72'|'v73'|'v74'|'v80'|'v81'> $this */
39
    public function isDecided(): bool
40
    {
41
        return $this->php_version !== 'auto';
42
    }
43
}
44