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
Copy file name to clipboardExpand all lines: UPGRADE-7.3.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,28 @@ Read more about this in the [Symfony documentation](https://symfony.com/doc/7.3/
8
8
9
9
If you're upgrading from a version below 7.1, follow the [7.2 upgrade guide](UPGRADE-7.2.md) first.
10
10
11
+
Console
12
+
-------
13
+
14
+
* Omitting parameter types in callables configured via `Command::setCode` method is deprecated
15
+
16
+
*Before*
17
+
```php
18
+
$command->setCode(function ($input, $output) {
19
+
// ...
20
+
});
21
+
```
22
+
23
+
*After*
24
+
```php
25
+
use Symfony\Component\Console\Input\InputInterface;
26
+
use Symfony\Component\Console\Output\OutputInterface;
if (null !== $statusCode && !\is_int($statusCode)) {
50
-
// throw new LogicException(\sprintf('The command "%s" must return either void or an integer value in the "%s" method, but "%s" was returned.', $this->command->getName(), $this->reflection->getName(), get_debug_type($statusCode)));
51
-
trigger_deprecation('symfony/console', '7.3', \sprintf('Returning a non-integer value from the command "%s" is deprecated and will throw an exception in PHP 8.0.', $this->command->getName()));
51
+
if ($this->triggerDeprecations) {
52
+
trigger_deprecation('symfony/console', '7.3', \sprintf('Returning a non-integer value from the command "%s" is deprecated and will throw an exception in PHP 8.0.', $this->command->getName()));
52
53
53
-
return0;
54
+
return0;
55
+
}
56
+
57
+
thrownewLogicException(\sprintf('The command "%s" must return either void or an integer value in the "%s" method, but "%s" was returned.', $this->command->getName(), $this->reflection->getName(), get_debug_type($statusCode)));
54
58
}
55
59
56
60
return$statusCode ?? 0;
@@ -92,10 +96,13 @@ private function getParameters(InputInterface $input, OutputInterface $output):
92
96
$type = $parameter->getType();
93
97
94
98
if (!$typeinstanceof \ReflectionNamedType) {
95
-
// throw new LogicException(\sprintf('The parameter "$%s" must have a named type. Untyped, Union or Intersection types are not supported.', $parameter->getName()));
96
-
trigger_deprecation('symfony/console', '7.3', \sprintf('Omitting the type declaration for the parameter "$%s" is deprecated and will throw an exception in PHP 8.0.', $parameter->getName()));
99
+
if ($this->triggerDeprecations) {
100
+
trigger_deprecation('symfony/console', '7.3', \sprintf('Omitting the type declaration for the parameter "$%s" is deprecated and will throw an exception in PHP 8.0.', $parameter->getName()));
97
101
98
-
continue;
102
+
continue;
103
+
}
104
+
105
+
thrownewLogicException(\sprintf('The parameter "$%s" must have a named type. Untyped, Union or Intersection types are not supported.', $parameter->getName()));
0 commit comments