Skip to content

Commit

Permalink
Fix number_format() with named arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 17, 2021
1 parent e8ef187 commit d4fb41c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions resources/functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7786,8 +7786,7 @@
'nsapi_response_headers' => ['array'],
'nsapi_virtual' => ['bool', 'uri'=>'string'],
'nthmac' => ['string', 'clent'=>'string', 'data'=>'string'],
'number_format' => ['string', 'number'=>'float', 'num_decimal_places='=>'int'],
'number_format\'1' => ['string', 'number'=>'float', 'num_decimal_places'=>'int', 'dec_separator'=>'string', 'thousands_separator'=>'string'],
'number_format' => ['string', 'number'=>'float', 'num_decimal_places='=>'int', 'dec_separator='=>'string|null', 'thousands_separator='=>'string|null'],
'NumberFormatter::__construct' => ['void', 'locale'=>'string', 'style'=>'int', 'pattern='=>'string'],
'NumberFormatter::create' => ['NumberFormatter', 'locale'=>'string', 'style'=>'int', 'pattern='=>'string'],
'NumberFormatter::format' => ['string', 'num'=>'', 'type='=>'int'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,13 @@ public function testBug3920(): void
$this->analyse([__DIR__ . '/data/bug-3920.php'], []);
}

public function testBugNumberFormatNamedArguments(): void
{
if (PHP_VERSION_ID < 80000 && !self::$useStaticReflectionProvider) {
$this->markTestSkipped('Test requires PHP 8.0');
}

$this->analyse([__DIR__ . '/data/number-format-named-arguments.php'], []);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php declare(strict_types = 1); // lint >= 8.0

\number_format(200.00, decimals: 2, decimal_separator: ',', thousands_separator: '&nbsp;');

0 comments on commit d4fb41c

Please sign in to comment.