for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class CheckOrAddExtraArray extends UpdateComposer {
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
public function run() {
$json = $this->composerJsonObj->jsonData;
composerJsonObj
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
if (property_exists($json, 'extra')) {
GeneralMethods::outputToScreen("<li> already has composer.json </li>");
return;
}
else {
GeneralMethods::outputToScreen("<li> Adding 'extra' array to composer.json </li>");
$json->extra = (object)array('installer-name' => str_replace('silverstripe-', '', $this->composerJsonObj->moduleName));
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.