for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SilverStripe\Widgets\Tests\WidgetControllerTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\TextField;
use SilverStripe\Widgets\Model\WidgetController;
/**
* @package widgets
* @subpackage tests
*/
class TestWidgetController extends WidgetController implements TestOnly
{
private static $allowed_actions = array(
$allowed_actions
'Form'
);
public function Form()
$widgetform = new Form(
$this,
__FUNCTION__,
new FieldList(
new TextField('TestValue')
),
new FormAction('doAction')
)
return $widgetform;
}
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\nWidget ID: %d',
$data['TestValue'],
$this->widget->ID