for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author jan huang <[email protected]>
* @copyright 2016
*
* @see https://www.github.com/janhuang
* @see https://fastdlabs.com
*/
namespace Controller;
use FastD\Http\JsonResponse;
use FastD\Http\Response;
use FastD\Http\ServerRequest;
* Class IndexController.
class IndexController
{
* @param ServerRequest $request
* @return Response
public function welcome(ServerRequest $request)
return json([
'foo' => $request->getParam('foo', 'bar'),
'bar'
string
boolean
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
])
->withCookie('uid', 100, 900)
->withFileDescriptor(1)
;
}
* @return JsonResponse
public function sayHello(ServerRequest $request)
'foo' => $request->getAttribute('name'),
]);
* @param ServerRequest $serverRequest
public function middleware(ServerRequest $serverRequest)
$serverRequest
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
'foo' => 'bar',
public function db()
return json(
database()->info()
);
public function model()
$model = model('demo');
'model' => get_class($model),
'db' => $model->getDatabase()->info(),
'list' => $model->select(),
public function auth()
public function abort()
abort(400);
public function queue()
queue()->push('demo queue');
'msg' => 'hello queue',
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: