Skip to content

Commit 76f21c3

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: rework the usage of '*' for the protocols option [Console] Fix invokable command running other commands
2 parents ce17f39 + 635f651 commit 76f21c3

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

console/calling_commands.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ the returned code from the command (return value from command ``__invoke()``
1818
method)::
1919

2020
// ...
21+
use Symfony\Component\Console\Application;
2122
use Symfony\Component\Console\Attribute\AsCommand;
2223
use Symfony\Component\Console\Input\ArrayInput;
2324
use Symfony\Component\Console\Output\OutputInterface;
2425

2526
#[AsCommand(name: 'app:create-user')]
2627
class CreateUserCommand
2728
{
28-
public function __invoke(OutputInterface $output): int
29+
public function __invoke(OutputInterface $output, Application $application): int
2930
{
3031
$greetInput = new ArrayInput([
3132
// the command name is passed as first argument
@@ -37,7 +38,7 @@ method)::
3738
// disable interactive behavior for the greet command
3839
$greetInput->setInteractive(false);
3940

40-
$returnCode = $this->getApplication()->doRun($greetInput, $output);
41+
$returnCode = $application->doRun($greetInput, $output);
4142

4243
// ...
4344
}
@@ -54,8 +55,8 @@ method)::
5455
Using ``doRun()`` instead of ``run()`` prevents autoexiting and allows to
5556
return the exit code instead.
5657

57-
Also, using ``$this->getApplication()->doRun()`` instead of
58-
``$this->getApplication()->find('demo:greet')->run()`` will allow proper
58+
Also, using ``$application->doRun()`` instead of
59+
``$application->find('demo:greet')->run()`` will allow proper
5960
events to be dispatched for that inner command as well.
6061

6162
.. warning::

reference/constraints/Url.rst

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Parameter Description
165165
``protocols``
166166
~~~~~~~~~~~~~
167167

168-
**type**: ``array`` **default**: ``['http', 'https']``
168+
**type**: ``array|string`` **default**: ``['http', 'https']``
169169

170170
The protocols considered to be valid for the URL. For example, if you also consider
171171
the ``ftp://`` type URLs to be valid, redefine the ``protocols`` array, listing
@@ -237,20 +237,15 @@ the ``ftp://`` type URLs to be valid, redefine the ``protocols`` array, listing
237237
}
238238
}
239239
240-
The value of this option can also be an asterisk (``*``) to allow all protocols
241-
or a regular expression::
240+
The value of this option can also be an asterisk (``*``) to allow all protocols::
242241

243242
// allows all protocols whose names are RFC 3986 compliant
244243
// (e.g. 'https://', 'git+ssh://', 'file://', 'custom://')
245-
protocols: ['*']
246-
247-
// regular expressions are also valid
248-
protocols: ['https?', 'custom.*', 'my-app-.*']
244+
protocols: '*'
249245

250246
.. versionadded:: 7.4
251247

252-
Support for ``*`` and regular expressions in the ``protocols`` option was
253-
introduced in Symfony 7.4.
248+
Support for ``*`` in the ``protocols`` option was introduced in Symfony 7.4.
254249

255250
``relativeProtocol``
256251
~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)