Nexus API Reference

RouteProtection
in package

FinalYes
Tags
psalm-api

Compile-time inspection for the fail-closed authorization check: which handler classes declare AuthorizationRequirement attributes, and whether a middleware list contains an AuthorizationEnforcer.

Table of Contents

Methods

hasEnforcer()  : bool
Whether the middleware list contains an authorization enforcer, given either as an instance or as a class-string.
requirementOf()  : class-string|null
The first authorization-requirement attribute declared on the handler class, or null when the handler declares none (closures cannot carry class attributes; unloadable classes are reported by handler resolution with its own error).

Methods

hasEnforcer()

Whether the middleware list contains an authorization enforcer, given either as an instance or as a class-string.

public static hasEnforcer(iterable<string|int, mixed> $middleware) : bool
Parameters
$middleware : iterable<string|int, mixed>
Return values
bool

requirementOf()

The first authorization-requirement attribute declared on the handler class, or null when the handler declares none (closures cannot carry class attributes; unloadable classes are reported by handler resolution with its own error).

public static requirementOf(string|Closure $handler) : class-string|null
Parameters
$handler : string|Closure

Class name, 'Class::method' string, or Closure.

Return values
class-string|null
On this page

Search results