for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dynamic\Salsify\ORM;
use SilverStripe\Assets\Image;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\ReadonlyField;
/**
* Class AssetFormFactoryExtension
* @package Dynamic\Salsify\ORM
*
* @property-read \SilverStripe\AssetAdmin\Forms\FileFormFactory $owner
*/
class AssetFormFactoryExtension extends Extension
{
* @param \SilverStripe\Forms\FieldList $fields
public function updateFormFields(FieldList $fields, $controller, $formName, $context)
$formName
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function updateFormFields(FieldList $fields, $controller, /** @scrutinizer ignore-unused */ $formName, $context)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$controller
public function updateFormFields(FieldList $fields, /** @scrutinizer ignore-unused */ $controller, $formName, $context)
$record = isset($context['Record']) ? $context['Record'] : null;
if ($record && $record->SalsifyID) {
$fields->insertAfter('LastEdited', ReadonlyField::create('SalsifyID', 'Salsify ID'));
if ($record instanceof Image) {
$fields->insertAfter('SalsifyID', ReadonlyField::create('Transformation', 'Salsify Transformation'));
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.