Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Matcher/Matcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class Matcher implements MatcherInterface
/**
* A cache that maps menu items and matching results.
*
* @var SplObjectStorage
* @var \SplObjectStorage
*/
protected SplObjectStorage $_cache;

/**
* Collection of voters added `addVoter()`.
*
* @var array<VoterInterface>
* @var array<\Knp\Menu\Matcher\Voter\VoterInterface>
*/
protected array $_voters = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Matcher/MatcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface MatcherInterface extends BaseMatcherInterface
/**
* Adds a voter in the matcher.
*
* @param VoterInterface $voter The voter to add.
* @param \Knp\Menu\Matcher\Voter\VoterInterface $voter The voter to add.
* @return void
*/
public function addVoter(VoterInterface $voter): void;
Expand Down
10 changes: 5 additions & 5 deletions src/Matcher/Voter/FuzzyRouteVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getParams(): array
/**
* Constructor.
*
* @param ServerRequest $request The request object from where to extract the routing
* @param \Cake\Http\ServerRequest $request The request object from where to extract the routing
* parameters to match against.
*/
public function __construct(ServerRequest $request)
Expand Down Expand Up @@ -79,7 +79,7 @@ public function matchItem(ItemInterface $item): ?bool
/**
* Extracts the routing parameters from the given request.
*
* @param ServerRequest $request The request object from where to extract the routing
* @param \Cake\Http\ServerRequest $request The request object from where to extract the routing
* parameters.
* @return array An array of routing parameters.
*/
Expand Down Expand Up @@ -112,7 +112,7 @@ protected function _extractParams(ServerRequest $request): array
$params['_Token'],
$params['_csrfToken'],
$params['_matchedRoute'],
$params['_route']
$params['_route'],
);
$params = array_merge($params, $pass);
$params += $params['?'];
Expand Down Expand Up @@ -145,7 +145,7 @@ function (mixed &$value): void {
if (is_numeric($value)) {
$value = (string)$value;
}
}
},
);

if (isset($params['?'])) {
Expand Down Expand Up @@ -173,7 +173,7 @@ protected function _normalizeRoute(array &$route): void
$route['_scheme'],
$route['_port'],
$route['_full'],
$route['_ssl']
$route['_ssl'],
);

$this->_normalizeParams($route);
Expand Down
2 changes: 1 addition & 1 deletion src/Matcher/Voter/UrlVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getUrlWithoutQuery(): string
* - `ignoreQueryString`: Defines whether the query string should be ignored when matching
* items. Defaults to `true`.
*
* @param ServerRequest $request The request object from where to extract the request
* @param \Cake\Http\ServerRequest $request The request object from where to extract the request
* target to match against.
* @param array $options An array of options, see the "Options" section in the method
* description.
Expand Down
2 changes: 1 addition & 1 deletion src/MenuFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface MenuFactoryInterface extends FactoryInterface
/**
* Adds a factory extension.
*
* @param ExtensionInterface $extension The extension to add.
* @param \Knp\Menu\Factory\ExtensionInterface $extension The extension to add.
* @param int $priority The priority to assign to the extension.
* @return void
*/
Expand Down
26 changes: 13 additions & 13 deletions src/Renderer/StringTemplateRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class StringTemplateRenderer implements RendererInterface
/**
* The matcher to use for determining the active items.
*
* @var MatcherInterface
* @var \Knp\Menu\Matcher\MatcherInterface
*/
protected MatcherInterface $_matcher;

Expand Down Expand Up @@ -135,7 +135,7 @@ class StringTemplateRenderer implements RendererInterface
* classes to consume (see the `inheritItemClasses` option for a list of valid class
* names).
*
* @param MatcherInterface $matcher The matcher to use for determining the active items.
* @param \Knp\Menu\Matcher\MatcherInterface $matcher The matcher to use for determining the active items.
* @param array $config An array of options, see the "Configuration options" section in the
* method description.
*/
Expand All @@ -158,7 +158,7 @@ public function __construct(MatcherInterface $matcher, array $config = [])
* This method supports all the options that the constructor supports.
*
* @see __construct()
* @param ItemInterface $item The menu to render.
* @param \Knp\Menu\ItemInterface $item The menu to render.
* @param array $options An array of options, see the "Options" section in the method
* description.
* @return string The rendered menu.
Expand All @@ -179,7 +179,7 @@ public function render(ItemInterface $item, array $options = []): string
/**
* Renders the root menu item.
*
* @param ItemInterface $item The menu item to render.
* @param \Knp\Menu\ItemInterface $item The menu item to render.
* @param array $options The rendering options.
* @return string The rendered menu item.
*/
Expand Down Expand Up @@ -236,7 +236,7 @@ protected function _renderMenu(ItemInterface $item, array $options): string
* - `templateVars`: The template variables to use for the element.
* - `childrenTemplates`: The templates to use for the children of the element.
*
* @param ItemInterface $item The menu whose children to render.
* @param \Knp\Menu\ItemInterface $item The menu whose children to render.
* @param array $options The rendering options, see the "Options" section in the method
* description for specific nesting element options.
* @return string The rendered element.
Expand Down Expand Up @@ -282,7 +282,7 @@ protected function _renderNested(ItemInterface $item, array $options): string
/**
* Renders the menu items children.
*
* @param ItemInterface $item The item whose children to render.
* @param \Knp\Menu\ItemInterface $item The item whose children to render.
* @param array $options The rendering options.
* @return array<string> The rendered children.
*/
Expand Down Expand Up @@ -310,7 +310,7 @@ protected function _renderChildren(ItemInterface $item, array $options): array
/**
* Renders the menu item and its children.
*
* @param ItemInterface $item The menu item to render.
* @param \Knp\Menu\ItemInterface $item The menu item to render.
* @param array $options The rendering options.
* @return string The rendered menu item.
*/
Expand Down Expand Up @@ -496,7 +496,7 @@ protected function _renderItem(ItemInterface $item, array $options): string
*
* - `currentAsLink`: Whether to render active items as links, or as text elements.
*
* @param ItemInterface $item The menu item for which to render a link.
* @param \Knp\Menu\ItemInterface $item The menu item for which to render a link.
* @param array $options The rendering options, see the "Options" section in the method
* description specific link options.
* @return string The rendered link.
Expand Down Expand Up @@ -524,7 +524,7 @@ protected function _renderLink(ItemInterface $item, array $options): string
* - `class`: The class(es) to set on the link element.
* - `templateVars`: The template variables to use for the link element.
*
* @param ItemInterface $item The menu item which to render as a link element.
* @param \Knp\Menu\ItemInterface $item The menu item which to render as a link element.
* @param array $options The rendering options, see the "Options" section in the method
* description specific link options.
* @return string The rendered link element.
Expand Down Expand Up @@ -553,7 +553,7 @@ protected function _renderLinkElement(ItemInterface $item, array $options): stri
* - `class`: The class(es) to set on the text element.
* - `templateVars`: The template variables to use for the text element.
*
* @param ItemInterface $item The item whose text to render.
* @param \Knp\Menu\ItemInterface $item The item whose text to render.
* @param array $options The rendering options, see the "Options" section in the method
* description specific text options.
* @return string The rendered text.
Expand All @@ -579,7 +579,7 @@ protected function _renderTextElement(ItemInterface $item, array $options): stri
* By default the label is being HTML entity encoded, unless explicitly disabled for the given
* menu item via the `escape` or `escapeLabel` option.
*
* @param ItemInterface $item The item whose label to render.
* @param \Knp\Menu\ItemInterface $item The item whose label to render.
* @return string The rendered label.
*/
protected function _renderLabel(ItemInterface $item): string
Expand All @@ -598,14 +598,14 @@ protected function _renderLabel(ItemInterface $item): string
* Formats an array of attributes as a string of HTML attributes.
*
* @param array $attributes The attributes to format.
* @param ItemInterface $item The menu item that defined the attributes.
* @param \Knp\Menu\ItemInterface $item The menu item that defined the attributes.
* @return string A formatted string of HTML attributes.
*/
protected function _formatAttributes(array $attributes, ItemInterface $item): string
{
if (!empty($attributes)) {
return $this->templater()->formatAttributes(
$attributes + ['escape' => $item->getExtra('escape', true)]
$attributes + ['escape' => $item->getExtra('escape', true)],
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/TestSuite/RequestFactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait RequestFactoryTrait
* Creates a request object.
*
* @param string $requestUri The request URI for which to create a request object for.
* @return ServerRequest
* @return \Cake\Http\ServerRequest
*/
public static function createRequest(string $requestUri): ServerRequest
{
Expand All @@ -37,13 +37,13 @@ public static function createRequest(string $requestUri): ServerRequest
'QUERY_STRING' => $query['string'],
'DOCUMENT_ROOT' => '/',
],
$query['arguments']
$query['arguments'],
);
Router::setRequest($request);

return $request->withAttribute(
'params',
Router::parseRequest($request)
Router::parseRequest($request),
);
}

Expand Down
Loading