[Console] Add new placeholder for application invoke method. #38349
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was a bit puzzled to find that the help for the
list
andhelp
commands suggests that you call the console application by prefixing it withphp myconsoleapp
.I am providing a script with a shebang like the first example from like is suggested in the following link:
https://symfony.com/doc/current/components/console.html
Eventually I want to distribute my console app as docker image so there is no need for php installed or the users even knowing is written in php.
The script name is easy to override by just setting a different value to
$_SERVER['PHP_SELF']
but thisphp
prefix is hardcoded into the help strings for the the two default commands available.What I came up with is the concept of "invoke method" to refer to that
php
prefix and I added methods in the Application class to be able to remove it completely when is not needed. The default is set to the value that symfony 5.1 currently uses so is backwards compatible.Slightly related to #38347 as I am trying to improve the console help output.
I didn't see any reference to the other placeholders in symfony/symfony-docs but I am willing to create docs for the three available if there interest in this feature.
What do you think?