dynamic /
silverstripe-salsify
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Dynamic\Salsify\Model; |
||||
| 4 | |||||
| 5 | use Dynamic\Salsify\Traits\Yieldable; |
||||
| 6 | use SilverStripe\Core\Config\Config; |
||||
| 7 | use SilverStripe\Core\Config\Configurable; |
||||
| 8 | use SilverStripe\Core\Extensible; |
||||
| 9 | use SilverStripe\Core\Injector\Injectable; |
||||
| 10 | |||||
| 11 | /** |
||||
| 12 | * Class Service |
||||
| 13 | * @package Dynamic\Salsify\Model |
||||
| 14 | * |
||||
| 15 | * @mixin Configurable |
||||
| 16 | * @mixin Extensible |
||||
| 17 | * @mixin Injectable |
||||
| 18 | * @mixin Yieldable |
||||
| 19 | */ |
||||
| 20 | abstract class Service |
||||
| 21 | { |
||||
| 22 | use Configurable; |
||||
| 23 | use Extensible { |
||||
| 24 | defineMethods as extensibleDefineMethods; |
||||
| 25 | } |
||||
| 26 | use Injectable; |
||||
| 27 | use Yieldable; |
||||
| 28 | |||||
| 29 | /** |
||||
| 30 | * @var string |
||||
| 31 | */ |
||||
| 32 | protected $importerKey; |
||||
| 33 | |||||
| 34 | /** |
||||
| 35 | * @var string |
||||
| 36 | */ |
||||
| 37 | protected $serviceName; |
||||
| 38 | |||||
| 39 | /** |
||||
| 40 | * Service constructor. |
||||
| 41 | * @param stirng $importerKey |
||||
|
0 ignored issues
–
show
|
|||||
| 42 | */ |
||||
| 43 | public function __construct($importerKey) |
||||
| 44 | { |
||||
| 45 | $this->importerKey = $importerKey; |
||||
| 46 | $this->serviceName = static::class . '.' . $this->importerKey; |
||||
| 47 | |||||
| 48 | $serviceConfig = Config::inst()->get($this->serviceName); |
||||
| 49 | foreach ($this->yieldKeyVal($serviceConfig) as $key => $value) { |
||||
| 50 | $this->config()->merge($key, $value); |
||||
|
0 ignored issues
–
show
It seems like
$key can also be of type true; however, parameter $name of SilverStripe\Core\Config\Config_ForClass::merge() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 51 | |||||
| 52 | if ($key === 'extensions') { |
||||
| 53 | if (!is_array($value)) { |
||||
| 54 | throw new \Exception("Extensions for {$this->serviceName} is not an array"); |
||||
| 55 | } |
||||
| 56 | foreach ($this->yieldSingle($value) as $extension) { |
||||
| 57 | static::add_extension($extension); |
||||
| 58 | } |
||||
| 59 | } |
||||
| 60 | } |
||||
| 61 | } |
||||
| 62 | } |
||||
| 63 |
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