Issues (83)

Reflection/RepositoryMagicFindExtension.php (6 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Mapado\RestClientSdk\PHPStan\Reflection;
6
7
use PHPStan\Broker\Broker;
0 ignored issues
show
The type PHPStan\Broker\Broker 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...
8
use PHPStan\Reflection\BrokerAwareExtension;
0 ignored issues
show
The type PHPStan\Reflection\BrokerAwareExtension 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...
9
use PHPStan\Reflection\ClassReflection;
0 ignored issues
show
The type PHPStan\Reflection\ClassReflection 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...
10
use PHPStan\Reflection\Dummy\DummyMethodReflection;
0 ignored issues
show
The type PHPStan\Reflection\Dummy\DummyMethodReflection 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...
11
use PHPStan\Reflection\MethodReflection;
0 ignored issues
show
The type PHPStan\Reflection\MethodReflection 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...
12
use PHPStan\Reflection\MethodsClassReflectionExtension;
0 ignored issues
show
The type PHPStan\Reflection\MethodsClassReflectionExtension 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...
13
14
class RepositoryMagicFindExtension implements MethodsClassReflectionExtension, BrokerAwareExtension
15
{
16
    /** @var Broker */
17
    private $broker;
18
19
    public function setBroker(Broker $broker): void
20
    {
21
        $this->broker = $broker;
22
    }
23
24
    public function hasMethod(ClassReflection $classReflection, string $methodName): bool
25
    {
26
        if (0 !== mb_strpos($methodName, 'findBy')
27
            && 0 !== mb_strpos($methodName, 'findOneBy')
28
        ) {
29
            return false;
30
        }
31
        if ('Mapado\RestClientSdk\EntityRepository' === $classReflection->getName()) {
32
            return true;
33
        }
34
        if (!$this->broker->hasClass('Mapado\RestClientSdk\EntityRepository')) {
35
            return false;
36
        }
37
38
        return $classReflection->isSubclassOf('Mapado\RestClientSdk\EntityRepository');
39
    }
40
41
    public function getMethod(ClassReflection $classReflection, string $methodName): MethodReflection
42
    {
43
        return new DummyMethodReflection($methodName);
44
    }
45
}
46