1 | <?php |
||||||
2 | |||||||
3 | declare(strict_types=1); |
||||||
4 | |||||||
5 | namespace Nip\View\Extensions\Helpers; |
||||||
6 | |||||||
7 | use League\Plates\Engine; |
||||||
8 | use Nip\View; |
||||||
9 | use Nip\View\Extensions\AbstractExtension; |
||||||
10 | use Nip\View\Helpers\HelpersCollection; |
||||||
11 | use Nip\View\Traits\HasMethodsTrait; |
||||||
12 | use Nip\View\Traits\MethodsOverloadingTrait; |
||||||
0 ignored issues
–
show
|
|||||||
13 | use Nip\View\ViewInterface; |
||||||
14 | |||||||
15 | /** |
||||||
16 | * Class HelpersExtension. |
||||||
17 | */ |
||||||
18 | class HelpersExtension extends AbstractExtension |
||||||
19 | { |
||||||
20 | /** |
||||||
21 | * @param ViewInterface|MethodsOverloadingTrait|HasMethodsTrait|View $engine |
||||||
22 | 11 | * |
|||||
23 | * @return void |
||||||
24 | 11 | */ |
|||||
25 | 11 | public function register(Engine $engine) |
|||||
26 | { |
||||||
27 | $helpersCollection = HelpersCollection::getInstance(); |
||||||
28 | 2 | $helpersCollection->setEngine($engine); |
|||||
29 | 11 | ||||||
30 | $engine->addMethod('getHelper', function ($name) use ($helpersCollection) { |
||||||
0 ignored issues
–
show
The method
addMethod() does not exist on League\Plates\Engine . Are you sure you never get this type here, but always one of the subclasses?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
31 | return $helpersCollection->getHelper($name); |
||||||
32 | 2 | }); |
|||||
33 | 11 | ||||||
34 | 11 | $engine->addMethod('hasHelper', function ($name) use ($helpersCollection) { |
|||||
35 | return $helpersCollection->hasHelper($name); |
||||||
36 | }); |
||||||
37 | } |
||||||
38 | } |
||||||
39 |
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