Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

PSR-11 Container Interface #33

Merged
merged 15 commits into from
Aug 11, 2017
Merged

PSR-11 Container Interface #33

merged 15 commits into from
Aug 11, 2017

Conversation

geerteltink
Copy link
Member

@geerteltink geerteltink commented Mar 25, 2017

Built on top of #32

@geerteltink geerteltink modified the milestone: 2.1.0 Mar 31, 2017
Copy link

@michaelmoussa michaelmoussa left a comment

Choose a reason for hiding this comment

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

@xtreamwayz looks good overall but I left some feedback for a minor docblock typo and for a str_replace(...) call that might not actually be necessary.

* @throws Exception\InvalidArgumentException if the route name is not
* known.
* @throws Exception\InvalidArgumentException if the route name is not known or
* or a parameter value does not match its regex.

Choose a reason for hiding this comment

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

Typo - double "or"

}

// Check substitute value with regex
$regex = '~^' . str_replace('/', '\/', $part[1]) . '$~';

Choose a reason for hiding this comment

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

I'm not 100% clear on why the str_replace is necessary here. If we're adding ~ to the start and end, preg_match doesn't need the forward slashes escaped. For instance, if $part[1] is foo/bar/baz, then all of the following return 1:

  • preg_match('/^foo\/bar\/baz$/', $part[1]);
  • preg_match('~^foo\/bar\/baz$~', $part[1]);
  • preg_match('~^foo/bar/baz$~', $part[1]);

If I haven't misunderstood something, then I suggest we remove line 288 and replace the next line with:

if (! preg_match('~^' . $part[1] . '$~', $substitutions[$part[0]])) {

@geerteltink geerteltink merged commit 1f54bd5 into zendframework:develop Aug 11, 2017
geerteltink added a commit that referenced this pull request Aug 11, 2017
geerteltink added a commit that referenced this pull request Aug 11, 2017
geerteltink added a commit that referenced this pull request Aug 11, 2017
@geerteltink geerteltink deleted the feature/psr-11 branch August 11, 2017 18:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants