-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
removed all *.class parameters #14070
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
Conversation
fabpot
commented
Mar 26, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | yes |
Deprecations? | no |
Tests pass? | no |
Fixed tickets | #11881, #12822 |
License | MIT |
Doc PR | none |
Here is the script I used: <?php
require_once __DIR__.'/vendor/autoload.php';
use Symfony\Component\Finder\Finder;
$finder = (new Finder())->name('*.xml')->in(__DIR__.'/src');
$values = array();
foreach ($finder as $file) {
$contents = file_get_contents($file);
$new = preg_replace_callback("{^ +<parameter key=\"([^\"]+)\.class\">([^<]+)</parameter>\n}m", function ($match) use (&$values) {
$values['%'.$match[1].'.class%'] = $match[2];
}, $contents);
$new = preg_replace("{^ +<parameters>\s+</parameters>\n\n}sm", '', $new);
$new = preg_replace("{</parameter>\s+</parameters>}s", "</parameter>\n </parameters>", $new);
$new = preg_replace("{<parameters>\s+ <parameter}s", "<parameters>\n <parameter", $new);
if ($new != $contents) {
file_put_contents($file, $new);
}
}
$finder = (new Finder())->in(__DIR__.'/src');
foreach ($finder as $file) {
$contents = file_get_contents($file);
$new = preg_replace_callback('{%[a-zA-Z0-9\._]+\.class%}', function ($match) use ($values) {
return isset($values[$match[0]]) ? $values[$match[0]] : $match[0];
}, $contents);
if ($new != $contents) {
file_put_contents($file, $new);
}
} |
👍 |
@@ -30,8 +30,6 @@ public function testLoadEmptyConfiguration() | |||
$container->loadFromExtension('twig', array()); | |||
$this->compileContainer($container); | |||
|
|||
$this->assertEquals('Twig_Environment', $container->getParameter('twig.class'), '->load() loads the twig.xml file'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this tests needs to be replaced by testing whether the twig
service is defined to keep that test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Apart from the two small things looks ok to me. |
ebf5eca
to
8835d1a
Compare
👍 |
This PR was merged into the 3.0-dev branch. Discussion ---------- removed all *.class parameters | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | no | Fixed tickets | #11881, #12822 | License | MIT | Doc PR | none Commits ------- 8835d1a removed all *.class parameters