Skip to content

Commit

Permalink
Merge pull request #10488 from kkmuffme/invalidargument-false-not-tru…
Browse files Browse the repository at this point in the history
…e-param

add InvalidArgument error when passing false to true param
  • Loading branch information
orklah authored Dec 13, 2023
2 parents f7fe4cf + d04694f commit 3bc8cde
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ public static function verifyType(
$input_type,
$param_type,
true,
true,
!isset($param_type->getAtomicTypes()['true']),
$union_comparison_results,
);

Expand Down
11 changes: 11 additions & 0 deletions tests/FunctionCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2358,6 +2358,17 @@ function fooFoo(int $a): void {}
fooFoo("string");',
'error_message' => 'InvalidArgument',
],
'invalidArgumentFalseTrueExpected' => [
'code' => '<?php
/**
* @param true|string $arg
* @return void
*/
function foo($arg) {}
foo(false);',
'error_message' => 'InvalidArgument',
],
'builtinFunctioninvalidArgumentWithWeakTypes' => [
'code' => '<?php
$s = substr(5, 4);',
Expand Down

0 comments on commit 3bc8cde

Please sign in to comment.