for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cortex\Auth\Http\Requests\Adminarea;
use Rinvex\Support\Traits\Escaper;
use Illuminate\Foundation\Http\FormRequest;
use Cortex\Foundation\Exceptions\GenericException;
class RoleFormRequest extends FormRequest
{
use Escaper;
/**
* Determine if the user is authorized to make this request.
*
* @throws \Cortex\Foundation\Exceptions\GenericException
* @return bool
*/
public function authorize(): bool
$currentUser = $this->user($this->route('guard'));
if (! $currentUser->can('superadmin') && ! $currentUser->roles->contains($this->route('role'))) {
throw new GenericException(trans('cortex/auth::messages.action_unauthorized'), route('adminarea.roles.index'));
route('adminarea.roles.index')
string
array|null
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);
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.
}
return true;
* Get the validation rules that apply to the request.
* @return array
public function rules(): array
return [];
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: