Skip to content

Commit

Permalink
minor #2506 [TwigComponent] Remove obsolete TemplateNameParser (sneak…
Browse files Browse the repository at this point in the history
…yvv)

This PR was merged into the 2.x branch.

Discussion
----------

[TwigComponent] Remove obsolete TemplateNameParser

It no longer parses (and should not have been stripping namespaces as it did before)

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| Issues        |
| License       | MIT

As discussed in #1772 (comment), the code added in #1070 (& expanded in #1082) was not needed (even incorrect, based upon a decorator TemplateIterator of Shopware).

Commits
-------

99cb909 Remove obsolete TemplateNameParser
  • Loading branch information
smnandre committed Jan 25, 2025
2 parents fdc13a5 + 99cb909 commit ec09cdf
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 85 deletions.
2 changes: 1 addition & 1 deletion src/TwigComponent/src/Twig/ComponentNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function compile(Compiler $compiler): void
->raw('), ')
->raw($this->getAttribute('only') ? '[]' : '$context')
->raw(', ')
->string(TemplateNameParser::parse($this->getAttribute('embedded_template')))
->string($this->getAttribute('embedded_template'))
->raw(', ')
->raw($this->getAttribute('embedded_index'))
->raw(");\n");
Expand Down
2 changes: 1 addition & 1 deletion src/TwigComponent/src/Twig/ComponentTokenParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function parse(Token $token): Node
$this->parser->embedTemplate($module);

// override the embedded index with a deterministic value, so it can be loaded in a controlled manner
$module->setAttribute('index', $this->generateEmbeddedTemplateIndex(TemplateNameParser::parse($stream->getSourceContext()->getName()), $token->getLine()));
$module->setAttribute('index', $this->generateEmbeddedTemplateIndex($stream->getSourceContext()->getName(), $token->getLine()));

$stream->expect(Token::BLOCK_END_TYPE);

Expand Down
36 changes: 0 additions & 36 deletions src/TwigComponent/src/Twig/TemplateNameParser.php

This file was deleted.

47 changes: 0 additions & 47 deletions src/TwigComponent/tests/Unit/Twig/TemplateNameParserTest.php

This file was deleted.

0 comments on commit ec09cdf

Please sign in to comment.