@@ -290,9 +290,9 @@ |
||
| 290 | 290 | $catch_context->vars_in_scope[$catch_var_id] = new Union( |
| 291 | 291 | array_map( |
| 292 | 292 | /** |
| 293 | - * @param string $fq_catch_class |
|
| 293 | + * @param StatementsAnalyzer $fq_catch_class |
|
| 294 | 294 | * |
| 295 | - * @return Type\Atomic |
|
| 295 | + * @return false|null |
|
| 296 | 296 | */ |
| 297 | 297 | function ($fq_catch_class) use ($codebase) { |
| 298 | 298 | $catch_class_type = new TNamedObject($fq_catch_class); |
@@ -466,6 +466,7 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | /** |
| 468 | 468 | * @param TValue ...$values |
| 469 | + * @param TValue[] $values |
|
| 469 | 470 | */ |
| 470 | 471 | public function contains(...$values): bool; |
| 471 | 472 | |
@@ -482,19 +483,20 @@ discard block |
||
| 482 | 483 | public function find($value); |
| 483 | 484 | |
| 484 | 485 | /** |
| 485 | - * @return TValue |
|
| 486 | + * @return TValue|null |
|
| 486 | 487 | * @throws \UnderflowException |
| 487 | 488 | */ |
| 488 | 489 | public function first(); |
| 489 | 490 | |
| 490 | 491 | /** |
| 491 | - * @return TValue |
|
| 492 | + * @return TValue|null |
|
| 492 | 493 | * @throws \OutOfRangeException |
| 493 | 494 | */ |
| 494 | 495 | public function get(int $index); |
| 495 | 496 | |
| 496 | 497 | /** |
| 497 | 498 | * @param TValue ...$values |
| 499 | + * @param TValue[] $values |
|
| 498 | 500 | * @throws \OutOfRangeException |
| 499 | 501 | */ |
| 500 | 502 | public function insert(int $index, ...$values); |
@@ -506,7 +508,7 @@ discard block |
||
| 506 | 508 | public function join(string $glue = null): string; |
| 507 | 509 | |
| 508 | 510 | /** |
| 509 | - * @return TValue |
|
| 511 | + * @return TValue|null |
|
| 510 | 512 | * @throws \UnderflowException |
| 511 | 513 | */ |
| 512 | 514 | public function last(); |
@@ -526,13 +528,14 @@ discard block |
||
| 526 | 528 | public function merge(iterable $values): Sequence; |
| 527 | 529 | |
| 528 | 530 | /** |
| 529 | - * @return TValue |
|
| 531 | + * @return TValue|null |
|
| 530 | 532 | * @throws \UnderflowException |
| 531 | 533 | */ |
| 532 | 534 | public function pop(); |
| 533 | 535 | |
| 534 | 536 | /** |
| 535 | 537 | * @param TValue ...$values |
| 538 | + * @param TValue[] $values |
|
| 536 | 539 | */ |
| 537 | 540 | public function push(...$values); |
| 538 | 541 | |
@@ -540,12 +543,12 @@ discard block |
||
| 540 | 543 | * @template TCarry |
| 541 | 544 | * @param callable(TCarry, TValue): TCarry $callback |
| 542 | 545 | * @param TCarry $initial |
| 543 | - * @return TCarry |
|
| 546 | + * @return TCarry|null |
|
| 544 | 547 | */ |
| 545 | 548 | public function reduce(callable $callback, $initial = null); |
| 546 | 549 | |
| 547 | 550 | /** |
| 548 | - * @return TValue |
|
| 551 | + * @return TValue|null |
|
| 549 | 552 | * @throws \OutOfRangeException |
| 550 | 553 | */ |
| 551 | 554 | public function remove(int $index); |
@@ -562,7 +565,7 @@ discard block |
||
| 562 | 565 | public function set(int $index, $value); |
| 563 | 566 | |
| 564 | 567 | /** |
| 565 | - * @return TValue |
|
| 568 | + * @return TValue|null |
|
| 566 | 569 | * @throws \UnderflowException |
| 567 | 570 | */ |
| 568 | 571 | public function shift(); |
@@ -585,6 +588,7 @@ discard block |
||
| 585 | 588 | |
| 586 | 589 | /** |
| 587 | 590 | * @param TValue ...$values |
| 591 | + * @param TValue[] $values |
|
| 588 | 592 | */ |
| 589 | 593 | public function unshift(...$values); |
| 590 | 594 | } |
@@ -739,6 +743,7 @@ discard block |
||
| 739 | 743 | |
| 740 | 744 | /** |
| 741 | 745 | * @param TValue ...$values |
| 746 | + * @param TValue[] $values |
|
| 742 | 747 | */ |
| 743 | 748 | public function add(...$values): void |
| 744 | 749 | { |
@@ -746,6 +751,7 @@ discard block |
||
| 746 | 751 | |
| 747 | 752 | /** |
| 748 | 753 | * @param TValue ...$values |
| 754 | + * @param TValue[] $values |
|
| 749 | 755 | */ |
| 750 | 756 | public function contains(...$values): bool |
| 751 | 757 | { |
@@ -819,6 +825,7 @@ discard block |
||
| 819 | 825 | |
| 820 | 826 | /** |
| 821 | 827 | * @param TValue ...$values |
| 828 | + * @param TValue[] $values |
|
| 822 | 829 | */ |
| 823 | 830 | public function remove(...$values): void |
| 824 | 831 | { |
@@ -917,6 +924,7 @@ discard block |
||
| 917 | 924 | |
| 918 | 925 | /** |
| 919 | 926 | * @param TValue ...$values |
| 927 | + * @param TValue[] $values |
|
| 920 | 928 | */ |
| 921 | 929 | public function push(...$values): void |
| 922 | 930 | { |
@@ -968,6 +976,7 @@ discard block |
||
| 968 | 976 | |
| 969 | 977 | /** |
| 970 | 978 | * @param TValue ...$values |
| 979 | + * @param TValue[] $values |
|
| 971 | 980 | */ |
| 972 | 981 | public function push(...$values): void |
| 973 | 982 | { |
@@ -884,6 +884,7 @@ discard block |
||
| 884 | 884 | |
| 885 | 885 | /** |
| 886 | 886 | * @param non-empty-string $function_id |
| 887 | + * @param \Psalm\Storage\FunctionStorage|null $function_storage |
|
| 887 | 888 | */ |
| 888 | 889 | private static function getFunctionCallReturnType( |
| 889 | 890 | StatementsAnalyzer $statements_analyzer, |
@@ -1189,6 +1190,9 @@ discard block |
||
| 1189 | 1190 | return true; |
| 1190 | 1191 | } |
| 1191 | 1192 | |
| 1193 | + /** |
|
| 1194 | + * @param \Psalm\Storage\FunctionStorage|null $function_storage |
|
| 1195 | + */ |
|
| 1192 | 1196 | private static function checkFunctionCallPurity( |
| 1193 | 1197 | StatementsAnalyzer $statements_analyzer, |
| 1194 | 1198 | \Psalm\Codebase $codebase, |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | $array_values = array_map( |
| 590 | 590 | /** |
| 591 | - * @return PhpParser\Node\Expr\ArrayItem |
|
| 591 | + * @return boolean |
|
| 592 | 592 | */ |
| 593 | 593 | function (PhpParser\Node\Arg $arg) { |
| 594 | 594 | return new PhpParser\Node\Expr\ArrayItem($arg->value); |
@@ -1346,6 +1346,9 @@ discard block |
||
| 1346 | 1346 | return true; |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | + /** |
|
| 1350 | + * @param \Psalm\Storage\MethodStorage|null $method_storage |
|
| 1351 | + */ |
|
| 1349 | 1352 | private static function taintReturnType( |
| 1350 | 1353 | StatementsAnalyzer $statements_analyzer, |
| 1351 | 1354 | PhpParser\Node\Expr\StaticCall $stmt, |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | if ($storage instanceof MethodStorage) { |
| 405 | 405 | $non_null_param_types = array_filter( |
| 406 | 406 | $storage->params, |
| 407 | - /** @return bool */ |
|
| 407 | + /** @return null|false */ |
|
| 408 | 408 | function (FunctionLikeParameter $p) { |
| 409 | 409 | return $p->type !== null && $p->has_docblock_type; |
| 410 | 410 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | } else { |
| 413 | 413 | $non_null_param_types = array_filter( |
| 414 | 414 | $storage->params, |
| 415 | - /** @return bool */ |
|
| 415 | + /** @return null|false */ |
|
| 416 | 416 | function (FunctionLikeParameter $p) { |
| 417 | 417 | return $p->type !== null; |
| 418 | 418 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | ) { |
| 426 | 426 | $types_without_docblocks = array_filter( |
| 427 | 427 | $storage->params, |
| 428 | - /** @return bool */ |
|
| 428 | + /** @return null|false */ |
|
| 429 | 429 | function (FunctionLikeParameter $p) { |
| 430 | 430 | return !$p->type || !$p->has_docblock_type; |
| 431 | 431 | } |
@@ -839,6 +839,9 @@ discard block |
||
| 839 | 839 | return null; |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | + /** |
|
| 843 | + * @param \Psalm\Storage\ClassLikeStorage|null $class_storage |
|
| 844 | + */ |
|
| 842 | 845 | private function checkParamReferences( |
| 843 | 846 | StatementsAnalyzer $statements_analyzer, |
| 844 | 847 | FunctionLikeStorage $storage, |
@@ -962,6 +965,7 @@ discard block |
||
| 962 | 965 | /** |
| 963 | 966 | * @param array<int, \Psalm\Storage\FunctionLikeParameter> $params |
| 964 | 967 | * @param array<int, Type\Union> $implemented_docblock_param_types |
| 968 | + * @param string|null $cased_method_id |
|
| 965 | 969 | */ |
| 966 | 970 | private function processParams( |
| 967 | 971 | StatementsAnalyzer $statements_analyzer, |
@@ -1471,7 +1475,6 @@ discard block |
||
| 1471 | 1475 | /** |
| 1472 | 1476 | * Adds return types for the given function |
| 1473 | 1477 | * |
| 1474 | - * @param string $return_type |
|
| 1475 | 1478 | * @param Context $context |
| 1476 | 1479 | * |
| 1477 | 1480 | * @return void |
@@ -691,6 +691,7 @@ |
||
| 691 | 691 | * @param string|null $cased_method_id |
| 692 | 692 | * @param FunctionLikeParameter|null $last_param |
| 693 | 693 | * @param array<int, FunctionLikeParameter> $function_params |
| 694 | + * @param FunctionLikeParameter[] $function_params |
|
| 694 | 695 | * @return false|null |
| 695 | 696 | */ |
| 696 | 697 | private static function handlePossiblyMatchingByRefParam( |
@@ -305,6 +305,9 @@ discard block |
||
| 305 | 305 | return true; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | + /** |
|
| 309 | + * @param null|string $keyed_array_var_id |
|
| 310 | + */ |
|
| 308 | 311 | public static function taintArrayFetch( |
| 309 | 312 | StatementsAnalyzer $statements_analyzer, |
| 310 | 313 | PhpParser\Node\Expr $var, |
@@ -1468,6 +1471,9 @@ discard block |
||
| 1468 | 1471 | return $array_access_type; |
| 1469 | 1472 | } |
| 1470 | 1473 | |
| 1474 | + /** |
|
| 1475 | + * @param null|string $array_var_id |
|
| 1476 | + */ |
|
| 1471 | 1477 | private static function checkLiteralIntArrayOffset( |
| 1472 | 1478 | Type\Union $offset_type, |
| 1473 | 1479 | Type\Union $expected_offset_type, |
@@ -1517,6 +1523,9 @@ discard block |
||
| 1517 | 1523 | } |
| 1518 | 1524 | } |
| 1519 | 1525 | |
| 1526 | + /** |
|
| 1527 | + * @param null|string $array_var_id |
|
| 1528 | + */ |
|
| 1520 | 1529 | private static function checkLiteralStringArrayOffset( |
| 1521 | 1530 | Type\Union $offset_type, |
| 1522 | 1531 | Type\Union $expected_offset_type, |
@@ -35,7 +35,6 @@ |
||
| 35 | 35 | use Psalm\Storage\FunctionLikeStorage; |
| 36 | 36 | use Psalm\Storage\MethodStorage; |
| 37 | 37 | use Psalm\Type; |
| 38 | -use Psalm\Internal\Type\TypeCombination; |
|
| 39 | 38 | use function strtolower; |
| 40 | 39 | use function substr; |
| 41 | 40 | use function count; |
@@ -9,8 +9,6 @@ |
||
| 9 | 9 | use Psalm\CodeLocation; |
| 10 | 10 | use Psalm\Context; |
| 11 | 11 | use Psalm\Internal\Analyzer\Statements\Expression\CallAnalyzer; |
| 12 | -use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer; |
|
| 13 | -use Psalm\Internal\Codebase\InternalCallMapHandler; |
|
| 14 | 12 | use Psalm\Internal\Type\ArrayType; |
| 15 | 13 | use Psalm\StatementsSource; |
| 16 | 14 | use Psalm\Type; |