Role based access control in Laminas

Code
<?php

use Laminas\Permissions\Rbac\Role;
use 
Laminas\Permissions\Rbac\Rbac;

define('R''read');
define('W''write');

// create roles
$roleAdmin = new Role('Admin');
$roleUser = new Role('User');
$roleAnonymous = new Role('Anonymous');

// permissions
$roleAdmin->addPermission(W);
$roleUser->addPermission(R);

// add child roles / hierarchy
$roleUser->addChild($roleAnonymous);
$roleAdmin->addChild($roleUser);

$rbac = new Rbac();
$rbac->addRole($roleUser);
$rbac->addRole($roleAdmin);
$rbac->addRole($roleAnonymous);

if (
$rbac->isGranted($roleAdminR)) {
    echo 
'Admin has access and read permission from User role.' PHP_EOL;
}

if (
$rbac->isGranted($roleUserW)) {
    echo 
'User has access and write permission.' PHP_EOL;
}
Result
Admin has access and read permission from User role.
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8