Your project should not use invalid default value types 2

More information: https://insight.symfony.com/what-we-analyse/php.invalid_default_value

  1. */
  2. class GuardPluginManager extends AbstractPluginManager
  3. {
  4. protected $instanceOf = GuardInterface::class;
  5. protected $factories = [

    Property Dot\Rbac\Guard\Guard\GuardPluginManager::$factories (Laminas\ServiceManager\FactoriesConfiguration) does not accept default value of type array<string, string>.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. RouteGuard::class => GuardFactory::class,
  7. RoutePermissionGuard::class => PermissionGuardFactory::class,
  8. ControllerGuard::class => GuardFactory::class,
  9. ControllerPermissionGuard::class => PermissionGuardFactory::class,
  1. */
  2. class GuardsProviderPluginManager extends AbstractPluginManager
  3. {
  4. protected $instanceOf = GuardsProviderInterface::class;
  5. protected $factories = [

    Property Dot\Rbac\Guard\Provider\GuardsProviderPluginManager::$factories (Laminas\ServiceManager\FactoriesConfiguration) does not accept default value of type array<string, string>.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by n3vrax
  6. ArrayGuardsProvider::class => GuardsProviderFactory::class,
  7. ];
  8. protected $aliases = [
  9. 'arrayguardsprovider' => ArrayGuardsProvider::class,

Your project should not use invalid parameter and return typehints 7

More information: https://insight.symfony.com/what-we-analyse/php.invalid_typehint

  1. /**
  2. * @param ContainerInterface $container
  3. * @param $requestedName
  4. * @return ForbiddenHandler
  5. */
  6. public function __invoke(ContainerInterface $container, $requestedName)

    Method Dot\Rbac\Guard\Factory\ForbiddenHandlerFactory::__invoke() has parameter $requestedName with no type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. $config = $container->get('config');
  9. $debug = (bool)$config['debug'] ?? false;
  10. $authorizationService = $container->get(AuthorizationInterface::class);
  1. * Class GuardFactory
  2. * @package Dot\Rbac\Guard\Factory
  3. */
  4. class GuardFactory
  5. {
  6. public function __invoke(ContainerInterface $container, $requestedName, array $options = null)

    Method Dot\Rbac\Guard\Factory\GuardFactory::__invoke() has parameter $requestedName with no type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. $options = $options ?? [];
  9. $options['role_service'] = isset($options['role_service'])
  10. && is_string($options['role_service'])
  11. && $container->has($options['role_service'])
  1. * @param ContainerInterface $container
  2. * @param $requestedName
  3. * @param array $options
  4. * @return ArrayGuardsProvider
  5. */
  6. public function __invoke(ContainerInterface $container, $requestedName, array $options = null)

    Method Dot\Rbac\Guard\Factory\GuardsProviderFactory::__invoke() has parameter $requestedName with no type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. $options = $options ?? [];
  9. $options['guard_factory'] = isset($options['guard_factory'])
  10. && is_string($options['guard_factory'])
  11. && $container->has($options['guard_factory'])
  1. * Class PermissionGuardFactory
  2. * @package Dot\Rbac\Guard\Factory
  3. */
  4. class PermissionGuardFactory
  5. {
  6. public function __invoke(ContainerInterface $container, $requestedName, array $options = null)

    Method Dot\Rbac\Guard\Factory\PermissionGuardFactory::__invoke() has parameter $requestedName with no type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. $options = $options ?? [];
  9. $options['authorization_service'] = isset($options['authorization_service'])
  10. && is_string($options['authorization_service'])
  11. && $container->has($options['authorization_service'])
  1. /**
  2. * @param ContainerInterface $container
  3. * @param $requestedName
  4. * @return RbacGuardMiddleware
  5. */
  6. public function __invoke(ContainerInterface $container, $requestedName)

    Method Dot\Rbac\Guard\Factory\RbacGuardMiddlewareFactory::__invoke() has parameter $requestedName with no type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. /** @var RbacGuardOptions $options */
  9. $options = $container->get(RbacGuardOptions::class);
  10. /** @var Factory $guardsProviderFactory */
  1. /**
  2. * @param ContainerInterface $container
  3. * @param $requestedName
  4. * @return RbacGuardOptions
  5. */
  6. public function __invoke(ContainerInterface $container, $requestedName)

    Method Dot\Rbac\Guard\Factory\RbacGuardOptionsFactory::__invoke() has parameter $requestedName with no type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. return new $requestedName($container->get('config')['dot_authorization']);
  9. }
  10. }
  1. * @param $error
  2. * @param ServerRequestInterface $request
  3. * @return ResponseInterface
  4. * @throws \Exception
  5. */
  6. protected function handleForbiddenError(

    Method Dot\Rbac\Guard\Middleware\ForbiddenHandler::handleForbiddenError() has parameter $error with no type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by n3vrax
  7. $error,
  8. ServerRequestInterface $request
  9. ): ResponseInterface {
  10. $event = $this->dispatchEvent(AuthorizationEvent::EVENT_FORBIDDEN, [
  11. 'request' => $request,

Your project should use return types 34

More information: https://insight.symfony.com/what-we-analyse/php.missing_return_typehint

  1. * Class GuardFactory
  2. * @package Dot\Rbac\Guard\Factory
  3. */
  4. class GuardFactory
  5. {
  6. public function __invoke(ContainerInterface $container, $requestedName, array $options = null)

    Method Dot\Rbac\Guard\Factory\GuardFactory::__invoke() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. $options = $options ?? [];
  9. $options['role_service'] = isset($options['role_service'])
  10. && is_string($options['role_service'])
  11. && $container->has($options['role_service'])
  1. * Class PermissionGuardFactory
  2. * @package Dot\Rbac\Guard\Factory
  3. */
  4. class PermissionGuardFactory
  5. {
  6. public function __invoke(ContainerInterface $container, $requestedName, array $options = null)

    Method Dot\Rbac\Guard\Factory\PermissionGuardFactory::__invoke() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. $options = $options ?? [];
  9. $options['authorization_service'] = isset($options['authorization_service'])
  10. && is_string($options['authorization_service'])
  11. && $container->has($options['authorization_service'])
  1. }
  2. /**
  3. * @param bool $debug
  4. */
  5. public function setDebug(bool $debug)

    Method Dot\Rbac\Guard\Middleware\ForbiddenHandler::setDebug() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by n3vrax
  6. {
  7. $this->debug = $debug;
  8. }
  9. }
  1. interface AuthorizationEventListenerInterface extends ListenerAggregateInterface
  2. {
  3. /**
  4. * @param AuthorizationEvent $e
  5. */
  6. public function onBeforeAuthorization(AuthorizationEvent $e);

    Method Dot\Rbac\Guard\Event\AuthorizationEventListenerInterface::onBeforeAuthorization() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. /**
  8. * @param AuthorizationEvent $e
  9. */
  10. public function onAfterAuthorization(AuthorizationEvent $e);
  1. public function onBeforeAuthorization(AuthorizationEvent $e);
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onAfterAuthorization(AuthorizationEvent $e);

    Method Dot\Rbac\Guard\Event\AuthorizationEventListenerInterface::onAfterAuthorization() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. /**
  7. * @param AuthorizationEvent $e
  8. */
  9. public function onForbidden(AuthorizationEvent $e);
  1. public function onAfterAuthorization(AuthorizationEvent $e);
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onForbidden(AuthorizationEvent $e);

    Method Dot\Rbac\Guard\Event\AuthorizationEventListenerInterface::onForbidden() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. }
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onBeforeAuthorization(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Middleware\ForbiddenHandler::onBeforeAuthorization() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. /**
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onBeforeAuthorization(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Middleware\RbacGuardMiddleware::onBeforeAuthorization() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. /**
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onBeforeAuthorization(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Event\AbstractAuthorizationEventListener::onBeforeAuthorization() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. /**
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onAfterAuthorization(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Event\AbstractAuthorizationEventListener::onAfterAuthorization() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. /**
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onAfterAuthorization(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Middleware\RbacGuardMiddleware::onAfterAuthorization() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. /**
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onAfterAuthorization(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Middleware\ForbiddenHandler::onAfterAuthorization() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. /**
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onForbidden(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Middleware\ForbiddenHandler::onForbidden() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. }
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onForbidden(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Middleware\RbacGuardMiddleware::onForbidden() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. }
  1. }
  2. /**
  3. * @param AuthorizationEvent $e
  4. */
  5. public function onForbidden(AuthorizationEvent $e)

    Method Dot\Rbac\Guard\Event\AbstractAuthorizationEventListener::onForbidden() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. // no-op
  8. }
  9. }
  1. {
  2. /**
  3. * @param ContainerInterface $container
  4. * @param EventManagerInterface $eventManager
  5. */
  6. protected function attachListeners(ContainerInterface $container, EventManagerInterface $eventManager)

    Method Dot\Rbac\Guard\Factory\ForbiddenHandlerFactory::attachListeners() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. /** @var RbacGuardOptions $options */
  9. $options = $container->get(RbacGuardOptions::class);
  10. if (!empty($options->getEventListeners())
  1. {
  2. /**
  3. * @param ContainerInterface $container
  4. * @param EventManagerInterface $eventManager
  5. */
  6. protected function attachListeners(ContainerInterface $container, EventManagerInterface $eventManager)

    Method Dot\Rbac\Guard\Factory\RbacGuardMiddlewareFactory::attachListeners() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  7. {
  8. /** @var RbacGuardOptions $options */
  9. $options = $container->get(RbacGuardOptions::class);
  10. if (!empty($options->getEventListeners())
  1. }
  2. /**
  3. * @param array $rules
  4. */
  5. abstract public function setRules(array $rules);

    Method Dot\Rbac\Guard\Guard\AbstractGuard::setRules() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. /**
  7. * @return int
  8. */
  9. public function getPriority(): int
  1. }
  2. /**
  3. * @param array $rules
  4. */
  5. public function setRules(array $rules)

    Method Dot\Rbac\Guard\Guard\ControllerGuard::setRules() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by n3vrax
  6. {
  7. $this->rules = [];
  8. foreach ($rules as $rule) {
  9. $route = strtolower($rule['route']);
  1. }
  2. /**
  3. * @param RoleServiceInterface $roleService
  4. */
  5. public function setRoleService(RoleServiceInterface $roleService)

    Method Dot\Rbac\Guard\Guard\ControllerGuard::setRoleService() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->roleService = $roleService;
  8. }
  9. /**
  1. }
  2. /**
  3. * @param array $rules
  4. */
  5. public function setRules(array $rules)

    Method Dot\Rbac\Guard\Guard\ControllerPermissionGuard::setRules() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by n3vrax
  6. {
  7. $this->rules = [];
  8. foreach ($rules as $rule) {
  9. $route = strtolower($rule['route']);
  1. }
  2. /**
  3. * @param AuthorizationInterface $authorizationService
  4. */
  5. public function setAuthorizationService(AuthorizationInterface $authorizationService)

    Method Dot\Rbac\Guard\Guard\ControllerPermissionGuard::setAuthorizationService() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->authorizationService = $authorizationService;
  8. }
  9. }
  1. }
  2. /**
  3. * @param array $rules
  4. */
  5. public function setRules(array $rules)

    Method Dot\Rbac\Guard\Guard\RouteGuard::setRules() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by n3vrax
  6. {
  7. $this->rules = [];
  8. foreach ($rules as $key => $value) {
  9. if (is_int($key)) {
  1. }
  2. /**
  3. * @param RoleServiceInterface $roleService
  4. */
  5. public function setRoleService(RoleServiceInterface $roleService)

    Method Dot\Rbac\Guard\Guard\RouteGuard::setRoleService() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->roleService = $roleService;
  8. }
  9. /**
  1. }
  2. /**
  3. * @param array $rules
  4. */
  5. public function setRules(array $rules)

    Method Dot\Rbac\Guard\Guard\RoutePermissionGuard::setRules() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by n3vrax
  6. {
  7. $this->rules = [];
  8. foreach ($rules as $key => $value) {
  9. if (is_int($key)) {
  10. $routeName = strtolower($value);
  1. }
  2. /**
  3. * @param AuthorizationInterface $authorizationService
  4. */
  5. public function setAuthorizationService(AuthorizationInterface $authorizationService)

    Method Dot\Rbac\Guard\Guard\RoutePermissionGuard::setAuthorizationService() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->authorizationService = $authorizationService;
  8. }
  9. }
  1. }
  2. /**
  3. * @param $messages
  4. */
  5. public function setMessages(array $messages)

    Method Dot\Rbac\Guard\Options\MessagesOptions::setMessages() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->messages = ArrayUtils::merge($this->messages, $messages, true);
  8. }
  9. /**
  1. }
  2. /**
  3. * @param string $protectionPolicy
  4. */
  5. public function setProtectionPolicy(string $protectionPolicy)

    Method Dot\Rbac\Guard\Options\RbacGuardOptions::setProtectionPolicy() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->protectionPolicy = $protectionPolicy;
  8. }
  9. /**
  1. }
  2. /**
  3. * @param array $guardsProvider
  4. */
  5. public function setGuardsProvider(array $guardsProvider)

    Method Dot\Rbac\Guard\Options\RbacGuardOptions::setGuardsProvider() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->guardsProvider = $guardsProvider;
  8. }
  9. /**
  1. }
  2. /**
  3. * @param array $messagesOptions
  4. */
  5. public function setMessagesOptions(array $messagesOptions)

    Method Dot\Rbac\Guard\Options\RbacGuardOptions::setMessagesOptions() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->messagesOptions = new MessagesOptions($messagesOptions);
  8. }
  9. /**
  1. }
  2. /**
  3. * @param array $eventListeners
  4. */
  5. public function setEventListeners(array $eventListeners)

    Method Dot\Rbac\Guard\Options\RbacGuardOptions::setEventListeners() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->eventListeners = $eventListeners;
  8. }
  9. }
  1. }
  2. /**
  3. * @param $protectionPolicy
  4. */
  5. public function setProtectionPolicy(string $protectionPolicy)

    Method Dot\Rbac\Guard\Guard\AbstractGuard::setProtectionPolicy() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->protectionPolicy = $protectionPolicy;
  8. }
  9. }
  1. }
  2. /**
  3. * @param Factory $guardFactory
  4. */
  5. public function setGuardFactory(Factory $guardFactory)

    Method Dot\Rbac\Guard\Provider\AbstractGuardsProvider::setGuardFactory() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->guardFactory = $guardFactory;
  8. }
  9. }
  1. }
  2. /**
  3. * @param array $guardsConfig
  4. */
  5. public function setGuardsConfig(array $guardsConfig)

    Method Dot\Rbac\Guard\Provider\ArrayGuardsProvider::setGuardsConfig() has no return type specified.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Popa Tiberiu
  6. {
  7. $this->guardsConfig = $guardsConfig;
  8. }
  9. }

Your project should not contain duplicated code

More information: https://insight.symfony.com/what-we-analyse/php.duplicated_code

  1. $allowedPermissions = $this->rules[$route][0];
  2. } else {
  3. return $this->protectionPolicy === self::POLICY_ALLOW;
  4. }
  5. if (empty($allowedPermissions)) {

    The next 49 lines appear both in src/Guard/ControllerPermissionGuard.php:106 and src/Guard/RoutePermissionGuard.php:92.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by n3vrax
  6. return $this->protectionPolicy === self::POLICY_ALLOW;
  7. }
  8. if (in_array('*', $allowedPermissions)) {
  9. return true;