Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d282ec

Browse files
committed
minor symfony#9741 [Console] Fix SymfonyStyle::ask usage (liviubalan, javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- [Console] Fix SymfonyStyle::ask usage Use function "ctype_digit" instead of "is_integer" because "$number" is not an integer value, but a string <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 9bb23e1 Use is_numeric() 38bcfcb [Console] Fix SymfonyStyle::ask usage
2 parents 7d2018d + 9bb23e1 commit 9d282ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

console/style.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,11 @@ User Input Methods
238238
the third argument::
239239

240240
$io->ask('Number of workers to start', 1, function ($number) {
241-
if (!is_integer($number)) {
242-
throw new \RuntimeException('You must type an integer.');
241+
if (!is_numeric($number)) {
242+
throw new \RuntimeException('You must type a number.');
243243
}
244244

245-
return $number;
245+
return (int) $number;
246246
});
247247

248248
:method:`Symfony\\Component\\Console\\Style\\SymfonyStyle::askHidden`

0 commit comments

Comments
 (0)