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

Skip to content

Commit 9bb23e1

Browse files
Use is_numeric()
1 parent 38bcfcb commit 9bb23e1

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 (!ctype_digit($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)