for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sarala;
use Sarala\Query\Sorts;
use Sarala\Query\Fields;
use League\Fractal\Manager;
use Illuminate\Http\Request;
use Sarala\Query\QueryParamBag;
use Illuminate\Support\ServiceProvider;
use League\Fractal\Serializer\JsonApiSerializer;
use League\Fractal\Serializer\DataArraySerializer;
class SaralaServiceProvider extends ServiceProvider
{
public function boot()
$this->publishes([
__DIR__.'/../config/sarala.php' => config_path('sarala.php'),
], 'config');
Request::macro('filters', function () {
return new QueryParamBag($this, 'filter');
$this
this<Sarala\SaralaServiceProvider>
object<Illuminate\Http\Request>
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);
});
Request::macro('includes', function () {
return new QueryParamBag($this, 'include');
Request::macro('fields', function () {
return new Fields($this);
Request::macro('sorts', function () {
return new Sorts($this);
}
public function register(): void
$this->app->bind(JsonApiSerializer::class, function ($app) {
$app
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
return new JsonApiSerializer(config('sarala.base_url'));
$this->app->bind(DataArraySerializer::class, function ($app) {
return new DataArraySerializer();
$this->app->bind(Manager::class, function ($app) {
return (new Manager())->setSerializer(Sarala::resolve()->getSerializer());
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: