for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SilverStripe\Control\Tests\RequestHandlingTest;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Dev\TestOnly;
class HTTPMethodTestController extends Controller implements TestOnly
{
private static $url_segment = 'HTTPMethodTestController';
$url_segment
private static $url_handlers = [
$url_handlers
'GET /' => 'getRoot',
'POST ' => 'postLegacyRoot',
];
private static $allowed_actions = [
$allowed_actions
'getRoot',
'postLegacyRoot',
public function getRoot(HTTPRequest $request)
$request
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function getRoot(/** @scrutinizer ignore-unused */ HTTPRequest $request)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return "Routed to getRoot";
}
public function postLegacyRoot(HTTPRequest $request)
public function postLegacyRoot(/** @scrutinizer ignore-unused */ HTTPRequest $request)
return "Routed to postLegacyRoot";