1 | <?php |
||||
2 | |||||
3 | declare(strict_types=1); |
||||
4 | |||||
5 | namespace Nip\View\Traits; |
||||
6 | |||||
7 | use Nip\Helpers\View\AbstractHelper; |
||||
8 | |||||
9 | /** |
||||
10 | * Trait HasHelpersTrait. |
||||
11 | * |
||||
12 | * @method Nip\Helpers\View\Breadcrumbs Breadcrumbs() |
||||
13 | * @method Nip\Helpers\View\Doctype Doctype() |
||||
14 | * @method Nip\Helpers\View\Flash Flash() |
||||
15 | * @method Nip\Helpers\View\FacebookMeta FacebookMeta() |
||||
16 | * @method Nip\Helpers\View\GoogleAnalytics GoogleAnalytics() |
||||
17 | * @method Nip\Helpers\View\HTML HTML() |
||||
18 | * @method Nip\Helpers\View\Messages Messages() |
||||
19 | * @method Nip\Helpers\View\Meta Meta() |
||||
20 | * @method Nip\Helpers\View\Paginator Paginator() |
||||
21 | * @method Nip\Helpers\View\Scripts Scripts() |
||||
22 | * @method Nip\Helpers\View\Stylesheets Stylesheets() |
||||
23 | * @method Nip\Helpers\View\TinyMCE TinyMCE() |
||||
24 | * @method Nip\Helpers\View\Url Url() |
||||
25 | * @method Nip\Helpers\View\GoogleDFP GoogleDFP() |
||||
26 | */ |
||||
27 | trait HasHelpersTrait |
||||
28 | { |
||||
29 | protected $helpers = []; |
||||
30 | |||||
31 | /** |
||||
32 | * @return mixed |
||||
33 | */ |
||||
34 | public function getHelper($name) |
||||
35 | { |
||||
36 | if (!isset($this->helpers[$name])) { |
||||
37 | $this->initHelper($name); |
||||
38 | } |
||||
39 | |||||
40 | return $this->helpers[$name]; |
||||
41 | } |
||||
42 | |||||
43 | public function initHelper($name) |
||||
44 | { |
||||
45 | $this->helpers[$name] = $this->newHelper($name); |
||||
46 | } |
||||
47 | |||||
48 | /** |
||||
49 | * @return Helpers\View\AbstractHelper |
||||
0 ignored issues
–
show
|
|||||
50 | */ |
||||
51 | public function newHelper($name) |
||||
52 | { |
||||
53 | $class = $this->getHelperClass($name); |
||||
54 | $helper = new $class(); |
||||
55 | /** @var AbstractHelper $helper */ |
||||
56 | $helper->setView($this); |
||||
0 ignored issues
–
show
$this of type Nip\View\Traits\HasHelpersTrait is incompatible with the type Nip\View\ViewInterface expected by parameter $view of Nip\Helpers\View\AbstractHelper::setView() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
57 | |||||
58 | return $helper; |
||||
0 ignored issues
–
show
|
|||||
59 | } |
||||
60 | |||||
61 | /** |
||||
62 | * @return string |
||||
63 | */ |
||||
64 | public function getHelperClass($name) |
||||
65 | { |
||||
66 | return '\Nip\Helpers\View\\' . $name; |
||||
67 | } |
||||
68 | } |
||||
69 |
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