nunomaduro /
laravel-code-analyse
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /** |
||
| 6 | * This file is part of Laravel Code Analyse. |
||
| 7 | * |
||
| 8 | * (c) Nuno Maduro <[email protected]> |
||
| 9 | * |
||
| 10 | * For the full copyright and license information, please view the LICENSE |
||
| 11 | * file that was distributed with this source code. |
||
| 12 | */ |
||
| 13 | |||
| 14 | namespace NunoMaduro\LaravelCodeAnalyse\Extensions; |
||
| 15 | |||
| 16 | use PHPStan\Broker\Broker; |
||
| 17 | use Illuminate\Support\Facades\Facade; |
||
| 18 | use PHPStan\Reflection\ClassReflection; |
||
| 19 | use PHPStan\Reflection\MethodReflection; |
||
| 20 | use PHPStan\Reflection\BrokerAwareExtension; |
||
| 21 | use PHPStan\Reflection\MethodsClassReflectionExtension; |
||
| 22 | use NunoMaduro\LaravelCodeAnalyse\FacadeConcreteClassResolver; |
||
|
0 ignored issues
–
show
|
|||
| 23 | |||
| 24 | final class FacadeMethodExtension implements MethodsClassReflectionExtension, BrokerAwareExtension |
||
| 25 | { |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var \PHPStan\Broker\Broker |
||
| 29 | */ |
||
| 30 | private $broker; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param \PHPStan\Broker\Broker $broker |
||
| 34 | */ |
||
| 35 | public function setBroker(Broker $broker): void |
||
| 36 | { |
||
| 37 | $this->broker = $broker; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * {@inheritdoc} |
||
| 42 | */ |
||
| 43 | public function hasMethod(ClassReflection $classReflection, string $methodName): bool |
||
| 44 | { |
||
| 45 | if ($classReflection->isSubclassOf(Facade::class)) { |
||
| 46 | $facadeClass = $classReflection->getNativeReflection() |
||
| 47 | ->getName(); |
||
| 48 | |||
| 49 | if ($concrete = $facadeClass::getFacadeRoot()) { |
||
| 50 | return $this->broker->getClass($concrete) |
||
| 51 | ->hasNativeMethod($methodName); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | return false; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * {@inheritdoc} |
||
| 60 | */ |
||
| 61 | public function getMethod(ClassReflection $classReflection, string $methodName): MethodReflection |
||
| 62 | { |
||
| 63 | $facadeClass = $classReflection->getNativeReflection() |
||
| 64 | ->getName(); |
||
| 65 | |||
| 66 | return $this->broker->getClass($facadeClass::getFacadeRoot()) |
||
| 67 | ->getNativeMethod($methodName); |
||
| 68 | } |
||
| 69 | } |
||
| 70 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths