8000 minor #33808 [Console] Throw a TypeError for non-int return value cal… · symfony/symfony@ebda9d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit ebda9d1

Browse files
minor #33808 [Console] Throw a TypeError for non-int return value calling Command::execute() (jschaedl)
This PR was merged into the 5.0-dev branch. Discussion ---------- [Console] Throw a TypeError for non-int return value calling Command::execute() | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #33747 <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | - <!-- required for new features --> ### Todo - [x] needs to be rebased after 4.4 was merged into master (see: #33805) Commits ------- b3a3b0c [Console] Throw a TypeError for non-int return values on calling Command::execute()
2 parents 95ebca5 + b3a3b0c commit ebda9d1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CHANGELOG
1010
* removed `TableStyle::getHorizontalBorderChar()` method in favor of `TableStyle::getBorderChars()`
1111
* removed `TableStyle::setVerticalBorderChar()` method in favor of `TableStyle::setVerticalBorderChars()`
1212
* removed `TableStyle::getVerticalBorderChar()` method in favor of `TableStyle::getBorderChars()`
13+
* removed support for returning `null` from `Command::execute()`, return `0` instead
1314
* `ProcessHelper::run()` accepts only `array|Symfony\Component\Process\Process` for its `command` argument
1415
* `Application::setDispatcher` accepts only `Symfony\Contracts\EventDispatcher\EventDispatcherInterface`
1516
for its `dispatcher` argument

src/Symfony/Component/Console/Command/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public function run(InputInterface $input, OutputInterface $output)
255255
$statusCode = $this->execute($input, $output);
256256

257257
if (!\is_int($statusCode)) {
258-
@trigger_error(sprintf('Return value of "%s::execute()" should always be of the type int since Symfony 4.4, %s returned.', \get_class($this), \gettype($statusCode)), E_USER_DEPRECATED);
258+
throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, %s returned.', \get_class($this), \gettype($statusCode)));
259259
}
260260
}
261261

0 commit comments

Comments
 (0)
0