8000 [Router] added static requirement optimization to php matcher dumper by jfsimon · Pull Request #8497 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Router] added static requirement optimization to php matcher dumper #8497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jfsimon
Copy link
Contributor
@jfsimon jfsimon commented Jul 16, 2013

This PR attempts to apply #6838 suggestion.
@Tobion could you please take a look and tell me what you think?

This comment should be taken in account #6838 (comment), this optimization could be performed by the RouteCompiler but it would require #5410 to be fixed (which may never happen).

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

$placeholder = sprintf('{%s}', $parameter);

if (preg_match('~^[\w]+$~i', $pattern) && false !== strpos($optimizedRoute->getPath(), $placeholder)) {
var_dump($parameter, $pattern);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@henrikbjorn oh, thanks... how could I miss it?!

8000
$dumper = new PhpMatcherDumper($collection);
$fixture = __DIR__.'/../../Fixtures/dumper/optimized_route_matcher.php';

$this->assertEquals(file_get_contents($fixture), $dumper->dump());
Copy link
Contributor

Choose a reason for hiding this comment

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

$this->assertStringEqualsFile($fixture, $dumper->dump());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stloyd wow, I was not aware of this method! I update the PR now, thanks.

@jfsimon
Copy link
Contributor Author
jfsimon commented Sep 7, 2013

@fabpot is this PR okay for you?

@fabpot
Copy link
Member
fabpot commented Sep 13, 2013

Looks like a lot of additional code for a very slight benefit. Closing.

@fabpot fabpot closed this Sep 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0