for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DNADesign\Elemental\Tests\Src;
use DNADesign\Elemental\Controllers\ElementController;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\TextField;
class TestElementController extends ElementController implements TestOnly
{
private static $url_segment = 'test-page';
$url_segment
private static $allowed_actions = array(
$allowed_actions
'Form'
);
public function Form()
$elementform = new Form(
$this,
'Form',
new FieldList(
new TextField('TestValue')
),
new FormAction('doAction')
)
return $elementform;
}
public function doAction($data, $form)
$form
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function doAction($data, /** @scrutinizer ignore-unused */ $form)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return sprintf(
'TestValue: %s\nElement ID: %d',
$data['TestValue'],
$this->element->ID