1 | <?php |
||
2 | |||
3 | namespace PHPKitchen\DI\Mixins; |
||
4 | |||
5 | use core\app\Application; |
||
0 ignored issues
–
show
|
|||
6 | use yii\di\ServiceLocator; |
||
7 | |||
8 | /** |
||
9 | * Injects service locator to target class. |
||
10 | * Use this trait only if you can't use dependency injection container. |
||
11 | * |
||
12 | * @property ServiceLocator|\yii\base\Application $serviceLocator public alias of {@link _serviceLocator} |
||
13 | * |
||
14 | * @package PHPKitchen\DI\mixins |
||
15 | * @author Dmitry Kolodko <[email protected]> |
||
16 | */ |
||
17 | trait ServiceLocatorAccess { |
||
18 | /** |
||
19 | * @var ServiceLocator|\yii\base\Application |
||
20 | */ |
||
21 | protected $_serviceLocator; |
||
22 | |||
23 | public function getServiceLocator() { |
||
24 | if (!isset($this->_serviceLocator)) { |
||
25 | $this->initServiceLocator(); |
||
26 | } |
||
27 | |||
28 | return $this->_serviceLocator; |
||
29 | } |
||
30 | |||
31 | public function setServiceLocator(ServiceLocator $locator) { |
||
32 | $this->_serviceLocator = $locator; |
||
33 | } |
||
34 | |||
35 | protected function initServiceLocator() { |
||
36 | $this->setServiceLocator(\Yii::$app); |
||
37 | } |
||
38 | } |
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