Skip to content

Commit c81e1a7

Browse files
committed
Deprecate returning a non-integer value from a \Closure function set via Command::setCode()
1 parent 90cd2c4 commit c81e1a7

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Tests/Console/ApplicationTest.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ public function testRunOnlyWarnsOnUnregistrableCommand()
135135
$kernel
136136
->method('getBundles')
137137
->willReturn([$this->createBundleMock(
138-
[(new Command('fine'))->setCode(function (InputInterface $input, OutputInterface $output) { $output->write('fine'); })]
138+
[(new Command('fine'))->setCode(function (InputInterface $input, OutputInterface $output): int {
139+
$output->write('fine');
140+
141+
return 0;
142+
})]
139143
)]);
140144
$kernel
141145
->method('getContainer')
@@ -163,7 +167,11 @@ public function testRegistrationErrorsAreDisplayedOnCommandNotFound()
163167
$kernel
164168
->method('getBundles')
165169
->willReturn([$this->createBundleMock(
166-
[(new Command(null))->setCode(function (InputInterface $input, OutputInterface $output) { $output->write('fine'); })]
170+
[(new Command(null))->setCode(function (InputInterface $input, OutputInterface $output): int {
171+
$output->write('fine');
172+
173+
return 0;
174+
})]
167175
)]);
168176
$kernel
169177
->method('getContainer')
@@ -193,7 +201,11 @@ public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd()
193201
$kernel
194202
->method('getBundles')
195203
->willReturn([$this->createBundleMock(
196-
[(new Command('fine'))->setCode(function (InputInterface $input, OutputInterface $output) { $output->write('fine'); })]
204+
[(new Command('fine'))->setCode(function (InputInterface $input, OutputInterface $output): int {
205+
$output->write('fine');
206+
207+
return 0;
208+
})]
197209
)]);
198210
$kernel
199211
->method('getContainer')

0 commit comments

Comments
 (0)