Search code examples
zend-framework3rbac

Zend\Permissions\Rbac\Role Error 500 when try to instantiate object


I'm trying to implement a RBAC in my project, but I can't instantiate Rbac class.

My code:

<?php

namespace Login\Controller;

use Zend\Mvc\Controller\AbstractActionController;

use Zend\Permissions\Rbac\Rbac; use Zend\Permissions\Rbac\Role;

class TesteController extends AbstractActionController {

public function indexAction() {
    $role = new Role('teste');

    die('=== FIM ===');
}

}

When I comment the Role line it shows "=== FIM ===", but when it isn't commented it gives 500 error.

I already check the module struct in vendor and it's alright.

Do I need to do anything else when I install a vendor module via composer to zend 3 recognize it?


Solution

  • The error was cause by my php version that doesn't accept return type declarations. The Rbac module is full of it.