Skip to content

Conversation

mspirkov
Copy link
Contributor

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues
image image

{
/**
* @var UrlRuleInterface[] the URL rules contained in this composite rule.
* @var UrlRuleInterface[]|UrlRuleInterface[][]|array[]|string[] the URL rules contained in this composite rule.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that only these types of arrays can be here

* @return UrlRuleInterface[]|UrlRuleInterface[][] the URL rules
*/
abstract protected function createRules();

$this->rules = $this->createRules();

foreach ($this->rules as $key => $rule) {
if (!is_array($rule)) {
$verbs = 'GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS';
$verb = null;
if (preg_match("/^((?:(?:$verbs),)*(?:$verbs))\\s+(.*)$/", $key, $matches)) {
$verb = explode(',', $matches[1]);
$key = $matches[2];
}
$rule = [
'pattern' => ltrim($this->prefix . '/' . $key, '/'),
'route' => ltrim($this->routePrefix . '/' . $rule, '/'),
'verb' => $verb
];
} elseif (isset($rule['pattern'], $rule['route'])) {
$rule['pattern'] = ltrim($this->prefix . '/' . $rule['pattern'], '/');
$rule['route'] = ltrim($this->routePrefix . '/' . $rule['route'], '/');
}

@mspirkov mspirkov marked this pull request as ready for review October 19, 2025 19:55
@samdark samdark merged commit 5681a98 into yiisoft:master Oct 20, 2025
94 checks passed
@samdark
Copy link
Member

samdark commented Oct 20, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants