Error with isAutorized method

Hello, i’m actually trying to implement the isAutorized method in my AppController and UserController.
First, I tried to implement it basically like :

function isAuthorized($type){
return true;

And I get an error : return type declarations must be compatible with controller->isauthorized : bool. I tried in my AppController, my UserController, same error. I tried too to add ($user = null) in parameter but same error.

If you have any advice or help,

Thank you in advance,


You have to define the function return type

function isAuthorized($type): bool {
    return true;

thank you so much.

For information : is it the same think to change the signature in top of method

  • @method isAuthorized($user)

Or is it more safe to set the type of return ? ( found this solution 1 hour ago but was very annoying to change some source code )

Again thank you so much,


The @method is just an annotation and it is for IDE autocompletition/hinting, with it PHP would still throwing an exception.

Setting the return type, o removing it in both controller would solve the issue