You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Process] Allow writing portable "prepared" command lines
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #23778
| License | MIT
| Doc PR | symfony/symfony-docs#9295
This give the opportunity to create process commands that allow to changes only the values instead of changing the code.
Commits
-------
d1e4f48 [Process] Allow writing portable "prepared" command lines
returnpreg_replace_callback('/\{\{ ?([_a-zA-Z0-9]++) ?\}\}/', function ($m) use ($pattern, $commandline, $env) {
1560
+
if (!isset($env[$m[1]]) || false === $env[$m[1]]) {
1561
+
foreach ($envas$k => $v) {
1562
+
if (false === $v) {
1563
+
unset($env[$k]);
1564
+
}
1565
+
}
1566
+
if (!$env) {
1567
+
thrownewInvalidArgumentException(sprintf('Invalid command line "%s": no values provided for any placeholders.', $commandline));
1568
+
}
1569
+
$env = implode('", "', array_keys($env));
1570
+
1571
+
thrownewInvalidArgumentException(sprintf('Invalid command line "%s": no value provided for placeholder "%s", did you mean "%s"?', $commandline, $m[1], $env));
0 commit comments