1 | <?php |
||
5 | class CheckOrAddExtraArray extends UpdateComposer { |
||
|
|||
6 | |||
7 | |||
8 | public function run() { |
||
9 | $json = $this->getJsonData(); |
||
10 | |||
11 | if (isset($json['extra'])) { |
||
12 | |||
13 | GeneralMethods::outputToScreen("<li> already has composer.json[extra][installer-name] </li>"); |
||
14 | |||
15 | return; |
||
16 | } |
||
17 | |||
18 | else { |
||
19 | GeneralMethods::outputToScreen("<li> Adding 'extra' array to composer.json </li>"); |
||
20 | if(! isset($json['extra'])) { |
||
21 | $json['extra'] = []; |
||
22 | } |
||
23 | $json['extra']['installer-name'] = str_replace('silverstripe-', '', $this->composerJsonObj->moduleName)); |
||
24 | } |
||
25 | $this->setJsonData($json); |
||
26 | } |
||
27 | } |
||
28 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.