Passed
Push — trunk ( 9b0a66...54d57b )
by Christian
27:18 queued 11:16
created

InTestClassTrait::isInTestClass()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 11
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules;
4
5
use PHPStan\Analyser\Scope;
0 ignored issues
show
Bug introduced by
The type PHPStan\Analyser\Scope 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...
6
use Shopware\Core\Framework\Log\Package;
7
8
/**
9
 * @internal
10
 */
11
#[Package('core')]
12
trait InTestClassTrait
13
{
14
    protected function isInTestClass(Scope $scope): bool
15
    {
16
        if (!$scope->isInClass()) {
17
            return false;
18
        }
19
20
        $definitionClassReflection = $scope->getClassReflection()->getNativeReflection();
21
22
        $className = $definitionClassReflection->getName();
23
24
        return str_contains($className, 'Test');
25
    }
26
}
27