From 0ef7ec100a365fc8855047ca5ced4a9bc554e059 Mon Sep 17 00:00:00 2001 From: Leo Viezens Date: Fri, 25 Nov 2022 15:45:34 +0100 Subject: [PATCH 001/109] #7387 Add asserting non-empty-string by strlen --- .../Statements/Expression/AssertionFinder.php | 333 +++++++++++++++++- tests/TypeReconciliation/EmptyTest.php | 119 +++++++ 2 files changed, 437 insertions(+), 15 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php index d4520275509..bb1a1a7f565 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php @@ -448,6 +448,8 @@ private static function scrapeEqualityAssertions( $count = null; $count_equality_position = self::hasCountEqualityCheck($conditional, $count); + $strlen = null; + $strlen_equality_position = self::hasStrlenEqualityCheck($conditional, $strlen); if ($count_equality_position) { $if_types = []; @@ -498,6 +500,58 @@ private static function scrapeEqualityAssertions( return $if_types ? [$if_types] : []; } + if ($strlen_equality_position) { + $if_types = []; + + if ($strlen_equality_position === self::ASSIGNMENT_TO_RIGHT) { + $strlen_expr = $conditional->left; + } elseif ($strlen_equality_position === self::ASSIGNMENT_TO_LEFT) { + $strlen_expr = $conditional->right; + } else { + throw new UnexpectedValueException('$strlen_equality_position value'); + } + + /** @var PhpParser\Node\Expr\FuncCall $strlen_expr */ + if (!isset($strlen_expr->getArgs()[0])) { + return []; + } + $var_name = ExpressionIdentifier::getExtendedVarId( + $strlen_expr->getArgs()[0]->value, + $this_class_name, + $source + ); + + if ($source instanceof StatementsAnalyzer) { + $var_type = $source->node_data->getType($conditional->left); + $other_type = $source->node_data->getType($conditional->right); + + if ($codebase + && $other_type + && $var_type + && $conditional instanceof PhpParser\Node\Expr\BinaryOp\Identical + ) { + self::handleParadoxicalAssertions( + $source, + $var_type, + $this_class_name, + $other_type, + $codebase, + $conditional + ); + } + } + + if ($var_name) { + if ($strlen > 0) { + $if_types[$var_name] = [[new Assertion\NonEmpty()]]; + } else { + $if_types[$var_name] = [[new Empty_()]]; + } + } + + return $if_types ? [$if_types] : []; + } + if (!$source instanceof StatementsAnalyzer) { return []; } @@ -670,6 +724,9 @@ private static function scrapeInequalityAssertions( $count = null; $count_inequality_position = self::hasCountEqualityCheck($conditional, $count); + $strlen = null; + $strlen_inequality_position = self::hasStrlenEqualityCheck($conditional, $strlen); + if ($count_inequality_position) { $if_types = []; @@ -719,6 +776,58 @@ private static function scrapeInequalityAssertions( return $if_types ? [$if_types] : []; } + if ($strlen_inequality_position) { + $if_types = []; + + if ($strlen_inequality_position === self::ASSIGNMENT_TO_RIGHT) { + $strlen_expr = $conditional->left; + } elseif ($strlen_inequality_position === self::ASSIGNMENT_TO_LEFT) { + $strlen_expr = $conditional->right; + } else { + throw new UnexpectedValueException('$strlen_inequality_position value'); + } + + /** @var PhpParser\Node\Expr\FuncCall $strlen_expr */ + if (!isset($strlen_expr->getArgs()[0])) { + return []; + } + $var_name = ExpressionIdentifier::getExtendedVarId( + $strlen_expr->getArgs()[0]->value, + $this_class_name, + $source + ); + + if ($source instanceof StatementsAnalyzer) { + $var_type = $source->node_data->getType($conditional->left); + $other_type = $source->node_data->getType($conditional->right); + + if ($codebase + && $other_type + && $var_type + && $conditional instanceof PhpParser\Node\Expr\BinaryOp\NotIdentical + ) { + self::handleParadoxicalAssertions( + $source, + $var_type, + $this_class_name, + $other_type, + $codebase, + $conditional + ); + } + } + + if ($var_name) { + if ($strlen > 0) { + $if_types[$var_name] = [[new Assertion\Empty_()]]; + } else { + $if_types[$var_name] = [[new Assertion\NonEmpty()]]; + } + } + + return $if_types ? [$if_types] : []; + } + if (!$source instanceof StatementsAnalyzer) { return []; } @@ -1539,10 +1648,34 @@ protected static function hasGetClassCheck( protected static function hasNonEmptyCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, ?int &$min_count + ) { + return self::hasNonEmptyCountOrStrlenEqualityCheck($conditional, $min_count, ['count']); + } + + /** + * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional + * @return false|int + */ + protected static function hasNonEmptyStrlenEqualityCheck( + PhpParser\Node\Expr\BinaryOp $conditional, + ?int &$min_count + ) { + return self::hasNonEmptyCountOrStrlenEqualityCheck($conditional, $min_count, ['strlen', 'mb_strlen']); + } + + /** + * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional + * @param array $funcCallNames + * @return false|int + */ + protected static function hasNonEmptyCountOrStrlenEqualityCheck( + PhpParser\Node\Expr\BinaryOp $conditional, + ?int &$min_value, + array $funcCallNames ) { if ($conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name - && strtolower($conditional->left->name->parts[0]) === 'count' + && in_array(strtolower($conditional->left->name->parts[0]), $funcCallNames) && $conditional->left->getArgs() && ($conditional instanceof BinaryOp\Greater || $conditional instanceof BinaryOp\GreaterOrEqual) ) { @@ -1551,7 +1684,7 @@ protected static function hasNonEmptyCountEqualityCheck( $comparison_adjustment = $conditional instanceof BinaryOp\Greater ? 1 : 0; } elseif ($conditional->right instanceof PhpParser\Node\Expr\FuncCall && $conditional->right->name instanceof PhpParser\Node\Name - && strtolower($conditional->right->name->parts[0]) === 'count' + && in_array(strtolower($conditional->right->name->parts[0]), $funcCallNames) && $conditional->right->getArgs() && ($conditional instanceof BinaryOp\Smaller || $conditional instanceof BinaryOp\SmallerOrEqual) ) { @@ -1566,7 +1699,7 @@ protected static function hasNonEmptyCountEqualityCheck( if ($compare_to instanceof PhpParser\Node\Scalar\LNumber && $compare_to->value > (-1 * $comparison_adjustment) ) { - $min_count = $compare_to->value + $comparison_adjustment; + $min_value = $compare_to->value + $comparison_adjustment; return $assignment_to; } @@ -1581,10 +1714,34 @@ protected static function hasNonEmptyCountEqualityCheck( protected static function hasLessThanCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, ?int &$max_count + ) { + return self::hasLessThanCountOrStrlenEqualityCheck($conditional, $max_count, ['count']); + } + + /** + * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional + * @return false|int + */ + protected static function hasLessThanStrlenEqualityCheck( + PhpParser\Node\Expr\BinaryOp $conditional, + ?int &$max_strlen + ) { + return self::hasLessThanCountOrStrlenEqualityCheck($conditional, $max_strlen, ['strlen', 'mb_strlen']); + } + + /** + * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional + * @param array $funcCallNames + * @return false|int + */ + protected static function hasLessThanCountOrStrlenEqualityCheck( + PhpParser\Node\Expr\BinaryOp $conditional, + ?int &$max_value, + array $funcCallNames ) { $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name - && strtolower($conditional->left->name->parts[0]) === 'count' + && in_array(strtolower($conditional->left->name->parts[0]), $funcCallNames) && $conditional->left->getArgs(); $operator_less_than_or_equal = @@ -1595,7 +1752,7 @@ protected static function hasLessThanCountEqualityCheck( && $operator_less_than_or_equal && $conditional->right instanceof PhpParser\Node\Scalar\LNumber ) { - $max_count = $conditional->right->value - + $max_value = $conditional->right->value - ($conditional instanceof PhpParser\Node\Expr\BinaryOp\Smaller ? 1 : 0); return self::ASSIGNMENT_TO_RIGHT; @@ -1603,7 +1760,7 @@ protected static function hasLessThanCountEqualityCheck( $right_count = $conditional->right instanceof PhpParser\Node\Expr\FuncCall && $conditional->right->name instanceof PhpParser\Node\Name - && strtolower($conditional->right->name->parts[0]) === 'count' + && in_array(strtolower($conditional->right->name->parts[0]), $funcCallNames) && $conditional->right->getArgs(); $operator_greater_than_or_equal = @@ -1614,7 +1771,7 @@ protected static function hasLessThanCountEqualityCheck( && $operator_greater_than_or_equal && $conditional->left instanceof PhpParser\Node\Scalar\LNumber ) { - $max_count = $conditional->left->value - + $max_value = $conditional->left->value - ($conditional instanceof PhpParser\Node\Expr\BinaryOp\Greater ? 1 : 0); return self::ASSIGNMENT_TO_LEFT; @@ -1630,25 +1787,49 @@ protected static function hasLessThanCountEqualityCheck( protected static function hasCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, ?int &$count + ) { + return self::hasCountOrStrlenEqualityCheck($conditional, $count, ['count']); + } + + /** + * @param Equal|Identical|NotEqual|NotIdentical $conditional + * @return false|int + */ + protected static function hasStrlenEqualityCheck( + PhpParser\Node\Expr\BinaryOp $conditional, + ?int &$count + ) { + return self::hasCountOrStrlenEqualityCheck($conditional, $count, ['strlen', 'mb_strlen']); + } + + /** + * @param Equal|Identical|NotEqual|NotIdentical $conditional + * @param array $funcCallNames + * @return false|int + */ + protected static function hasCountOrStrlenEqualityCheck( + PhpParser\Node\Expr\BinaryOp $conditional, + ?int &$resultValue, + array $funcCallNames ) { $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name - && strtolower($conditional->left->name->parts[0]) === 'count' + && in_array(strtolower($conditional->left->name->parts[0]), $funcCallNames) && $conditional->left->getArgs(); if ($left_count && $conditional->right instanceof PhpParser\Node\Scalar\LNumber) { - $count = $conditional->right->value; + $resultValue = $conditional->right->value; return self::ASSIGNMENT_TO_RIGHT; } $right_count = $conditional->right instanceof PhpParser\Node\Expr\FuncCall && $conditional->right->name instanceof PhpParser\Node\Name - && strtolower($conditional->right->name->parts[0]) === 'count' + && in_array(strtolower($conditional->right->name->parts[0]), $funcCallNames) && $conditional->right->getArgs(); if ($right_count && $conditional->left instanceof PhpParser\Node\Scalar\LNumber) { - $count = $conditional->left->value; + $resultValue = $conditional->left->value; return self::ASSIGNMENT_TO_LEFT; } @@ -1783,15 +1964,37 @@ protected static function hasInferiorNumberCheck( protected static function hasReconcilableNonEmptyCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional ) { - $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall + return self::hasReconcilableNonEmptyCountOrStrlenEqualityCheck($conditional, ['count']); + } + + /** + * @param PhpParser\Node\Expr\BinaryOp\Greater|PhpParser\Node\Expr\BinaryOp\GreaterOrEqual $conditional + * @return false|int + */ + protected static function hasReconcilableNonEmptyStrlenEqualityCheck( + PhpParser\Node\Expr\BinaryOp $conditional + ) { + return self::hasReconcilableNonEmptyCountOrStrlenEqualityCheck($conditional, ['strlen', 'mb_strlen']); + } + + /** + * @param PhpParser\Node\Expr\BinaryOp\Greater|PhpParser\Node\Expr\BinaryOp\GreaterOrEqual $conditional + * @param array $funcCallNames + * @return false|int + */ + protected static function hasReconcilableNonEmptyCountOrStrlenEqualityCheck( + PhpParser\Node\Expr\BinaryOp $conditional, + array $funcCallNames + ) { + $left_value = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name - && strtolower($conditional->left->name->parts[0]) === 'count'; + && in_array(strtolower($conditional->left->name->parts[0]), $funcCallNames); $right_number = $conditional->right instanceof PhpParser\Node\Scalar\LNumber && $conditional->right->value === ( - $conditional instanceof PhpParser\Node\Expr\BinaryOp\Greater ? 0 : 1); + $conditional instanceof PhpParser\Node\Expr\BinaryOp\Greater ? 0 : 1); - if ($left_count && $right_number) { + if ($left_value && $right_number) { return self::ASSIGNMENT_TO_RIGHT; } @@ -3806,6 +4009,8 @@ private static function getGreaterAssertions( $conditional, $superior_value_comparison ); + $min_strlen = null; + $strlen_equality_position = self::hasNonEmptyStrlenEqualityCheck($conditional, $min_strlen); if ($count_equality_position) { if ($count_equality_position === self::ASSIGNMENT_TO_RIGHT) { @@ -3836,6 +4041,42 @@ private static function getGreaterAssertions( return $if_types ? [$if_types] : []; } + if ($strlen_equality_position) { + if ($strlen_equality_position === self::ASSIGNMENT_TO_RIGHT) { + $strlened_expr = $conditional->left; + } else { + throw new UnexpectedValueException('$strlen_equality_position value'); + } + + /** @var PhpParser\Node\Expr\FuncCall $strlened_expr */ + if (!isset($strlened_expr->getArgs()[0])) { + return []; + } + $var_name = ExpressionIdentifier::getExtendedVarId( + $strlened_expr->getArgs()[0]->value, + $this_class_name, + $source + ); + + if ($var_name) { + if (self::hasReconcilableNonEmptyStrlenEqualityCheck($conditional)) { + $if_types[$var_name] = [[new Assertion\NonEmpty()]]; + } else { + if ($min_strlen > 0) { + $if_types[$var_name] = [[new Assertion\NonEmpty()]]; + } else { + $if_types[$var_name] = [[new Empty_()]]; + } + } + } + + if ($var_name) { + $if_types[$var_name] = [[new Assertion\NonEmpty()]]; + } + + return $if_types ? [$if_types] : []; + } + if ($count_inequality_position) { if ($count_inequality_position === self::ASSIGNMENT_TO_LEFT) { $count_expr = $conditional->right; @@ -3912,6 +4153,12 @@ private static function getSmallerAssertions( $count_equality_position = self::hasNonEmptyCountEqualityCheck($conditional, $min_count); $max_count = null; $count_inequality_position = self::hasLessThanCountEqualityCheck($conditional, $max_count); + + $min_strlen = null; + $strlen_equality_position = self::hasNonEmptyStrlenEqualityCheck($conditional, $min_strlen); + $max_strlen = null; + $strlen_inequality_position = self::hasLessThanStrlenEqualityCheck($conditional, $max_strlen); + $inferior_value_comparison = null; $inferior_value_position = self::hasInferiorNumberCheck( $source, @@ -3969,6 +4216,62 @@ private static function getSmallerAssertions( return $if_types ? [$if_types] : []; } + if ($strlen_equality_position) { + if ($strlen_equality_position === self::ASSIGNMENT_TO_LEFT) { + $strlen_expr = $conditional->right; + } else { + throw new UnexpectedValueException('$strlen_equality_position value'); + } + + /** @var PhpParser\Node\Expr\FuncCall $strlen_expr */ + if (!isset($strlen_expr->getArgs()[0])) { + return []; + } + $var_name = ExpressionIdentifier::getExtendedVarId( + $strlen_expr->getArgs()[0]->value, + $this_class_name, + $source + ); + + if ($var_name) { + if ($min_strlen > 0) { + $if_types[$var_name] = [[new Assertion\NonEmpty()]]; + } else { + $if_types[$var_name] = [[new Empty_()]]; + } + } + + return $if_types ? [$if_types] : []; + } + + if ($strlen_inequality_position) { + if ($strlen_inequality_position === self::ASSIGNMENT_TO_RIGHT) { + $strlen_expr = $conditional->left; + } else { + throw new UnexpectedValueException('$strlen_inequality_position value'); + } + + /** @var PhpParser\Node\Expr\FuncCall $strlen_expr */ + if (!isset($strlen_expr->getArgs()[0])) { + return []; + } + $var_name = ExpressionIdentifier::getExtendedVarId( + $strlen_expr->getArgs()[0]->value, + $this_class_name, + $source + ); + + if ($var_name) { + if ($max_strlen > 0) { + $if_types[$var_name] = [[new Assertion\NonEmpty()]]; + } else { + $if_types[$var_name] = [[new Empty_()]]; + } + } + + return $if_types ? [$if_types] : []; + } + if ($inferior_value_position) { if ($inferior_value_position === self::ASSIGNMENT_TO_RIGHT) { $var_name = ExpressionIdentifier::getExtendedVarId( diff --git a/tests/TypeReconciliation/EmptyTest.php b/tests/TypeReconciliation/EmptyTest.php index 90a6f3bf252..78498c7b51b 100644 --- a/tests/TypeReconciliation/EmptyTest.php +++ b/tests/TypeReconciliation/EmptyTest.php @@ -417,6 +417,69 @@ function foo(array $arr): void { if (empty($arr["a"])) {} }' ], + 'strlenWithGreaterZero' => [ + 'code' => ' 0 ? $str : "string"; + }' + ], + 'strlenRighthandWithGreaterZero' => [ + 'code' => ' [ + 'code' => '= 1 ? $str : "string"; + }' + ], + 'strlenRighthandWithGreaterEqualsOne' => [ + 'code' => ' [ + 'code' => ' [ + 'code' => ' [ + 'code' => ' [ + 'code' => ' [ + 'code' => ' [ // #8163 'code' => ' 'MixedReturnTypeCoercion' ], + 'preventStrlenGreaterMinusOne' => [ + 'code' => ' -1 ? $str : "string"; + }', + 'error_message' => 'LessSpecificReturnStatement' + ], + 'preventRighthandStrlenGreaterMinusOne' => [ + 'code' => ' 'LessSpecificReturnStatement' + ], + 'preventStrlenGreaterEqualsZero' => [ + 'code' => '= 0 ? $str : "string"; + }', + 'error_message' => 'LessSpecificReturnStatement' + ], + 'preventStrlenEqualsZero' => [ + 'code' => ' 'InvalidReturnStatement' + ], + 'preventStrlenLessThanOne' => [ + 'code' => ' 'InvalidReturnStatement' + ], + 'preventStrlenLessEqualsZero' => [ + 'code' => ' 'InvalidReturnStatement' + ], + 'preventStrlenWithConcatenatedString' => [ + 'code' => ' 2 ? $str : "string"; + }', + 'error_message' => 'LessSpecificReturnStatement' + ], ]; } } From 2f385a905759c2f494cb63196408de3291c314f8 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Wed, 18 Jan 2023 20:54:49 +0100 Subject: [PATCH 002/109] Unify deprecation messages --- src/Psalm/Config.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index faee01d9f25..be96e3aba9e 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -2234,9 +2234,8 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null): $is_stub_already_loaded = in_array($ext_stub_path, $this->internal_stubs, true); if (! $is_stub_already_loaded && extension_loaded($ext_name)) { $this->internal_stubs[] = $ext_stub_path; - $progress->write("Deprecation: Psalm stubs for ext-$ext_name loaded using legacy way." - . " Instead, please declare ext-$ext_name as dependency in composer.json" - . " or use and/or directives in Psalm config.\n"); + $progress->write("Warning: Psalm 6 will not automatically load stubs for ext-$ext_name." + . " You should explicitly enable or disable this ext in composer.json or Psalm config.\n"); } } From a28d825476cb4e8720706819a0bbf366e87f1e25 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Wed, 18 Jan 2023 20:55:14 +0100 Subject: [PATCH 003/109] Do not display "Enabled extensions: " for empty ext list --- src/Psalm/Internal/Analyzer/ProjectAnalyzer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php index c89284b2922..b874537f0c3 100644 --- a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php @@ -564,8 +564,8 @@ private function generatePHPVersionMessage(): string $source, ); - if (count($codebase->config->php_extensions) > 0) { - $enabled_extensions_names = array_keys(array_filter($codebase->config->php_extensions)); + $enabled_extensions_names = array_keys(array_filter($codebase->config->php_extensions)); + if (count($enabled_extensions_names) > 0) { $message .= ' Enabled extensions: ' . implode(', ', $enabled_extensions_names); } From 089b388c91cc74cec733c51f5bc871a21aaaa33f Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Wed, 18 Jan 2023 21:19:30 +0100 Subject: [PATCH 004/109] Unify deprecation messages --- src/Psalm/Internal/Cli/Psalm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index b8d794103ee..b3e9510c788 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -1151,7 +1151,7 @@ private static function configureShepherd(Config $config, array $options, array if (is_string(getenv('PSALM_SHEPHERD_HOST'))) { // remove this block in Psalm 6 fwrite( STDERR, - 'PSALM_SHEPHERD_HOST env variable is deprecated and will be removed in Psalm 6.' + 'Warning: PSALM_SHEPHERD_HOST env variable will be removed in Psalm 6.' .' Please use "--shepherd" cli option or PSALM_SHEPHERD env variable' .' to specify a custom Shepherd host/endpoint.' . PHP_EOL, From bb2cf1f30ad32266a48f7ec3a61633e146e04b24 Mon Sep 17 00:00:00 2001 From: Mark McEver Date: Mon, 23 Jan 2023 15:09:29 -0600 Subject: [PATCH 005/109] Added @psalm-pure to filter_var() --- stubs/CoreGenericFunctions.phpstub | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stubs/CoreGenericFunctions.phpstub b/stubs/CoreGenericFunctions.phpstub index 90355efd586..51db73457c9 100644 --- a/stubs/CoreGenericFunctions.phpstub +++ b/stubs/CoreGenericFunctions.phpstub @@ -813,6 +813,8 @@ function array_sum(array $array) {} function array_product(array $array) {} /** + * @psalm-pure + * * 257 is FILTER_VALIDATE_INT * @psalm-taint-escape ($filter is 257 ? 'html' : null) * From 0cc770c947be52d48b081b54b73c6a756e58a236 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Tue, 24 Jan 2023 06:48:03 +0100 Subject: [PATCH 006/109] Use a new method to display warning --- src/Psalm/Config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 65d7ce4fe8a..c5ce6933e59 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -2243,8 +2243,8 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null): $is_stub_already_loaded = in_array($ext_stub_path, $this->internal_stubs, true); if (! $is_stub_already_loaded && extension_loaded($ext_name)) { $this->internal_stubs[] = $ext_stub_path; - $progress->write("Warning: Psalm 6 will not automatically load stubs for ext-$ext_name." - . " You should explicitly enable or disable this ext in composer.json or Psalm config.\n"); + $progress->warning("Psalm 6 will not automatically load stubs for ext-$ext_name." + . " You should explicitly enable or disable this ext in composer.json or Psalm config."); } } From 9d54de6a5172bf419b268835062b597fb5cf9b86 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Tue, 24 Jan 2023 06:50:09 +0100 Subject: [PATCH 007/109] Use a new method to display warning --- src/Psalm/Config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index c5ce6933e59..10083095fb8 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -2243,8 +2243,8 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null): $is_stub_already_loaded = in_array($ext_stub_path, $this->internal_stubs, true); if (! $is_stub_already_loaded && extension_loaded($ext_name)) { $this->internal_stubs[] = $ext_stub_path; - $progress->warning("Psalm 6 will not automatically load stubs for ext-$ext_name." - . " You should explicitly enable or disable this ext in composer.json or Psalm config."); + $this->config_warnings[] = "Psalm 6 will not automatically load stubs for ext-$ext_name." + . " You should explicitly enable or disable this ext in composer.json or Psalm config."; } } From d6aff3ed20598890c47255a85724fb763d679de7 Mon Sep 17 00:00:00 2001 From: shvlv Date: Tue, 24 Jan 2023 12:24:52 +0200 Subject: [PATCH 008/109] Parse class constant for PhpStorm Meta override --- .../Internal/Scanner/PhpStormMetaScanner.php | 33 +++++++++++++++++++ tests/StubTest.php | 16 +++++++++ tests/fixtures/stubs/phpstorm.meta.php | 7 ++++ 3 files changed, 56 insertions(+) diff --git a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php index 5870f492511..e49ba2baffe 100644 --- a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php +++ b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php @@ -12,6 +12,7 @@ use Psalm\Type\Atomic\TKeyedArray; use Psalm\Type\Atomic\TNamedObject; use Psalm\Type\Union; +use ReflectionProperty; use function count; use function implode; @@ -63,6 +64,38 @@ public static function handleOverride(array $args, Codebase $codebase): void } elseif ($array_item->value instanceof PhpParser\Node\Scalar\String_) { $map[$array_item->key->value] = $array_item->value->value; } + } elseif ($array_item->key instanceof PhpParser\Node\Expr\ClassConstFetch + && $array_item->key->class instanceof PhpParser\Node\Name\FullyQualified + && $array_item->key->name instanceof PhpParser\Node\Identifier + ) { + $resolved_name = $array_item->key->class->getAttribute('resolvedName'); + if (!$resolved_name) { + continue; + } + + $constant_type = $codebase->classlikes->getClassConstantType( + $resolved_name, + $array_item->key->name->name, + ReflectionProperty::IS_PUBLIC, + ); + + if (!$constant_type instanceof Union || !$constant_type->isSingleStringLiteral()) { + continue; + } + + $meta_key = $constant_type->getSingleStringLiteral()->value; + + if ($array_item->value instanceof PhpParser\Node\Expr\ClassConstFetch + && $array_item->value->class instanceof PhpParser\Node\Name\FullyQualified + && $array_item->value->name instanceof PhpParser\Node\Identifier + && strtolower($array_item->value->name->name) + ) { + $map[$meta_key] = new Union([ + new TNamedObject(implode('\\', $array_item->value->class->parts)), + ]); + } elseif ($array_item->value instanceof PhpParser\Node\Scalar\String_) { + $map[$meta_key] = $array_item->value->value; + } } } } diff --git a/tests/StubTest.php b/tests/StubTest.php index 8cb13b69ed4..41ff56d2a4e 100644 --- a/tests/StubTest.php +++ b/tests/StubTest.php @@ -317,6 +317,10 @@ public function testPhpStormMetaParsingFile(): void 'creAte2("object"); $y2 = (new \Ns\MyClass)->creaTe2("exception"); + + $const1 = (new \Ns\MyClass)->creAte3(\Ns\MyClass::OBJECT); + $const2 = (new \Ns\MyClass)->creaTe3("exception"); $b1 = \Create("object"); $b2 = \cReate("exception"); @@ -404,6 +417,9 @@ function bar(array $a) {} '$y1===' => 'stdClass', '$y2===' => 'Exception', + '$const1===' => 'stdClass', + '$const2===' => 'Exception', + '$b1===' => 'stdClass', '$b2===' => 'Exception', diff --git a/tests/fixtures/stubs/phpstorm.meta.php b/tests/fixtures/stubs/phpstorm.meta.php index f2d3944f92f..7ef519238c2 100644 --- a/tests/fixtures/stubs/phpstorm.meta.php +++ b/tests/fixtures/stubs/phpstorm.meta.php @@ -25,6 +25,13 @@ 'object' => \stdClass::class, ])); + // tests with class constant as key + override(\Ns\MyClass::crEate3(), map([ + '' => '@', + \Ns\MyClass::EXCEPTION => \Exception::class, + \Ns\MyClass::OBJECT => \stdClass::class, + ])); + override(\Ns\MyClass::foO(0), type(0)); override(\Ns\MyClass::Bar(0), elementType(0)); override(\foo(0), type(0)); From 6227943bfbd10bb0d6c32f8a8b576353c2af9683 Mon Sep 17 00:00:00 2001 From: shvlv Date: Tue, 24 Jan 2023 13:31:58 +0200 Subject: [PATCH 009/109] Allow to scan private constants --- src/Psalm/Internal/Scanner/PhpStormMetaScanner.php | 2 +- tests/StubTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php index e49ba2baffe..a70d82c57c7 100644 --- a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php +++ b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php @@ -76,7 +76,7 @@ public static function handleOverride(array $args, Codebase $codebase): void $constant_type = $codebase->classlikes->getClassConstantType( $resolved_name, $array_item->key->name->name, - ReflectionProperty::IS_PUBLIC, + ReflectionProperty::IS_PRIVATE, ); if (!$constant_type instanceof Union || !$constant_type->isSingleStringLiteral()) { diff --git a/tests/StubTest.php b/tests/StubTest.php index 41ff56d2a4e..a86f148686c 100644 --- a/tests/StubTest.php +++ b/tests/StubTest.php @@ -319,7 +319,7 @@ public function testPhpStormMetaParsingFile(): void class MyClass { public const OBJECT = "object"; - public const EXCEPTION = "exception"; + private const EXCEPTION = "exception"; /** * @return mixed From eca707998290376c757bd79f04356ea5664af464 Mon Sep 17 00:00:00 2001 From: shvlv Date: Wed, 25 Jan 2023 11:32:41 +0200 Subject: [PATCH 010/109] Fix Psalm errors --- src/Psalm/Internal/Scanner/PhpStormMetaScanner.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php index a70d82c57c7..5058e67ce8e 100644 --- a/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php +++ b/src/Psalm/Internal/Scanner/PhpStormMetaScanner.php @@ -64,10 +64,12 @@ public static function handleOverride(array $args, Codebase $codebase): void } elseif ($array_item->value instanceof PhpParser\Node\Scalar\String_) { $map[$array_item->key->value] = $array_item->value->value; } - } elseif ($array_item->key instanceof PhpParser\Node\Expr\ClassConstFetch + } elseif ($array_item + && $array_item->key instanceof PhpParser\Node\Expr\ClassConstFetch && $array_item->key->class instanceof PhpParser\Node\Name\FullyQualified && $array_item->key->name instanceof PhpParser\Node\Identifier ) { + /** @var string|null $resolved_name */ $resolved_name = $array_item->key->class->getAttribute('resolvedName'); if (!$resolved_name) { continue; From 247d30f74c023108c6393933e1d26cbc63ccbdd7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 25 Jan 2023 10:42:05 +0100 Subject: [PATCH 011/109] Detect duplicate keys in array shapes --- src/Psalm/Internal/Type/TypeParser.php | 12 ++++++++---- tests/TypeParseTest.php | 22 ++++++++++++++-------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/Psalm/Internal/Type/TypeParser.php b/src/Psalm/Internal/Type/TypeParser.php index f255618d9fb..a5635899cf1 100644 --- a/src/Psalm/Internal/Type/TypeParser.php +++ b/src/Psalm/Internal/Type/TypeParser.php @@ -1478,6 +1478,10 @@ private static function getTypeFromKeyedArrayTree( $had_optional = true; } + if (isset($properties[$property_key])) { + throw new TypeParseTreeException("Duplicate key $property_key detected"); + } + $properties[$property_key] = $property_type; if ($class_string) { $class_strings[$property_key] = true; @@ -1485,7 +1489,7 @@ private static function getTypeFromKeyedArrayTree( } if ($had_explicit && $had_implicit) { - throw new TypeParseTreeException('Cannot mix explicit and implicit keys!'); + throw new TypeParseTreeException('Cannot mix explicit and implicit keys'); } if ($type === 'object') { @@ -1500,7 +1504,7 @@ private static function getTypeFromKeyedArrayTree( } if ($callable && !$properties) { - throw new TypeParseTreeException('A callable array cannot be empty!'); + throw new TypeParseTreeException('A callable array cannot be empty'); } if ($type !== 'array' && $type !== 'list') { @@ -1508,7 +1512,7 @@ private static function getTypeFromKeyedArrayTree( } if ($type === 'list' && !$is_list) { - throw new TypeParseTreeException('A list shape cannot describe a non-list!'); + throw new TypeParseTreeException('A list shape cannot describe a non-list'); } if (!$properties) { @@ -1520,7 +1524,7 @@ private static function getTypeFromKeyedArrayTree( $class_strings, $sealed ? null - : [$is_list ? Type::getInt() : Type::getArrayKey(), Type::getMixed()], + : [$is_list ? Type::getListKey() : Type::getArrayKey(), Type::getMixed()], $is_list, $from_docblock, ); diff --git a/tests/TypeParseTest.php b/tests/TypeParseTest.php index 07f7c68ce06..81634a1235d 100644 --- a/tests/TypeParseTest.php +++ b/tests/TypeParseTest.php @@ -473,54 +473,60 @@ public function testTKeyedCallableArrayNonList(): void public function testTKeyedListNonList(): void { - $this->expectExceptionMessage('A list shape cannot describe a non-list!'); + $this->expectExceptionMessage('A list shape cannot describe a non-list'); Type::parseString('list{a: 0, b: 1, c: 2}'); } public function testTKeyedListNonListOptional(): void { - $this->expectExceptionMessage('A list shape cannot describe a non-list!'); + $this->expectExceptionMessage('A list shape cannot describe a non-list'); Type::parseString('list{a: 0, b?: 1, c?: 2}'); } public function testTKeyedListNonListOptionalWrongOrder1(): void { - $this->expectExceptionMessage('A list shape cannot describe a non-list!'); + $this->expectExceptionMessage('A list shape cannot describe a non-list'); Type::parseString('list{0?: 0, 1: 1, 2: 2}'); } public function testTKeyedListNonListOptionalWrongOrder2(): void { - $this->expectExceptionMessage('A list shape cannot describe a non-list!'); + $this->expectExceptionMessage('A list shape cannot describe a non-list'); Type::parseString('list{0: 0, 1?: 1, 2: 2}'); } public function testTKeyedListWrongOrder(): void { - $this->expectExceptionMessage('A list shape cannot describe a non-list!'); + $this->expectExceptionMessage('A list shape cannot describe a non-list'); Type::parseString('list{1: 1, 0: 0}'); } public function testTKeyedListNonListKeys(): void { - $this->expectExceptionMessage('A list shape cannot describe a non-list!'); + $this->expectExceptionMessage('A list shape cannot describe a non-list'); Type::parseString('list{1: 1, 2: 2}'); } public function testTKeyedListNoExplicitAndImplicitKeys(): void { - $this->expectExceptionMessage('Cannot mix explicit and implicit keys!'); + $this->expectExceptionMessage('Cannot mix explicit and implicit keys'); Type::parseString('list{0: 0, 1}'); } public function testTKeyedArrayNoExplicitAndImplicitKeys(): void { - $this->expectExceptionMessage('Cannot mix explicit and implicit keys!'); + $this->expectExceptionMessage('Cannot mix explicit and implicit keys'); Type::parseString('array{0, test: 1}'); } + public function testTKeyedArrayNoDuplicateKeys(): void + { + $this->expectExceptionMessage('Duplicate key a detected'); + Type::parseString('array{a: int, a: int}'); + } + public function testSimpleCallable(): void { $this->assertSame( From 40a05d574ae246a1a3da6de581566fff990d817c Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 25 Jan 2023 12:26:59 +0100 Subject: [PATCH 012/109] Improve error messages --- src/Psalm/Internal/Analyzer/CommentAnalyzer.php | 2 +- .../Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php index 805da934070..7d8fdd13a84 100644 --- a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php @@ -162,7 +162,7 @@ public static function arrayToDocblocks( throw new DocblockParseException( $line_parts[0] . ' is not a valid type' . - ' (from ' . + ' ('.$e->getMessage().' in ' . $source->getFilePath() . ':' . $comment->getStartLine() . diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php index 1495cdcb211..3da672a634d 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php @@ -1895,7 +1895,7 @@ private static function getTypeAliasesFromCommentLines( $self_fqcln, ); } catch (TypeParseTreeException $e) { - throw new DocblockParseException($type_string . ' is not a valid type'); + throw new DocblockParseException($type_string . ' is not a valid type: '.$e->getMessage()); } $type_alias_tokens[$type_alias] = new InlineTypeAlias($type_tokens); From 32581a71fd94767dcf3d4731f6902ba58f25e921 Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Wed, 25 Jan 2023 10:54:33 -0500 Subject: [PATCH 013/109] cdata in baseline --- psalm-baseline.xml | 180 ++++++++++++++++++------------------ src/Psalm/ErrorBaseline.php | 7 +- 2 files changed, 96 insertions(+), 91 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 39e01182cc0..eed99a12399 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,14 +1,14 @@ - + - $comment_block->tags['variablesfrom'][0] + tags['variablesfrom'][0]]]> $matches[1] - $comment_block->tags['variablesfrom'][0] + tags['variablesfrom'][0]]]> $matches[1] @@ -24,7 +24,7 @@ - explode('::', $method_id)[1] + @@ -38,7 +38,7 @@ $comments[0] $property_name - $stmt->props[0] + props[0]]]> $uninitialized_variables[0] @@ -58,7 +58,7 @@ - $stmt->cond + cond]]> @@ -69,46 +69,46 @@ - $context->assigned_var_ids += $switch_scope->new_assigned_var_ids + assigned_var_ids += $switch_scope->new_assigned_var_ids]]> - $new_case_equality_expr->getArgs()[1] - $switch_scope->leftover_statements[0] - $traverser->traverse([$switch_condition])[0] + getArgs()[1]]]> + leftover_statements[0]]]> + traverse([$switch_condition])[0]]]> - $assertion->rule[0] - $assertion->rule[0] - $assertion->rule[0] - $assertion->rule[0] - $assertion->rule[0] - $assertion->rule[0] - $assertion->rule[0] - $count_expr->getArgs()[0] - $count_expr->getArgs()[0] - $count_expr->getArgs()[0] - $count_expr->getArgs()[0] - $count_expr->getArgs()[0] - $counted_expr->getArgs()[0] - $expr->getArgs()[0] - $expr->getArgs()[0] - $expr->getArgs()[0] - $expr->getArgs()[0] - $expr->getArgs()[0] - $expr->getArgs()[0] - $expr->getArgs()[0] - $expr->getArgs()[0] - $expr->getArgs()[1] - $expr->getArgs()[1] - $get_debug_type_expr->getArgs()[0] - $get_debug_type_expr->getArgs()[0] - $getclass_expr->getArgs()[0] - $gettype_expr->getArgs()[0] - $gettype_expr->getArgs()[0] + rule[0]]]> + rule[0]]]> + rule[0]]]> + rule[0]]]> + rule[0]]]> + rule[0]]]> + rule[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[1]]]> + getArgs()[1]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> + getArgs()[0]]]> @@ -129,7 +129,7 @@ $method_name $parts[1] - explode('::', $cased_method_id)[1] + @@ -143,7 +143,7 @@ - $stmt->getArgs()[0] + getArgs()[0]]]> $parts[1] @@ -156,12 +156,12 @@ - $result->invalid_method_call_types[0] - $result->non_existent_class_method_ids[0] - $result->non_existent_class_method_ids[0] - $result->non_existent_interface_method_ids[0] - $result->non_existent_interface_method_ids[0] - $result->non_existent_magic_method_ids[0] + invalid_method_call_types[0]]]> + non_existent_class_method_ids[0]]]> + non_existent_class_method_ids[0]]]> + non_existent_interface_method_ids[0]]]> + non_existent_interface_method_ids[0]]]> + non_existent_magic_method_ids[0]]]> @@ -171,8 +171,8 @@ - $callable_arg->items[0] - $callable_arg->items[1] + items[0]]]> + items[1]]]> @@ -205,7 +205,7 @@ - $atomic_return_type->type_params[2] + type_params[2]]]> @@ -225,7 +225,7 @@ - $stmt->expr->getArgs()[0] + expr->getArgs()[0]]]> $check_type_string @@ -233,7 +233,7 @@ - $options['tcp'] ?? null + @@ -283,11 +283,11 @@ - $a->props[0] - $a->stmts[0] + props[0]]]> + stmts[0]]]> $a_stmt_comments[0] - $b->props[0] - $b->stmts[0] + props[0]]]> + stmts[0]]]> $b_stmt_comments[0] @@ -304,14 +304,14 @@ - $stmt->props[0] + props[0]]]> - $type < 1 - $type < 1 || $type > 4 - $type > 4 + + 4]]> + 4]]> @@ -347,7 +347,7 @@ $match[0] $match[1] $match[2] - $node->stmts[0] + stmts[0]]]> $replacement_stmts[0] $replacement_stmts[0] $replacement_stmts[0] @@ -357,8 +357,8 @@ $doc_line_parts[1] $matches[0] - $method_tree->children[0] - $method_tree->children[1] + children[0]]]> + children[1]]]> @@ -369,8 +369,8 @@ - $node->getArgs()[0] - $node->getArgs()[1] + getArgs()[0]]]> + getArgs()[1]]]> @@ -378,7 +378,7 @@ $since_parts[1] - count($line_parts) > 0 + 0]]> @@ -391,7 +391,7 @@ - $stmt->stmts[0] + stmts[0]]]> @@ -419,8 +419,8 @@ isContainedBy - $array->properties[0] - $array->properties[0] + properties[0]]]> + properties[0]]]> @@ -433,7 +433,7 @@ - $array_atomic_type->properties[0] + properties[0]]]> $properties[0] $properties[0] $properties[0] @@ -447,13 +447,13 @@ - $combination->array_type_params[1] - $combination->array_type_params[1] - $combination->array_type_params[1] - $combination->array_type_params[1] - $combination->array_type_params[1] - $combination->array_type_params[1] - $combination->array_type_params[1] + array_type_params[1]]]> + array_type_params[1]]]> + array_type_params[1]]]> + array_type_params[1]]]> + array_type_params[1]]]> + array_type_params[1]]]> + array_type_params[1]]]> @@ -466,8 +466,8 @@ $const_name $const_name $intersection_types[0] - $parse_tree->children[0] - $parse_tree->condition->children[0] + children[0]]]> + condition->children[0]]]> array_keys($offset_template_data)[0] array_keys($template_type_map[$array_param_name])[0] array_keys($template_type_map[$class_name])[0] @@ -485,7 +485,7 @@ - $codebase->config->shepherd_host + config->shepherd_host]]> @@ -543,7 +543,7 @@ replace - $this->type_params[1] + type_params[1]]]> @@ -569,7 +569,7 @@ replace - $cloned->value_param + value_param]]> @@ -585,8 +585,8 @@ TList - new TList($this->getGenericValueType()) - new TNonEmptyList($this->getGenericValueType()) + getGenericValueType())]]> + getGenericValueType())]]> combine @@ -604,12 +604,12 @@ replace - $key_type->possibly_undefined + possibly_undefined]]> - $this->properties[0] - $this->properties[0] - $this->properties[0] + properties[0]]]> + properties[0]]]> + properties[0]]]> getList @@ -621,7 +621,7 @@ replace - $cloned->type_param + type_param]]> @@ -697,7 +697,7 @@ TArray|TKeyedArray|TClassStringMap - $this->types['array'] + types['array']]]> allFloatLiterals @@ -708,7 +708,7 @@ - $subNodes['expr'] + diff --git a/src/Psalm/ErrorBaseline.php b/src/Psalm/ErrorBaseline.php index 1206a518c46..135a2a984d9 100644 --- a/src/Psalm/ErrorBaseline.php +++ b/src/Psalm/ErrorBaseline.php @@ -266,7 +266,12 @@ private static function writeToFile( foreach ($existingIssueType['s'] as $selection) { $codeNode = $baselineDoc->createElement('code'); - $codeNode->textContent = trim($selection); + $textContent = trim($selection); + if ($textContent !== \htmlspecialchars($textContent)) { + $codeNode->append($baselineDoc->createCDATASection($textContent)); + } else { + $codeNode->textContent = trim($textContent); + } $issueNode->appendChild($codeNode); } $fileNode->appendChild($issueNode); From 375cdeb63620420bcf7bb4a4727be24dde43cb79 Mon Sep 17 00:00:00 2001 From: Jack Worman Date: Wed, 25 Jan 2023 10:57:28 -0500 Subject: [PATCH 014/109] cdata in baseline --- src/Psalm/ErrorBaseline.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Psalm/ErrorBaseline.php b/src/Psalm/ErrorBaseline.php index 135a2a984d9..227132769d2 100644 --- a/src/Psalm/ErrorBaseline.php +++ b/src/Psalm/ErrorBaseline.php @@ -16,6 +16,7 @@ use function array_reduce; use function array_values; use function get_loaded_extensions; +use function htmlspecialchars; use function implode; use function ksort; use function min; @@ -267,7 +268,7 @@ private static function writeToFile( foreach ($existingIssueType['s'] as $selection) { $codeNode = $baselineDoc->createElement('code'); $textContent = trim($selection); - if ($textContent !== \htmlspecialchars($textContent)) { + if ($textContent !== htmlspecialchars($textContent)) { $codeNode->append($baselineDoc->createCDATASection($textContent)); } else { $codeNode->textContent = trim($textContent); From 7526d60f2ad235421937f5415a7015cb42dd7f2e Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Sun, 29 Jan 2023 18:32:31 +0100 Subject: [PATCH 015/109] Update assertion to reflect a new output It reverts https://github.com/vimeo/psalm/commit/588d9e08bc52abb8fccc8801e6a9e839b94817ae#diff-1ef46093f20172c4dc1cbe5a54e5b60c255082acd3f7c382dae621d8d23df404R172 --- tests/EndToEnd/PsalmEndToEndTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/EndToEnd/PsalmEndToEndTest.php b/tests/EndToEnd/PsalmEndToEndTest.php index b8e0f1dac9a..cd7e2e7451c 100644 --- a/tests/EndToEnd/PsalmEndToEndTest.php +++ b/tests/EndToEnd/PsalmEndToEndTest.php @@ -168,7 +168,7 @@ public function testPsalmDiff(): void $this->assertStringContainsString('InvalidReturnType', $result['STDOUT']); $this->assertStringContainsString('InvalidReturnStatement', $result['STDOUT']); $this->assertStringContainsString('3 errors', $result['STDOUT']); - $this->assertEquals(1, substr_count($result['STDERR'], 'E')); // Should only have 'E' from 'Extensions' in version message + $this->assertStringNotContainsString('E', $result['STDERR']); $this->assertSame(2, $result['CODE']); From c55d297d0a80304281b669106c7c0f5196b512d3 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Sun, 29 Jan 2023 18:52:09 +0100 Subject: [PATCH 016/109] Fix coding style issue --- tests/EndToEnd/PsalmEndToEndTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/EndToEnd/PsalmEndToEndTest.php b/tests/EndToEnd/PsalmEndToEndTest.php index cd7e2e7451c..adae16b6699 100644 --- a/tests/EndToEnd/PsalmEndToEndTest.php +++ b/tests/EndToEnd/PsalmEndToEndTest.php @@ -20,7 +20,6 @@ use function readdir; use function rmdir; use function str_replace; -use function substr_count; use function sys_get_temp_dir; use function tempnam; use function unlink; From a9de67afd53e00e31f3bd95929e42773efeeca70 Mon Sep 17 00:00:00 2001 From: Leo Viezens Date: Mon, 30 Jan 2023 15:46:29 +0100 Subject: [PATCH 017/109] #7387 Add unrelated psalm errors to baseline --- psalm-baseline.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index eed99a12399..d13ce87c531 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + tags['variablesfrom'][0]]]> @@ -241,6 +241,12 @@ $identifier_name + + + $input_path[2] + $input_path[2] + + $trait From b5781c34e85a96a51f0ec5448a5c1e0249d92197 Mon Sep 17 00:00:00 2001 From: Mark McEver Date: Wed, 1 Feb 2023 15:41:52 -0600 Subject: [PATCH 018/109] Fixed a case where the conditional taint, specialize, & flow features were not playing nicely together --- .../Call/FunctionCallReturnTypeFetcher.php | 2 +- stubs/CoreGenericFunctions.phpstub | 60 +++++++++++++++++++ tests/TaintTest.php | 38 ++++++++---- 3 files changed, 86 insertions(+), 14 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php index bd54e0f90d5..0a8322e3cda 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php @@ -658,7 +658,7 @@ private static function taintReturnType( $stmt->getArgs(), $node_location, $function_call_node, - $removed_taints, + [...$removed_taints, ...$conditionally_removed_taints], $added_taints, ); } diff --git a/stubs/CoreGenericFunctions.phpstub b/stubs/CoreGenericFunctions.phpstub index 51db73457c9..abd7d6219ec 100644 --- a/stubs/CoreGenericFunctions.phpstub +++ b/stubs/CoreGenericFunctions.phpstub @@ -816,19 +816,79 @@ function array_product(array $array) {} * @psalm-pure * * 257 is FILTER_VALIDATE_INT + * @psalm-taint-escape ($filter is 257 ? 'callable' : null) + * @psalm-taint-escape ($filter is 257 ? 'unserialize' : null) + * @psalm-taint-escape ($filter is 257 ? 'include' : null) + * @psalm-taint-escape ($filter is 257 ? 'eval' : null) + * @psalm-taint-escape ($filter is 257 ? 'ldap' : null) + * @psalm-taint-escape ($filter is 257 ? 'sql' : null) * @psalm-taint-escape ($filter is 257 ? 'html' : null) + * @psalm-taint-escape ($filter is 257 ? 'has_quotes' : null) + * @psalm-taint-escape ($filter is 257 ? 'shell' : null) + * @psalm-taint-escape ($filter is 257 ? 'ssrf' : null) + * @psalm-taint-escape ($filter is 257 ? 'file' : null) + * @psalm-taint-escape ($filter is 257 ? 'cookie' : null) + * @psalm-taint-escape ($filter is 257 ? 'header' : null) * * 258 is FILTER_VALIDATE_BOOLEAN + * @psalm-taint-escape ($filter is 258 ? 'callable' : null) + * @psalm-taint-escape ($filter is 258 ? 'unserialize' : null) + * @psalm-taint-escape ($filter is 258 ? 'include' : null) + * @psalm-taint-escape ($filter is 258 ? 'eval' : null) + * @psalm-taint-escape ($filter is 258 ? 'ldap' : null) + * @psalm-taint-escape ($filter is 258 ? 'sql' : null) * @psalm-taint-escape ($filter is 258 ? 'html' : null) + * @psalm-taint-escape ($filter is 258 ? 'has_quotes' : null) + * @psalm-taint-escape ($filter is 258 ? 'shell' : null) + * @psalm-taint-escape ($filter is 258 ? 'ssrf' : null) + * @psalm-taint-escape ($filter is 258 ? 'file' : null) + * @psalm-taint-escape ($filter is 258 ? 'cookie' : null) + * @psalm-taint-escape ($filter is 258 ? 'header' : null) * * 259 is FILTER_VALIDATE_FLOAT + * @psalm-taint-escape ($filter is 259 ? 'callable' : null) + * @psalm-taint-escape ($filter is 259 ? 'unserialize' : null) + * @psalm-taint-escape ($filter is 259 ? 'include' : null) + * @psalm-taint-escape ($filter is 259 ? 'eval' : null) + * @psalm-taint-escape ($filter is 259 ? 'ldap' : null) + * @psalm-taint-escape ($filter is 259 ? 'sql' : null) * @psalm-taint-escape ($filter is 259 ? 'html' : null) + * @psalm-taint-escape ($filter is 259 ? 'has_quotes' : null) + * @psalm-taint-escape ($filter is 259 ? 'shell' : null) + * @psalm-taint-escape ($filter is 259 ? 'ssrf' : null) + * @psalm-taint-escape ($filter is 259 ? 'file' : null) + * @psalm-taint-escape ($filter is 259 ? 'cookie' : null) + * @psalm-taint-escape ($filter is 259 ? 'header' : null) * * 519 is FILTER_SANITIZE_NUMBER_INT + * @psalm-taint-escape ($filter is 519 ? 'callable' : null) + * @psalm-taint-escape ($filter is 519 ? 'unserialize' : null) + * @psalm-taint-escape ($filter is 519 ? 'include' : null) + * @psalm-taint-escape ($filter is 519 ? 'eval' : null) + * @psalm-taint-escape ($filter is 519 ? 'ldap' : null) + * @psalm-taint-escape ($filter is 519 ? 'sql' : null) * @psalm-taint-escape ($filter is 519 ? 'html' : null) + * @psalm-taint-escape ($filter is 519 ? 'has_quotes' : null) + * @psalm-taint-escape ($filter is 519 ? 'shell' : null) + * @psalm-taint-escape ($filter is 519 ? 'ssrf' : null) + * @psalm-taint-escape ($filter is 519 ? 'file' : null) + * @psalm-taint-escape ($filter is 519 ? 'cookie' : null) + * @psalm-taint-escape ($filter is 519 ? 'header' : null) * * 520 is FILTER_SANITIZE_NUMBER_FLOAT + * @psalm-taint-escape ($filter is 520 ? 'callable' : null) + * @psalm-taint-escape ($filter is 520 ? 'unserialize' : null) + * @psalm-taint-escape ($filter is 520 ? 'include' : null) + * @psalm-taint-escape ($filter is 520 ? 'eval' : null) + * @psalm-taint-escape ($filter is 520 ? 'ldap' : null) + * @psalm-taint-escape ($filter is 520 ? 'sql' : null) * @psalm-taint-escape ($filter is 520 ? 'html' : null) + * @psalm-taint-escape ($filter is 520 ? 'has_quotes' : null) + * @psalm-taint-escape ($filter is 520 ? 'shell' : null) + * @psalm-taint-escape ($filter is 520 ? 'ssrf' : null) + * @psalm-taint-escape ($filter is 520 ? 'file' : null) + * @psalm-taint-escape ($filter is 520 ? 'cookie' : null) + * @psalm-taint-escape ($filter is 520 ? 'header' : null) * * @psalm-flow ($value, $filter, $options) -> return */ diff --git a/tests/TaintTest.php b/tests/TaintTest.php index 4034e9dc092..e0610c8024a 100644 --- a/tests/TaintTest.php +++ b/tests/TaintTest.php @@ -230,19 +230,31 @@ function foo() : void { echo $a; }', ], - 'taintFilterVarInt' => [ - 'code' => ' [ - 'code' => ' [ - 'code' => ' [ + 'code' => ' [ 'code' => ' Date: Wed, 1 Feb 2023 15:50:36 -0600 Subject: [PATCH 019/109] Attempted to avoid a psalm warning that was not accurate --- .../Expression/Call/FunctionCallReturnTypeFetcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php index 0a8322e3cda..6c40bf7834b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php @@ -658,7 +658,7 @@ private static function taintReturnType( $stmt->getArgs(), $node_location, $function_call_node, - [...$removed_taints, ...$conditionally_removed_taints], + array_merge($removed_taints, $conditionally_removed_taints), $added_taints, ); } From 79c3779033dc64205aa075b70cf2422865b81750 Mon Sep 17 00:00:00 2001 From: ging-dev Date: Thu, 2 Feb 2023 16:41:10 +0700 Subject: [PATCH 020/109] fix `didChange` event in LSP --- src/Psalm/Internal/LanguageServer/Server/TextDocument.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Psalm/Internal/LanguageServer/Server/TextDocument.php b/src/Psalm/Internal/LanguageServer/Server/TextDocument.php index 119e3612e8e..87d4c650ee8 100644 --- a/src/Psalm/Internal/LanguageServer/Server/TextDocument.php +++ b/src/Psalm/Internal/LanguageServer/Server/TextDocument.php @@ -103,6 +103,7 @@ public function didSave(TextDocumentItem $textDocument, ?string $text): void /** * The document change notification is sent from the client to the server to signal changes to a text document. * + * @param VersionedTextDocumentIdentifier $textDocument the document that was changed * @param TextDocumentContentChangeEvent[] $contentChanges */ public function didChange(VersionedTextDocumentIdentifier $textDocument, array $contentChanges): void From fb65c79079f990bf295dfc178316fecfaabfcfcd Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 2 Feb 2023 12:19:22 -0400 Subject: [PATCH 021/109] Fix newly discovered CS issues --- .../Statements/Expression/AssertionFinder.php | 14 ++++---- tests/Internal/CliUtilsTest.php | 4 +-- tests/Traits/ValidCodeAnalysisTestTrait.php | 2 +- tests/TypeReconciliation/EmptyTest.php | 32 +++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php index 42cd94ab8ab..352382720b0 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php @@ -518,7 +518,7 @@ private static function scrapeEqualityAssertions( $var_name = ExpressionIdentifier::getExtendedVarId( $strlen_expr->getArgs()[0]->value, $this_class_name, - $source + $source, ); if ($source instanceof StatementsAnalyzer) { @@ -536,7 +536,7 @@ private static function scrapeEqualityAssertions( $this_class_name, $other_type, $codebase, - $conditional + $conditional, ); } } @@ -794,7 +794,7 @@ private static function scrapeInequalityAssertions( $var_name = ExpressionIdentifier::getExtendedVarId( $strlen_expr->getArgs()[0]->value, $this_class_name, - $source + $source, ); if ($source instanceof StatementsAnalyzer) { @@ -812,7 +812,7 @@ private static function scrapeInequalityAssertions( $this_class_name, $other_type, $codebase, - $conditional + $conditional, ); } } @@ -4048,7 +4048,7 @@ private static function getGreaterAssertions( $var_name = ExpressionIdentifier::getExtendedVarId( $strlened_expr->getArgs()[0]->value, $this_class_name, - $source + $source, ); if ($var_name) { @@ -4223,7 +4223,7 @@ private static function getSmallerAssertions( $var_name = ExpressionIdentifier::getExtendedVarId( $strlen_expr->getArgs()[0]->value, $this_class_name, - $source + $source, ); if ($var_name) { @@ -4251,7 +4251,7 @@ private static function getSmallerAssertions( $var_name = ExpressionIdentifier::getExtendedVarId( $strlen_expr->getArgs()[0]->value, $this_class_name, - $source + $source, ); if ($var_name) { diff --git a/tests/Internal/CliUtilsTest.php b/tests/Internal/CliUtilsTest.php index 6246474c860..0e00b7112a1 100644 --- a/tests/Internal/CliUtilsTest.php +++ b/tests/Internal/CliUtilsTest.php @@ -14,7 +14,7 @@ class CliUtilsTest extends TestCase /** * @var list */ - private $argv = []; + private array $argv = []; protected function setUp(): void { @@ -68,7 +68,7 @@ public function provideGetPathsToCheck(): iterable $dummyProjectDir = (string)realpath( __DIR__ . DIRECTORY_SEPARATOR . '..' - . DIRECTORY_SEPARATOR. 'fixtures' + . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'DummyProject', ); $currentDir = (string)realpath('.'); diff --git a/tests/Traits/ValidCodeAnalysisTestTrait.php b/tests/Traits/ValidCodeAnalysisTestTrait.php index ea9e70a4661..c1340ed1fbc 100644 --- a/tests/Traits/ValidCodeAnalysisTestTrait.php +++ b/tests/Traits/ValidCodeAnalysisTestTrait.php @@ -39,7 +39,7 @@ abstract public function providerValidCodeParse(): iterable; public function testValidCode( string $code, array $assertions = [], - $ignored_issues = [], + array $ignored_issues = [], string $php_version = '7.3' ): void { $test_name = $this->getTestName(); diff --git a/tests/TypeReconciliation/EmptyTest.php b/tests/TypeReconciliation/EmptyTest.php index 8daa3922152..ac95e53a131 100644 --- a/tests/TypeReconciliation/EmptyTest.php +++ b/tests/TypeReconciliation/EmptyTest.php @@ -419,63 +419,63 @@ function foo(array $arr): void { /** @return non-empty-string */ function nonEmptyString(string $str): string { return strlen($str) > 0 ? $str : "string"; - }' + }', ], 'strlenRighthandWithGreaterZero' => [ 'code' => ' [ 'code' => '= 1 ? $str : "string"; - }' + }', ], 'strlenRighthandWithGreaterEqualsOne' => [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ 'code' => ' [ // #8163 'code' => ' -1 ? $str : "string"; }', - 'error_message' => 'LessSpecificReturnStatement' + 'error_message' => 'LessSpecificReturnStatement', ], 'preventRighthandStrlenGreaterMinusOne' => [ 'code' => ' 'LessSpecificReturnStatement' + 'error_message' => 'LessSpecificReturnStatement', ], 'preventStrlenGreaterEqualsZero' => [ 'code' => '= 0 ? $str : "string"; }', - 'error_message' => 'LessSpecificReturnStatement' + 'error_message' => 'LessSpecificReturnStatement', ], 'preventStrlenEqualsZero' => [ 'code' => ' 'InvalidReturnStatement' + 'error_message' => 'InvalidReturnStatement', ], 'preventStrlenLessThanOne' => [ 'code' => ' 'InvalidReturnStatement' + 'error_message' => 'InvalidReturnStatement', ], 'preventStrlenLessEqualsZero' => [ 'code' => ' 'InvalidReturnStatement' + 'error_message' => 'InvalidReturnStatement', ], 'preventStrlenWithConcatenatedString' => [ 'code' => ' 2 ? $str : "string"; }', - 'error_message' => 'LessSpecificReturnStatement' + 'error_message' => 'LessSpecificReturnStatement', ], ]; } From 5d930a438aa8136899d490e87fa5e182f816487d Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 2 Feb 2023 12:27:57 -0400 Subject: [PATCH 022/109] Fix invalid test cases --- tests/ReturnTypeProvider/GetObjectVarsTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/ReturnTypeProvider/GetObjectVarsTest.php b/tests/ReturnTypeProvider/GetObjectVarsTest.php index dd4aa0c7e62..814b9decb91 100644 --- a/tests/ReturnTypeProvider/GetObjectVarsTest.php +++ b/tests/ReturnTypeProvider/GetObjectVarsTest.php @@ -154,6 +154,7 @@ public function __construct(public string $t) {} 'assertions' => [ '$test===' => "array{t: 'test'}", ], + 'ignored_issues' => [], 'php_version' => '8.2', ]; @@ -168,6 +169,7 @@ public function __construct(public string $t) {} 'assertions' => [ '$test===' => "array{t: 'test'}", ], + 'ignored_issues' => [], 'php_version' => '8.2', ]; From f922e576c8279c9e13799a63002a00d48d3bea81 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Thu, 2 Feb 2023 12:21:31 -0600 Subject: [PATCH 023/109] Fix xmlrpc callmap functions that were dropped in PHP 8.0 --- dictionaries/CallMap.php | 14 -------------- dictionaries/CallMap_80_delta.php | 14 ++++++++++++++ .../Codebase/InternalCallMapHandlerTest.php | 8 -------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index 95f619c9071..d803e6a1a25 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -15665,20 +15665,6 @@ 'XMLReader::setRelaxNGSchemaSource' => ['bool', 'source'=>'?string'], 'XMLReader::setSchema' => ['bool', 'filename'=>'?string'], 'XMLReader::XML' => ['bool', 'source'=>'string', 'encoding='=>'?string', 'options='=>'int'], -'xmlrpc_decode' => ['mixed', 'xml'=>'string', 'encoding='=>'string'], -'xmlrpc_decode_request' => ['?array', 'xml'=>'string', '&w_method'=>'string', 'encoding='=>'string'], -'xmlrpc_encode' => ['string', 'value'=>'mixed'], -'xmlrpc_encode_request' => ['string', 'method'=>'string', 'params'=>'mixed', 'output_options='=>'array'], -'xmlrpc_get_type' => ['string', 'value'=>'mixed'], -'xmlrpc_is_fault' => ['bool', 'arg'=>'array'], -'xmlrpc_parse_method_descriptions' => ['array', 'xml'=>'string'], -'xmlrpc_server_add_introspection_data' => ['int', 'server'=>'resource', 'desc'=>'array'], -'xmlrpc_server_call_method' => ['string', 'server'=>'resource', 'xml'=>'string', 'user_data'=>'mixed', 'output_options='=>'array'], -'xmlrpc_server_create' => ['resource'], -'xmlrpc_server_destroy' => ['int', 'server'=>'resource'], -'xmlrpc_server_register_introspection_callback' => ['bool', 'server'=>'resource', 'function'=>'string'], -'xmlrpc_server_register_method' => ['bool', 'server'=>'resource', 'method_name'=>'string', 'function'=>'string'], -'xmlrpc_set_type' => ['bool', '&rw_value'=>'string|DateTime', 'type'=>'string'], 'XMLWriter::endAttribute' => ['bool'], 'XMLWriter::endCdata' => ['bool'], 'XMLWriter::endComment' => ['bool'], diff --git a/dictionaries/CallMap_80_delta.php b/dictionaries/CallMap_80_delta.php index 3f6b49cc2cb..9e5522fd08b 100644 --- a/dictionaries/CallMap_80_delta.php +++ b/dictionaries/CallMap_80_delta.php @@ -2520,5 +2520,19 @@ 'SimpleXMLIterator::hasChildren' => ['bool'], 'SimpleXMLIterator::getChildren' => ['?SimpleXMLIterator'], 'SplTempFileObject::fgetss' => ['string', 'allowable_tags='=>'string'], + 'xmlrpc_decode' => ['mixed', 'xml'=>'string', 'encoding='=>'string'], + 'xmlrpc_decode_request' => ['?array', 'xml'=>'string', '&w_method'=>'string', 'encoding='=>'string'], + 'xmlrpc_encode' => ['string', 'value'=>'mixed'], + 'xmlrpc_encode_request' => ['string', 'method'=>'string', 'params'=>'mixed', 'output_options='=>'array'], + 'xmlrpc_get_type' => ['string', 'value'=>'mixed'], + 'xmlrpc_is_fault' => ['bool', 'arg'=>'array'], + 'xmlrpc_parse_method_descriptions' => ['array', 'xml'=>'string'], + 'xmlrpc_server_add_introspection_data' => ['int', 'server'=>'resource', 'desc'=>'array'], + 'xmlrpc_server_call_method' => ['string', 'server'=>'resource', 'xml'=>'string', 'user_data'=>'mixed', 'output_options='=>'array'], + 'xmlrpc_server_create' => ['resource'], + 'xmlrpc_server_destroy' => ['int', 'server'=>'resource'], + 'xmlrpc_server_register_introspection_callback' => ['bool', 'server'=>'resource', 'function'=>'string'], + 'xmlrpc_server_register_method' => ['bool', 'server'=>'resource', 'method_name'=>'string', 'function'=>'string'], + 'xmlrpc_set_type' => ['bool', '&rw_value'=>'string|DateTime', 'type'=>'string'], ], ]; diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index c66657ee220..3ecc8579e08 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -841,12 +841,6 @@ class InternalCallMapHandlerTest extends TestCase 'xmlreader::next', 'xmlreader::open', 'xmlreader::xml', - 'xmlrpc_encode_request', - 'xmlrpc_server_add_introspection_data', - 'xmlrpc_server_call_method', - 'xmlrpc_server_destroy', - 'xmlrpc_server_register_introspection_callback', - 'xmlrpc_server_register_method', 'xsltprocessor::registerphpfunctions', 'xsltprocessor::transformtodoc', 'yaml_emit', @@ -915,8 +909,6 @@ class InternalCallMapHandlerTest extends TestCase 'register_shutdown_function' => ['8.0', '8.1'], 'splfileobject::fscanf' => ['8.1', '8.2'], 'spltempfileobject::fscanf' => ['8.1', '8.2'], - 'xmlrpc_encode', - 'xmlrpc_server_create', 'xsltprocessor::transformtoxml' => ['8.1', '8.2'], ]; From 234787bcd689a55c8fcd69791f3819ed2c0c32ee Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Fri, 3 Feb 2023 00:30:32 -0500 Subject: [PATCH 024/109] Fix logic bugs caught by better elseif checks --- psalm-baseline.xml | 1 - src/Psalm/Internal/Analyzer/ClassAnalyzer.php | 2 +- .../Expression/Call/ClassTemplateParamCollector.php | 9 ++++----- src/Psalm/Internal/Type/TypeCombiner.php | 12 ++++++------ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d13ce87c531..b0f8bd4704e 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -459,7 +459,6 @@ array_type_params[1]]]> array_type_params[1]]]> array_type_params[1]]]> - array_type_params[1]]]> diff --git a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php index 9c246ddae7b..9961461c9b0 100644 --- a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php @@ -2434,7 +2434,7 @@ private function checkEnum(): void $storage->name, ), ); - } elseif ($case_storage->value !== null && $storage->enum_type !== null) { + } elseif ($case_storage->value !== null) { if ((is_int($case_storage->value) && $storage->enum_type === 'string') || (is_string($case_storage->value) && $storage->enum_type === 'int') ) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php index d9fe8c241a4..6802fa495db 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php @@ -144,11 +144,10 @@ public static function collect( $template_result, ); - $class_template_params[$type_name][$class_storage->name] - = $output_type_extends ?? Type::getMixed(); - } - - if (!isset($class_template_params[$type_name][$class_storage->name])) { + $class_template_params[$type_name] = [ + $class_storage->name => $output_type_extends ?? Type::getMixed(), + ]; + } else { $class_template_params[$type_name] = [$class_storage->name => Type::getMixed()]; } } diff --git a/src/Psalm/Internal/Type/TypeCombiner.php b/src/Psalm/Internal/Type/TypeCombiner.php index 934c046d0dc..f22dd91851b 100644 --- a/src/Psalm/Internal/Type/TypeCombiner.php +++ b/src/Psalm/Internal/Type/TypeCombiner.php @@ -362,9 +362,11 @@ public static function combine( $new_types[] = $type->setFromDocblock($from_docblock); } - if (!$new_types && !$has_never) { - throw new UnexpectedValueException('There should be types here'); - } elseif (!$new_types && $has_never) { + if (!$new_types) { + if (!$has_never) { + throw new UnexpectedValueException('There should be types here'); + } + $union_type = Type::getNever($from_docblock); } else { $union_type = new Union($new_types); @@ -1351,9 +1353,7 @@ private static function handleKeyedArrayEntries( if (!$combination->array_type_params || $combination->array_type_params[1]->isNever()) { if (!$overwrite_empty_array - && ($combination->array_type_params - && ($combination->array_type_params[1]->isNever() - || $combination->array_type_params[1]->isMixed())) + && $combination->array_type_params ) { foreach ($combination->objectlike_entries as &$objectlike_entry) { $objectlike_entry = $objectlike_entry->setPossiblyUndefined(true); From cdbd71ba8b732a4536a8a5355c54fed7c58faf25 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Fri, 3 Feb 2023 12:09:15 -0600 Subject: [PATCH 025/109] Add DatePeriod::INCLUDE_END_DATE option --- stubs/Php80.phpstub | 4 ++-- stubs/Php82.phpstub | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/stubs/Php80.phpstub b/stubs/Php80.phpstub index 03a8c8f1436..83674334300 100644 --- a/stubs/Php80.phpstub +++ b/stubs/Php80.phpstub @@ -220,12 +220,12 @@ class DatePeriod implements IteratorAggregate /** * @param Start $start * @param (Start is string ? 0|self::EXCLUDE_START_DATE : DateInterval) $interval - * @param (Start is string ? never : DateTimeInterface|positive-int) $end + * @param (Start is string ? never : (DateTimeInterface|positive-int)) $end * @param (Start is string ? never : 0|self::EXCLUDE_START_DATE) $options */ public function __construct($start, $interval = 0, $end = 1, $options = 0) {} - /** @psalm-return (Start is string ? (Traversable&Iterator) : (Traversable&Iterator)) */ + /** @psalm-return (Start is string ? Iterator : Iterator) */ public function getIterator(): Iterator {} } diff --git a/stubs/Php82.phpstub b/stubs/Php82.phpstub index 5ac5ee5f316..f6da0a6c254 100644 --- a/stubs/Php82.phpstub +++ b/stubs/Php82.phpstub @@ -10,4 +10,27 @@ namespace { /** @return non-empty-list */ public function getTypes(): array {} } + + /** + * @psalm-immutable + * + * @template-covariant Start of string|DateTimeInterface + * @implements IteratorAggregate + */ + class DatePeriod implements IteratorAggregate + { + const EXCLUDE_START_DATE = 1; + const INCLUDE_END_DATE = 2; + + /** + * @param Start $start + * @param (Start is string ? int-mask : DateInterval) $interval + * @param (Start is string ? never : (DateTimeInterface|positive-int)) $end + * @param (Start is string ? never : int-mask) $options + */ + public function __construct($start, $interval = 0, $end = 1, $options = 0) {} + + /** @psalm-return (Start is string ? Iterator : Iterator) */ + public function getIterator(): Iterator {} + } } From d450b40da8220efcbd11515e74753930bc10d8b3 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Fri, 3 Feb 2023 21:08:16 -0500 Subject: [PATCH 026/109] Remove some logic that didn't need to be there (#9209) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove check to see what breaks * Simplify following logic * Add tests from @kkmuffme‘s branch * Reduce scope of fix * Clean up logic a little * Add failing test * Improvements * Fix for non-Paradoxical Condition result --- .../issues/ParadoxicalCondition.md | 8 +--- src/Psalm/Internal/Algebra.php | 18 ++++----- .../Statements/Block/IfElseAnalyzer.php | 3 ++ .../Expression/BinaryOp/AndAnalyzer.php | 5 ++- tests/AssertAnnotationTest.php | 16 ++++++++ tests/TypeReconciliation/TypeAlgebraTest.php | 39 ++++++++++++++++++- 6 files changed, 69 insertions(+), 20 deletions(-) diff --git a/docs/running_psalm/issues/ParadoxicalCondition.md b/docs/running_psalm/issues/ParadoxicalCondition.md index 4d355f6cd27..334b1b3519d 100644 --- a/docs/running_psalm/issues/ParadoxicalCondition.md +++ b/docs/running_psalm/issues/ParadoxicalCondition.md @@ -5,11 +5,7 @@ Emitted when a paradox is encountered in your programs logic that could not be c ```php isNegation()) { - $things_that_can_be_said[(string)$assertion] = $assertion; - } + $things_that_can_be_said[(string)$assertion] = $assertion; } - if ($things_that_can_be_said && count($things_that_can_be_said) === count($possible_types)) { - if ($clause->generated && count($possible_types) > 1) { - unset($cond_referenced_var_ids[$var]); - } + if ($clause->generated && count($possible_types) > 1) { + unset($cond_referenced_var_ids[$var]); + } - $truths[$var] = [array_values($things_that_can_be_said)]; + $truths[$var] = [array_values($things_that_can_be_said)]; - if ($creating_conditional_id && $creating_conditional_id === $clause->creating_conditional_id) { - $active_truths[$var] = [array_values($things_that_can_be_said)]; - } + if ($creating_conditional_id && $creating_conditional_id === $clause->creating_conditional_id) { + $active_truths[$var] = [array_values($things_that_can_be_said)]; } } } diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php index 1abf90ffca9..a5a006a0b31 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php @@ -272,6 +272,9 @@ public static function analyze( // this has to go on a separate line because the phar compactor messes with precedence $scope_to_clone = $if_scope->post_leaving_if_context ?? $post_if_context; $else_context = clone $scope_to_clone; + $else_context->clauses = Algebra::simplifyCNF( + [...$else_context->clauses, ...$if_scope->negated_clauses], + ); // check the elseifs foreach ($stmt->elseifs as $elseif) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php index 5732707b92c..e5cca5b8a68 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php @@ -151,7 +151,10 @@ public static function analyze( $right_context = clone $left_context; } - $partitioned_clauses = Context::removeReconciledClauses($left_clauses, $changed_var_ids); + $partitioned_clauses = Context::removeReconciledClauses( + [...$left_context->clauses, ...$left_clauses], + $changed_var_ids + ); $right_context->clauses = $partitioned_clauses[0]; diff --git a/tests/AssertAnnotationTest.php b/tests/AssertAnnotationTest.php index 8630d068a87..f41c95769cd 100644 --- a/tests/AssertAnnotationTest.php +++ b/tests/AssertAnnotationTest.php @@ -2110,6 +2110,22 @@ function consumeAOrB(string $aOrB): void {} consumeAOrB($abc); ', ], + 'assertDocblockTypeContradictionCorrectType' => [ + 'code' => ' [], 'php_version' => '8.0', ], + 'subclassAfterNegation' => [ + 'code' => 's; + } + } + }' + ], + 'subclassAfterElseifNegation' => [ + 'code' => 's; + } + }' + ], ]; } @@ -1347,14 +1381,15 @@ function foo(?object $a): void { ], 'repeatedAndConditional' => [ 'code' => ' 'ParadoxicalCondition', + 'error_message' => 'TypeDoesNotContainType', ], 'andConditionalAfterOrConditional' => [ 'code' => ' Date: Mon, 6 Feb 2023 01:12:14 -0600 Subject: [PATCH 027/109] Convert callmaps resource types --- dictionaries/CallMap.php | 12 +++++----- dictionaries/CallMap_72_delta.php | 2 +- dictionaries/CallMap_80_delta.php | 24 +++++++++++++++---- dictionaries/CallMap_historical.php | 4 ++-- .../Codebase/InternalCallMapHandlerTest.php | 6 ----- 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index d803e6a1a25..0490c25c6ca 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -12037,10 +12037,10 @@ 'SeekableIterator::rewind' => ['void'], 'SeekableIterator::seek' => ['void', 'position'=>'int'], 'SeekableIterator::valid' => ['bool'], -'sem_acquire' => ['bool', 'semaphore'=>'resource', 'non_blocking='=>'bool'], -'sem_get' => ['resource|false', 'key'=>'int', 'max_acquire='=>'int', 'permissions='=>'int', 'auto_release='=>'int'], -'sem_release' => ['bool', 'semaphore'=>'resource'], -'sem_remove' => ['bool', 'semaphore'=>'resource'], +'sem_acquire' => ['bool', 'semaphore'=>'SysvSemaphore', 'non_blocking='=>'bool'], +'sem_get' => ['SysvSemaphore|false', 'key'=>'int', 'max_acquire='=>'int', 'permissions='=>'int', 'auto_release='=>'bool'], +'sem_release' => ['bool', 'semaphore'=>'SysvSemaphore'], +'sem_remove' => ['bool', 'semaphore'=>'SysvSemaphore'], 'Serializable::__construct' => ['void'], 'Serializable::serialize' => ['?string'], 'Serializable::unserialize' => ['void', 'serialized'=>'string'], @@ -12300,7 +12300,7 @@ 'socket_addrinfo_bind' => ['Socket|false', 'address'=>'AddressInfo'], 'socket_addrinfo_connect' => ['Socket|false', 'address'=>'AddressInfo'], 'socket_addrinfo_explain' => ['array', 'address'=>'AddressInfo'], -'socket_addrinfo_lookup' => ['false|AddressInfo[]', 'host='=>'string|null', 'service='=>'mixed', 'hints='=>'array'], +'socket_addrinfo_lookup' => ['false|AddressInfo[]', 'host'=>'string', 'service='=>'?string', 'hints='=>'array'], 'socket_bind' => ['bool', 'socket'=>'Socket', 'addr'=>'string', 'port='=>'int'], 'socket_clear_error' => ['void', 'socket='=>'?Socket'], 'socket_close' => ['void', 'socket'=>'Socket'], @@ -12308,7 +12308,7 @@ 'socket_connect' => ['bool', 'socket'=>'Socket', 'addr'=>'string', 'port='=>'int'], 'socket_create' => ['Socket|false', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int'], 'socket_create_listen' => ['Socket|false', 'port'=>'int', 'backlog='=>'int'], -'socket_create_pair' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_fd'=>'Socket[]'], +'socket_create_pair' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_pair'=>'Socket[]'], 'socket_export_stream' => ['resource|false', 'socket'=>'Socket'], 'socket_get_option' => ['mixed|false', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int'], 'socket_get_status' => ['array', 'stream'=>'Socket'], diff --git a/dictionaries/CallMap_72_delta.php b/dictionaries/CallMap_72_delta.php index 01b222ac4f7..ab30febce89 100644 --- a/dictionaries/CallMap_72_delta.php +++ b/dictionaries/CallMap_72_delta.php @@ -43,7 +43,7 @@ 'socket_addrinfo_bind' => ['?resource', 'addrinfo'=>'resource'], 'socket_addrinfo_connect' => ['resource', 'addrinfo'=>'resource'], 'socket_addrinfo_explain' => ['array', 'addrinfo'=>'resource'], - 'socket_addrinfo_lookup' => ['resource[]', 'node'=>'string', 'service='=>'mixed', 'hints='=>'array'], + 'socket_addrinfo_lookup' => ['resource[]', 'host'=>'string', 'service='=>'string', 'hints='=>'array'], 'sodium_add' => ['void', '&rw_string1'=>'string', 'string2'=>'string'], 'sodium_base642bin' => ['string', 'string'=>'string', 'id'=>'int', 'ignore='=>'string'], 'sodium_bin2base64' => ['string', 'string'=>'string', 'id'=>'int'], diff --git a/dictionaries/CallMap_80_delta.php b/dictionaries/CallMap_80_delta.php index 9e5522fd08b..645e8f75f69 100644 --- a/dictionaries/CallMap_80_delta.php +++ b/dictionaries/CallMap_80_delta.php @@ -1845,6 +1845,22 @@ 'old' => ['bool', 'stream'=>'resource', 'enable='=>'bool'], 'new' => ['bool', 'stream'=>'resource', 'enable='=>'?bool'], ], + 'sem_acquire' => [ + 'old' => ['bool', 'semaphore'=>'resource', 'non_blocking='=>'bool'], + 'new' => ['bool', 'semaphore'=>'SysvSemaphore', 'non_blocking='=>'bool'], + ], + 'sem_get' => [ + 'old' => ['resource|false', 'key'=>'int', 'max_acquire='=>'int', 'permissions='=>'int', 'auto_release='=>'bool'], + 'new' => ['SysvSemaphore|false', 'key'=>'int', 'max_acquire='=>'int', 'permissions='=>'int', 'auto_release='=>'bool'], + ], + 'sem_release' => [ + 'old' => ['bool', 'semaphore'=>'resource'], + 'new' => ['bool', 'semaphore'=>'SysvSemaphore'], + ], + 'sem_remove' => [ + 'old' => ['bool', 'semaphore'=>'resource'], + 'new' => ['bool', 'semaphore'=>'SysvSemaphore'], + ], 'session_cache_expire' => [ 'old' => ['int', 'value='=>'int'], 'new' => ['int', 'value='=>'?int'], @@ -1922,8 +1938,8 @@ 'new' => ['array', 'address'=>'AddressInfo'], ], 'socket_addrinfo_lookup' => [ - 'old' => ['resource[]', 'node'=>'string', 'service='=>'mixed', 'hints='=>'array'], - 'new' => ['false|AddressInfo[]', 'host='=>'string|null', 'service='=>'mixed', 'hints='=>'array'], + 'old' => ['resource[]', 'host'=>'string', 'service='=>'string', 'hints='=>'array'], + 'new' => ['false|AddressInfo[]', 'host'=>'string', 'service='=>'?string', 'hints='=>'array'], ], 'socket_bind' => [ 'old' => ['bool', 'socket'=>'resource', 'addr'=>'string', 'port='=>'int'], @@ -1950,8 +1966,8 @@ 'new' => ['Socket|false', 'port'=>'int', 'backlog='=>'int'], ], 'socket_create_pair' => [ - 'old' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_fd'=>'resource[]'], - 'new' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_fd'=>'Socket[]'], + 'old' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_pair'=>'resource[]'], + 'new' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_pair'=>'Socket[]'], ], 'socket_export_stream' => [ 'old' => ['resource|false', 'socket'=>'resource'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index f1f4cbd0c8a..5ac1ca4add2 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -14796,7 +14796,7 @@ 'seaslog_get_author' => ['string'], 'seaslog_get_version' => ['string'], 'sem_acquire' => ['bool', 'semaphore'=>'resource', 'non_blocking='=>'bool'], - 'sem_get' => ['resource|false', 'key'=>'int', 'max_acquire='=>'int', 'permissions='=>'int', 'auto_release='=>'int'], + 'sem_get' => ['resource|false', 'key'=>'int', 'max_acquire='=>'int', 'permissions='=>'int', 'auto_release='=>'bool'], 'sem_release' => ['bool', 'semaphore'=>'resource'], 'sem_remove' => ['bool', 'semaphore'=>'resource'], 'serialize' => ['string', 'value'=>'mixed'], @@ -14950,7 +14950,7 @@ 'socket_connect' => ['bool', 'socket'=>'resource', 'addr'=>'string', 'port='=>'int'], 'socket_create' => ['resource|false', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int'], 'socket_create_listen' => ['resource|false', 'port'=>'int', 'backlog='=>'int'], - 'socket_create_pair' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_fd'=>'resource[]'], + 'socket_create_pair' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_pair'=>'resource[]'], 'socket_export_stream' => ['resource|false', 'socket'=>'resource'], 'socket_get_option' => ['mixed|false', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int'], 'socket_get_status' => ['array', 'stream'=>'resource'], diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 3ecc8579e08..3f0ba226893 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -681,10 +681,6 @@ class InternalCallMapHandlerTest extends TestCase 'resourcebundle::create', 'resourcebundle::getlocales', 'sapi_windows_cp_get', - 'sem_acquire', - 'sem_get', - 'sem_release', - 'sem_remove', 'sessionhandler::gc', 'sessionhandler::open', 'shm_detach', @@ -705,11 +701,9 @@ class InternalCallMapHandlerTest extends TestCase 'snmp_set_enum_print', 'snmp_set_valueretrieval', 'snmpset', - 'socket_addrinfo_lookup', 'socket_bind', 'socket_cmsg_space', 'socket_connect', - 'socket_create_pair', 'socket_get_option', 'socket_getopt', 'socket_getpeername', From e754fd8b598dc264488880a46d9e1e4ecc4d7f41 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Mon, 6 Feb 2023 01:23:34 -0600 Subject: [PATCH 028/109] Add more specific return for class-implements --- dictionaries/CallMap.php | 6 +++--- dictionaries/CallMap_historical.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index d803e6a1a25..f03277cb0bf 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -1034,9 +1034,9 @@ 'chunk_split' => ['string', 'string'=>'string', 'length='=>'int', 'separator='=>'string'], 'class_alias' => ['bool', 'class'=>'string', 'alias'=>'string', 'autoload='=>'bool'], 'class_exists' => ['bool', 'class'=>'string', 'autoload='=>'bool'], -'class_implements' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], -'class_parents' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], -'class_uses' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], +'class_implements' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], +'class_parents' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], +'class_uses' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], 'classkit_import' => ['array', 'filename'=>'string'], 'classkit_method_add' => ['bool', 'classname'=>'string', 'methodname'=>'string', 'args'=>'string', 'code'=>'string', 'flags='=>'int'], 'classkit_method_copy' => ['bool', 'dclass'=>'string', 'dmethod'=>'string', 'sclass'=>'string', 'smethod='=>'string'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index f1f4cbd0c8a..58557735887 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -9951,9 +9951,9 @@ 'classObj::updateFromString' => ['int', 'snippet'=>'string'], 'class_alias' => ['bool', 'class'=>'string', 'alias'=>'string', 'autoload='=>'bool'], 'class_exists' => ['bool', 'class'=>'string', 'autoload='=>'bool'], - 'class_implements' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], - 'class_parents' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], - 'class_uses' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], + 'class_implements' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], + 'class_parents' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], + 'class_uses' => ['array|false', 'object_or_class'=>'object|string', 'autoload='=>'bool'], 'classkit_import' => ['array', 'filename'=>'string'], 'classkit_method_add' => ['bool', 'classname'=>'string', 'methodname'=>'string', 'args'=>'string', 'code'=>'string', 'flags='=>'int'], 'classkit_method_copy' => ['bool', 'dclass'=>'string', 'dmethod'=>'string', 'sclass'=>'string', 'smethod='=>'string'], From 22efcb12fb2f6df81e69596bab398fa90e411d97 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Mon, 6 Feb 2023 03:31:43 -0300 Subject: [PATCH 029/109] Use "numeric-string" type for some MySQLi properties --- dictionaries/CallMap.php | 8 ++++---- dictionaries/CallMap_historical.php | 8 ++++---- dictionaries/PropertyMap.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index d803e6a1a25..7bd4366b482 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -8459,7 +8459,7 @@ 'mysqli::store_result' => ['mysqli_result|false', 'mode='=>'int'], 'mysqli::thread_safe' => ['bool'], 'mysqli::use_result' => ['mysqli_result|false'], -'mysqli_affected_rows' => ['int', 'mysql'=>'mysqli'], +'mysqli_affected_rows' => ['int<-1, max>|numeric-string', 'mysql'=>'mysqli'], 'mysqli_autocommit' => ['bool', 'mysql'=>'mysqli', 'enable'=>'bool'], 'mysqli_begin_transaction' => ['bool', 'mysql'=>'mysqli', 'flags='=>'int', 'name='=>'?string'], 'mysqli_change_user' => ['bool', 'mysql'=>'mysqli', 'username'=>'string', 'password'=>'string', 'database'=>'?string'], @@ -8526,7 +8526,7 @@ 'mysqli_multi_query' => ['bool', 'mysql'=>'mysqli', 'query'=>'string'], 'mysqli_next_result' => ['bool', 'mysql'=>'mysqli'], 'mysqli_num_fields' => ['int', 'result'=>'mysqli_result'], -'mysqli_num_rows' => ['int', 'result'=>'mysqli_result'], +'mysqli_num_rows' => ['int<0, max>|numeric-string', 'result'=>'mysqli_result'], 'mysqli_options' => ['bool', 'mysql'=>'mysqli', 'option'=>'int', 'value'=>'string|int'], 'mysqli_ping' => ['bool', 'mysql'=>'mysqli'], 'mysqli_poll' => ['int|false', 'read'=>'array', 'write'=>'array', 'error'=>'array', 'seconds'=>'int', 'microseconds='=>'int'], @@ -8588,13 +8588,13 @@ 'mysqli_stmt::get_warnings' => ['object'], 'mysqli_stmt::more_results' => ['bool'], 'mysqli_stmt::next_result' => ['bool'], -'mysqli_stmt::num_rows' => ['int'], +'mysqli_stmt::num_rows' => ['int<0, max>|numeric-string'], 'mysqli_stmt::prepare' => ['bool', 'query'=>'string'], 'mysqli_stmt::reset' => ['bool'], 'mysqli_stmt::result_metadata' => ['mysqli_result|false'], 'mysqli_stmt::send_long_data' => ['bool', 'param_num'=>'int', 'data'=>'string'], 'mysqli_stmt::store_result' => ['bool'], -'mysqli_stmt_affected_rows' => ['int|string', 'statement'=>'mysqli_stmt'], +'mysqli_stmt_affected_rows' => ['int<-1, max>|numeric-string', 'statement'=>'mysqli_stmt'], 'mysqli_stmt_attr_get' => ['int', 'statement'=>'mysqli_stmt', 'attribute'=>'int'], 'mysqli_stmt_attr_set' => ['bool', 'statement'=>'mysqli_stmt', 'attribute'=>'int', 'value'=>'int'], 'mysqli_stmt_bind_param' => ['bool', 'statement'=>'mysqli_stmt', 'types'=>'string', '&vars'=>'mixed', '&...args='=>'mixed'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index f1f4cbd0c8a..e9c8464f120 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -13381,7 +13381,7 @@ 'mysqli::store_result' => ['mysqli_result|false', 'mode='=>'int'], 'mysqli::thread_safe' => ['bool'], 'mysqli::use_result' => ['mysqli_result|false'], - 'mysqli_affected_rows' => ['int', 'mysql'=>'mysqli'], + 'mysqli_affected_rows' => ['int<-1, max>|numeric-string', 'mysql'=>'mysqli'], 'mysqli_autocommit' => ['bool', 'mysql'=>'mysqli', 'enable'=>'bool'], 'mysqli_begin_transaction' => ['bool', 'mysql'=>'mysqli', 'flags='=>'int', 'name='=>'string'], 'mysqli_change_user' => ['bool', 'mysql'=>'mysqli', 'username'=>'string', 'password'=>'string', 'database'=>'?string'], @@ -13446,7 +13446,7 @@ 'mysqli_multi_query' => ['bool', 'mysql'=>'mysqli', 'query'=>'string'], 'mysqli_next_result' => ['bool', 'mysql'=>'mysqli'], 'mysqli_num_fields' => ['int', 'result'=>'mysqli_result'], - 'mysqli_num_rows' => ['int', 'result'=>'mysqli_result'], + 'mysqli_num_rows' => ['int<0, max>|numeric-string', 'result'=>'mysqli_result'], 'mysqli_options' => ['bool', 'mysql'=>'mysqli', 'option'=>'int', 'value'=>'string|int'], 'mysqli_ping' => ['bool', 'mysql'=>'mysqli'], 'mysqli_poll' => ['int|false', 'read'=>'array', 'write'=>'array', 'error'=>'array', 'seconds'=>'int', 'microseconds='=>'int'], @@ -13507,13 +13507,13 @@ 'mysqli_stmt::get_warnings' => ['object'], 'mysqli_stmt::more_results' => ['bool'], 'mysqli_stmt::next_result' => ['bool'], - 'mysqli_stmt::num_rows' => ['int'], + 'mysqli_stmt::num_rows' => ['int<0, max>|numeric-string'], 'mysqli_stmt::prepare' => ['bool', 'query'=>'string'], 'mysqli_stmt::reset' => ['bool'], 'mysqli_stmt::result_metadata' => ['mysqli_result|false'], 'mysqli_stmt::send_long_data' => ['bool', 'param_num'=>'int', 'data'=>'string'], 'mysqli_stmt::store_result' => ['bool'], - 'mysqli_stmt_affected_rows' => ['int|string', 'statement'=>'mysqli_stmt'], + 'mysqli_stmt_affected_rows' => ['int<-1, max>|numeric-string', 'statement'=>'mysqli_stmt'], 'mysqli_stmt_attr_get' => ['int', 'statement'=>'mysqli_stmt', 'attribute'=>'int'], 'mysqli_stmt_attr_set' => ['bool', 'statement'=>'mysqli_stmt', 'attribute'=>'int', 'value'=>'int'], 'mysqli_stmt_bind_param' => ['bool', 'statement'=>'mysqli_stmt', 'types'=>'string', '&vars'=>'mixed', '&...args='=>'mixed'], diff --git a/dictionaries/PropertyMap.php b/dictionaries/PropertyMap.php index 3dd2f9f605b..7f07ea657de 100644 --- a/dictionaries/PropertyMap.php +++ b/dictionaries/PropertyMap.php @@ -264,7 +264,7 @@ 'value' => 'string', ], 'mysqli' => [ - 'affected_rows' => 'int|string', + 'affected_rows' => 'int<-1, max>|numeric-string', 'client_info' => 'string', 'client_version' => 'int', 'connect_errno' => 'int', @@ -295,21 +295,21 @@ 'current_field' => 'int', 'field_count' => 'int', 'lengths' => 'array|null', - 'num_rows' => 'int|string', + 'num_rows' => 'int<0, max>|numeric-string', 'type' => 'int', ], 'mysqli_sql_exception' => [ 'sqlstate' => 'string', ], 'mysqli_stmt' => [ - 'affected_rows' => 'int|string', + 'affected_rows' => 'int<-1, max>|numeric-string', 'errno' => 'int', 'error' => 'string', 'error_list' => 'array', 'field_count' => 'int', 'id' => 'int', 'insert_id' => 'int|string', - 'num_rows' => 'int|string', + 'num_rows' => 'int<0, max>|numeric-string', 'param_count' => 'int', 'sqlstate' => 'string', ], From 9346b7f74bf4b9905deaa741334e4aefe4522ede Mon Sep 17 00:00:00 2001 From: kkmuffme <11071985+kkmuffme@users.noreply.github.com> Date: Tue, 7 Feb 2023 11:31:46 +0100 Subject: [PATCH 030/109] find_unused_code CLI arg should not be overwritten by config file --- src/Psalm/Internal/Cli/Psalm.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index 82fbdd35af7..620596390dd 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -1087,9 +1087,7 @@ private static function shouldFindUnusedCode(array $options, Config $config) } else { $find_unused_code = 'auto'; } - } - - if ($config->find_unused_code) { + } elseif ($config->find_unused_code) { $find_unused_code = 'auto'; } From 3c4a829f712da775ca1b0ec2705622e3c2ff61a1 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 7 Feb 2023 11:20:02 -0400 Subject: [PATCH 031/109] Fixed more CS issues --- src/Psalm/Internal/Algebra.php | 1 - .../Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php | 2 +- tests/TypeReconciliation/TypeAlgebraTest.php | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Psalm/Internal/Algebra.php b/src/Psalm/Internal/Algebra.php index dae6f7e82c5..0f581fc850f 100644 --- a/src/Psalm/Internal/Algebra.php +++ b/src/Psalm/Internal/Algebra.php @@ -4,7 +4,6 @@ use Psalm\Exception\ComplicatedExpressionException; use Psalm\Storage\Assertion; -use Psalm\Storage\Assertion\Falsy; use UnexpectedValueException; use function array_filter; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php index e5cca5b8a68..1f5f90309e6 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php @@ -153,7 +153,7 @@ public static function analyze( $partitioned_clauses = Context::removeReconciledClauses( [...$left_context->clauses, ...$left_clauses], - $changed_var_ids + $changed_var_ids, ); $right_context->clauses = $partitioned_clauses[0]; diff --git a/tests/TypeReconciliation/TypeAlgebraTest.php b/tests/TypeReconciliation/TypeAlgebraTest.php index 75b0c6d9f11..aea50a778e6 100644 --- a/tests/TypeReconciliation/TypeAlgebraTest.php +++ b/tests/TypeReconciliation/TypeAlgebraTest.php @@ -1226,7 +1226,7 @@ function foo(Base $base): void { echo $base->s; } } - }' + }', ], 'subclassAfterElseifNegation' => [ 'code' => 's; } - }' + }', ], ]; } From fa7efb7d8fd6c1ccbbaba6a7f38bf3b0242e618f Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Tue, 7 Feb 2023 11:29:20 +0100 Subject: [PATCH 032/109] Allow fidry/cpu-core-counter:v0.5 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 922383390a0..31037d08a21 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "dnoegel/php-xdg-base-dir": "^0.1.1", "felixfbecker/advanced-json-rpc": "^3.1", "felixfbecker/language-server-protocol": "^1.5.2", - "fidry/cpu-core-counter": "^0.4.0", + "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", "sebastian/diff": "^4.0 || ^5.0", @@ -44,12 +44,12 @@ "require-dev": { "ext-curl": "*", "bamarni/composer-bin-plugin": "^1.4", - "brianium/paratest": "^6.0", + "brianium/paratest": "^6.9", "mockery/mockery": "^1.5", "nunomaduro/mock-final-classes": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpdoc-parser": "^1.6", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.6", "psalm/plugin-mockery": "^1.1", "psalm/plugin-phpunit": "^0.18", "slevomat/coding-standard": "^8.4", From d7e0bc5d258afd9cb69e82b09fcbc607d15a99dd Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 7 Feb 2023 18:13:29 +0100 Subject: [PATCH 033/109] Always enable JIT --- src/Psalm/Internal/Fork/PsalmRestarter.php | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index ebc2441afe8..af3d367c8d1 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -5,10 +5,13 @@ use Composer\XdebugHandler\XdebugHandler; use function array_filter; +use function array_splice; use function extension_loaded; use function file_get_contents; use function file_put_contents; use function implode; +use function in_array; +use function ini_get; use function preg_replace; /** @@ -40,6 +43,18 @@ protected function requiresRestart($default): bool $this->disabledExtensions, static fn(string $extension): bool => extension_loaded($extension) ); + if (!extension_loaded('opcache')) { + return true; + } + if (!in_array(ini_get('opcache.enable_cli'), ['1', 'true', true, 1])) { + return true; + } + if (((int) ini_get('opcache.jit')) !== 1205) { + return true; + } + if (((int) ini_get('opcache.jit')) === 0) { + return true; + } return $default || $this->required; } @@ -47,9 +62,9 @@ protected function requiresRestart($default): bool /** * No type hint to allow xdebug-handler v1 and v2 usage * - * @param string|string[] $command + * @param string[] $command */ - protected function restart($command): void + protected function restart(array $command): void { if ($this->required && $this->tmpIni) { $regex = '/^\s*(extension\s*=.*(' . implode('|', $this->disabledExtensions) . ').*)$/mi'; @@ -59,8 +74,18 @@ protected function restart($command): void file_put_contents($this->tmpIni, $content); } + array_splice( + $command, + 1, + 0, + [ + '-dzend_extension=opcache', + '-dopcache.enable_cli=true', + '-dopcache.jit_buffer_size=512M', + '-dopcache.jit=1205', + ], + ); - /** @psalm-suppress PossiblyInvalidArgument */ parent::restart($command); } } From 5d976900d1c593e36976f436a59159b31fa234ef Mon Sep 17 00:00:00 2001 From: Andrew Boyton Date: Thu, 9 Feb 2023 11:55:06 +1100 Subject: [PATCH 034/109] Fix divide by a floating point zero The code was failing when dividing by 0.0. --- .../Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php index 1712c8a5485..9be82c7c920 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php @@ -962,7 +962,7 @@ public static function arithmeticOperation( } elseif ($operation instanceof PhpParser\Node\Expr\BinaryOp\ShiftRight) { $result = $operand1 >> $operand2; } elseif ($operation instanceof PhpParser\Node\Expr\BinaryOp\Div) { - if ($operand2 === 0) { + if ($operand2 === 0 || $operand2 === 0.0) { return Type::getNever(); } From 250d4d593eb237ad828c04c8f649697dc5d980b2 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 9 Feb 2023 02:56:01 -0400 Subject: [PATCH 035/109] Don't crash on unknown exceptions in `@throws` docblock Fixes vimeo/psalm#9248 --- .../Analyzer/FunctionLikeAnalyzer.php | 5 +++- tests/ThrowsAnnotationTest.php | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 77c4ff55fab..a337ece0feb 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -710,7 +710,10 @@ public function analyze( foreach ($storage->throws as $expected_exception => $_) { if ($expected_exception === $possibly_thrown_exception - || $codebase->classExtendsOrImplements($possibly_thrown_exception, $expected_exception) + || ( + $codebase->classOrInterfaceExists($possibly_thrown_exception) + && $codebase->classExtendsOrImplements($possibly_thrown_exception, $expected_exception) + ) ) { $is_expected = true; break; diff --git a/tests/ThrowsAnnotationTest.php b/tests/ThrowsAnnotationTest.php index 4caea968cff..38476819116 100644 --- a/tests/ThrowsAnnotationTest.php +++ b/tests/ThrowsAnnotationTest.php @@ -634,4 +634,29 @@ function method(): void $this->analyzeFile('somefile.php', $context); } + + public function testUnknownExceptionInThrowsOfACalledMethod(): void + { + $this->expectExceptionMessage('MissingThrowsDocblock'); + $this->expectException(CodeException::class); + Config::getInstance()->check_for_throws_docblock = true; + + $this->addFile( + 'somefile.php', + 'havingFun(); + } + /** @throws \Monkey\Shit */ + private function havingFun(): void {} + } + ', + ); + + $context = new Context(); + + $this->analyzeFile('somefile.php', $context); + } } From c7ef4580c3ebbbdf632477132ef64f356dc575be Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 9 Feb 2023 03:35:58 -0400 Subject: [PATCH 036/109] Update workflows to use non-deprecated method offf setting step output See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- .github/workflows/bcc.yml | 4 ++-- .github/workflows/build-phar.yml | 4 ++-- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/windows-ci.yml | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/bcc.yml b/.github/workflows/bcc.yml index 5cc8c319458..6264f7a4158 100644 --- a/.github/workflows/bcc.yml +++ b/.github/workflows/bcc.yml @@ -20,8 +20,8 @@ jobs: - name: Get Composer Cache Directories id: composer-cache run: | - echo "::set-output name=files_cache::$(composer config cache-files-dir)" - echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" + echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT - name: Cache composer cache uses: actions/cache@v3 diff --git a/.github/workflows/build-phar.yml b/.github/workflows/build-phar.yml index 2f06237b5ac..2f7d467a1bd 100644 --- a/.github/workflows/build-phar.yml +++ b/.github/workflows/build-phar.yml @@ -49,8 +49,8 @@ jobs: - name: Get Composer Cache Directories id: composer-cache run: | - echo "::set-output name=files_cache::$(composer config cache-files-dir)" - echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" + echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT - name: Cache composer cache uses: actions/cache@v3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb91b65d8e1..ded89da5cd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,8 @@ jobs: - name: Get Composer Cache Directories id: composer-cache run: | - echo "::set-output name=files_cache::$(composer config cache-files-dir)" - echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" + echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT - name: Cache composer cache uses: actions/cache@v3 @@ -58,8 +58,8 @@ jobs: - id: chunk-matrix name: Generates the Chunk Matrix run: | - echo "::set-output name=count::$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')" - echo "::set-output name=chunks::$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" + echo "count=$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')" >> $GITHUB_OUTPUT + echo "chunks=$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" >> $GITHUB_OUTPUT tests: name: "Unit Tests - ${{ matrix.chunk }}" @@ -94,8 +94,8 @@ jobs: - name: Get Composer Cache Directories id: composer-cache run: | - echo "::set-output name=files_cache::$(composer config cache-files-dir)" - echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" + echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT - name: Cache composer cache uses: actions/cache@v3 diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index adf55967721..69a9cbb58a2 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -23,8 +23,8 @@ jobs: - id: chunk-matrix name: Generates the Chunk Matrix run: | - echo "::set-output name=count::$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')" - echo "::set-output name=chunks::$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" + echo "count=$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')" >> $GITHUB_OUTPUT + echo "chunks=$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" >> $GITHUB_OUTPUT tests: name: "Unit Tests - ${{ matrix.chunk }}" @@ -64,8 +64,8 @@ jobs: - name: Get Composer Cache Directories id: composer-cache run: | - echo "::set-output name=files_cache::$(composer config cache-files-dir)" - echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" + echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT - name: Cache composer cache uses: actions/cache@v3 From 9f07f5fe9aca89d7e8c5662549d2d56010572565 Mon Sep 17 00:00:00 2001 From: Bitwise Operators Date: Thu, 9 Feb 2023 08:53:30 +0100 Subject: [PATCH 037/109] docs: Add entry to utility types mentioning using value-of<> with BackedEnum --- docs/annotating_code/type_syntax/utility_types.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/annotating_code/type_syntax/utility_types.md b/docs/annotating_code/type_syntax/utility_types.md index 32b10cadd63..d2de471f453 100644 --- a/docs/annotating_code/type_syntax/utility_types.md +++ b/docs/annotating_code/type_syntax/utility_types.md @@ -51,6 +51,13 @@ Some examples: - `value-of` evaluates to `string` - `value-of` evaluates to the template param's value-type (ensure `@template T of array`) +### Use with enumerations + +In addition to array-types, `value-of` can also be used to specify an `int` or `string` that contains one of the possible values of a `BackedEnum`: + +- `value-of` evaluates to `'H'|'D'|'C'|'S'` (see [Backed enumerations](https://www.php.net/manual/en/language.enumerations.backed.php)) +- `value-of` evaluates to `0|1` + ### Notes on template usage If you use `value-of` with a template param, you can fulfill the type check only with these allowed methods: From 89024ffbc252b0efcf0195301f03f7326147846a Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 9 Feb 2023 03:44:02 -0400 Subject: [PATCH 038/109] Quote paths --- .github/workflows/windows-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 69a9cbb58a2..2b9e68a1da9 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -64,8 +64,8 @@ jobs: - name: Get Composer Cache Directories id: composer-cache run: | - echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT + echo "files_cache=""$(composer config cache-files-dir)""" >> $GITHUB_OUTPUT + echo "vcs_cache=""$(composer config cache-vcs-dir)""" >> $GITHUB_OUTPUT - name: Cache composer cache uses: actions/cache@v3 From 78c3d6b43641c911c53ba9b4f3f2bb7150d55b99 Mon Sep 17 00:00:00 2001 From: kkmuffme <11071985+kkmuffme@users.noreply.github.com> Date: Thu, 9 Feb 2023 09:27:51 +0100 Subject: [PATCH 039/109] fix lstat bug cache directory race condition --- src/Psalm/Config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 10083095fb8..ff01b3a6573 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -66,7 +66,6 @@ use function fclose; use function file_exists; use function file_get_contents; -use function filetype; use function flock; use function fopen; use function get_class; @@ -2502,11 +2501,12 @@ public static function removeCacheDirectory(string $dir): void $full_path = $dir . '/' . $object; // if it was deleted in the meantime/race condition with other psalm process + clearstatcache(true, $full_path); if (!file_exists($full_path)) { continue; } - if (filetype($full_path) === 'dir') { + if (is_dir($full_path)) { self::removeCacheDirectory($full_path); } else { $fp = fopen($full_path, 'c'); From b467a0a74eaad9cda23f49885c45e337303ed29f Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Thu, 9 Feb 2023 10:38:39 -0600 Subject: [PATCH 040/109] Fix Spoofchecker callmaps --- dictionaries/CallMap.php | 10 +++++----- dictionaries/CallMap_historical.php | 10 +++++----- tests/Internal/Codebase/InternalCallMapHandlerTest.php | 5 ----- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index d803e6a1a25..db6ab1274da 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -13471,11 +13471,11 @@ 'SplTempFileObject::valid' => ['bool'], 'SplType::__construct' => ['void', 'initial_value='=>'mixed', 'strict='=>'bool'], 'Spoofchecker::__construct' => ['void'], -'Spoofchecker::areConfusable' => ['bool', 's1'=>'string', 's2'=>'string', '&w_error='=>'string'], -'Spoofchecker::isSuspicious' => ['bool', 'text'=>'string', '&w_error='=>'string'], -'Spoofchecker::setAllowedLocales' => ['void', 'locale_list'=>'string'], -'Spoofchecker::setChecks' => ['void', 'checks'=>'long'], -'Spoofchecker::setRestrictionLevel' => ['void', 'restriction_level'=>'int'], +'Spoofchecker::areConfusable' => ['bool', 'string1'=>'string', 'string2'=>'string', '&w_errorCode='=>'int'], +'Spoofchecker::isSuspicious' => ['bool', 'string'=>'string', '&w_errorCode='=>'int'], +'Spoofchecker::setAllowedLocales' => ['void', 'locales'=>'string'], +'Spoofchecker::setChecks' => ['void', 'checks'=>'int'], +'Spoofchecker::setRestrictionLevel' => ['void', 'level'=>'int'], 'sprintf' => ['string', 'format'=>'string', '...values='=>'string|int|float'], 'SQLite3::__construct' => ['void', 'filename'=>'string', 'flags='=>'int', 'encryptionKey='=>'?string'], 'SQLite3::busyTimeout' => ['bool', 'milliseconds'=>'int'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index f1f4cbd0c8a..5130b8be560 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -8008,11 +8008,11 @@ 'SplTempFileObject::valid' => ['bool'], 'SplType::__construct' => ['void', 'initial_value='=>'mixed', 'strict='=>'bool'], 'Spoofchecker::__construct' => ['void'], - 'Spoofchecker::areConfusable' => ['bool', 's1'=>'string', 's2'=>'string', '&w_error='=>'string'], - 'Spoofchecker::isSuspicious' => ['bool', 'text'=>'string', '&w_error='=>'string'], - 'Spoofchecker::setAllowedLocales' => ['void', 'locale_list'=>'string'], - 'Spoofchecker::setChecks' => ['void', 'checks'=>'long'], - 'Spoofchecker::setRestrictionLevel' => ['void', 'restriction_level'=>'int'], + 'Spoofchecker::areConfusable' => ['bool', 'string1'=>'string', 'string2'=>'string', '&w_errorCode='=>'int'], + 'Spoofchecker::isSuspicious' => ['bool', 'string'=>'string', '&w_errorCode='=>'int'], + 'Spoofchecker::setAllowedLocales' => ['void', 'locales'=>'string'], + 'Spoofchecker::setChecks' => ['void', 'checks'=>'int'], + 'Spoofchecker::setRestrictionLevel' => ['void', 'level'=>'int'], 'Stomp::__construct' => ['void', 'broker='=>'string', 'username='=>'string', 'password='=>'string', 'headers='=>'?array'], 'Stomp::abort' => ['bool', 'transaction_id'=>'string', 'headers='=>'?array'], 'Stomp::ack' => ['bool', 'msg'=>'', 'headers='=>'?array'], diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 3ecc8579e08..7e14a822a7c 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -789,11 +789,6 @@ class InternalCallMapHandlerTest extends TestCase 'spltempfileobject::setfileclass', 'spltempfileobject::setinfoclass', 'spltempfileobject::setmaxlinelen', - 'spoofchecker::areconfusable', - 'spoofchecker::issuspicious', - 'spoofchecker::setallowedlocales', - 'spoofchecker::setchecks', - 'spoofchecker::setrestrictionlevel', 'sqlite3::__construct', 'sqlite3::open', 'sqlsrv_connect', From ffb393ca977b72d8f0fb1405b3750662ae965c70 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 9 Feb 2023 14:42:22 -0400 Subject: [PATCH 041/109] Switch shell instead of tweaking quotes --- .github/workflows/windows-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 2b9e68a1da9..8e202adf150 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -25,6 +25,7 @@ jobs: run: | echo "count=$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')" >> $GITHUB_OUTPUT echo "chunks=$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" >> $GITHUB_OUTPUT + shell: bash tests: name: "Unit Tests - ${{ matrix.chunk }}" @@ -64,8 +65,9 @@ jobs: - name: Get Composer Cache Directories id: composer-cache run: | - echo "files_cache=""$(composer config cache-files-dir)""" >> $GITHUB_OUTPUT - echo "vcs_cache=""$(composer config cache-vcs-dir)""" >> $GITHUB_OUTPUT + echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT + shell: bash - name: Cache composer cache uses: actions/cache@v3 From 954136679a4953fd22f2e29c65a03a5b5e38ee5a Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 9 Feb 2023 17:49:49 -0400 Subject: [PATCH 042/109] Fix crashes with invalid `@psalm-check-type` syntax Fixes vimeo/psalm#9201 --- psalm-baseline.xml | 5 +---- .../Internal/Analyzer/StatementsAnalyzer.php | 4 ++-- tests/CheckTypeTest.php | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index b0f8bd4704e..66d23cbb8e1 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + tags['variablesfrom'][0]]]> @@ -227,9 +227,6 @@ expr->getArgs()[0]]]> - - $check_type_string - diff --git a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php index a4e0263bd1e..c13850f0a98 100644 --- a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php @@ -656,9 +656,9 @@ private static function analyzeStatement( } foreach ($checked_types as [$check_type_line, $is_exact]) { - [$checked_var, $check_type_string] = array_map('trim', explode('=', $check_type_line)); + [$checked_var, $check_type_string] = array_map('trim', explode('=', $check_type_line, 2)) + ['', '']; - if ($check_type_string === '') { + if ($check_type_string === '' || $checked_var === '') { IssueBuffer::maybeAdd( new InvalidDocblock( "Invalid format for @psalm-check-type" . ($is_exact ? "-exact" : ""), diff --git a/tests/CheckTypeTest.php b/tests/CheckTypeTest.php index 5178f4ffe7e..a3f0aabbfe5 100644 --- a/tests/CheckTypeTest.php +++ b/tests/CheckTypeTest.php @@ -64,5 +64,23 @@ public function providerInvalidCodeParse(): iterable ', 'error_message' => 'Checked variable $foo? = 1 does not match $foo = 1', ]; + yield 'invalidIncompleteSyntax' => [ + 'code' => ' 'InvalidDocblock', + ]; + yield 'invalidIncompleteSyntaxNoVar' => [ + 'code' => ' 'InvalidDocblock', + ]; + yield 'invalidIncompleteSyntaxNoType' => [ + 'code' => ' 'InvalidDocblock', + ]; } } From 85d4acf3b3d1ecb253a4e108041a87347abe8ffa Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 9 Feb 2023 22:57:57 -0400 Subject: [PATCH 043/109] Fix crash when int range boundary is overflown Fixes vimeo/psalm#9114 --- .../Internal/Type/SimpleAssertionReconciler.php | 3 ++- tests/IntRangeTest.php | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php index c1b377db5d2..44adb58dfb2 100644 --- a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php @@ -80,6 +80,7 @@ use function count; use function explode; use function get_class; +use function is_int; use function min; use function strlen; use function strpos; @@ -2000,7 +2001,7 @@ private static function reconcileIsGreaterThan( $existing_var_type->addType(new TIntRange($assertion_value, $atomic_type->value)); } }*/ - } elseif ($atomic_type instanceof TInt) { + } elseif ($atomic_type instanceof TInt && is_int($assertion_value)) { $redundant = false; $existing_var_type->removeType($atomic_type->getKey()); $existing_var_type->addType(new TIntRange($assertion_value, null)); diff --git a/tests/IntRangeTest.php b/tests/IntRangeTest.php index 1d14c6d7840..c7c09ae2d92 100644 --- a/tests/IntRangeTest.php +++ b/tests/IntRangeTest.php @@ -1017,6 +1017,19 @@ function bar(int $_a, int $_b): void {} } ', ], + 'rangeOverflow' => [ + 'code' => ' [ + '$z' => 'int|null', + ], + ], ]; } From 542cc343fcdab9c3080cbb4654793f60d730e634 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sat, 11 Feb 2023 06:42:48 -0400 Subject: [PATCH 044/109] Fix opcache being loaded twice Fixes vimeo/psalm#9263 --- src/Psalm/Internal/Fork/PsalmRestarter.php | 27 ++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index af3d367c8d1..f91c3e2b727 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -43,15 +43,15 @@ protected function requiresRestart($default): bool $this->disabledExtensions, static fn(string $extension): bool => extension_loaded($extension) ); - if (!extension_loaded('opcache')) { - return true; - } + if (!in_array(ini_get('opcache.enable_cli'), ['1', 'true', true, 1])) { return true; } + if (((int) ini_get('opcache.jit')) !== 1205) { return true; } + if (((int) ini_get('opcache.jit')) === 0) { return true; } @@ -74,16 +74,25 @@ protected function restart(array $command): void file_put_contents($this->tmpIni, $content); } + + $additional_options = []; + + // executed in the parent process (before restart) + // if it wasn't loaded then we apparently don't have opcache installed and there's no point trying + // to tweak it + if (extension_loaded('opcache') || extension_loaded('Zend OPcache')) { + $additional_options = [ + '-dopcache.enable_cli=true', + '-dopcache.jit_buffer_size=512M', + '-dopcache.jit=1205', + ]; + } + array_splice( $command, 1, 0, - [ - '-dzend_extension=opcache', - '-dopcache.enable_cli=true', - '-dopcache.jit_buffer_size=512M', - '-dopcache.jit=1205', - ], + $additional_options, ); parent::restart($command); From 4f4ffb9080b3b5f3ae14670d70d7abb3da0c3ec5 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Sat, 11 Feb 2023 04:44:18 -0600 Subject: [PATCH 045/109] Drop abandoned mcve m_ functions --- dictionaries/CallMap.php | 39 ----------------------------- dictionaries/CallMap_historical.php | 39 ----------------------------- 2 files changed, 78 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index e888b4e10d4..14afa96a148 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -6933,45 +6933,6 @@ 'lzf_compress' => ['string', 'data'=>'string'], 'lzf_decompress' => ['string', 'data'=>'string'], 'lzf_optimized_for' => ['int'], -'m_checkstatus' => ['int', 'conn'=>'resource', 'identifier'=>'int'], -'m_completeauthorizations' => ['int', 'conn'=>'resource', 'array'=>'int'], -'m_connect' => ['int', 'conn'=>'resource'], -'m_connectionerror' => ['string', 'conn'=>'resource'], -'m_deletetrans' => ['bool', 'conn'=>'resource', 'identifier'=>'int'], -'m_destroyconn' => ['bool', 'conn'=>'resource'], -'m_destroyengine' => ['void'], -'m_getcell' => ['string', 'conn'=>'resource', 'identifier'=>'int', 'column'=>'string', 'row'=>'int'], -'m_getcellbynum' => ['string', 'conn'=>'resource', 'identifier'=>'int', 'column'=>'int', 'row'=>'int'], -'m_getcommadelimited' => ['string', 'conn'=>'resource', 'identifier'=>'int'], -'m_getheader' => ['string', 'conn'=>'resource', 'identifier'=>'int', 'column_num'=>'int'], -'m_initconn' => ['resource'], -'m_initengine' => ['int', 'location'=>'string'], -'m_iscommadelimited' => ['int', 'conn'=>'resource', 'identifier'=>'int'], -'m_maxconntimeout' => ['bool', 'conn'=>'resource', 'secs'=>'int'], -'m_monitor' => ['int', 'conn'=>'resource'], -'m_numcolumns' => ['int', 'conn'=>'resource', 'identifier'=>'int'], -'m_numrows' => ['int', 'conn'=>'resource', 'identifier'=>'int'], -'m_parsecommadelimited' => ['int', 'conn'=>'resource', 'identifier'=>'int'], -'m_responsekeys' => ['array', 'conn'=>'resource', 'identifier'=>'int'], -'m_responseparam' => ['string', 'conn'=>'resource', 'identifier'=>'int', 'key'=>'string'], -'m_returnstatus' => ['int', 'conn'=>'resource', 'identifier'=>'int'], -'m_setblocking' => ['int', 'conn'=>'resource', 'tf'=>'int'], -'m_setdropfile' => ['int', 'conn'=>'resource', 'directory'=>'string'], -'m_setip' => ['int', 'conn'=>'resource', 'host'=>'string', 'port'=>'int'], -'m_setssl' => ['int', 'conn'=>'resource', 'host'=>'string', 'port'=>'int'], -'m_setssl_cafile' => ['int', 'conn'=>'resource', 'cafile'=>'string'], -'m_setssl_files' => ['int', 'conn'=>'resource', 'sslkeyfile'=>'string', 'sslcertfile'=>'string'], -'m_settimeout' => ['int', 'conn'=>'resource', 'seconds'=>'int'], -'m_sslcert_gen_hash' => ['string', 'filename'=>'string'], -'m_transactionssent' => ['int', 'conn'=>'resource'], -'m_transinqueue' => ['int', 'conn'=>'resource'], -'m_transkeyval' => ['int', 'conn'=>'resource', 'identifier'=>'int', 'key'=>'string', 'value'=>'string'], -'m_transnew' => ['int', 'conn'=>'resource'], -'m_transsend' => ['int', 'conn'=>'resource', 'identifier'=>'int'], -'m_uwait' => ['int', 'microsecs'=>'int'], -'m_validateidentifier' => ['int', 'conn'=>'resource', 'tf'=>'int'], -'m_verifyconnection' => ['bool', 'conn'=>'resource', 'tf'=>'int'], -'m_verifysslcert' => ['bool', 'conn'=>'resource', 'tf'=>'int'], 'magic_quotes_runtime' => ['bool', 'new_setting'=>'bool'], 'mail' => ['bool', 'to'=>'string', 'subject'=>'string', 'message'=>'string', 'additional_headers='=>'string|array|null', 'additional_params='=>'string'], 'mailparse_determine_best_xfer_encoding' => ['string', 'fp'=>'resource'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 57e9e528b86..831a251a415 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -12636,45 +12636,6 @@ 'lzf_compress' => ['string', 'data'=>'string'], 'lzf_decompress' => ['string', 'data'=>'string'], 'lzf_optimized_for' => ['int'], - 'm_checkstatus' => ['int', 'conn'=>'resource', 'identifier'=>'int'], - 'm_completeauthorizations' => ['int', 'conn'=>'resource', 'array'=>'int'], - 'm_connect' => ['int', 'conn'=>'resource'], - 'm_connectionerror' => ['string', 'conn'=>'resource'], - 'm_deletetrans' => ['bool', 'conn'=>'resource', 'identifier'=>'int'], - 'm_destroyconn' => ['bool', 'conn'=>'resource'], - 'm_destroyengine' => ['void'], - 'm_getcell' => ['string', 'conn'=>'resource', 'identifier'=>'int', 'column'=>'string', 'row'=>'int'], - 'm_getcellbynum' => ['string', 'conn'=>'resource', 'identifier'=>'int', 'column'=>'int', 'row'=>'int'], - 'm_getcommadelimited' => ['string', 'conn'=>'resource', 'identifier'=>'int'], - 'm_getheader' => ['string', 'conn'=>'resource', 'identifier'=>'int', 'column_num'=>'int'], - 'm_initconn' => ['resource'], - 'm_initengine' => ['int', 'location'=>'string'], - 'm_iscommadelimited' => ['int', 'conn'=>'resource', 'identifier'=>'int'], - 'm_maxconntimeout' => ['bool', 'conn'=>'resource', 'secs'=>'int'], - 'm_monitor' => ['int', 'conn'=>'resource'], - 'm_numcolumns' => ['int', 'conn'=>'resource', 'identifier'=>'int'], - 'm_numrows' => ['int', 'conn'=>'resource', 'identifier'=>'int'], - 'm_parsecommadelimited' => ['int', 'conn'=>'resource', 'identifier'=>'int'], - 'm_responsekeys' => ['array', 'conn'=>'resource', 'identifier'=>'int'], - 'm_responseparam' => ['string', 'conn'=>'resource', 'identifier'=>'int', 'key'=>'string'], - 'm_returnstatus' => ['int', 'conn'=>'resource', 'identifier'=>'int'], - 'm_setblocking' => ['int', 'conn'=>'resource', 'tf'=>'int'], - 'm_setdropfile' => ['int', 'conn'=>'resource', 'directory'=>'string'], - 'm_setip' => ['int', 'conn'=>'resource', 'host'=>'string', 'port'=>'int'], - 'm_setssl' => ['int', 'conn'=>'resource', 'host'=>'string', 'port'=>'int'], - 'm_setssl_cafile' => ['int', 'conn'=>'resource', 'cafile'=>'string'], - 'm_setssl_files' => ['int', 'conn'=>'resource', 'sslkeyfile'=>'string', 'sslcertfile'=>'string'], - 'm_settimeout' => ['int', 'conn'=>'resource', 'seconds'=>'int'], - 'm_sslcert_gen_hash' => ['string', 'filename'=>'string'], - 'm_transactionssent' => ['int', 'conn'=>'resource'], - 'm_transinqueue' => ['int', 'conn'=>'resource'], - 'm_transkeyval' => ['int', 'conn'=>'resource', 'identifier'=>'int', 'key'=>'string', 'value'=>'string'], - 'm_transnew' => ['int', 'conn'=>'resource'], - 'm_transsend' => ['int', 'conn'=>'resource', 'identifier'=>'int'], - 'm_uwait' => ['int', 'microsecs'=>'int'], - 'm_validateidentifier' => ['int', 'conn'=>'resource', 'tf'=>'int'], - 'm_verifyconnection' => ['bool', 'conn'=>'resource', 'tf'=>'int'], - 'm_verifysslcert' => ['bool', 'conn'=>'resource', 'tf'=>'int'], 'magic_quotes_runtime' => ['bool', 'new_setting'=>'bool'], 'mail' => ['bool', 'to'=>'string', 'subject'=>'string', 'message'=>'string', 'additional_headers='=>'string|array|null', 'additional_params='=>'string'], 'mailparse_determine_best_xfer_encoding' => ['string', 'fp'=>'resource'], From 9547a5cba5ab1667f0cf0ecae5f54a1abe75d2b3 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Sat, 11 Feb 2023 04:41:54 -0600 Subject: [PATCH 046/109] Fix several callmap function signatures --- dictionaries/CallMap.php | 92 ++++++------ dictionaries/CallMap_80_delta.php | 140 ++++++++++++++++-- dictionaries/CallMap_81_delta.php | 8 +- dictionaries/CallMap_historical.php | 40 ++--- .../Codebase/InternalCallMapHandlerTest.php | 47 ------ 5 files changed, 196 insertions(+), 131 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index e888b4e10d4..84a5dec2492 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -526,8 +526,8 @@ 'bbcode_set_flags' => ['bool', 'bbcode_container'=>'resource', 'flags'=>'int', 'mode='=>'int'], 'bcadd' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], 'bccomp' => ['int', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], -'bcdiv' => ['numeric-string', 'dividend'=>'numeric-string', 'divisor'=>'numeric-string', 'scale='=>'int|null'], -'bcmod' => ['numeric-string', 'dividend'=>'numeric-string', 'divisor'=>'numeric-string', 'scale='=>'int|null'], +'bcdiv' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], +'bcmod' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], 'bcmul' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], 'bcompiler_load' => ['bool', 'filename'=>'string'], 'bcompiler_load_exe' => ['bool', 'filename'=>'string'], @@ -543,7 +543,7 @@ 'bcompiler_write_header' => ['bool', 'filehandle'=>'resource', 'write_ver='=>'string'], 'bcompiler_write_included_filename' => ['bool', 'filehandle'=>'resource', 'filename'=>'string'], 'bcpow' => ['numeric-string', 'num'=>'numeric-string', 'exponent'=>'numeric-string', 'scale='=>'int|null'], -'bcpowmod' => ['numeric-string|false', 'base'=>'numeric-string', 'exponent'=>'numeric-string', 'modulus'=>'numeric-string', 'scale='=>'int|null'], +'bcpowmod' => ['numeric-string', 'num'=>'numeric-string', 'exponent'=>'numeric-string', 'modulus'=>'numeric-string', 'scale='=>'int|null'], 'bcscale' => ['int', 'scale='=>'int|null'], 'bcsqrt' => ['numeric-string', 'num'=>'numeric-string', 'scale='=>'int|null'], 'bcsub' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], @@ -569,7 +569,7 @@ 'bson_encode' => ['string', 'anything'=>'mixed'], 'bzclose' => ['bool', 'bz'=>'resource'], 'bzcompress' => ['string|int', 'data'=>'string', 'block_size='=>'int', 'work_factor='=>'int'], -'bzdecompress' => ['string|int', 'data'=>'string', 'use_less_memory='=>'int'], +'bzdecompress' => ['string|int|false', 'data'=>'string', 'use_less_memory='=>'bool'], 'bzerrno' => ['int', 'bz'=>'resource'], 'bzerror' => ['array', 'bz'=>'resource'], 'bzerrstr' => ['string', 'bz'=>'resource'], @@ -1553,7 +1553,7 @@ 'crack_opendict' => ['resource|false', 'dictionary'=>'string'], 'crash' => [''], 'crc32' => ['int', 'string'=>'string'], -'crypt' => ['string', 'string'=>'string', 'salt='=>'string'], +'crypt' => ['string', 'string'=>'string', 'salt'=>'string'], 'ctype_alnum' => ['bool', 'text'=>'string|int'], 'ctype_alpha' => ['bool', 'text'=>'string|int'], 'ctype_cntrl' => ['bool', 'text'=>'string|int'], @@ -1956,7 +1956,7 @@ 'deaggregate' => ['', 'object'=>'object', 'class_name='=>'string'], 'debug_backtrace' => ['list', 'options='=>'int', 'limit='=>'int'], 'debug_print_backtrace' => ['void', 'options='=>'int', 'limit='=>'int'], -'debug_zval_dump' => ['void', '...value'=>'mixed'], +'debug_zval_dump' => ['void', 'value'=>'mixed', '...values='=>'mixed'], 'debugger_connect' => [''], 'debugger_connector_pid' => [''], 'debugger_get_server_start_time' => [''], @@ -2029,7 +2029,7 @@ 'dl' => ['bool', 'extension_filename'=>'string'], 'dngettext' => ['string', 'domain'=>'string', 'singular'=>'string', 'plural'=>'string', 'count'=>'int'], 'dns_check_record' => ['bool', 'hostname'=>'string', 'type='=>'string'], -'dns_get_mx' => ['bool', 'hostname'=>'string', '&w_hosts'=>'array', '&w_weights'=>'array'], +'dns_get_mx' => ['bool', 'hostname'=>'string', '&w_hosts'=>'array', '&w_weights='=>'array'], 'dns_get_record' => ['list|false', 'hostname'=>'string', 'type='=>'int', '&w_authoritative_name_servers='=>'array', '&w_additional_records='=>'array', 'raw='=>'bool'], 'dom_document_relaxNG_validate_file' => ['bool', 'filename'=>'string'], 'dom_document_relaxNG_validate_xml' => ['bool', 'source'=>'string'], @@ -2464,27 +2464,27 @@ 'EmptyIterator::next' => ['void'], 'EmptyIterator::rewind' => ['void'], 'EmptyIterator::valid' => ['bool'], -'enchant_broker_describe' => ['array', 'broker'=>'resource'], -'enchant_broker_dict_exists' => ['bool', 'broker'=>'resource', 'tag'=>'string'], -'enchant_broker_free' => ['bool', 'broker'=>'resource'], -'enchant_broker_free_dict' => ['bool', 'dictionary'=>'resource'], -'enchant_broker_get_dict_path' => ['string', 'broker'=>'resource', 'type'=>'int'], -'enchant_broker_get_error' => ['string|false', 'broker'=>'resource'], +'enchant_broker_describe' => ['array', 'broker'=>'EnchantBroker'], +'enchant_broker_dict_exists' => ['bool', 'broker'=>'EnchantBroker', 'tag'=>'string'], +'enchant_broker_free' => ['bool', 'broker'=>'EnchantBroker'], +'enchant_broker_free_dict' => ['bool', 'dictionary'=>'EnchantBroker'], +'enchant_broker_get_dict_path' => ['string', 'broker'=>'EnchantBroker', 'type'=>'int'], +'enchant_broker_get_error' => ['string|false', 'broker'=>'EnchantBroker'], 'enchant_broker_init' => ['EnchantBroker|false'], -'enchant_broker_list_dicts' => ['array|false', 'broker'=>'resource'], -'enchant_broker_request_dict' => ['resource|false', 'broker'=>'resource', 'tag'=>'string'], -'enchant_broker_request_pwl_dict' => ['resource|false', 'broker'=>'resource', 'filename'=>'string'], -'enchant_broker_set_dict_path' => ['bool', 'broker'=>'resource', 'type'=>'int', 'path'=>'string'], -'enchant_broker_set_ordering' => ['bool', 'broker'=>'resource', 'tag'=>'string', 'ordering'=>'string'], -'enchant_dict_add_to_personal' => ['void', 'dictionary'=>'resource', 'word'=>'string'], -'enchant_dict_add_to_session' => ['void', 'dictionary'=>'resource', 'word'=>'string'], -'enchant_dict_check' => ['bool', 'dictionary'=>'resource', 'word'=>'string'], -'enchant_dict_describe' => ['array', 'dictionary'=>'resource'], -'enchant_dict_get_error' => ['string', 'dictionary'=>'resource'], -'enchant_dict_is_in_session' => ['bool', 'dictionary'=>'resource', 'word'=>'string'], -'enchant_dict_quick_check' => ['bool', 'dictionary'=>'resource', 'word'=>'string', '&w_suggestions='=>'array'], -'enchant_dict_store_replacement' => ['void', 'dictionary'=>'resource', 'misspelled'=>'string', 'correct'=>'string'], -'enchant_dict_suggest' => ['array', 'dictionary'=>'resource', 'word'=>'string'], +'enchant_broker_list_dicts' => ['array', 'broker'=>'EnchantBroker'], +'enchant_broker_request_dict' => ['EnchantDictionary|false', 'broker'=>'EnchantBroker', 'tag'=>'string'], +'enchant_broker_request_pwl_dict' => ['EnchantDictionary|false', 'broker'=>'EnchantBroker', 'filename'=>'string'], +'enchant_broker_set_dict_path' => ['bool', 'broker'=>'EnchantBroker', 'type'=>'int', 'path'=>'string'], +'enchant_broker_set_ordering' => ['bool', 'broker'=>'EnchantBroker', 'tag'=>'string', 'ordering'=>'string'], +'enchant_dict_add_to_personal' => ['void', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], +'enchant_dict_add_to_session' => ['void', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], +'enchant_dict_check' => ['bool', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], +'enchant_dict_describe' => ['array', 'dictionary'=>'EnchantDictionary'], +'enchant_dict_get_error' => ['string', 'dictionary'=>'EnchantDictionary'], +'enchant_dict_is_in_session' => ['bool', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], +'enchant_dict_quick_check' => ['bool', 'dictionary'=>'EnchantDictionary', 'word'=>'string', '&w_suggestions='=>'array'], +'enchant_dict_store_replacement' => ['void', 'dictionary'=>'EnchantDictionary', 'misspelled'=>'string', 'correct'=>'string'], +'enchant_dict_suggest' => ['array', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], 'end' => ['mixed|false', '&r_array'=>'array|object'], 'enum_exists' => ['bool', 'enum' => 'string', 'autoload=' => 'bool'], 'Error::__clone' => ['void'], @@ -3969,10 +3969,10 @@ 'gmp_add' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int'], 'gmp_and' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int'], 'gmp_binomial' => ['GMP', 'n'=>'GMP|string|int', 'k'=>'int'], -'gmp_clrbit' => ['void', 'num'=>'GMP|string|int', 'index'=>'int'], +'gmp_clrbit' => ['void', 'num'=>'GMP', 'index'=>'int'], 'gmp_cmp' => ['int', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int'], 'gmp_com' => ['GMP', 'num'=>'GMP|string|int'], -'gmp_div' => ['GMP', 'num1'=>'GMP|resource|string', 'num2'=>'GMP|resource|string', 'rounding_mode='=>'int'], +'gmp_div' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int', 'rounding_mode='=>'int'], 'gmp_div_q' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int', 'rounding_mode='=>'int'], 'gmp_div_qr' => ['array{0: GMP, 1: GMP}', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int', 'rounding_mode='=>'int'], 'gmp_div_r' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int', 'rounding_mode='=>'int'], @@ -4008,7 +4008,7 @@ 'gmp_rootrem' => ['array{0: GMP, 1: GMP}', 'num'=>'GMP|string|int', 'nth'=>'int'], 'gmp_scan0' => ['int', 'num1'=>'GMP|string|int', 'start'=>'int'], 'gmp_scan1' => ['int', 'num1'=>'GMP|string|int', 'start'=>'int'], -'gmp_setbit' => ['void', 'num'=>'GMP|string|int', 'index'=>'int', 'value='=>'bool'], +'gmp_setbit' => ['void', 'num'=>'GMP', 'index'=>'int', 'value='=>'bool'], 'gmp_sign' => ['int', 'num'=>'GMP|string|int'], 'gmp_sqrt' => ['GMP', 'num'=>'GMP|string|int'], 'gmp_sqrtrem' => ['array{0: GMP, 1: GMP}', 'num'=>'GMP|string|int'], @@ -4334,7 +4334,7 @@ 'hash_hkdf' => ['non-empty-string', 'algo'=>'string', 'key'=>'string', 'length='=>'int', 'info='=>'string', 'salt='=>'string'], 'hash_hmac' => ['non-empty-string', 'algo'=>'string', 'data'=>'string', 'key'=>'string', 'binary='=>'bool'], 'hash_hmac_algos' => ['list'], -'hash_hmac_file' => ['non-empty-string|false', 'algo'=>'string', 'data'=>'string', 'key'=>'string', 'binary='=>'bool'], +'hash_hmac_file' => ['non-empty-string', 'algo'=>'string', 'filename'=>'string', 'key'=>'string', 'binary='=>'bool'], 'hash_init' => ['HashContext', 'algo'=>'string', 'flags='=>'int', 'key='=>'string', 'options='=>'array{seed:scalar}'], 'hash_pbkdf2' => ['non-empty-string', 'algo'=>'string', 'password'=>'string', 'salt'=>'string', 'iterations'=>'int', 'length='=>'int', 'binary='=>'bool'], 'hash_update' => ['bool', 'context'=>'HashContext', 'data'=>'string'], @@ -5297,7 +5297,7 @@ 'ifxus_tell_slob' => ['int', 'bid'=>'int'], 'ifxus_write_slob' => ['int', 'bid'=>'int', 'content'=>'string'], 'igbinary_serialize' => ['string|false', 'value'=>'mixed'], -'igbinary_unserialize' => ['mixed', 'string'=>'string'], +'igbinary_unserialize' => ['mixed', 'str'=>'string'], 'ignore_user_abort' => ['int', 'enable='=>'?bool'], 'iis_add_server' => ['int', 'path'=>'string', 'comment'=>'string', 'server_ip'=>'string', 'port'=>'int', 'host_name'=>'string', 'rights'=>'int', 'start_server'=>'int'], 'iis_get_dir_security' => ['int', 'server_instance'=>'int', 'virtual_path'=>'string'], @@ -5375,7 +5375,7 @@ 'imagefilledpolygon' => ['bool', 'image'=>'GdImage', 'points'=>'array', 'num_points_or_color'=>'int', 'color'=>'int'], 'imagefilledrectangle' => ['bool', 'image'=>'GdImage', 'x1'=>'int', 'y1'=>'int', 'x2'=>'int', 'y2'=>'int', 'color'=>'int'], 'imagefilltoborder' => ['bool', 'image'=>'GdImage', 'x'=>'int', 'y'=>'int', 'border_color'=>'int', 'color'=>'int'], -'imagefilter' => ['bool', 'image'=>'GdImage', 'filter'=>'int', 'args='=>'int', 'arg2='=>'int', 'arg3='=>'int', 'arg4='=>'int'], +'imagefilter' => ['bool', 'image'=>'GdImage', 'filter'=>'int', '...args='=>'array|int|float|bool'], 'imageflip' => ['bool', 'image'=>'GdImage', 'mode'=>'int'], 'imagefontheight' => ['int', 'font'=>'int'], 'imagefontwidth' => ['int', 'font'=>'int'], @@ -5405,12 +5405,12 @@ 'imagepolygon' => ['bool', 'image'=>'GdImage', 'points'=>'array', 'num_points_or_color'=>'int', 'color'=>'int'], 'imagerectangle' => ['bool', 'image'=>'GdImage', 'x1'=>'int', 'y1'=>'int', 'x2'=>'int', 'y2'=>'int', 'color'=>'int'], 'imageresolution' => ['array|bool', 'image'=>'GdImage', 'resolution_x='=>'?int', 'resolution_y='=>'?int'], -'imagerotate' => ['false|GdImage', 'image'=>'GdImage', 'angle'=>'float', 'background_color'=>'int', 'ignore_transparent='=>'int'], +'imagerotate' => ['false|GdImage', 'image'=>'GdImage', 'angle'=>'float', 'background_color'=>'int', 'ignore_transparent='=>'bool'], 'imagesavealpha' => ['bool', 'image'=>'GdImage', 'enable'=>'bool'], 'imagescale' => ['false|GdImage', 'image'=>'GdImage', 'width'=>'int', 'height='=>'int', 'mode='=>'int'], 'imagesetbrush' => ['bool', 'image'=>'GdImage', 'brush'=>'GdImage'], 'imagesetclip' => ['bool', 'image'=>'GdImage', 'x1'=>'int', 'x2'=>'int', 'y1'=>'int', 'y2'=>'int'], -'imagesetinterpolation' => ['bool', 'image'=>'GdImage', 'method'=>'int'], +'imagesetinterpolation' => ['bool', 'image'=>'GdImage', 'method='=>'int'], 'imagesetpixel' => ['bool', 'image'=>'GdImage', 'x'=>'int', 'y'=>'int', 'color'=>'int'], 'imagesetstyle' => ['bool', 'image'=>'GdImage', 'style'=>'non-empty-array'], 'imagesetthickness' => ['bool', 'image'=>'GdImage', 'thickness'=>'int'], @@ -5420,12 +5420,12 @@ 'imagesx' => ['int', 'image'=>'GdImage'], 'imagesy' => ['int', 'image'=>'GdImage'], 'imagetruecolortopalette' => ['bool', 'image'=>'GdImage', 'dither'=>'bool', 'num_colors'=>'int'], -'imagettfbbox' => ['false|array', 'size'=>'float', 'angle'=>'float', 'font_filename'=>'string', 'string'=>'string'], -'imagettftext' => ['false|array', 'image'=>'GdImage', 'size'=>'float', 'angle'=>'float', 'x'=>'int', 'y'=>'int', 'color'=>'int', 'font_filename'=>'string', 'text'=>'string'], +'imagettfbbox' => ['false|array', 'size'=>'float', 'angle'=>'float', 'font_filename'=>'string', 'string'=>'string', 'options='=>'array'], +'imagettftext' => ['false|array', 'image'=>'GdImage', 'size'=>'float', 'angle'=>'float', 'x'=>'int', 'y'=>'int', 'color'=>'int', 'font_filename'=>'string', 'text'=>'string', 'options='=>'array'], 'imagetypes' => ['int'], 'imagewbmp' => ['bool', 'image'=>'GdImage', 'file='=>'string|resource|null', 'foreground_color='=>'?int'], 'imagewebp' => ['bool', 'image'=>'GdImage', 'file='=>'string|resource|null', 'quality='=>'int'], -'imagexbm' => ['bool', 'image'=>'GdImage', 'filename='=>'?string', 'foreground_color='=>'int'], +'imagexbm' => ['bool', 'image'=>'GdImage', 'filename'=>'?string', 'foreground_color='=>'?int'], 'Imagick::__construct' => ['void', 'files='=>'string|string[]'], 'Imagick::__toString' => ['string'], 'Imagick::adaptiveBlurImage' => ['bool', 'radius'=>'float', 'sigma'=>'float', 'channel='=>'int'], @@ -6032,7 +6032,7 @@ 'imap_mutf7_to_utf8' => ['string|false', 'string'=>'string'], 'imap_num_msg' => ['int|false', 'imap'=>'IMAP\Connection'], 'imap_num_recent' => ['int', 'imap'=>'IMAP\Connection'], -'imap_open' => ['IMAP\Connection|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options='=>'?array'], +'imap_open' => ['IMAP\Connection|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options='=>'array'], 'imap_ping' => ['bool', 'imap'=>'IMAP\Connection'], 'imap_qprint' => ['string|false', 'string'=>'string'], 'imap_rename' => ['bool', 'imap'=>'IMAP\Connection', 'from'=>'string', 'to'=>'string'], @@ -6040,7 +6040,7 @@ 'imap_reopen' => ['bool', 'imap'=>'IMAP\Connection', 'mailbox'=>'string', 'flags='=>'int', 'retries='=>'int'], 'imap_rfc822_parse_adrlist' => ['array', 'string'=>'string', 'default_hostname'=>'string'], 'imap_rfc822_parse_headers' => ['stdClass', 'headers'=>'string', 'default_hostname='=>'string'], -'imap_rfc822_write_address' => ['string|false', 'mailbox'=>'?string', 'hostname'=>'?string', 'personal'=>'?string'], +'imap_rfc822_write_address' => ['string|false', 'mailbox'=>'string', 'hostname'=>'string', 'personal'=>'string'], 'imap_savebody' => ['bool', 'imap'=>'IMAP\Connection', 'file'=>'string|resource', 'message_num'=>'int', 'section='=>'string', 'flags='=>'int'], 'imap_scan' => ['array|false', 'imap'=>'IMAP\Connection', 'reference'=>'string', 'pattern'=>'string', 'content'=>'string'], 'imap_scanmailbox' => ['array|false', 'imap'=>'IMAP\Connection', 'reference'=>'string', 'pattern'=>'string', 'content'=>'string'], @@ -6048,7 +6048,7 @@ 'imap_set_quota' => ['bool', 'imap'=>'IMAP\Connection', 'quota_root'=>'string', 'mailbox_size'=>'int'], 'imap_setacl' => ['bool', 'imap'=>'IMAP\Connection', 'mailbox'=>'string', 'user_id'=>'string', 'rights'=>'string'], 'imap_setflag_full' => ['bool', 'imap'=>'IMAP\Connection', 'sequence'=>'string', 'flag'=>'string', 'options='=>'int'], -'imap_sort' => ['array|false', 'imap'=>'IMAP\Connection', 'criteria'=>'int', 'reverse'=>'int', 'flags='=>'int', 'search_criteria='=>'string', 'charset='=>'string'], +'imap_sort' => ['array|false', 'imap'=>'IMAP\Connection', 'criteria'=>'int', 'reverse'=>'bool', 'flags='=>'int', 'search_criteria='=>'?string', 'charset='=>'?string'], 'imap_status' => ['stdClass|false', 'imap'=>'IMAP\Connection', 'mailbox'=>'string', 'flags'=>'int'], 'imap_subscribe' => ['bool', 'imap'=>'IMAP\Connection', 'mailbox'=>'string'], 'imap_thread' => ['array|false', 'imap'=>'IMAP\Connection', 'flags='=>'int'], @@ -6074,9 +6074,9 @@ 'InfiniteIterator::next' => ['void'], 'InfiniteIterator::rewind' => ['void'], 'InfiniteIterator::valid' => ['bool'], -'inflate_add' => ['string|false', 'context'=>'resource', 'data'=>'string', 'flush_mode='=>'int'], -'inflate_get_read_len' => ['int|false', 'context'=>'resource'], -'inflate_get_status' => ['int|false', 'context'=>'resource'], +'inflate_add' => ['string|false', 'context'=>'InflateContext', 'data'=>'string', 'flush_mode='=>'int'], +'inflate_get_read_len' => ['int', 'context'=>'InflateContext'], +'inflate_get_status' => ['int', 'context'=>'InflateContext'], 'inflate_init' => ['InflateContext|false', 'encoding'=>'int', 'options='=>'array'], 'ingres_autocommit' => ['bool', 'link'=>'resource'], 'ingres_autocommit_state' => ['bool', 'link'=>'resource'], @@ -6918,7 +6918,7 @@ 'LogicException::getPrevious' => ['?Throwable'], 'LogicException::getTrace' => ['list\',args?:array}>'], 'LogicException::getTraceAsString' => ['string'], -'long2ip' => ['string', 'ip'=>'string|int'], +'long2ip' => ['string', 'ip'=>'int'], 'lstat' => ['array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int, 6: int, 7: int, 8: int, 9: int, 10: int, 11: int, 12: int, dev: int, ino: int, mode: int, nlink: int, uid: int, gid: int, rdev: int, size: int, atime: int, mtime: int, ctime: int, blksize: int, blocks: int}|false', 'filename'=>'string'], 'ltrim' => ['string', 'string'=>'string', 'characters='=>'string'], 'Lua::__call' => ['mixed', 'lua_func'=>'callable', 'args='=>'array', 'use_self='=>'int'], @@ -6973,7 +6973,7 @@ 'm_verifyconnection' => ['bool', 'conn'=>'resource', 'tf'=>'int'], 'm_verifysslcert' => ['bool', 'conn'=>'resource', 'tf'=>'int'], 'magic_quotes_runtime' => ['bool', 'new_setting'=>'bool'], -'mail' => ['bool', 'to'=>'string', 'subject'=>'string', 'message'=>'string', 'additional_headers='=>'string|array|null', 'additional_params='=>'string'], +'mail' => ['bool', 'to'=>'string', 'subject'=>'string', 'message'=>'string', 'additional_headers='=>'string|array', 'additional_params='=>'string'], 'mailparse_determine_best_xfer_encoding' => ['string', 'fp'=>'resource'], 'mailparse_msg_create' => ['resource'], 'mailparse_msg_extract_part' => ['void', 'mimemail'=>'resource', 'msgbody'=>'string', 'callbackfunc='=>'callable'], diff --git a/dictionaries/CallMap_80_delta.php b/dictionaries/CallMap_80_delta.php index 645e8f75f69..10ddcd25d4c 100644 --- a/dictionaries/CallMap_80_delta.php +++ b/dictionaries/CallMap_80_delta.php @@ -394,12 +394,12 @@ 'new' => ['int', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], ], 'bcdiv' => [ - 'old' => ['numeric-string', 'dividend'=>'numeric-string', 'divisor'=>'numeric-string', 'scale='=>'int'], - 'new' => ['numeric-string', 'dividend'=>'numeric-string', 'divisor'=>'numeric-string', 'scale='=>'int|null'], + 'old' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], + 'new' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], ], 'bcmod' => [ - 'old' => ['numeric-string', 'dividend'=>'numeric-string', 'divisor'=>'numeric-string', 'scale='=>'int'], - 'new' => ['numeric-string', 'dividend'=>'numeric-string', 'divisor'=>'numeric-string', 'scale='=>'int|null'], + 'old' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], + 'new' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'], ], 'bcmul' => [ 'old' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], @@ -410,8 +410,8 @@ 'new' => ['numeric-string', 'num'=>'numeric-string', 'exponent'=>'numeric-string', 'scale='=>'int|null'], ], 'bcpowmod' => [ - 'old' => ['numeric-string|false', 'base'=>'numeric-string', 'exponent'=>'numeric-string', 'modulus'=>'numeric-string', 'scale='=>'int'], - 'new' => ['numeric-string|false', 'base'=>'numeric-string', 'exponent'=>'numeric-string', 'modulus'=>'numeric-string', 'scale='=>'int|null'], + 'old' => ['numeric-string|false', 'num'=>'numeric-string', 'exponent'=>'numeric-string', 'modulus'=>'numeric-string', 'scale='=>'int'], + 'new' => ['numeric-string', 'num'=>'numeric-string', 'exponent'=>'numeric-string', 'modulus'=>'numeric-string', 'scale='=>'int|null'], ], 'bcscale' => [ 'old' => ['int', 'scale='=>'int'], @@ -433,6 +433,10 @@ 'old' => ['string', 'domain'=>'string', 'directory'=>'string'], 'new' => ['string', 'domain'=>'string', 'directory'=>'?string'], ], + 'bzdecompress' => [ + 'old' => ['string|int|false', 'data'=>'string', 'use_less_memory='=>'int'], + 'new' => ['string|int|false', 'data'=>'string', 'use_less_memory='=>'bool'], + ], 'bzwrite' => [ 'old' => ['int|false', 'bz'=>'resource', 'data'=>'string', 'length='=>'int'], 'new' => ['int|false', 'bz'=>'resource', 'data'=>'string', 'length='=>'?int'], @@ -457,6 +461,10 @@ 'old' => ['string|false', 'input'=>'string', 'mode='=>'3|4'], 'new' => ['string', 'input'=>'string', 'mode='=>'3|4'], ], + 'crypt' => [ + 'old' => ['string', 'string'=>'string', 'salt='=>'string'], + 'new' => ['string', 'string'=>'string', 'salt'=>'string'], + ], 'curl_close' => [ 'old' => ['void', 'ch'=>'resource'], 'new' => ['void', 'handle'=>'CurlHandle'], @@ -649,10 +657,90 @@ 'old' => ['int', 'year='=>'int', 'mode='=>'int'], 'new' => ['int', 'year='=>'?int', 'mode='=>'int'], ], + 'enchant_broker_describe' => [ + 'old' => ['array|false', 'broker'=>'resource'], + 'new' => ['array', 'broker'=>'EnchantBroker'], + ], + 'enchant_broker_dict_exists' => [ + 'old' => ['bool', 'broker'=>'resource', 'tag'=>'string'], + 'new' => ['bool', 'broker'=>'EnchantBroker', 'tag'=>'string'], + ], + 'enchant_broker_free' => [ + 'old' => ['bool', 'broker'=>'resource'], + 'new' => ['bool', 'broker'=>'EnchantBroker'], + ], + 'enchant_broker_free_dict' => [ + 'old' => ['bool', 'dictionary'=>'resource'], + 'new' => ['bool', 'dictionary'=>'EnchantBroker'], + ], + 'enchant_broker_get_dict_path' => [ + 'old' => ['string', 'broker'=>'resource', 'type'=>'int'], + 'new' => ['string', 'broker'=>'EnchantBroker', 'type'=>'int'], + ], + 'enchant_broker_get_error' => [ + 'old' => ['string|false', 'broker'=>'resource'], + 'new' => ['string|false', 'broker'=>'EnchantBroker'], + ], 'enchant_broker_init' => [ 'old' => ['resource|false'], 'new' => ['EnchantBroker|false'], ], + 'enchant_broker_list_dicts' => [ + 'old' => ['array|false', 'broker'=>'resource'], + 'new' => ['array', 'broker'=>'EnchantBroker'], + ], + 'enchant_broker_request_dict' => [ + 'old' => ['resource|false', 'broker'=>'resource', 'tag'=>'string'], + 'new' => ['EnchantDictionary|false', 'broker'=>'EnchantBroker', 'tag'=>'string'], + ], + 'enchant_broker_request_pwl_dict' => [ + 'old' => ['resource|false', 'broker'=>'resource', 'filename'=>'string'], + 'new' => ['EnchantDictionary|false', 'broker'=>'EnchantBroker', 'filename'=>'string'], + ], + 'enchant_broker_set_dict_path' => [ + 'old' => ['bool', 'broker'=>'resource', 'type'=>'int', 'path'=>'string'], + 'new' => ['bool', 'broker'=>'EnchantBroker', 'type'=>'int', 'path'=>'string'], + ], + 'enchant_broker_set_ordering' => [ + 'old' => ['bool', 'broker'=>'resource', 'tag'=>'string', 'ordering'=>'string'], + 'new' => ['bool', 'broker'=>'EnchantBroker', 'tag'=>'string', 'ordering'=>'string'], + ], + 'enchant_dict_add_to_personal' => [ + 'old' => ['void', 'dictionary'=>'resource', 'word'=>'string'], + 'new' => ['void', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], + ], + 'enchant_dict_add_to_session' => [ + 'old' => ['void', 'dictionary'=>'resource', 'word'=>'string'], + 'new' => ['void', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], + ], + 'enchant_dict_check' => [ + 'old' => ['bool', 'dictionary'=>'resource', 'word'=>'string'], + 'new' => ['bool', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], + ], + 'enchant_dict_describe' => [ + 'old' => ['array', 'dictionary'=>'resource'], + 'new' => ['array', 'dictionary'=>'EnchantDictionary'], + ], + 'enchant_dict_get_error' => [ + 'old' => ['string', 'dictionary'=>'resource'], + 'new' => ['string', 'dictionary'=>'EnchantDictionary'], + ], + 'enchant_dict_is_in_session' => [ + 'old' => ['bool', 'dictionary'=>'resource', 'word'=>'string'], + 'new' => ['bool', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], + ], + 'enchant_dict_quick_check' => [ + 'old' => ['bool', 'dictionary'=>'resource', 'word'=>'string', '&w_suggestions='=>'array'], + 'new' => ['bool', 'dictionary'=>'EnchantDictionary', 'word'=>'string', '&w_suggestions='=>'array'], + ], + 'enchant_dict_store_replacement' => [ + 'old' => ['void', 'dictionary'=>'resource', 'misspelled'=>'string', 'correct'=>'string'], + 'new' => ['void', 'dictionary'=>'EnchantDictionary', 'misspelled'=>'string', 'correct'=>'string'], + ], + 'enchant_dict_suggest' => [ + 'old' => ['array', 'dictionary'=>'resource', 'word'=>'string'], + 'new' => ['array', 'dictionary'=>'EnchantDictionary', 'word'=>'string'], + ], 'error_log' => [ 'old' => ['bool', 'message'=>'string', 'message_type='=>'int', 'destination='=>'string', 'additional_headers='=>'string'], 'new' => ['bool', 'message'=>'string', 'message_type='=>'int', 'destination='=>'?string', 'additional_headers='=>'?string'], @@ -761,6 +849,10 @@ 'old' => ['non-empty-string|false', 'algo'=>'string', 'data'=>'string', 'key'=>'string', 'binary='=>'bool'], 'new' => ['non-empty-string', 'algo'=>'string', 'data'=>'string', 'key'=>'string', 'binary='=>'bool'], ], + 'hash_hmac_file' => [ + 'old' => ['non-empty-string|false', 'algo'=>'string', 'data'=>'string', 'key'=>'string', 'binary='=>'bool'], + 'new' => ['non-empty-string', 'algo'=>'string', 'filename'=>'string', 'key'=>'string', 'binary='=>'bool'], + ], 'hash_init' => [ 'old' => ['HashContext|false', 'algo'=>'string', 'flags='=>'int', 'key='=>'string'], 'new' => ['HashContext', 'algo'=>'string', 'flags='=>'int', 'key='=>'string'], @@ -1034,8 +1126,8 @@ 'new' => ['bool', 'image'=>'GdImage', 'x'=>'int', 'y'=>'int', 'border_color'=>'int', 'color'=>'int'], ], 'imagefilter' => [ - 'old' => ['bool', 'image'=>'resource', 'filter'=>'int', 'args='=>'int', 'arg2='=>'int', 'arg3='=>'int', 'arg4='=>'int'], - 'new' => ['bool', 'image'=>'GdImage', 'filter'=>'int', 'args='=>'int', 'arg2='=>'int', 'arg3='=>'int', 'arg4='=>'int'], + 'old' => ['bool', 'image'=>'resource', 'filter'=>'int', '...args='=>'array|int|float|bool'], + 'new' => ['bool', 'image'=>'GdImage', 'filter'=>'int', '...args='=>'array|int|float|bool'], ], 'imageflip' => [ 'old' => ['bool', 'image'=>'resource', 'mode'=>'int'], @@ -1123,7 +1215,7 @@ ], 'imagerotate' => [ 'old' => ['resource|false', 'src_im'=>'resource', 'angle'=>'float', 'bgdcolor'=>'int', 'ignoretransparent='=>'int'], - 'new' => ['false|GdImage', 'image'=>'GdImage', 'angle'=>'float', 'background_color'=>'int', 'ignore_transparent='=>'int'], + 'new' => ['false|GdImage', 'image'=>'GdImage', 'angle'=>'float', 'background_color'=>'int', 'ignore_transparent='=>'bool'], ], 'imagesavealpha' => [ 'old' => ['bool', 'image'=>'resource', 'enable'=>'bool'], @@ -1142,8 +1234,8 @@ 'new' => ['bool', 'image'=>'GdImage', 'x1'=>'int', 'x2'=>'int', 'y1'=>'int', 'y2'=>'int'], ], 'imagesetinterpolation' => [ - 'old' => ['bool', 'image'=>'resource', 'method'=>'int'], - 'new' => ['bool', 'image'=>'GdImage', 'method'=>'int'], + 'old' => ['bool', 'image'=>'resource', 'method='=>'int'], + 'new' => ['bool', 'image'=>'GdImage', 'method='=>'int'], ], 'imagesetpixel' => [ 'old' => ['bool', 'image'=>'resource', 'x'=>'int', 'y'=>'int', 'color'=>'int'], @@ -1181,9 +1273,13 @@ 'old' => ['bool', 'image'=>'resource', 'dither'=>'bool', 'num_colors'=>'int'], 'new' => ['bool', 'image'=>'GdImage', 'dither'=>'bool', 'num_colors'=>'int'], ], + 'imagettfbbox' => [ + 'old' => ['false|array', 'size'=>'float', 'angle'=>'float', 'font_filename'=>'string', 'string'=>'string'], + 'new' => ['false|array', 'size'=>'float', 'angle'=>'float', 'font_filename'=>'string', 'string'=>'string', 'options='=>'array'], + ], 'imagettftext' => [ 'old' => ['false|array', 'image'=>'resource', 'size'=>'float', 'angle'=>'float', 'x'=>'int', 'y'=>'int', 'color'=>'int', 'font_filename'=>'string', 'text'=>'string'], - 'new' => ['false|array', 'image'=>'GdImage', 'size'=>'float', 'angle'=>'float', 'x'=>'int', 'y'=>'int', 'color'=>'int', 'font_filename'=>'string', 'text'=>'string'], + 'new' => ['false|array', 'image'=>'GdImage', 'size'=>'float', 'angle'=>'float', 'x'=>'int', 'y'=>'int', 'color'=>'int', 'font_filename'=>'string', 'text'=>'string', 'options='=>'array'], ], 'imagewbmp' => [ 'old' => ['bool', 'image'=>'resource', 'file='=>'string|resource|null', 'foreground_color='=>'int'], @@ -1194,8 +1290,8 @@ 'new' => ['bool', 'image'=>'GdImage', 'file='=>'string|resource|null', 'quality='=>'int'], ], 'imagexbm' => [ - 'old' => ['bool', 'image'=>'resource', 'filename='=>'?string', 'foreground_color='=>'int'], - 'new' => ['bool', 'image'=>'GdImage', 'filename='=>'?string', 'foreground_color='=>'int'], + 'old' => ['bool', 'image'=>'resource', 'filename'=>'?string', 'foreground_color='=>'int'], + 'new' => ['bool', 'image'=>'GdImage', 'filename'=>'?string', 'foreground_color='=>'?int'], ], 'imap_append' => [ 'old' => ['bool', 'imap'=>'resource', 'folder'=>'string', 'message'=>'string', 'options='=>'string', 'internal_date='=>'string'], @@ -1209,6 +1305,22 @@ 'old' => ['bool', 'to'=>'string', 'subject'=>'string', 'message'=>'string', 'additional_headers='=>'string', 'cc='=>'string', 'bcc='=>'string', 'return_path='=>'string'], 'new' => ['bool', 'to'=>'string', 'subject'=>'string', 'message'=>'string', 'additional_headers='=>'?string', 'cc='=>'?string', 'bcc='=>'?string', 'return_path='=>'?string'], ], + 'imap_sort' => [ + 'old' => ['array|false', 'imap'=>'resource', 'criteria'=>'int', 'reverse'=>'int', 'flags='=>'int', 'search_criteria='=>'string', 'charset='=>'string'], + 'new' => ['array|false', 'imap'=>'resource', 'criteria'=>'int', 'reverse'=>'bool', 'flags='=>'int', 'search_criteria='=>'?string', 'charset='=>'?string'], + ], + 'inflate_add' => [ + 'old' => ['string|false', 'context'=>'resource', 'data'=>'string', 'flush_mode='=>'int'], + 'new' => ['string|false', 'context'=>'InflateContext', 'data'=>'string', 'flush_mode='=>'int'], + ], + 'inflate_get_read_len' => [ + 'old' => ['int', 'context'=>'resource'], + 'new' => ['int', 'context'=>'InflateContext'], + ], + 'inflate_get_status' => [ + 'old' => ['int', 'context'=>'resource'], + 'new' => ['int', 'context'=>'InflateContext'], + ], 'inflate_init' => [ 'old' => ['resource|false', 'encoding'=>'int', 'options='=>'array'], 'new' => ['InflateContext|false', 'encoding'=>'int', 'options='=>'array'], diff --git a/dictionaries/CallMap_81_delta.php b/dictionaries/CallMap_81_delta.php index 455c4ed5b12..15de17d3a3c 100644 --- a/dictionaries/CallMap_81_delta.php +++ b/dictionaries/CallMap_81_delta.php @@ -395,8 +395,8 @@ 'new' => ['int', 'imap'=>'IMAP\Connection'], ], 'imap_open' => [ - 'old' => ['resource|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options='=>'?array'], - 'new' => ['IMAP\Connection|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options='=>'?array'], + 'old' => ['resource|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options='=>'array'], + 'new' => ['IMAP\Connection|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options='=>'array'], ], 'imap_ping' => [ 'old' => ['bool', 'imap'=>'resource'], @@ -443,8 +443,8 @@ 'new' => ['bool', 'imap'=>'IMAP\Connection', 'sequence'=>'string', 'flag'=>'string', 'options='=>'int'], ], 'imap_sort' => [ - 'old' => ['array|false', 'imap'=>'resource', 'criteria'=>'int', 'reverse'=>'int', 'flags='=>'int', 'search_criteria='=>'string', 'charset='=>'string'], - 'new' => ['array|false', 'imap'=>'IMAP\Connection', 'criteria'=>'int', 'reverse'=>'int', 'flags='=>'int', 'search_criteria='=>'string', 'charset='=>'string'], + 'old' => ['array|false', 'imap'=>'resource', 'criteria'=>'int', 'reverse'=>'bool', 'flags='=>'int', 'search_criteria='=>'?string', 'charset='=>'?string'], + 'new' => ['array|false', 'imap'=>'IMAP\Connection', 'criteria'=>'int', 'reverse'=>'bool', 'flags='=>'int', 'search_criteria='=>'?string', 'charset='=>'?string'], ], 'imap_status' => [ 'old' => ['stdClass|false', 'imap'=>'resource', 'mailbox'=>'string', 'flags'=>'int'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 57e9e528b86..bf20cc65dff 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -9651,8 +9651,8 @@ 'bbcode_set_flags' => ['bool', 'bbcode_container'=>'resource', 'flags'=>'int', 'mode='=>'int'], 'bcadd' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], 'bccomp' => ['int', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], - 'bcdiv' => ['numeric-string', 'dividend'=>'numeric-string', 'divisor'=>'numeric-string', 'scale='=>'int'], - 'bcmod' => ['numeric-string', 'dividend'=>'numeric-string', 'divisor'=>'numeric-string', 'scale='=>'int'], + 'bcdiv' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], + 'bcmod' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], 'bcmul' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], 'bcompiler_load' => ['bool', 'filename'=>'string'], 'bcompiler_load_exe' => ['bool', 'filename'=>'string'], @@ -9668,7 +9668,7 @@ 'bcompiler_write_header' => ['bool', 'filehandle'=>'resource', 'write_ver='=>'string'], 'bcompiler_write_included_filename' => ['bool', 'filehandle'=>'resource', 'filename'=>'string'], 'bcpow' => ['numeric-string', 'num'=>'numeric-string', 'exponent'=>'numeric-string', 'scale='=>'int'], - 'bcpowmod' => ['numeric-string|false', 'base'=>'numeric-string', 'exponent'=>'numeric-string', 'modulus'=>'numeric-string', 'scale='=>'int'], + 'bcpowmod' => ['numeric-string|false', 'num'=>'numeric-string', 'exponent'=>'numeric-string', 'modulus'=>'numeric-string', 'scale='=>'int'], 'bcscale' => ['int', 'scale'=>'int'], 'bcsqrt' => ['numeric-string', 'num'=>'numeric-string', 'scale='=>'int'], 'bcsub' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'], @@ -9694,7 +9694,7 @@ 'bson_encode' => ['string', 'anything'=>'mixed'], 'bzclose' => ['bool', 'bz'=>'resource'], 'bzcompress' => ['string|int', 'data'=>'string', 'block_size='=>'int', 'work_factor='=>'int'], - 'bzdecompress' => ['string|int', 'data'=>'string', 'use_less_memory='=>'int'], + 'bzdecompress' => ['string|int|false', 'data'=>'string', 'use_less_memory='=>'int'], 'bzerrno' => ['int', 'bz'=>'resource'], 'bzerror' => ['array', 'bz'=>'resource'], 'bzerrstr' => ['string', 'bz'=>'resource'], @@ -10403,7 +10403,7 @@ 'deaggregate' => ['', 'object'=>'object', 'class_name='=>'string'], 'debug_backtrace' => ['list', 'options='=>'int', 'limit='=>'int'], 'debug_print_backtrace' => ['void', 'options='=>'int', 'limit='=>'int'], - 'debug_zval_dump' => ['void', '...value'=>'mixed'], + 'debug_zval_dump' => ['void', 'value'=>'mixed', '...values='=>'mixed'], 'debugger_connect' => [''], 'debugger_connector_pid' => [''], 'debugger_get_server_start_time' => [''], @@ -10437,7 +10437,7 @@ 'dl' => ['bool', 'extension_filename'=>'string'], 'dngettext' => ['string', 'domain'=>'string', 'singular'=>'string', 'plural'=>'string', 'count'=>'int'], 'dns_check_record' => ['bool', 'hostname'=>'string', 'type='=>'string'], - 'dns_get_mx' => ['bool', 'hostname'=>'string', '&w_hosts'=>'array', '&w_weights'=>'array'], + 'dns_get_mx' => ['bool', 'hostname'=>'string', '&w_hosts'=>'array', '&w_weights='=>'array'], 'dns_get_record' => ['list|false', 'hostname'=>'string', 'type='=>'int', '&w_authoritative_name_servers='=>'array', '&w_additional_records='=>'array', 'raw='=>'bool'], 'dom_document_relaxNG_validate_file' => ['bool', 'filename'=>'string'], 'dom_document_relaxNG_validate_xml' => ['bool', 'source'=>'string'], @@ -10524,7 +10524,7 @@ 'eio_utime' => ['resource', 'path'=>'string', 'atime'=>'float', 'mtime'=>'float', 'pri='=>'int', 'callback='=>'callable', 'data='=>'mixed'], 'eio_write' => ['resource', 'fd'=>'mixed', 'string'=>'string', 'length='=>'int', 'offset='=>'int', 'pri='=>'int', 'callback='=>'callable', 'data='=>'mixed'], 'empty' => ['bool', 'value'=>'mixed'], - 'enchant_broker_describe' => ['array', 'broker'=>'resource'], + 'enchant_broker_describe' => ['array|false', 'broker'=>'resource'], 'enchant_broker_dict_exists' => ['bool', 'broker'=>'resource', 'tag'=>'string'], 'enchant_broker_free' => ['bool', 'broker'=>'resource'], 'enchant_broker_free_dict' => ['bool', 'dictionary'=>'resource'], @@ -11168,10 +11168,10 @@ 'gmp_abs' => ['GMP', 'num'=>'GMP|string|int'], 'gmp_add' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int'], 'gmp_and' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int'], - 'gmp_clrbit' => ['void', 'num'=>'GMP|string|int', 'index'=>'int'], + 'gmp_clrbit' => ['void', 'num'=>'GMP', 'index'=>'int'], 'gmp_cmp' => ['int', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int'], 'gmp_com' => ['GMP', 'num'=>'GMP|string|int'], - 'gmp_div' => ['GMP', 'num1'=>'GMP|resource|string', 'num2'=>'GMP|resource|string', 'rounding_mode='=>'int'], + 'gmp_div' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int', 'rounding_mode='=>'int'], 'gmp_div_q' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int', 'rounding_mode='=>'int'], 'gmp_div_qr' => ['array{0: GMP, 1: GMP}', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int', 'rounding_mode='=>'int'], 'gmp_div_r' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int', 'rounding_mode='=>'int'], @@ -11205,7 +11205,7 @@ 'gmp_rootrem' => ['array{0: GMP, 1: GMP}', 'num'=>'GMP|string|int', 'nth'=>'int'], 'gmp_scan0' => ['int', 'num1'=>'GMP|string|int', 'start'=>'int'], 'gmp_scan1' => ['int', 'num1'=>'GMP|string|int', 'start'=>'int'], - 'gmp_setbit' => ['void', 'num'=>'GMP|string|int', 'index'=>'int', 'value='=>'bool'], + 'gmp_setbit' => ['void', 'num'=>'GMP', 'index'=>'int', 'value='=>'bool'], 'gmp_sign' => ['int', 'num'=>'GMP|string|int'], 'gmp_sqrt' => ['GMP', 'num'=>'GMP|string|int'], 'gmp_sqrtrem' => ['array{0: GMP, 1: GMP}', 'num'=>'GMP|string|int'], @@ -12060,7 +12060,7 @@ 'ifxus_tell_slob' => ['int', 'bid'=>'int'], 'ifxus_write_slob' => ['int', 'bid'=>'int', 'content'=>'string'], 'igbinary_serialize' => ['string|false', 'value'=>'mixed'], - 'igbinary_unserialize' => ['mixed', 'string'=>'string'], + 'igbinary_unserialize' => ['mixed', 'str'=>'string'], 'ignore_user_abort' => ['int', 'enable='=>'bool'], 'iis_add_server' => ['int', 'path'=>'string', 'comment'=>'string', 'server_ip'=>'string', 'port'=>'int', 'host_name'=>'string', 'rights'=>'int', 'start_server'=>'int'], 'iis_get_dir_security' => ['int', 'server_instance'=>'int', 'virtual_path'=>'string'], @@ -12138,7 +12138,7 @@ 'imagefilledpolygon' => ['bool', 'image'=>'resource', 'points'=>'array', 'num_points_or_color'=>'int', 'color'=>'int'], 'imagefilledrectangle' => ['bool', 'image'=>'resource', 'x1'=>'int', 'y1'=>'int', 'x2'=>'int', 'y2'=>'int', 'color'=>'int'], 'imagefilltoborder' => ['bool', 'image'=>'resource', 'x'=>'int', 'y'=>'int', 'border_color'=>'int', 'color'=>'int'], - 'imagefilter' => ['bool', 'image'=>'resource', 'filter'=>'int', 'args='=>'int', 'arg2='=>'int', 'arg3='=>'int', 'arg4='=>'int'], + 'imagefilter' => ['bool', 'image'=>'resource', 'filter'=>'int', '...args='=>'array|int|float|bool'], 'imageflip' => ['bool', 'image'=>'resource', 'mode'=>'int'], 'imagefontheight' => ['int', 'font'=>'int'], 'imagefontwidth' => ['int', 'font'=>'int'], @@ -12166,7 +12166,7 @@ 'imagesavealpha' => ['bool', 'image'=>'resource', 'enable'=>'bool'], 'imagescale' => ['resource|false', 'im'=>'resource', 'new_width'=>'int', 'new_height='=>'int', 'method='=>'int'], 'imagesetbrush' => ['bool', 'image'=>'resource', 'brush'=>'resource'], - 'imagesetinterpolation' => ['bool', 'image'=>'resource', 'method'=>'int'], + 'imagesetinterpolation' => ['bool', 'image'=>'resource', 'method='=>'int'], 'imagesetpixel' => ['bool', 'image'=>'resource', 'x'=>'int', 'y'=>'int', 'color'=>'int'], 'imagesetstyle' => ['bool', 'image'=>'resource', 'style'=>'non-empty-array'], 'imagesetthickness' => ['bool', 'image'=>'resource', 'thickness'=>'int'], @@ -12181,7 +12181,7 @@ 'imagetypes' => ['int'], 'imagewbmp' => ['bool', 'image'=>'resource', 'file='=>'string|resource|null', 'foreground_color='=>'int'], 'imagewebp' => ['bool', 'image'=>'resource', 'file='=>'string|resource|null', 'quality='=>'int'], - 'imagexbm' => ['bool', 'image'=>'resource', 'filename='=>'?string', 'foreground_color='=>'int'], + 'imagexbm' => ['bool', 'image'=>'resource', 'filename'=>'?string', 'foreground_color='=>'int'], 'imap_8bit' => ['string|false', 'string'=>'string'], 'imap_alerts' => ['array|false'], 'imap_append' => ['bool', 'imap'=>'resource', 'folder'=>'string', 'message'=>'string', 'options='=>'string', 'internal_date='=>'string'], @@ -12229,7 +12229,7 @@ 'imap_mutf7_to_utf8' => ['string|false', 'string'=>'string'], 'imap_num_msg' => ['int|false', 'imap'=>'resource'], 'imap_num_recent' => ['int', 'imap'=>'resource'], - 'imap_open' => ['resource|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options='=>'?array'], + 'imap_open' => ['resource|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options='=>'array'], 'imap_ping' => ['bool', 'imap'=>'resource'], 'imap_qprint' => ['string|false', 'string'=>'string'], 'imap_rename' => ['bool', 'imap'=>'resource', 'from'=>'string', 'to'=>'string'], @@ -12237,7 +12237,7 @@ 'imap_reopen' => ['bool', 'imap'=>'resource', 'mailbox'=>'string', 'flags='=>'int', 'retries='=>'int'], 'imap_rfc822_parse_adrlist' => ['array', 'string'=>'string', 'default_hostname'=>'string'], 'imap_rfc822_parse_headers' => ['stdClass', 'headers'=>'string', 'default_hostname='=>'string'], - 'imap_rfc822_write_address' => ['string|false', 'mailbox'=>'?string', 'hostname'=>'?string', 'personal'=>'?string'], + 'imap_rfc822_write_address' => ['string|false', 'mailbox'=>'string', 'hostname'=>'string', 'personal'=>'string'], 'imap_savebody' => ['bool', 'imap'=>'resource', 'file'=>'string|resource', 'message_num'=>'int', 'section='=>'string', 'flags='=>'int'], 'imap_scan' => ['array|false', 'imap'=>'resource', 'reference'=>'string', 'pattern'=>'string', 'content'=>'string'], 'imap_scanmailbox' => ['array|false', 'imap'=>'resource', 'reference'=>'string', 'pattern'=>'string', 'content'=>'string'], @@ -12265,8 +12265,8 @@ 'inet_ntop' => ['string|false', 'ip'=>'string'], 'inet_pton' => ['string|false', 'ip'=>'string'], 'inflate_add' => ['string|false', 'context'=>'resource', 'data'=>'string', 'flush_mode='=>'int'], - 'inflate_get_read_len' => ['int|false', 'context'=>'resource'], - 'inflate_get_status' => ['int|false', 'context'=>'resource'], + 'inflate_get_read_len' => ['int', 'context'=>'resource'], + 'inflate_get_status' => ['int', 'context'=>'resource'], 'inflate_init' => ['resource|false', 'encoding'=>'int', 'options='=>'array'], 'ingres_autocommit' => ['bool', 'link'=>'resource'], 'ingres_autocommit_state' => ['bool', 'link'=>'resource'], @@ -12630,7 +12630,7 @@ 'log' => ['float', 'num'=>'float', 'base='=>'float'], 'log10' => ['float', 'num'=>'float'], 'log1p' => ['float', 'num'=>'float'], - 'long2ip' => ['string', 'ip'=>'string|int'], + 'long2ip' => ['string', 'ip'=>'int'], 'lstat' => ['array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int, 6: int, 7: int, 8: int, 9: int, 10: int, 11: int, 12: int, dev: int, ino: int, mode: int, nlink: int, uid: int, gid: int, rdev: int, size: int, atime: int, mtime: int, ctime: int, blksize: int, blocks: int}|false', 'filename'=>'string'], 'ltrim' => ['string', 'string'=>'string', 'characters='=>'string'], 'lzf_compress' => ['string', 'data'=>'string'], @@ -12676,7 +12676,7 @@ 'm_verifyconnection' => ['bool', 'conn'=>'resource', 'tf'=>'int'], 'm_verifysslcert' => ['bool', 'conn'=>'resource', 'tf'=>'int'], 'magic_quotes_runtime' => ['bool', 'new_setting'=>'bool'], - 'mail' => ['bool', 'to'=>'string', 'subject'=>'string', 'message'=>'string', 'additional_headers='=>'string|array|null', 'additional_params='=>'string'], + 'mail' => ['bool', 'to'=>'string', 'subject'=>'string', 'message'=>'string', 'additional_headers='=>'string|array', 'additional_params='=>'string'], 'mailparse_determine_best_xfer_encoding' => ['string', 'fp'=>'resource'], 'mailparse_msg_create' => ['resource'], 'mailparse_msg_extract_part' => ['void', 'mimemail'=>'resource', 'msgbody'=>'string', 'callbackfunc='=>'callable'], diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 6368f5ccffb..f714bb13a4d 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -78,10 +78,6 @@ class InternalCallMapHandlerTest extends TestCase 'arrayobject::uasort', 'arrayobject::uksort', 'arrayobject::unserialize', - 'bcdiv', - 'bcmod', - 'bcpowmod', - 'bzdecompress', 'cachingiterator::offsetexists', 'cachingiterator::offsetget', 'cachingiterator::offsetset', @@ -96,7 +92,6 @@ class InternalCallMapHandlerTest extends TestCase 'collator::setattribute', 'collator::sort', 'collator::sortwithsortkeys', - 'crypt', 'curlfile::__construct', 'curlfile::setmimetype', 'curlfile::setpostfilename', @@ -111,7 +106,6 @@ class InternalCallMapHandlerTest extends TestCase 'datetime::settime', 'datetime::settimestamp', 'datetimezone::gettransitions', - 'debug_zval_dump', 'directoryiterator::__construct', 'directoryiterator::getfileinfo', 'directoryiterator::getpathinfo', @@ -119,7 +113,6 @@ class InternalCallMapHandlerTest extends TestCase 'directoryiterator::seek', 'directoryiterator::setfileclass', 'directoryiterator::setinfoclass', - 'dns_get_mx', 'domattr::insertbefore', 'domattr::isdefaultnamespace', 'domattr::issamenode', @@ -176,26 +169,6 @@ class InternalCallMapHandlerTest extends TestCase 'domxpath::registernamespace', 'domxpath::registerphpfunctions', 'easter_date', - 'enchant_broker_describe', - 'enchant_broker_dict_exists', - 'enchant_broker_free', - 'enchant_broker_free_dict', - 'enchant_broker_get_dict_path', - 'enchant_broker_get_error', - 'enchant_broker_list_dicts', - 'enchant_broker_request_dict', - 'enchant_broker_request_pwl_dict', - 'enchant_broker_set_dict_path', - 'enchant_broker_set_ordering', - 'enchant_dict_add_to_personal', - 'enchant_dict_add_to_session', - 'enchant_dict_check', - 'enchant_dict_describe', - 'enchant_dict_get_error', - 'enchant_dict_is_in_session', - 'enchant_dict_quick_check', - 'enchant_dict_store_replacement', - 'enchant_dict_suggest', 'fiber::start', 'filesystemiterator::__construct', 'filesystemiterator::getfileinfo', @@ -218,9 +191,6 @@ class InternalCallMapHandlerTest extends TestCase 'globiterator::setfileclass', 'globiterator::setflags', 'globiterator::setinfoclass', - 'gmp_clrbit', - 'gmp_div', - 'gmp_setbit', 'gnupg::adddecryptkey', 'gnupg::addencryptkey', 'gnupg::addsignkey', @@ -255,26 +225,11 @@ class InternalCallMapHandlerTest extends TestCase 'gnupg_setsignmode', 'gnupg_sign', 'gnupg_verify', - 'hash_hmac_file', - 'igbinary_unserialize', 'imagefilledpolygon', - 'imagefilter', 'imagegd', 'imagegd2', 'imageopenpolygon', 'imagepolygon', - 'imagerotate', - 'imagesetinterpolation', - 'imagettfbbox', - 'imagettftext', - 'imagexbm', - 'imap_open', - 'imap_rfc822_write_address', - 'imap_sort', - 'inflate_add', - 'inflate_get_read_len', - 'inflate_get_status', - 'inotify_rm_watch', 'intlbreakiterator::getlocale', 'intlbreakiterator::getpartsiterator', 'intlcal_from_date_time', @@ -416,10 +371,8 @@ class InternalCallMapHandlerTest extends TestCase 'locale::getdisplayregion', 'locale::getdisplayscript', 'locale::getdisplayvariant', - 'long2ip', 'lzf_compress', 'lzf_decompress', - 'mail', 'mailparse_msg_extract_part', 'mailparse_msg_extract_part_file', 'mailparse_msg_extract_whole_part_file', From 528ac003cef51f39a5de920eae667f671e46ef10 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sat, 11 Feb 2023 07:02:05 -0400 Subject: [PATCH 047/109] Do not try tweaking JIT if it's not available --- src/Psalm/Internal/Fork/PsalmRestarter.php | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index f91c3e2b727..1be0dbc6ae9 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -14,6 +14,8 @@ use function ini_get; use function preg_replace; +use const PHP_VERSION_ID; + /** * @internal */ @@ -44,16 +46,19 @@ protected function requiresRestart($default): bool static fn(string $extension): bool => extension_loaded($extension) ); - if (!in_array(ini_get('opcache.enable_cli'), ['1', 'true', true, 1])) { - return true; - } + if (PHP_VERSION_ID >= 8_00_00 && (extension_loaded('opcache') || extension_loaded('Zend OPcache'))) { + // restart to enable JIT if it's not configured in the optimal way + if (!in_array(ini_get('opcache.enable_cli'), ['1', 'true', true, 1])) { + return true; + } - if (((int) ini_get('opcache.jit')) !== 1205) { - return true; - } + if (((int) ini_get('opcache.jit')) !== 1205) { + return true; + } - if (((int) ini_get('opcache.jit')) === 0) { - return true; + if (((int) ini_get('opcache.jit')) === 0) { + return true; + } } return $default || $this->required; @@ -80,7 +85,8 @@ protected function restart(array $command): void // executed in the parent process (before restart) // if it wasn't loaded then we apparently don't have opcache installed and there's no point trying // to tweak it - if (extension_loaded('opcache') || extension_loaded('Zend OPcache')) { + // If we're running on 7.4 there's no JIT available + if (PHP_VERSION_ID >= 8_00_00 && (extension_loaded('opcache') || extension_loaded('Zend OPcache'))) { $additional_options = [ '-dopcache.enable_cli=true', '-dopcache.jit_buffer_size=512M', From 8bbef2758788dd0c44f6d8b3ab47396f06ec8082 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Sat, 11 Feb 2023 17:47:09 -0600 Subject: [PATCH 048/109] Drop removed xsl callmap functions --- dictionaries/CallMap.php | 29 ----------------------------- dictionaries/CallMap_historical.php | 29 ----------------------------- 2 files changed, 58 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index 0bb3463af2c..15fd2107617 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -15714,35 +15714,6 @@ 'xpath_register_ns' => ['bool', 'xpath_context'=>'xpathcontext', 'prefix'=>'string', 'uri'=>'string'], 'xpath_register_ns_auto' => ['bool', 'xpath_context'=>'xpathcontext', 'context_node='=>'object'], 'xptr_new_context' => ['XPathContext'], -'xsl_xsltprocessor_get_parameter' => ['string', 'namespace'=>'string', 'name'=>'string'], -'xsl_xsltprocessor_get_security_prefs' => ['int'], -'xsl_xsltprocessor_has_exslt_support' => ['bool'], -'xsl_xsltprocessor_register_php_functions' => ['', 'restrict'=>''], -'xsl_xsltprocessor_remove_parameter' => ['bool', 'namespace'=>'string', 'name'=>'string'], -'xsl_xsltprocessor_set_parameter' => ['bool', 'namespace'=>'string', 'name'=>'', 'value'=>'string'], -'xsl_xsltprocessor_set_profiling' => ['bool', 'filename'=>'string'], -'xsl_xsltprocessor_set_security_prefs' => ['int', 'securityprefs'=>'int'], -'xsl_xsltprocessor_transform_to_uri' => ['int', 'doc'=>'DOMDocument', 'uri'=>'string'], -'xsl_xsltprocessor_transform_to_xml' => ['string', 'doc'=>'DOMDocument'], -'xslt_backend_info' => ['string'], -'xslt_backend_name' => ['string'], -'xslt_backend_version' => ['string'], -'xslt_create' => ['resource'], -'xslt_errno' => ['int', 'xh'=>''], -'xslt_error' => ['string', 'xh'=>''], -'xslt_free' => ['', 'xh'=>''], -'xslt_getopt' => ['int', 'processor'=>''], -'xslt_process' => ['', 'xh'=>'', 'xmlcontainer'=>'string', 'xslcontainer'=>'string', 'resultcontainer='=>'string', 'arguments='=>'array', 'parameters='=>'array'], -'xslt_set_base' => ['', 'xh'=>'', 'uri'=>'string'], -'xslt_set_encoding' => ['', 'xh'=>'', 'encoding'=>'string'], -'xslt_set_error_handler' => ['', 'xh'=>'', 'handler'=>''], -'xslt_set_log' => ['', 'xh'=>'', 'log='=>''], -'xslt_set_object' => ['bool', 'processor'=>'', 'object'=>'object'], -'xslt_set_sax_handler' => ['', 'xh'=>'', 'handlers'=>'array'], -'xslt_set_sax_handlers' => ['', 'processor'=>'', 'handlers'=>'array'], -'xslt_set_scheme_handler' => ['', 'xh'=>'', 'handlers'=>'array'], -'xslt_set_scheme_handlers' => ['', 'xh'=>'', 'handlers'=>'array'], -'xslt_setopt' => ['', 'processor'=>'', 'newmask'=>'int'], 'XSLTProcessor::getParameter' => ['string|false', 'namespace'=>'string', 'name'=>'string'], 'XsltProcessor::getSecurityPrefs' => ['int'], 'XSLTProcessor::hasExsltSupport' => ['bool'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index e1373810d5a..39b2a257e27 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -16461,35 +16461,6 @@ 'xpath_register_ns' => ['bool', 'xpath_context'=>'xpathcontext', 'prefix'=>'string', 'uri'=>'string'], 'xpath_register_ns_auto' => ['bool', 'xpath_context'=>'xpathcontext', 'context_node='=>'object'], 'xptr_new_context' => ['XPathContext'], - 'xsl_xsltprocessor_get_parameter' => ['string', 'namespace'=>'string', 'name'=>'string'], - 'xsl_xsltprocessor_get_security_prefs' => ['int'], - 'xsl_xsltprocessor_has_exslt_support' => ['bool'], - 'xsl_xsltprocessor_register_php_functions' => ['', 'restrict'=>''], - 'xsl_xsltprocessor_remove_parameter' => ['bool', 'namespace'=>'string', 'name'=>'string'], - 'xsl_xsltprocessor_set_parameter' => ['bool', 'namespace'=>'string', 'name'=>'', 'value'=>'string'], - 'xsl_xsltprocessor_set_profiling' => ['bool', 'filename'=>'string'], - 'xsl_xsltprocessor_set_security_prefs' => ['int', 'securityprefs'=>'int'], - 'xsl_xsltprocessor_transform_to_uri' => ['int', 'doc'=>'DOMDocument', 'uri'=>'string'], - 'xsl_xsltprocessor_transform_to_xml' => ['string', 'doc'=>'DOMDocument'], - 'xslt_backend_info' => ['string'], - 'xslt_backend_name' => ['string'], - 'xslt_backend_version' => ['string'], - 'xslt_create' => ['resource'], - 'xslt_errno' => ['int', 'xh'=>''], - 'xslt_error' => ['string', 'xh'=>''], - 'xslt_free' => ['', 'xh'=>''], - 'xslt_getopt' => ['int', 'processor'=>''], - 'xslt_process' => ['', 'xh'=>'', 'xmlcontainer'=>'string', 'xslcontainer'=>'string', 'resultcontainer='=>'string', 'arguments='=>'array', 'parameters='=>'array'], - 'xslt_set_base' => ['', 'xh'=>'', 'uri'=>'string'], - 'xslt_set_encoding' => ['', 'xh'=>'', 'encoding'=>'string'], - 'xslt_set_error_handler' => ['', 'xh'=>'', 'handler'=>''], - 'xslt_set_log' => ['', 'xh'=>'', 'log='=>''], - 'xslt_set_object' => ['bool', 'processor'=>'', 'object'=>'object'], - 'xslt_set_sax_handler' => ['', 'xh'=>'', 'handlers'=>'array'], - 'xslt_set_sax_handlers' => ['', 'processor'=>'', 'handlers'=>'array'], - 'xslt_set_scheme_handler' => ['', 'xh'=>'', 'handlers'=>'array'], - 'xslt_set_scheme_handlers' => ['', 'xh'=>'', 'handlers'=>'array'], - 'xslt_setopt' => ['', 'processor'=>'', 'newmask'=>'int'], 'yac::__construct' => ['void', 'prefix='=>'string'], 'yac::__get' => ['mixed', 'key'=>'string'], 'yac::__set' => ['mixed', 'key'=>'string', 'value'=>'mixed'], From c48c0c5c853996cbd36453c2c154dc25e3b16fe3 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Sat, 11 Feb 2023 18:01:55 -0600 Subject: [PATCH 049/109] Drop abandoned maxdb callmap functions --- dictionaries/CallMap.php | 165 ---------------------------- dictionaries/CallMap_historical.php | 165 ---------------------------- 2 files changed, 330 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index 0bb3463af2c..309ff27e0ae 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -7021,171 +7021,6 @@ 'mapObj::zoomScale' => ['int', 'nScaleDenom'=>'float', 'oPixelPos'=>'pointObj', 'nImageWidth'=>'int', 'nImageHeight'=>'int', 'oGeorefExt'=>'rectObj', 'oMaxGeorefExt'=>'rectObj'], 'max' => ['mixed', 'value'=>'non-empty-array'], 'max\'1' => ['mixed', 'value'=>'', 'values'=>'', '...args='=>''], -'maxdb::__construct' => ['void', 'host='=>'string', 'username='=>'string', 'passwd='=>'string', 'dbname='=>'string', 'port='=>'int', 'socket='=>'string'], -'maxdb::affected_rows' => ['int', 'link'=>''], -'maxdb::auto_commit' => ['bool', 'link'=>'', 'mode'=>'bool'], -'maxdb::change_user' => ['bool', 'link'=>'', 'user'=>'string', 'password'=>'string', 'database'=>'string'], -'maxdb::character_set_name' => ['string', 'link'=>''], -'maxdb::close' => ['bool', 'link'=>''], -'maxdb::commit' => ['bool', 'link'=>''], -'maxdb::disable_reads_from_master' => ['', 'link'=>''], -'maxdb::errno' => ['int', 'link'=>''], -'maxdb::error' => ['string', 'link'=>''], -'maxdb::field_count' => ['int', 'link'=>''], -'maxdb::get_host_info' => ['string', 'link'=>''], -'maxdb::info' => ['string', 'link'=>''], -'maxdb::insert_id' => ['', 'link'=>''], -'maxdb::kill' => ['bool', 'link'=>'', 'processid'=>'int'], -'maxdb::more_results' => ['bool', 'link'=>''], -'maxdb::multi_query' => ['bool', 'link'=>'', 'query'=>'string'], -'maxdb::next_result' => ['bool', 'link'=>''], -'maxdb::num_rows' => ['int', 'result'=>''], -'maxdb::options' => ['bool', 'link'=>'', 'option'=>'int', 'value'=>''], -'maxdb::ping' => ['bool', 'link'=>''], -'maxdb::prepare' => ['maxdb_stmt', 'link'=>'', 'query'=>'string'], -'maxdb::protocol_version' => ['string', 'link'=>''], -'maxdb::query' => ['', 'link'=>'', 'query'=>'string', 'resultmode='=>'int'], -'maxdb::real_connect' => ['bool', 'link'=>'', 'hostname='=>'string', 'username='=>'string', 'passwd='=>'string', 'dbname='=>'string', 'port='=>'int', 'socket='=>'string'], -'maxdb::real_escape_string' => ['string', 'link'=>'', 'escapestr'=>'string'], -'maxdb::real_query' => ['bool', 'link'=>'', 'query'=>'string'], -'maxdb::rollback' => ['bool', 'link'=>''], -'maxdb::rpl_query_type' => ['int', 'link'=>''], -'maxdb::select_db' => ['bool', 'link'=>'', 'dbname'=>'string'], -'maxdb::send_query' => ['bool', 'link'=>'', 'query'=>'string'], -'maxdb::server_info' => ['string', 'link'=>''], -'maxdb::server_version' => ['int', 'link'=>''], -'maxdb::sqlstate' => ['string', 'link'=>''], -'maxdb::ssl_set' => ['bool', 'link'=>'', 'key'=>'string', 'cert'=>'string', 'ca'=>'string', 'capath'=>'string', 'cipher'=>'string'], -'maxdb::stat' => ['string', 'link'=>''], -'maxdb::stmt_init' => ['object', 'link'=>''], -'maxdb::store_result' => ['bool', 'link'=>''], -'maxdb::thread_id' => ['int', 'link'=>''], -'maxdb::use_result' => ['resource', 'link'=>''], -'maxdb::warning_count' => ['int', 'link'=>''], -'maxdb_affected_rows' => ['int', 'link'=>'resource'], -'maxdb_autocommit' => ['bool', 'link'=>'', 'mode'=>'bool'], -'maxdb_change_user' => ['bool', 'link'=>'', 'user'=>'string', 'password'=>'string', 'database'=>'string'], -'maxdb_character_set_name' => ['string', 'link'=>''], -'maxdb_close' => ['bool', 'link'=>''], -'maxdb_commit' => ['bool', 'link'=>''], -'maxdb_connect' => ['resource', 'host='=>'string', 'username='=>'string', 'passwd='=>'string', 'dbname='=>'string', 'port='=>'int', 'socket='=>'string'], -'maxdb_connect_errno' => ['int'], -'maxdb_connect_error' => ['string'], -'maxdb_data_seek' => ['bool', 'result'=>'', 'offset'=>'int'], -'maxdb_debug' => ['void', 'debug'=>'string'], -'maxdb_disable_reads_from_master' => ['', 'link'=>''], -'maxdb_disable_rpl_parse' => ['bool', 'link'=>'resource'], -'maxdb_dump_debug_info' => ['bool', 'link'=>'resource'], -'maxdb_embedded_connect' => ['resource', 'dbname='=>'string'], -'maxdb_enable_reads_from_master' => ['bool', 'link'=>'resource'], -'maxdb_enable_rpl_parse' => ['bool', 'link'=>'resource'], -'maxdb_errno' => ['int', 'link'=>'resource'], -'maxdb_error' => ['string', 'link'=>'resource'], -'maxdb_fetch_array' => ['', 'result'=>'', 'resulttype='=>'int'], -'maxdb_fetch_assoc' => ['array', 'result'=>''], -'maxdb_fetch_field' => ['', 'result'=>''], -'maxdb_fetch_field_direct' => ['', 'result'=>'', 'fieldnr'=>'int'], -'maxdb_fetch_fields' => ['', 'result'=>''], -'maxdb_fetch_lengths' => ['array', 'result'=>'resource'], -'maxdb_fetch_object' => ['object', 'result'=>'object'], -'maxdb_fetch_row' => ['', 'result'=>''], -'maxdb_field_count' => ['int', 'link'=>''], -'maxdb_field_seek' => ['bool', 'result'=>'', 'fieldnr'=>'int'], -'maxdb_field_tell' => ['int', 'result'=>'resource'], -'maxdb_free_result' => ['', 'result'=>''], -'maxdb_get_client_info' => ['string'], -'maxdb_get_client_version' => ['int'], -'maxdb_get_host_info' => ['string', 'link'=>'resource'], -'maxdb_get_proto_info' => ['string', 'link'=>'resource'], -'maxdb_get_server_info' => ['string', 'link'=>'resource'], -'maxdb_get_server_version' => ['int', 'link'=>'resource'], -'maxdb_info' => ['string', 'link'=>'resource'], -'maxdb_init' => ['resource'], -'maxdb_insert_id' => ['mixed', 'link'=>'resource'], -'maxdb_kill' => ['bool', 'link'=>'', 'processid'=>'int'], -'maxdb_master_query' => ['bool', 'link'=>'resource', 'query'=>'string'], -'maxdb_more_results' => ['bool', 'link'=>'resource'], -'maxdb_multi_query' => ['bool', 'link'=>'', 'query'=>'string'], -'maxdb_next_result' => ['bool', 'link'=>'resource'], -'maxdb_num_fields' => ['int', 'result'=>'resource'], -'maxdb_num_rows' => ['int', 'result'=>'resource'], -'maxdb_options' => ['bool', 'link'=>'', 'option'=>'int', 'value'=>''], -'maxdb_ping' => ['bool', 'link'=>''], -'maxdb_prepare' => ['maxdb_stmt', 'link'=>'', 'query'=>'string'], -'maxdb_query' => ['', 'link'=>'', 'query'=>'string', 'resultmode='=>'int'], -'maxdb_real_connect' => ['bool', 'link'=>'', 'hostname='=>'string', 'username='=>'string', 'passwd='=>'string', 'dbname='=>'string', 'port='=>'int', 'socket='=>'string'], -'maxdb_real_escape_string' => ['string', 'link'=>'', 'escapestr'=>'string'], -'maxdb_real_query' => ['bool', 'link'=>'', 'query'=>'string'], -'maxdb_report' => ['bool', 'flags'=>'int'], -'maxdb_result::current_field' => ['int', 'result'=>''], -'maxdb_result::data_seek' => ['bool', 'result'=>'', 'offset'=>'int'], -'maxdb_result::fetch_array' => ['', 'result'=>'', 'resulttype='=>'int'], -'maxdb_result::fetch_assoc' => ['array', 'result'=>''], -'maxdb_result::fetch_field' => ['', 'result'=>''], -'maxdb_result::fetch_field_direct' => ['', 'result'=>'', 'fieldnr'=>'int'], -'maxdb_result::fetch_fields' => ['', 'result'=>''], -'maxdb_result::fetch_object' => ['object', 'result'=>'object'], -'maxdb_result::fetch_row' => ['', 'result'=>''], -'maxdb_result::field_count' => ['int', 'result'=>''], -'maxdb_result::field_seek' => ['bool', 'result'=>'', 'fieldnr'=>'int'], -'maxdb_result::free' => ['', 'result'=>''], -'maxdb_result::lengths' => ['array', 'result'=>''], -'maxdb_rollback' => ['bool', 'link'=>''], -'maxdb_rpl_parse_enabled' => ['int', 'link'=>'resource'], -'maxdb_rpl_probe' => ['bool', 'link'=>'resource'], -'maxdb_rpl_query_type' => ['int', 'link'=>''], -'maxdb_select_db' => ['bool', 'link'=>'resource', 'dbname'=>'string'], -'maxdb_send_query' => ['bool', 'link'=>'', 'query'=>'string'], -'maxdb_server_end' => ['void'], -'maxdb_server_init' => ['bool', 'server='=>'array', 'groups='=>'array'], -'maxdb_sqlstate' => ['string', 'link'=>'resource'], -'maxdb_ssl_set' => ['bool', 'link'=>'', 'key'=>'string', 'cert'=>'string', 'ca'=>'string', 'capath'=>'string', 'cipher'=>'string'], -'maxdb_stat' => ['string', 'link'=>''], -'maxdb_stmt::affected_rows' => ['int', 'stmt'=>''], -'maxdb_stmt::bind_param' => ['bool', 'stmt'=>'', 'types'=>'string', '&...rw_var'=>''], -'maxdb_stmt::bind_param\'1' => ['bool', 'stmt'=>'', 'types'=>'string', '&rw_var'=>'array'], -'maxdb_stmt::bind_result' => ['bool', 'stmt'=>'', '&w_var1'=>'', '&...w_vars='=>''], -'maxdb_stmt::close' => ['bool', 'stmt'=>''], -'maxdb_stmt::close_long_data' => ['bool', 'stmt'=>'', 'param_nr'=>'int'], -'maxdb_stmt::data_seek' => ['bool', 'statement'=>'', 'offset'=>'int'], -'maxdb_stmt::errno' => ['int', 'stmt'=>''], -'maxdb_stmt::error' => ['string', 'stmt'=>''], -'maxdb_stmt::execute' => ['bool', 'stmt'=>''], -'maxdb_stmt::fetch' => ['bool', 'stmt'=>''], -'maxdb_stmt::free_result' => ['', 'stmt'=>''], -'maxdb_stmt::num_rows' => ['int', 'stmt'=>''], -'maxdb_stmt::param_count' => ['int', 'stmt'=>''], -'maxdb_stmt::prepare' => ['', 'stmt'=>'', 'query'=>'string'], -'maxdb_stmt::reset' => ['bool', 'stmt'=>''], -'maxdb_stmt::result_metadata' => ['resource', 'stmt'=>''], -'maxdb_stmt::send_long_data' => ['bool', 'stmt'=>'', 'param_nr'=>'int', 'data'=>'string'], -'maxdb_stmt::stmt_send_long_data' => ['bool', 'param_nr'=>'int', 'data'=>'string'], -'maxdb_stmt::store_result' => ['bool'], -'maxdb_stmt_affected_rows' => ['int', 'stmt'=>'resource'], -'maxdb_stmt_bind_param' => ['bool', 'stmt'=>'', 'types'=>'string', 'var1'=>'', '...args='=>'', 'var='=>'array'], -'maxdb_stmt_bind_result' => ['bool', 'stmt'=>'', '&w_var1'=>'', '&...w_vars='=>''], -'maxdb_stmt_close' => ['bool', 'stmt'=>''], -'maxdb_stmt_close_long_data' => ['bool', 'stmt'=>'', 'param_nr'=>'int'], -'maxdb_stmt_data_seek' => ['bool', 'statement'=>'', 'offset'=>'int'], -'maxdb_stmt_errno' => ['int', 'stmt'=>'resource'], -'maxdb_stmt_error' => ['string', 'stmt'=>'resource'], -'maxdb_stmt_execute' => ['bool', 'stmt'=>''], -'maxdb_stmt_fetch' => ['bool', 'stmt'=>''], -'maxdb_stmt_free_result' => ['', 'stmt'=>''], -'maxdb_stmt_init' => ['object', 'link'=>''], -'maxdb_stmt_num_rows' => ['int', 'stmt'=>'resource'], -'maxdb_stmt_param_count' => ['int', 'stmt'=>'resource'], -'maxdb_stmt_prepare' => ['', 'stmt'=>'', 'query'=>'string'], -'maxdb_stmt_reset' => ['bool', 'stmt'=>''], -'maxdb_stmt_result_metadata' => ['resource', 'stmt'=>''], -'maxdb_stmt_send_long_data' => ['bool', 'stmt'=>'', 'param_nr'=>'int', 'data'=>'string'], -'maxdb_stmt_sqlstate' => ['string', 'stmt'=>'resource'], -'maxdb_stmt_store_result' => ['bool', 'stmt'=>''], -'maxdb_store_result' => ['bool', 'link'=>''], -'maxdb_thread_id' => ['int', 'link'=>'resource'], -'maxdb_thread_safe' => ['bool'], -'maxdb_use_result' => ['resource', 'link'=>''], -'maxdb_warning_count' => ['int', 'link'=>'resource'], 'mb_check_encoding' => ['bool', 'value='=>'array|string|null', 'encoding='=>'string|null'], 'mb_chr' => ['non-empty-string|false', 'codepoint'=>'int', 'encoding='=>'string|null'], 'mb_convert_case' => ['string', 'string'=>'string', 'mode'=>'int', 'encoding='=>'string|null'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index e1373810d5a..7d93ce09a29 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -12724,171 +12724,6 @@ 'mapObj::zoomScale' => ['int', 'nScaleDenom'=>'float', 'oPixelPos'=>'pointObj', 'nImageWidth'=>'int', 'nImageHeight'=>'int', 'oGeorefExt'=>'rectObj', 'oMaxGeorefExt'=>'rectObj'], 'max' => ['mixed', 'value'=>'non-empty-array'], 'max\'1' => ['mixed', 'value'=>'', 'values'=>'', '...args='=>''], - 'maxdb::__construct' => ['void', 'host='=>'string', 'username='=>'string', 'passwd='=>'string', 'dbname='=>'string', 'port='=>'int', 'socket='=>'string'], - 'maxdb::affected_rows' => ['int', 'link'=>''], - 'maxdb::auto_commit' => ['bool', 'link'=>'', 'mode'=>'bool'], - 'maxdb::change_user' => ['bool', 'link'=>'', 'user'=>'string', 'password'=>'string', 'database'=>'string'], - 'maxdb::character_set_name' => ['string', 'link'=>''], - 'maxdb::close' => ['bool', 'link'=>''], - 'maxdb::commit' => ['bool', 'link'=>''], - 'maxdb::disable_reads_from_master' => ['', 'link'=>''], - 'maxdb::errno' => ['int', 'link'=>''], - 'maxdb::error' => ['string', 'link'=>''], - 'maxdb::field_count' => ['int', 'link'=>''], - 'maxdb::get_host_info' => ['string', 'link'=>''], - 'maxdb::info' => ['string', 'link'=>''], - 'maxdb::insert_id' => ['', 'link'=>''], - 'maxdb::kill' => ['bool', 'link'=>'', 'processid'=>'int'], - 'maxdb::more_results' => ['bool', 'link'=>''], - 'maxdb::multi_query' => ['bool', 'link'=>'', 'query'=>'string'], - 'maxdb::next_result' => ['bool', 'link'=>''], - 'maxdb::num_rows' => ['int', 'result'=>''], - 'maxdb::options' => ['bool', 'link'=>'', 'option'=>'int', 'value'=>''], - 'maxdb::ping' => ['bool', 'link'=>''], - 'maxdb::prepare' => ['maxdb_stmt', 'link'=>'', 'query'=>'string'], - 'maxdb::protocol_version' => ['string', 'link'=>''], - 'maxdb::query' => ['', 'link'=>'', 'query'=>'string', 'resultmode='=>'int'], - 'maxdb::real_connect' => ['bool', 'link'=>'', 'hostname='=>'string', 'username='=>'string', 'passwd='=>'string', 'dbname='=>'string', 'port='=>'int', 'socket='=>'string'], - 'maxdb::real_escape_string' => ['string', 'link'=>'', 'escapestr'=>'string'], - 'maxdb::real_query' => ['bool', 'link'=>'', 'query'=>'string'], - 'maxdb::rollback' => ['bool', 'link'=>''], - 'maxdb::rpl_query_type' => ['int', 'link'=>''], - 'maxdb::select_db' => ['bool', 'link'=>'', 'dbname'=>'string'], - 'maxdb::send_query' => ['bool', 'link'=>'', 'query'=>'string'], - 'maxdb::server_info' => ['string', 'link'=>''], - 'maxdb::server_version' => ['int', 'link'=>''], - 'maxdb::sqlstate' => ['string', 'link'=>''], - 'maxdb::ssl_set' => ['bool', 'link'=>'', 'key'=>'string', 'cert'=>'string', 'ca'=>'string', 'capath'=>'string', 'cipher'=>'string'], - 'maxdb::stat' => ['string', 'link'=>''], - 'maxdb::stmt_init' => ['object', 'link'=>''], - 'maxdb::store_result' => ['bool', 'link'=>''], - 'maxdb::thread_id' => ['int', 'link'=>''], - 'maxdb::use_result' => ['resource', 'link'=>''], - 'maxdb::warning_count' => ['int', 'link'=>''], - 'maxdb_affected_rows' => ['int', 'link'=>'resource'], - 'maxdb_autocommit' => ['bool', 'link'=>'', 'mode'=>'bool'], - 'maxdb_change_user' => ['bool', 'link'=>'', 'user'=>'string', 'password'=>'string', 'database'=>'string'], - 'maxdb_character_set_name' => ['string', 'link'=>''], - 'maxdb_close' => ['bool', 'link'=>''], - 'maxdb_commit' => ['bool', 'link'=>''], - 'maxdb_connect' => ['resource', 'host='=>'string', 'username='=>'string', 'passwd='=>'string', 'dbname='=>'string', 'port='=>'int', 'socket='=>'string'], - 'maxdb_connect_errno' => ['int'], - 'maxdb_connect_error' => ['string'], - 'maxdb_data_seek' => ['bool', 'result'=>'', 'offset'=>'int'], - 'maxdb_debug' => ['void', 'debug'=>'string'], - 'maxdb_disable_reads_from_master' => ['', 'link'=>''], - 'maxdb_disable_rpl_parse' => ['bool', 'link'=>'resource'], - 'maxdb_dump_debug_info' => ['bool', 'link'=>'resource'], - 'maxdb_embedded_connect' => ['resource', 'dbname='=>'string'], - 'maxdb_enable_reads_from_master' => ['bool', 'link'=>'resource'], - 'maxdb_enable_rpl_parse' => ['bool', 'link'=>'resource'], - 'maxdb_errno' => ['int', 'link'=>'resource'], - 'maxdb_error' => ['string', 'link'=>'resource'], - 'maxdb_fetch_array' => ['', 'result'=>'', 'resulttype='=>'int'], - 'maxdb_fetch_assoc' => ['array', 'result'=>''], - 'maxdb_fetch_field' => ['', 'result'=>''], - 'maxdb_fetch_field_direct' => ['', 'result'=>'', 'fieldnr'=>'int'], - 'maxdb_fetch_fields' => ['', 'result'=>''], - 'maxdb_fetch_lengths' => ['array', 'result'=>'resource'], - 'maxdb_fetch_object' => ['object', 'result'=>'object'], - 'maxdb_fetch_row' => ['', 'result'=>''], - 'maxdb_field_count' => ['int', 'link'=>''], - 'maxdb_field_seek' => ['bool', 'result'=>'', 'fieldnr'=>'int'], - 'maxdb_field_tell' => ['int', 'result'=>'resource'], - 'maxdb_free_result' => ['', 'result'=>''], - 'maxdb_get_client_info' => ['string'], - 'maxdb_get_client_version' => ['int'], - 'maxdb_get_host_info' => ['string', 'link'=>'resource'], - 'maxdb_get_proto_info' => ['string', 'link'=>'resource'], - 'maxdb_get_server_info' => ['string', 'link'=>'resource'], - 'maxdb_get_server_version' => ['int', 'link'=>'resource'], - 'maxdb_info' => ['string', 'link'=>'resource'], - 'maxdb_init' => ['resource'], - 'maxdb_insert_id' => ['mixed', 'link'=>'resource'], - 'maxdb_kill' => ['bool', 'link'=>'', 'processid'=>'int'], - 'maxdb_master_query' => ['bool', 'link'=>'resource', 'query'=>'string'], - 'maxdb_more_results' => ['bool', 'link'=>'resource'], - 'maxdb_multi_query' => ['bool', 'link'=>'', 'query'=>'string'], - 'maxdb_next_result' => ['bool', 'link'=>'resource'], - 'maxdb_num_fields' => ['int', 'result'=>'resource'], - 'maxdb_num_rows' => ['int', 'result'=>'resource'], - 'maxdb_options' => ['bool', 'link'=>'', 'option'=>'int', 'value'=>''], - 'maxdb_ping' => ['bool', 'link'=>''], - 'maxdb_prepare' => ['maxdb_stmt', 'link'=>'', 'query'=>'string'], - 'maxdb_query' => ['', 'link'=>'', 'query'=>'string', 'resultmode='=>'int'], - 'maxdb_real_connect' => ['bool', 'link'=>'', 'hostname='=>'string', 'username='=>'string', 'passwd='=>'string', 'dbname='=>'string', 'port='=>'int', 'socket='=>'string'], - 'maxdb_real_escape_string' => ['string', 'link'=>'', 'escapestr'=>'string'], - 'maxdb_real_query' => ['bool', 'link'=>'', 'query'=>'string'], - 'maxdb_report' => ['bool', 'flags'=>'int'], - 'maxdb_result::current_field' => ['int', 'result'=>''], - 'maxdb_result::data_seek' => ['bool', 'result'=>'', 'offset'=>'int'], - 'maxdb_result::fetch_array' => ['', 'result'=>'', 'resulttype='=>'int'], - 'maxdb_result::fetch_assoc' => ['array', 'result'=>''], - 'maxdb_result::fetch_field' => ['', 'result'=>''], - 'maxdb_result::fetch_field_direct' => ['', 'result'=>'', 'fieldnr'=>'int'], - 'maxdb_result::fetch_fields' => ['', 'result'=>''], - 'maxdb_result::fetch_object' => ['object', 'result'=>'object'], - 'maxdb_result::fetch_row' => ['', 'result'=>''], - 'maxdb_result::field_count' => ['int', 'result'=>''], - 'maxdb_result::field_seek' => ['bool', 'result'=>'', 'fieldnr'=>'int'], - 'maxdb_result::free' => ['', 'result'=>''], - 'maxdb_result::lengths' => ['array', 'result'=>''], - 'maxdb_rollback' => ['bool', 'link'=>''], - 'maxdb_rpl_parse_enabled' => ['int', 'link'=>'resource'], - 'maxdb_rpl_probe' => ['bool', 'link'=>'resource'], - 'maxdb_rpl_query_type' => ['int', 'link'=>''], - 'maxdb_select_db' => ['bool', 'link'=>'resource', 'dbname'=>'string'], - 'maxdb_send_query' => ['bool', 'link'=>'', 'query'=>'string'], - 'maxdb_server_end' => ['void'], - 'maxdb_server_init' => ['bool', 'server='=>'array', 'groups='=>'array'], - 'maxdb_sqlstate' => ['string', 'link'=>'resource'], - 'maxdb_ssl_set' => ['bool', 'link'=>'', 'key'=>'string', 'cert'=>'string', 'ca'=>'string', 'capath'=>'string', 'cipher'=>'string'], - 'maxdb_stat' => ['string', 'link'=>''], - 'maxdb_stmt::affected_rows' => ['int', 'stmt'=>''], - 'maxdb_stmt::bind_param' => ['bool', 'stmt'=>'', 'types'=>'string', '&...rw_var'=>''], - 'maxdb_stmt::bind_param\'1' => ['bool', 'stmt'=>'', 'types'=>'string', '&rw_var'=>'array'], - 'maxdb_stmt::bind_result' => ['bool', 'stmt'=>'', '&w_var1'=>'', '&...w_vars='=>''], - 'maxdb_stmt::close' => ['bool', 'stmt'=>''], - 'maxdb_stmt::close_long_data' => ['bool', 'stmt'=>'', 'param_nr'=>'int'], - 'maxdb_stmt::data_seek' => ['bool', 'statement'=>'', 'offset'=>'int'], - 'maxdb_stmt::errno' => ['int', 'stmt'=>''], - 'maxdb_stmt::error' => ['string', 'stmt'=>''], - 'maxdb_stmt::execute' => ['bool', 'stmt'=>''], - 'maxdb_stmt::fetch' => ['bool', 'stmt'=>''], - 'maxdb_stmt::free_result' => ['', 'stmt'=>''], - 'maxdb_stmt::num_rows' => ['int', 'stmt'=>''], - 'maxdb_stmt::param_count' => ['int', 'stmt'=>''], - 'maxdb_stmt::prepare' => ['', 'stmt'=>'', 'query'=>'string'], - 'maxdb_stmt::reset' => ['bool', 'stmt'=>''], - 'maxdb_stmt::result_metadata' => ['resource', 'stmt'=>''], - 'maxdb_stmt::send_long_data' => ['bool', 'stmt'=>'', 'param_nr'=>'int', 'data'=>'string'], - 'maxdb_stmt::stmt_send_long_data' => ['bool', 'param_nr'=>'int', 'data'=>'string'], - 'maxdb_stmt::store_result' => ['bool'], - 'maxdb_stmt_affected_rows' => ['int', 'stmt'=>'resource'], - 'maxdb_stmt_bind_param' => ['bool', 'stmt'=>'', 'types'=>'string', 'var1'=>'', '...args='=>'', 'var='=>'array'], - 'maxdb_stmt_bind_result' => ['bool', 'stmt'=>'', '&w_var1'=>'', '&...w_vars='=>''], - 'maxdb_stmt_close' => ['bool', 'stmt'=>''], - 'maxdb_stmt_close_long_data' => ['bool', 'stmt'=>'', 'param_nr'=>'int'], - 'maxdb_stmt_data_seek' => ['bool', 'statement'=>'', 'offset'=>'int'], - 'maxdb_stmt_errno' => ['int', 'stmt'=>'resource'], - 'maxdb_stmt_error' => ['string', 'stmt'=>'resource'], - 'maxdb_stmt_execute' => ['bool', 'stmt'=>''], - 'maxdb_stmt_fetch' => ['bool', 'stmt'=>''], - 'maxdb_stmt_free_result' => ['', 'stmt'=>''], - 'maxdb_stmt_init' => ['object', 'link'=>''], - 'maxdb_stmt_num_rows' => ['int', 'stmt'=>'resource'], - 'maxdb_stmt_param_count' => ['int', 'stmt'=>'resource'], - 'maxdb_stmt_prepare' => ['', 'stmt'=>'', 'query'=>'string'], - 'maxdb_stmt_reset' => ['bool', 'stmt'=>''], - 'maxdb_stmt_result_metadata' => ['resource', 'stmt'=>''], - 'maxdb_stmt_send_long_data' => ['bool', 'stmt'=>'', 'param_nr'=>'int', 'data'=>'string'], - 'maxdb_stmt_sqlstate' => ['string', 'stmt'=>'resource'], - 'maxdb_stmt_store_result' => ['bool', 'stmt'=>''], - 'maxdb_store_result' => ['bool', 'link'=>''], - 'maxdb_thread_id' => ['int', 'link'=>'resource'], - 'maxdb_thread_safe' => ['bool'], - 'maxdb_use_result' => ['resource', 'link'=>''], - 'maxdb_warning_count' => ['int', 'link'=>'resource'], 'mb_check_encoding' => ['bool', 'value='=>'string', 'encoding='=>'string'], 'mb_convert_case' => ['string', 'string'=>'string', 'mode'=>'int', 'encoding='=>'string'], 'mb_convert_encoding' => ['string|false', 'string'=>'string', 'to_encoding'=>'string', 'from_encoding='=>'mixed'], From ea8979ecd93411c857443000af7ff2f43049ebe5 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Sat, 11 Feb 2023 18:20:32 -0600 Subject: [PATCH 050/109] Drop abandoned newt callmap functions --- dictionaries/CallMap.php | 116 ---------------------------- dictionaries/CallMap_historical.php | 116 ---------------------------- 2 files changed, 232 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index 0bb3463af2c..b26b1cc9854 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -8858,122 +8858,6 @@ 'newrelic_set_appname' => ['bool', 'name'=>'string', 'license='=>'string', 'xmit='=>'bool'], 'newrelic_set_user_attributes' => ['bool', 'user'=>'string', 'account'=>'string', 'product'=>'string'], 'newrelic_start_transaction' => ['bool', 'appname'=>'string', 'license='=>'string'], -'newt_bell' => ['void'], -'newt_button' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string'], -'newt_button_bar' => ['resource', 'buttons'=>'array'], -'newt_centered_window' => ['int', 'width'=>'int', 'height'=>'int', 'title='=>'string'], -'newt_checkbox' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string', 'def_value'=>'string', 'seq='=>'string'], -'newt_checkbox_get_value' => ['string', 'checkbox'=>'resource'], -'newt_checkbox_set_flags' => ['void', 'checkbox'=>'resource', 'flags'=>'int', 'sense'=>'int'], -'newt_checkbox_set_value' => ['void', 'checkbox'=>'resource', 'value'=>'string'], -'newt_checkbox_tree' => ['resource', 'left'=>'int', 'top'=>'int', 'height'=>'int', 'flags='=>'int'], -'newt_checkbox_tree_add_item' => ['void', 'checkboxtree'=>'resource', 'text'=>'string', 'data'=>'mixed', 'flags'=>'int', 'index'=>'int', '...args='=>'int'], -'newt_checkbox_tree_find_item' => ['array', 'checkboxtree'=>'resource', 'data'=>'mixed'], -'newt_checkbox_tree_get_current' => ['mixed', 'checkboxtree'=>'resource'], -'newt_checkbox_tree_get_entry_value' => ['string', 'checkboxtree'=>'resource', 'data'=>'mixed'], -'newt_checkbox_tree_get_multi_selection' => ['array', 'checkboxtree'=>'resource', 'seqnum'=>'string'], -'newt_checkbox_tree_get_selection' => ['array', 'checkboxtree'=>'resource'], -'newt_checkbox_tree_multi' => ['resource', 'left'=>'int', 'top'=>'int', 'height'=>'int', 'seq'=>'string', 'flags='=>'int'], -'newt_checkbox_tree_set_current' => ['void', 'checkboxtree'=>'resource', 'data'=>'mixed'], -'newt_checkbox_tree_set_entry' => ['void', 'checkboxtree'=>'resource', 'data'=>'mixed', 'text'=>'string'], -'newt_checkbox_tree_set_entry_value' => ['void', 'checkboxtree'=>'resource', 'data'=>'mixed', 'value'=>'string'], -'newt_checkbox_tree_set_width' => ['void', 'checkbox_tree'=>'resource', 'width'=>'int'], -'newt_clear_key_buffer' => ['void'], -'newt_cls' => ['void'], -'newt_compact_button' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string'], -'newt_component_add_callback' => ['void', 'component'=>'resource', 'func_name'=>'mixed', 'data'=>'mixed'], -'newt_component_takes_focus' => ['void', 'component'=>'resource', 'takes_focus'=>'bool'], -'newt_create_grid' => ['resource', 'cols'=>'int', 'rows'=>'int'], -'newt_cursor_off' => ['void'], -'newt_cursor_on' => ['void'], -'newt_delay' => ['void', 'microseconds'=>'int'], -'newt_draw_form' => ['void', 'form'=>'resource'], -'newt_draw_root_text' => ['void', 'left'=>'int', 'top'=>'int', 'text'=>'string'], -'newt_entry' => ['resource', 'left'=>'int', 'top'=>'int', 'width'=>'int', 'init_value='=>'string', 'flags='=>'int'], -'newt_entry_get_value' => ['string', 'entry'=>'resource'], -'newt_entry_set' => ['void', 'entry'=>'resource', 'value'=>'string', 'cursor_at_end='=>'bool'], -'newt_entry_set_filter' => ['void', 'entry'=>'resource', 'filter'=>'callable', 'data'=>'mixed'], -'newt_entry_set_flags' => ['void', 'entry'=>'resource', 'flags'=>'int', 'sense'=>'int'], -'newt_finished' => ['int'], -'newt_form' => ['resource', 'vert_bar='=>'resource', 'help='=>'string', 'flags='=>'int'], -'newt_form_add_component' => ['void', 'form'=>'resource', 'component'=>'resource'], -'newt_form_add_components' => ['void', 'form'=>'resource', 'components'=>'array'], -'newt_form_add_hot_key' => ['void', 'form'=>'resource', 'key'=>'int'], -'newt_form_destroy' => ['void', 'form'=>'resource'], -'newt_form_get_current' => ['resource', 'form'=>'resource'], -'newt_form_run' => ['void', 'form'=>'resource', 'exit_struct'=>'array'], -'newt_form_set_background' => ['void', 'from'=>'resource', 'background'=>'int'], -'newt_form_set_height' => ['void', 'form'=>'resource', 'height'=>'int'], -'newt_form_set_size' => ['void', 'form'=>'resource'], -'newt_form_set_timer' => ['void', 'form'=>'resource', 'milliseconds'=>'int'], -'newt_form_set_width' => ['void', 'form'=>'resource', 'width'=>'int'], -'newt_form_watch_fd' => ['void', 'form'=>'resource', 'stream'=>'resource', 'flags='=>'int'], -'newt_get_screen_size' => ['void', 'cols'=>'int', 'rows'=>'int'], -'newt_grid_add_components_to_form' => ['void', 'grid'=>'resource', 'form'=>'resource', 'recurse'=>'bool'], -'newt_grid_basic_window' => ['resource', 'text'=>'resource', 'middle'=>'resource', 'buttons'=>'resource'], -'newt_grid_free' => ['void', 'grid'=>'resource', 'recurse'=>'bool'], -'newt_grid_get_size' => ['void', 'grid'=>'resource', 'width'=>'int', 'height'=>'int'], -'newt_grid_h_close_stacked' => ['resource', 'element1_type'=>'int', 'element1'=>'resource', '...args='=>'resource'], -'newt_grid_h_stacked' => ['resource', 'element1_type'=>'int', 'element1'=>'resource', '...args='=>'resource'], -'newt_grid_place' => ['void', 'grid'=>'resource', 'left'=>'int', 'top'=>'int'], -'newt_grid_set_field' => ['void', 'grid'=>'resource', 'col'=>'int', 'row'=>'int', 'type'=>'int', 'value'=>'resource', 'pad_left'=>'int', 'pad_top'=>'int', 'pad_right'=>'int', 'pad_bottom'=>'int', 'anchor'=>'int', 'flags='=>'int'], -'newt_grid_simple_window' => ['resource', 'text'=>'resource', 'middle'=>'resource', 'buttons'=>'resource'], -'newt_grid_v_close_stacked' => ['resource', 'element1_type'=>'int', 'element1'=>'resource', '...args='=>'resource'], -'newt_grid_v_stacked' => ['resource', 'element1_type'=>'int', 'element1'=>'resource', '...args='=>'resource'], -'newt_grid_wrapped_window' => ['void', 'grid'=>'resource', 'title'=>'string'], -'newt_grid_wrapped_window_at' => ['void', 'grid'=>'resource', 'title'=>'string', 'left'=>'int', 'top'=>'int'], -'newt_init' => ['int'], -'newt_label' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string'], -'newt_label_set_text' => ['void', 'label'=>'resource', 'text'=>'string'], -'newt_listbox' => ['resource', 'left'=>'int', 'top'=>'int', 'height'=>'int', 'flags='=>'int'], -'newt_listbox_append_entry' => ['void', 'listbox'=>'resource', 'text'=>'string', 'data'=>'mixed'], -'newt_listbox_clear' => ['void', 'listobx'=>'resource'], -'newt_listbox_clear_selection' => ['void', 'listbox'=>'resource'], -'newt_listbox_delete_entry' => ['void', 'listbox'=>'resource', 'key'=>'mixed'], -'newt_listbox_get_current' => ['string', 'listbox'=>'resource'], -'newt_listbox_get_selection' => ['array', 'listbox'=>'resource'], -'newt_listbox_insert_entry' => ['void', 'listbox'=>'resource', 'text'=>'string', 'data'=>'mixed', 'key'=>'mixed'], -'newt_listbox_item_count' => ['int', 'listbox'=>'resource'], -'newt_listbox_select_item' => ['void', 'listbox'=>'resource', 'key'=>'mixed', 'sense'=>'int'], -'newt_listbox_set_current' => ['void', 'listbox'=>'resource', 'num'=>'int'], -'newt_listbox_set_current_by_key' => ['void', 'listbox'=>'resource', 'key'=>'mixed'], -'newt_listbox_set_data' => ['void', 'listbox'=>'resource', 'num'=>'int', 'data'=>'mixed'], -'newt_listbox_set_entry' => ['void', 'listbox'=>'resource', 'num'=>'int', 'text'=>'string'], -'newt_listbox_set_width' => ['void', 'listbox'=>'resource', 'width'=>'int'], -'newt_listitem' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string', 'is_default'=>'bool', 'prev_item'=>'resource', 'data'=>'mixed', 'flags='=>'int'], -'newt_listitem_get_data' => ['mixed', 'item'=>'resource'], -'newt_listitem_set' => ['void', 'item'=>'resource', 'text'=>'string'], -'newt_open_window' => ['int', 'left'=>'int', 'top'=>'int', 'width'=>'int', 'height'=>'int', 'title='=>'string'], -'newt_pop_help_line' => ['void'], -'newt_pop_window' => ['void'], -'newt_push_help_line' => ['void', 'text='=>'string'], -'newt_radio_get_current' => ['resource', 'set_member'=>'resource'], -'newt_radiobutton' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string', 'is_default'=>'bool', 'prev_button='=>'resource'], -'newt_redraw_help_line' => ['void'], -'newt_reflow_text' => ['string', 'text'=>'string', 'width'=>'int', 'flex_down'=>'int', 'flex_up'=>'int', 'actual_width'=>'int', 'actual_height'=>'int'], -'newt_refresh' => ['void'], -'newt_resize_screen' => ['void', 'redraw='=>'bool'], -'newt_resume' => ['void'], -'newt_run_form' => ['resource', 'form'=>'resource'], -'newt_scale' => ['resource', 'left'=>'int', 'top'=>'int', 'width'=>'int', 'full_value'=>'int'], -'newt_scale_set' => ['void', 'scale'=>'resource', 'amount'=>'int'], -'newt_scrollbar_set' => ['void', 'scrollbar'=>'resource', 'where'=>'int', 'total'=>'int'], -'newt_set_help_callback' => ['void', 'function'=>'mixed'], -'newt_set_suspend_callback' => ['void', 'function'=>'callable', 'data'=>'mixed'], -'newt_suspend' => ['void'], -'newt_textbox' => ['resource', 'left'=>'int', 'top'=>'int', 'width'=>'int', 'height'=>'int', 'flags='=>'int'], -'newt_textbox_get_num_lines' => ['int', 'textbox'=>'resource'], -'newt_textbox_reflowed' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'char', 'width'=>'int', 'flex_down'=>'int', 'flex_up'=>'int', 'flags='=>'int'], -'newt_textbox_set_height' => ['void', 'textbox'=>'resource', 'height'=>'int'], -'newt_textbox_set_text' => ['void', 'textbox'=>'resource', 'text'=>'string'], -'newt_vertical_scrollbar' => ['resource', 'left'=>'int', 'top'=>'int', 'height'=>'int', 'normal_colorset='=>'int', 'thumb_colorset='=>'int'], -'newt_wait_for_key' => ['void'], -'newt_win_choice' => ['int', 'title'=>'string', 'button1_text'=>'string', 'button2_text'=>'string', 'format'=>'string', 'args='=>'mixed', '...args='=>'mixed'], -'newt_win_entries' => ['int', 'title'=>'string', 'text'=>'string', 'suggested_width'=>'int', 'flex_down'=>'int', 'flex_up'=>'int', 'data_width'=>'int', 'items'=>'array', 'button1'=>'string', '...args='=>'string'], -'newt_win_menu' => ['int', 'title'=>'string', 'text'=>'string', 'suggestedwidth'=>'int', 'flexdown'=>'int', 'flexup'=>'int', 'maxlistheight'=>'int', 'items'=>'array', 'listitem'=>'int', 'button1='=>'string', '...args='=>'string'], -'newt_win_message' => ['void', 'title'=>'string', 'button_text'=>'string', 'format'=>'string', 'args='=>'mixed', '...args='=>'mixed'], -'newt_win_messagev' => ['void', 'title'=>'string', 'button_text'=>'string', 'format'=>'string', 'args'=>'array'], -'newt_win_ternary' => ['int', 'title'=>'string', 'button1_text'=>'string', 'button2_text'=>'string', 'button3_text'=>'string', 'format'=>'string', 'args='=>'mixed', '...args='=>'mixed'], 'next' => ['mixed', '&r_array'=>'array|object'], 'ngettext' => ['string', 'singular'=>'string', 'plural'=>'string', 'count'=>'int'], 'nl2br' => ['string', 'string'=>'string', 'use_xhtml='=>'bool'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index e1373810d5a..63e2808292a 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -13722,122 +13722,6 @@ 'newrelic_set_appname' => ['bool', 'name'=>'string', 'license='=>'string', 'xmit='=>'bool'], 'newrelic_set_user_attributes' => ['bool', 'user'=>'string', 'account'=>'string', 'product'=>'string'], 'newrelic_start_transaction' => ['bool', 'appname'=>'string', 'license='=>'string'], - 'newt_bell' => ['void'], - 'newt_button' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string'], - 'newt_button_bar' => ['resource', 'buttons'=>'array'], - 'newt_centered_window' => ['int', 'width'=>'int', 'height'=>'int', 'title='=>'string'], - 'newt_checkbox' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string', 'def_value'=>'string', 'seq='=>'string'], - 'newt_checkbox_get_value' => ['string', 'checkbox'=>'resource'], - 'newt_checkbox_set_flags' => ['void', 'checkbox'=>'resource', 'flags'=>'int', 'sense'=>'int'], - 'newt_checkbox_set_value' => ['void', 'checkbox'=>'resource', 'value'=>'string'], - 'newt_checkbox_tree' => ['resource', 'left'=>'int', 'top'=>'int', 'height'=>'int', 'flags='=>'int'], - 'newt_checkbox_tree_add_item' => ['void', 'checkboxtree'=>'resource', 'text'=>'string', 'data'=>'mixed', 'flags'=>'int', 'index'=>'int', '...args='=>'int'], - 'newt_checkbox_tree_find_item' => ['array', 'checkboxtree'=>'resource', 'data'=>'mixed'], - 'newt_checkbox_tree_get_current' => ['mixed', 'checkboxtree'=>'resource'], - 'newt_checkbox_tree_get_entry_value' => ['string', 'checkboxtree'=>'resource', 'data'=>'mixed'], - 'newt_checkbox_tree_get_multi_selection' => ['array', 'checkboxtree'=>'resource', 'seqnum'=>'string'], - 'newt_checkbox_tree_get_selection' => ['array', 'checkboxtree'=>'resource'], - 'newt_checkbox_tree_multi' => ['resource', 'left'=>'int', 'top'=>'int', 'height'=>'int', 'seq'=>'string', 'flags='=>'int'], - 'newt_checkbox_tree_set_current' => ['void', 'checkboxtree'=>'resource', 'data'=>'mixed'], - 'newt_checkbox_tree_set_entry' => ['void', 'checkboxtree'=>'resource', 'data'=>'mixed', 'text'=>'string'], - 'newt_checkbox_tree_set_entry_value' => ['void', 'checkboxtree'=>'resource', 'data'=>'mixed', 'value'=>'string'], - 'newt_checkbox_tree_set_width' => ['void', 'checkbox_tree'=>'resource', 'width'=>'int'], - 'newt_clear_key_buffer' => ['void'], - 'newt_cls' => ['void'], - 'newt_compact_button' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string'], - 'newt_component_add_callback' => ['void', 'component'=>'resource', 'func_name'=>'mixed', 'data'=>'mixed'], - 'newt_component_takes_focus' => ['void', 'component'=>'resource', 'takes_focus'=>'bool'], - 'newt_create_grid' => ['resource', 'cols'=>'int', 'rows'=>'int'], - 'newt_cursor_off' => ['void'], - 'newt_cursor_on' => ['void'], - 'newt_delay' => ['void', 'microseconds'=>'int'], - 'newt_draw_form' => ['void', 'form'=>'resource'], - 'newt_draw_root_text' => ['void', 'left'=>'int', 'top'=>'int', 'text'=>'string'], - 'newt_entry' => ['resource', 'left'=>'int', 'top'=>'int', 'width'=>'int', 'init_value='=>'string', 'flags='=>'int'], - 'newt_entry_get_value' => ['string', 'entry'=>'resource'], - 'newt_entry_set' => ['void', 'entry'=>'resource', 'value'=>'string', 'cursor_at_end='=>'bool'], - 'newt_entry_set_filter' => ['void', 'entry'=>'resource', 'filter'=>'callable', 'data'=>'mixed'], - 'newt_entry_set_flags' => ['void', 'entry'=>'resource', 'flags'=>'int', 'sense'=>'int'], - 'newt_finished' => ['int'], - 'newt_form' => ['resource', 'vert_bar='=>'resource', 'help='=>'string', 'flags='=>'int'], - 'newt_form_add_component' => ['void', 'form'=>'resource', 'component'=>'resource'], - 'newt_form_add_components' => ['void', 'form'=>'resource', 'components'=>'array'], - 'newt_form_add_hot_key' => ['void', 'form'=>'resource', 'key'=>'int'], - 'newt_form_destroy' => ['void', 'form'=>'resource'], - 'newt_form_get_current' => ['resource', 'form'=>'resource'], - 'newt_form_run' => ['void', 'form'=>'resource', 'exit_struct'=>'array'], - 'newt_form_set_background' => ['void', 'from'=>'resource', 'background'=>'int'], - 'newt_form_set_height' => ['void', 'form'=>'resource', 'height'=>'int'], - 'newt_form_set_size' => ['void', 'form'=>'resource'], - 'newt_form_set_timer' => ['void', 'form'=>'resource', 'milliseconds'=>'int'], - 'newt_form_set_width' => ['void', 'form'=>'resource', 'width'=>'int'], - 'newt_form_watch_fd' => ['void', 'form'=>'resource', 'stream'=>'resource', 'flags='=>'int'], - 'newt_get_screen_size' => ['void', 'cols'=>'int', 'rows'=>'int'], - 'newt_grid_add_components_to_form' => ['void', 'grid'=>'resource', 'form'=>'resource', 'recurse'=>'bool'], - 'newt_grid_basic_window' => ['resource', 'text'=>'resource', 'middle'=>'resource', 'buttons'=>'resource'], - 'newt_grid_free' => ['void', 'grid'=>'resource', 'recurse'=>'bool'], - 'newt_grid_get_size' => ['void', 'grid'=>'resource', 'width'=>'int', 'height'=>'int'], - 'newt_grid_h_close_stacked' => ['resource', 'element1_type'=>'int', 'element1'=>'resource', '...args='=>'resource'], - 'newt_grid_h_stacked' => ['resource', 'element1_type'=>'int', 'element1'=>'resource', '...args='=>'resource'], - 'newt_grid_place' => ['void', 'grid'=>'resource', 'left'=>'int', 'top'=>'int'], - 'newt_grid_set_field' => ['void', 'grid'=>'resource', 'col'=>'int', 'row'=>'int', 'type'=>'int', 'value'=>'resource', 'pad_left'=>'int', 'pad_top'=>'int', 'pad_right'=>'int', 'pad_bottom'=>'int', 'anchor'=>'int', 'flags='=>'int'], - 'newt_grid_simple_window' => ['resource', 'text'=>'resource', 'middle'=>'resource', 'buttons'=>'resource'], - 'newt_grid_v_close_stacked' => ['resource', 'element1_type'=>'int', 'element1'=>'resource', '...args='=>'resource'], - 'newt_grid_v_stacked' => ['resource', 'element1_type'=>'int', 'element1'=>'resource', '...args='=>'resource'], - 'newt_grid_wrapped_window' => ['void', 'grid'=>'resource', 'title'=>'string'], - 'newt_grid_wrapped_window_at' => ['void', 'grid'=>'resource', 'title'=>'string', 'left'=>'int', 'top'=>'int'], - 'newt_init' => ['int'], - 'newt_label' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string'], - 'newt_label_set_text' => ['void', 'label'=>'resource', 'text'=>'string'], - 'newt_listbox' => ['resource', 'left'=>'int', 'top'=>'int', 'height'=>'int', 'flags='=>'int'], - 'newt_listbox_append_entry' => ['void', 'listbox'=>'resource', 'text'=>'string', 'data'=>'mixed'], - 'newt_listbox_clear' => ['void', 'listobx'=>'resource'], - 'newt_listbox_clear_selection' => ['void', 'listbox'=>'resource'], - 'newt_listbox_delete_entry' => ['void', 'listbox'=>'resource', 'key'=>'mixed'], - 'newt_listbox_get_current' => ['string', 'listbox'=>'resource'], - 'newt_listbox_get_selection' => ['array', 'listbox'=>'resource'], - 'newt_listbox_insert_entry' => ['void', 'listbox'=>'resource', 'text'=>'string', 'data'=>'mixed', 'key'=>'mixed'], - 'newt_listbox_item_count' => ['int', 'listbox'=>'resource'], - 'newt_listbox_select_item' => ['void', 'listbox'=>'resource', 'key'=>'mixed', 'sense'=>'int'], - 'newt_listbox_set_current' => ['void', 'listbox'=>'resource', 'num'=>'int'], - 'newt_listbox_set_current_by_key' => ['void', 'listbox'=>'resource', 'key'=>'mixed'], - 'newt_listbox_set_data' => ['void', 'listbox'=>'resource', 'num'=>'int', 'data'=>'mixed'], - 'newt_listbox_set_entry' => ['void', 'listbox'=>'resource', 'num'=>'int', 'text'=>'string'], - 'newt_listbox_set_width' => ['void', 'listbox'=>'resource', 'width'=>'int'], - 'newt_listitem' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string', 'is_default'=>'bool', 'prev_item'=>'resource', 'data'=>'mixed', 'flags='=>'int'], - 'newt_listitem_get_data' => ['mixed', 'item'=>'resource'], - 'newt_listitem_set' => ['void', 'item'=>'resource', 'text'=>'string'], - 'newt_open_window' => ['int', 'left'=>'int', 'top'=>'int', 'width'=>'int', 'height'=>'int', 'title='=>'string'], - 'newt_pop_help_line' => ['void'], - 'newt_pop_window' => ['void'], - 'newt_push_help_line' => ['void', 'text='=>'string'], - 'newt_radio_get_current' => ['resource', 'set_member'=>'resource'], - 'newt_radiobutton' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'string', 'is_default'=>'bool', 'prev_button='=>'resource'], - 'newt_redraw_help_line' => ['void'], - 'newt_reflow_text' => ['string', 'text'=>'string', 'width'=>'int', 'flex_down'=>'int', 'flex_up'=>'int', 'actual_width'=>'int', 'actual_height'=>'int'], - 'newt_refresh' => ['void'], - 'newt_resize_screen' => ['void', 'redraw='=>'bool'], - 'newt_resume' => ['void'], - 'newt_run_form' => ['resource', 'form'=>'resource'], - 'newt_scale' => ['resource', 'left'=>'int', 'top'=>'int', 'width'=>'int', 'full_value'=>'int'], - 'newt_scale_set' => ['void', 'scale'=>'resource', 'amount'=>'int'], - 'newt_scrollbar_set' => ['void', 'scrollbar'=>'resource', 'where'=>'int', 'total'=>'int'], - 'newt_set_help_callback' => ['void', 'function'=>'mixed'], - 'newt_set_suspend_callback' => ['void', 'function'=>'callable', 'data'=>'mixed'], - 'newt_suspend' => ['void'], - 'newt_textbox' => ['resource', 'left'=>'int', 'top'=>'int', 'width'=>'int', 'height'=>'int', 'flags='=>'int'], - 'newt_textbox_get_num_lines' => ['int', 'textbox'=>'resource'], - 'newt_textbox_reflowed' => ['resource', 'left'=>'int', 'top'=>'int', 'text'=>'char', 'width'=>'int', 'flex_down'=>'int', 'flex_up'=>'int', 'flags='=>'int'], - 'newt_textbox_set_height' => ['void', 'textbox'=>'resource', 'height'=>'int'], - 'newt_textbox_set_text' => ['void', 'textbox'=>'resource', 'text'=>'string'], - 'newt_vertical_scrollbar' => ['resource', 'left'=>'int', 'top'=>'int', 'height'=>'int', 'normal_colorset='=>'int', 'thumb_colorset='=>'int'], - 'newt_wait_for_key' => ['void'], - 'newt_win_choice' => ['int', 'title'=>'string', 'button1_text'=>'string', 'button2_text'=>'string', 'format'=>'string', 'args='=>'mixed', '...args='=>'mixed'], - 'newt_win_entries' => ['int', 'title'=>'string', 'text'=>'string', 'suggested_width'=>'int', 'flex_down'=>'int', 'flex_up'=>'int', 'data_width'=>'int', 'items'=>'array', 'button1'=>'string', '...args='=>'string'], - 'newt_win_menu' => ['int', 'title'=>'string', 'text'=>'string', 'suggestedwidth'=>'int', 'flexdown'=>'int', 'flexup'=>'int', 'maxlistheight'=>'int', 'items'=>'array', 'listitem'=>'int', 'button1='=>'string', '...args='=>'string'], - 'newt_win_message' => ['void', 'title'=>'string', 'button_text'=>'string', 'format'=>'string', 'args='=>'mixed', '...args='=>'mixed'], - 'newt_win_messagev' => ['void', 'title'=>'string', 'button_text'=>'string', 'format'=>'string', 'args'=>'array'], - 'newt_win_ternary' => ['int', 'title'=>'string', 'button1_text'=>'string', 'button2_text'=>'string', 'button3_text'=>'string', 'format'=>'string', 'args='=>'mixed', '...args='=>'mixed'], 'next' => ['mixed', '&r_array'=>'array|object'], 'ngettext' => ['string', 'singular'=>'string', 'plural'=>'string', 'count'=>'int'], 'nl2br' => ['string', 'string'=>'string', 'use_xhtml='=>'bool'], From 085e8f6fb2d3a9d7026b1e4b33221f90f874e29a Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sun, 12 Feb 2023 02:42:59 -0400 Subject: [PATCH 051/109] Forbid implementing some interfaces - `Throwable` can only be implemented when classes extend one of `Exception` or `Error` - `UnitEnum` and `BackedEnum` cannot be implemented by user-defined classes Refs vimeo/psalm#7722 --- config.xsd | 1 + docs/running_psalm/error_levels.md | 1 + docs/running_psalm/issues.md | 1 + .../issues/InvalidInterfaceImplementation.md | 15 +++++++ src/Psalm/Internal/Analyzer/ClassAnalyzer.php | 30 ++++++++++++++ .../Issue/InvalidInterfaceImplementation.php | 9 +++++ tests/ClassTest.php | 8 ++++ tests/DocumentationTest.php | 1 + tests/EnumTest.php | 40 +++++++++++++++++++ 9 files changed, 106 insertions(+) create mode 100644 docs/running_psalm/issues/InvalidInterfaceImplementation.md create mode 100644 src/Psalm/Issue/InvalidInterfaceImplementation.php diff --git a/config.xsd b/config.xsd index 4f4b7f82a8b..3582e854b92 100644 --- a/config.xsd +++ b/config.xsd @@ -272,6 +272,7 @@ + diff --git a/docs/running_psalm/error_levels.md b/docs/running_psalm/error_levels.md index a0799b89277..b4db5ddc026 100644 --- a/docs/running_psalm/error_levels.md +++ b/docs/running_psalm/error_levels.md @@ -48,6 +48,7 @@ Level 5 and above allows a more non-verifiable code, and higher levels are even - [InvalidEnumMethod](issues/InvalidEnumMethod.md) - [InvalidExtendClass](issues/InvalidExtendClass.md) - [InvalidGlobal](issues/InvalidGlobal.md) + - [InvalidInterfaceImplementation](issues/InvalidInterfaceImplementation.md) - [InvalidParamDefault](issues/InvalidParamDefault.md) - [InvalidParent](issues/InvalidParent.md) - [InvalidPassByReference](issues/InvalidPassByReference.md) diff --git a/docs/running_psalm/issues.md b/docs/running_psalm/issues.md index b232476a3bc..3da202b4598 100644 --- a/docs/running_psalm/issues.md +++ b/docs/running_psalm/issues.md @@ -75,6 +75,7 @@ - [InvalidFalsableReturnType](issues/InvalidFalsableReturnType.md) - [InvalidFunctionCall](issues/InvalidFunctionCall.md) - [InvalidGlobal](issues/InvalidGlobal.md) + - [InvalidInterfaceImplementation](issues/InvalidInterfaceImplementation.md) - [InvalidIterator](issues/InvalidIterator.md) - [InvalidLiteralArgument](issues/InvalidLiteralArgument.md) - [InvalidMethodCall](issues/InvalidMethodCall.md) diff --git a/docs/running_psalm/issues/InvalidInterfaceImplementation.md b/docs/running_psalm/issues/InvalidInterfaceImplementation.md new file mode 100644 index 00000000000..837b70139da --- /dev/null +++ b/docs/running_psalm/issues/InvalidInterfaceImplementation.md @@ -0,0 +1,15 @@ +# InvalidInterfaceImplementation + +Emitted when trying to implement interface that cannot be implemented (e.g. `Throwable`, `UnitEnum`, `BackedEnum`). + +```php +analysis_php_version_id >= 7_00_00 + && !$storage->abstract + && !isset($storage->parent_classes['exception']) + && !isset($storage->parent_classes['error']) + ) { + IssueBuffer::maybeAdd( + new InvalidInterfaceImplementation( + 'Classes implementing Throwable should extend Exception or Error', + $code_location, + $fq_class_name, + ), + ); + } + + if (($fq_interface_name_lc === 'unitenum' + || $fq_interface_name_lc === 'backedenum') + && !$storage->is_enum + && $codebase->analysis_php_version_id >= 8_01_00 + ) { + IssueBuffer::maybeAdd( + new InvalidInterfaceImplementation( + $fq_interface_name . ' cannot be implemented by classes', + $code_location, + $fq_class_name, + ), + ); + } + if ($interface_storage->deprecated) { IssueBuffer::maybeAdd( new DeprecatedInterface( diff --git a/src/Psalm/Issue/InvalidInterfaceImplementation.php b/src/Psalm/Issue/InvalidInterfaceImplementation.php new file mode 100644 index 00000000000..bd5c4b02a05 --- /dev/null +++ b/src/Psalm/Issue/InvalidInterfaceImplementation.php @@ -0,0 +1,9 @@ + 'MixedMethodCall', ], + 'forbiddenThrowableImplementation' => [ + 'code' => ' 'InvalidInterfaceImplementation', + 'ignored_issues' => [], + 'php_version' => '7.0', + ], ]; } } diff --git a/tests/DocumentationTest.php b/tests/DocumentationTest.php index d79addf5a35..feec5b5f70a 100644 --- a/tests/DocumentationTest.php +++ b/tests/DocumentationTest.php @@ -308,6 +308,7 @@ public function providerInvalidCodeParse(): array case 'InvalidEnumMethod': case 'NoEnumProperties': case 'OverriddenFinalConstant': + case 'InvalidInterfaceImplementation': $php_version = '8.1'; break; } diff --git a/tests/EnumTest.php b/tests/EnumTest.php index abf03aebe8f..9477ef7cc4d 100644 --- a/tests/EnumTest.php +++ b/tests/EnumTest.php @@ -765,6 +765,46 @@ public function __get() {} 'ignored_issues' => [], 'php_version' => '8.1', ], + 'forbiddenUnitEnumImplementation' => [ + 'code' => ' 'InvalidInterfaceImplementation', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], + 'forbiddenBackedEnumImplementation' => [ + 'code' => ' 'InvalidInterfaceImplementation', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], ]; } } From 42e301cf848415576da07edc202c73b0a4714a81 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Sun, 12 Feb 2023 01:24:43 -0600 Subject: [PATCH 052/109] Update callmap types for php 8.2 --- dictionaries/CallMap.php | 64 +++++++++---------- dictionaries/CallMap_80_delta.php | 40 ++++++------ dictionaries/CallMap_82_delta.php | 10 ++- dictionaries/CallMap_historical.php | 58 ++++++++--------- .../Codebase/InternalCallMapHandlerTest.php | 2 +- 5 files changed, 91 insertions(+), 83 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index da84cd6c87e..5044870ffdf 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -477,10 +477,10 @@ 'ArrayObject::uasort' => ['void', 'cmp_function'=>'callable(mixed,mixed):int'], 'ArrayObject::uksort' => ['void', 'cmp_function'=>'callable(mixed,mixed):int'], 'ArrayObject::unserialize' => ['void', 'serialized'=>'string'], -'arsort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], +'arsort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], 'asin' => ['float', 'num'=>'float'], 'asinh' => ['float', 'num'=>'float'], -'asort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], +'asort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], 'assert' => ['bool', 'assertion'=>'string|bool|int', 'description='=>'string|Throwable|null'], 'assert_options' => ['mixed|false', 'option'=>'int', 'value='=>'mixed'], 'ast\get_kind_name' => ['string', 'kind'=>'int'], @@ -1078,7 +1078,7 @@ 'ClosedGeneratorException::getTrace' => ['list\',args?:array}>'], 'ClosedGeneratorException::getTraceAsString' => ['string'], 'closedir' => ['void', 'dir_handle='=>'resource'], -'closelog' => ['bool'], +'closelog' => ['true'], 'Closure::__construct' => ['void'], 'Closure::__invoke' => ['', '...args='=>''], 'Closure::bind' => ['Closure|false', 'old'=>'Closure', 'to'=>'?object', 'scope='=>'object|string'], @@ -1879,9 +1879,9 @@ 'dba_key_split' => ['array|false', 'key'=>'string|false|null'], 'dba_list' => ['array'], 'dba_nextkey' => ['string', 'dba'=>'resource'], -'dba_open' => ['resource', 'path'=>'string', 'mode'=>'string', 'handler='=>'string', '...handler_params='=>'string'], +'dba_open' => ['resource', 'path'=>'string', 'mode'=>'string', 'handler='=>'?string', 'permission='=>'int', 'map_size='=>'int', 'flags='=>'?int'], 'dba_optimize' => ['bool', 'dba'=>'resource'], -'dba_popen' => ['resource', 'path'=>'string', 'mode'=>'string', 'handler='=>'string', '...handler_params='=>'string'], +'dba_popen' => ['resource', 'path'=>'string', 'mode'=>'string', 'handler='=>'?string', 'permission='=>'int', 'map_size='=>'int', 'flags='=>'?int'], 'dba_replace' => ['bool', 'key'=>'string', 'value'=>'string', 'dba'=>'resource'], 'dba_sync' => ['bool', 'dba'=>'resource'], 'dbase_add_record' => ['bool', 'dbase_identifier'=>'resource', 'record'=>'array'], @@ -2463,7 +2463,7 @@ 'EmptyIterator::key' => ['never'], 'EmptyIterator::next' => ['void'], 'EmptyIterator::rewind' => ['void'], -'EmptyIterator::valid' => ['bool'], +'EmptyIterator::valid' => ['false'], 'enchant_broker_describe' => ['array', 'broker'=>'EnchantBroker'], 'enchant_broker_dict_exists' => ['bool', 'broker'=>'EnchantBroker', 'tag'=>'string'], 'enchant_broker_free' => ['bool', 'broker'=>'EnchantBroker'], @@ -6621,8 +6621,8 @@ 'kadm5_modify_principal' => ['bool', 'handle'=>'resource', 'principal'=>'string', 'options'=>'array'], 'key' => ['int|string|null', 'array'=>'array|object'], 'key_exists' => ['bool', 'key'=>'string|int', 'array'=>'array'], -'krsort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], -'ksort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], +'krsort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], +'ksort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], 'KTaglib_ID3v2_AttachedPictureFrame::getDescription' => ['string'], 'KTaglib_ID3v2_AttachedPictureFrame::getMimeType' => ['string'], 'KTaglib_ID3v2_AttachedPictureFrame::getType' => ['int'], @@ -8260,13 +8260,13 @@ 'mysqli_begin_transaction' => ['bool', 'mysql'=>'mysqli', 'flags='=>'int', 'name='=>'?string'], 'mysqli_change_user' => ['bool', 'mysql'=>'mysqli', 'username'=>'string', 'password'=>'string', 'database'=>'?string'], 'mysqli_character_set_name' => ['string', 'mysql'=>'mysqli'], -'mysqli_close' => ['bool', 'mysql'=>'mysqli'], +'mysqli_close' => ['true', 'mysql'=>'mysqli'], 'mysqli_commit' => ['bool', 'mysql'=>'mysqli', 'flags='=>'int', 'name='=>'?string'], 'mysqli_connect' => ['mysqli|false', 'hostname='=>'string|null', 'username='=>'string|null', 'password='=>'string|null', 'database='=>'string|null', 'port='=>'int|null', 'socket='=>'string|null'], 'mysqli_connect_errno' => ['int'], 'mysqli_connect_error' => ['?string'], 'mysqli_data_seek' => ['bool', 'result'=>'mysqli_result', 'offset'=>'int'], -'mysqli_debug' => ['bool', 'options'=>'string'], +'mysqli_debug' => ['true', 'options'=>'string'], 'mysqli_disable_reads_from_master' => ['bool', 'link'=>'mysqli'], 'mysqli_disable_rpl_parse' => ['bool', 'link'=>'mysqli'], 'mysqli_driver::embedded_server_end' => ['void'], @@ -8281,7 +8281,7 @@ 'mysqli_error_list' => ['array', 'mysql'=>'mysqli'], 'mysqli_escape_string' => ['string', 'mysql'=>'mysqli', 'string'=>'string'], 'mysqli_execute' => ['bool', 'statement'=>'mysqli_stmt', 'params='=>'list|null'], -'mysqli_execute_query' => ['mysqli_result|bool', 'mysqli'=>'mysqli', 'query'=>'non-empty-string', 'params='=>'list|null'], +'mysqli_execute_query' => ['mysqli_result|bool', 'mysql'=>'mysqli', 'query'=>'non-empty-string', 'params='=>'list|null'], 'mysqli_fetch_all' => ['list>', 'result'=>'mysqli_result', 'mode='=>'3'], 'mysqli_fetch_all\'1' => ['list>', 'result'=>'mysqli_result', 'mode='=>'1'], 'mysqli_fetch_all\'2' => ['list>', 'result'=>'mysqli_result', 'mode='=>'2'], @@ -8395,7 +8395,7 @@ 'mysqli_stmt_attr_set' => ['bool', 'statement'=>'mysqli_stmt', 'attribute'=>'int', 'value'=>'int'], 'mysqli_stmt_bind_param' => ['bool', 'statement'=>'mysqli_stmt', 'types'=>'string', '&vars'=>'mixed', '&...args='=>'mixed'], 'mysqli_stmt_bind_result' => ['bool', 'statement'=>'mysqli_stmt', '&w_var1'=>'', '&...w_vars='=>''], -'mysqli_stmt_close' => ['bool', 'statement'=>'mysqli_stmt'], +'mysqli_stmt_close' => ['true', 'statement'=>'mysqli_stmt'], 'mysqli_stmt_data_seek' => ['void', 'statement'=>'mysqli_stmt', 'offset'=>'int'], 'mysqli_stmt_errno' => ['int', 'statement'=>'mysqli_stmt'], 'mysqli_stmt_error' => ['string', 'statement'=>'mysqli_stmt'], @@ -9013,7 +9013,7 @@ 'openal_source_stop' => ['bool', 'source'=>'resource'], 'openal_stream' => ['resource', 'source'=>'resource', 'format'=>'int', 'rate'=>'int'], 'opendir' => ['resource|false', 'directory'=>'string', 'context='=>'resource'], -'openlog' => ['bool', 'prefix'=>'string', 'flags'=>'int', 'facility'=>'int'], +'openlog' => ['true', 'prefix'=>'string', 'flags'=>'int', 'facility'=>'int'], 'openssl_cipher_iv_length' => ['int|false', 'cipher_algo'=>'string'], 'openssl_cipher_key_length' => ['positive-int|false', 'cipher_algo'=>'non-empty-string'], 'openssl_csr_export' => ['bool', 'csr'=>'OpenSSLCertificateSigningRequest|string', '&w_output'=>'string', 'no_text='=>'bool'], @@ -9861,7 +9861,7 @@ 'php_user_filter::filter' => ['int', 'in'=>'resource', 'out'=>'resource', '&rw_consumed'=>'int', 'closing'=>'bool'], 'php_user_filter::onClose' => ['void'], 'php_user_filter::onCreate' => ['bool'], -'phpcredits' => ['bool', 'flags='=>'int'], +'phpcredits' => ['true', 'flags='=>'int'], 'phpdbg_break_file' => ['void', 'file'=>'string', 'line'=>'int'], 'phpdbg_break_function' => ['void', 'function'=>'string'], 'phpdbg_break_method' => ['void', 'class'=>'string', 'method'=>'string'], @@ -9873,7 +9873,7 @@ 'phpdbg_get_executable' => ['array', 'options='=>'array'], 'phpdbg_prompt' => ['void', 'string'=>'string'], 'phpdbg_start_oplog' => ['void'], -'phpinfo' => ['bool', 'flags='=>'int'], +'phpinfo' => ['true', 'flags='=>'int'], 'PhpToken::tokenize' => ['list', 'code'=>'string', 'flags='=>'int'], 'PhpToken::is' => ['bool', 'kind'=>'string|int|string[]|int[]'], 'PhpToken::isIgnorable' => ['bool'], @@ -11870,7 +11870,7 @@ 'shmop_size' => ['int', 'shmop'=>'Shmop'], 'shmop_write' => ['int', 'shmop'=>'Shmop', 'data'=>'string', 'offset'=>'int'], 'show_source' => ['string|bool', 'filename'=>'string', 'return='=>'bool'], -'shuffle' => ['bool', '&rw_array'=>'array'], +'shuffle' => ['true', '&rw_array'=>'array'], 'signeurlpaiement' => ['string', 'clent'=>'string', 'data'=>'string'], 'similar_text' => ['int', 'string1'=>'string', 'string2'=>'string', '&w_percent='=>'float'], 'simplexml_import_dom' => ['?SimpleXMLElement', 'node'=>'DOMNode', 'class_name='=>'?string'], @@ -12797,7 +12797,7 @@ 'SolrUtils::escapeQueryChars' => ['string|false', 'string'=>'string'], 'SolrUtils::getSolrVersion' => ['string'], 'SolrUtils::queryPhrase' => ['string', 'string'=>'string'], -'sort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], +'sort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], 'soundex' => ['string', 'string'=>'string'], 'SphinxClient::__construct' => ['void'], 'SphinxClient::addQuery' => ['int', 'query'=>'string', 'index='=>'string', 'comment='=>'string'], @@ -13131,7 +13131,7 @@ 'SplTempFileObject::getRealPath' => ['string|false'], 'SplTempFileObject::getSize' => ['int|false'], 'SplTempFileObject::getType' => ['string|false'], -'SplTempFileObject::hasChildren' => ['bool'], +'SplTempFileObject::hasChildren' => ['false'], 'SplTempFileObject::isDir' => ['bool'], 'SplTempFileObject::isExecutable' => ['bool'], 'SplTempFileObject::isFile' => ['bool'], @@ -14175,7 +14175,7 @@ 'SyncSharedMemory::write' => ['int', 'string='=>'string', 'start='=>'int'], 'sys_get_temp_dir' => ['string'], 'sys_getloadavg' => ['array'], -'syslog' => ['bool', 'priority'=>'int', 'message'=>'string'], +'syslog' => ['true', 'priority'=>'int', 'message'=>'string'], 'system' => ['string|false', 'command'=>'string', '&w_result_code='=>'int'], 'taint' => ['bool', '&rw_string'=>'string', '&...w_other_strings='=>'string'], 'tan' => ['float', 'num'=>'float'], @@ -14576,7 +14576,7 @@ 'TypeError::getPrevious' => ['?Throwable'], 'TypeError::getTrace' => ['list\',args?:array}>'], 'TypeError::getTraceAsString' => ['string'], -'uasort' => ['bool', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], +'uasort' => ['true', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], 'ucfirst' => ['string', 'string'=>'string'], 'UConverter::__construct' => ['void', 'destination_encoding='=>'?string', 'source_encoding='=>'?string'], 'UConverter::convert' => ['string', 'string'=>'string', 'reverse='=>'bool'], @@ -14787,7 +14787,7 @@ 'ui\window::setMargin' => ['', 'margin'=>'bool'], 'ui\window::setSize' => ['', 'size'=>'UI\Size'], 'ui\window::setTitle' => ['', 'title'=>'string'], -'uksort' => ['bool', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], +'uksort' => ['true', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], 'umask' => ['int', 'mask='=>'?int'], 'UnderflowException::__clone' => ['void'], 'UnderflowException::__construct' => ['void', 'message='=>'string', 'code='=>'int', 'previous='=>'?Throwable'], @@ -14864,7 +14864,7 @@ 'use_soap_error_handler' => ['bool', 'enable='=>'bool'], 'user_error' => ['bool', 'message'=>'string', 'error_level='=>'int'], 'usleep' => ['void', 'microseconds'=>'positive-int|0'], -'usort' => ['bool', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], +'usort' => ['true', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], 'utf8_decode' => ['string', 'string'=>'string'], 'utf8_encode' => ['string', 'string'=>'string'], 'V8Js::__construct' => ['void', 'object_name='=>'string', 'variables='=>'array', 'extensions='=>'array', 'report_uncaught_exceptions='=>'bool', 'snapshot_blob='=>'string'], @@ -15301,16 +15301,16 @@ 'xml_parser_free' => ['bool', 'parser'=>'XMLParser'], 'xml_parser_get_option' => ['string', 'parser'=>'XMLParser', 'option'=>'int'], 'xml_parser_set_option' => ['bool', 'parser'=>'XMLParser', 'option'=>'int', 'value'=>'mixed'], -'xml_set_character_data_handler' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], -'xml_set_default_handler' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], -'xml_set_element_handler' => ['bool', 'parser'=>'XMLParser', 'start_handler'=>'callable', 'end_handler'=>'callable'], -'xml_set_end_namespace_decl_handler' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], -'xml_set_external_entity_ref_handler' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], -'xml_set_notation_decl_handler' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], -'xml_set_object' => ['bool', 'parser'=>'XMLParser', 'object'=>'object'], -'xml_set_processing_instruction_handler' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], -'xml_set_start_namespace_decl_handler' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], -'xml_set_unparsed_entity_decl_handler' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], +'xml_set_character_data_handler' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], +'xml_set_default_handler' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], +'xml_set_element_handler' => ['true', 'parser'=>'XMLParser', 'start_handler'=>'callable', 'end_handler'=>'callable'], +'xml_set_end_namespace_decl_handler' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], +'xml_set_external_entity_ref_handler' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], +'xml_set_notation_decl_handler' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], +'xml_set_object' => ['true', 'parser'=>'XMLParser', 'object'=>'object'], +'xml_set_processing_instruction_handler' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], +'xml_set_start_namespace_decl_handler' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], +'xml_set_unparsed_entity_decl_handler' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], 'XMLDiff\Base::__construct' => ['void', 'nsname'=>'string'], 'XMLDiff\Base::diff' => ['mixed', 'from'=>'mixed', 'to'=>'mixed'], 'XMLDiff\Base::merge' => ['mixed', 'src'=>'mixed', 'diff'=>'mixed'], diff --git a/dictionaries/CallMap_80_delta.php b/dictionaries/CallMap_80_delta.php index 10ddcd25d4c..cb1d9a10060 100644 --- a/dictionaries/CallMap_80_delta.php +++ b/dictionaries/CallMap_80_delta.php @@ -2390,44 +2390,44 @@ 'new' => ['bool', 'parser'=>'XMLParser', 'option'=>'int', 'value'=>'mixed'], ], 'xml_set_character_data_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], ], 'xml_set_default_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], ], 'xml_set_element_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'start_handler'=>'callable', 'end_handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'start_handler'=>'callable', 'end_handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'start_handler'=>'callable', 'end_handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'start_handler'=>'callable', 'end_handler'=>'callable'], ], 'xml_set_end_namespace_decl_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], ], 'xml_set_external_entity_ref_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], ], 'xml_set_notation_decl_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], ], 'xml_set_object' => [ - 'old' => ['bool', 'parser'=>'resource', 'object'=>'object'], - 'new' => ['bool', 'parser'=>'XMLParser', 'object'=>'object'], + 'old' => ['true', 'parser'=>'resource', 'object'=>'object'], + 'new' => ['true', 'parser'=>'XMLParser', 'object'=>'object'], ], 'xml_set_processing_instruction_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], ], 'xml_set_start_namespace_decl_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], ], 'xml_set_unparsed_entity_decl_handler' => [ - 'old' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'new' => ['bool', 'parser'=>'XMLParser', 'handler'=>'callable'], + 'old' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], ], 'xmlwriter_end_attribute' => [ 'old' => ['bool', 'writer'=>'resource'], diff --git a/dictionaries/CallMap_82_delta.php b/dictionaries/CallMap_82_delta.php index bfb0450d6e1..555ea008931 100644 --- a/dictionaries/CallMap_82_delta.php +++ b/dictionaries/CallMap_82_delta.php @@ -16,7 +16,7 @@ */ return [ 'added' => [ - 'mysqli_execute_query' => ['mysqli_result|bool', 'mysqli'=>'mysqli', 'query'=>'non-empty-string', 'params='=>'list|null'], + 'mysqli_execute_query' => ['mysqli_result|bool', 'mysql'=>'mysqli', 'query'=>'non-empty-string', 'params='=>'list|null'], 'mysqli::execute_query' => ['mysqli_result|bool', 'query'=>'non-empty-string', 'params='=>'list|null'], 'openssl_cipher_key_length' => ['positive-int|false', 'cipher_algo'=>'non-empty-string'], 'curl_upkeep' => ['bool', 'handle'=>'CurlHandle'], @@ -33,6 +33,14 @@ ], 'changed' => [ + 'dba_open' => [ + 'old' => ['resource', 'path'=>'string', 'mode'=>'string', 'handler='=>'string', '...handler_params='=>'string'], + 'new' => ['resource', 'path'=>'string', 'mode'=>'string', 'handler='=>'?string', 'permission='=>'int', 'map_size='=>'int', 'flags='=>'?int'], + ], + 'dba_popen' => [ + 'old' => ['resource', 'path'=>'string', 'mode'=>'string', 'handler='=>'string', '...handler_params='=>'string'], + 'new' => ['resource', 'path'=>'string', 'mode'=>'string', 'handler='=>'?string', 'permission='=>'int', 'map_size='=>'int', 'flags='=>'?int'], + ], 'str_split' => [ 'old' => ['non-empty-list', 'string'=>'string', 'length='=>'positive-int'], 'new' => ['list', 'string'=>'string', 'length='=>'positive-int'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 68f146de157..e626d4896d7 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -1333,7 +1333,7 @@ 'EmptyIterator::key' => ['never'], 'EmptyIterator::next' => ['void'], 'EmptyIterator::rewind' => ['void'], - 'EmptyIterator::valid' => ['bool'], + 'EmptyIterator::valid' => ['false'], 'Error::__clone' => ['void'], 'Error::__construct' => ['void', 'message='=>'string', 'code='=>'int', 'previous='=>'?Throwable'], 'Error::__toString' => ['string'], @@ -7988,7 +7988,7 @@ 'SplTempFileObject::getRealPath' => ['string|false'], 'SplTempFileObject::getSize' => ['int|false'], 'SplTempFileObject::getType' => ['string|false'], - 'SplTempFileObject::hasChildren' => ['bool'], + 'SplTempFileObject::hasChildren' => ['false'], 'SplTempFileObject::isDir' => ['bool'], 'SplTempFileObject::isExecutable' => ['bool'], 'SplTempFileObject::isFile' => ['bool'], @@ -9622,10 +9622,10 @@ 'array_walk\'1' => ['bool', '&rw_array'=>'object', 'callback'=>'callable', 'arg='=>'mixed'], 'array_walk_recursive' => ['bool', '&rw_array'=>'array', 'callback'=>'callable', 'arg='=>'mixed'], 'array_walk_recursive\'1' => ['bool', '&rw_array'=>'object', 'callback'=>'callable', 'arg='=>'mixed'], - 'arsort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], + 'arsort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], 'asin' => ['float', 'num'=>'float'], 'asinh' => ['float', 'num'=>'float'], - 'asort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], + 'asort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], 'assert' => ['bool', 'assertion'=>'string|bool|int', 'description='=>'string|Throwable|null'], 'assert_options' => ['mixed|false', 'option'=>'int', 'value='=>'mixed'], 'ast\Node::__construct' => ['void', 'kind='=>'int', 'flags='=>'int', 'children='=>'ast\Node\Decl[]|ast\Node[]|int[]|string[]|float[]|bool[]|null[]', 'start_line='=>'int'], @@ -9964,7 +9964,7 @@ 'cli_get_process_title' => ['?string'], 'cli_set_process_title' => ['bool', 'title'=>'string'], 'closedir' => ['void', 'dir_handle='=>'resource'], - 'closelog' => ['bool'], + 'closelog' => ['true'], 'clusterObj::convertToString' => ['string'], 'clusterObj::getFilterString' => ['string'], 'clusterObj::getGroupString' => ['string'], @@ -12460,8 +12460,8 @@ 'kadm5_modify_principal' => ['bool', 'handle'=>'resource', 'principal'=>'string', 'options'=>'array'], 'key' => ['int|string|null', 'array'=>'array|object'], 'key_exists' => ['bool', 'key'=>'string|int', 'array'=>'array'], - 'krsort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], - 'ksort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], + 'krsort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], + 'ksort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], 'labelObj::__construct' => ['void'], 'labelObj::convertToString' => ['string'], 'labelObj::deleteStyle' => ['int', 'index'=>'int'], @@ -13182,13 +13182,13 @@ 'mysqli_begin_transaction' => ['bool', 'mysql'=>'mysqli', 'flags='=>'int', 'name='=>'string'], 'mysqli_change_user' => ['bool', 'mysql'=>'mysqli', 'username'=>'string', 'password'=>'string', 'database'=>'?string'], 'mysqli_character_set_name' => ['string', 'mysql'=>'mysqli'], - 'mysqli_close' => ['bool', 'mysql'=>'mysqli'], + 'mysqli_close' => ['true', 'mysql'=>'mysqli'], 'mysqli_commit' => ['bool', 'mysql'=>'mysqli', 'flags='=>'int', 'name='=>'string'], 'mysqli_connect' => ['mysqli|false', 'hostname='=>'string', 'username='=>'string', 'password='=>'string', 'database='=>'string', 'port='=>'int', 'socket='=>'string'], 'mysqli_connect_errno' => ['int'], 'mysqli_connect_error' => ['?string'], 'mysqli_data_seek' => ['bool', 'result'=>'mysqli_result', 'offset'=>'int'], - 'mysqli_debug' => ['bool', 'options'=>'string'], + 'mysqli_debug' => ['true', 'options'=>'string'], 'mysqli_disable_reads_from_master' => ['bool', 'link'=>'mysqli'], 'mysqli_disable_rpl_parse' => ['bool', 'link'=>'mysqli'], 'mysqli_driver::embedded_server_end' => ['void'], @@ -13314,7 +13314,7 @@ 'mysqli_stmt_attr_set' => ['bool', 'statement'=>'mysqli_stmt', 'attribute'=>'int', 'value'=>'int'], 'mysqli_stmt_bind_param' => ['bool', 'statement'=>'mysqli_stmt', 'types'=>'string', '&vars'=>'mixed', '&...args='=>'mixed'], 'mysqli_stmt_bind_result' => ['bool', 'statement'=>'mysqli_stmt', '&w_var1'=>'', '&...w_vars='=>''], - 'mysqli_stmt_close' => ['bool', 'statement'=>'mysqli_stmt'], + 'mysqli_stmt_close' => ['true', 'statement'=>'mysqli_stmt'], 'mysqli_stmt_data_seek' => ['void', 'statement'=>'mysqli_stmt', 'offset'=>'int'], 'mysqli_stmt_errno' => ['int', 'statement'=>'mysqli_stmt'], 'mysqli_stmt_error' => ['string', 'statement'=>'mysqli_stmt'], @@ -13777,7 +13777,7 @@ 'openal_source_stop' => ['bool', 'source'=>'resource'], 'openal_stream' => ['resource', 'source'=>'resource', 'format'=>'int', 'rate'=>'int'], 'opendir' => ['resource|false', 'directory'=>'string', 'context='=>'resource'], - 'openlog' => ['bool', 'prefix'=>'string', 'flags'=>'int', 'facility'=>'int'], + 'openlog' => ['true', 'prefix'=>'string', 'flags'=>'int', 'facility'=>'int'], 'openssl_cipher_iv_length' => ['int|false', 'cipher_algo'=>'string'], 'openssl_csr_export' => ['bool', 'csr'=>'string|resource', '&w_output'=>'string', 'no_text='=>'bool'], 'openssl_csr_export_to_file' => ['bool', 'csr'=>'string|resource', 'output_filename'=>'string', 'no_text='=>'bool'], @@ -14038,7 +14038,7 @@ 'php_user_filter::filter' => ['int', 'in'=>'resource', 'out'=>'resource', '&rw_consumed'=>'int', 'closing'=>'bool'], 'php_user_filter::onClose' => ['void'], 'php_user_filter::onCreate' => ['bool'], - 'phpcredits' => ['bool', 'flags='=>'int'], + 'phpcredits' => ['true', 'flags='=>'int'], 'phpdbg_break_file' => ['void', 'file'=>'string', 'line'=>'int'], 'phpdbg_break_function' => ['void', 'function'=>'string'], 'phpdbg_break_method' => ['void', 'class'=>'string', 'method'=>'string'], @@ -14050,7 +14050,7 @@ 'phpdbg_get_executable' => ['array', 'options='=>'array'], 'phpdbg_prompt' => ['void', 'string'=>'string'], 'phpdbg_start_oplog' => ['void'], - 'phpinfo' => ['bool', 'flags='=>'int'], + 'phpinfo' => ['true', 'flags='=>'int'], 'phpversion' => ['string|false', 'extension='=>'string'], 'pht\AtomicInteger::__construct' => ['void', 'value='=>'int'], 'pht\AtomicInteger::dec' => ['void'], @@ -14588,7 +14588,7 @@ 'shmop_size' => ['int', 'shmop'=>'resource'], 'shmop_write' => ['int|false', 'shmop'=>'resource', 'data'=>'string', 'offset'=>'int'], 'show_source' => ['string|bool', 'filename'=>'string', 'return='=>'bool'], - 'shuffle' => ['bool', '&rw_array'=>'array'], + 'shuffle' => ['true', '&rw_array'=>'array'], 'signeurlpaiement' => ['string', 'clent'=>'string', 'data'=>'string'], 'similar_text' => ['int', 'string1'=>'string', 'string2'=>'string', '&w_percent='=>'float'], 'simplexml_import_dom' => ['?SimpleXMLElement', 'node'=>'DOMNode', 'class_name='=>'?string'], @@ -14659,7 +14659,7 @@ 'socket_write' => ['int|false', 'socket'=>'resource', 'data'=>'string', 'length='=>'int'], 'solid_fetch_prev' => ['bool', 'result_id'=>''], 'solr_get_version' => ['string|false'], - 'sort' => ['bool', '&rw_array'=>'array', 'flags='=>'int'], + 'sort' => ['true', '&rw_array'=>'array', 'flags='=>'int'], 'soundex' => ['string', 'string'=>'string'], 'spl_autoload' => ['void', 'class'=>'string', 'file_extensions='=>'string'], 'spl_autoload_call' => ['void', 'class'=>'string'], @@ -15383,7 +15383,7 @@ 'symlink' => ['bool', 'target'=>'string', 'link'=>'string'], 'sys_get_temp_dir' => ['string'], 'sys_getloadavg' => ['array'], - 'syslog' => ['bool', 'priority'=>'int', 'message'=>'string'], + 'syslog' => ['true', 'priority'=>'int', 'message'=>'string'], 'system' => ['string|false', 'command'=>'string', '&w_result_code='=>'int'], 'taint' => ['bool', '&rw_string'=>'string', '&...w_other_strings='=>'string'], 'tan' => ['float', 'num'=>'float'], @@ -15638,7 +15638,7 @@ 'transliterator_transliterate' => ['string|false', 'transliterator'=>'Transliterator|string', 'string'=>'string', 'start='=>'int', 'end='=>'int'], 'trigger_error' => ['bool', 'message'=>'string', 'error_level='=>'256|512|1024|16384'], 'trim' => ['string', 'string'=>'string', 'characters='=>'string'], - 'uasort' => ['bool', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], + 'uasort' => ['true', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], 'ucfirst' => ['string', 'string'=>'string'], 'ucwords' => ['string', 'string'=>'string', 'separators='=>'string'], 'udm_add_search_limit' => ['bool', 'agent'=>'resource', 'var'=>'int', 'value'=>'string'], @@ -15830,7 +15830,7 @@ 'ui\window::setMargin' => ['', 'margin'=>'bool'], 'ui\window::setSize' => ['', 'size'=>'UI\Size'], 'ui\window::setTitle' => ['', 'title'=>'string'], - 'uksort' => ['bool', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], + 'uksort' => ['true', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], 'umask' => ['int', 'mask='=>'int'], 'uniqid' => ['non-empty-string', 'prefix='=>'string', 'more_entropy='=>'bool'], 'unixtojd' => ['int', 'timestamp='=>'int'], @@ -15887,7 +15887,7 @@ 'use_soap_error_handler' => ['bool', 'enable='=>'bool'], 'user_error' => ['bool', 'message'=>'string', 'error_level='=>'int'], 'usleep' => ['void', 'microseconds'=>'positive-int|0'], - 'usort' => ['bool', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], + 'usort' => ['true', '&rw_array'=>'array', 'callback'=>'callable(mixed,mixed):int'], 'utf8_decode' => ['string', 'string'=>'string'], 'utf8_encode' => ['string', 'string'=>'string'], 'var_dump' => ['void', 'value'=>'mixed', '...values='=>'mixed'], @@ -16110,16 +16110,16 @@ 'xml_parser_free' => ['bool', 'parser'=>'resource'], 'xml_parser_get_option' => ['string|false', 'parser'=>'resource', 'option'=>'int'], 'xml_parser_set_option' => ['bool', 'parser'=>'resource', 'option'=>'int', 'value'=>'mixed'], - 'xml_set_character_data_handler' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'xml_set_default_handler' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'xml_set_element_handler' => ['bool', 'parser'=>'resource', 'start_handler'=>'callable', 'end_handler'=>'callable'], - 'xml_set_end_namespace_decl_handler' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'xml_set_external_entity_ref_handler' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'xml_set_notation_decl_handler' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'xml_set_object' => ['bool', 'parser'=>'resource', 'object'=>'object'], - 'xml_set_processing_instruction_handler' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'xml_set_start_namespace_decl_handler' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], - 'xml_set_unparsed_entity_decl_handler' => ['bool', 'parser'=>'resource', 'handler'=>'callable'], + 'xml_set_character_data_handler' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'xml_set_default_handler' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'xml_set_element_handler' => ['true', 'parser'=>'resource', 'start_handler'=>'callable', 'end_handler'=>'callable'], + 'xml_set_end_namespace_decl_handler' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'xml_set_external_entity_ref_handler' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'xml_set_notation_decl_handler' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'xml_set_object' => ['true', 'parser'=>'resource', 'object'=>'object'], + 'xml_set_processing_instruction_handler' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'xml_set_start_namespace_decl_handler' => ['true', 'parser'=>'resource', 'handler'=>'callable'], + 'xml_set_unparsed_entity_decl_handler' => ['true', 'parser'=>'resource', 'handler'=>'callable'], 'xmlrpc_decode' => ['mixed', 'xml'=>'string', 'encoding='=>'string'], 'xmlrpc_decode_request' => ['?array', 'xml'=>'string', '&w_method'=>'string', 'encoding='=>'string'], 'xmlrpc_encode' => ['string', 'value'=>'mixed'], diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index f714bb13a4d..05003f784e5 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -809,7 +809,7 @@ class InternalCallMapHandlerTest extends TestCase 'callbackfilteriterator::getinneriterator' => ['8.1', '8.2'], 'curl_multi_getcontent', 'datetime::add' => ['8.1', '8.2'], - 'datetime::createfromimmutable' => ['8.1', '8.2'], + 'datetime::createfromimmutable' => ['8.1'], 'datetime::createfrominterface', 'datetime::setdate' => ['8.1', '8.2'], 'datetime::settimezone' => ['8.1', '8.2'], From 873d79c5d76f65b59e78eaeb8226f871c4f7843c Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Mon, 13 Feb 2023 00:37:59 -0400 Subject: [PATCH 053/109] Forbid overriding built-in enum methods Fixes vimeo/psalm#9274 --- .../Analyzer/FunctionLikeAnalyzer.php | 2 +- .../Internal/Analyzer/MethodAnalyzer.php | 19 ++++++- tests/EnumTest.php | 56 +++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index a337ece0feb..6eca8ec9532 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -2000,7 +2000,7 @@ private function getFunctionInformation( MethodAnalyzer::checkMethodSignatureMustOmitReturnType($storage, $codeLocation); if ($appearing_class_storage->is_enum) { - MethodAnalyzer::checkForbiddenEnumMethod($storage); + MethodAnalyzer::checkForbiddenEnumMethod($storage, $appearing_class_storage); } if (!$context->calling_method_id || !$context->collect_initializations) { diff --git a/src/Psalm/Internal/Analyzer/MethodAnalyzer.php b/src/Psalm/Internal/Analyzer/MethodAnalyzer.php index 0a5077c1414..89af7aaec71 100644 --- a/src/Psalm/Internal/Analyzer/MethodAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/MethodAnalyzer.php @@ -16,6 +16,7 @@ use Psalm\Issue\UndefinedMethod; use Psalm\IssueBuffer; use Psalm\StatementsSource; +use Psalm\Storage\ClassLikeStorage; use Psalm\Storage\MethodStorage; use UnexpectedValueException; @@ -310,7 +311,7 @@ public function getMethodId(?string $context_self = null): MethodIdentifier ); } - public static function checkForbiddenEnumMethod(MethodStorage $method_storage): void + public static function checkForbiddenEnumMethod(MethodStorage $method_storage, ClassLikeStorage $enum_storage): void { if ($method_storage->cased_name === null || $method_storage->location === null) { return; @@ -324,5 +325,21 @@ public static function checkForbiddenEnumMethod(MethodStorage $method_storage): $method_storage->defining_fqcln . '::' . $method_storage->cased_name, )); } + + if ($method_name_lc === 'cases') { + IssueBuffer::maybeAdd(new InvalidEnumMethod( + 'Enums cannot define ' . $method_storage->cased_name, + $method_storage->location, + $method_storage->defining_fqcln . '::' . $method_storage->cased_name, + )); + } + + if ($enum_storage->enum_type && ($method_name_lc === 'from' || $method_name_lc === 'tryfrom')) { + IssueBuffer::maybeAdd(new InvalidEnumMethod( + 'Enums cannot define ' . $method_storage->cased_name, + $method_storage->location, + $method_storage->defining_fqcln . '::' . $method_storage->cased_name, + )); + } } } diff --git a/tests/EnumTest.php b/tests/EnumTest.php index 9477ef7cc4d..74483e04b89 100644 --- a/tests/EnumTest.php +++ b/tests/EnumTest.php @@ -805,6 +805,62 @@ public static function tryFrom(int|string $value): ?static 'ignored_issues' => [], 'php_version' => '8.1', ], + 'forbiddenUnitEnumCasesMethod' => [ + 'code' => ' 'InvalidEnumMethod', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], + 'forbiddenBackedEnumCasesMethod' => [ + 'code' => ' 'InvalidEnumMethod', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], + 'forbiddenBackedEnumFromMethod' => [ + 'code' => ' 'InvalidEnumMethod', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], + 'forbiddenBackedEnumTryFromMethod' => [ + 'code' => ' 'InvalidEnumMethod', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], ]; } } From 8fb290eb0d4f882cfd9f670cf9c1ebef37dfa322 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Sun, 12 Feb 2023 15:49:52 -0600 Subject: [PATCH 054/109] Fix remaining callmap functions --- dictionaries/CallMap.php | 122 ++++++------- dictionaries/CallMap_71_delta.php | 8 +- dictionaries/CallMap_72_delta.php | 12 +- dictionaries/CallMap_73_delta.php | 44 +++++ dictionaries/CallMap_74_delta.php | 16 ++ dictionaries/CallMap_80_delta.php | 168 +++++++++++++----- dictionaries/CallMap_81_delta.php | 58 +++--- dictionaries/CallMap_historical.php | 84 ++++----- .../Codebase/InternalCallMapHandlerTest.php | 72 -------- 9 files changed, 334 insertions(+), 250 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index 5044870ffdf..c3aaa8a3446 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -6761,7 +6761,7 @@ 'ldap_get_attributes' => ['array', 'ldap'=>'LDAP\Connection', 'entry'=>'LDAP\ResultEntry'], 'ldap_get_dn' => ['string|false', 'ldap'=>'LDAP\Connection', 'entry'=>'LDAP\ResultEntry'], 'ldap_get_entries' => ['array|false', 'ldap'=>'LDAP\Connection', 'result'=>'LDAP\Result'], -'ldap_get_option' => ['bool', 'ldap'=>'LDAP\Connection', 'option'=>'int', '&w_value='=>'array|string|int|null'], +'ldap_get_option' => ['bool', 'ldap'=>'LDAP\Connection', 'option'=>'int', '&w_value='=>'array|string|int'], 'ldap_get_values' => ['array|false', 'ldap'=>'LDAP\Connection', 'entry'=>'LDAP\ResultEntry', 'attribute'=>'string'], 'ldap_get_values_len' => ['array|false', 'ldap'=>'LDAP\Connection', 'entry'=>'LDAP\ResultEntry', 'attribute'=>'string'], 'ldap_list' => ['LDAP\Result|LDAP\Result[]|false', 'ldap'=>'LDAP\Connection|LDAP\Connection[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], @@ -7980,11 +7980,11 @@ 'msession_unlock' => ['int', 'session'=>'string', 'key'=>'int'], 'msg_get_queue' => ['SysvMessageQueue|false', 'key'=>'int', 'permissions='=>'int'], 'msg_queue_exists' => ['bool', 'key'=>'int'], -'msg_receive' => ['bool', 'queue'=>'resource', 'desired_message_type'=>'int', '&w_received_message_type'=>'int', 'max_message_size'=>'int', '&w_message'=>'mixed', 'unserialize='=>'bool', 'flags='=>'int', '&w_error_code='=>'int'], -'msg_remove_queue' => ['bool', 'queue'=>'resource'], -'msg_send' => ['bool', 'queue'=>'resource', 'message_type'=>'int', 'message'=>'mixed', 'serialize='=>'bool', 'blocking='=>'bool', '&w_error_code='=>'int'], -'msg_set_queue' => ['bool', 'queue'=>'resource', 'data'=>'array'], -'msg_stat_queue' => ['array', 'queue'=>'resource'], +'msg_receive' => ['bool', 'queue'=>'SysvMessageQueue', 'desired_message_type'=>'int', '&w_received_message_type'=>'int', 'max_message_size'=>'int', '&w_message'=>'mixed', 'unserialize='=>'bool', 'flags='=>'int', '&w_error_code='=>'int'], +'msg_remove_queue' => ['bool', 'queue'=>'SysvMessageQueue'], +'msg_send' => ['bool', 'queue'=>'SysvMessageQueue', 'message_type'=>'int', 'message'=>'mixed', 'serialize='=>'bool', 'blocking='=>'bool', '&w_error_code='=>'int'], +'msg_set_queue' => ['bool', 'queue'=>'SysvMessageQueue', 'data'=>'array'], +'msg_stat_queue' => ['array', 'queue'=>'SysvMessageQueue'], 'msgfmt_create' => ['?MessageFormatter', 'locale'=>'string', 'pattern'=>'string'], 'msgfmt_format' => ['string|false', 'formatter'=>'MessageFormatter', 'values'=>'array'], 'msgfmt_format_message' => ['string|false', 'locale'=>'string', 'pattern'=>'string', 'values'=>'array'], @@ -8788,7 +8788,7 @@ 'OAuth::setTimestamp' => ['mixed', 'timestamp'=>'string'], 'OAuth::setToken' => ['bool', 'token'=>'string', 'token_secret'=>'string'], 'OAuth::setVersion' => ['bool', 'version'=>'string'], -'oauth_get_sbs' => ['string', 'http_method'=>'string', 'uri'=>'string', 'request_parameters='=>'array'], +'oauth_get_sbs' => ['string', 'http_method'=>'string', 'uri'=>'string', 'parameters'=>'array'], 'oauth_urlencode' => ['string', 'uri'=>'string'], 'OAuthProvider::__construct' => ['void', 'params_array='=>'array'], 'OAuthProvider::addRequiredParameter' => ['bool', 'req_params'=>'string'], @@ -9650,9 +9650,10 @@ 'pg_escape_string' => ['string', 'connection'=>'\PgSql\Connection', 'string'=>'string'], 'pg_escape_string\'1' => ['string', 'connection'=>'string'], 'pg_exec' => ['\PgSql\Result|false', 'connection'=>'\PgSql\Connection', 'query'=>'string'], +'pg_exec\'1' => ['\PgSql\Result|false', 'connection'=>'string'], 'pg_execute' => ['\PgSql\Result|false', 'connection'=>'\PgSql\Connection', 'statement_name'=>'string', 'params'=>'array'], 'pg_execute\'1' => ['\PgSql\Result|false', 'connection'=>'string', 'statement_name'=>'array'], -'pg_fetch_all' => ['array', 'result'=>'\PgSql\Result', 'result_type='=>'int'], +'pg_fetch_all' => ['array', 'result'=>'\PgSql\Result', 'mode='=>'int'], 'pg_fetch_all_columns' => ['array', 'result'=>'\PgSql\Result', 'field='=>'int'], 'pg_fetch_array' => ['array|false', 'result'=>'\PgSql\Result', 'row='=>'?int', 'mode='=>'int'], 'pg_fetch_assoc' => ['array|false', 'result'=>'\PgSql\Result', 'row='=>'?int'], @@ -9672,9 +9673,9 @@ 'pg_field_type_oid' => ['int|string', 'result'=>'\PgSql\Result', 'field'=>'int'], 'pg_flush' => ['int|bool', 'connection'=>'\PgSql\Connection'], 'pg_free_result' => ['bool', 'result'=>'\PgSql\Result'], -'pg_get_notify' => ['array|false', 'result'=>'\PgSql\Result', 'mode='=>'int'], +'pg_get_notify' => ['array|false', 'connection'=>'\PgSql\Connection', 'mode='=>'int'], 'pg_get_pid' => ['int', 'connection'=>'\PgSql\Connection'], -'pg_get_result' => ['\PgSql\Result|false', 'connection='=>'\PgSql\Connection'], +'pg_get_result' => ['\PgSql\Result|false', 'connection'=>'\PgSql\Connection'], 'pg_host' => ['string', 'connection='=>'?\PgSql\Connection'], 'pg_insert' => ['\PgSql\Result|string|false', 'connection'=>'\PgSql\Connection', 'table_name'=>'string', 'values'=>'array', 'flags='=>'int'], 'pg_last_error' => ['string', 'connection='=>'?\PgSql\Connection'], @@ -9702,7 +9703,7 @@ 'pg_options' => ['string', 'connection='=>'?\PgSql\Connection'], 'pg_parameter_status' => ['string|false', 'connection'=>'\PgSql\Connection', 'name'=>'string'], 'pg_parameter_status\'1' => ['string|false', 'connection'=>'string'], -'pg_pconnect' => ['\PgSql\Connection|false', 'connection_string'=>'string', 'flags='=>'string', 'port='=>'string|int', 'options='=>'string', 'tty='=>'string', 'database='=>'string'], +'pg_pconnect' => ['\PgSql\Connection|false', 'connection_string'=>'string', 'flags='=>'int'], 'pg_ping' => ['bool', 'connection='=>'?\PgSql\Connection'], 'pg_port' => ['string', 'connection='=>'?\PgSql\Connection'], 'pg_prepare' => ['\PgSql\Result|false', 'connection'=>'\PgSql\Connection', 'statement_name'=>'string', 'query'=>'string'], @@ -9717,8 +9718,8 @@ 'pg_result_error_field' => ['string|false|null', 'result'=>'\PgSql\Result', 'field_code'=>'int'], 'pg_result_seek' => ['bool', 'result'=>'\PgSql\Result', 'row'=>'int'], 'pg_result_status' => ['string|int', 'result'=>'\PgSql\Result', 'mode='=>'int'], -'pg_select' => ['string|array|false', 'connection'=>'\PgSql\Connection', 'table_name'=>'string', 'assoc_array'=>'array', 'options='=>'int', 'result_type='=>'int'], -'pg_send_execute' => ['bool|int', 'connection'=>'\PgSql\Connection', 'query'=>'string', 'params'=>'array'], +'pg_select' => ['string|array|false', 'connection'=>'\PgSql\Connection', 'table_name'=>'string', 'conditions'=>'array', 'flags='=>'int', 'mode='=>'int'], +'pg_send_execute' => ['bool|int', 'connection'=>'\PgSql\Connection', 'statement_name'=>'string', 'params'=>'array'], 'pg_send_prepare' => ['bool|int', 'connection'=>'\PgSql\Connection', 'statement_name'=>'string', 'query'=>'string'], 'pg_send_query' => ['bool|int', 'connection'=>'\PgSql\Connection', 'query'=>'string'], 'pg_send_query_params' => ['bool|int', 'connection'=>'\PgSql\Connection', 'query'=>'string', 'params'=>'array'], @@ -9974,7 +9975,7 @@ 'Postal\Expand::expand_address' => ['string[]', 'address'=>'string', 'options='=>'array'], 'Postal\Parser::parse_address' => ['array', 'address'=>'string', 'options='=>'array'], 'pow' => ['float|int', 'num'=>'int|float', 'exponent'=>'int|float'], -'preg_filter' => ['null|string|string[]', 'pattern'=>'mixed', 'replacement'=>'mixed', 'subject'=>'mixed', 'limit='=>'int', '&w_count='=>'int'], +'preg_filter' => ['string|string[]|null', 'pattern'=>'string|string[]', 'replacement'=>'string|string[]', 'subject'=>'string|string[]', 'limit='=>'int', '&w_count='=>'int'], 'preg_grep' => ['array|false', 'pattern'=>'string', 'array'=>'array', 'flags='=>'int'], 'preg_last_error' => ['int'], 'preg_match' => ['int|false', 'pattern'=>'string', 'subject'=>'string', '&w_matches='=>'string[]', 'flags='=>'0', 'offset='=>'int'], @@ -9982,9 +9983,10 @@ 'preg_match_all' => ['int|false', 'pattern'=>'string', 'subject'=>'string', '&w_matches='=>'array', 'flags='=>'int', 'offset='=>'int'], 'preg_quote' => ['string', 'str'=>'string', 'delimiter='=>'?string'], 'preg_replace' => ['string|string[]|null', 'pattern'=>'string|array', 'replacement'=>'string|array', 'subject'=>'string|array', 'limit='=>'int', '&w_count='=>'int'], -'preg_replace_callback' => ['string|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int'], -'preg_replace_callback\'1' => ['string[]|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int'], -'preg_replace_callback_array' => ['string|string[]|null', 'pattern'=>'array', 'subject'=>'string|array', 'limit='=>'int', '&w_count='=>'int'], +'preg_replace_callback' => ['string|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int', 'flags='=>'int'], +'preg_replace_callback\'1' => ['string[]|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int', 'flags='=>'int'], +'preg_replace_callback_array' => ['string|null', 'pattern'=>'array', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int', 'flags='=>'int'], +'preg_replace_callback_array\'1' => ['string[]|null', 'pattern'=>'array', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int', 'flags='=>'int'], 'preg_split' => ['list|false', 'pattern'=>'string', 'subject'=>'string', 'limit'=>'int', 'flags='=>'null'], 'preg_split\'1' => ['list|list>|false', 'pattern'=>'string', 'subject'=>'string', 'limit='=>'int', 'flags='=>'int'], 'prev' => ['mixed', '&r_array'=>'array|object'], @@ -11477,7 +11479,7 @@ 'SAMMessage::body' => ['string'], 'SAMMessage::header' => ['object'], 'sapi_windows_cp_conv' => ['?string', 'in_codepage'=>'int|string', 'out_codepage'=>'int|string', 'subject'=>'string'], -'sapi_windows_cp_get' => ['int'], +'sapi_windows_cp_get' => ['int', 'kind='=>'string'], 'sapi_windows_cp_is_utf8' => ['bool'], 'sapi_windows_cp_set' => ['bool', 'codepage'=>'int'], 'sapi_windows_vt100_support' => ['bool', 'stream'=>'resource', 'enable='=>'?bool'], @@ -11857,12 +11859,12 @@ 'shapeObj::within' => ['int', 'shape2'=>'shapeObj'], 'shell_exec' => ['string|false|null', 'command'=>'string'], 'shm_attach' => ['SysvSharedMemory|false', 'key'=>'int', 'size='=>'?int', 'permissions='=>'int'], -'shm_detach' => ['bool', 'shm'=>'resource'], -'shm_get_var' => ['mixed', 'shm'=>'resource', 'key'=>'int'], -'shm_has_var' => ['bool', 'shm'=>'resource', 'key'=>'int'], -'shm_put_var' => ['bool', 'shm'=>'resource', 'key'=>'int', 'value'=>'mixed'], -'shm_remove' => ['bool', 'shm'=>'resource'], -'shm_remove_var' => ['bool', 'shm'=>'resource', 'key'=>'int'], +'shm_detach' => ['bool', 'shm'=>'SysvSharedMemory'], +'shm_get_var' => ['mixed', 'shm'=>'SysvSharedMemory', 'key'=>'int'], +'shm_has_var' => ['bool', 'shm'=>'SysvSharedMemory', 'key'=>'int'], +'shm_put_var' => ['bool', 'shm'=>'SysvSharedMemory', 'key'=>'int', 'value'=>'mixed'], +'shm_remove' => ['bool', 'shm'=>'SysvSharedMemory'], +'shm_remove_var' => ['bool', 'shm'=>'SysvSharedMemory', 'key'=>'int'], 'shmop_close' => ['void', 'shmop'=>'Shmop'], 'shmop_delete' => ['bool', 'shmop'=>'Shmop'], 'shmop_open' => ['Shmop|false', 'key'=>'int', 'mode'=>'string', 'permissions'=>'int', 'size'=>'int'], @@ -11916,21 +11918,21 @@ 'SNMP::getErrno' => ['int'], 'SNMP::getError' => ['string'], 'SNMP::getnext' => ['string|array|false', 'objectId'=>'string|array'], -'SNMP::set' => ['bool', 'objectId'=>'string|array', 'type'=>'string|array', 'value'=>'mixed'], +'SNMP::set' => ['bool', 'objectId'=>'string|array', 'type'=>'string|array', 'value'=>'string|array'], 'SNMP::setSecurity' => ['bool', 'securityLevel'=>'string', 'authProtocol='=>'string', 'authPassphrase='=>'string', 'privacyProtocol='=>'string', 'privacyPassphrase='=>'string', 'contextName='=>'string', 'contextEngineId='=>'string'], 'SNMP::walk' => ['array|false', 'objectId'=>'string', 'suffixAsKey='=>'bool', 'maxRepetitions='=>'int', 'nonRepeaters='=>'int'], 'snmp_get_quick_print' => ['bool'], 'snmp_get_valueretrieval' => ['int'], 'snmp_read_mib' => ['bool', 'filename'=>'string'], -'snmp_set_enum_print' => ['bool', 'enable'=>'int'], +'snmp_set_enum_print' => ['true', 'enable'=>'bool'], 'snmp_set_oid_numeric_print' => ['true', 'format'=>'int'], 'snmp_set_oid_output_format' => ['true', 'format'=>'int'], 'snmp_set_quick_print' => ['bool', 'enable'=>'bool'], -'snmp_set_valueretrieval' => ['bool', 'method='=>'int'], +'snmp_set_valueretrieval' => ['true', 'method'=>'int'], 'snmpget' => ['string|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], 'snmpgetnext' => ['string|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], 'snmprealwalk' => ['array|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], -'snmpset' => ['bool', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'type'=>'string', 'value'=>'mixed', 'timeout='=>'int', 'retries='=>'int'], +'snmpset' => ['bool', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'type'=>'string|string[]', 'value'=>'string|string[]', 'timeout='=>'int', 'retries='=>'int'], 'snmpwalk' => ['array|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], 'snmpwalkoid' => ['array|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], 'SoapClient::__call' => ['', 'function_name'=>'string', 'arguments'=>'array'], @@ -11981,39 +11983,39 @@ 'socket_addrinfo_connect' => ['Socket|false', 'address'=>'AddressInfo'], 'socket_addrinfo_explain' => ['array', 'address'=>'AddressInfo'], 'socket_addrinfo_lookup' => ['false|AddressInfo[]', 'host'=>'string', 'service='=>'?string', 'hints='=>'array'], -'socket_bind' => ['bool', 'socket'=>'Socket', 'addr'=>'string', 'port='=>'int'], +'socket_bind' => ['bool', 'socket'=>'Socket', 'address'=>'string', 'port='=>'int'], 'socket_clear_error' => ['void', 'socket='=>'?Socket'], 'socket_close' => ['void', 'socket'=>'Socket'], -'socket_cmsg_space' => ['int', 'level'=>'int', 'type'=>'int'], -'socket_connect' => ['bool', 'socket'=>'Socket', 'addr'=>'string', 'port='=>'int'], +'socket_cmsg_space' => ['?int', 'level'=>'int', 'type'=>'int', 'num='=>'int'], +'socket_connect' => ['bool', 'socket'=>'Socket', 'address'=>'string', 'port='=>'?int'], 'socket_create' => ['Socket|false', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int'], 'socket_create_listen' => ['Socket|false', 'port'=>'int', 'backlog='=>'int'], 'socket_create_pair' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_pair'=>'Socket[]'], 'socket_export_stream' => ['resource|false', 'socket'=>'Socket'], -'socket_get_option' => ['mixed|false', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int'], +'socket_get_option' => ['array|int|false', 'socket'=>'Socket', 'level'=>'int', 'option'=>'int'], 'socket_get_status' => ['array', 'stream'=>'Socket'], -'socket_getopt' => ['mixed', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int'], -'socket_getpeername' => ['bool', 'socket'=>'Socket', '&w_addr'=>'string', '&w_port='=>'int'], -'socket_getsockname' => ['bool', 'socket'=>'Socket', '&w_addr'=>'string', '&w_port='=>'int'], +'socket_getopt' => ['array|int|false', 'socket'=>'Socket', 'level'=>'int', 'option'=>'int'], +'socket_getpeername' => ['bool', 'socket'=>'Socket', '&w_address'=>'string', '&w_port='=>'int'], +'socket_getsockname' => ['bool', 'socket'=>'Socket', '&w_address'=>'string', '&w_port='=>'int'], 'socket_import_stream' => ['Socket|false', 'stream'=>'resource'], 'socket_last_error' => ['int', 'socket='=>'?Socket'], 'socket_listen' => ['bool', 'socket'=>'Socket', 'backlog='=>'int'], -'socket_read' => ['string|false', 'socket'=>'Socket', 'length'=>'int', 'type='=>'int'], -'socket_recv' => ['int|false', 'socket'=>'Socket', '&w_buf'=>'string', 'length'=>'int', 'flags'=>'int'], -'socket_recvfrom' => ['int|false', 'socket'=>'Socket', '&w_buf'=>'string', 'length'=>'int', 'flags'=>'int', '&w_name'=>'string', '&w_port='=>'int'], -'socket_recvmsg' => ['int|false', 'socket'=>'Socket', '&w_message'=>'string', 'flags='=>'int'], -'socket_select' => ['int|false', '&rw_read_fds'=>'Socket[]|null', '&rw_write_fds'=>'Socket[]|null', '&rw_except_fds'=>'Socket[]|null', 'tv_sec'=>'int|null', 'tv_usec='=>'int'], -'socket_send' => ['int|false', 'socket'=>'Socket', 'buf'=>'string', 'length'=>'int', 'flags'=>'int'], -'socket_sendmsg' => ['int|false', 'socket'=>'Socket', 'message'=>'array', 'flags'=>'int'], -'socket_sendto' => ['int|false', 'socket'=>'Socket', 'buf'=>'string', 'length'=>'int', 'flags'=>'int', 'addr'=>'string', 'port='=>'int'], +'socket_read' => ['string|false', 'socket'=>'Socket', 'length'=>'int', 'mode='=>'int'], +'socket_recv' => ['int|false', 'socket'=>'Socket', '&w_data'=>'string', 'length'=>'int', 'flags'=>'int'], +'socket_recvfrom' => ['int|false', 'socket'=>'Socket', '&w_data'=>'string', 'length'=>'int', 'flags'=>'int', '&w_address'=>'string', '&w_port='=>'int'], +'socket_recvmsg' => ['int|false', 'socket'=>'Socket', '&w_message'=>'array', 'flags='=>'int'], +'socket_select' => ['int|false', '&rw_read'=>'Socket[]|null', '&rw_write'=>'Socket[]|null', '&rw_except'=>'Socket[]|null', 'seconds'=>'int|null', 'microseconds='=>'int'], +'socket_send' => ['int|false', 'socket'=>'Socket', 'data'=>'string', 'length'=>'int', 'flags'=>'int'], +'socket_sendmsg' => ['int|false', 'socket'=>'Socket', 'message'=>'array', 'flags='=>'int'], +'socket_sendto' => ['int|false', 'socket'=>'Socket', 'data'=>'string', 'length'=>'int', 'flags'=>'int', 'address'=>'string', 'port='=>'?int'], 'socket_set_block' => ['bool', 'socket'=>'Socket'], -'socket_set_blocking' => ['bool', 'socket'=>'Socket', 'mode'=>'int'], +'socket_set_blocking' => ['bool', 'stream'=>'Socket', 'enable'=>'bool'], 'socket_set_nonblock' => ['bool', 'socket'=>'Socket'], -'socket_set_option' => ['bool', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int', 'optval'=>'int|string|array'], +'socket_set_option' => ['bool', 'socket'=>'Socket', 'level'=>'int', 'option'=>'int', 'value'=>'int|string|array'], 'socket_set_timeout' => ['bool', 'stream'=>'resource', 'seconds'=>'int', 'microseconds='=>'int'], -'socket_setopt' => ['void', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int', 'optval'=>'int|string|array'], -'socket_shutdown' => ['bool', 'socket'=>'Socket', 'how='=>'int'], -'socket_strerror' => ['string', 'errno'=>'int'], +'socket_setopt' => ['bool', 'socket'=>'Socket', 'level'=>'int', 'option'=>'int', 'value'=>'int|string|array'], +'socket_shutdown' => ['bool', 'socket'=>'Socket', 'mode='=>'int'], +'socket_strerror' => ['string', 'error_code'=>'int'], 'socket_write' => ['int|false', 'socket'=>'Socket', 'data'=>'string', 'length='=>'int|null'], 'socket_wsaprotocol_info_export' => ['string|false', 'socket'=>'Socket', 'process_id'=>'int'], 'socket_wsaprotocol_info_import' => ['Socket|false', 'info_id'=>'string'], @@ -12049,14 +12051,14 @@ 'sodium_crypto_box_seal_open' => ['string|false', 'ciphertext'=>'string', 'key_pair'=>'string'], 'sodium_crypto_box_secretkey' => ['string', 'key_pair'=>'string'], 'sodium_crypto_box_seed_keypair' => ['string', 'seed'=>'string'], -'sodium_crypto_generichash' => ['string', 'message'=>'string', 'key='=>'?string', 'length='=>'?int'], -'sodium_crypto_generichash_final' => ['string', '&state'=>'string', 'length='=>'?int'], -'sodium_crypto_generichash_init' => ['string', 'key='=>'?string', 'length='=>'?int'], +'sodium_crypto_generichash' => ['string', 'message'=>'string', 'key='=>'string', 'length='=>'int'], +'sodium_crypto_generichash_final' => ['string', '&state'=>'string', 'length='=>'int'], +'sodium_crypto_generichash_init' => ['string', 'key='=>'string', 'length='=>'int'], 'sodium_crypto_generichash_keygen' => ['non-empty-string'], -'sodium_crypto_generichash_update' => ['bool', '&rw_state'=>'string', 'string'=>'string'], +'sodium_crypto_generichash_update' => ['true', '&rw_state'=>'string', 'message'=>'string'], 'sodium_crypto_kdf_derive_from_key' => ['string', 'subkey_length'=>'int', 'subkey_id'=>'int', 'context'=>'string', 'key'=>'string'], 'sodium_crypto_kdf_keygen' => ['non-empty-string'], -'sodium_crypto_kx_client_session_keys' => ['array', 'client_keypair'=>'string', 'server_key'=>'string'], +'sodium_crypto_kx_client_session_keys' => ['array', 'client_key_pair'=>'string', 'server_key'=>'string'], 'sodium_crypto_kx_keypair' => ['string'], 'sodium_crypto_kx_publickey' => ['string', 'key_pair'=>'string'], 'sodium_crypto_kx_secretkey' => ['string', 'key_pair'=>'string'], @@ -12079,7 +12081,7 @@ 'sodium_crypto_secretstream_xchacha20poly1305_keygen' => ['non-empty-string'], 'sodium_crypto_secretstream_xchacha20poly1305_pull' => ['array', '&r_state'=>'string', 'ciphertext'=>'string', 'additional_data='=>'string'], 'sodium_crypto_secretstream_xchacha20poly1305_push' => ['string', '&w_state'=>'string', 'message'=>'string', 'additional_data='=>'string', 'tag='=>'int'], -'sodium_crypto_secretstream_xchacha20poly1305_rekey' => ['void', 'state'=>'string'], +'sodium_crypto_secretstream_xchacha20poly1305_rekey' => ['void', '&w_state'=>'string'], 'sodium_crypto_shorthash' => ['string', 'message'=>'string', 'key'=>'string'], 'sodium_crypto_shorthash_keygen' => ['non-empty-string'], 'sodium_crypto_sign' => ['string', 'message'=>'string', 'secret_key'=>'string'], @@ -13592,7 +13594,7 @@ 'substr' => ['string', 'string'=>'string', 'offset'=>'int', 'length='=>'?int'], 'substr_compare' => ['int', 'haystack'=>'string', 'needle'=>'string', 'offset'=>'int', 'length='=>'?int', 'case_insensitive='=>'bool'], 'substr_count' => ['int', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'length='=>'?int'], -'substr_replace' => ['string|string[]', 'string'=>'string|string[]', 'replace'=>'mixed', 'offset'=>'mixed', 'length='=>'mixed'], +'substr_replace' => ['string|string[]', 'string'=>'string|string[]', 'replace'=>'string|string[]', 'offset'=>'int|int[]', 'length='=>'int|int[]|null'], 'suhosin_encrypt_cookie' => ['string|false', 'name'=>'string', 'value'=>'string'], 'suhosin_get_raw_cookies' => ['array'], 'SVM::__construct' => ['void'], @@ -14292,7 +14294,7 @@ 'tidy_get_release' => ['string'], 'tidy_get_root' => ['?tidyNode', 'tidy'=>'tidy'], 'tidy_get_status' => ['int', 'tidy'=>'tidy'], -'tidy_getopt' => ['mixed', 'tidy'=>'string', 'option'=>'tidy'], +'tidy_getopt' => ['string|int|bool', 'tidy'=>'tidy', 'option'=>'string'], 'tidy_is_xhtml' => ['bool', 'tidy'=>'tidy'], 'tidy_is_xml' => ['bool', 'tidy'=>'tidy'], 'tidy_load_config' => ['void', 'filename'=>'string', 'encoding'=>'string'], @@ -16191,8 +16193,8 @@ 'Yaf_View_Simple::getScriptPath' => ['string'], 'Yaf_View_Simple::render' => ['string', 'tpl'=>'string', 'tpl_vars='=>'array'], 'Yaf_View_Simple::setScriptPath' => ['bool', 'template_dir'=>'string'], -'yaml_emit' => ['string', 'data'=>'mixed', 'encoding='=>'int', 'linebreak='=>'int'], -'yaml_emit_file' => ['bool', 'filename'=>'string', 'data'=>'mixed', 'encoding='=>'int', 'linebreak='=>'int'], +'yaml_emit' => ['string', 'data'=>'mixed', 'encoding='=>'int', 'linebreak='=>'int', 'callbacks='=>'array'], +'yaml_emit_file' => ['bool', 'filename'=>'string', 'data'=>'mixed', 'encoding='=>'int', 'linebreak='=>'int', 'callbacks='=>'array'], 'yaml_parse' => ['mixed|false', 'input'=>'string', 'pos='=>'int', '&w_ndocs='=>'int', 'callbacks='=>'array'], 'yaml_parse_file' => ['mixed|false', 'filename'=>'string', 'pos='=>'int', '&w_ndocs='=>'int', 'callbacks='=>'array'], 'yaml_parse_url' => ['mixed|false', 'url'=>'string', 'pos='=>'int', '&w_ndocs='=>'int', 'callbacks='=>'array'], @@ -16345,7 +16347,7 @@ 'ZendAPI_Queue::updateJob' => ['int', '&job'=>'Job'], 'ZendAPI_Queue::zendapi_queue' => ['ZendAPI_Queue', 'queue_url'=>'string'], 'zip_close' => ['void', 'zip'=>'resource'], -'zip_entry_close' => ['bool', 'zip_ent'=>'resource'], +'zip_entry_close' => ['bool', 'zip_entry'=>'resource'], 'zip_entry_compressedsize' => ['int', 'zip_entry'=>'resource'], 'zip_entry_compressionmethod' => ['string', 'zip_entry'=>'resource'], 'zip_entry_filesize' => ['int', 'zip_entry'=>'resource'], @@ -16405,7 +16407,7 @@ 'ZipArchive::unchangeIndex' => ['bool', 'index'=>'int'], 'ZipArchive::unchangeName' => ['bool', 'name'=>'string'], 'zlib_decode' => ['string|false', 'data'=>'string', 'max_length='=>'int'], -'zlib_encode' => ['string', 'data'=>'string', 'encoding'=>'int', 'level='=>'string|int'], +'zlib_encode' => ['string|false', 'data'=>'string', 'encoding'=>'int', 'level='=>'int'], 'zlib_get_coding_type' => ['string|false'], 'ZMQ::__construct' => ['void'], 'ZMQContext::__construct' => ['void', 'io_threads='=>'int', 'is_persistent='=>'bool'], diff --git a/dictionaries/CallMap_71_delta.php b/dictionaries/CallMap_71_delta.php index de49f6af698..163e60c74ec 100644 --- a/dictionaries/CallMap_71_delta.php +++ b/dictionaries/CallMap_71_delta.php @@ -27,7 +27,7 @@ 'pcntl_async_signals' => ['bool', 'enable='=>'bool'], 'pcntl_signal_get_handler' => ['int|string', 'signal'=>'int'], 'sapi_windows_cp_conv' => ['?string', 'in_codepage'=>'int|string', 'out_codepage'=>'int|string', 'subject'=>'string'], - 'sapi_windows_cp_get' => ['int'], + 'sapi_windows_cp_get' => ['int', 'kind='=>'string'], 'sapi_windows_cp_is_utf8' => ['bool'], 'sapi_windows_cp_set' => ['bool', 'codepage'=>'int'], 'session_create_id' => ['string', 'prefix='=>'string'], @@ -56,11 +56,11 @@ ], 'pg_fetch_all' => [ 'old' => ['array', 'result'=>'resource'], - 'new' => ['array', 'result'=>'resource', 'result_type='=>'int'], + 'new' => ['array', 'result'=>'resource', 'mode='=>'int'], ], 'pg_select' => [ - 'old' => ['string|array|false', 'connection'=>'resource', 'table_name'=>'string', 'assoc_array'=>'array', 'options='=>'int'], - 'new' => ['string|array|false', 'connection'=>'resource', 'table_name'=>'string', 'assoc_array'=>'array', 'options='=>'int', 'result_type='=>'int'], + 'old' => ['string|array|false', 'connection'=>'resource', 'table_name'=>'string', 'conditions'=>'array', 'flags='=>'int'], + 'new' => ['string|array|false', 'connection'=>'resource', 'table_name'=>'string', 'conditions'=>'array', 'flags='=>'int', 'mode='=>'int'], ], 'timezone_identifiers_list' => [ 'old' => ['list|false', 'timezoneGroup='=>'int', 'countryCode='=>'string'], diff --git a/dictionaries/CallMap_72_delta.php b/dictionaries/CallMap_72_delta.php index ab30febce89..1956ee7cec0 100644 --- a/dictionaries/CallMap_72_delta.php +++ b/dictionaries/CallMap_72_delta.php @@ -75,14 +75,14 @@ 'sodium_crypto_box_seal_open' => ['string|false', 'ciphertext'=>'string', 'key_pair'=>'string'], 'sodium_crypto_box_secretkey' => ['string', 'key_pair'=>'string'], 'sodium_crypto_box_seed_keypair' => ['string', 'seed'=>'string'], - 'sodium_crypto_generichash' => ['string', 'message'=>'string', 'key='=>'?string', 'length='=>'?int'], - 'sodium_crypto_generichash_final' => ['string', '&state'=>'string', 'length='=>'?int'], - 'sodium_crypto_generichash_init' => ['string', 'key='=>'?string', 'length='=>'?int'], + 'sodium_crypto_generichash' => ['string', 'message'=>'string', 'key='=>'string', 'length='=>'int'], + 'sodium_crypto_generichash_final' => ['string', '&state'=>'string', 'length='=>'int'], + 'sodium_crypto_generichash_init' => ['string', 'key='=>'string', 'length='=>'int'], 'sodium_crypto_generichash_keygen' => ['non-empty-string'], - 'sodium_crypto_generichash_update' => ['bool', '&rw_state'=>'string', 'string'=>'string'], + 'sodium_crypto_generichash_update' => ['true', '&rw_state'=>'string', 'message'=>'string'], 'sodium_crypto_kdf_derive_from_key' => ['string', 'subkey_length'=>'int', 'subkey_id'=>'int', 'context'=>'string', 'key'=>'string'], 'sodium_crypto_kdf_keygen' => ['non-empty-string'], - 'sodium_crypto_kx_client_session_keys' => ['array', 'client_keypair'=>'string', 'server_key'=>'string'], + 'sodium_crypto_kx_client_session_keys' => ['array', 'client_key_pair'=>'string', 'server_key'=>'string'], 'sodium_crypto_kx_keypair' => ['string'], 'sodium_crypto_kx_publickey' => ['string', 'key_pair'=>'string'], 'sodium_crypto_kx_secretkey' => ['string', 'key_pair'=>'string'], @@ -105,7 +105,7 @@ 'sodium_crypto_secretstream_xchacha20poly1305_keygen' => ['non-empty-string'], 'sodium_crypto_secretstream_xchacha20poly1305_pull' => ['array', '&r_state'=>'string', 'ciphertext'=>'string', 'additional_data='=>'string'], 'sodium_crypto_secretstream_xchacha20poly1305_push' => ['string', '&w_state'=>'string', 'message'=>'string', 'additional_data='=>'string', 'tag='=>'int'], - 'sodium_crypto_secretstream_xchacha20poly1305_rekey' => ['void', 'state'=>'string'], + 'sodium_crypto_secretstream_xchacha20poly1305_rekey' => ['void', '&w_state'=>'string'], 'sodium_crypto_shorthash' => ['string', 'message'=>'string', 'key'=>'string'], 'sodium_crypto_shorthash_keygen' => ['non-empty-string'], 'sodium_crypto_sign' => ['string', 'message'=>'string', 'secret_key'=>'string'], diff --git a/dictionaries/CallMap_73_delta.php b/dictionaries/CallMap_73_delta.php index 91002d47056..d33ad5c5fa5 100644 --- a/dictionaries/CallMap_73_delta.php +++ b/dictionaries/CallMap_73_delta.php @@ -62,10 +62,54 @@ 'old' => ['int', 'scale'=>'int'], 'new' => ['int', 'scale='=>'int'], ], + 'ldap_compare' => [ + 'old' => ['bool|int', 'ldap'=>'resource', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string'], + 'new' => ['bool|int', 'ldap'=>'resource', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string', 'controls='=>'array'], + ], + 'ldap_delete' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'controls='=>'array'], + ], 'ldap_exop_passwd' => [ 'old' => ['bool|string', 'ldap'=>'resource', 'user='=>'string', 'old_password='=>'string', 'new_password='=>'string'], 'new' => ['bool|string', 'ldap'=>'resource', 'user='=>'string', 'old_password='=>'string', 'new_password='=>'string', '&w_controls='=>'array'], ], + 'ldap_list' => [ + 'old' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int'], + 'new' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'array'], + ], + 'ldap_mod_add' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], + ], + 'ldap_mod_del' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], + ], + 'ldap_mod_replace' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], + ], + 'ldap_modify' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], + ], + 'ldap_modify_batch' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'modifications_info'=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'modifications_info'=>'array', 'controls='=>'array'], + ], + 'ldap_read' => [ + 'old' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int'], + 'new' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'array'], + ], + 'ldap_rename' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool', 'controls='=>'array'], + ], + 'ldap_search' => [ + 'old' => ['resource|false', 'ldap'=>'resource|resource[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int'], + 'new' => ['resource|false', 'ldap'=>'resource|resource[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'array'], + ], ], 'removed' => [ ], diff --git a/dictionaries/CallMap_74_delta.php b/dictionaries/CallMap_74_delta.php index 01127069746..dbd4408f49d 100644 --- a/dictionaries/CallMap_74_delta.php +++ b/dictionaries/CallMap_74_delta.php @@ -53,6 +53,22 @@ 'old' => ['bool', 'hash'=>'string', 'algo'=>'int', 'options='=>'array'], 'new' => ['bool', 'hash'=>'string', 'algo'=>'int|string|null', 'options='=>'array'], ], + 'preg_replace_callback' => [ + 'old' => ['string|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int'], + 'new' => ['string|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int', 'flags='=>'int'], + ], + 'preg_replace_callback\'1' => [ + 'old' => ['string[]|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int'], + 'new' => ['string[]|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int', 'flags='=>'int'], + ], + 'preg_replace_callback_array' => [ + 'old' => ['string|null', 'pattern'=>'array', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int'], + 'new' => ['string|null', 'pattern'=>'array', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int', 'flags='=>'int'], + ], + 'preg_replace_callback_array\'1' => [ + 'old' => ['string[]|null', 'pattern'=>'array', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int'], + 'new' => ['string[]|null', 'pattern'=>'array', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int', 'flags='=>'int'], + ], 'proc_open' => [ 'old' => ['resource|false', 'command'=>'string', 'descriptor_spec'=>'array', '&pipes'=>'resource[]', 'cwd='=>'?string', 'env_vars='=>'?array', 'options='=>'?array'], 'new' => ['resource|false', 'command'=>'string|array', 'descriptor_spec'=>'array', '&pipes'=>'resource[]', 'cwd='=>'?string', 'env_vars='=>'?array', 'options='=>'?array'], diff --git a/dictionaries/CallMap_80_delta.php b/dictionaries/CallMap_80_delta.php index cb1d9a10060..2bebb5bac2e 100644 --- a/dictionaries/CallMap_80_delta.php +++ b/dictionaries/CallMap_80_delta.php @@ -1341,6 +1341,14 @@ 'old' => ['resource|false', 'ldap'=>'resource', 'dn='=>'string|null', 'password='=>'string|null', 'controls='=>'array'], 'new' => ['resource|false', 'ldap'=>'resource', 'dn='=>'string|null', 'password='=>'string|null', 'controls='=>'?array'], ], + 'ldap_compare' => [ + 'old' => ['bool|int', 'ldap'=>'resource', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string', 'controls='=>'array'], + 'new' => ['bool|int', 'ldap'=>'resource', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string', 'controls='=>'?array'], + ], + 'ldap_delete' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'controls='=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'controls='=>'?array'], + ], 'ldap_delete_ext' => [ 'old' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'controls='=>'array'], 'new' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'controls='=>'?array'], @@ -1349,22 +1357,58 @@ 'old' => ['bool|string', 'ldap'=>'resource', 'user='=>'string', 'old_password='=>'string', 'new_password='=>'string', '&w_controls='=>'array'], 'new' => ['bool|string', 'ldap'=>'resource', 'user='=>'string', 'old_password='=>'string', 'new_password='=>'string', '&w_controls='=>'array|null'], ], + 'ldap_list' => [ + 'old' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'array'], + 'new' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], + ], 'ldap_rename_ext' => [ 'old' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool', 'controls='=>'array'], 'new' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool', 'controls='=>'?array'], ], + 'ldap_mod_add' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], + ], 'ldap_mod_add_ext' => [ 'old' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], 'new' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], + 'ldap_mod_del' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], + ], 'ldap_mod_del_ext' => [ 'old' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], 'new' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], + 'ldap_mod_replace' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], + ], 'ldap_mod_replace_ext' => [ 'old' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], 'new' => ['resource|false', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], + 'ldap_modify' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], + ], + 'ldap_modify_batch' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'modifications_info'=>'array', 'controls='=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'modifications_info'=>'array', 'controls='=>'?array'], + ], + 'ldap_read' => [ + 'old' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'array'], + 'new' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], + ], + 'ldap_rename' => [ + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool', 'controls='=>'array'], + 'new' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool', 'controls='=>'?array'], + ], + 'ldap_search' => [ + 'old' => ['resource|false', 'ldap'=>'resource|resource[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'array'], + 'new' => ['resource|false', 'ldap'=>'resource|resource[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], + ], 'ldap_set_rebind_proc' => [ 'old' => ['bool', 'ldap'=>'resource', 'callback'=>'callable'], 'new' => ['bool', 'ldap'=>'resource', 'callback'=>'?callable'], @@ -1617,6 +1661,26 @@ 'old' => ['resource|false', 'key'=>'int', 'permissions='=>'int'], 'new' => ['SysvMessageQueue|false', 'key'=>'int', 'permissions='=>'int'], ], + 'msg_receive' => [ + 'old' => ['bool', 'queue'=>'resource', 'desired_message_type'=>'int', '&w_received_message_type'=>'int', 'max_message_size'=>'int', '&w_message'=>'mixed', 'unserialize='=>'bool', 'flags='=>'int', '&w_error_code='=>'int'], + 'new' => ['bool', 'queue'=>'SysvMessageQueue', 'desired_message_type'=>'int', '&w_received_message_type'=>'int', 'max_message_size'=>'int', '&w_message'=>'mixed', 'unserialize='=>'bool', 'flags='=>'int', '&w_error_code='=>'int'], + ], + 'msg_remove_queue' => [ + 'old' => ['bool', 'queue'=>'resource'], + 'new' => ['bool', 'queue'=>'SysvMessageQueue'], + ], + 'msg_send' => [ + 'old' => ['bool', 'queue'=>'resource', 'message_type'=>'int', 'message'=>'mixed', 'serialize='=>'bool', 'blocking='=>'bool', '&w_error_code='=>'int'], + 'new' => ['bool', 'queue'=>'SysvMessageQueue', 'message_type'=>'int', 'message'=>'mixed', 'serialize='=>'bool', 'blocking='=>'bool', '&w_error_code='=>'int'], + ], + 'msg_set_queue' => [ + 'old' => ['bool', 'queue'=>'resource', 'data'=>'array'], + 'new' => ['bool', 'queue'=>'SysvMessageQueue', 'data'=>'array'], + ], + 'msg_stat_queue' => [ + 'old' => ['array', 'queue'=>'resource'], + 'new' => ['array', 'queue'=>'SysvMessageQueue'], + ], 'mysqli::__construct' => [ 'old' => ['void', 'hostname='=>'string', 'username='=>'string', 'password='=>'string', 'database='=>'string', 'port='=>'int', 'socket='=>'string'], 'new' => ['void', 'hostname='=>'string|null', 'username='=>'string|null', 'password='=>'string|null', 'database='=>'string|null', 'port='=>'int|null', 'socket='=>'string|null'], @@ -2005,6 +2069,30 @@ 'old' => ['resource|false', 'key'=>'int', 'size='=>'int', 'permissions='=>'int'], 'new' => ['SysvSharedMemory|false', 'key'=>'int', 'size='=>'?int', 'permissions='=>'int'], ], + 'shm_detach' => [ + 'old' => ['bool', 'shm'=>'resource'], + 'new' => ['bool', 'shm'=>'SysvSharedMemory'], + ], + 'shm_get_var' => [ + 'old' => ['mixed', 'shm'=>'resource', 'key'=>'int'], + 'new' => ['mixed', 'shm'=>'SysvSharedMemory', 'key'=>'int'], + ], + 'shm_has_var' => [ + 'old' => ['bool', 'shm'=>'resource', 'key'=>'int'], + 'new' => ['bool', 'shm'=>'SysvSharedMemory', 'key'=>'int'], + ], + 'shm_put_var' => [ + 'old' => ['bool', 'shm'=>'resource', 'key'=>'int', 'value'=>'mixed'], + 'new' => ['bool', 'shm'=>'SysvSharedMemory', 'key'=>'int', 'value'=>'mixed'], + ], + 'shm_remove' => [ + 'old' => ['bool', 'shm'=>'resource'], + 'new' => ['bool', 'shm'=>'SysvSharedMemory'], + ], + 'shm_remove_var' => [ + 'old' => ['bool', 'shm'=>'resource', 'key'=>'int'], + 'new' => ['bool', 'shm'=>'SysvSharedMemory', 'key'=>'int'], + ], 'shmop_close' => [ 'old' => ['void', 'shmop'=>'resource'], 'new' => ['void', 'shmop'=>'Shmop'], @@ -2054,8 +2142,8 @@ 'new' => ['false|AddressInfo[]', 'host'=>'string', 'service='=>'?string', 'hints='=>'array'], ], 'socket_bind' => [ - 'old' => ['bool', 'socket'=>'resource', 'addr'=>'string', 'port='=>'int'], - 'new' => ['bool', 'socket'=>'Socket', 'addr'=>'string', 'port='=>'int'], + 'old' => ['bool', 'socket'=>'resource', 'address'=>'string', 'port='=>'int'], + 'new' => ['bool', 'socket'=>'Socket', 'address'=>'string', 'port='=>'int'], ], 'socket_clear_error' => [ 'old' => ['void', 'socket='=>'resource'], @@ -2066,8 +2154,8 @@ 'new' => ['void', 'socket'=>'Socket'], ], 'socket_connect' => [ - 'old' => ['bool', 'socket'=>'resource', 'addr'=>'string', 'port='=>'int'], - 'new' => ['bool', 'socket'=>'Socket', 'addr'=>'string', 'port='=>'int'], + 'old' => ['bool', 'socket'=>'resource', 'address'=>'string', 'port='=>'int'], + 'new' => ['bool', 'socket'=>'Socket', 'address'=>'string', 'port='=>'?int'], ], 'socket_create' => [ 'old' => ['resource|false', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int'], @@ -2086,24 +2174,24 @@ 'new' => ['resource|false', 'socket'=>'Socket'], ], 'socket_get_option' => [ - 'old' => ['mixed|false', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int'], - 'new' => ['mixed|false', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int'], + 'old' => ['array|int|false', 'socket'=>'resource', 'level'=>'int', 'option'=>'int'], + 'new' => ['array|int|false', 'socket'=>'Socket', 'level'=>'int', 'option'=>'int'], ], 'socket_get_status' => [ 'old' => ['array', 'stream'=>'resource'], 'new' => ['array', 'stream'=>'Socket'], ], 'socket_getopt' => [ - 'old' => ['mixed', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int'], - 'new' => ['mixed', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int'], + 'old' => ['array|int|false', 'socket'=>'resource', 'level'=>'int', 'option'=>'int'], + 'new' => ['array|int|false', 'socket'=>'Socket', 'level'=>'int', 'option'=>'int'], ], 'socket_getpeername' => [ - 'old' => ['bool', 'socket'=>'resource', '&w_addr'=>'string', '&w_port='=>'int'], - 'new' => ['bool', 'socket'=>'Socket', '&w_addr'=>'string', '&w_port='=>'int'], + 'old' => ['bool', 'socket'=>'resource', '&w_address'=>'string', '&w_port='=>'int'], + 'new' => ['bool', 'socket'=>'Socket', '&w_address'=>'string', '&w_port='=>'int'], ], 'socket_getsockname' => [ - 'old' => ['bool', 'socket'=>'resource', '&w_addr'=>'string', '&w_port='=>'int'], - 'new' => ['bool', 'socket'=>'Socket', '&w_addr'=>'string', '&w_port='=>'int'], + 'old' => ['bool', 'socket'=>'resource', '&w_address'=>'string', '&w_port='=>'int'], + 'new' => ['bool', 'socket'=>'Socket', '&w_address'=>'string', '&w_port='=>'int'], ], 'socket_import_stream' => [ 'old' => ['resource|false', 'stream'=>'resource'], @@ -2118,68 +2206,64 @@ 'new' => ['bool', 'socket'=>'Socket', 'backlog='=>'int'], ], 'socket_read' => [ - 'old' => ['string|false', 'socket'=>'resource', 'length'=>'int', 'type='=>'int'], - 'new' => ['string|false', 'socket'=>'Socket', 'length'=>'int', 'type='=>'int'], + 'old' => ['string|false', 'socket'=>'resource', 'length'=>'int', 'mode='=>'int'], + 'new' => ['string|false', 'socket'=>'Socket', 'length'=>'int', 'mode='=>'int'], ], 'socket_recv' => [ - 'old' => ['int|false', 'socket'=>'resource', '&w_buf'=>'string', 'length'=>'int', 'flags'=>'int'], - 'new' => ['int|false', 'socket'=>'Socket', '&w_buf'=>'string', 'length'=>'int', 'flags'=>'int'], + 'old' => ['int|false', 'socket'=>'resource', '&w_data'=>'string', 'length'=>'int', 'flags'=>'int'], + 'new' => ['int|false', 'socket'=>'Socket', '&w_data'=>'string', 'length'=>'int', 'flags'=>'int'], ], 'socket_recvfrom' => [ - 'old' => ['int|false', 'socket'=>'resource', '&w_buf'=>'string', 'length'=>'int', 'flags'=>'int', '&w_name'=>'string', '&w_port='=>'int'], - 'new' => ['int|false', 'socket'=>'Socket', '&w_buf'=>'string', 'length'=>'int', 'flags'=>'int', '&w_name'=>'string', '&w_port='=>'int'], + 'old' => ['int|false', 'socket'=>'resource', '&w_data'=>'string', 'length'=>'int', 'flags'=>'int', '&w_address'=>'string', '&w_port='=>'int'], + 'new' => ['int|false', 'socket'=>'Socket', '&w_data'=>'string', 'length'=>'int', 'flags'=>'int', '&w_address'=>'string', '&w_port='=>'int'], ], 'socket_recvmsg' => [ - 'old' => ['int|false', 'socket'=>'resource', '&w_message'=>'string', 'flags='=>'int'], - 'new' => ['int|false', 'socket'=>'Socket', '&w_message'=>'string', 'flags='=>'int'], + 'old' => ['int|false', 'socket'=>'resource', '&w_message'=>'array', 'flags='=>'int'], + 'new' => ['int|false', 'socket'=>'Socket', '&w_message'=>'array', 'flags='=>'int'], ], 'socket_select' => [ - 'old' => ['int|false', '&rw_read_fds'=>'resource[]|null', '&rw_write_fds'=>'resource[]|null', '&rw_except_fds'=>'resource[]|null', 'tv_sec'=>'int|null', 'tv_usec='=>'int'], - 'new' => ['int|false', '&rw_read_fds'=>'Socket[]|null', '&rw_write_fds'=>'Socket[]|null', '&rw_except_fds'=>'Socket[]|null', 'tv_sec'=>'int|null', 'tv_usec='=>'int'], + 'old' => ['int|false', '&rw_read'=>'resource[]|null', '&rw_write'=>'resource[]|null', '&rw_except'=>'resource[]|null', 'seconds'=>'int|null', 'microseconds='=>'int'], + 'new' => ['int|false', '&rw_read'=>'Socket[]|null', '&rw_write'=>'Socket[]|null', '&rw_except'=>'Socket[]|null', 'seconds'=>'int|null', 'microseconds='=>'int'], ], 'socket_send' => [ - 'old' => ['int|false', 'socket'=>'resource', 'buf'=>'string', 'length'=>'int', 'flags'=>'int'], - 'new' => ['int|false', 'socket'=>'Socket', 'buf'=>'string', 'length'=>'int', 'flags'=>'int'], + 'old' => ['int|false', 'socket'=>'resource', 'data'=>'string', 'length'=>'int', 'flags'=>'int'], + 'new' => ['int|false', 'socket'=>'Socket', 'data'=>'string', 'length'=>'int', 'flags'=>'int'], ], 'socket_sendmsg' => [ - 'old' => ['int|false', 'socket'=>'resource', 'message'=>'array', 'flags'=>'int'], - 'new' => ['int|false', 'socket'=>'Socket', 'message'=>'array', 'flags'=>'int'], + 'old' => ['int|false', 'socket'=>'resource', 'message'=>'array', 'flags='=>'int'], + 'new' => ['int|false', 'socket'=>'Socket', 'message'=>'array', 'flags='=>'int'], ], 'socket_sendto' => [ - 'old' => ['int|false', 'socket'=>'resource', 'buf'=>'string', 'length'=>'int', 'flags'=>'int', 'addr'=>'string', 'port='=>'int'], - 'new' => ['int|false', 'socket'=>'Socket', 'buf'=>'string', 'length'=>'int', 'flags'=>'int', 'addr'=>'string', 'port='=>'int'], + 'old' => ['int|false', 'socket'=>'resource', 'data'=>'string', 'length'=>'int', 'flags'=>'int', 'address'=>'string', 'port='=>'int'], + 'new' => ['int|false', 'socket'=>'Socket', 'data'=>'string', 'length'=>'int', 'flags'=>'int', 'address'=>'string', 'port='=>'?int'], ], 'socket_set_block' => [ 'old' => ['bool', 'socket'=>'resource'], 'new' => ['bool', 'socket'=>'Socket'], ], 'socket_set_blocking' => [ - 'old' => ['bool', 'socket'=>'resource', 'mode'=>'int'], - 'new' => ['bool', 'socket'=>'Socket', 'mode'=>'int'], + 'old' => ['bool', 'stream'=>'resource', 'enable'=>'bool'], + 'new' => ['bool', 'stream'=>'Socket', 'enable'=>'bool'], ], 'socket_set_nonblock' => [ 'old' => ['bool', 'socket'=>'resource'], 'new' => ['bool', 'socket'=>'Socket'], ], 'socket_set_option' => [ - 'old' => ['bool', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int', 'optval'=>'int|string|array'], - 'new' => ['bool', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int', 'optval'=>'int|string|array'], + 'old' => ['bool', 'socket'=>'resource', 'level'=>'int', 'option'=>'int', 'value'=>'int|string|array'], + 'new' => ['bool', 'socket'=>'Socket', 'level'=>'int', 'option'=>'int', 'value'=>'int|string|array'], ], 'socket_set_timeout' => [ 'old' => ['bool', 'stream'=>'resource', 'seconds'=>'int', 'microseconds='=>'int'], 'new' => ['bool', 'stream'=>'resource', 'seconds'=>'int', 'microseconds='=>'int'], ], 'socket_setopt' => [ - 'old' => ['void', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int', 'optval'=>'int|string|array'], - 'new' => ['void', 'socket'=>'Socket', 'level'=>'int', 'optname'=>'int', 'optval'=>'int|string|array'], + 'old' => ['bool', 'socket'=>'resource', 'level'=>'int', 'option'=>'int', 'value'=>'int|string|array'], + 'new' => ['bool', 'socket'=>'Socket', 'level'=>'int', 'option'=>'int', 'value'=>'int|string|array'], ], 'socket_shutdown' => [ - 'old' => ['bool', 'socket'=>'resource', 'how='=>'int'], - 'new' => ['bool', 'socket'=>'Socket', 'how='=>'int'], - ], - 'socket_strerror' => [ - 'old' => ['string', 'errno'=>'int'], - 'new' => ['string', 'errno'=>'int'], + 'old' => ['bool', 'socket'=>'resource', 'mode='=>'int'], + 'new' => ['bool', 'socket'=>'Socket', 'mode='=>'int'], ], 'socket_write' => [ 'old' => ['int|false', 'socket'=>'resource', 'data'=>'string', 'length='=>'int'], @@ -2309,6 +2393,10 @@ 'old' => ['string|false', 'string'=>'string', 'offset'=>'int', 'length='=>'int'], 'new' => ['string', 'string'=>'string', 'offset'=>'int', 'length='=>'?int'], ], + 'substr_replace' => [ + 'old' => ['string|string[]', 'string'=>'string|string[]', 'replace'=>'string|string[]', 'offset'=>'int|int[]', 'length='=>'int|int[]'], + 'new' => ['string|string[]', 'string'=>'string|string[]', 'replace'=>'string|string[]', 'offset'=>'int|int[]', 'length='=>'int|int[]|null'], + ], 'tidy_parse_file' => [ 'old' => ['tidy', 'filename'=>'string', 'config='=>'array|string', 'encoding='=>'string', 'useIncludePath='=>'bool'], 'new' => ['tidy', 'filename'=>'string', 'config='=>'array|string|null', 'encoding='=>'?string', 'useIncludePath='=>'bool'], diff --git a/dictionaries/CallMap_81_delta.php b/dictionaries/CallMap_81_delta.php index 15de17d3a3c..081e4adf25b 100644 --- a/dictionaries/CallMap_81_delta.php +++ b/dictionaries/CallMap_81_delta.php @@ -507,7 +507,7 @@ 'new' => ['bool', 'ldap'=>'LDAP\Connection'], ], 'ldap_compare' => [ - 'old' => ['bool|int', 'ldap'=>'resource', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string'], + 'old' => ['bool|int', 'ldap'=>'resource', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string', 'controls='=>'?array'], 'new' => ['bool|int', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'attribute'=>'string', 'value'=>'string', 'controls='=>'?array'], ], 'ldap_connect' => [ @@ -519,7 +519,7 @@ 'new' => ['int', 'ldap'=>'LDAP\Connection', 'result'=>'LDAP\Result'], ], 'ldap_delete' => [ - 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string'], + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'controls='=>'?array'], 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'controls='=>'?array'], ], 'ldap_delete_ext' => [ @@ -579,8 +579,8 @@ 'new' => ['array|false', 'ldap'=>'LDAP\Connection', 'result'=>'LDAP\Result'], ], 'ldap_get_option' => [ - 'old' => ['bool', 'ldap'=>'resource', 'option'=>'int', '&w_value'=>'mixed'], - 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'option'=>'int', '&w_value='=>'array|string|int|null'], + 'old' => ['bool', 'ldap'=>'resource', 'option'=>'int', '&w_value='=>'array|string|int'], + 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'option'=>'int', '&w_value='=>'array|string|int'], ], 'ldap_get_values' => [ 'old' => ['array|false', 'ldap'=>'resource', 'entry'=>'resource', 'attribute'=>'string'], @@ -591,11 +591,11 @@ 'new' => ['array|false', 'ldap'=>'LDAP\Connection', 'entry'=>'LDAP\ResultEntry', 'attribute'=>'string'], ], 'ldap_list' => [ - 'old' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int'], + 'old' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], 'new' => ['LDAP\Result|LDAP\Result[]|false', 'ldap'=>'LDAP\Connection|LDAP\Connection[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], ], 'ldap_mod_add' => [ - 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], 'ldap_mod_add_ext' => [ @@ -603,7 +603,7 @@ 'new' => ['LDAP\Result|false', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], 'ldap_mod_del' => [ - 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], 'ldap_mod_del_ext' => [ @@ -611,7 +611,7 @@ 'new' => ['LDAP\Result|false', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], 'ldap_mod_replace' => [ - 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], 'ldap_mod_replace_ext' => [ @@ -619,11 +619,11 @@ 'new' => ['LDAP\Result|false', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], 'ldap_modify' => [ - 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'entry'=>'array', 'controls='=>'?array'], ], 'ldap_modify_batch' => [ - 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'modifications_info'=>'array'], + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'modifications_info'=>'array', 'controls='=>'?array'], 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'modifications_info'=>'array', 'controls='=>'?array'], ], 'ldap_next_attribute' => [ @@ -631,7 +631,7 @@ 'new' => ['string|false', 'ldap'=>'LDAP\Connection', 'entry'=>'LDAP\ResultEntry'], ], 'ldap_next_entry' => [ - 'old' => ['resource|false', 'ldap'=>'resource', 'result'=>'resource'], + 'old' => ['resource|false', 'ldap'=>'resource', 'entry'=>'resource'], 'new' => ['LDAP\ResultEntry|false', 'ldap'=>'LDAP\Connection', 'entry'=>'LDAP\ResultEntry'], ], 'ldap_next_reference' => [ @@ -643,7 +643,7 @@ 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'result'=>'LDAP\Result', '&w_response_data='=>'string', '&w_response_oid='=>'string'], ], 'ldap_parse_reference' => [ - 'old' => ['bool', 'ldap'=>'resource', 'entry'=>'resource', 'referrals'=>'array'], + 'old' => ['bool', 'ldap'=>'resource', 'entry'=>'resource', '&w_referrals'=>'array'], 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'entry'=>'LDAP\ResultEntry', '&w_referrals'=>'array'], ], 'ldap_parse_result' => [ @@ -651,11 +651,11 @@ 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'result'=>'LDAP\Result', '&w_error_code'=>'int', '&w_matched_dn='=>'string', '&w_error_message='=>'string', '&w_referrals='=>'array', '&w_controls='=>'array'], ], 'ldap_read' => [ - 'old' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int'], + 'old' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], 'new' => ['LDAP\Result|LDAP\Result[]|false', 'ldap'=>'LDAP\Connection|LDAP\Connection[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], ], 'ldap_rename' => [ - 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool'], + 'old' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool', 'controls='=>'?array'], 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool', 'controls='=>'?array'], ], 'ldap_rename_ext' => [ @@ -667,7 +667,7 @@ 'new' => ['bool', 'ldap'=>'LDAP\Connection', 'dn='=>'?string', 'password='=>'?string', 'mech='=>'?string', 'realm='=>'?string', 'authc_id='=>'?string', 'authz_id='=>'?string', 'props='=>'?string'], ], 'ldap_search' => [ - 'old' => ['resource|false', 'ldap'=>'resource|resource[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int'], + 'old' => ['resource|false', 'ldap'=>'resource|resource[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], 'new' => ['LDAP\Result|LDAP\Result[]|false', 'ldap'=>'LDAP\Connection|LDAP\Connection[]', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int', 'controls='=>'?array'], ], 'ldap_set_option' => [ @@ -790,6 +790,10 @@ 'old' => ['resource|false', 'connection' => 'resource', 'query' => 'string'], 'new' => ['\PgSql\Result|false', 'connection' => '\PgSql\Connection', 'query' => 'string'], ], + 'pg_exec\'1' => [ + 'old' => ['resource|false', 'connection' => 'string'], + 'new' => ['\PgSql\Result|false', 'connection' => 'string'], + ], 'pg_execute' => [ 'old' => ['resource|false', 'connection' => 'resource', 'statement_name' => 'string', 'params' => 'array'], 'new' => ['\PgSql\Result|false', 'connection' => '\PgSql\Connection', 'statement_name' => 'string', 'params' => 'array'], @@ -799,8 +803,8 @@ 'new' => ['\PgSql\Result|false', 'connection' => 'string', 'statement_name' => 'array'], ], 'pg_fetch_all' => [ - 'old' => ['array', 'result' => 'resource', 'result_type=' => 'int'], - 'new' => ['array', 'result' => '\PgSql\Result', 'result_type=' => 'int'], + 'old' => ['array', 'result' => 'resource', 'mode=' => 'int'], + 'new' => ['array', 'result' => '\PgSql\Result', 'mode=' => 'int'], ], 'pg_fetch_all_columns' => [ 'old' => ['array', 'result' => 'resource', 'field=' => 'int'], @@ -879,16 +883,16 @@ 'new' => ['bool', 'result' => '\PgSql\Result'], ], 'pg_get_notify' => [ - 'old' => ['array|false', 'result' => 'resource', 'mode=' => 'int'], - 'new' => ['array|false', 'result' => '\PgSql\Result', 'mode=' => 'int'], + 'old' => ['array|false', 'connection' => 'resource', 'mode=' => 'int'], + 'new' => ['array|false', 'connection' => '\PgSql\Connection', 'mode=' => 'int'], ], 'pg_get_pid' => [ 'old' => ['int', 'connection' => 'resource'], 'new' => ['int', 'connection' => '\PgSql\Connection'], ], 'pg_get_result' => [ - 'old' => ['resource|false', 'connection=' => 'resource'], - 'new' => ['\PgSql\Result|false', 'connection=' => '\PgSql\Connection'], + 'old' => ['resource|false', 'connection' => 'resource'], + 'new' => ['\PgSql\Result|false', 'connection' => '\PgSql\Connection'], ], 'pg_host' => [ 'old' => ['string', 'connection=' => 'resource'], @@ -983,8 +987,8 @@ 'new' => ['string|false', 'connection' => '\PgSql\Connection', 'name' => 'string'], ], 'pg_pconnect' => [ - 'old' => ['resource|false', 'connection_string' => 'string', 'flags=' => 'string', 'port=' => 'string|int', 'options=' => 'string', 'tty=' => 'string', 'database=' => 'string'], - 'new' => ['\PgSql\Connection|false', 'connection_string' => 'string', 'flags=' => 'string', 'port=' => 'string|int', 'options=' => 'string', 'tty=' => 'string', 'database=' => 'string'], + 'old' => ['resource|false', 'connection_string' => 'string', 'flags=' => 'int'], + 'new' => ['\PgSql\Connection|false', 'connection_string' => 'string', 'flags=' => 'int'], ], 'pg_ping' => [ 'old' => ['bool', 'connection=' => '?resource'], @@ -1039,12 +1043,12 @@ 'new' => ['string|int', 'result' => '\PgSql\Result', 'mode=' => 'int'], ], 'pg_select' => [ - 'old' => ['string|array|false', 'connection' => 'resource', 'table_name' => 'string', 'assoc_array' => 'array', 'options=' => 'int', 'result_type=' => 'int'], - 'new' => ['string|array|false', 'connection' => '\PgSql\Connection', 'table_name' => 'string', 'assoc_array' => 'array', 'options=' => 'int', 'result_type=' => 'int'], + 'old' => ['string|array|false', 'connection' => 'resource', 'table_name' => 'string', 'conditions' => 'array', 'flags=' => 'int', 'mode='=>'int'], + 'new' => ['string|array|false', 'connection' => '\PgSql\Connection', 'table_name' => 'string', 'conditions' => 'array', 'flags=' => 'int', 'mode='=>'int'], ], 'pg_send_execute' => [ - 'old' => ['bool|int', 'connection' => 'resource', 'query' => 'string', 'params' => 'array'], - 'new' => ['bool|int', 'connection' => '\PgSql\Connection', 'query' => 'string', 'params' => 'array'], + 'old' => ['bool|int', 'connection' => 'resource', 'statement_name' => 'string', 'params' => 'array'], + 'new' => ['bool|int', 'connection' => '\PgSql\Connection', 'statement_name' => 'string', 'params' => 'array'], ], 'pg_send_prepare' => [ 'old' => ['bool|int', 'connection' => 'resource', 'statement_name' => 'string', 'query' => 'string'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index e626d4896d7..33fa7f57376 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -6403,7 +6403,7 @@ 'SNMP::getErrno' => ['int'], 'SNMP::getError' => ['string'], 'SNMP::getnext' => ['string|array|false', 'objectId'=>'string|array'], - 'SNMP::set' => ['bool', 'objectId'=>'string|array', 'type'=>'string|array', 'value'=>'mixed'], + 'SNMP::set' => ['bool', 'objectId'=>'string|array', 'type'=>'string|array', 'value'=>'string|array'], 'SNMP::setSecurity' => ['bool', 'securityLevel'=>'string', 'authProtocol='=>'string', 'authPassphrase='=>'string', 'privacyProtocol='=>'string', 'privacyPassphrase='=>'string', 'contextName='=>'string', 'contextEngineId='=>'string'], 'SNMP::walk' => ['array|false', 'objectId'=>'string', 'suffixAsKey='=>'bool', 'maxRepetitions='=>'int', 'nonRepeaters='=>'int'], 'SQLite3::__construct' => ['void', 'filename'=>'string', 'flags='=>'int', 'encryptionKey='=>'?string'], @@ -12553,7 +12553,7 @@ 'ldap_get_attributes' => ['array', 'ldap'=>'resource', 'entry'=>'resource'], 'ldap_get_dn' => ['string|false', 'ldap'=>'resource', 'entry'=>'resource'], 'ldap_get_entries' => ['array|false', 'ldap'=>'resource', 'result'=>'resource'], - 'ldap_get_option' => ['bool', 'ldap'=>'resource', 'option'=>'int', '&w_value'=>'mixed'], + 'ldap_get_option' => ['bool', 'ldap'=>'resource', 'option'=>'int', '&w_value='=>'array|string|int'], 'ldap_get_values' => ['array|false', 'ldap'=>'resource', 'entry'=>'resource', 'attribute'=>'string'], 'ldap_get_values_len' => ['array|false', 'ldap'=>'resource', 'entry'=>'resource', 'attribute'=>'string'], 'ldap_list' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int'], @@ -12566,9 +12566,9 @@ 'ldap_modify' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'entry'=>'array'], 'ldap_modify_batch' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'modifications_info'=>'array'], 'ldap_next_attribute' => ['string|false', 'ldap'=>'resource', 'entry'=>'resource'], - 'ldap_next_entry' => ['resource|false', 'ldap'=>'resource', 'result'=>'resource'], + 'ldap_next_entry' => ['resource|false', 'ldap'=>'resource', 'entry'=>'resource'], 'ldap_next_reference' => ['resource|false', 'ldap'=>'resource', 'entry'=>'resource'], - 'ldap_parse_reference' => ['bool', 'ldap'=>'resource', 'entry'=>'resource', 'referrals'=>'array'], + 'ldap_parse_reference' => ['bool', 'ldap'=>'resource', 'entry'=>'resource', '&w_referrals'=>'array'], 'ldap_parse_result' => ['bool', 'ldap'=>'resource', 'result'=>'resource', '&w_error_code'=>'int', '&w_matched_dn='=>'string', '&w_error_message='=>'string', '&w_referrals='=>'array', '&w_controls='=>'array'], 'ldap_read' => ['resource|false', 'ldap'=>'resource|array', 'base'=>'string', 'filter'=>'string', 'attributes='=>'array', 'attributes_only='=>'int', 'sizelimit='=>'int', 'timelimit='=>'int', 'deref='=>'int'], 'ldap_rename' => ['bool', 'ldap'=>'resource', 'dn'=>'string', 'new_rdn'=>'string', 'new_parent'=>'string', 'delete_old_rdn'=>'bool'], @@ -13600,7 +13600,7 @@ 'numfmt_set_pattern' => ['bool', 'formatter'=>'NumberFormatter', 'pattern'=>'string'], 'numfmt_set_symbol' => ['bool', 'formatter'=>'NumberFormatter', 'symbol'=>'int', 'value'=>'string'], 'numfmt_set_text_attribute' => ['bool', 'formatter'=>'NumberFormatter', 'attribute'=>'int', 'value'=>'string'], - 'oauth_get_sbs' => ['string', 'http_method'=>'string', 'uri'=>'string', 'request_parameters='=>'array'], + 'oauth_get_sbs' => ['string', 'http_method'=>'string', 'uri'=>'string', 'parameters'=>'array'], 'oauth_urlencode' => ['string', 'uri'=>'string'], 'ob_clean' => ['bool'], 'ob_deflatehandler' => ['string', 'data'=>'string', 'mode'=>'int'], @@ -13928,6 +13928,7 @@ 'pg_escape_string' => ['string', 'connection'=>'resource', 'string'=>'string'], 'pg_escape_string\'1' => ['string', 'connection'=>'string'], 'pg_exec' => ['resource|false', 'connection'=>'resource', 'query'=>'string'], + 'pg_exec\'1' => ['resource|false', 'connection'=>'string'], 'pg_execute' => ['resource|false', 'connection'=>'resource', 'statement_name'=>'string', 'params'=>'array'], 'pg_execute\'1' => ['resource|false', 'connection'=>'string', 'statement_name'=>'array'], 'pg_fetch_all' => ['array', 'result'=>'resource'], @@ -13950,9 +13951,9 @@ 'pg_field_type_oid' => ['int|string', 'result'=>'resource', 'field'=>'int'], 'pg_flush' => ['int|bool', 'connection'=>'resource'], 'pg_free_result' => ['bool', 'result'=>'resource'], - 'pg_get_notify' => ['array|false', 'result'=>'resource', 'mode='=>'int'], + 'pg_get_notify' => ['array|false', 'connection'=>'resource', 'mode='=>'int'], 'pg_get_pid' => ['int', 'connection'=>'resource'], - 'pg_get_result' => ['resource|false', 'connection='=>'resource'], + 'pg_get_result' => ['resource|false', 'connection'=>'resource'], 'pg_host' => ['string', 'connection='=>'resource'], 'pg_insert' => ['resource|string|false', 'connection'=>'resource', 'table_name'=>'string', 'values'=>'array', 'flags='=>'int'], 'pg_last_error' => ['string', 'connection='=>'resource'], @@ -13980,7 +13981,7 @@ 'pg_options' => ['string', 'connection='=>'resource'], 'pg_parameter_status' => ['string|false', 'connection'=>'resource', 'name'=>'string'], 'pg_parameter_status\'1' => ['string|false', 'connection'=>'string'], - 'pg_pconnect' => ['resource|false', 'connection_string'=>'string', 'flags='=>'string', 'port='=>'string|int', 'options='=>'string', 'tty='=>'string', 'database='=>'string'], + 'pg_pconnect' => ['resource|false', 'connection_string'=>'string', 'flags='=>'int'], 'pg_ping' => ['bool', 'connection='=>'resource'], 'pg_port' => ['string', 'connection='=>'resource'], 'pg_prepare' => ['resource|false', 'connection'=>'resource', 'statement_name'=>'string', 'query'=>'string'], @@ -13995,8 +13996,8 @@ 'pg_result_error_field' => ['string|false|null', 'result'=>'resource', 'field_code'=>'int'], 'pg_result_seek' => ['bool', 'result'=>'resource', 'row'=>'int'], 'pg_result_status' => ['string|int', 'result'=>'resource', 'mode='=>'int'], - 'pg_select' => ['string|array|false', 'connection'=>'resource', 'table_name'=>'string', 'assoc_array'=>'array', 'options='=>'int'], - 'pg_send_execute' => ['bool|int', 'connection'=>'resource', 'query'=>'string', 'params'=>'array'], + 'pg_select' => ['string|array|false', 'connection'=>'resource', 'table_name'=>'string', 'conditions'=>'array', 'flags='=>'int'], + 'pg_send_execute' => ['bool|int', 'connection'=>'resource', 'statement_name'=>'string', 'params'=>'array'], 'pg_send_prepare' => ['bool|int', 'connection'=>'resource', 'statement_name'=>'string', 'query'=>'string'], 'pg_send_query' => ['bool|int', 'connection'=>'resource', 'query'=>'string'], 'pg_send_query_params' => ['bool|int', 'connection'=>'resource', 'query'=>'string', 'params'=>'array'], @@ -14140,7 +14141,7 @@ 'posix_ttyname' => ['string|false', 'file_descriptor'=>'resource|int'], 'posix_uname' => ['array{sysname: string, nodename: string, release: string, version: string, machine: string, domainname: string}|false'], 'pow' => ['float|int', 'num'=>'int|float', 'exponent'=>'int|float'], - 'preg_filter' => ['null|string|string[]', 'pattern'=>'mixed', 'replacement'=>'mixed', 'subject'=>'mixed', 'limit='=>'int', '&w_count='=>'int'], + 'preg_filter' => ['string|string[]|null', 'pattern'=>'string|string[]', 'replacement'=>'string|string[]', 'subject'=>'string|string[]', 'limit='=>'int', '&w_count='=>'int'], 'preg_grep' => ['array|false', 'pattern'=>'string', 'array'=>'array', 'flags='=>'int'], 'preg_last_error' => ['int'], 'preg_match' => ['int|false', 'pattern'=>'string', 'subject'=>'string', '&w_matches='=>'string[]', 'flags='=>'0', 'offset='=>'int'], @@ -14150,7 +14151,8 @@ 'preg_replace' => ['string|string[]|null', 'pattern'=>'string|array', 'replacement'=>'string|array', 'subject'=>'string|array', 'limit='=>'int', '&w_count='=>'int'], 'preg_replace_callback' => ['string|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int'], 'preg_replace_callback\'1' => ['string[]|null', 'pattern'=>'string|array', 'callback'=>'callable(string[]):string', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int'], - 'preg_replace_callback_array' => ['string|string[]|null', 'pattern'=>'array', 'subject'=>'string|array', 'limit='=>'int', '&w_count='=>'int'], + 'preg_replace_callback_array' => ['string|null', 'pattern'=>'array', 'subject'=>'string', 'limit='=>'int', '&w_count='=>'int'], + 'preg_replace_callback_array\'1' => ['string[]|null', 'pattern'=>'array', 'subject'=>'string[]', 'limit='=>'int', '&w_count='=>'int'], 'preg_split' => ['list|false', 'pattern'=>'string', 'subject'=>'string', 'limit'=>'int', 'flags='=>'null'], 'preg_split\'1' => ['list|list>|false', 'pattern'=>'string', 'subject'=>'string', 'limit='=>'int', 'flags='=>'int'], 'prev' => ['mixed', '&r_array'=>'array|object'], @@ -14611,51 +14613,51 @@ 'snmp_get_quick_print' => ['bool'], 'snmp_get_valueretrieval' => ['int'], 'snmp_read_mib' => ['bool', 'filename'=>'string'], - 'snmp_set_enum_print' => ['bool', 'enable'=>'int'], + 'snmp_set_enum_print' => ['true', 'enable'=>'bool'], 'snmp_set_oid_numeric_print' => ['true', 'format'=>'int'], 'snmp_set_oid_output_format' => ['true', 'format'=>'int'], 'snmp_set_quick_print' => ['bool', 'enable'=>'bool'], - 'snmp_set_valueretrieval' => ['bool', 'method='=>'int'], + 'snmp_set_valueretrieval' => ['true', 'method'=>'int'], 'snmpget' => ['string|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], 'snmpgetnext' => ['string|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], 'snmprealwalk' => ['array|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], - 'snmpset' => ['bool', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'type'=>'string', 'value'=>'mixed', 'timeout='=>'int', 'retries='=>'int'], + 'snmpset' => ['bool', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'type'=>'string|string[]', 'value'=>'string|string[]', 'timeout='=>'int', 'retries='=>'int'], 'snmpwalk' => ['array|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], 'snmpwalkoid' => ['array|false', 'hostname'=>'string', 'community'=>'string', 'object_id'=>'string', 'timeout='=>'int', 'retries='=>'int'], 'socket_accept' => ['resource|false', 'socket'=>'resource'], - 'socket_bind' => ['bool', 'socket'=>'resource', 'addr'=>'string', 'port='=>'int'], + 'socket_bind' => ['bool', 'socket'=>'resource', 'address'=>'string', 'port='=>'int'], 'socket_clear_error' => ['void', 'socket='=>'resource'], 'socket_close' => ['void', 'socket'=>'resource'], - 'socket_cmsg_space' => ['int', 'level'=>'int', 'type'=>'int'], - 'socket_connect' => ['bool', 'socket'=>'resource', 'addr'=>'string', 'port='=>'int'], + 'socket_cmsg_space' => ['?int', 'level'=>'int', 'type'=>'int', 'num='=>'int'], + 'socket_connect' => ['bool', 'socket'=>'resource', 'address'=>'string', 'port='=>'int'], 'socket_create' => ['resource|false', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int'], 'socket_create_listen' => ['resource|false', 'port'=>'int', 'backlog='=>'int'], 'socket_create_pair' => ['bool', 'domain'=>'int', 'type'=>'int', 'protocol'=>'int', '&w_pair'=>'resource[]'], 'socket_export_stream' => ['resource|false', 'socket'=>'resource'], - 'socket_get_option' => ['mixed|false', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int'], + 'socket_get_option' => ['array|int|false', 'socket'=>'resource', 'level'=>'int', 'option'=>'int'], 'socket_get_status' => ['array', 'stream'=>'resource'], - 'socket_getopt' => ['mixed', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int'], - 'socket_getpeername' => ['bool', 'socket'=>'resource', '&w_addr'=>'string', '&w_port='=>'int'], - 'socket_getsockname' => ['bool', 'socket'=>'resource', '&w_addr'=>'string', '&w_port='=>'int'], + 'socket_getopt' => ['array|int|false', 'socket'=>'resource', 'level'=>'int', 'option'=>'int'], + 'socket_getpeername' => ['bool', 'socket'=>'resource', '&w_address'=>'string', '&w_port='=>'int'], + 'socket_getsockname' => ['bool', 'socket'=>'resource', '&w_address'=>'string', '&w_port='=>'int'], 'socket_import_stream' => ['resource|false', 'stream'=>'resource'], 'socket_last_error' => ['int', 'socket='=>'resource'], 'socket_listen' => ['bool', 'socket'=>'resource', 'backlog='=>'int'], - 'socket_read' => ['string|false', 'socket'=>'resource', 'length'=>'int', 'type='=>'int'], - 'socket_recv' => ['int|false', 'socket'=>'resource', '&w_buf'=>'string', 'length'=>'int', 'flags'=>'int'], - 'socket_recvfrom' => ['int|false', 'socket'=>'resource', '&w_buf'=>'string', 'length'=>'int', 'flags'=>'int', '&w_name'=>'string', '&w_port='=>'int'], - 'socket_recvmsg' => ['int|false', 'socket'=>'resource', '&w_message'=>'string', 'flags='=>'int'], - 'socket_select' => ['int|false', '&rw_read_fds'=>'resource[]|null', '&rw_write_fds'=>'resource[]|null', '&rw_except_fds'=>'resource[]|null', 'tv_sec'=>'int|null', 'tv_usec='=>'int'], - 'socket_send' => ['int|false', 'socket'=>'resource', 'buf'=>'string', 'length'=>'int', 'flags'=>'int'], - 'socket_sendmsg' => ['int|false', 'socket'=>'resource', 'message'=>'array', 'flags'=>'int'], - 'socket_sendto' => ['int|false', 'socket'=>'resource', 'buf'=>'string', 'length'=>'int', 'flags'=>'int', 'addr'=>'string', 'port='=>'int'], + 'socket_read' => ['string|false', 'socket'=>'resource', 'length'=>'int', 'mode='=>'int'], + 'socket_recv' => ['int|false', 'socket'=>'resource', '&w_data'=>'string', 'length'=>'int', 'flags'=>'int'], + 'socket_recvfrom' => ['int|false', 'socket'=>'resource', '&w_data'=>'string', 'length'=>'int', 'flags'=>'int', '&w_address'=>'string', '&w_port='=>'int'], + 'socket_recvmsg' => ['int|false', 'socket'=>'resource', '&w_message'=>'array', 'flags='=>'int'], + 'socket_select' => ['int|false', '&rw_read'=>'resource[]|null', '&rw_write'=>'resource[]|null', '&rw_except'=>'resource[]|null', 'seconds'=>'int|null', 'microseconds='=>'int'], + 'socket_send' => ['int|false', 'socket'=>'resource', 'data'=>'string', 'length'=>'int', 'flags'=>'int'], + 'socket_sendmsg' => ['int|false', 'socket'=>'resource', 'message'=>'array', 'flags='=>'int'], + 'socket_sendto' => ['int|false', 'socket'=>'resource', 'data'=>'string', 'length'=>'int', 'flags'=>'int', 'address'=>'string', 'port='=>'int'], 'socket_set_block' => ['bool', 'socket'=>'resource'], - 'socket_set_blocking' => ['bool', 'socket'=>'resource', 'mode'=>'int'], + 'socket_set_blocking' => ['bool', 'stream'=>'resource', 'enable'=>'bool'], 'socket_set_nonblock' => ['bool', 'socket'=>'resource'], - 'socket_set_option' => ['bool', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int', 'optval'=>'int|string|array'], + 'socket_set_option' => ['bool', 'socket'=>'resource', 'level'=>'int', 'option'=>'int', 'value'=>'int|string|array'], 'socket_set_timeout' => ['bool', 'stream'=>'resource', 'seconds'=>'int', 'microseconds='=>'int'], - 'socket_setopt' => ['void', 'socket'=>'resource', 'level'=>'int', 'optname'=>'int', 'optval'=>'int|string|array'], - 'socket_shutdown' => ['bool', 'socket'=>'resource', 'how='=>'int'], - 'socket_strerror' => ['string', 'errno'=>'int'], + 'socket_setopt' => ['bool', 'socket'=>'resource', 'level'=>'int', 'option'=>'int', 'value'=>'int|string|array'], + 'socket_shutdown' => ['bool', 'socket'=>'resource', 'mode='=>'int'], + 'socket_strerror' => ['string', 'error_code'=>'int'], 'socket_write' => ['int|false', 'socket'=>'resource', 'data'=>'string', 'length='=>'int'], 'solid_fetch_prev' => ['bool', 'result_id'=>''], 'solr_get_version' => ['string|false'], @@ -14996,7 +14998,7 @@ 'substr' => ['string|false', 'string'=>'string', 'offset'=>'int', 'length='=>'int'], 'substr_compare' => ['int|false', 'haystack'=>'string', 'needle'=>'string', 'offset'=>'int', 'length='=>'int', 'case_insensitive='=>'bool'], 'substr_count' => ['int', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'length='=>'int'], - 'substr_replace' => ['string|string[]', 'string'=>'string|string[]', 'replace'=>'mixed', 'offset'=>'mixed', 'length='=>'mixed'], + 'substr_replace' => ['string|string[]', 'string'=>'string|string[]', 'replace'=>'string|string[]', 'offset'=>'int|int[]', 'length='=>'int|int[]'], 'suhosin_encrypt_cookie' => ['string|false', 'name'=>'string', 'value'=>'string'], 'suhosin_get_raw_cookies' => ['array'], 'svm::crossvalidate' => ['float', 'problem'=>'array', 'number_of_folds'=>'int'], @@ -15436,7 +15438,7 @@ 'tidy_get_release' => ['string'], 'tidy_get_root' => ['?tidyNode', 'tidy'=>'tidy'], 'tidy_get_status' => ['int', 'tidy'=>'tidy'], - 'tidy_getopt' => ['mixed', 'tidy'=>'string', 'option'=>'tidy'], + 'tidy_getopt' => ['string|int|bool', 'tidy'=>'tidy', 'option'=>'string'], 'tidy_is_xhtml' => ['bool', 'tidy'=>'tidy'], 'tidy_is_xml' => ['bool', 'tidy'=>'tidy'], 'tidy_load_config' => ['void', 'filename'=>'string', 'encoding'=>'string'], @@ -16188,8 +16190,8 @@ 'yac::flush' => ['bool'], 'yac::get' => ['mixed', 'key'=>'string|array', 'cas='=>'int'], 'yac::info' => ['array'], - 'yaml_emit' => ['string', 'data'=>'mixed', 'encoding='=>'int', 'linebreak='=>'int'], - 'yaml_emit_file' => ['bool', 'filename'=>'string', 'data'=>'mixed', 'encoding='=>'int', 'linebreak='=>'int'], + 'yaml_emit' => ['string', 'data'=>'mixed', 'encoding='=>'int', 'linebreak='=>'int', 'callbacks='=>'array'], + 'yaml_emit_file' => ['bool', 'filename'=>'string', 'data'=>'mixed', 'encoding='=>'int', 'linebreak='=>'int', 'callbacks='=>'array'], 'yaml_parse' => ['mixed|false', 'input'=>'string', 'pos='=>'int', '&w_ndocs='=>'int', 'callbacks='=>'array'], 'yaml_parse_file' => ['mixed|false', 'filename'=>'string', 'pos='=>'int', '&w_ndocs='=>'int', 'callbacks='=>'array'], 'yaml_parse_url' => ['mixed|false', 'url'=>'string', 'pos='=>'int', '&w_ndocs='=>'int', 'callbacks='=>'array'], @@ -16259,7 +16261,7 @@ 'zend_thread_id' => ['int'], 'zend_version' => ['string'], 'zip_close' => ['void', 'zip'=>'resource'], - 'zip_entry_close' => ['bool', 'zip_ent'=>'resource'], + 'zip_entry_close' => ['bool', 'zip_entry'=>'resource'], 'zip_entry_compressedsize' => ['int', 'zip_entry'=>'resource'], 'zip_entry_compressionmethod' => ['string', 'zip_entry'=>'resource'], 'zip_entry_filesize' => ['int', 'zip_entry'=>'resource'], @@ -16269,7 +16271,7 @@ 'zip_open' => ['resource|int|false', 'filename'=>'string'], 'zip_read' => ['resource', 'zip'=>'resource'], 'zlib_decode' => ['string|false', 'data'=>'string', 'max_length='=>'int'], - 'zlib_encode' => ['string', 'data'=>'string', 'encoding'=>'int', 'level='=>'string|int'], + 'zlib_encode' => ['string|false', 'data'=>'string', 'encoding'=>'int', 'level='=>'int'], 'zlib_get_coding_type' => ['string|false'], 'zookeeper_dispatch' => ['void'], ]; diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 05003f784e5..37aeb4bd030 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -349,20 +349,6 @@ class InternalCallMapHandlerTest extends TestCase 'intltz_get_display_name', 'iteratoriterator::__construct', 'jsonexception::__construct', - 'ldap_compare' => ['8.0'], - 'ldap_delete' => ['8.0'], - 'ldap_get_option' => ['8.0'], - 'ldap_list' => ['8.0'], - 'ldap_mod_add' => ['8.0'], - 'ldap_mod_del' => ['8.0'], - 'ldap_mod_replace' => ['8.0'], - 'ldap_modify' => ['8.0'], - 'ldap_modify_batch' => ['8.0'], - 'ldap_next_entry' => ['8.0'], - 'ldap_parse_reference' => ['8.0'], - 'ldap_read' => ['8.0'], - 'ldap_rename' => ['8.0'], - 'ldap_search' => ['8.0'], 'limititerator::__construct', 'limititerator::seek', 'locale::filtermatches', @@ -443,11 +429,6 @@ class InternalCallMapHandlerTest extends TestCase 'messageformatter::parse', 'messageformatter::parsemessage', 'mongodb\bson\binary::__construct', - 'msg_receive', - 'msg_remove_queue', - 'msg_send', - 'msg_set_queue', - 'msg_stat_queue', 'multipleiterator::attachiterator', 'mysqli::poll', 'mysqli_poll', @@ -473,7 +454,6 @@ class InternalCallMapHandlerTest extends TestCase 'oauth::setcapath', 'oauth::settimeout', 'oauth::settimestamp', - 'oauth_get_sbs', 'oauthprovider::consumerhandler', 'oauthprovider::isrequesttokenendpoint', 'oauthprovider::timestampnoncehandler', @@ -526,13 +506,6 @@ class InternalCallMapHandlerTest extends TestCase 'pdostatement::bindparam', 'pdostatement::fetchobject', 'pdostatement::getattribute', - 'pg_exec', - 'pg_fetch_all', - 'pg_get_notify', - 'pg_get_result', - 'pg_pconnect', - 'pg_select', - 'pg_send_execute', 'phar::__construct', 'phar::addemptydir', 'phar::addfile', @@ -575,8 +548,6 @@ class InternalCallMapHandlerTest extends TestCase 'pharfileinfo::__construct', 'pharfileinfo::chmod', 'pharfileinfo::iscompressed', - 'preg_filter', - 'preg_replace_callback_array', 'recursivearrayiterator::asort', 'recursivearrayiterator::ksort', 'recursivearrayiterator::offsetexists', @@ -633,15 +604,8 @@ class InternalCallMapHandlerTest extends TestCase 'resourcebundle::__construct', 'resourcebundle::create', 'resourcebundle::getlocales', - 'sapi_windows_cp_get', 'sessionhandler::gc', 'sessionhandler::open', - 'shm_detach', - 'shm_get_var', - 'shm_has_var', - 'shm_put_var', - 'shm_remove', - 'shm_remove_var', 'simplexmlelement::__construct', 'simplexmlelement::addattribute', 'simplexmlelement::addchild', @@ -650,36 +614,6 @@ class InternalCallMapHandlerTest extends TestCase 'simplexmlelement::getdocnamespaces', 'simplexmlelement::registerxpathnamespace', 'simplexmlelement::xpath', - 'snmp::set', - 'snmp_set_enum_print', - 'snmp_set_valueretrieval', - 'snmpset', - 'socket_bind', - 'socket_cmsg_space', - 'socket_connect', - 'socket_get_option', - 'socket_getopt', - 'socket_getpeername', - 'socket_getsockname', - 'socket_read', - 'socket_recv', - 'socket_recvfrom', - 'socket_recvmsg', - 'socket_select', - 'socket_send', - 'socket_sendmsg', - 'socket_sendto', - 'socket_set_blocking', - 'socket_set_option', - 'socket_setopt', - 'socket_shutdown', - 'socket_strerror', - 'sodium_crypto_generichash', - 'sodium_crypto_generichash_final', - 'sodium_crypto_generichash_init', - 'sodium_crypto_generichash_update', - 'sodium_crypto_kx_client_session_keys', - 'sodium_crypto_secretstream_xchacha20poly1305_rekey', 'spldoublylinkedlist::add', 'spldoublylinkedlist::offsetset', 'spldoublylinkedlist::setiteratormode', @@ -747,8 +681,6 @@ class InternalCallMapHandlerTest extends TestCase 'sqlsrv_query', 'sqlsrv_server_info', 'ssh2_forward_accept', - 'substr_replace', - 'tidy_getopt', 'transliterator::transliterate', 'uconverter::convert', 'uconverter::fromucallback', @@ -785,15 +717,11 @@ class InternalCallMapHandlerTest extends TestCase 'xmlreader::xml', 'xsltprocessor::registerphpfunctions', 'xsltprocessor::transformtodoc', - 'yaml_emit', - 'yaml_emit_file', - 'zip_entry_close', 'ziparchive::iscompressionmethodsupported', 'ziparchive::isencryptionmethodsupported', 'ziparchive::setcompressionindex', 'ziparchive::setcompressionname', 'ziparchive::setencryptionindex', - 'zlib_encode', ]; /** From 8eebebef6205209f7c9b6424c3d0dd51eb91db5f Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 13 Feb 2023 16:09:07 +0000 Subject: [PATCH 055/109] Add curl stubs to prevent crashes --- stubs/Php80.phpstub | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/stubs/Php80.phpstub b/stubs/Php80.phpstub index 83674334300..42e0ad799a5 100644 --- a/stubs/Php80.phpstub +++ b/stubs/Php80.phpstub @@ -239,3 +239,24 @@ class DatePeriod implements IteratorAggregate * @psalm-taint-sink ssrf $url */ function get_headers(string $url, bool $associative = false, $context = null) : array|false {} + +final class CurlHandle +{ + private function __construct() + { + } +} + +final class CurlMultiHandle +{ + private function __construct() + { + } +} + +final class CurlShareHandle +{ + private function __construct() + { + } +} From b54cefe33f5c792481d688ceaada4536262151b7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 7 Feb 2023 21:05:58 +0100 Subject: [PATCH 056/109] Emit warning if the opcache cannot be installed or JIT cannot be used --- src/Psalm/Internal/Cli/Psalm.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index 620596390dd..f3551ad419a 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -46,6 +46,7 @@ use function count; use function file_exists; use function file_put_contents; +use function function_exists; use function fwrite; use function gc_collect_cycles; use function gc_disable; @@ -63,6 +64,7 @@ use function json_encode; use function max; use function microtime; +use function opcache_get_status; use function parse_url; use function preg_match; use function preg_replace; @@ -258,9 +260,11 @@ public static function run(array $argv): void $threads = self::detectThreads($options, $config, $in_ci); + $progress = self::initProgress($options, $config); + self::emitMacPcreWarning($options, $threads); - self::restart($options, $threads); + self::restart($options, $threads, $progress); if (isset($options['debug-emitted-issues'])) { $config->debug_emitted_issues = true; @@ -317,7 +321,6 @@ public static function run(array $argv): void self::clearGlobalCache($config); } - $progress = self::initProgress($options, $config); $providers = self::initProviders($options, $config, $current_dir); $stdout_report_options = self::initStdoutReportOptions($options, $show_info, $output_format, $in_ci); @@ -879,7 +882,7 @@ private static function emitMacPcreWarning(array $options, int $threads): void } } - private static function restart(array $options, int $threads): void + private static function restart(array $options, int $threads, Progress $progress): void { $ini_handler = new PsalmRestarter('PSALM'); @@ -904,6 +907,16 @@ private static function restart(array $options, int $threads): void // If Xdebug is enabled, restart without it $ini_handler->check(); + + if (!function_exists('opcache_get_status') + || !($opcache_status = opcache_get_status(false)) + || !isset($opcache_status['opcache_enabled']) + || !$opcache_status['opcache_enabled'] + ) { + $progress->write(PHP_EOL + . 'Install the opcache extension to make use of JIT on PHP 8.0+ for a 20%+ performance boost!' + . PHP_EOL . PHP_EOL); + } } private static function detectThreads(array $options, Config $config, bool $in_ci): int From cee90fc0714020b637423d693c2630cc8feeb0db Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Mon, 13 Feb 2023 22:39:33 -0400 Subject: [PATCH 057/109] Compare enum cases thoroughly Fixes vimeo/psalm#7814 --- .../Type/Comparator/AtomicTypeComparator.php | 7 ++ tests/EnumTest.php | 71 +++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php b/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php index fd44ac82e66..b0f461ccfc5 100644 --- a/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php @@ -301,6 +301,13 @@ public static function isContainedBy( return false; } + if ($container_type_part instanceof TEnumCase + && $input_type_part instanceof TEnumCase + ) { + return $container_type_part->value === $input_type_part->value + && $container_type_part->case_name === $input_type_part->case_name; + } + if (($input_type_part instanceof TNamedObject || ($input_type_part instanceof TTemplateParam && $input_type_part->as->hasObjectType()) diff --git a/tests/EnumTest.php b/tests/EnumTest.php index 74483e04b89..f1aa230316e 100644 --- a/tests/EnumTest.php +++ b/tests/EnumTest.php @@ -861,6 +861,77 @@ public static function tryFrom(string $value): ?self 'ignored_issues' => [], 'php_version' => '8.1', ], + 'functionCallWithInvalidCase' => [ + 'code' => ' 'InvalidArgument', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], + 'issue-7814-1' => [ + 'code' => ' 'InvalidArgument', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], + 'issue-7814-2' => [ + 'code' => ' $_ + */ + function withA(WithState $_): void {} + + // Should be issue here. But nothing + // Argument 1 of withA expects WithState, WithState provided + withA(new WithState(State::C)); + ', + 'error_message' => 'InvalidArgument', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], ]; } } From 39c992c255ecaa065ba02aa25b9d4b9408d98a0d Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 14 Feb 2023 02:25:46 -0400 Subject: [PATCH 058/109] Emit issues for calls to `is_a(string, class-string, false)` Fixes vimeo/psalm#4092 --- .../Call/NamedFunctionCallHandler.php | 36 ++++++++++++++ tests/FunctionCallTest.php | 48 +++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php index 79196cc1d02..39cf5dd9568 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php @@ -514,6 +514,42 @@ public static function handle( } } } + + if ($first_arg + && $function_id === 'is_a' + // assertion reconsiler already emits relevant (but different) issues + && !$context->inside_conditional + ) { + $first_arg_type = $statements_analyzer->node_data->getType($first_arg->value); + + if ($first_arg_type && $first_arg_type->isString()) { + $third_arg = $stmt->getArgs()[2] ?? null; + if ($third_arg) { + $third_arg_type = $statements_analyzer->node_data->getType($third_arg->value); + } else { + $third_arg_type = Type::getFalse(); + } + + if ($third_arg_type + && $third_arg_type->isSingle() + && $third_arg_type->isFalse() + ) { + if ($first_arg_type->from_docblock) { + IssueBuffer::maybeAdd(new RedundantFunctionCallGivenDocblockType( + 'Call to is_a always return false when first argument is string ' + . 'unless third argument is true', + new CodeLocation($statements_analyzer, $function_name), + )); + } else { + IssueBuffer::maybeAdd(new RedundantFunctionCall( + 'Call to is_a always return false when first argument is string ' + . 'unless third argument is true', + new CodeLocation($statements_analyzer, $function_name), + )); + } + } + } + } } private static function handleDependentTypeFunction( diff --git a/tests/FunctionCallTest.php b/tests/FunctionCallTest.php index 41916337e17..6c0a4f8a643 100644 --- a/tests/FunctionCallTest.php +++ b/tests/FunctionCallTest.php @@ -2693,6 +2693,54 @@ function takesArrayShapeWithZeroOrPositiveInt(array $foo): void ', 'error_message' => 'InvalidArgument', ], + 'is_a_withAStringAndNoThirdArg' => [ + 'code' => ' 'RedundantFunctionCall', + ], + 'is_a_withAStringAndFalseThirdArg' => [ + 'code' => ' 'RedundantFunctionCall', + ], + 'is_a_withAUnionOfStringsAndNoThirdArg' => [ + 'code' => ' 'RedundantFunctionCall', + ], + 'is_a_withAUnionOfStringsAndFalseThirdArg' => [ + 'code' => ' 'RedundantFunctionCall', + ], + 'is_a_withAClassStringAndNoThirdArg' => [ + 'code' => ' 'RedundantFunctionCall', + ], + 'is_a_withAClassStringAndFalseThirdArg' => [ + 'code' => ' 'RedundantFunctionCall', + ], + 'is_a_withAUnionOfClassStringsAndNoThirdArg' => [ + 'code' => ' 'RedundantFunctionCall', + ], + 'is_a_withAUnionOfClassStringsAndFalseThirdArg' => [ + 'code' => ' 'RedundantFunctionCall', + ], ]; } From c3b5877519690735895b02935aaeb08ad5187279 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Tue, 14 Feb 2023 05:48:20 -0600 Subject: [PATCH 059/109] Drop abandoned cairo extension --- dictionaries/CallMap.php | 406 ---------------------------- dictionaries/CallMap_historical.php | 406 ---------------------------- 2 files changed, 812 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index c3aaa8a3446..e0e32340efc 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -594,412 +594,6 @@ 'CachingIterator::rewind' => ['void'], 'CachingIterator::setFlags' => ['void', 'flags'=>'int'], 'CachingIterator::valid' => ['bool'], -'Cairo::availableFonts' => ['array'], -'Cairo::availableSurfaces' => ['array'], -'Cairo::statusToString' => ['string', 'status'=>'int'], -'Cairo::version' => ['int'], -'Cairo::versionString' => ['string'], -'cairo_append_path' => ['', 'path'=>'cairopath', 'context'=>'cairocontext'], -'cairo_arc' => ['', 'x'=>'float', 'y'=>'float', 'radius'=>'float', 'angle1'=>'float', 'angle2'=>'float', 'context'=>'cairocontext'], -'cairo_arc_negative' => ['', 'x'=>'float', 'y'=>'float', 'radius'=>'float', 'angle1'=>'float', 'angle2'=>'float', 'context'=>'cairocontext'], -'cairo_available_fonts' => ['array'], -'cairo_available_surfaces' => ['array'], -'cairo_clip' => ['', 'context'=>'cairocontext'], -'cairo_clip_extents' => ['array', 'context'=>'cairocontext'], -'cairo_clip_preserve' => ['', 'context'=>'cairocontext'], -'cairo_clip_rectangle_list' => ['array', 'context'=>'cairocontext'], -'cairo_close_path' => ['', 'context'=>'cairocontext'], -'cairo_copy_page' => ['', 'context'=>'cairocontext'], -'cairo_copy_path' => ['CairoPath', 'context'=>'cairocontext'], -'cairo_copy_path_flat' => ['CairoPath', 'context'=>'cairocontext'], -'cairo_create' => ['CairoContext', 'surface'=>'cairosurface'], -'cairo_curve_to' => ['', 'x1'=>'float', 'y1'=>'float', 'x2'=>'float', 'y2'=>'float', 'x3'=>'float', 'y3'=>'float', 'context'=>'cairocontext'], -'cairo_device_to_user' => ['array', 'x'=>'float', 'y'=>'float', 'context'=>'cairocontext'], -'cairo_device_to_user_distance' => ['array', 'x'=>'float', 'y'=>'float', 'context'=>'cairocontext'], -'cairo_fill' => ['', 'context'=>'cairocontext'], -'cairo_fill_extents' => ['array', 'context'=>'cairocontext'], -'cairo_fill_preserve' => ['', 'context'=>'cairocontext'], -'cairo_font_extents' => ['array', 'context'=>'cairocontext'], -'cairo_font_face_get_type' => ['int', 'fontface'=>'cairofontface'], -'cairo_font_face_status' => ['int', 'fontface'=>'cairofontface'], -'cairo_font_options_create' => ['CairoFontOptions'], -'cairo_font_options_equal' => ['bool', 'options'=>'cairofontoptions', 'other'=>'cairofontoptions'], -'cairo_font_options_get_antialias' => ['int', 'options'=>'cairofontoptions'], -'cairo_font_options_get_hint_metrics' => ['int', 'options'=>'cairofontoptions'], -'cairo_font_options_get_hint_style' => ['int', 'options'=>'cairofontoptions'], -'cairo_font_options_get_subpixel_order' => ['int', 'options'=>'cairofontoptions'], -'cairo_font_options_hash' => ['int', 'options'=>'cairofontoptions'], -'cairo_font_options_merge' => ['void', 'options'=>'cairofontoptions', 'other'=>'cairofontoptions'], -'cairo_font_options_set_antialias' => ['void', 'options'=>'cairofontoptions', 'antialias'=>'int'], -'cairo_font_options_set_hint_metrics' => ['void', 'options'=>'cairofontoptions', 'hint_metrics'=>'int'], -'cairo_font_options_set_hint_style' => ['void', 'options'=>'cairofontoptions', 'hint_style'=>'int'], -'cairo_font_options_set_subpixel_order' => ['void', 'options'=>'cairofontoptions', 'subpixel_order'=>'int'], -'cairo_font_options_status' => ['int', 'options'=>'cairofontoptions'], -'cairo_format_stride_for_width' => ['int', 'format'=>'int', 'width'=>'int'], -'cairo_get_antialias' => ['int', 'context'=>'cairocontext'], -'cairo_get_current_point' => ['array', 'context'=>'cairocontext'], -'cairo_get_dash' => ['array', 'context'=>'cairocontext'], -'cairo_get_dash_count' => ['int', 'context'=>'cairocontext'], -'cairo_get_fill_rule' => ['int', 'context'=>'cairocontext'], -'cairo_get_font_face' => ['', 'context'=>'cairocontext'], -'cairo_get_font_matrix' => ['', 'context'=>'cairocontext'], -'cairo_get_font_options' => ['', 'context'=>'cairocontext'], -'cairo_get_group_target' => ['', 'context'=>'cairocontext'], -'cairo_get_line_cap' => ['int', 'context'=>'cairocontext'], -'cairo_get_line_join' => ['int', 'context'=>'cairocontext'], -'cairo_get_line_width' => ['float', 'context'=>'cairocontext'], -'cairo_get_matrix' => ['', 'context'=>'cairocontext'], -'cairo_get_miter_limit' => ['float', 'context'=>'cairocontext'], -'cairo_get_operator' => ['int', 'context'=>'cairocontext'], -'cairo_get_scaled_font' => ['', 'context'=>'cairocontext'], -'cairo_get_source' => ['', 'context'=>'cairocontext'], -'cairo_get_target' => ['', 'context'=>'cairocontext'], -'cairo_get_tolerance' => ['float', 'context'=>'cairocontext'], -'cairo_glyph_path' => ['', 'glyphs'=>'array', 'context'=>'cairocontext'], -'cairo_has_current_point' => ['bool', 'context'=>'cairocontext'], -'cairo_identity_matrix' => ['', 'context'=>'cairocontext'], -'cairo_image_surface_create' => ['CairoImageSurface', 'format'=>'int', 'width'=>'int', 'height'=>'int'], -'cairo_image_surface_create_for_data' => ['CairoImageSurface', 'data'=>'string', 'format'=>'int', 'width'=>'int', 'height'=>'int', 'stride='=>'int'], -'cairo_image_surface_create_from_png' => ['CairoImageSurface', 'file'=>'string'], -'cairo_image_surface_get_data' => ['string', 'surface'=>'cairoimagesurface'], -'cairo_image_surface_get_format' => ['int', 'surface'=>'cairoimagesurface'], -'cairo_image_surface_get_height' => ['int', 'surface'=>'cairoimagesurface'], -'cairo_image_surface_get_stride' => ['int', 'surface'=>'cairoimagesurface'], -'cairo_image_surface_get_width' => ['int', 'surface'=>'cairoimagesurface'], -'cairo_in_fill' => ['bool', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_in_stroke' => ['bool', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_line_to' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_mask' => ['', 'pattern'=>'cairopattern', 'context'=>'cairocontext'], -'cairo_mask_surface' => ['', 'surface'=>'cairosurface', 'x='=>'string', 'y='=>'string', 'context='=>'cairocontext'], -'cairo_matrix_create_scale' => ['object', 'sx'=>'float', 'sy'=>'float'], -'cairo_matrix_init' => ['object', 'xx='=>'float', 'yx='=>'float', 'xy='=>'float', 'yy='=>'float', 'x0='=>'float', 'y0='=>'float'], -'cairo_matrix_init_identity' => ['object'], -'cairo_matrix_init_rotate' => ['object', 'radians'=>'float'], -'cairo_matrix_init_scale' => ['object', 'sx'=>'float', 'sy'=>'float'], -'cairo_matrix_init_translate' => ['object', 'tx'=>'float', 'ty'=>'float'], -'cairo_matrix_invert' => ['void', 'matrix'=>'cairomatrix'], -'cairo_matrix_multiply' => ['CairoMatrix', 'matrix1'=>'cairomatrix', 'matrix2'=>'cairomatrix'], -'cairo_matrix_rotate' => ['', 'matrix'=>'cairomatrix', 'radians'=>'float'], -'cairo_matrix_scale' => ['', 'sx'=>'float', 'sy'=>'float', 'context'=>'cairocontext'], -'cairo_matrix_transform_distance' => ['array', 'matrix'=>'cairomatrix', 'dx'=>'float', 'dy'=>'float'], -'cairo_matrix_transform_point' => ['array', 'matrix'=>'cairomatrix', 'dx'=>'float', 'dy'=>'float'], -'cairo_matrix_translate' => ['void', 'matrix'=>'cairomatrix', 'tx'=>'float', 'ty'=>'float'], -'cairo_move_to' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_new_path' => ['', 'context'=>'cairocontext'], -'cairo_new_sub_path' => ['', 'context'=>'cairocontext'], -'cairo_paint' => ['', 'context'=>'cairocontext'], -'cairo_paint_with_alpha' => ['', 'alpha'=>'string', 'context'=>'cairocontext'], -'cairo_path_extents' => ['array', 'context'=>'cairocontext'], -'cairo_pattern_add_color_stop_rgb' => ['void', 'pattern'=>'cairogradientpattern', 'offset'=>'float', 'red'=>'float', 'green'=>'float', 'blue'=>'float'], -'cairo_pattern_add_color_stop_rgba' => ['void', 'pattern'=>'cairogradientpattern', 'offset'=>'float', 'red'=>'float', 'green'=>'float', 'blue'=>'float', 'alpha'=>'float'], -'cairo_pattern_create_for_surface' => ['CairoPattern', 'surface'=>'cairosurface'], -'cairo_pattern_create_linear' => ['CairoPattern', 'x0'=>'float', 'y0'=>'float', 'x1'=>'float', 'y1'=>'float'], -'cairo_pattern_create_radial' => ['CairoPattern', 'x0'=>'float', 'y0'=>'float', 'r0'=>'float', 'x1'=>'float', 'y1'=>'float', 'r1'=>'float'], -'cairo_pattern_create_rgb' => ['CairoPattern', 'red'=>'float', 'green'=>'float', 'blue'=>'float'], -'cairo_pattern_create_rgba' => ['CairoPattern', 'red'=>'float', 'green'=>'float', 'blue'=>'float', 'alpha'=>'float'], -'cairo_pattern_get_color_stop_count' => ['int', 'pattern'=>'cairogradientpattern'], -'cairo_pattern_get_color_stop_rgba' => ['array', 'pattern'=>'cairogradientpattern', 'index'=>'int'], -'cairo_pattern_get_extend' => ['int', 'pattern'=>'string'], -'cairo_pattern_get_filter' => ['int', 'pattern'=>'cairosurfacepattern'], -'cairo_pattern_get_linear_points' => ['array', 'pattern'=>'cairolineargradient'], -'cairo_pattern_get_matrix' => ['CairoMatrix', 'pattern'=>'cairopattern'], -'cairo_pattern_get_radial_circles' => ['array', 'pattern'=>'cairoradialgradient'], -'cairo_pattern_get_rgba' => ['array', 'pattern'=>'cairosolidpattern'], -'cairo_pattern_get_surface' => ['CairoSurface', 'pattern'=>'cairosurfacepattern'], -'cairo_pattern_get_type' => ['int', 'pattern'=>'cairopattern'], -'cairo_pattern_set_extend' => ['void', 'pattern'=>'string', 'extend'=>'string'], -'cairo_pattern_set_filter' => ['void', 'pattern'=>'cairosurfacepattern', 'filter'=>'int'], -'cairo_pattern_set_matrix' => ['void', 'pattern'=>'cairopattern', 'matrix'=>'cairomatrix'], -'cairo_pattern_status' => ['int', 'pattern'=>'cairopattern'], -'cairo_pdf_surface_create' => ['CairoPdfSurface', 'file'=>'string', 'width'=>'float', 'height'=>'float'], -'cairo_pdf_surface_set_size' => ['void', 'surface'=>'cairopdfsurface', 'width'=>'float', 'height'=>'float'], -'cairo_pop_group' => ['', 'context'=>'cairocontext'], -'cairo_pop_group_to_source' => ['', 'context'=>'cairocontext'], -'cairo_ps_get_levels' => ['array'], -'cairo_ps_level_to_string' => ['string', 'level'=>'int'], -'cairo_ps_surface_create' => ['CairoPsSurface', 'file'=>'string', 'width'=>'float', 'height'=>'float'], -'cairo_ps_surface_dsc_begin_page_setup' => ['void', 'surface'=>'cairopssurface'], -'cairo_ps_surface_dsc_begin_setup' => ['void', 'surface'=>'cairopssurface'], -'cairo_ps_surface_dsc_comment' => ['void', 'surface'=>'cairopssurface', 'comment'=>'string'], -'cairo_ps_surface_get_eps' => ['bool', 'surface'=>'cairopssurface'], -'cairo_ps_surface_restrict_to_level' => ['void', 'surface'=>'cairopssurface', 'level'=>'int'], -'cairo_ps_surface_set_eps' => ['void', 'surface'=>'cairopssurface', 'level'=>'bool'], -'cairo_ps_surface_set_size' => ['void', 'surface'=>'cairopssurface', 'width'=>'float', 'height'=>'float'], -'cairo_push_group' => ['', 'context'=>'cairocontext'], -'cairo_push_group_with_content' => ['', 'content'=>'string', 'context'=>'cairocontext'], -'cairo_rectangle' => ['', 'x'=>'string', 'y'=>'string', 'width'=>'string', 'height'=>'string', 'context'=>'cairocontext'], -'cairo_rel_curve_to' => ['', 'x1'=>'string', 'y1'=>'string', 'x2'=>'string', 'y2'=>'string', 'x3'=>'string', 'y3'=>'string', 'context'=>'cairocontext'], -'cairo_rel_line_to' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_rel_move_to' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_reset_clip' => ['', 'context'=>'cairocontext'], -'cairo_restore' => ['', 'context'=>'cairocontext'], -'cairo_rotate' => ['', 'sx'=>'string', 'sy'=>'string', 'context'=>'cairocontext', 'angle'=>'string'], -'cairo_save' => ['', 'context'=>'cairocontext'], -'cairo_scale' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_scaled_font_create' => ['CairoScaledFont', 'fontface'=>'cairofontface', 'matrix'=>'cairomatrix', 'ctm'=>'cairomatrix', 'fontoptions'=>'cairofontoptions'], -'cairo_scaled_font_extents' => ['array', 'scaledfont'=>'cairoscaledfont'], -'cairo_scaled_font_get_ctm' => ['CairoMatrix', 'scaledfont'=>'cairoscaledfont'], -'cairo_scaled_font_get_font_face' => ['CairoFontFace', 'scaledfont'=>'cairoscaledfont'], -'cairo_scaled_font_get_font_matrix' => ['CairoFontOptions', 'scaledfont'=>'cairoscaledfont'], -'cairo_scaled_font_get_font_options' => ['CairoFontOptions', 'scaledfont'=>'cairoscaledfont'], -'cairo_scaled_font_get_scale_matrix' => ['CairoMatrix', 'scaledfont'=>'cairoscaledfont'], -'cairo_scaled_font_get_type' => ['int', 'scaledfont'=>'cairoscaledfont'], -'cairo_scaled_font_glyph_extents' => ['array', 'scaledfont'=>'cairoscaledfont', 'glyphs'=>'array'], -'cairo_scaled_font_status' => ['int', 'scaledfont'=>'cairoscaledfont'], -'cairo_scaled_font_text_extents' => ['array', 'scaledfont'=>'cairoscaledfont', 'text'=>'string'], -'cairo_select_font_face' => ['', 'family'=>'string', 'slant='=>'string', 'weight='=>'string', 'context='=>'cairocontext'], -'cairo_set_antialias' => ['', 'antialias='=>'string', 'context='=>'cairocontext'], -'cairo_set_dash' => ['', 'dashes'=>'array', 'offset='=>'string', 'context='=>'cairocontext'], -'cairo_set_fill_rule' => ['', 'setting'=>'string', 'context'=>'cairocontext'], -'cairo_set_font_face' => ['', 'fontface'=>'cairofontface', 'context'=>'cairocontext'], -'cairo_set_font_matrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], -'cairo_set_font_options' => ['', 'fontoptions'=>'cairofontoptions', 'context'=>'cairocontext'], -'cairo_set_font_size' => ['', 'size'=>'string', 'context'=>'cairocontext'], -'cairo_set_line_cap' => ['', 'setting'=>'string', 'context'=>'cairocontext'], -'cairo_set_line_join' => ['', 'setting'=>'string', 'context'=>'cairocontext'], -'cairo_set_line_width' => ['', 'width'=>'string', 'context'=>'cairocontext'], -'cairo_set_matrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], -'cairo_set_miter_limit' => ['', 'limit'=>'string', 'context'=>'cairocontext'], -'cairo_set_operator' => ['', 'setting'=>'string', 'context'=>'cairocontext'], -'cairo_set_scaled_font' => ['', 'scaledfont'=>'cairoscaledfont', 'context'=>'cairocontext'], -'cairo_set_source' => ['', 'red'=>'string', 'green'=>'string', 'blue'=>'string', 'alpha'=>'string', 'context'=>'cairocontext', 'pattern'=>'cairopattern'], -'cairo_set_source_surface' => ['', 'surface'=>'cairosurface', 'x='=>'string', 'y='=>'string', 'context='=>'cairocontext'], -'cairo_set_tolerance' => ['', 'tolerance'=>'string', 'context'=>'cairocontext'], -'cairo_show_page' => ['', 'context'=>'cairocontext'], -'cairo_show_text' => ['', 'text'=>'string', 'context'=>'cairocontext'], -'cairo_status' => ['int', 'context'=>'cairocontext'], -'cairo_status_to_string' => ['string', 'status'=>'int'], -'cairo_stroke' => ['', 'context'=>'cairocontext'], -'cairo_stroke_extents' => ['array', 'context'=>'cairocontext'], -'cairo_stroke_preserve' => ['', 'context'=>'cairocontext'], -'cairo_surface_copy_page' => ['void', 'surface'=>'cairosurface'], -'cairo_surface_create_similar' => ['CairoSurface', 'surface'=>'cairosurface', 'content'=>'int', 'width'=>'float', 'height'=>'float'], -'cairo_surface_finish' => ['void', 'surface'=>'cairosurface'], -'cairo_surface_flush' => ['void', 'surface'=>'cairosurface'], -'cairo_surface_get_content' => ['int', 'surface'=>'cairosurface'], -'cairo_surface_get_device_offset' => ['array', 'surface'=>'cairosurface'], -'cairo_surface_get_font_options' => ['CairoFontOptions', 'surface'=>'cairosurface'], -'cairo_surface_get_type' => ['int', 'surface'=>'cairosurface'], -'cairo_surface_mark_dirty' => ['void', 'surface'=>'cairosurface'], -'cairo_surface_mark_dirty_rectangle' => ['void', 'surface'=>'cairosurface', 'x'=>'float', 'y'=>'float', 'width'=>'float', 'height'=>'float'], -'cairo_surface_set_device_offset' => ['void', 'surface'=>'cairosurface', 'x'=>'float', 'y'=>'float'], -'cairo_surface_set_fallback_resolution' => ['void', 'surface'=>'cairosurface', 'x'=>'float', 'y'=>'float'], -'cairo_surface_show_page' => ['void', 'surface'=>'cairosurface'], -'cairo_surface_status' => ['int', 'surface'=>'cairosurface'], -'cairo_surface_write_to_png' => ['void', 'surface'=>'cairosurface', 'stream'=>'resource'], -'cairo_svg_get_versions' => ['array'], -'cairo_svg_surface_create' => ['CairoSvgSurface', 'file'=>'string', 'width'=>'float', 'height'=>'float'], -'cairo_svg_surface_get_versions' => ['array'], -'cairo_svg_surface_restrict_to_version' => ['void', 'surface'=>'cairosvgsurface', 'version'=>'int'], -'cairo_svg_version_to_string' => ['string', 'version'=>'int'], -'cairo_text_extents' => ['array', 'text'=>'string', 'context'=>'cairocontext'], -'cairo_text_path' => ['', 'string'=>'string', 'context'=>'cairocontext', 'text'=>'string'], -'cairo_transform' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], -'cairo_translate' => ['', 'tx'=>'string', 'ty'=>'string', 'context'=>'cairocontext', 'x'=>'string', 'y'=>'string'], -'cairo_user_to_device' => ['array', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_user_to_device_distance' => ['array', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'cairo_version' => ['int'], -'cairo_version_string' => ['string'], -'CairoContext::__construct' => ['void', 'surface'=>'CairoSurface'], -'CairoContext::appendPath' => ['', 'path'=>'cairopath', 'context'=>'cairocontext'], -'CairoContext::arc' => ['', 'x'=>'float', 'y'=>'float', 'radius'=>'float', 'angle1'=>'float', 'angle2'=>'float', 'context'=>'cairocontext'], -'CairoContext::arcNegative' => ['', 'x'=>'float', 'y'=>'float', 'radius'=>'float', 'angle1'=>'float', 'angle2'=>'float', 'context'=>'cairocontext'], -'CairoContext::clip' => ['', 'context'=>'cairocontext'], -'CairoContext::clipExtents' => ['array', 'context'=>'cairocontext'], -'CairoContext::clipPreserve' => ['', 'context'=>'cairocontext'], -'CairoContext::clipRectangleList' => ['array', 'context'=>'cairocontext'], -'CairoContext::closePath' => ['', 'context'=>'cairocontext'], -'CairoContext::copyPage' => ['', 'context'=>'cairocontext'], -'CairoContext::copyPath' => ['CairoPath', 'context'=>'cairocontext'], -'CairoContext::copyPathFlat' => ['CairoPath', 'context'=>'cairocontext'], -'CairoContext::curveTo' => ['', 'x1'=>'float', 'y1'=>'float', 'x2'=>'float', 'y2'=>'float', 'x3'=>'float', 'y3'=>'float', 'context'=>'cairocontext'], -'CairoContext::deviceToUser' => ['array', 'x'=>'float', 'y'=>'float', 'context'=>'cairocontext'], -'CairoContext::deviceToUserDistance' => ['array', 'x'=>'float', 'y'=>'float', 'context'=>'cairocontext'], -'CairoContext::fill' => ['', 'context'=>'cairocontext'], -'CairoContext::fillExtents' => ['array', 'context'=>'cairocontext'], -'CairoContext::fillPreserve' => ['', 'context'=>'cairocontext'], -'CairoContext::fontExtents' => ['array', 'context'=>'cairocontext'], -'CairoContext::getAntialias' => ['int', 'context'=>'cairocontext'], -'CairoContext::getCurrentPoint' => ['array', 'context'=>'cairocontext'], -'CairoContext::getDash' => ['array', 'context'=>'cairocontext'], -'CairoContext::getDashCount' => ['int', 'context'=>'cairocontext'], -'CairoContext::getFillRule' => ['int', 'context'=>'cairocontext'], -'CairoContext::getFontFace' => ['', 'context'=>'cairocontext'], -'CairoContext::getFontMatrix' => ['', 'context'=>'cairocontext'], -'CairoContext::getFontOptions' => ['', 'context'=>'cairocontext'], -'CairoContext::getGroupTarget' => ['', 'context'=>'cairocontext'], -'CairoContext::getLineCap' => ['int', 'context'=>'cairocontext'], -'CairoContext::getLineJoin' => ['int', 'context'=>'cairocontext'], -'CairoContext::getLineWidth' => ['float', 'context'=>'cairocontext'], -'CairoContext::getMatrix' => ['', 'context'=>'cairocontext'], -'CairoContext::getMiterLimit' => ['float', 'context'=>'cairocontext'], -'CairoContext::getOperator' => ['int', 'context'=>'cairocontext'], -'CairoContext::getScaledFont' => ['', 'context'=>'cairocontext'], -'CairoContext::getSource' => ['', 'context'=>'cairocontext'], -'CairoContext::getTarget' => ['', 'context'=>'cairocontext'], -'CairoContext::getTolerance' => ['float', 'context'=>'cairocontext'], -'CairoContext::glyphPath' => ['', 'glyphs'=>'array', 'context'=>'cairocontext'], -'CairoContext::hasCurrentPoint' => ['bool', 'context'=>'cairocontext'], -'CairoContext::identityMatrix' => ['', 'context'=>'cairocontext'], -'CairoContext::inFill' => ['bool', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::inStroke' => ['bool', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::lineTo' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::mask' => ['', 'pattern'=>'cairopattern', 'context'=>'cairocontext'], -'CairoContext::maskSurface' => ['', 'surface'=>'cairosurface', 'x='=>'string', 'y='=>'string', 'context='=>'cairocontext'], -'CairoContext::moveTo' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::newPath' => ['', 'context'=>'cairocontext'], -'CairoContext::newSubPath' => ['', 'context'=>'cairocontext'], -'CairoContext::paint' => ['', 'context'=>'cairocontext'], -'CairoContext::paintWithAlpha' => ['', 'alpha'=>'string', 'context'=>'cairocontext'], -'CairoContext::pathExtents' => ['array', 'context'=>'cairocontext'], -'CairoContext::popGroup' => ['', 'context'=>'cairocontext'], -'CairoContext::popGroupToSource' => ['', 'context'=>'cairocontext'], -'CairoContext::pushGroup' => ['', 'context'=>'cairocontext'], -'CairoContext::pushGroupWithContent' => ['', 'content'=>'string', 'context'=>'cairocontext'], -'CairoContext::rectangle' => ['', 'x'=>'string', 'y'=>'string', 'width'=>'string', 'height'=>'string', 'context'=>'cairocontext'], -'CairoContext::relCurveTo' => ['', 'x1'=>'string', 'y1'=>'string', 'x2'=>'string', 'y2'=>'string', 'x3'=>'string', 'y3'=>'string', 'context'=>'cairocontext'], -'CairoContext::relLineTo' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::relMoveTo' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::resetClip' => ['', 'context'=>'cairocontext'], -'CairoContext::restore' => ['', 'context'=>'cairocontext'], -'CairoContext::rotate' => ['', 'angle'=>'string', 'context'=>'cairocontext'], -'CairoContext::save' => ['', 'context'=>'cairocontext'], -'CairoContext::scale' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::selectFontFace' => ['', 'family'=>'string', 'slant='=>'string', 'weight='=>'string', 'context='=>'cairocontext'], -'CairoContext::setAntialias' => ['', 'antialias='=>'string', 'context='=>'cairocontext'], -'CairoContext::setDash' => ['', 'dashes'=>'array', 'offset='=>'string', 'context='=>'cairocontext'], -'CairoContext::setFillRule' => ['', 'setting'=>'string', 'context'=>'cairocontext'], -'CairoContext::setFontFace' => ['', 'fontface'=>'cairofontface', 'context'=>'cairocontext'], -'CairoContext::setFontMatrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], -'CairoContext::setFontOptions' => ['', 'fontoptions'=>'cairofontoptions', 'context'=>'cairocontext'], -'CairoContext::setFontSize' => ['', 'size'=>'string', 'context'=>'cairocontext'], -'CairoContext::setLineCap' => ['', 'setting'=>'string', 'context'=>'cairocontext'], -'CairoContext::setLineJoin' => ['', 'setting'=>'string', 'context'=>'cairocontext'], -'CairoContext::setLineWidth' => ['', 'width'=>'string', 'context'=>'cairocontext'], -'CairoContext::setMatrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], -'CairoContext::setMiterLimit' => ['', 'limit'=>'string', 'context'=>'cairocontext'], -'CairoContext::setOperator' => ['', 'setting'=>'string', 'context'=>'cairocontext'], -'CairoContext::setScaledFont' => ['', 'scaledfont'=>'cairoscaledfont', 'context'=>'cairocontext'], -'CairoContext::setSource' => ['', 'pattern'=>'cairopattern', 'context'=>'cairocontext'], -'CairoContext::setSourceRGB' => ['', 'red'=>'string', 'green'=>'string', 'blue'=>'string', 'context'=>'cairocontext', 'pattern'=>'cairopattern'], -'CairoContext::setSourceRGBA' => ['', 'red'=>'string', 'green'=>'string', 'blue'=>'string', 'alpha'=>'string', 'context'=>'cairocontext', 'pattern'=>'cairopattern'], -'CairoContext::setSourceSurface' => ['', 'surface'=>'cairosurface', 'x='=>'string', 'y='=>'string', 'context='=>'cairocontext'], -'CairoContext::setTolerance' => ['', 'tolerance'=>'string', 'context'=>'cairocontext'], -'CairoContext::showPage' => ['', 'context'=>'cairocontext'], -'CairoContext::showText' => ['', 'text'=>'string', 'context'=>'cairocontext'], -'CairoContext::status' => ['int', 'context'=>'cairocontext'], -'CairoContext::stroke' => ['', 'context'=>'cairocontext'], -'CairoContext::strokeExtents' => ['array', 'context'=>'cairocontext'], -'CairoContext::strokePreserve' => ['', 'context'=>'cairocontext'], -'CairoContext::textExtents' => ['array', 'text'=>'string', 'context'=>'cairocontext'], -'CairoContext::textPath' => ['', 'string'=>'string', 'context'=>'cairocontext', 'text'=>'string'], -'CairoContext::transform' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], -'CairoContext::translate' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::userToDevice' => ['array', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoContext::userToDeviceDistance' => ['array', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], -'CairoFontFace::__construct' => ['void'], -'CairoFontFace::getType' => ['int'], -'CairoFontFace::status' => ['int', 'fontface'=>'cairofontface'], -'CairoFontOptions::__construct' => ['void'], -'CairoFontOptions::equal' => ['bool', 'other'=>'string'], -'CairoFontOptions::getAntialias' => ['int', 'context'=>'cairocontext'], -'CairoFontOptions::getHintMetrics' => ['int'], -'CairoFontOptions::getHintStyle' => ['int'], -'CairoFontOptions::getSubpixelOrder' => ['int'], -'CairoFontOptions::hash' => ['int'], -'CairoFontOptions::merge' => ['void', 'other'=>'string'], -'CairoFontOptions::setAntialias' => ['', 'antialias='=>'string', 'context='=>'cairocontext'], -'CairoFontOptions::setHintMetrics' => ['void', 'hint_metrics'=>'string'], -'CairoFontOptions::setHintStyle' => ['void', 'hint_style'=>'string'], -'CairoFontOptions::setSubpixelOrder' => ['void', 'subpixel_order'=>'string'], -'CairoFontOptions::status' => ['int', 'context'=>'cairocontext'], -'CairoFormat::strideForWidth' => ['int', 'format'=>'int', 'width'=>'int'], -'CairoGradientPattern::addColorStopRgb' => ['void', 'offset'=>'string', 'red'=>'string', 'green'=>'string', 'blue'=>'string'], -'CairoGradientPattern::addColorStopRgba' => ['void', 'offset'=>'string', 'red'=>'string', 'green'=>'string', 'blue'=>'string', 'alpha'=>'string'], -'CairoGradientPattern::getColorStopCount' => ['int'], -'CairoGradientPattern::getColorStopRgba' => ['array', 'index'=>'string'], -'CairoGradientPattern::getExtend' => ['int'], -'CairoGradientPattern::setExtend' => ['void', 'extend'=>'int'], -'CairoImageSurface::__construct' => ['void', 'format'=>'int', 'width'=>'int', 'height'=>'int'], -'CairoImageSurface::createForData' => ['void', 'data'=>'string', 'format'=>'int', 'width'=>'int', 'height'=>'int', 'stride='=>'int'], -'CairoImageSurface::createFromPng' => ['CairoImageSurface', 'file'=>'string'], -'CairoImageSurface::getData' => ['string'], -'CairoImageSurface::getFormat' => ['int'], -'CairoImageSurface::getHeight' => ['int'], -'CairoImageSurface::getStride' => ['int'], -'CairoImageSurface::getWidth' => ['int'], -'CairoLinearGradient::__construct' => ['void', 'x0'=>'float', 'y0'=>'float', 'x1'=>'float', 'y1'=>'float'], -'CairoLinearGradient::getPoints' => ['array'], -'CairoMatrix::__construct' => ['void', 'xx='=>'float', 'yx='=>'float', 'xy='=>'float', 'yy='=>'float', 'x0='=>'float', 'y0='=>'float'], -'CairoMatrix::initIdentity' => ['object'], -'CairoMatrix::initRotate' => ['object', 'radians'=>'float'], -'CairoMatrix::initScale' => ['object', 'sx'=>'float', 'sy'=>'float'], -'CairoMatrix::initTranslate' => ['object', 'tx'=>'float', 'ty'=>'float'], -'CairoMatrix::invert' => ['void'], -'CairoMatrix::multiply' => ['CairoMatrix', 'matrix1'=>'cairomatrix', 'matrix2'=>'cairomatrix'], -'CairoMatrix::rotate' => ['', 'sx'=>'string', 'sy'=>'string', 'context'=>'cairocontext', 'angle'=>'string'], -'CairoMatrix::scale' => ['', 'sx'=>'float', 'sy'=>'float', 'context'=>'cairocontext'], -'CairoMatrix::transformDistance' => ['array', 'dx'=>'string', 'dy'=>'string'], -'CairoMatrix::transformPoint' => ['array', 'dx'=>'string', 'dy'=>'string'], -'CairoMatrix::translate' => ['', 'tx'=>'string', 'ty'=>'string', 'context'=>'cairocontext', 'x'=>'string', 'y'=>'string'], -'CairoPattern::__construct' => ['void'], -'CairoPattern::getMatrix' => ['', 'context'=>'cairocontext'], -'CairoPattern::getType' => ['int'], -'CairoPattern::setMatrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], -'CairoPattern::status' => ['int', 'context'=>'cairocontext'], -'CairoPdfSurface::__construct' => ['void', 'file'=>'string', 'width'=>'float', 'height'=>'float'], -'CairoPdfSurface::setSize' => ['void', 'width'=>'string', 'height'=>'string'], -'CairoPsSurface::__construct' => ['void', 'file'=>'string', 'width'=>'float', 'height'=>'float'], -'CairoPsSurface::dscBeginPageSetup' => ['void'], -'CairoPsSurface::dscBeginSetup' => ['void'], -'CairoPsSurface::dscComment' => ['void', 'comment'=>'string'], -'CairoPsSurface::getEps' => ['bool'], -'CairoPsSurface::getLevels' => ['array'], -'CairoPsSurface::levelToString' => ['string', 'level'=>'int'], -'CairoPsSurface::restrictToLevel' => ['void', 'level'=>'string'], -'CairoPsSurface::setEps' => ['void', 'level'=>'string'], -'CairoPsSurface::setSize' => ['void', 'width'=>'string', 'height'=>'string'], -'CairoRadialGradient::__construct' => ['void', 'x0'=>'float', 'y0'=>'float', 'r0'=>'float', 'x1'=>'float', 'y1'=>'float', 'r1'=>'float'], -'CairoRadialGradient::getCircles' => ['array'], -'CairoScaledFont::__construct' => ['void', 'font_face'=>'CairoFontFace', 'matrix'=>'CairoMatrix', 'ctm'=>'CairoMatrix', 'options'=>'CairoFontOptions'], -'CairoScaledFont::extents' => ['array'], -'CairoScaledFont::getCtm' => ['CairoMatrix'], -'CairoScaledFont::getFontFace' => ['', 'context'=>'cairocontext'], -'CairoScaledFont::getFontMatrix' => ['', 'context'=>'cairocontext'], -'CairoScaledFont::getFontOptions' => ['', 'context'=>'cairocontext'], -'CairoScaledFont::getScaleMatrix' => ['void'], -'CairoScaledFont::getType' => ['int'], -'CairoScaledFont::glyphExtents' => ['array', 'glyphs'=>'string'], -'CairoScaledFont::status' => ['int', 'context'=>'cairocontext'], -'CairoScaledFont::textExtents' => ['array', 'text'=>'string', 'context'=>'cairocontext'], -'CairoSolidPattern::__construct' => ['void', 'red'=>'float', 'green'=>'float', 'blue'=>'float', 'alpha='=>'float'], -'CairoSolidPattern::getRgba' => ['array'], -'CairoSurface::__construct' => ['void'], -'CairoSurface::copyPage' => ['', 'context'=>'cairocontext'], -'CairoSurface::createSimilar' => ['void', 'other'=>'cairosurface', 'content'=>'int', 'width'=>'string', 'height'=>'string'], -'CairoSurface::finish' => ['void'], -'CairoSurface::flush' => ['void'], -'CairoSurface::getContent' => ['int'], -'CairoSurface::getDeviceOffset' => ['array'], -'CairoSurface::getFontOptions' => ['', 'context'=>'cairocontext'], -'CairoSurface::getType' => ['int'], -'CairoSurface::markDirty' => ['void'], -'CairoSurface::markDirtyRectangle' => ['void', 'x'=>'string', 'y'=>'string', 'width'=>'string', 'height'=>'string'], -'CairoSurface::setDeviceOffset' => ['void', 'x'=>'string', 'y'=>'string'], -'CairoSurface::setFallbackResolution' => ['void', 'x'=>'string', 'y'=>'string'], -'CairoSurface::showPage' => ['', 'context'=>'cairocontext'], -'CairoSurface::status' => ['int', 'context'=>'cairocontext'], -'CairoSurface::writeToPng' => ['void', 'file'=>'string'], -'CairoSurfacePattern::__construct' => ['void', 'surface'=>'CairoSurface'], -'CairoSurfacePattern::getExtend' => ['int'], -'CairoSurfacePattern::getFilter' => ['int'], -'CairoSurfacePattern::getSurface' => ['void'], -'CairoSurfacePattern::setExtend' => ['void', 'extend'=>'int'], -'CairoSurfacePattern::setFilter' => ['void', 'filter'=>'string'], -'CairoSvgSurface::__construct' => ['void', 'file'=>'string', 'width'=>'float', 'height'=>'float'], -'CairoSvgSurface::getVersions' => ['array'], -'CairoSvgSurface::restrictToVersion' => ['void', 'version'=>'string'], -'CairoSvgSurface::versionToString' => ['string', 'version'=>'int'], 'cal_days_in_month' => ['int', 'calendar'=>'int', 'month'=>'int', 'year'=>'int'], 'cal_from_jd' => ['array{date:string,month:int,day:int,year:int,dow:int,abbrevdayname:string,dayname:string,abbrevmonth:string,monthname:string}', 'julian_day'=>'int', 'calendar'=>'int'], 'cal_info' => ['array', 'calendar='=>'int'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 33fa7f57376..07c0010a7f0 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -316,211 +316,6 @@ 'CachingIterator::rewind' => ['void'], 'CachingIterator::setFlags' => ['void', 'flags'=>'int'], 'CachingIterator::valid' => ['bool'], - 'Cairo::availableFonts' => ['array'], - 'Cairo::availableSurfaces' => ['array'], - 'Cairo::statusToString' => ['string', 'status'=>'int'], - 'Cairo::version' => ['int'], - 'Cairo::versionString' => ['string'], - 'CairoContext::__construct' => ['void', 'surface'=>'CairoSurface'], - 'CairoContext::appendPath' => ['', 'path'=>'cairopath', 'context'=>'cairocontext'], - 'CairoContext::arc' => ['', 'x'=>'float', 'y'=>'float', 'radius'=>'float', 'angle1'=>'float', 'angle2'=>'float', 'context'=>'cairocontext'], - 'CairoContext::arcNegative' => ['', 'x'=>'float', 'y'=>'float', 'radius'=>'float', 'angle1'=>'float', 'angle2'=>'float', 'context'=>'cairocontext'], - 'CairoContext::clip' => ['', 'context'=>'cairocontext'], - 'CairoContext::clipExtents' => ['array', 'context'=>'cairocontext'], - 'CairoContext::clipPreserve' => ['', 'context'=>'cairocontext'], - 'CairoContext::clipRectangleList' => ['array', 'context'=>'cairocontext'], - 'CairoContext::closePath' => ['', 'context'=>'cairocontext'], - 'CairoContext::copyPage' => ['', 'context'=>'cairocontext'], - 'CairoContext::copyPath' => ['CairoPath', 'context'=>'cairocontext'], - 'CairoContext::copyPathFlat' => ['CairoPath', 'context'=>'cairocontext'], - 'CairoContext::curveTo' => ['', 'x1'=>'float', 'y1'=>'float', 'x2'=>'float', 'y2'=>'float', 'x3'=>'float', 'y3'=>'float', 'context'=>'cairocontext'], - 'CairoContext::deviceToUser' => ['array', 'x'=>'float', 'y'=>'float', 'context'=>'cairocontext'], - 'CairoContext::deviceToUserDistance' => ['array', 'x'=>'float', 'y'=>'float', 'context'=>'cairocontext'], - 'CairoContext::fill' => ['', 'context'=>'cairocontext'], - 'CairoContext::fillExtents' => ['array', 'context'=>'cairocontext'], - 'CairoContext::fillPreserve' => ['', 'context'=>'cairocontext'], - 'CairoContext::fontExtents' => ['array', 'context'=>'cairocontext'], - 'CairoContext::getAntialias' => ['int', 'context'=>'cairocontext'], - 'CairoContext::getCurrentPoint' => ['array', 'context'=>'cairocontext'], - 'CairoContext::getDash' => ['array', 'context'=>'cairocontext'], - 'CairoContext::getDashCount' => ['int', 'context'=>'cairocontext'], - 'CairoContext::getFillRule' => ['int', 'context'=>'cairocontext'], - 'CairoContext::getFontFace' => ['', 'context'=>'cairocontext'], - 'CairoContext::getFontMatrix' => ['', 'context'=>'cairocontext'], - 'CairoContext::getFontOptions' => ['', 'context'=>'cairocontext'], - 'CairoContext::getGroupTarget' => ['', 'context'=>'cairocontext'], - 'CairoContext::getLineCap' => ['int', 'context'=>'cairocontext'], - 'CairoContext::getLineJoin' => ['int', 'context'=>'cairocontext'], - 'CairoContext::getLineWidth' => ['float', 'context'=>'cairocontext'], - 'CairoContext::getMatrix' => ['', 'context'=>'cairocontext'], - 'CairoContext::getMiterLimit' => ['float', 'context'=>'cairocontext'], - 'CairoContext::getOperator' => ['int', 'context'=>'cairocontext'], - 'CairoContext::getScaledFont' => ['', 'context'=>'cairocontext'], - 'CairoContext::getSource' => ['', 'context'=>'cairocontext'], - 'CairoContext::getTarget' => ['', 'context'=>'cairocontext'], - 'CairoContext::getTolerance' => ['float', 'context'=>'cairocontext'], - 'CairoContext::glyphPath' => ['', 'glyphs'=>'array', 'context'=>'cairocontext'], - 'CairoContext::hasCurrentPoint' => ['bool', 'context'=>'cairocontext'], - 'CairoContext::identityMatrix' => ['', 'context'=>'cairocontext'], - 'CairoContext::inFill' => ['bool', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::inStroke' => ['bool', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::lineTo' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::mask' => ['', 'pattern'=>'cairopattern', 'context'=>'cairocontext'], - 'CairoContext::maskSurface' => ['', 'surface'=>'cairosurface', 'x='=>'string', 'y='=>'string', 'context='=>'cairocontext'], - 'CairoContext::moveTo' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::newPath' => ['', 'context'=>'cairocontext'], - 'CairoContext::newSubPath' => ['', 'context'=>'cairocontext'], - 'CairoContext::paint' => ['', 'context'=>'cairocontext'], - 'CairoContext::paintWithAlpha' => ['', 'alpha'=>'string', 'context'=>'cairocontext'], - 'CairoContext::pathExtents' => ['array', 'context'=>'cairocontext'], - 'CairoContext::popGroup' => ['', 'context'=>'cairocontext'], - 'CairoContext::popGroupToSource' => ['', 'context'=>'cairocontext'], - 'CairoContext::pushGroup' => ['', 'context'=>'cairocontext'], - 'CairoContext::pushGroupWithContent' => ['', 'content'=>'string', 'context'=>'cairocontext'], - 'CairoContext::rectangle' => ['', 'x'=>'string', 'y'=>'string', 'width'=>'string', 'height'=>'string', 'context'=>'cairocontext'], - 'CairoContext::relCurveTo' => ['', 'x1'=>'string', 'y1'=>'string', 'x2'=>'string', 'y2'=>'string', 'x3'=>'string', 'y3'=>'string', 'context'=>'cairocontext'], - 'CairoContext::relLineTo' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::relMoveTo' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::resetClip' => ['', 'context'=>'cairocontext'], - 'CairoContext::restore' => ['', 'context'=>'cairocontext'], - 'CairoContext::rotate' => ['', 'angle'=>'string', 'context'=>'cairocontext'], - 'CairoContext::save' => ['', 'context'=>'cairocontext'], - 'CairoContext::scale' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::selectFontFace' => ['', 'family'=>'string', 'slant='=>'string', 'weight='=>'string', 'context='=>'cairocontext'], - 'CairoContext::setAntialias' => ['', 'antialias='=>'string', 'context='=>'cairocontext'], - 'CairoContext::setDash' => ['', 'dashes'=>'array', 'offset='=>'string', 'context='=>'cairocontext'], - 'CairoContext::setFillRule' => ['', 'setting'=>'string', 'context'=>'cairocontext'], - 'CairoContext::setFontFace' => ['', 'fontface'=>'cairofontface', 'context'=>'cairocontext'], - 'CairoContext::setFontMatrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], - 'CairoContext::setFontOptions' => ['', 'fontoptions'=>'cairofontoptions', 'context'=>'cairocontext'], - 'CairoContext::setFontSize' => ['', 'size'=>'string', 'context'=>'cairocontext'], - 'CairoContext::setLineCap' => ['', 'setting'=>'string', 'context'=>'cairocontext'], - 'CairoContext::setLineJoin' => ['', 'setting'=>'string', 'context'=>'cairocontext'], - 'CairoContext::setLineWidth' => ['', 'width'=>'string', 'context'=>'cairocontext'], - 'CairoContext::setMatrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], - 'CairoContext::setMiterLimit' => ['', 'limit'=>'string', 'context'=>'cairocontext'], - 'CairoContext::setOperator' => ['', 'setting'=>'string', 'context'=>'cairocontext'], - 'CairoContext::setScaledFont' => ['', 'scaledfont'=>'cairoscaledfont', 'context'=>'cairocontext'], - 'CairoContext::setSource' => ['', 'pattern'=>'cairopattern', 'context'=>'cairocontext'], - 'CairoContext::setSourceRGB' => ['', 'red'=>'string', 'green'=>'string', 'blue'=>'string', 'context'=>'cairocontext', 'pattern'=>'cairopattern'], - 'CairoContext::setSourceRGBA' => ['', 'red'=>'string', 'green'=>'string', 'blue'=>'string', 'alpha'=>'string', 'context'=>'cairocontext', 'pattern'=>'cairopattern'], - 'CairoContext::setSourceSurface' => ['', 'surface'=>'cairosurface', 'x='=>'string', 'y='=>'string', 'context='=>'cairocontext'], - 'CairoContext::setTolerance' => ['', 'tolerance'=>'string', 'context'=>'cairocontext'], - 'CairoContext::showPage' => ['', 'context'=>'cairocontext'], - 'CairoContext::showText' => ['', 'text'=>'string', 'context'=>'cairocontext'], - 'CairoContext::status' => ['int', 'context'=>'cairocontext'], - 'CairoContext::stroke' => ['', 'context'=>'cairocontext'], - 'CairoContext::strokeExtents' => ['array', 'context'=>'cairocontext'], - 'CairoContext::strokePreserve' => ['', 'context'=>'cairocontext'], - 'CairoContext::textExtents' => ['array', 'text'=>'string', 'context'=>'cairocontext'], - 'CairoContext::textPath' => ['', 'string'=>'string', 'context'=>'cairocontext', 'text'=>'string'], - 'CairoContext::transform' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], - 'CairoContext::translate' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::userToDevice' => ['array', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoContext::userToDeviceDistance' => ['array', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'CairoFontFace::__construct' => ['void'], - 'CairoFontFace::getType' => ['int'], - 'CairoFontFace::status' => ['int', 'fontface'=>'cairofontface'], - 'CairoFontOptions::__construct' => ['void'], - 'CairoFontOptions::equal' => ['bool', 'other'=>'string'], - 'CairoFontOptions::getAntialias' => ['int', 'context'=>'cairocontext'], - 'CairoFontOptions::getHintMetrics' => ['int'], - 'CairoFontOptions::getHintStyle' => ['int'], - 'CairoFontOptions::getSubpixelOrder' => ['int'], - 'CairoFontOptions::hash' => ['int'], - 'CairoFontOptions::merge' => ['void', 'other'=>'string'], - 'CairoFontOptions::setAntialias' => ['', 'antialias='=>'string', 'context='=>'cairocontext'], - 'CairoFontOptions::setHintMetrics' => ['void', 'hint_metrics'=>'string'], - 'CairoFontOptions::setHintStyle' => ['void', 'hint_style'=>'string'], - 'CairoFontOptions::setSubpixelOrder' => ['void', 'subpixel_order'=>'string'], - 'CairoFontOptions::status' => ['int', 'context'=>'cairocontext'], - 'CairoFormat::strideForWidth' => ['int', 'format'=>'int', 'width'=>'int'], - 'CairoGradientPattern::addColorStopRgb' => ['void', 'offset'=>'string', 'red'=>'string', 'green'=>'string', 'blue'=>'string'], - 'CairoGradientPattern::addColorStopRgba' => ['void', 'offset'=>'string', 'red'=>'string', 'green'=>'string', 'blue'=>'string', 'alpha'=>'string'], - 'CairoGradientPattern::getColorStopCount' => ['int'], - 'CairoGradientPattern::getColorStopRgba' => ['array', 'index'=>'string'], - 'CairoGradientPattern::getExtend' => ['int'], - 'CairoGradientPattern::setExtend' => ['void', 'extend'=>'int'], - 'CairoImageSurface::__construct' => ['void', 'format'=>'int', 'width'=>'int', 'height'=>'int'], - 'CairoImageSurface::createForData' => ['void', 'data'=>'string', 'format'=>'int', 'width'=>'int', 'height'=>'int', 'stride='=>'int'], - 'CairoImageSurface::createFromPng' => ['CairoImageSurface', 'file'=>'string'], - 'CairoImageSurface::getData' => ['string'], - 'CairoImageSurface::getFormat' => ['int'], - 'CairoImageSurface::getHeight' => ['int'], - 'CairoImageSurface::getStride' => ['int'], - 'CairoImageSurface::getWidth' => ['int'], - 'CairoLinearGradient::__construct' => ['void', 'x0'=>'float', 'y0'=>'float', 'x1'=>'float', 'y1'=>'float'], - 'CairoLinearGradient::getPoints' => ['array'], - 'CairoMatrix::__construct' => ['void', 'xx='=>'float', 'yx='=>'float', 'xy='=>'float', 'yy='=>'float', 'x0='=>'float', 'y0='=>'float'], - 'CairoMatrix::initIdentity' => ['object'], - 'CairoMatrix::initRotate' => ['object', 'radians'=>'float'], - 'CairoMatrix::initScale' => ['object', 'sx'=>'float', 'sy'=>'float'], - 'CairoMatrix::initTranslate' => ['object', 'tx'=>'float', 'ty'=>'float'], - 'CairoMatrix::invert' => ['void'], - 'CairoMatrix::multiply' => ['CairoMatrix', 'matrix1'=>'cairomatrix', 'matrix2'=>'cairomatrix'], - 'CairoMatrix::rotate' => ['', 'sx'=>'string', 'sy'=>'string', 'context'=>'cairocontext', 'angle'=>'string'], - 'CairoMatrix::scale' => ['', 'sx'=>'float', 'sy'=>'float', 'context'=>'cairocontext'], - 'CairoMatrix::transformDistance' => ['array', 'dx'=>'string', 'dy'=>'string'], - 'CairoMatrix::transformPoint' => ['array', 'dx'=>'string', 'dy'=>'string'], - 'CairoMatrix::translate' => ['', 'tx'=>'string', 'ty'=>'string', 'context'=>'cairocontext', 'x'=>'string', 'y'=>'string'], - 'CairoPattern::__construct' => ['void'], - 'CairoPattern::getMatrix' => ['', 'context'=>'cairocontext'], - 'CairoPattern::getType' => ['int'], - 'CairoPattern::setMatrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], - 'CairoPattern::status' => ['int', 'context'=>'cairocontext'], - 'CairoPdfSurface::__construct' => ['void', 'file'=>'string', 'width'=>'float', 'height'=>'float'], - 'CairoPdfSurface::setSize' => ['void', 'width'=>'string', 'height'=>'string'], - 'CairoPsSurface::__construct' => ['void', 'file'=>'string', 'width'=>'float', 'height'=>'float'], - 'CairoPsSurface::dscBeginPageSetup' => ['void'], - 'CairoPsSurface::dscBeginSetup' => ['void'], - 'CairoPsSurface::dscComment' => ['void', 'comment'=>'string'], - 'CairoPsSurface::getEps' => ['bool'], - 'CairoPsSurface::getLevels' => ['array'], - 'CairoPsSurface::levelToString' => ['string', 'level'=>'int'], - 'CairoPsSurface::restrictToLevel' => ['void', 'level'=>'string'], - 'CairoPsSurface::setEps' => ['void', 'level'=>'string'], - 'CairoPsSurface::setSize' => ['void', 'width'=>'string', 'height'=>'string'], - 'CairoRadialGradient::__construct' => ['void', 'x0'=>'float', 'y0'=>'float', 'r0'=>'float', 'x1'=>'float', 'y1'=>'float', 'r1'=>'float'], - 'CairoRadialGradient::getCircles' => ['array'], - 'CairoScaledFont::__construct' => ['void', 'font_face'=>'CairoFontFace', 'matrix'=>'CairoMatrix', 'ctm'=>'CairoMatrix', 'options'=>'CairoFontOptions'], - 'CairoScaledFont::extents' => ['array'], - 'CairoScaledFont::getCtm' => ['CairoMatrix'], - 'CairoScaledFont::getFontFace' => ['', 'context'=>'cairocontext'], - 'CairoScaledFont::getFontMatrix' => ['', 'context'=>'cairocontext'], - 'CairoScaledFont::getFontOptions' => ['', 'context'=>'cairocontext'], - 'CairoScaledFont::getScaleMatrix' => ['void'], - 'CairoScaledFont::getType' => ['int'], - 'CairoScaledFont::glyphExtents' => ['array', 'glyphs'=>'string'], - 'CairoScaledFont::status' => ['int', 'context'=>'cairocontext'], - 'CairoScaledFont::textExtents' => ['array', 'text'=>'string', 'context'=>'cairocontext'], - 'CairoSolidPattern::__construct' => ['void', 'red'=>'float', 'green'=>'float', 'blue'=>'float', 'alpha='=>'float'], - 'CairoSolidPattern::getRgba' => ['array'], - 'CairoSurface::__construct' => ['void'], - 'CairoSurface::copyPage' => ['', 'context'=>'cairocontext'], - 'CairoSurface::createSimilar' => ['void', 'other'=>'cairosurface', 'content'=>'int', 'width'=>'string', 'height'=>'string'], - 'CairoSurface::finish' => ['void'], - 'CairoSurface::flush' => ['void'], - 'CairoSurface::getContent' => ['int'], - 'CairoSurface::getDeviceOffset' => ['array'], - 'CairoSurface::getFontOptions' => ['', 'context'=>'cairocontext'], - 'CairoSurface::getType' => ['int'], - 'CairoSurface::markDirty' => ['void'], - 'CairoSurface::markDirtyRectangle' => ['void', 'x'=>'string', 'y'=>'string', 'width'=>'string', 'height'=>'string'], - 'CairoSurface::setDeviceOffset' => ['void', 'x'=>'string', 'y'=>'string'], - 'CairoSurface::setFallbackResolution' => ['void', 'x'=>'string', 'y'=>'string'], - 'CairoSurface::showPage' => ['', 'context'=>'cairocontext'], - 'CairoSurface::status' => ['int', 'context'=>'cairocontext'], - 'CairoSurface::writeToPng' => ['void', 'file'=>'string'], - 'CairoSurfacePattern::__construct' => ['void', 'surface'=>'CairoSurface'], - 'CairoSurfacePattern::getExtend' => ['int'], - 'CairoSurfacePattern::getFilter' => ['int'], - 'CairoSurfacePattern::getSurface' => ['void'], - 'CairoSurfacePattern::setExtend' => ['void', 'extend'=>'int'], - 'CairoSurfacePattern::setFilter' => ['void', 'filter'=>'string'], - 'CairoSvgSurface::__construct' => ['void', 'file'=>'string', 'width'=>'float', 'height'=>'float'], - 'CairoSvgSurface::getVersions' => ['array'], - 'CairoSvgSurface::restrictToVersion' => ['void', 'version'=>'string'], - 'CairoSvgSurface::versionToString' => ['string', 'version'=>'int'], 'CallbackFilterIterator::__construct' => ['void', 'iterator'=>'Iterator', 'func'=>'callable(mixed):bool|callable(mixed,mixed):bool|callable(mixed,mixed,mixed):bool'], 'CallbackFilterIterator::accept' => ['bool'], 'CallbackFilterIterator::current' => ['mixed'], @@ -9702,207 +9497,6 @@ 'bzopen' => ['resource|false', 'file'=>'string|resource', 'mode'=>'string'], 'bzread' => ['string|false', 'bz'=>'resource', 'length='=>'int'], 'bzwrite' => ['int|false', 'bz'=>'resource', 'data'=>'string', 'length='=>'int'], - 'cairo_append_path' => ['', 'path'=>'cairopath', 'context'=>'cairocontext'], - 'cairo_arc' => ['', 'x'=>'float', 'y'=>'float', 'radius'=>'float', 'angle1'=>'float', 'angle2'=>'float', 'context'=>'cairocontext'], - 'cairo_arc_negative' => ['', 'x'=>'float', 'y'=>'float', 'radius'=>'float', 'angle1'=>'float', 'angle2'=>'float', 'context'=>'cairocontext'], - 'cairo_available_fonts' => ['array'], - 'cairo_available_surfaces' => ['array'], - 'cairo_clip' => ['', 'context'=>'cairocontext'], - 'cairo_clip_extents' => ['array', 'context'=>'cairocontext'], - 'cairo_clip_preserve' => ['', 'context'=>'cairocontext'], - 'cairo_clip_rectangle_list' => ['array', 'context'=>'cairocontext'], - 'cairo_close_path' => ['', 'context'=>'cairocontext'], - 'cairo_copy_page' => ['', 'context'=>'cairocontext'], - 'cairo_copy_path' => ['CairoPath', 'context'=>'cairocontext'], - 'cairo_copy_path_flat' => ['CairoPath', 'context'=>'cairocontext'], - 'cairo_create' => ['CairoContext', 'surface'=>'cairosurface'], - 'cairo_curve_to' => ['', 'x1'=>'float', 'y1'=>'float', 'x2'=>'float', 'y2'=>'float', 'x3'=>'float', 'y3'=>'float', 'context'=>'cairocontext'], - 'cairo_device_to_user' => ['array', 'x'=>'float', 'y'=>'float', 'context'=>'cairocontext'], - 'cairo_device_to_user_distance' => ['array', 'x'=>'float', 'y'=>'float', 'context'=>'cairocontext'], - 'cairo_fill' => ['', 'context'=>'cairocontext'], - 'cairo_fill_extents' => ['array', 'context'=>'cairocontext'], - 'cairo_fill_preserve' => ['', 'context'=>'cairocontext'], - 'cairo_font_extents' => ['array', 'context'=>'cairocontext'], - 'cairo_font_face_get_type' => ['int', 'fontface'=>'cairofontface'], - 'cairo_font_face_status' => ['int', 'fontface'=>'cairofontface'], - 'cairo_font_options_create' => ['CairoFontOptions'], - 'cairo_font_options_equal' => ['bool', 'options'=>'cairofontoptions', 'other'=>'cairofontoptions'], - 'cairo_font_options_get_antialias' => ['int', 'options'=>'cairofontoptions'], - 'cairo_font_options_get_hint_metrics' => ['int', 'options'=>'cairofontoptions'], - 'cairo_font_options_get_hint_style' => ['int', 'options'=>'cairofontoptions'], - 'cairo_font_options_get_subpixel_order' => ['int', 'options'=>'cairofontoptions'], - 'cairo_font_options_hash' => ['int', 'options'=>'cairofontoptions'], - 'cairo_font_options_merge' => ['void', 'options'=>'cairofontoptions', 'other'=>'cairofontoptions'], - 'cairo_font_options_set_antialias' => ['void', 'options'=>'cairofontoptions', 'antialias'=>'int'], - 'cairo_font_options_set_hint_metrics' => ['void', 'options'=>'cairofontoptions', 'hint_metrics'=>'int'], - 'cairo_font_options_set_hint_style' => ['void', 'options'=>'cairofontoptions', 'hint_style'=>'int'], - 'cairo_font_options_set_subpixel_order' => ['void', 'options'=>'cairofontoptions', 'subpixel_order'=>'int'], - 'cairo_font_options_status' => ['int', 'options'=>'cairofontoptions'], - 'cairo_format_stride_for_width' => ['int', 'format'=>'int', 'width'=>'int'], - 'cairo_get_antialias' => ['int', 'context'=>'cairocontext'], - 'cairo_get_current_point' => ['array', 'context'=>'cairocontext'], - 'cairo_get_dash' => ['array', 'context'=>'cairocontext'], - 'cairo_get_dash_count' => ['int', 'context'=>'cairocontext'], - 'cairo_get_fill_rule' => ['int', 'context'=>'cairocontext'], - 'cairo_get_font_face' => ['', 'context'=>'cairocontext'], - 'cairo_get_font_matrix' => ['', 'context'=>'cairocontext'], - 'cairo_get_font_options' => ['', 'context'=>'cairocontext'], - 'cairo_get_group_target' => ['', 'context'=>'cairocontext'], - 'cairo_get_line_cap' => ['int', 'context'=>'cairocontext'], - 'cairo_get_line_join' => ['int', 'context'=>'cairocontext'], - 'cairo_get_line_width' => ['float', 'context'=>'cairocontext'], - 'cairo_get_matrix' => ['', 'context'=>'cairocontext'], - 'cairo_get_miter_limit' => ['float', 'context'=>'cairocontext'], - 'cairo_get_operator' => ['int', 'context'=>'cairocontext'], - 'cairo_get_scaled_font' => ['', 'context'=>'cairocontext'], - 'cairo_get_source' => ['', 'context'=>'cairocontext'], - 'cairo_get_target' => ['', 'context'=>'cairocontext'], - 'cairo_get_tolerance' => ['float', 'context'=>'cairocontext'], - 'cairo_glyph_path' => ['', 'glyphs'=>'array', 'context'=>'cairocontext'], - 'cairo_has_current_point' => ['bool', 'context'=>'cairocontext'], - 'cairo_identity_matrix' => ['', 'context'=>'cairocontext'], - 'cairo_image_surface_create' => ['CairoImageSurface', 'format'=>'int', 'width'=>'int', 'height'=>'int'], - 'cairo_image_surface_create_for_data' => ['CairoImageSurface', 'data'=>'string', 'format'=>'int', 'width'=>'int', 'height'=>'int', 'stride='=>'int'], - 'cairo_image_surface_create_from_png' => ['CairoImageSurface', 'file'=>'string'], - 'cairo_image_surface_get_data' => ['string', 'surface'=>'cairoimagesurface'], - 'cairo_image_surface_get_format' => ['int', 'surface'=>'cairoimagesurface'], - 'cairo_image_surface_get_height' => ['int', 'surface'=>'cairoimagesurface'], - 'cairo_image_surface_get_stride' => ['int', 'surface'=>'cairoimagesurface'], - 'cairo_image_surface_get_width' => ['int', 'surface'=>'cairoimagesurface'], - 'cairo_in_fill' => ['bool', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_in_stroke' => ['bool', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_line_to' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_mask' => ['', 'pattern'=>'cairopattern', 'context'=>'cairocontext'], - 'cairo_mask_surface' => ['', 'surface'=>'cairosurface', 'x='=>'string', 'y='=>'string', 'context='=>'cairocontext'], - 'cairo_matrix_create_scale' => ['object', 'sx'=>'float', 'sy'=>'float'], - 'cairo_matrix_init' => ['object', 'xx='=>'float', 'yx='=>'float', 'xy='=>'float', 'yy='=>'float', 'x0='=>'float', 'y0='=>'float'], - 'cairo_matrix_init_identity' => ['object'], - 'cairo_matrix_init_rotate' => ['object', 'radians'=>'float'], - 'cairo_matrix_init_scale' => ['object', 'sx'=>'float', 'sy'=>'float'], - 'cairo_matrix_init_translate' => ['object', 'tx'=>'float', 'ty'=>'float'], - 'cairo_matrix_invert' => ['void', 'matrix'=>'cairomatrix'], - 'cairo_matrix_multiply' => ['CairoMatrix', 'matrix1'=>'cairomatrix', 'matrix2'=>'cairomatrix'], - 'cairo_matrix_rotate' => ['', 'matrix'=>'cairomatrix', 'radians'=>'float'], - 'cairo_matrix_scale' => ['', 'sx'=>'float', 'sy'=>'float', 'context'=>'cairocontext'], - 'cairo_matrix_transform_distance' => ['array', 'matrix'=>'cairomatrix', 'dx'=>'float', 'dy'=>'float'], - 'cairo_matrix_transform_point' => ['array', 'matrix'=>'cairomatrix', 'dx'=>'float', 'dy'=>'float'], - 'cairo_matrix_translate' => ['void', 'matrix'=>'cairomatrix', 'tx'=>'float', 'ty'=>'float'], - 'cairo_move_to' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_new_path' => ['', 'context'=>'cairocontext'], - 'cairo_new_sub_path' => ['', 'context'=>'cairocontext'], - 'cairo_paint' => ['', 'context'=>'cairocontext'], - 'cairo_paint_with_alpha' => ['', 'alpha'=>'string', 'context'=>'cairocontext'], - 'cairo_path_extents' => ['array', 'context'=>'cairocontext'], - 'cairo_pattern_add_color_stop_rgb' => ['void', 'pattern'=>'cairogradientpattern', 'offset'=>'float', 'red'=>'float', 'green'=>'float', 'blue'=>'float'], - 'cairo_pattern_add_color_stop_rgba' => ['void', 'pattern'=>'cairogradientpattern', 'offset'=>'float', 'red'=>'float', 'green'=>'float', 'blue'=>'float', 'alpha'=>'float'], - 'cairo_pattern_create_for_surface' => ['CairoPattern', 'surface'=>'cairosurface'], - 'cairo_pattern_create_linear' => ['CairoPattern', 'x0'=>'float', 'y0'=>'float', 'x1'=>'float', 'y1'=>'float'], - 'cairo_pattern_create_radial' => ['CairoPattern', 'x0'=>'float', 'y0'=>'float', 'r0'=>'float', 'x1'=>'float', 'y1'=>'float', 'r1'=>'float'], - 'cairo_pattern_create_rgb' => ['CairoPattern', 'red'=>'float', 'green'=>'float', 'blue'=>'float'], - 'cairo_pattern_create_rgba' => ['CairoPattern', 'red'=>'float', 'green'=>'float', 'blue'=>'float', 'alpha'=>'float'], - 'cairo_pattern_get_color_stop_count' => ['int', 'pattern'=>'cairogradientpattern'], - 'cairo_pattern_get_color_stop_rgba' => ['array', 'pattern'=>'cairogradientpattern', 'index'=>'int'], - 'cairo_pattern_get_extend' => ['int', 'pattern'=>'string'], - 'cairo_pattern_get_filter' => ['int', 'pattern'=>'cairosurfacepattern'], - 'cairo_pattern_get_linear_points' => ['array', 'pattern'=>'cairolineargradient'], - 'cairo_pattern_get_matrix' => ['CairoMatrix', 'pattern'=>'cairopattern'], - 'cairo_pattern_get_radial_circles' => ['array', 'pattern'=>'cairoradialgradient'], - 'cairo_pattern_get_rgba' => ['array', 'pattern'=>'cairosolidpattern'], - 'cairo_pattern_get_surface' => ['CairoSurface', 'pattern'=>'cairosurfacepattern'], - 'cairo_pattern_get_type' => ['int', 'pattern'=>'cairopattern'], - 'cairo_pattern_set_extend' => ['void', 'pattern'=>'string', 'extend'=>'string'], - 'cairo_pattern_set_filter' => ['void', 'pattern'=>'cairosurfacepattern', 'filter'=>'int'], - 'cairo_pattern_set_matrix' => ['void', 'pattern'=>'cairopattern', 'matrix'=>'cairomatrix'], - 'cairo_pattern_status' => ['int', 'pattern'=>'cairopattern'], - 'cairo_pdf_surface_create' => ['CairoPdfSurface', 'file'=>'string', 'width'=>'float', 'height'=>'float'], - 'cairo_pdf_surface_set_size' => ['void', 'surface'=>'cairopdfsurface', 'width'=>'float', 'height'=>'float'], - 'cairo_pop_group' => ['', 'context'=>'cairocontext'], - 'cairo_pop_group_to_source' => ['', 'context'=>'cairocontext'], - 'cairo_ps_get_levels' => ['array'], - 'cairo_ps_level_to_string' => ['string', 'level'=>'int'], - 'cairo_ps_surface_create' => ['CairoPsSurface', 'file'=>'string', 'width'=>'float', 'height'=>'float'], - 'cairo_ps_surface_dsc_begin_page_setup' => ['void', 'surface'=>'cairopssurface'], - 'cairo_ps_surface_dsc_begin_setup' => ['void', 'surface'=>'cairopssurface'], - 'cairo_ps_surface_dsc_comment' => ['void', 'surface'=>'cairopssurface', 'comment'=>'string'], - 'cairo_ps_surface_get_eps' => ['bool', 'surface'=>'cairopssurface'], - 'cairo_ps_surface_restrict_to_level' => ['void', 'surface'=>'cairopssurface', 'level'=>'int'], - 'cairo_ps_surface_set_eps' => ['void', 'surface'=>'cairopssurface', 'level'=>'bool'], - 'cairo_ps_surface_set_size' => ['void', 'surface'=>'cairopssurface', 'width'=>'float', 'height'=>'float'], - 'cairo_push_group' => ['', 'context'=>'cairocontext'], - 'cairo_push_group_with_content' => ['', 'content'=>'string', 'context'=>'cairocontext'], - 'cairo_rectangle' => ['', 'x'=>'string', 'y'=>'string', 'width'=>'string', 'height'=>'string', 'context'=>'cairocontext'], - 'cairo_rel_curve_to' => ['', 'x1'=>'string', 'y1'=>'string', 'x2'=>'string', 'y2'=>'string', 'x3'=>'string', 'y3'=>'string', 'context'=>'cairocontext'], - 'cairo_rel_line_to' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_rel_move_to' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_reset_clip' => ['', 'context'=>'cairocontext'], - 'cairo_restore' => ['', 'context'=>'cairocontext'], - 'cairo_rotate' => ['', 'sx'=>'string', 'sy'=>'string', 'context'=>'cairocontext', 'angle'=>'string'], - 'cairo_save' => ['', 'context'=>'cairocontext'], - 'cairo_scale' => ['', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_scaled_font_create' => ['CairoScaledFont', 'fontface'=>'cairofontface', 'matrix'=>'cairomatrix', 'ctm'=>'cairomatrix', 'fontoptions'=>'cairofontoptions'], - 'cairo_scaled_font_extents' => ['array', 'scaledfont'=>'cairoscaledfont'], - 'cairo_scaled_font_get_ctm' => ['CairoMatrix', 'scaledfont'=>'cairoscaledfont'], - 'cairo_scaled_font_get_font_face' => ['CairoFontFace', 'scaledfont'=>'cairoscaledfont'], - 'cairo_scaled_font_get_font_matrix' => ['CairoFontOptions', 'scaledfont'=>'cairoscaledfont'], - 'cairo_scaled_font_get_font_options' => ['CairoFontOptions', 'scaledfont'=>'cairoscaledfont'], - 'cairo_scaled_font_get_scale_matrix' => ['CairoMatrix', 'scaledfont'=>'cairoscaledfont'], - 'cairo_scaled_font_get_type' => ['int', 'scaledfont'=>'cairoscaledfont'], - 'cairo_scaled_font_glyph_extents' => ['array', 'scaledfont'=>'cairoscaledfont', 'glyphs'=>'array'], - 'cairo_scaled_font_status' => ['int', 'scaledfont'=>'cairoscaledfont'], - 'cairo_scaled_font_text_extents' => ['array', 'scaledfont'=>'cairoscaledfont', 'text'=>'string'], - 'cairo_select_font_face' => ['', 'family'=>'string', 'slant='=>'string', 'weight='=>'string', 'context='=>'cairocontext'], - 'cairo_set_antialias' => ['', 'antialias='=>'string', 'context='=>'cairocontext'], - 'cairo_set_dash' => ['', 'dashes'=>'array', 'offset='=>'string', 'context='=>'cairocontext'], - 'cairo_set_fill_rule' => ['', 'setting'=>'string', 'context'=>'cairocontext'], - 'cairo_set_font_face' => ['', 'fontface'=>'cairofontface', 'context'=>'cairocontext'], - 'cairo_set_font_matrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], - 'cairo_set_font_options' => ['', 'fontoptions'=>'cairofontoptions', 'context'=>'cairocontext'], - 'cairo_set_font_size' => ['', 'size'=>'string', 'context'=>'cairocontext'], - 'cairo_set_line_cap' => ['', 'setting'=>'string', 'context'=>'cairocontext'], - 'cairo_set_line_join' => ['', 'setting'=>'string', 'context'=>'cairocontext'], - 'cairo_set_line_width' => ['', 'width'=>'string', 'context'=>'cairocontext'], - 'cairo_set_matrix' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], - 'cairo_set_miter_limit' => ['', 'limit'=>'string', 'context'=>'cairocontext'], - 'cairo_set_operator' => ['', 'setting'=>'string', 'context'=>'cairocontext'], - 'cairo_set_scaled_font' => ['', 'scaledfont'=>'cairoscaledfont', 'context'=>'cairocontext'], - 'cairo_set_source' => ['', 'red'=>'string', 'green'=>'string', 'blue'=>'string', 'alpha'=>'string', 'context'=>'cairocontext', 'pattern'=>'cairopattern'], - 'cairo_set_source_surface' => ['', 'surface'=>'cairosurface', 'x='=>'string', 'y='=>'string', 'context='=>'cairocontext'], - 'cairo_set_tolerance' => ['', 'tolerance'=>'string', 'context'=>'cairocontext'], - 'cairo_show_page' => ['', 'context'=>'cairocontext'], - 'cairo_show_text' => ['', 'text'=>'string', 'context'=>'cairocontext'], - 'cairo_status' => ['int', 'context'=>'cairocontext'], - 'cairo_status_to_string' => ['string', 'status'=>'int'], - 'cairo_stroke' => ['', 'context'=>'cairocontext'], - 'cairo_stroke_extents' => ['array', 'context'=>'cairocontext'], - 'cairo_stroke_preserve' => ['', 'context'=>'cairocontext'], - 'cairo_surface_copy_page' => ['void', 'surface'=>'cairosurface'], - 'cairo_surface_create_similar' => ['CairoSurface', 'surface'=>'cairosurface', 'content'=>'int', 'width'=>'float', 'height'=>'float'], - 'cairo_surface_finish' => ['void', 'surface'=>'cairosurface'], - 'cairo_surface_flush' => ['void', 'surface'=>'cairosurface'], - 'cairo_surface_get_content' => ['int', 'surface'=>'cairosurface'], - 'cairo_surface_get_device_offset' => ['array', 'surface'=>'cairosurface'], - 'cairo_surface_get_font_options' => ['CairoFontOptions', 'surface'=>'cairosurface'], - 'cairo_surface_get_type' => ['int', 'surface'=>'cairosurface'], - 'cairo_surface_mark_dirty' => ['void', 'surface'=>'cairosurface'], - 'cairo_surface_mark_dirty_rectangle' => ['void', 'surface'=>'cairosurface', 'x'=>'float', 'y'=>'float', 'width'=>'float', 'height'=>'float'], - 'cairo_surface_set_device_offset' => ['void', 'surface'=>'cairosurface', 'x'=>'float', 'y'=>'float'], - 'cairo_surface_set_fallback_resolution' => ['void', 'surface'=>'cairosurface', 'x'=>'float', 'y'=>'float'], - 'cairo_surface_show_page' => ['void', 'surface'=>'cairosurface'], - 'cairo_surface_status' => ['int', 'surface'=>'cairosurface'], - 'cairo_surface_write_to_png' => ['void', 'surface'=>'cairosurface', 'stream'=>'resource'], - 'cairo_svg_get_versions' => ['array'], - 'cairo_svg_surface_create' => ['CairoSvgSurface', 'file'=>'string', 'width'=>'float', 'height'=>'float'], - 'cairo_svg_surface_get_versions' => ['array'], - 'cairo_svg_surface_restrict_to_version' => ['void', 'surface'=>'cairosvgsurface', 'version'=>'int'], - 'cairo_svg_version_to_string' => ['string', 'version'=>'int'], - 'cairo_text_extents' => ['array', 'text'=>'string', 'context'=>'cairocontext'], - 'cairo_text_path' => ['', 'string'=>'string', 'context'=>'cairocontext', 'text'=>'string'], - 'cairo_transform' => ['', 'matrix'=>'cairomatrix', 'context'=>'cairocontext'], - 'cairo_translate' => ['', 'tx'=>'string', 'ty'=>'string', 'context'=>'cairocontext', 'x'=>'string', 'y'=>'string'], - 'cairo_user_to_device' => ['array', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_user_to_device_distance' => ['array', 'x'=>'string', 'y'=>'string', 'context'=>'cairocontext'], - 'cairo_version' => ['int'], - 'cairo_version_string' => ['string'], 'cal_days_in_month' => ['int', 'calendar'=>'int', 'month'=>'int', 'year'=>'int'], 'cal_from_jd' => ['array{date:string,month:int,day:int,year:int,dow:int,abbrevdayname:string,dayname:string,abbrevmonth:string,monthname:string}', 'julian_day'=>'int', 'calendar'=>'int'], 'cal_info' => ['array', 'calendar='=>'int'], From 18b4fc532a85e6d1f489d9da2b27cec75f324aa5 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Tue, 14 Feb 2023 05:54:24 -0600 Subject: [PATCH 060/109] Drop abandoned ncurses callmap --- dictionaries/CallMap.php | 160 ---------------------------- dictionaries/CallMap_historical.php | 160 ---------------------------- 2 files changed, 320 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index c3aaa8a3446..dd8b12dacee 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -8512,166 +8512,6 @@ 'MysqlndUhPreparedStatement::prepare' => ['bool', 'statement'=>'mysqlnd_prepared_statement', 'query'=>'string'], 'natcasesort' => ['bool', '&rw_array'=>'array'], 'natsort' => ['bool', '&rw_array'=>'array'], -'ncurses_addch' => ['int', 'ch'=>'int'], -'ncurses_addchnstr' => ['int', 's'=>'string', 'n'=>'int'], -'ncurses_addchstr' => ['int', 's'=>'string'], -'ncurses_addnstr' => ['int', 's'=>'string', 'n'=>'int'], -'ncurses_addstr' => ['int', 'text'=>'string'], -'ncurses_assume_default_colors' => ['int', 'fg'=>'int', 'bg'=>'int'], -'ncurses_attroff' => ['int', 'attributes'=>'int'], -'ncurses_attron' => ['int', 'attributes'=>'int'], -'ncurses_attrset' => ['int', 'attributes'=>'int'], -'ncurses_baudrate' => ['int'], -'ncurses_beep' => ['int'], -'ncurses_bkgd' => ['int', 'attrchar'=>'int'], -'ncurses_bkgdset' => ['void', 'attrchar'=>'int'], -'ncurses_border' => ['int', 'left'=>'int', 'right'=>'int', 'top'=>'int', 'bottom'=>'int', 'tl_corner'=>'int', 'tr_corner'=>'int', 'bl_corner'=>'int', 'br_corner'=>'int'], -'ncurses_bottom_panel' => ['int', 'panel'=>'resource'], -'ncurses_can_change_color' => ['bool'], -'ncurses_cbreak' => ['bool'], -'ncurses_clear' => ['bool'], -'ncurses_clrtobot' => ['bool'], -'ncurses_clrtoeol' => ['bool'], -'ncurses_color_content' => ['int', 'color'=>'int', 'r'=>'int', 'g'=>'int', 'b'=>'int'], -'ncurses_color_set' => ['int', 'pair'=>'int'], -'ncurses_curs_set' => ['int', 'visibility'=>'int'], -'ncurses_def_prog_mode' => ['bool'], -'ncurses_def_shell_mode' => ['bool'], -'ncurses_define_key' => ['int', 'definition'=>'string', 'keycode'=>'int'], -'ncurses_del_panel' => ['bool', 'panel'=>'resource'], -'ncurses_delay_output' => ['int', 'milliseconds'=>'int'], -'ncurses_delch' => ['bool'], -'ncurses_deleteln' => ['bool'], -'ncurses_delwin' => ['bool', 'window'=>'resource'], -'ncurses_doupdate' => ['bool'], -'ncurses_echo' => ['bool'], -'ncurses_echochar' => ['int', 'character'=>'int'], -'ncurses_end' => ['int'], -'ncurses_erase' => ['bool'], -'ncurses_erasechar' => ['string'], -'ncurses_filter' => ['void'], -'ncurses_flash' => ['bool'], -'ncurses_flushinp' => ['bool'], -'ncurses_getch' => ['int'], -'ncurses_getmaxyx' => ['void', 'window'=>'resource', 'y'=>'int', 'x'=>'int'], -'ncurses_getmouse' => ['bool', 'mevent'=>'array'], -'ncurses_getyx' => ['void', 'window'=>'resource', 'y'=>'int', 'x'=>'int'], -'ncurses_halfdelay' => ['int', 'tenth'=>'int'], -'ncurses_has_colors' => ['bool'], -'ncurses_has_ic' => ['bool'], -'ncurses_has_il' => ['bool'], -'ncurses_has_key' => ['int', 'keycode'=>'int'], -'ncurses_hide_panel' => ['int', 'panel'=>'resource'], -'ncurses_hline' => ['int', 'charattr'=>'int', 'n'=>'int'], -'ncurses_inch' => ['string'], -'ncurses_init' => ['void'], -'ncurses_init_color' => ['int', 'color'=>'int', 'r'=>'int', 'g'=>'int', 'b'=>'int'], -'ncurses_init_pair' => ['int', 'pair'=>'int', 'fg'=>'int', 'bg'=>'int'], -'ncurses_insch' => ['int', 'character'=>'int'], -'ncurses_insdelln' => ['int', 'count'=>'int'], -'ncurses_insertln' => ['int'], -'ncurses_insstr' => ['int', 'text'=>'string'], -'ncurses_instr' => ['int', 'buffer'=>'string'], -'ncurses_isendwin' => ['bool'], -'ncurses_keyok' => ['int', 'keycode'=>'int', 'enable'=>'bool'], -'ncurses_keypad' => ['int', 'window'=>'resource', 'bf'=>'bool'], -'ncurses_killchar' => ['string'], -'ncurses_longname' => ['string'], -'ncurses_meta' => ['int', 'window'=>'resource', '_8bit'=>'bool'], -'ncurses_mouse_trafo' => ['bool', 'y'=>'int', 'x'=>'int', 'toscreen'=>'bool'], -'ncurses_mouseinterval' => ['int', 'milliseconds'=>'int'], -'ncurses_mousemask' => ['int', 'newmask'=>'int', 'oldmask'=>'int'], -'ncurses_move' => ['int', 'y'=>'int', 'x'=>'int'], -'ncurses_move_panel' => ['int', 'panel'=>'resource', 'startx'=>'int', 'starty'=>'int'], -'ncurses_mvaddch' => ['int', 'y'=>'int', 'x'=>'int', 'c'=>'int'], -'ncurses_mvaddchnstr' => ['int', 'y'=>'int', 'x'=>'int', 's'=>'string', 'n'=>'int'], -'ncurses_mvaddchstr' => ['int', 'y'=>'int', 'x'=>'int', 's'=>'string'], -'ncurses_mvaddnstr' => ['int', 'y'=>'int', 'x'=>'int', 's'=>'string', 'n'=>'int'], -'ncurses_mvaddstr' => ['int', 'y'=>'int', 'x'=>'int', 's'=>'string'], -'ncurses_mvcur' => ['int', 'old_y'=>'int', 'old_x'=>'int', 'new_y'=>'int', 'new_x'=>'int'], -'ncurses_mvdelch' => ['int', 'y'=>'int', 'x'=>'int'], -'ncurses_mvgetch' => ['int', 'y'=>'int', 'x'=>'int'], -'ncurses_mvhline' => ['int', 'y'=>'int', 'x'=>'int', 'attrchar'=>'int', 'n'=>'int'], -'ncurses_mvinch' => ['int', 'y'=>'int', 'x'=>'int'], -'ncurses_mvvline' => ['int', 'y'=>'int', 'x'=>'int', 'attrchar'=>'int', 'n'=>'int'], -'ncurses_mvwaddstr' => ['int', 'window'=>'resource', 'y'=>'int', 'x'=>'int', 'text'=>'string'], -'ncurses_napms' => ['int', 'milliseconds'=>'int'], -'ncurses_new_panel' => ['resource', 'window'=>'resource'], -'ncurses_newpad' => ['resource', 'rows'=>'int', 'cols'=>'int'], -'ncurses_newwin' => ['resource', 'rows'=>'int', 'cols'=>'int', 'y'=>'int', 'x'=>'int'], -'ncurses_nl' => ['bool'], -'ncurses_nocbreak' => ['bool'], -'ncurses_noecho' => ['bool'], -'ncurses_nonl' => ['bool'], -'ncurses_noqiflush' => ['void'], -'ncurses_noraw' => ['bool'], -'ncurses_pair_content' => ['int', 'pair'=>'int', 'f'=>'int', 'b'=>'int'], -'ncurses_panel_above' => ['resource', 'panel'=>'resource'], -'ncurses_panel_below' => ['resource', 'panel'=>'resource'], -'ncurses_panel_window' => ['resource', 'panel'=>'resource'], -'ncurses_pnoutrefresh' => ['int', 'pad'=>'resource', 'pminrow'=>'int', 'pmincol'=>'int', 'sminrow'=>'int', 'smincol'=>'int', 'smaxrow'=>'int', 'smaxcol'=>'int'], -'ncurses_prefresh' => ['int', 'pad'=>'resource', 'pminrow'=>'int', 'pmincol'=>'int', 'sminrow'=>'int', 'smincol'=>'int', 'smaxrow'=>'int', 'smaxcol'=>'int'], -'ncurses_putp' => ['int', 'text'=>'string'], -'ncurses_qiflush' => ['void'], -'ncurses_raw' => ['bool'], -'ncurses_refresh' => ['int', 'ch'=>'int'], -'ncurses_replace_panel' => ['int', 'panel'=>'resource', 'window'=>'resource'], -'ncurses_reset_prog_mode' => ['int'], -'ncurses_reset_shell_mode' => ['int'], -'ncurses_resetty' => ['bool'], -'ncurses_savetty' => ['bool'], -'ncurses_scr_dump' => ['int', 'filename'=>'string'], -'ncurses_scr_init' => ['int', 'filename'=>'string'], -'ncurses_scr_restore' => ['int', 'filename'=>'string'], -'ncurses_scr_set' => ['int', 'filename'=>'string'], -'ncurses_scrl' => ['int', 'count'=>'int'], -'ncurses_show_panel' => ['int', 'panel'=>'resource'], -'ncurses_slk_attr' => ['int'], -'ncurses_slk_attroff' => ['int', 'intarg'=>'int'], -'ncurses_slk_attron' => ['int', 'intarg'=>'int'], -'ncurses_slk_attrset' => ['int', 'intarg'=>'int'], -'ncurses_slk_clear' => ['bool'], -'ncurses_slk_color' => ['int', 'intarg'=>'int'], -'ncurses_slk_init' => ['bool', 'format'=>'int'], -'ncurses_slk_noutrefresh' => ['bool'], -'ncurses_slk_refresh' => ['int'], -'ncurses_slk_restore' => ['int'], -'ncurses_slk_set' => ['bool', 'labelnr'=>'int', 'label'=>'string', 'format'=>'int'], -'ncurses_slk_touch' => ['int'], -'ncurses_standend' => ['int'], -'ncurses_standout' => ['int'], -'ncurses_start_color' => ['int'], -'ncurses_termattrs' => ['bool'], -'ncurses_termname' => ['string'], -'ncurses_timeout' => ['void', 'millisec'=>'int'], -'ncurses_top_panel' => ['int', 'panel'=>'resource'], -'ncurses_typeahead' => ['int', 'fd'=>'int'], -'ncurses_ungetch' => ['int', 'keycode'=>'int'], -'ncurses_ungetmouse' => ['bool', 'mevent'=>'array'], -'ncurses_update_panels' => ['void'], -'ncurses_use_default_colors' => ['bool'], -'ncurses_use_env' => ['void', 'flag'=>'bool'], -'ncurses_use_extended_names' => ['int', 'flag'=>'bool'], -'ncurses_vidattr' => ['int', 'intarg'=>'int'], -'ncurses_vline' => ['int', 'charattr'=>'int', 'n'=>'int'], -'ncurses_waddch' => ['int', 'window'=>'resource', 'ch'=>'int'], -'ncurses_waddstr' => ['int', 'window'=>'resource', 'string'=>'string', 'n='=>'int'], -'ncurses_wattroff' => ['int', 'window'=>'resource', 'attrs'=>'int'], -'ncurses_wattron' => ['int', 'window'=>'resource', 'attrs'=>'int'], -'ncurses_wattrset' => ['int', 'window'=>'resource', 'attrs'=>'int'], -'ncurses_wborder' => ['int', 'window'=>'resource', 'left'=>'int', 'right'=>'int', 'top'=>'int', 'bottom'=>'int', 'tl_corner'=>'int', 'tr_corner'=>'int', 'bl_corner'=>'int', 'br_corner'=>'int'], -'ncurses_wclear' => ['int', 'window'=>'resource'], -'ncurses_wcolor_set' => ['int', 'window'=>'resource', 'color_pair'=>'int'], -'ncurses_werase' => ['int', 'window'=>'resource'], -'ncurses_wgetch' => ['int', 'window'=>'resource'], -'ncurses_whline' => ['int', 'window'=>'resource', 'charattr'=>'int', 'n'=>'int'], -'ncurses_wmouse_trafo' => ['bool', 'window'=>'resource', 'y'=>'int', 'x'=>'int', 'toscreen'=>'bool'], -'ncurses_wmove' => ['int', 'window'=>'resource', 'y'=>'int', 'x'=>'int'], -'ncurses_wnoutrefresh' => ['int', 'window'=>'resource'], -'ncurses_wrefresh' => ['int', 'window'=>'resource'], -'ncurses_wstandend' => ['int', 'window'=>'resource'], -'ncurses_wstandout' => ['int', 'window'=>'resource'], -'ncurses_wvline' => ['int', 'window'=>'resource', 'charattr'=>'int', 'n'=>'int'], 'net_get_interfaces' => ['array>|false'], 'newrelic_add_custom_parameter' => ['bool', 'key'=>'string', 'value'=>'bool|float|int|string'], 'newrelic_add_custom_tracer' => ['bool', 'function_name'=>'string'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 33fa7f57376..ad608e338cf 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -13377,166 +13377,6 @@ 'mysqlnd_uh_set_statement_proxy' => ['bool', '&rw_statement_proxy'=>'MysqlndUhStatement'], 'natcasesort' => ['bool', '&rw_array'=>'array'], 'natsort' => ['bool', '&rw_array'=>'array'], - 'ncurses_addch' => ['int', 'ch'=>'int'], - 'ncurses_addchnstr' => ['int', 's'=>'string', 'n'=>'int'], - 'ncurses_addchstr' => ['int', 's'=>'string'], - 'ncurses_addnstr' => ['int', 's'=>'string', 'n'=>'int'], - 'ncurses_addstr' => ['int', 'text'=>'string'], - 'ncurses_assume_default_colors' => ['int', 'fg'=>'int', 'bg'=>'int'], - 'ncurses_attroff' => ['int', 'attributes'=>'int'], - 'ncurses_attron' => ['int', 'attributes'=>'int'], - 'ncurses_attrset' => ['int', 'attributes'=>'int'], - 'ncurses_baudrate' => ['int'], - 'ncurses_beep' => ['int'], - 'ncurses_bkgd' => ['int', 'attrchar'=>'int'], - 'ncurses_bkgdset' => ['void', 'attrchar'=>'int'], - 'ncurses_border' => ['int', 'left'=>'int', 'right'=>'int', 'top'=>'int', 'bottom'=>'int', 'tl_corner'=>'int', 'tr_corner'=>'int', 'bl_corner'=>'int', 'br_corner'=>'int'], - 'ncurses_bottom_panel' => ['int', 'panel'=>'resource'], - 'ncurses_can_change_color' => ['bool'], - 'ncurses_cbreak' => ['bool'], - 'ncurses_clear' => ['bool'], - 'ncurses_clrtobot' => ['bool'], - 'ncurses_clrtoeol' => ['bool'], - 'ncurses_color_content' => ['int', 'color'=>'int', 'r'=>'int', 'g'=>'int', 'b'=>'int'], - 'ncurses_color_set' => ['int', 'pair'=>'int'], - 'ncurses_curs_set' => ['int', 'visibility'=>'int'], - 'ncurses_def_prog_mode' => ['bool'], - 'ncurses_def_shell_mode' => ['bool'], - 'ncurses_define_key' => ['int', 'definition'=>'string', 'keycode'=>'int'], - 'ncurses_del_panel' => ['bool', 'panel'=>'resource'], - 'ncurses_delay_output' => ['int', 'milliseconds'=>'int'], - 'ncurses_delch' => ['bool'], - 'ncurses_deleteln' => ['bool'], - 'ncurses_delwin' => ['bool', 'window'=>'resource'], - 'ncurses_doupdate' => ['bool'], - 'ncurses_echo' => ['bool'], - 'ncurses_echochar' => ['int', 'character'=>'int'], - 'ncurses_end' => ['int'], - 'ncurses_erase' => ['bool'], - 'ncurses_erasechar' => ['string'], - 'ncurses_filter' => ['void'], - 'ncurses_flash' => ['bool'], - 'ncurses_flushinp' => ['bool'], - 'ncurses_getch' => ['int'], - 'ncurses_getmaxyx' => ['void', 'window'=>'resource', 'y'=>'int', 'x'=>'int'], - 'ncurses_getmouse' => ['bool', 'mevent'=>'array'], - 'ncurses_getyx' => ['void', 'window'=>'resource', 'y'=>'int', 'x'=>'int'], - 'ncurses_halfdelay' => ['int', 'tenth'=>'int'], - 'ncurses_has_colors' => ['bool'], - 'ncurses_has_ic' => ['bool'], - 'ncurses_has_il' => ['bool'], - 'ncurses_has_key' => ['int', 'keycode'=>'int'], - 'ncurses_hide_panel' => ['int', 'panel'=>'resource'], - 'ncurses_hline' => ['int', 'charattr'=>'int', 'n'=>'int'], - 'ncurses_inch' => ['string'], - 'ncurses_init' => ['void'], - 'ncurses_init_color' => ['int', 'color'=>'int', 'r'=>'int', 'g'=>'int', 'b'=>'int'], - 'ncurses_init_pair' => ['int', 'pair'=>'int', 'fg'=>'int', 'bg'=>'int'], - 'ncurses_insch' => ['int', 'character'=>'int'], - 'ncurses_insdelln' => ['int', 'count'=>'int'], - 'ncurses_insertln' => ['int'], - 'ncurses_insstr' => ['int', 'text'=>'string'], - 'ncurses_instr' => ['int', 'buffer'=>'string'], - 'ncurses_isendwin' => ['bool'], - 'ncurses_keyok' => ['int', 'keycode'=>'int', 'enable'=>'bool'], - 'ncurses_keypad' => ['int', 'window'=>'resource', 'bf'=>'bool'], - 'ncurses_killchar' => ['string'], - 'ncurses_longname' => ['string'], - 'ncurses_meta' => ['int', 'window'=>'resource', '_8bit'=>'bool'], - 'ncurses_mouse_trafo' => ['bool', 'y'=>'int', 'x'=>'int', 'toscreen'=>'bool'], - 'ncurses_mouseinterval' => ['int', 'milliseconds'=>'int'], - 'ncurses_mousemask' => ['int', 'newmask'=>'int', 'oldmask'=>'int'], - 'ncurses_move' => ['int', 'y'=>'int', 'x'=>'int'], - 'ncurses_move_panel' => ['int', 'panel'=>'resource', 'startx'=>'int', 'starty'=>'int'], - 'ncurses_mvaddch' => ['int', 'y'=>'int', 'x'=>'int', 'c'=>'int'], - 'ncurses_mvaddchnstr' => ['int', 'y'=>'int', 'x'=>'int', 's'=>'string', 'n'=>'int'], - 'ncurses_mvaddchstr' => ['int', 'y'=>'int', 'x'=>'int', 's'=>'string'], - 'ncurses_mvaddnstr' => ['int', 'y'=>'int', 'x'=>'int', 's'=>'string', 'n'=>'int'], - 'ncurses_mvaddstr' => ['int', 'y'=>'int', 'x'=>'int', 's'=>'string'], - 'ncurses_mvcur' => ['int', 'old_y'=>'int', 'old_x'=>'int', 'new_y'=>'int', 'new_x'=>'int'], - 'ncurses_mvdelch' => ['int', 'y'=>'int', 'x'=>'int'], - 'ncurses_mvgetch' => ['int', 'y'=>'int', 'x'=>'int'], - 'ncurses_mvhline' => ['int', 'y'=>'int', 'x'=>'int', 'attrchar'=>'int', 'n'=>'int'], - 'ncurses_mvinch' => ['int', 'y'=>'int', 'x'=>'int'], - 'ncurses_mvvline' => ['int', 'y'=>'int', 'x'=>'int', 'attrchar'=>'int', 'n'=>'int'], - 'ncurses_mvwaddstr' => ['int', 'window'=>'resource', 'y'=>'int', 'x'=>'int', 'text'=>'string'], - 'ncurses_napms' => ['int', 'milliseconds'=>'int'], - 'ncurses_new_panel' => ['resource', 'window'=>'resource'], - 'ncurses_newpad' => ['resource', 'rows'=>'int', 'cols'=>'int'], - 'ncurses_newwin' => ['resource', 'rows'=>'int', 'cols'=>'int', 'y'=>'int', 'x'=>'int'], - 'ncurses_nl' => ['bool'], - 'ncurses_nocbreak' => ['bool'], - 'ncurses_noecho' => ['bool'], - 'ncurses_nonl' => ['bool'], - 'ncurses_noqiflush' => ['void'], - 'ncurses_noraw' => ['bool'], - 'ncurses_pair_content' => ['int', 'pair'=>'int', 'f'=>'int', 'b'=>'int'], - 'ncurses_panel_above' => ['resource', 'panel'=>'resource'], - 'ncurses_panel_below' => ['resource', 'panel'=>'resource'], - 'ncurses_panel_window' => ['resource', 'panel'=>'resource'], - 'ncurses_pnoutrefresh' => ['int', 'pad'=>'resource', 'pminrow'=>'int', 'pmincol'=>'int', 'sminrow'=>'int', 'smincol'=>'int', 'smaxrow'=>'int', 'smaxcol'=>'int'], - 'ncurses_prefresh' => ['int', 'pad'=>'resource', 'pminrow'=>'int', 'pmincol'=>'int', 'sminrow'=>'int', 'smincol'=>'int', 'smaxrow'=>'int', 'smaxcol'=>'int'], - 'ncurses_putp' => ['int', 'text'=>'string'], - 'ncurses_qiflush' => ['void'], - 'ncurses_raw' => ['bool'], - 'ncurses_refresh' => ['int', 'ch'=>'int'], - 'ncurses_replace_panel' => ['int', 'panel'=>'resource', 'window'=>'resource'], - 'ncurses_reset_prog_mode' => ['int'], - 'ncurses_reset_shell_mode' => ['int'], - 'ncurses_resetty' => ['bool'], - 'ncurses_savetty' => ['bool'], - 'ncurses_scr_dump' => ['int', 'filename'=>'string'], - 'ncurses_scr_init' => ['int', 'filename'=>'string'], - 'ncurses_scr_restore' => ['int', 'filename'=>'string'], - 'ncurses_scr_set' => ['int', 'filename'=>'string'], - 'ncurses_scrl' => ['int', 'count'=>'int'], - 'ncurses_show_panel' => ['int', 'panel'=>'resource'], - 'ncurses_slk_attr' => ['int'], - 'ncurses_slk_attroff' => ['int', 'intarg'=>'int'], - 'ncurses_slk_attron' => ['int', 'intarg'=>'int'], - 'ncurses_slk_attrset' => ['int', 'intarg'=>'int'], - 'ncurses_slk_clear' => ['bool'], - 'ncurses_slk_color' => ['int', 'intarg'=>'int'], - 'ncurses_slk_init' => ['bool', 'format'=>'int'], - 'ncurses_slk_noutrefresh' => ['bool'], - 'ncurses_slk_refresh' => ['int'], - 'ncurses_slk_restore' => ['int'], - 'ncurses_slk_set' => ['bool', 'labelnr'=>'int', 'label'=>'string', 'format'=>'int'], - 'ncurses_slk_touch' => ['int'], - 'ncurses_standend' => ['int'], - 'ncurses_standout' => ['int'], - 'ncurses_start_color' => ['int'], - 'ncurses_termattrs' => ['bool'], - 'ncurses_termname' => ['string'], - 'ncurses_timeout' => ['void', 'millisec'=>'int'], - 'ncurses_top_panel' => ['int', 'panel'=>'resource'], - 'ncurses_typeahead' => ['int', 'fd'=>'int'], - 'ncurses_ungetch' => ['int', 'keycode'=>'int'], - 'ncurses_ungetmouse' => ['bool', 'mevent'=>'array'], - 'ncurses_update_panels' => ['void'], - 'ncurses_use_default_colors' => ['bool'], - 'ncurses_use_env' => ['void', 'flag'=>'bool'], - 'ncurses_use_extended_names' => ['int', 'flag'=>'bool'], - 'ncurses_vidattr' => ['int', 'intarg'=>'int'], - 'ncurses_vline' => ['int', 'charattr'=>'int', 'n'=>'int'], - 'ncurses_waddch' => ['int', 'window'=>'resource', 'ch'=>'int'], - 'ncurses_waddstr' => ['int', 'window'=>'resource', 'string'=>'string', 'n='=>'int'], - 'ncurses_wattroff' => ['int', 'window'=>'resource', 'attrs'=>'int'], - 'ncurses_wattron' => ['int', 'window'=>'resource', 'attrs'=>'int'], - 'ncurses_wattrset' => ['int', 'window'=>'resource', 'attrs'=>'int'], - 'ncurses_wborder' => ['int', 'window'=>'resource', 'left'=>'int', 'right'=>'int', 'top'=>'int', 'bottom'=>'int', 'tl_corner'=>'int', 'tr_corner'=>'int', 'bl_corner'=>'int', 'br_corner'=>'int'], - 'ncurses_wclear' => ['int', 'window'=>'resource'], - 'ncurses_wcolor_set' => ['int', 'window'=>'resource', 'color_pair'=>'int'], - 'ncurses_werase' => ['int', 'window'=>'resource'], - 'ncurses_wgetch' => ['int', 'window'=>'resource'], - 'ncurses_whline' => ['int', 'window'=>'resource', 'charattr'=>'int', 'n'=>'int'], - 'ncurses_wmouse_trafo' => ['bool', 'window'=>'resource', 'y'=>'int', 'x'=>'int', 'toscreen'=>'bool'], - 'ncurses_wmove' => ['int', 'window'=>'resource', 'y'=>'int', 'x'=>'int'], - 'ncurses_wnoutrefresh' => ['int', 'window'=>'resource'], - 'ncurses_wrefresh' => ['int', 'window'=>'resource'], - 'ncurses_wstandend' => ['int', 'window'=>'resource'], - 'ncurses_wstandout' => ['int', 'window'=>'resource'], - 'ncurses_wvline' => ['int', 'window'=>'resource', 'charattr'=>'int', 'n'=>'int'], 'newrelic_add_custom_parameter' => ['bool', 'key'=>'string', 'value'=>'bool|float|int|string'], 'newrelic_add_custom_tracer' => ['bool', 'function_name'=>'string'], 'newrelic_background_job' => ['void', 'flag='=>'bool'], From 3693300b2d8791d3298abe021c57c335cd6bf29e Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 14 Feb 2023 19:19:07 -0400 Subject: [PATCH 061/109] Made `WeakReference` mutable Fixes vimeo/psalm#6544 --- stubs/CoreGenericClasses.phpstub | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stubs/CoreGenericClasses.phpstub b/stubs/CoreGenericClasses.phpstub index 4fbfcd01c7e..74a2353cf66 100644 --- a/stubs/CoreGenericClasses.phpstub +++ b/stubs/CoreGenericClasses.phpstub @@ -439,7 +439,6 @@ interface Serializable { /** * @template-covariant T as object - * @psalm-immutable */ final class WeakReference { @@ -448,10 +447,10 @@ final class WeakReference /** * @template TIn as object - * @param TIn $referent + * @param TIn $object * @return WeakReference */ - public static function create(object $referent): WeakReference {} + public static function create(object $object): WeakReference {} /** @return ?T */ public function get(): ?object {} From 38e15c981739c88ad3552e57b81e62749886c65e Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 14 Feb 2023 21:01:52 -0400 Subject: [PATCH 062/109] Added note on properties used in constructor only Fixes vimeo/psalm#7955 --- docs/running_psalm/issues/UnusedProperty.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/running_psalm/issues/UnusedProperty.md b/docs/running_psalm/issues/UnusedProperty.md index 4ec0c016a4d..07c7f3545b5 100644 --- a/docs/running_psalm/issues/UnusedProperty.md +++ b/docs/running_psalm/issues/UnusedProperty.md @@ -3,6 +3,8 @@ Emitted when `--find-dead-code` is turned on and Psalm cannot find any uses of a private property. +Properties used in constructor only are considered used. Use normal variables instead. + If this property is used and part of the public API, annotate the containing class with `@psalm-api`. From 1ab02125b067c5f4fa9b33050a71dea41c9de113 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 14 Feb 2023 21:19:29 -0400 Subject: [PATCH 063/109] Added issue type and psalm.dev link to Emacs report Fixes vimeo/psalm#8331 --- src/Psalm/Report/EmacsReport.php | 4 +++- tests/ReportOutputTest.php | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Psalm/Report/EmacsReport.php b/src/Psalm/Report/EmacsReport.php index 675c19890b5..d022fe5dcc3 100644 --- a/src/Psalm/Report/EmacsReport.php +++ b/src/Psalm/Report/EmacsReport.php @@ -14,12 +14,14 @@ public function create(): string $output = ''; foreach ($this->issues_data as $issue_data) { $output .= sprintf( - '%s:%s:%s:%s - %s', + '%s:%s:%s:%s - %s: %s (see %s)', $issue_data->file_path, $issue_data->line_from, $issue_data->column_from, ($issue_data->severity === Config::REPORT_ERROR ? 'error' : 'warning'), + $issue_data->type, $issue_data->message, + $issue_data->link, ) . "\n"; } diff --git a/tests/ReportOutputTest.php b/tests/ReportOutputTest.php index bfeb1893da0..4d28aad4b76 100644 --- a/tests/ReportOutputTest.php +++ b/tests/ReportOutputTest.php @@ -963,12 +963,14 @@ public function testEmacsReport(): void $emacs_report_options = ProjectAnalyzer::getFileReportOptions([__DIR__ . '/test-report.emacs'])[0]; $this->assertSame( - 'somefile.php:3:10:error - Cannot find referenced variable $as_you_____type -somefile.php:3:10:error - Could not infer a return type -somefile.php:2:42:error - Could not verify return type \'null|string\' for psalmCanVerify -somefile.php:8:6:error - Const CHANGE_ME is not defined -somefile.php:17:6:warning - Possibly undefined global variable $a, first seen on line 11 -', + <<<'EOF' + somefile.php:3:10:error - UndefinedVariable: Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) + somefile.php:3:10:error - MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138) + somefile.php:2:42:error - MixedInferredReturnType: Could not verify return type 'null|string' for psalmCanVerify (see https://psalm.dev/047) + somefile.php:8:6:error - UndefinedConstant: Const CHANGE_ME is not defined (see https://psalm.dev/020) + somefile.php:17:6:warning - PossiblyUndefinedGlobalVariable: Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126) + + EOF, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $emacs_report_options), ); } From 840250c534b101b63a8f7a1bc037da0857e5896a Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 14 Feb 2023 21:56:07 -0400 Subject: [PATCH 064/109] Update expectations formatting It's easier to read with consistent indentation --- tests/ReportOutputTest.php | 352 ++++++++++++++++++++----------------- 1 file changed, 188 insertions(+), 164 deletions(-) diff --git a/tests/ReportOutputTest.php b/tests/ReportOutputTest.php index 4d28aad4b76..4c768484b17 100644 --- a/tests/ReportOutputTest.php +++ b/tests/ReportOutputTest.php @@ -74,17 +74,19 @@ public function testReportFormatException(): void public function analyzeTaintFlowFilesForReport(): void { - $vulnerable_file_contents = 'addFile( 'taintflow-test/vulnerable.php', @@ -674,23 +676,25 @@ public function testSarifReport(): void public function analyzeFileForReport(): void { - $file_contents = ' 10) { - $a = 5; -} else { - //$a = 2; -} + if (rand(0, 100) > 10) { + $a = 5; + } else { + //$a = 2; + } -/** @psalm-suppress MixedArgument */ -echo $a;'; + /** @psalm-suppress MixedArgument */ + echo $a; + EOF; $this->addFile( 'somefile.php', @@ -982,12 +986,14 @@ public function testPylintReport(): void $pylint_report_options = ProjectAnalyzer::getFileReportOptions([__DIR__ . '/test-report.pylint'])[0]; $this->assertSame( - 'somefile.php:3: [E0001] UndefinedVariable: Cannot find referenced variable $as_you_____type (column 10) -somefile.php:3: [E0001] MixedReturnStatement: Could not infer a return type (column 10) -somefile.php:2: [E0001] MixedInferredReturnType: Could not verify return type \'null|string\' for psalmCanVerify (column 42) -somefile.php:8: [E0001] UndefinedConstant: Const CHANGE_ME is not defined (column 6) -somefile.php:17: [W0001] PossiblyUndefinedGlobalVariable: Possibly undefined global variable $a, first seen on line 11 (column 6) -', + <<<'EOF' + somefile.php:3: [E0001] UndefinedVariable: Cannot find referenced variable $as_you_____type (column 10) + somefile.php:3: [E0001] MixedReturnStatement: Could not infer a return type (column 10) + somefile.php:2: [E0001] MixedInferredReturnType: Could not verify return type 'null|string' for psalmCanVerify (column 42) + somefile.php:8: [E0001] UndefinedConstant: Const CHANGE_ME is not defined (column 6) + somefile.php:17: [W0001] PossiblyUndefinedGlobalVariable: Possibly undefined global variable $a, first seen on line 11 (column 6) + + EOF, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $pylint_report_options), ); } @@ -1000,22 +1006,24 @@ public function testConsoleReport(): void $console_report_options->use_color = false; $this->assertSame( - 'ERROR: UndefinedVariable - somefile.php:3:10 - Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) - return $as_you_____type; + <<<'EOF' + ERROR: UndefinedVariable - somefile.php:3:10 - Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) + return $as_you_____type; + + ERROR: MixedReturnStatement - somefile.php:3:10 - Could not infer a return type (see https://psalm.dev/138) + return $as_you_____type; -ERROR: MixedReturnStatement - somefile.php:3:10 - Could not infer a return type (see https://psalm.dev/138) - return $as_you_____type; + ERROR: MixedInferredReturnType - somefile.php:2:42 - Could not verify return type 'null|string' for psalmCanVerify (see https://psalm.dev/047) + function psalmCanVerify(int $your_code): ?string { -ERROR: MixedInferredReturnType - somefile.php:2:42 - Could not verify return type \'null|string\' for psalmCanVerify (see https://psalm.dev/047) -function psalmCanVerify(int $your_code): ?string { + ERROR: UndefinedConstant - somefile.php:8:6 - Const CHANGE_ME is not defined (see https://psalm.dev/020) + echo CHANGE_ME; -ERROR: UndefinedConstant - somefile.php:8:6 - Const CHANGE_ME is not defined (see https://psalm.dev/020) -echo CHANGE_ME; + INFO: PossiblyUndefinedGlobalVariable - somefile.php:17:6 - Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126) + echo $a -INFO: PossiblyUndefinedGlobalVariable - somefile.php:17:6 - Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126) -echo $a -', + EOF, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $console_report_options), ); } @@ -1029,19 +1037,21 @@ public function testConsoleReportNoInfo(): void $console_report_options->show_info = false; $this->assertSame( - 'ERROR: UndefinedVariable - somefile.php:3:10 - Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) - return $as_you_____type; + <<<'EOF' + ERROR: UndefinedVariable - somefile.php:3:10 - Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) + return $as_you_____type; + + ERROR: MixedReturnStatement - somefile.php:3:10 - Could not infer a return type (see https://psalm.dev/138) + return $as_you_____type; -ERROR: MixedReturnStatement - somefile.php:3:10 - Could not infer a return type (see https://psalm.dev/138) - return $as_you_____type; + ERROR: MixedInferredReturnType - somefile.php:2:42 - Could not verify return type 'null|string' for psalmCanVerify (see https://psalm.dev/047) + function psalmCanVerify(int $your_code): ?string { -ERROR: MixedInferredReturnType - somefile.php:2:42 - Could not verify return type \'null|string\' for psalmCanVerify (see https://psalm.dev/047) -function psalmCanVerify(int $your_code): ?string { + ERROR: UndefinedConstant - somefile.php:8:6 - Const CHANGE_ME is not defined (see https://psalm.dev/020) + echo CHANGE_ME; -ERROR: UndefinedConstant - somefile.php:8:6 - Const CHANGE_ME is not defined (see https://psalm.dev/020) -echo CHANGE_ME; -', + EOF, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $console_report_options), ); } @@ -1055,22 +1065,24 @@ public function testConsoleReportNoSnippet(): void $console_report_options->use_color = false; $this->assertSame( - 'ERROR: UndefinedVariable - somefile.php:3:10 - Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) + <<<'EOF' + ERROR: UndefinedVariable - somefile.php:3:10 - Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) -ERROR: MixedReturnStatement - somefile.php:3:10 - Could not infer a return type (see https://psalm.dev/138) + ERROR: MixedReturnStatement - somefile.php:3:10 - Could not infer a return type (see https://psalm.dev/138) -ERROR: MixedInferredReturnType - somefile.php:2:42 - Could not verify return type \'null|string\' for psalmCanVerify (see https://psalm.dev/047) + ERROR: MixedInferredReturnType - somefile.php:2:42 - Could not verify return type 'null|string' for psalmCanVerify (see https://psalm.dev/047) -ERROR: UndefinedConstant - somefile.php:8:6 - Const CHANGE_ME is not defined (see https://psalm.dev/020) + ERROR: UndefinedConstant - somefile.php:8:6 - Const CHANGE_ME is not defined (see https://psalm.dev/020) -INFO: PossiblyUndefinedGlobalVariable - somefile.php:17:6 - Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126) + INFO: PossiblyUndefinedGlobalVariable - somefile.php:17:6 - Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126) -', + + EOF, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $console_report_options), ); } @@ -1118,17 +1130,20 @@ public function testCompactReport(): void $compact_report_options->use_color = false; $this->assertSame( - 'FILE: somefile.php' . "\n" . - "\n" . - '+----------+------+---------------------------------+---------------------------------------------------------------+' . "\n" . - '| SEVERITY | LINE | ISSUE | DESCRIPTION |' . "\n" . - '+----------+------+---------------------------------+---------------------------------------------------------------+' . "\n" . - '| ERROR | 3 | UndefinedVariable | Cannot find referenced variable $as_you_____type |' . "\n" . - '| ERROR | 3 | MixedReturnStatement | Could not infer a return type |' . "\n" . - '| ERROR | 2 | MixedInferredReturnType | Could not verify return type \'null|string\' for psalmCanVerify |' . "\n" . - '| ERROR | 8 | UndefinedConstant | Const CHANGE_ME is not defined |' . "\n" . - '| INFO | 17 | PossiblyUndefinedGlobalVariable | Possibly undefined global variable $a, first seen on line 11 |' . "\n" . - '+----------+------+---------------------------------+---------------------------------------------------------------+' . "\n", + <<<'EOF' + FILE: somefile.php + + +----------+------+---------------------------------+---------------------------------------------------------------+ + | SEVERITY | LINE | ISSUE | DESCRIPTION | + +----------+------+---------------------------------+---------------------------------------------------------------+ + | ERROR | 3 | UndefinedVariable | Cannot find referenced variable $as_you_____type | + | ERROR | 3 | MixedReturnStatement | Could not infer a return type | + | ERROR | 2 | MixedInferredReturnType | Could not verify return type 'null|string' for psalmCanVerify | + | ERROR | 8 | UndefinedConstant | Const CHANGE_ME is not defined | + | INFO | 17 | PossiblyUndefinedGlobalVariable | Possibly undefined global variable $a, first seen on line 11 | + +----------+------+---------------------------------+---------------------------------------------------------------+ + + EOF, $this->toUnixLineEndings(IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $compact_report_options)), ); } @@ -1140,25 +1155,27 @@ public function testCheckstyleReport(): void $checkstyle_report_options = ProjectAnalyzer::getFileReportOptions([__DIR__ . '/test-report.checkstyle.xml'])[0]; $this->assertSame( - ' - - - - - - - - - - - - - - - - - -', + <<<'EOF' + + + + + + + + + + + + + + + + + + + + EOF, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $checkstyle_report_options), ); @@ -1178,62 +1195,64 @@ public function testJunitReport(): void $xml = IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $checkstyle_report_options); $this->assertSame( - ' - - - - message: Cannot find referenced variable $as_you_____type -type: UndefinedVariable -snippet: return $as_you_____type; -selected_text: $as_you_____type -line: 3 -column_from: 10 -column_to: 26 - - - - message: Could not infer a return type -type: MixedReturnStatement -snippet: return $as_you_____type; -selected_text: $as_you_____type -line: 3 -column_from: 10 -column_to: 26 - - - - message: Could not verify return type \'null|string\' for psalmCanVerify -type: MixedInferredReturnType -snippet: function psalmCanVerify(int $your_code): ?string { -selected_text: ?string -line: 2 -column_from: 42 -column_to: 49 - - - - message: Const CHANGE_ME is not defined -type: UndefinedConstant -snippet: echo CHANGE_ME; -selected_text: CHANGE_ME -line: 8 -column_from: 6 -column_to: 15 - - - - message: Possibly undefined global variable $a, first seen on line 11 -type: PossiblyUndefinedGlobalVariable -snippet: echo $a -selected_text: $a -line: 17 -column_from: 6 -column_to: 8 - - - - -', + <<<'EOF' + + + + + message: Cannot find referenced variable $as_you_____type + type: UndefinedVariable + snippet: return $as_you_____type; + selected_text: $as_you_____type + line: 3 + column_from: 10 + column_to: 26 + + + + message: Could not infer a return type + type: MixedReturnStatement + snippet: return $as_you_____type; + selected_text: $as_you_____type + line: 3 + column_from: 10 + column_to: 26 + + + + message: Could not verify return type 'null|string' for psalmCanVerify + type: MixedInferredReturnType + snippet: function psalmCanVerify(int $your_code): ?string { + selected_text: ?string + line: 2 + column_from: 42 + column_to: 49 + + + + message: Const CHANGE_ME is not defined + type: UndefinedConstant + snippet: echo CHANGE_ME; + selected_text: CHANGE_ME + line: 8 + column_from: 6 + column_to: 15 + + + + message: Possibly undefined global variable $a, first seen on line 11 + type: PossiblyUndefinedGlobalVariable + snippet: echo $a + selected_text: $a + line: 17 + column_from: 6 + column_to: 8 + + + + + + EOF, $xml, ); @@ -1260,13 +1279,13 @@ public function testGithubActionsOutput(): void $github_report_options = new ReportOptions(); $github_report_options->format = Report::TYPE_GITHUB_ACTIONS; $expected_output = <<<'EOF' -::error file=somefile.php,line=3,col=10,title=UndefinedVariable::somefile.php:3:10: UndefinedVariable: Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) -::error file=somefile.php,line=3,col=10,title=MixedReturnStatement::somefile.php:3:10: MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138) -::error file=somefile.php,line=2,col=42,title=MixedInferredReturnType::somefile.php:2:42: MixedInferredReturnType: Could not verify return type 'null|string' for psalmCanVerify (see https://psalm.dev/047) -::error file=somefile.php,line=8,col=6,title=UndefinedConstant::somefile.php:8:6: UndefinedConstant: Const CHANGE_ME is not defined (see https://psalm.dev/020) -::warning file=somefile.php,line=17,col=6,title=PossiblyUndefinedGlobalVariable::somefile.php:17:6: PossiblyUndefinedGlobalVariable: Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126) + ::error file=somefile.php,line=3,col=10,title=UndefinedVariable::somefile.php:3:10: UndefinedVariable: Cannot find referenced variable $as_you_____type (see https://psalm.dev/024) + ::error file=somefile.php,line=3,col=10,title=MixedReturnStatement::somefile.php:3:10: MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138) + ::error file=somefile.php,line=2,col=42,title=MixedInferredReturnType::somefile.php:2:42: MixedInferredReturnType: Could not verify return type 'null|string' for psalmCanVerify (see https://psalm.dev/047) + ::error file=somefile.php,line=8,col=6,title=UndefinedConstant::somefile.php:8:6: UndefinedConstant: Const CHANGE_ME is not defined (see https://psalm.dev/020) + ::warning file=somefile.php,line=17,col=6,title=PossiblyUndefinedGlobalVariable::somefile.php:17:6: PossiblyUndefinedGlobalVariable: Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126) -EOF; + EOF; $this->assertSame( $expected_output, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $github_report_options), @@ -1280,13 +1299,13 @@ public function testCountOutput(): void $report_options = new ReportOptions(); $report_options->format = Report::TYPE_COUNT; $expected_output = <<<'EOF' -MixedInferredReturnType: 1 -MixedReturnStatement: 1 -PossiblyUndefinedGlobalVariable: 1 -UndefinedConstant: 1 -UndefinedVariable: 1 + MixedInferredReturnType: 1 + MixedReturnStatement: 1 + PossiblyUndefinedGlobalVariable: 1 + UndefinedConstant: 1 + UndefinedVariable: 1 -EOF; + EOF; $this->assertSame( $expected_output, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $report_options), @@ -1302,8 +1321,7 @@ public function testEmptyReportIfNotError(): void $this->analyzeFile('somefile.php', new Context()); $this->assertSame( - '[] -', + "[]\n", IssueBuffer::getOutput(IssueBuffer::getIssuesData(), ProjectAnalyzer::getFileReportOptions([__DIR__ . '/test-report.json'])[0]), ); $this->assertSame( @@ -1311,19 +1329,23 @@ public function testEmptyReportIfNotError(): void IssueBuffer::getOutput(IssueBuffer::getIssuesData(), ProjectAnalyzer::getFileReportOptions([__DIR__ . '/test-report.emacs'])[0]), ); $this->assertSame( - ' - - - -', + <<<'EOF' + + + + + + EOF, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), ProjectAnalyzer::getFileReportOptions([__DIR__ . '/test-report.xml'])[0]), ); $this->assertSame( - ' - - -', + <<<'EOF' + + + + + EOF, IssueBuffer::getOutput(IssueBuffer::getIssuesData(), ProjectAnalyzer::getFileReportOptions([__DIR__ . '/test-report.checkstyle.xml'])[0]), ); @@ -1331,8 +1353,10 @@ public function testEmptyReportIfNotError(): void IssueBuffer::finish($this->project_analyzer, true, 0); ob_end_clean(); $this->assertFileExists(__DIR__ . '/test-report.json'); - $this->assertSame('[] -', file_get_contents(__DIR__ . '/test-report.json')); + $this->assertSame( + "[]\n", + file_get_contents(__DIR__ . '/test-report.json'), + ); unlink(__DIR__ . '/test-report.json'); } From 07dfb5f2aad878da8e3e36fe0ba18181aac2e110 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 14 Feb 2023 22:00:17 -0400 Subject: [PATCH 065/109] Update docs/running_psalm/issues/UnusedProperty.md Co-authored-by: Theodore Brown --- docs/running_psalm/issues/UnusedProperty.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/running_psalm/issues/UnusedProperty.md b/docs/running_psalm/issues/UnusedProperty.md index 07c7f3545b5..5769b0f8341 100644 --- a/docs/running_psalm/issues/UnusedProperty.md +++ b/docs/running_psalm/issues/UnusedProperty.md @@ -3,7 +3,7 @@ Emitted when `--find-dead-code` is turned on and Psalm cannot find any uses of a private property. -Properties used in constructor only are considered used. Use normal variables instead. +Properties used in constructor only are considered unused. Use normal variables instead. If this property is used and part of the public API, annotate the containing class with `@psalm-api`. From a538439a878c805f1bc42f5b18c9cc3471cea3c9 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 00:30:45 -0400 Subject: [PATCH 066/109] Add option to skip callmap test With this change, callmap tests can be skipped with `--exclude-group=callmap`: ```console $ php-noxdebug vendor/bin/paratest --passthru-php="-dmemory_limit=-1" --exclude-group=callmap ``` --- tests/Internal/Codebase/InternalCallMapHandlerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 37aeb4bd030..ddce4bea24e 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -44,6 +44,7 @@ use const PHP_MINOR_VERSION; use const PHP_VERSION; +/** @group callmap */ class InternalCallMapHandlerTest extends TestCase { /** From 3f2ecaec7e509e233a5c1c1d907e3d72ad111e03 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 01:20:03 -0400 Subject: [PATCH 067/109] Allow `@var` annotations on global vars The actual code was extracted from `StaticAnalyzer` Fixes vimeo/psalm#1111 --- .../Internal/Analyzer/CommentAnalyzer.php | 132 ++++++++++++++++++ .../Analyzer/Statements/GlobalAnalyzer.php | 122 +++++++++------- .../Analyzer/Statements/StaticAnalyzer.php | 109 ++------------- tests/AnnotationTest.php | 18 +++ 4 files changed, 234 insertions(+), 147 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php index 7d8fdd13a84..00a3f8a20f3 100644 --- a/src/Psalm/Internal/Analyzer/CommentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/CommentAnalyzer.php @@ -4,6 +4,9 @@ use PhpParser; use Psalm\Aliases; +use Psalm\CodeLocation; +use Psalm\CodeLocation\DocblockTypeLocation; +use Psalm\Context; use Psalm\DocComment; use Psalm\Exception\DocblockParseException; use Psalm\Exception\IncorrectDocblockException; @@ -13,12 +16,18 @@ use Psalm\Internal\Scanner\ParsedDocblock; use Psalm\Internal\Scanner\VarDocblockComment; use Psalm\Internal\Type\TypeAlias; +use Psalm\Internal\Type\TypeExpander; use Psalm\Internal\Type\TypeParser; use Psalm\Internal\Type\TypeTokenizer; +use Psalm\Issue\InvalidDocblock; +use Psalm\Issue\MissingDocblockType; +use Psalm\IssueBuffer; use Psalm\Type\Union; +use UnexpectedValueException; use function array_merge; use function count; +use function is_string; use function preg_match; use function preg_replace; use function preg_split; @@ -381,4 +390,127 @@ public static function splitDocLine(string $return_block): array return [$type]; } + + /** @return list */ + public static function getVarComments( + PhpParser\Comment\Doc $doc_comment, + StatementsAnalyzer $statements_analyzer, + PhpParser\Node\Expr\Variable $var + ): array { + $codebase = $statements_analyzer->getCodebase(); + $parsed_docblock = $statements_analyzer->getParsedDocblock(); + + if (!$parsed_docblock) { + return []; + } + + $var_comments = []; + + try { + $var_comments = $codebase->config->disable_var_parsing + ? [] + : self::arrayToDocblocks( + $doc_comment, + $parsed_docblock, + $statements_analyzer->getSource(), + $statements_analyzer->getSource()->getAliases(), + $statements_analyzer->getSource()->getTemplateTypeMap(), + ); + } catch (IncorrectDocblockException $e) { + IssueBuffer::maybeAdd( + new MissingDocblockType( + $e->getMessage(), + new CodeLocation($statements_analyzer, $var), + ), + ); + } catch (DocblockParseException $e) { + IssueBuffer::maybeAdd( + new InvalidDocblock( + $e->getMessage(), + new CodeLocation($statements_analyzer->getSource(), $var), + ), + ); + } + + return $var_comments; + } + + /** + * @param list $var_comments + */ + public static function populateVarTypesFromDocblock( + array $var_comments, + PhpParser\Node\Expr\Variable $var, + Context $context, + StatementsAnalyzer $statements_analyzer + ): ?Union { + if (!is_string($var->name)) { + return null; + } + $codebase = $statements_analyzer->getCodebase(); + $comment_type = null; + $var_id = '$' . $var->name; + + foreach ($var_comments as $var_comment) { + if (!$var_comment->type) { + continue; + } + + try { + $var_comment_type = TypeExpander::expandUnion( + $codebase, + $var_comment->type, + $context->self, + $context->self, + $statements_analyzer->getParentFQCLN(), + ); + + $var_comment_type = $var_comment_type->setFromDocblock(); + + /** @psalm-suppress UnusedMethodCall */ + $var_comment_type->check( + $statements_analyzer, + new CodeLocation($statements_analyzer->getSource(), $var), + $statements_analyzer->getSuppressedIssues(), + ); + + if ($codebase->alter_code + && $var_comment->type_start + && $var_comment->type_end + && $var_comment->line_number + ) { + $type_location = new DocblockTypeLocation( + $statements_analyzer, + $var_comment->type_start, + $var_comment->type_end, + $var_comment->line_number, + ); + + $codebase->classlikes->handleDocblockTypeInMigration( + $codebase, + $statements_analyzer, + $var_comment_type, + $type_location, + $context->calling_method_id, + ); + } + + if (!$var_comment->var_id || $var_comment->var_id === $var_id) { + $comment_type = $var_comment_type; + continue; + } + + $context->vars_in_scope[$var_comment->var_id] = $var_comment_type; + } catch (UnexpectedValueException $e) { + IssueBuffer::maybeAdd( + new InvalidDocblock( + $e->getMessage(), + new CodeLocation($statements_analyzer, $var), + ), + ); + } + } + + return $comment_type; + } } diff --git a/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php index a96755c3c6c..4eb29ca7b62 100644 --- a/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php @@ -5,6 +5,7 @@ use PhpParser; use Psalm\CodeLocation; use Psalm\Context; +use Psalm\Internal\Analyzer\CommentAnalyzer; use Psalm\Internal\Analyzer\FunctionLikeAnalyzer; use Psalm\Internal\Analyzer\Statements\Expression\Fetch\VariableFetchAnalyzer; use Psalm\Internal\Analyzer\StatementsAnalyzer; @@ -43,57 +44,80 @@ public static function analyze( : null; foreach ($stmt->vars as $var) { - if ($var instanceof PhpParser\Node\Expr\Variable) { - if (is_string($var->name)) { - $var_id = '$' . $var->name; - - if ($var->name === 'argv' || $var->name === 'argc') { - $context->vars_in_scope[$var_id] = - VariableFetchAnalyzer::getGlobalType($var_id, $codebase->analysis_php_version_id); - } elseif (isset($function_storage->global_types[$var_id])) { - $context->vars_in_scope[$var_id] = $function_storage->global_types[$var_id]; - $context->vars_possibly_in_scope[$var_id] = true; - } else { - $context->vars_in_scope[$var_id] = - $global_context && $global_context->hasVariable($var_id) - ? $global_context->vars_in_scope[$var_id] - : VariableFetchAnalyzer::getGlobalType($var_id, $codebase->analysis_php_version_id); - - $context->vars_possibly_in_scope[$var_id] = true; - - $context->byref_constraints[$var_id] = new ReferenceConstraint(); - } - - $assignment_node = DataFlowNode::getForAssignment( - $var_id, - new CodeLocation($statements_analyzer, $var), - ); - $context->vars_in_scope[$var_id] = $context->vars_in_scope[$var_id]->setParentNodes([ - $assignment_node->id => $assignment_node, - ]); - $context->references_to_external_scope[$var_id] = true; - - if (isset($context->references_in_scope[$var_id])) { - // Global shadows existing reference - $context->decrementReferenceCount($var_id); - unset($context->references_in_scope[$var_id]); - } - $statements_analyzer->registerVariable( - $var_id, - new CodeLocation($statements_analyzer, $var), - $context->branch_point, - ); - $statements_analyzer->getCodebase()->analyzer->addNodeReference( - $statements_analyzer->getFilePath(), - $var, - $var_id, - ); - - if ($global_context !== null && $global_context->hasVariable($var_id)) { - $global_context->referenced_globals[$var_id] = true; - } + if (!$var instanceof PhpParser\Node\Expr\Variable) { + continue; + } + + if (!is_string($var->name)) { + continue; + } + + $var_id = '$' . $var->name; + + $doc_comment = $stmt->getDocComment(); + $comment_type = null; + + if ($doc_comment) { + $var_comments = CommentAnalyzer::getVarComments($doc_comment, $statements_analyzer, $var); + $comment_type = CommentAnalyzer::populateVarTypesFromDocblock( + $var_comments, + $var, + $context, + $statements_analyzer, + ); + } + + if ($comment_type) { + $context->vars_in_scope[$var_id] = $comment_type; + $context->vars_possibly_in_scope[$var_id] = true; + $context->byref_constraints[$var_id] = new ReferenceConstraint($comment_type); + } else { + if ($var->name === 'argv' || $var->name === 'argc') { + $context->vars_in_scope[$var_id] = + VariableFetchAnalyzer::getGlobalType($var_id, $codebase->analysis_php_version_id); + } elseif (isset($function_storage->global_types[$var_id])) { + $context->vars_in_scope[$var_id] = $function_storage->global_types[$var_id]; + $context->vars_possibly_in_scope[$var_id] = true; + } else { + $context->vars_in_scope[$var_id] = + $global_context && $global_context->hasVariable($var_id) + ? $global_context->vars_in_scope[$var_id] + : VariableFetchAnalyzer::getGlobalType($var_id, $codebase->analysis_php_version_id); + + $context->vars_possibly_in_scope[$var_id] = true; + + $context->byref_constraints[$var_id] = new ReferenceConstraint(); } } + + $assignment_node = DataFlowNode::getForAssignment( + $var_id, + new CodeLocation($statements_analyzer, $var), + ); + $context->vars_in_scope[$var_id] = $context->vars_in_scope[$var_id]->setParentNodes([ + $assignment_node->id => $assignment_node, + ]); + $context->references_to_external_scope[$var_id] = true; + + if (isset($context->references_in_scope[$var_id])) { + // Global shadows existing reference + $context->decrementReferenceCount($var_id); + unset($context->references_in_scope[$var_id]); + } + $statements_analyzer->registerVariable( + $var_id, + new CodeLocation($statements_analyzer, $var), + $context->branch_point, + ); + $statements_analyzer->getCodebase()->analyzer->addNodeReference( + $statements_analyzer->getFilePath(), + $var, + $var_id, + ); + + if ($global_context !== null && $global_context->hasVariable($var_id)) { + $global_context->referenced_globals[$var_id] = true; + } } } } diff --git a/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php index efd9d9e7ac8..eecb5b84284 100644 --- a/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php @@ -4,22 +4,15 @@ use PhpParser; use Psalm\CodeLocation; -use Psalm\CodeLocation\DocblockTypeLocation; use Psalm\Context; -use Psalm\Exception\DocblockParseException; -use Psalm\Exception\IncorrectDocblockException; use Psalm\Internal\Analyzer\CommentAnalyzer; use Psalm\Internal\Analyzer\StatementsAnalyzer; use Psalm\Internal\ReferenceConstraint; use Psalm\Internal\Type\Comparator\UnionTypeComparator; -use Psalm\Internal\Type\TypeExpander; use Psalm\Issue\ImpureStaticVariable; -use Psalm\Issue\InvalidDocblock; -use Psalm\Issue\MissingDocblockType; use Psalm\Issue\ReferenceConstraintViolation; use Psalm\IssueBuffer; use Psalm\Type; -use UnexpectedValueException; use function is_string; @@ -56,98 +49,18 @@ public static function analyze( $comment_type = null; - if ($doc_comment && ($parsed_docblock = $statements_analyzer->getParsedDocblock())) { - $var_comments = []; - - try { - $var_comments = $codebase->config->disable_var_parsing - ? [] - : CommentAnalyzer::arrayToDocblocks( - $doc_comment, - $parsed_docblock, - $statements_analyzer->getSource(), - $statements_analyzer->getSource()->getAliases(), - $statements_analyzer->getSource()->getTemplateTypeMap(), - ); - } catch (IncorrectDocblockException $e) { - IssueBuffer::maybeAdd( - new MissingDocblockType( - $e->getMessage(), - new CodeLocation($statements_analyzer, $var), - ), - ); - } catch (DocblockParseException $e) { - IssueBuffer::maybeAdd( - new InvalidDocblock( - $e->getMessage(), - new CodeLocation($statements_analyzer->getSource(), $var), - ), - ); - } - - foreach ($var_comments as $var_comment) { - if (!$var_comment->type) { - continue; - } - - try { - $var_comment_type = TypeExpander::expandUnion( - $codebase, - $var_comment->type, - $context->self, - $context->self, - $statements_analyzer->getParentFQCLN(), - ); - - $var_comment_type = $var_comment_type->setFromDocblock(); - - /** @psalm-suppress UnusedMethodCall */ - $var_comment_type->check( - $statements_analyzer, - new CodeLocation($statements_analyzer->getSource(), $var), - $statements_analyzer->getSuppressedIssues(), - ); - - if ($codebase->alter_code - && $var_comment->type_start - && $var_comment->type_end - && $var_comment->line_number - ) { - $type_location = new DocblockTypeLocation( - $statements_analyzer, - $var_comment->type_start, - $var_comment->type_end, - $var_comment->line_number, - ); - - $codebase->classlikes->handleDocblockTypeInMigration( - $codebase, - $statements_analyzer, - $var_comment_type, - $type_location, - $context->calling_method_id, - ); - } - - if (!$var_comment->var_id || $var_comment->var_id === $var_id) { - $comment_type = $var_comment_type; - continue; - } - - $context->vars_in_scope[$var_comment->var_id] = $var_comment_type; - } catch (UnexpectedValueException $e) { - IssueBuffer::maybeAdd( - new InvalidDocblock( - $e->getMessage(), - new CodeLocation($statements_analyzer, $var), - ), - ); - } - } + if ($doc_comment) { + $var_comments = CommentAnalyzer::getVarComments($doc_comment, $statements_analyzer, $var->var); + $comment_type = CommentAnalyzer::populateVarTypesFromDocblock( + $var_comments, + $var->var, + $context, + $statements_analyzer, + ); + } - if ($comment_type) { - $context->byref_constraints[$var_id] = new ReferenceConstraint($comment_type); - } + if ($comment_type) { + $context->byref_constraints[$var_id] = new ReferenceConstraint($comment_type); } if ($var->default) { diff --git a/tests/AnnotationTest.php b/tests/AnnotationTest.php index 45cb565f5f3..036481c0806 100644 --- a/tests/AnnotationTest.php +++ b/tests/AnnotationTest.php @@ -1248,6 +1248,24 @@ public function __construct( } }', ], + 'globalDocBlock' => [ + 'code' => ' [ + 'code' => ' Date: Wed, 15 Feb 2023 02:53:47 -0400 Subject: [PATCH 068/109] Flag class constant references where LHS is ordinary string Fixes vimeo/psalm#2185 --- .../Statements/Expression/ClassConstAnalyzer.php | 13 +++++++++++++ tests/ConstantTest.php | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php index e00739c18fe..d271ce94b0d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php @@ -25,6 +25,7 @@ use Psalm\Issue\InternalClass; use Psalm\Issue\InvalidClassConstantType; use Psalm\Issue\InvalidConstantAssignmentValue; +use Psalm\Issue\InvalidStringClass; use Psalm\Issue\LessSpecificClassConstantType; use Psalm\Issue\NonStaticSelfCall; use Psalm\Issue\OverriddenFinalConstant; @@ -41,6 +42,7 @@ use Psalm\Type\Atomic\TMixed; use Psalm\Type\Atomic\TNamedObject; use Psalm\Type\Atomic\TObject; +use Psalm\Type\Atomic\TString; use Psalm\Type\Atomic\TTemplateParam; use Psalm\Type\Atomic\TTemplateParamClass; use Psalm\Type\Union; @@ -467,6 +469,17 @@ public static function analyzeFetch( } elseif ($atomic_type instanceof TLiteralClassString) { $fq_class_name = $atomic_type->value; $lhs_type_definite_class = $atomic_type->definite_class; + } elseif ($atomic_type instanceof TString + && !$atomic_type instanceof TClassString + && !$codebase->config->allow_string_standin_for_class + ) { + IssueBuffer::maybeAdd( + new InvalidStringClass( + 'String cannot be used as a class', + new CodeLocation($statements_analyzer->getSource(), $stmt->class), + ), + $statements_analyzer->getSuppressedIssues(), + ); } } diff --git a/tests/ConstantTest.php b/tests/ConstantTest.php index 54673fc8e0d..b0a976782fa 100644 --- a/tests/ConstantTest.php +++ b/tests/ConstantTest.php @@ -2030,6 +2030,18 @@ class Foo 'ignored_issues' => [], 'php_version' => '8.0', ], + 'classStringIsRequiredToAccessClassConstant' => [ + 'code' => ' 'InvalidStringClass', + ], ]; } } From d6b75057a4895c294aedf52cc35c30637ac09f8a Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 03:02:34 -0400 Subject: [PATCH 069/109] Fix test --- tests/DocumentationTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/DocumentationTest.php b/tests/DocumentationTest.php index feec5b5f70a..653e25f2004 100644 --- a/tests/DocumentationTest.php +++ b/tests/DocumentationTest.php @@ -333,6 +333,7 @@ public function testShortcodesAreUnique(): void $all_shortcodes = []; foreach ($all_issues as $issue_type) { + /** @var class-string $issue_class */ $issue_class = '\\Psalm\\Issue\\' . $issue_type; /** @var int $shortcode */ $shortcode = $issue_class::SHORTCODE; From 2bb590feb629e9cd8ab2a314219133674de6a793 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 03:29:02 -0400 Subject: [PATCH 070/109] Allow suppressing `MissingThrowsDocblock` for individual exceptions Fixes vimeo/psalm#8638 --- config.xsd | 2 +- src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php | 1 + src/Psalm/Issue/MissingThrowsDocblock.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.xsd b/config.xsd index 3582e854b92..fd338ad9de6 100644 --- a/config.xsd +++ b/config.xsd @@ -318,7 +318,7 @@ - + diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 6eca8ec9532..fb9c7128cc0 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -736,6 +736,7 @@ public function analyze( $possibly_thrown_exception . ' is thrown but not caught - please either catch' . ' or add a @throws annotation', $codelocation, + $possibly_thrown_exception, ), ); } diff --git a/src/Psalm/Issue/MissingThrowsDocblock.php b/src/Psalm/Issue/MissingThrowsDocblock.php index 4a5862bf8f1..7dc0ba8ba10 100644 --- a/src/Psalm/Issue/MissingThrowsDocblock.php +++ b/src/Psalm/Issue/MissingThrowsDocblock.php @@ -2,7 +2,7 @@ namespace Psalm\Issue; -final class MissingThrowsDocblock extends CodeIssue +final class MissingThrowsDocblock extends ClassIssue { public const SHORTCODE = 169; } From c28d96e25ce4a613175e8356b92d7e0ef0298155 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 03:55:49 -0400 Subject: [PATCH 071/109] Fixed issue message for missing `@psalm-external-mutation-free` Fixes vimeo/psalm#8604 --- src/Psalm/Internal/Analyzer/MethodComparator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/MethodComparator.php b/src/Psalm/Internal/Analyzer/MethodComparator.php index ed56927f874..82e1c6c4863 100644 --- a/src/Psalm/Internal/Analyzer/MethodComparator.php +++ b/src/Psalm/Internal/Analyzer/MethodComparator.php @@ -320,10 +320,10 @@ private static function checkForObviousMethodMismatches( ) { IssueBuffer::maybeAdd( new MissingImmutableAnnotation( - $cased_guide_method_id . ' is marked @psalm-immutable, but ' + $cased_guide_method_id . ' is marked @psalm-external-mutation-free, but ' . $implementer_classlike_storage->name . '::' . ($guide_method_storage->cased_name ?: '') - . ' is not marked @psalm-immutable', + . ' is not marked @psalm-external-mutation-free', $code_location, ), $suppressed_issues + $implementer_classlike_storage->suppressed_issues, From faf4e8b2825372ff2a8c891bdc41c2e4afaf3b3c Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 12:27:14 -0400 Subject: [PATCH 072/109] Suggest Psalm to be installed in require-dev section See composer/composer#10960 --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 31037d08a21..2ca4e0653a8 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,8 @@ "keywords": [ "php", "code", - "inspection" + "inspection", + "static analysis" ], "license": "MIT", "authors": [ From ab77cfd4902c012f6ed3955d852015acf46475cb Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Wed, 15 Feb 2023 13:33:34 -0600 Subject: [PATCH 073/109] Fix memcached extension callmap --- dictionaries/CallMap.php | 46 +++++++++---------- dictionaries/CallMap_historical.php | 46 +++++++++---------- .../Codebase/InternalCallMapHandlerTest.php | 2 + 3 files changed, 48 insertions(+), 46 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index b64a4da67ba..23a89269691 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -6762,36 +6762,36 @@ 'memcache_set_compress_threshold' => ['bool', 'memcache_obj'=>'Memcache', 'threshold'=>'int', 'min_savings='=>'float'], 'memcache_set_failure_callback' => ['', 'memcache_obj'=>'Memcache'], 'memcache_set_server_params' => ['bool', 'memcache_obj'=>'Memcache', 'host'=>'string', 'port='=>'int', 'timeout='=>'int', 'retry_interval='=>'int', 'status='=>'bool', 'failure_callback='=>'callable'], -'Memcached::__construct' => ['void', 'persistent_id='=>'mixed|string', 'on_new_object_cb='=>'mixed'], +'Memcached::__construct' => ['void', 'persistent_id='=>'?string', 'callback='=>'?callable', 'connection_str='=>'?string'], 'Memcached::add' => ['bool', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::addByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::addServer' => ['bool', 'host'=>'string', 'port'=>'int', 'weight='=>'int'], 'Memcached::addServers' => ['bool', 'servers'=>'array'], -'Memcached::append' => ['bool', 'key'=>'string', 'value'=>'string'], -'Memcached::appendByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'string'], -'Memcached::cas' => ['bool', 'cas_token'=>'float', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], -'Memcached::casByKey' => ['bool', 'cas_token'=>'float', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], +'Memcached::append' => ['?bool', 'key'=>'string', 'value'=>'string'], +'Memcached::appendByKey' => ['?bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'string'], +'Memcached::cas' => ['bool', 'cas_token'=>'string|int|float', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], +'Memcached::casByKey' => ['bool', 'cas_token'=>'string|int|float', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::decrement' => ['int|false', 'key'=>'string', 'offset='=>'int', 'initial_value='=>'int', 'expiry='=>'int'], 'Memcached::decrementByKey' => ['int|false', 'server_key'=>'string', 'key'=>'string', 'offset='=>'int', 'initial_value='=>'int', 'expiry='=>'int'], 'Memcached::delete' => ['bool', 'key'=>'string', 'time='=>'int'], 'Memcached::deleteByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'time='=>'int'], 'Memcached::deleteMulti' => ['array', 'keys'=>'array', 'time='=>'int'], -'Memcached::deleteMultiByKey' => ['bool', 'server_key'=>'string', 'keys'=>'array', 'time='=>'int'], +'Memcached::deleteMultiByKey' => ['array', 'server_key'=>'string', 'keys'=>'array', 'time='=>'int'], 'Memcached::fetch' => ['array|false'], 'Memcached::fetchAll' => ['array|false'], 'Memcached::flush' => ['bool', 'delay='=>'int'], -'Memcached::flushBuffers' => [''], -'Memcached::get' => ['mixed|false', 'key'=>'string', 'cache_cb='=>'?callable', 'flags='=>'int'], +'Memcached::flushBuffers' => ['bool'], +'Memcached::get' => ['mixed|false', 'key'=>'string', 'cache_cb='=>'?callable', 'get_flags='=>'int'], 'Memcached::getAllKeys' => ['array|false'], -'Memcached::getByKey' => ['mixed|false', 'server_key'=>'string', 'key'=>'string', 'value_cb='=>'?callable', 'flags='=>'int'], -'Memcached::getDelayed' => ['bool', 'keys'=>'array', 'with_cas='=>'bool', 'value_cb='=>'callable'], +'Memcached::getByKey' => ['mixed|false', 'server_key'=>'string', 'key'=>'string', 'cache_cb='=>'?callable', 'get_flags='=>'int'], +'Memcached::getDelayed' => ['bool', 'keys'=>'array', 'with_cas='=>'bool', 'value_cb='=>'?callable'], 'Memcached::getDelayedByKey' => ['bool', 'server_key'=>'string', 'keys'=>'array', 'with_cas='=>'bool', 'value_cb='=>'?callable'], -'Memcached::getLastDisconnectedServer' => [''], -'Memcached::getLastErrorCode' => [''], -'Memcached::getLastErrorErrno' => [''], -'Memcached::getLastErrorMessage' => [''], -'Memcached::getMulti' => ['array|false', 'keys'=>'array', 'flags='=>'int'], -'Memcached::getMultiByKey' => ['array|false', 'server_key'=>'string', 'keys'=>'array', 'flags='=>'int'], +'Memcached::getLastDisconnectedServer' => ['array|false'], +'Memcached::getLastErrorCode' => ['int'], +'Memcached::getLastErrorErrno' => ['int'], +'Memcached::getLastErrorMessage' => ['string'], +'Memcached::getMulti' => ['array|false', 'keys'=>'array', 'get_flags='=>'int'], +'Memcached::getMultiByKey' => ['array|false', 'server_key'=>'string', 'keys'=>'array', 'get_flags='=>'int'], 'Memcached::getOption' => ['mixed|false', 'option'=>'int'], 'Memcached::getResultCode' => ['int'], 'Memcached::getResultMessage' => ['string'], @@ -6803,23 +6803,23 @@ 'Memcached::incrementByKey' => ['int|false', 'server_key'=>'string', 'key'=>'string', 'offset='=>'int', 'initial_value='=>'int', 'expiry='=>'int'], 'Memcached::isPersistent' => ['bool'], 'Memcached::isPristine' => ['bool'], -'Memcached::prepend' => ['bool', 'key'=>'string', 'value'=>'string'], -'Memcached::prependByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'string'], +'Memcached::prepend' => ['?bool', 'key'=>'string', 'value'=>'string'], +'Memcached::prependByKey' => ['?bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'string'], 'Memcached::quit' => ['bool'], 'Memcached::replace' => ['bool', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::replaceByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::resetServerList' => ['bool'], 'Memcached::set' => ['bool', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], -'Memcached::setBucket' => ['', 'host_map'=>'array', 'forward_map'=>'array', 'replicas'=>''], +'Memcached::setBucket' => ['bool', 'host_map'=>'array', 'forward_map'=>'?array', 'replicas'=>'int'], 'Memcached::setByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], -'Memcached::setEncodingKey' => ['', 'key'=>''], +'Memcached::setEncodingKey' => ['bool', 'key'=>'string'], 'Memcached::setMulti' => ['bool', 'items'=>'array', 'expiration='=>'int'], 'Memcached::setMultiByKey' => ['bool', 'server_key'=>'string', 'items'=>'array', 'expiration='=>'int'], 'Memcached::setOption' => ['bool', 'option'=>'int', 'value'=>'mixed'], 'Memcached::setOptions' => ['bool', 'options'=>'array'], -'Memcached::setSaslAuthData' => ['void', 'username'=>'string', 'password'=>'string'], -'Memcached::touch' => ['bool', 'key'=>'string', 'expiration'=>'int'], -'Memcached::touchByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'expiration'=>'int'], +'Memcached::setSaslAuthData' => ['bool', 'username'=>'string', 'password'=>'string'], +'Memcached::touch' => ['bool', 'key'=>'string', 'expiration='=>'int'], +'Memcached::touchByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'expiration='=>'int'], 'MemcachePool::add' => ['bool', 'key'=>'string', 'var'=>'mixed', 'flag='=>'int', 'expire='=>'int'], 'MemcachePool::addServer' => ['bool', 'host'=>'string', 'port='=>'int', 'persistent='=>'bool', 'weight='=>'int', 'timeout='=>'int', 'retry_interval='=>'int', 'status='=>'bool', 'failure_callback='=>'?callable', 'timeoutms='=>'int'], 'MemcachePool::append' => [''], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 4645caba322..e4f52d08dff 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -3479,36 +3479,36 @@ 'MemcachePool::setCompressThreshold' => ['bool', 'thresold'=>'int', 'min_saving='=>'float'], 'MemcachePool::setFailureCallback' => [''], 'MemcachePool::setServerParams' => ['bool', 'host'=>'string', 'port='=>'int', 'timeout='=>'int', 'retry_interval='=>'int', 'status='=>'bool', 'failure_callback='=>'?callable'], - 'Memcached::__construct' => ['void', 'persistent_id='=>'mixed|string', 'on_new_object_cb='=>'mixed'], + 'Memcached::__construct' => ['void', 'persistent_id='=>'?string', 'callback='=>'?callable', 'connection_str='=>'?string'], 'Memcached::add' => ['bool', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::addByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::addServer' => ['bool', 'host'=>'string', 'port'=>'int', 'weight='=>'int'], 'Memcached::addServers' => ['bool', 'servers'=>'array'], - 'Memcached::append' => ['bool', 'key'=>'string', 'value'=>'string'], - 'Memcached::appendByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'string'], - 'Memcached::cas' => ['bool', 'cas_token'=>'float', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], - 'Memcached::casByKey' => ['bool', 'cas_token'=>'float', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], + 'Memcached::append' => ['?bool', 'key'=>'string', 'value'=>'string'], + 'Memcached::appendByKey' => ['?bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'string'], + 'Memcached::cas' => ['bool', 'cas_token'=>'string|int|float', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], + 'Memcached::casByKey' => ['bool', 'cas_token'=>'string|int|float', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::decrement' => ['int|false', 'key'=>'string', 'offset='=>'int', 'initial_value='=>'int', 'expiry='=>'int'], 'Memcached::decrementByKey' => ['int|false', 'server_key'=>'string', 'key'=>'string', 'offset='=>'int', 'initial_value='=>'int', 'expiry='=>'int'], 'Memcached::delete' => ['bool', 'key'=>'string', 'time='=>'int'], 'Memcached::deleteByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'time='=>'int'], 'Memcached::deleteMulti' => ['array', 'keys'=>'array', 'time='=>'int'], - 'Memcached::deleteMultiByKey' => ['bool', 'server_key'=>'string', 'keys'=>'array', 'time='=>'int'], + 'Memcached::deleteMultiByKey' => ['array', 'server_key'=>'string', 'keys'=>'array', 'time='=>'int'], 'Memcached::fetch' => ['array|false'], 'Memcached::fetchAll' => ['array|false'], 'Memcached::flush' => ['bool', 'delay='=>'int'], - 'Memcached::flushBuffers' => [''], - 'Memcached::get' => ['mixed|false', 'key'=>'string', 'cache_cb='=>'?callable', 'flags='=>'int'], + 'Memcached::flushBuffers' => ['bool'], + 'Memcached::get' => ['mixed|false', 'key'=>'string', 'cache_cb='=>'?callable', 'get_flags='=>'int'], 'Memcached::getAllKeys' => ['array|false'], - 'Memcached::getByKey' => ['mixed|false', 'server_key'=>'string', 'key'=>'string', 'value_cb='=>'?callable', 'flags='=>'int'], - 'Memcached::getDelayed' => ['bool', 'keys'=>'array', 'with_cas='=>'bool', 'value_cb='=>'callable'], + 'Memcached::getByKey' => ['mixed|false', 'server_key'=>'string', 'key'=>'string', 'cache_cb='=>'?callable', 'get_flags='=>'int'], + 'Memcached::getDelayed' => ['bool', 'keys'=>'array', 'with_cas='=>'bool', 'value_cb='=>'?callable'], 'Memcached::getDelayedByKey' => ['bool', 'server_key'=>'string', 'keys'=>'array', 'with_cas='=>'bool', 'value_cb='=>'?callable'], - 'Memcached::getLastDisconnectedServer' => [''], - 'Memcached::getLastErrorCode' => [''], - 'Memcached::getLastErrorErrno' => [''], - 'Memcached::getLastErrorMessage' => [''], - 'Memcached::getMulti' => ['array|false', 'keys'=>'array', 'flags='=>'int'], - 'Memcached::getMultiByKey' => ['array|false', 'server_key'=>'string', 'keys'=>'array', 'flags='=>'int'], + 'Memcached::getLastDisconnectedServer' => ['array|false'], + 'Memcached::getLastErrorCode' => ['int'], + 'Memcached::getLastErrorErrno' => ['int'], + 'Memcached::getLastErrorMessage' => ['string'], + 'Memcached::getMulti' => ['array|false', 'keys'=>'array', 'get_flags='=>'int'], + 'Memcached::getMultiByKey' => ['array|false', 'server_key'=>'string', 'keys'=>'array', 'get_flags='=>'int'], 'Memcached::getOption' => ['mixed|false', 'option'=>'int'], 'Memcached::getResultCode' => ['int'], 'Memcached::getResultMessage' => ['string'], @@ -3520,23 +3520,23 @@ 'Memcached::incrementByKey' => ['int|false', 'server_key'=>'string', 'key'=>'string', 'offset='=>'int', 'initial_value='=>'int', 'expiry='=>'int'], 'Memcached::isPersistent' => ['bool'], 'Memcached::isPristine' => ['bool'], - 'Memcached::prepend' => ['bool', 'key'=>'string', 'value'=>'string'], - 'Memcached::prependByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'string'], + 'Memcached::prepend' => ['?bool', 'key'=>'string', 'value'=>'string'], + 'Memcached::prependByKey' => ['?bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'string'], 'Memcached::quit' => ['bool'], 'Memcached::replace' => ['bool', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::replaceByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], 'Memcached::resetServerList' => ['bool'], 'Memcached::set' => ['bool', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], - 'Memcached::setBucket' => ['', 'host_map'=>'array', 'forward_map'=>'array', 'replicas'=>''], + 'Memcached::setBucket' => ['bool', 'host_map'=>'array', 'forward_map'=>'?array', 'replicas'=>'int'], 'Memcached::setByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'value'=>'mixed', 'expiration='=>'int'], - 'Memcached::setEncodingKey' => ['', 'key'=>''], + 'Memcached::setEncodingKey' => ['bool', 'key'=>'string'], 'Memcached::setMulti' => ['bool', 'items'=>'array', 'expiration='=>'int'], 'Memcached::setMultiByKey' => ['bool', 'server_key'=>'string', 'items'=>'array', 'expiration='=>'int'], 'Memcached::setOption' => ['bool', 'option'=>'int', 'value'=>'mixed'], 'Memcached::setOptions' => ['bool', 'options'=>'array'], - 'Memcached::setSaslAuthData' => ['void', 'username'=>'string', 'password'=>'string'], - 'Memcached::touch' => ['bool', 'key'=>'string', 'expiration'=>'int'], - 'Memcached::touchByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'expiration'=>'int'], + 'Memcached::setSaslAuthData' => ['bool', 'username'=>'string', 'password'=>'string'], + 'Memcached::touch' => ['bool', 'key'=>'string', 'expiration='=>'int'], + 'Memcached::touchByKey' => ['bool', 'server_key'=>'string', 'key'=>'string', 'expiration='=>'int'], 'MessageFormatter::__construct' => ['void', 'locale'=>'string', 'pattern'=>'string'], 'MessageFormatter::create' => ['MessageFormatter', 'locale'=>'string', 'pattern'=>'string'], 'MessageFormatter::format' => ['false|string', 'args'=>'array'], diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index ddce4bea24e..3aabd226da7 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -407,6 +407,8 @@ class InternalCallMapHandlerTest extends TestCase 'memcache_set_compress_threshold', 'memcache_set_failure_callback', 'memcache_set_server_params', + 'memcached::cas', // memcached 3.2.0 has incorrect reflection + 'memcached::casbykey', // memcached 3.2.0 has incorrect reflection 'memcachepool::add', 'memcachepool::addserver', 'memcachepool::append', From ee823619b8cfa871b817c27310b1d579dd5aaaf2 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 20:14:00 -0400 Subject: [PATCH 074/109] Flag direct constructor calls Fixes vimeo/psalm#2975 --- config.xsd | 1 + docs/running_psalm/error_levels.md | 1 + docs/running_psalm/issues.md | 1 + .../issues/DirectConstructorCall.md | 12 +++++++++++ .../Expression/Call/MethodCallAnalyzer.php | 13 ++++++++++++ src/Psalm/Issue/DirectConstructorCall.php | 9 ++++++++ tests/ClassTest.php | 21 +++++++++++++++++++ 7 files changed, 58 insertions(+) create mode 100644 docs/running_psalm/issues/DirectConstructorCall.md create mode 100644 src/Psalm/Issue/DirectConstructorCall.php diff --git a/config.xsd b/config.xsd index fd338ad9de6..263a066ede3 100644 --- a/config.xsd +++ b/config.xsd @@ -218,6 +218,7 @@ + diff --git a/docs/running_psalm/error_levels.md b/docs/running_psalm/error_levels.md index b4db5ddc026..c40319fdcb6 100644 --- a/docs/running_psalm/error_levels.md +++ b/docs/running_psalm/error_levels.md @@ -226,6 +226,7 @@ Level 5 and above allows a more non-verifiable code, and higher levels are even - [DeprecatedMethod](issues/DeprecatedMethod.md) - [DeprecatedProperty](issues/DeprecatedProperty.md) - [DeprecatedTrait](issues/DeprecatedTrait.md) +- [DirectConstructorCall](issues/DirectConstructorCall.md) - [DocblockTypeContradiction](issues/DocblockTypeContradiction.md) - [InvalidDocblockParamName](issues/InvalidDocblockParamName.md) - [InvalidFalsableReturnType](issues/InvalidFalsableReturnType.md) diff --git a/docs/running_psalm/issues.md b/docs/running_psalm/issues.md index 3da202b4598..918d1991b93 100644 --- a/docs/running_psalm/issues.md +++ b/docs/running_psalm/issues.md @@ -21,6 +21,7 @@ - [DeprecatedMethod](issues/DeprecatedMethod.md) - [DeprecatedProperty](issues/DeprecatedProperty.md) - [DeprecatedTrait](issues/DeprecatedTrait.md) + - [DirectConstructorCall](issues/DirectConstructorCall.md) - [DocblockTypeContradiction](issues/DocblockTypeContradiction.md) - [DuplicateArrayKey](issues/DuplicateArrayKey.md) - [DuplicateClass](issues/DuplicateClass.md) diff --git a/docs/running_psalm/issues/DirectConstructorCall.md b/docs/running_psalm/issues/DirectConstructorCall.md new file mode 100644 index 00000000000..75ca384dda6 --- /dev/null +++ b/docs/running_psalm/issues/DirectConstructorCall.md @@ -0,0 +1,12 @@ +# DirectConstructorCall + +Emitted when `__construct()` is called directly as a method. Constructors are supposed to be called implicitely, as a result of `new ClassName` statement. + +```php +__construct(); // wrong +``` diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php index f7dd973fde7..4773c21b650 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php @@ -13,6 +13,7 @@ use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer; use Psalm\Internal\Analyzer\StatementsAnalyzer; use Psalm\Internal\Type\TemplateResult; +use Psalm\Issue\DirectConstructorCall; use Psalm\Issue\InvalidMethodCall; use Psalm\Issue\InvalidScope; use Psalm\Issue\NullReference; @@ -90,6 +91,18 @@ public static function analyze( return false; } } + + if ($stmt->name instanceof PhpParser\Node\Identifier + && strtolower($stmt->name->name) === '__construct' + ) { + IssueBuffer::maybeAdd( + new DirectConstructorCall( + 'Constructors should not be called directly', + new CodeLocation($statements_analyzer->getSource(), $stmt), + ), + $statements_analyzer->getSuppressedIssues(), + ); + } } $lhs_var_id = ExpressionIdentifier::getExtendedVarId( diff --git a/src/Psalm/Issue/DirectConstructorCall.php b/src/Psalm/Issue/DirectConstructorCall.php new file mode 100644 index 00000000000..9fbf2ae81c7 --- /dev/null +++ b/src/Psalm/Issue/DirectConstructorCall.php @@ -0,0 +1,9 @@ + [], 'php_version' => '7.0', ], + 'directConstructorCall' => [ + 'code' => '__construct(); + ', + 'error_message' => 'DirectConstructorCall', + ], + 'directConstructorCallOnThis' => [ + 'code' => '__construct(); } + } + $a = new A; + $a->f(); + ', + 'error_message' => 'DirectConstructorCall', + ], ]; } } From 01911a06b7307942dddbe860e1aad31e2f43161b Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 21:29:20 -0400 Subject: [PATCH 075/109] Deprecate FunctionLikeStorage::$unused_docblock_params Refs vimeo/psalm#3166 --- src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php | 4 ++-- .../PhpVisitor/Reflector/FunctionLikeDocblockScanner.php | 4 ++++ src/Psalm/Storage/FunctionLikeStorage.php | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index fb9c7128cc0..1f8bd751c2f 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -361,8 +361,8 @@ public function analyze( $context->external_mutation_free = true; } - if ($storage->unused_docblock_params) { - foreach ($storage->unused_docblock_params as $param_name => $param_location) { + if ($storage->has_undertyped_native_parameters) { + foreach ($storage->unused_docblock_parameters as $param_name => $param_location) { IssueBuffer::maybeAdd( new InvalidDocblockParamName( 'Incorrect param name $' . $param_name . ' in docblock for ' . $cased_method_id, diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php index e69dbb8449d..c61377cddba 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php @@ -908,8 +908,12 @@ private static function improveParamsFromDocblock( ); if ($params_without_docblock_type) { + /** @psalm-suppress DeprecatedProperty remove in Psalm 6 */ $storage->unused_docblock_params = $unused_docblock_params; } + + $storage->has_undertyped_native_parameters = $params_without_docblock_type !== []; + $storage->unused_docblock_parameters = $unused_docblock_params; } /** diff --git a/src/Psalm/Storage/FunctionLikeStorage.php b/src/Psalm/Storage/FunctionLikeStorage.php index 8e029d7521e..e581e35e640 100644 --- a/src/Psalm/Storage/FunctionLikeStorage.php +++ b/src/Psalm/Storage/FunctionLikeStorage.php @@ -172,10 +172,19 @@ abstract class FunctionLikeStorage implements HasAttributesInterface public $return_type_description; /** + * @psalm-suppress PossiblyUnusedProperty * @var array|null + * @deprecated will be removed in Psalm 6. use {@see FunctionLikeStorage::$unused_docblock_parameters} instead */ public $unused_docblock_params; + /** + * @var array + */ + public array $unused_docblock_parameters = []; + + public bool $has_undertyped_native_parameters = false; + /** * @var bool */ From 0598402620292c8279796baa8e2cfcbd301bb1d6 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Wed, 15 Feb 2023 19:55:49 -0600 Subject: [PATCH 076/109] Skip verifying callmaps based on name pattern --- .../Codebase/InternalCallMapHandlerTest.php | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index ddce4bea24e..28c56c21953 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -47,6 +47,22 @@ /** @group callmap */ class InternalCallMapHandlerTest extends TestCase { + /** + * Regex patterns for callmap entries that should be skipped. + * + * These will not be checked against reflection. This prevents a + * large ignore list for extension functions have invalid reflection + * or are not maintained. + * + * @var list + */ + private static array $skippedPatterns = [ + '/\'\d$/', // skip alternate signatures + '/^redis/', // redis extension + '/^imagick/', // imagick extension + '/^uopz/', // uopz extension + ]; + /** * Specify a function name as value, or a function name as key and * an array containing the PHP versions in which to ignore this function as values. @@ -687,15 +703,6 @@ class InternalCallMapHandlerTest extends TestCase 'uconverter::fromucallback', 'uconverter::reasontext', 'uconverter::transcode', - 'uopz_allow_exit', - 'uopz_get_mock', - 'uopz_get_property', - 'uopz_get_return', - 'uopz_get_static', - 'uopz_set_mock', - 'uopz_set_property', - 'uopz_set_static', - 'uopz_unset_mock', 'xdiff_file_bdiff', 'xdiff_file_bdiff_size', 'xdiff_file_diff', @@ -918,6 +925,17 @@ public function callMapEntryProvider(): iterable ); $callMap = InternalCallMapHandler::getCallMap(); foreach ($callMap as $function => $entry) { + foreach (static::$skippedPatterns as $skipPattern) { + if (preg_match($skipPattern, $function)) { + continue 2; + } + } + + // Skip functions with alternate signatures + if (isset($callMap["$function'1"])) { + continue; + } + $classNameEnd = strpos($function, '::'); if ($classNameEnd !== false) { $className = substr($function, 0, $classNameEnd); @@ -928,11 +946,6 @@ public function callMapEntryProvider(): iterable continue; } - // Skip functions with alternate signatures - if (isset($callMap["$function'1"]) || preg_match("/\'\d$/", $function)) { - continue; - } - // if ($function != 'fprintf') continue; yield "$function: " . json_encode($entry) => [$function, $entry]; } } From e6aa63731dede5e416ff0a51c2858991eae15f0a Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 22:04:26 -0400 Subject: [PATCH 077/109] Flag docblock parameters that have no counterparts in function signature Fixes vimeo/psalm#3166 --- config.xsd | 1 + docs/running_psalm/error_levels.md | 1 + docs/running_psalm/issues.md | 1 + docs/running_psalm/issues/UnusedDocblockParam.md | 14 ++++++++++++++ .../Internal/Analyzer/FunctionLikeAnalyzer.php | 13 +++++++++++-- src/Psalm/Issue/UnusedDocblockParam.php | 9 +++++++++ tests/UnusedCodeTest.php | 12 +++++++++++- 7 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 docs/running_psalm/issues/UnusedDocblockParam.md create mode 100644 src/Psalm/Issue/UnusedDocblockParam.php diff --git a/config.xsd b/config.xsd index 263a066ede3..9d08a678a55 100644 --- a/config.xsd +++ b/config.xsd @@ -484,6 +484,7 @@ + diff --git a/docs/running_psalm/error_levels.md b/docs/running_psalm/error_levels.md index c40319fdcb6..7c7bfa2a5ba 100644 --- a/docs/running_psalm/error_levels.md +++ b/docs/running_psalm/error_levels.md @@ -302,6 +302,7 @@ Level 5 and above allows a more non-verifiable code, and higher levels are even - [UnusedClass](issues/UnusedClass.md) - [UnusedClosureParam](issues/UnusedClosureParam.md) - [UnusedConstructor](issues/UnusedConstructor.md) + - [UnusedDocblockParam](issues/UnusedDocblockParam.md) - [UnusedForeachValue](issues/UnusedForeachValue.md) - [UnusedMethod](issues/UnusedMethod.md) - [UnusedParam](issues/UnusedParam.md) diff --git a/docs/running_psalm/issues.md b/docs/running_psalm/issues.md index 918d1991b93..996db7fa081 100644 --- a/docs/running_psalm/issues.md +++ b/docs/running_psalm/issues.md @@ -288,6 +288,7 @@ - [UnusedClass](issues/UnusedClass.md) - [UnusedClosureParam](issues/UnusedClosureParam.md) - [UnusedConstructor](issues/UnusedConstructor.md) + - [UnusedDocblockParam](issues/UnusedDocblockParam.md) - [UnusedForeachValue](issues/UnusedForeachValue.md) - [UnusedFunctionCall](issues/UnusedFunctionCall.md) - [UnusedMethod](issues/UnusedMethod.md) diff --git a/docs/running_psalm/issues/UnusedDocblockParam.md b/docs/running_psalm/issues/UnusedDocblockParam.md new file mode 100644 index 00000000000..9dfec468538 --- /dev/null +++ b/docs/running_psalm/issues/UnusedDocblockParam.md @@ -0,0 +1,14 @@ +# UnusedDocblockParam + +Emitted when `--find-dead-code` is turned on and a parameter specified in docblock does not have a corresponding parameter in function / method signature. + +```php +external_mutation_free = true; } - if ($storage->has_undertyped_native_parameters) { - foreach ($storage->unused_docblock_parameters as $param_name => $param_location) { + foreach ($storage->unused_docblock_parameters as $param_name => $param_location) { + if ($storage->has_undertyped_native_parameters) { IssueBuffer::maybeAdd( new InvalidDocblockParamName( 'Incorrect param name $' . $param_name . ' in docblock for ' . $cased_method_id, $param_location, ), ); + } elseif ($codebase->find_unused_code) { + IssueBuffer::maybeAdd( + new UnusedDocblockParam( + 'Docblock parameter $' . $param_name . ' in docblock for ' . $cased_method_id + . ' does not have a counterpart in signature parameter list', + $param_location, + ), + ); } } diff --git a/src/Psalm/Issue/UnusedDocblockParam.php b/src/Psalm/Issue/UnusedDocblockParam.php new file mode 100644 index 00000000000..0b429fa0075 --- /dev/null +++ b/src/Psalm/Issue/UnusedDocblockParam.php @@ -0,0 +1,9 @@ + [ 'code' => 'foo + ?' . '>foo ', 'error_message' => 'UnevaluatedCode', ], @@ -1836,6 +1836,16 @@ public function b(int $c): void {} PHP, 'error_message' => 'PossiblyUnusedParam', ], + 'unused param tag' => [ + 'code' => <<<'PHP' + 'UnusedDocblockParam', + ], ]; } } From cd5b743d6b0b0eb34b7534a1388ea481b502f59f Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 22:18:30 -0400 Subject: [PATCH 078/109] Fix newly found issues --- src/Psalm/Internal/Type/TypeParser.php | 5 ++--- src/Psalm/Type.php | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Psalm/Internal/Type/TypeParser.php b/src/Psalm/Internal/Type/TypeParser.php index a5635899cf1..cf95fbecc4b 100644 --- a/src/Psalm/Internal/Type/TypeParser.php +++ b/src/Psalm/Internal/Type/TypeParser.php @@ -104,7 +104,6 @@ class TypeParser * Parses a string type representation * * @param list $type_tokens - * @param array{int,int}|null $php_version * @param array> $template_type_map * @param array $type_aliases */ @@ -716,7 +715,7 @@ private static function getTypeFromGenericTree( throw new TypeParseTreeException('Class string param should be a named object'); } - $types []= new TClassString($type->value, $type, false, false, false, $from_docblock); + $types[] = new TClassString($type->value, $type, false, false, false, $from_docblock); } return new Union($types); @@ -1452,7 +1451,7 @@ private static function getTypeFromKeyedArrayTree( || ($had_optional && !$property_maybe_undefined) || $type === 'array' || $type === 'callable-array' - || $previous_property_key != ($property_key-1) + || $previous_property_key != ($property_key - 1) ) ) { $is_list = false; diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index 2f12dd8bbd6..5ae85202cca 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -70,7 +70,6 @@ abstract class Type /** * Parses a string type representation * - * @param array{int,int}|null $php_version * @param array> $template_type_map */ public static function parseString( @@ -905,8 +904,8 @@ private static function intersectAtomicTypes( if ($intersection_atomic === null || $wider_type === null) { throw new LogicException( '$intersection_atomic and $wider_type should be both set or null.' - .' Check the preceding code for errors.' - .' Did you forget to assign one of the variables?', + . ' Check the preceding code for errors.' + . ' Did you forget to assign one of the variables?', ); } if (!self::mayHaveIntersection($intersection_atomic, $codebase) @@ -914,7 +913,7 @@ private static function intersectAtomicTypes( ) { throw new LogicException( '$intersection_atomic and $wider_type should be both support intersection.' - .' Check the preceding code for errors.', + . ' Check the preceding code for errors.', ); } From eb63eddce1786cae68dd9a0f7e3dfca570a70fa7 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 23:12:14 -0400 Subject: [PATCH 079/109] Added a page explaining how to add a new issue type --- docs/contributing/adding_issues.md | 62 ++++++++++++++++++++++++++++++ docs/contributing/index.md | 1 + 2 files changed, 63 insertions(+) create mode 100644 docs/contributing/adding_issues.md diff --git a/docs/contributing/adding_issues.md b/docs/contributing/adding_issues.md new file mode 100644 index 00000000000..b609d872837 --- /dev/null +++ b/docs/contributing/adding_issues.md @@ -0,0 +1,62 @@ +# Adding a new issue type + +To add a new issue type there are a number of required steps, listed below. + +## Generating a new shortcode + +Run `bin/max_used_shortcode.php` and note the value it printed (`$max_shortcode`) + +## Create issue class + +Create a class in `Psalm\Issue` namespace like this: + +```php + Date: Thu, 16 Feb 2023 01:28:47 -0400 Subject: [PATCH 080/109] Forbid non-null defaults for callable parameters Fixes vimeo/psalm#3284 --- .../Internal/Analyzer/FunctionLikeAnalyzer.php | 15 +++++++++++++++ tests/FunctionCallTest.php | 6 ++++++ tests/MethodCallTest.php | 8 ++++++++ 3 files changed, 29 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 357bf57326b..152565c2862 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -1256,6 +1256,21 @@ private function processParams( ), ); } + + if ($default_type + && !$default_type->isNull() + && $param_type->isSingleAndMaybeNullable() + && $param_type->getCallableTypes() + ) { + IssueBuffer::maybeAdd( + new InvalidParamDefault( + 'Default value type for ' . $param_type->getId() . ' argument ' . ($offset + 1) + . ' of method ' . $cased_method_id + . ' can only be null, ' . $default_type->getId() . ' specified', + $function_param->type_location, + ), + ); + } } if ($has_template_types) { diff --git a/tests/FunctionCallTest.php b/tests/FunctionCallTest.php index 6c0a4f8a643..751590c7b1c 100644 --- a/tests/FunctionCallTest.php +++ b/tests/FunctionCallTest.php @@ -2741,6 +2741,12 @@ function takesArrayShapeWithZeroOrPositiveInt(array $foo): void ', 'error_message' => 'RedundantFunctionCall', ], + 'incorrectCallableParamDefault' => [ + 'code' => ' 'InvalidParamDefault', + ], ]; } diff --git a/tests/MethodCallTest.php b/tests/MethodCallTest.php index e308dbd6f08..e2030863f24 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -1562,6 +1562,14 @@ public function foo(): string { }', 'error_message' => 'UndefinedMethod', ], + 'incorrectCallableParamDefault' => [ + 'code' => ' 'InvalidParamDefault', + ], ]; } } From 86fe34bb527e3258ecc9dc52f272ceb407dcc4cf Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Thu, 16 Feb 2023 10:45:42 +0100 Subject: [PATCH 081/109] Run assertions on CI --- .github/workflows/shepherd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/shepherd.yml b/.github/workflows/shepherd.yml index 5411bf7529f..67ae1e3ac45 100644 --- a/.github/workflows/shepherd.yml +++ b/.github/workflows/shepherd.yml @@ -14,6 +14,9 @@ jobs: - uses: shivammathur/setup-php@v2 with: php-version: '8.2' + ini-values: zend.assertions=1 + tools: composer:v2 + coverage: none - name: Install dependencies run: composer install --prefer-dist --no-progress --no-suggest From 3ddeecec1a3d9f13d4a13f68c6481ecde3e85359 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Thu, 16 Feb 2023 13:34:39 -0600 Subject: [PATCH 082/109] Fix strpos stub return type --- stubs/CoreGenericFunctions.phpstub | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/CoreGenericFunctions.phpstub b/stubs/CoreGenericFunctions.phpstub index 563be5068c2..f9640b06596 100644 --- a/stubs/CoreGenericFunctions.phpstub +++ b/stubs/CoreGenericFunctions.phpstub @@ -351,7 +351,7 @@ function array_merge_recursive(array ...$arrays) /** * @psalm-pure - * + * * @no-named-arguments * * @psalm-template TKey as array-key @@ -629,7 +629,7 @@ function substr_replace($string, $replace, $offset, $length = null) {} * * @psalm-return positive-int|0|false */ -function strpos($haystack, $needle, int $offset = 0) : int {} +function strpos($haystack, $needle, int $offset = 0) : int|false {} /** * @psalm-pure From e813a54d03343a88b92cb9a66d21ea2a3c198d33 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Fri, 17 Feb 2023 01:27:37 -0600 Subject: [PATCH 083/109] Skip verifying memcache extension callmap --- .../Codebase/InternalCallMapHandlerTest.php | 59 +------------------ 1 file changed, 3 insertions(+), 56 deletions(-) diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 257df94e617..c9130378962 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -61,6 +61,9 @@ class InternalCallMapHandlerTest extends TestCase '/^redis/', // redis extension '/^imagick/', // imagick extension '/^uopz/', // uopz extension + '/^memcache_/', // memcache extension + '/^memcache::/', // memcache extension + '/^memcachepool/', // memcache extension ]; /** @@ -385,64 +388,8 @@ class InternalCallMapHandlerTest extends TestCase 'mailparse_msg_get_structure', 'mailparse_msg_parse', 'mailparse_stream_encode', - 'memcache::add', - 'memcache::addserver', - 'memcache::append', - 'memcache::cas', - 'memcache::connect', - 'memcache::decrement', - 'memcache::delete', - 'memcache::findserver', - 'memcache::flush', - 'memcache::getserverstatus', - 'memcache::increment', - 'memcache::pconnect', - 'memcache::prepend', - 'memcache::replace', - 'memcache::set', - 'memcache::setfailurecallback', - 'memcache::setserverparams', - 'memcache_add', - 'memcache_add_server', - 'memcache_append', - 'memcache_cas', - 'memcache_close', - 'memcache_connect', - 'memcache_decrement', - 'memcache_delete', - 'memcache_flush', - 'memcache_get_extended_stats', - 'memcache_get_server_status', - 'memcache_get_stats', - 'memcache_get_version', - 'memcache_increment', - 'memcache_pconnect', - 'memcache_prepend', - 'memcache_replace', - 'memcache_set', - 'memcache_set_compress_threshold', - 'memcache_set_failure_callback', - 'memcache_set_server_params', 'memcached::cas', // memcached 3.2.0 has incorrect reflection 'memcached::casbykey', // memcached 3.2.0 has incorrect reflection - 'memcachepool::add', - 'memcachepool::addserver', - 'memcachepool::append', - 'memcachepool::cas', - 'memcachepool::connect', - 'memcachepool::decrement', - 'memcachepool::delete', - 'memcachepool::findserver', - 'memcachepool::flush', - 'memcachepool::get', - 'memcachepool::getserverstatus', - 'memcachepool::increment', - 'memcachepool::prepend', - 'memcachepool::replace', - 'memcachepool::set', - 'memcachepool::setcompressthreshold', - 'memcachepool::setfailurecallback', - 'memcachepool::setserverparams', 'messageformatter::format', 'messageformatter::formatmessage', 'messageformatter::parse', From 4d871fd2413f6eac3d576ccd4d998db626e460ba Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Fri, 17 Feb 2023 15:30:55 -0400 Subject: [PATCH 084/109] Disable JIT-incompatible extensions to prevent warnings This also enables JIT for `psalter` and syncs the list of disabled extensions between `psalm`, `psalter` and `psalm-language-server` --- src/Psalm/Internal/Cli/LanguageServer.php | 8 +++++++- src/Psalm/Internal/Cli/Psalm.php | 7 ++++++- src/Psalm/Internal/Cli/Psalter.php | 12 +++++++++--- src/Psalm/Internal/Fork/PsalmRestarter.php | 17 ++++++++++++----- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/Psalm/Internal/Cli/LanguageServer.php b/src/Psalm/Internal/Cli/LanguageServer.php index 1be270948ea..d9df6548301 100644 --- a/src/Psalm/Internal/Cli/LanguageServer.php +++ b/src/Psalm/Internal/Cli/LanguageServer.php @@ -237,7 +237,13 @@ static function (string $arg) use ($valid_long_options): void { $ini_handler = new PsalmRestarter('PSALM'); - $ini_handler->disableExtension('grpc'); + $ini_handler->disableExtensions([ + 'grpc', + 'uopz', + // extensions bellow are incompatible with JIT + 'pcov', + 'blackfire', + ]); // If Xdebug is enabled, restart without it $ini_handler->check(); diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index f3551ad419a..f7f60c78f2b 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -903,7 +903,12 @@ private static function restart(array $options, int $threads, Progress $progress $ini_handler->disableExtension('grpc'); } - $ini_handler->disableExtension('uopz'); + $ini_handler->disableExtensions([ + 'uopz', + // extesions that are incompatible with JIT (they are also usually make Psalm slow) + 'pcov', + 'blackfire', + ]); // If Xdebug is enabled, restart without it $ini_handler->check(); diff --git a/src/Psalm/Internal/Cli/Psalter.php b/src/Psalm/Internal/Cli/Psalter.php index d19ad988833..6d5dfa0cf50 100644 --- a/src/Psalm/Internal/Cli/Psalter.php +++ b/src/Psalm/Internal/Cli/Psalter.php @@ -3,13 +3,13 @@ namespace Psalm\Internal\Cli; use AssertionError; -use Composer\XdebugHandler\XdebugHandler; use Psalm\Config; use Psalm\Exception\UnsupportedIssueToFixException; use Psalm\Internal\Analyzer\ProjectAnalyzer; use Psalm\Internal\CliUtils; use Psalm\Internal\Composer; use Psalm\Internal\ErrorHandler; +use Psalm\Internal\Fork\PsalmRestarter; use Psalm\Internal\IncludeCollector; use Psalm\Internal\Provider\ClassLikeStorageCacheProvider; use Psalm\Internal\Provider\FileProvider; @@ -218,10 +218,16 @@ public static function run(array $argv): void static fn(): ?\Composer\Autoload\ClassLoader => CliUtils::requireAutoloaders($current_dir, isset($options['r']), $vendor_dir) ); - + $ini_handler = new PsalmRestarter('PSALTER'); + $ini_handler->disableExtensions([ + 'grpc', + 'uopz', + 'pcov', + 'blackfire', + ]); // If Xdebug is enabled, restart without it - (new XdebugHandler('PSALTER'))->check(); + $ini_handler->check(); $paths_to_check = CliUtils::getPathsToCheck($options['f'] ?? null); diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index 1be0dbc6ae9..f02a33614a7 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -5,6 +5,7 @@ use Composer\XdebugHandler\XdebugHandler; use function array_filter; +use function array_merge; use function array_splice; use function extension_loaded; use function file_get_contents; @@ -26,11 +27,17 @@ class PsalmRestarter extends XdebugHandler /** * @var string[] */ - private array $disabledExtensions = []; + private array $disabled_extensions = []; - public function disableExtension(string $disabledExtension): void + public function disableExtension(string $disabled_extension): void { - $this->disabledExtensions[] = $disabledExtension; + $this->disabled_extensions[] = $disabled_extension; + } + + /** @param list $disable_extensions */ + public function disableExtensions(array $disable_extensions): void + { + $this->disabled_extensions = array_merge($this->disabled_extensions, $disable_extensions); } /** @@ -42,7 +49,7 @@ public function disableExtension(string $disabledExtension): void protected function requiresRestart($default): bool { $this->required = (bool) array_filter( - $this->disabledExtensions, + $this->disabled_extensions, static fn(string $extension): bool => extension_loaded($extension) ); @@ -72,7 +79,7 @@ protected function requiresRestart($default): bool protected function restart(array $command): void { if ($this->required && $this->tmpIni) { - $regex = '/^\s*(extension\s*=.*(' . implode('|', $this->disabledExtensions) . ').*)$/mi'; + $regex = '/^\s*(extension\s*=.*(' . implode('|', $this->disabled_extensions) . ').*)$/mi'; $content = file_get_contents($this->tmpIni); $content = preg_replace($regex, ';$1', $content); From 4f22c2e7c6e96413d6f8e8c994cb9972c2fe5ba3 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Fri, 17 Feb 2023 23:52:12 -0400 Subject: [PATCH 085/109] Propagate phantom classes to closure context Fixes vimeo/psalm#9317 --- .../Internal/Analyzer/ClosureAnalyzer.php | 1 + tests/ClosureTest.php | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php b/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php index 47b1af3717c..c5daf4f5ea6 100644 --- a/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php @@ -203,6 +203,7 @@ public static function analyzeExpression( } $use_context->calling_method_id = $context->calling_method_id; + $use_context->phantom_classes = $context->phantom_classes; $closure_analyzer->analyze($use_context, $statements_analyzer->node_data, $context, false); diff --git a/tests/ClosureTest.php b/tests/ClosureTest.php index 34bac3dc52e..5a381eeb364 100644 --- a/tests/ClosureTest.php +++ b/tests/ClosureTest.php @@ -934,6 +934,29 @@ function test($var) : void echo $var; // $var should be string, instead it\'s considered to be Closure|string. }', ], + 'classExistsInOuterScopeOfArrowFunction' => [ + 'code' => <<<'PHP' + Foo::bar(23, []); + } + PHP, + 'assertions' => [], + 'ignored_issues' => [], + 'php_version' => '7.4', + ], + 'classExistsInOuterScopeOfAClosure' => [ + 'code' => <<<'PHP' + Date: Sat, 18 Feb 2023 12:44:16 +0100 Subject: [PATCH 086/109] Allow spatie/array-to-xml v3 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2ca4e0653a8..d62c80c27c1 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", "sebastian/diff": "^4.0 || ^5.0", - "spatie/array-to-xml": "^2.17.0", + "spatie/array-to-xml": "^2.17.0 || ^3.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0" }, From 80e781315aef38aada5a8d50243d873639812ac5 Mon Sep 17 00:00:00 2001 From: Gregor Harlan Date: Sat, 18 Feb 2023 12:58:40 +0100 Subject: [PATCH 087/109] RedundantCast --- src/Psalm/Report/XmlReport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Report/XmlReport.php b/src/Psalm/Report/XmlReport.php index 0e1622e5830..cabc7c9d046 100644 --- a/src/Psalm/Report/XmlReport.php +++ b/src/Psalm/Report/XmlReport.php @@ -14,7 +14,7 @@ final class XmlReport extends Report { public function create(): string { - $xml = (string) ArrayToXml::convert( + $xml = ArrayToXml::convert( [ 'item' => array_map( static function (IssueData $issue_data): array { From c8393bd50d267d7f0bfea88f784ad4f8d71de85e Mon Sep 17 00:00:00 2001 From: Evan Shaw Date: Sun, 19 Feb 2023 14:18:17 +1300 Subject: [PATCH 088/109] Fix language server first-class callable crashes --- .../Expression/Call/FunctionCallAnalyzer.php | 1 + .../ExistingAtomicMethodCallAnalyzer.php | 2 ++ .../StaticMethod/AtomicStaticCallAnalyzer.php | 1 + tests/ClosureTest.php | 31 +++++++++++++++++++ 4 files changed, 35 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php index 2ece1a32fcd..0ad6a6a812d 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php @@ -471,6 +471,7 @@ private static function handleNamedFunction( = $function_call_info->is_stubbed || $function_call_info->in_call_map || $namespaced_function_exists; if ($function_call_info->function_exists + && !$stmt->isFirstClassCallable() && $codebase->store_node_types && !$context->collect_initializations && !$context->collect_mutations diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php index 5d814f53e27..c3f4717e30e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php @@ -95,6 +95,7 @@ public static function analyze( } if ($codebase->store_node_types + && !$stmt->isFirstClassCallable() && !$context->collect_initializations && !$context->collect_mutations ) { @@ -226,6 +227,7 @@ public static function analyze( } if ($codebase->store_node_types + && !$stmt->isFirstClassCallable() && !$context->collect_initializations && !$context->collect_mutations ) { diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php index ac857f23be1..52a87e9abc9 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php @@ -322,6 +322,7 @@ private static function handleNamedCall( $cased_method_id = $fq_class_name . '::' . $stmt_name->name; if ($codebase->store_node_types + && !$stmt->isFirstClassCallable() && !$context->collect_initializations && !$context->collect_mutations ) { diff --git a/tests/ClosureTest.php b/tests/ClosureTest.php index 5a381eeb364..209458fb9c9 100644 --- a/tests/ClosureTest.php +++ b/tests/ClosureTest.php @@ -2,6 +2,7 @@ namespace Psalm\Tests; +use Psalm\Context; use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait; use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait; @@ -12,6 +13,36 @@ class ClosureTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; + public function testLanguageServerFirstClassCallable(): void + { + $code = 'publicMethod(...); + '; + + $context = new Context(); + + $this->project_analyzer->setPhpVersion('8.1.0', 'tests'); + + $codebase = $this->project_analyzer->getCodebase(); + $codebase->enterServerMode(); + $codebase->config->visitPreloadedStubFiles($codebase); + + $file_path = self::$src_dir_path . 'somefile.php'; + + $this->addFile($file_path, $code); + $this->analyzeFile($file_path, $context); + } + public function providerValidCodeParse(): iterable { return [ From d4a57c863c8511b7b43d62886dedb57b126e94f6 Mon Sep 17 00:00:00 2001 From: Evan Shaw Date: Sun, 19 Feb 2023 19:51:51 +1300 Subject: [PATCH 089/109] Enable store_node_types for all test cases --- tests/ClosureTest.php | 31 ------------------- tests/Traits/InvalidCodeAnalysisTestTrait.php | 1 + tests/Traits/ValidCodeAnalysisTestTrait.php | 1 + 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/tests/ClosureTest.php b/tests/ClosureTest.php index 209458fb9c9..5a381eeb364 100644 --- a/tests/ClosureTest.php +++ b/tests/ClosureTest.php @@ -2,7 +2,6 @@ namespace Psalm\Tests; -use Psalm\Context; use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait; use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait; @@ -13,36 +12,6 @@ class ClosureTest extends TestCase use InvalidCodeAnalysisTestTrait; use ValidCodeAnalysisTestTrait; - public function testLanguageServerFirstClassCallable(): void - { - $code = 'publicMethod(...); - '; - - $context = new Context(); - - $this->project_analyzer->setPhpVersion('8.1.0', 'tests'); - - $codebase = $this->project_analyzer->getCodebase(); - $codebase->enterServerMode(); - $codebase->config->visitPreloadedStubFiles($codebase); - - $file_path = self::$src_dir_path . 'somefile.php'; - - $this->addFile($file_path, $code); - $this->analyzeFile($file_path, $context); - } - public function providerValidCodeParse(): iterable { return [ diff --git a/tests/Traits/InvalidCodeAnalysisTestTrait.php b/tests/Traits/InvalidCodeAnalysisTestTrait.php index da3c731a5a8..f4b9b8357d0 100644 --- a/tests/Traits/InvalidCodeAnalysisTestTrait.php +++ b/tests/Traits/InvalidCodeAnalysisTestTrait.php @@ -73,6 +73,7 @@ public function testInvalidCode( $this->expectExceptionMessageMatches('/\b' . preg_quote($error_message, '/') . '\b/'); $codebase = $this->project_analyzer->getCodebase(); + $codebase->enterServerMode(); $codebase->config->visitPreloadedStubFiles($codebase); $this->addFile($file_path, $code); diff --git a/tests/Traits/ValidCodeAnalysisTestTrait.php b/tests/Traits/ValidCodeAnalysisTestTrait.php index c1340ed1fbc..de7b15d893a 100644 --- a/tests/Traits/ValidCodeAnalysisTestTrait.php +++ b/tests/Traits/ValidCodeAnalysisTestTrait.php @@ -68,6 +68,7 @@ public function testValidCode( $this->project_analyzer->setPhpVersion($php_version, 'tests'); $codebase = $this->project_analyzer->getCodebase(); + $codebase->enterServerMode(); $codebase->config->visitPreloadedStubFiles($codebase); $file_path = self::$src_dir_path . 'somefile.php'; From 236c1a8ae52e7a0d76c8dcb7d35aa78eff01e4dc Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sun, 19 Feb 2023 03:52:12 -0400 Subject: [PATCH 090/109] Added the test to validate test environment itself We should make sure that the environment the tests are run is as strict as possible. For example, zend.assertions should be enabled. --- tests/TestEnvironmentTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/TestEnvironmentTest.php diff --git a/tests/TestEnvironmentTest.php b/tests/TestEnvironmentTest.php new file mode 100644 index 00000000000..5a123791289 --- /dev/null +++ b/tests/TestEnvironmentTest.php @@ -0,0 +1,19 @@ +assertSame( + '1', + ini_get('zend.assertions'), + 'zend.assertions should be set to 1 to increase test strictness', + ); + } +} From 73bad8967d874a8a7f2175df303927dda8010e9b Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sun, 19 Feb 2023 04:18:32 -0400 Subject: [PATCH 091/109] Forbid first-class callables in `new` It's an invalid construct in PHP, not rejected by PHPParser for some reaason. Fixes vimeo/psalm#9335 --- .../Analyzer/Statements/Expression/Call/NewAnalyzer.php | 9 +++++++++ tests/ClosureTest.php | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php index c02cb9304a0..0087a5850c7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php @@ -29,6 +29,7 @@ use Psalm\Issue\InternalMethod; use Psalm\Issue\InvalidStringClass; use Psalm\Issue\MixedMethodCall; +use Psalm\Issue\ParseError; use Psalm\Issue\TooManyArguments; use Psalm\Issue\UndefinedClass; use Psalm\Issue\UnsafeGenericInstantiation; @@ -84,6 +85,14 @@ public static function analyze( $from_static = false; + if ($stmt->isFirstClassCallable()) { + IssueBuffer::maybeAdd(new ParseError( + 'First-class callables cannot be used in new', + new CodeLocation($statements_analyzer->getSource(), $stmt), + )); + return false; + } + if ($stmt->class instanceof PhpParser\Node\Name) { if (!in_array(strtolower($stmt->class->parts[0]), ['self', 'static', 'parent'], true)) { $aliases = $statements_analyzer->getAliases(); diff --git a/tests/ClosureTest.php b/tests/ClosureTest.php index 5a381eeb364..43d441944fa 100644 --- a/tests/ClosureTest.php +++ b/tests/ClosureTest.php @@ -1419,6 +1419,15 @@ public function f(): int { 'ignored_issues' => [], 'php_version' => '7.4', ], + 'FirstClassCallable:WithNew' => [ + 'code' => <<<'PHP' + 'ParseError', + 'ignored_issues' => [], + 'php_version' => '8.1', + ], ]; } } From a25fe3558488dd8ac4f21f943ae7cca5c59390a8 Mon Sep 17 00:00:00 2001 From: Evan Shaw Date: Sun, 19 Feb 2023 22:38:34 +1300 Subject: [PATCH 092/109] Negated is_numeric narrows scalar type --- .../Type/SimpleNegatedAssertionReconciler.php | 4 ++++ tests/TypeReconciliation/ConditionalTest.php | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php index ee0db415fdb..5f7d8e12de0 100644 --- a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php @@ -1292,6 +1292,10 @@ private static function reconcileNumeric( } elseif ($type instanceof TArrayKey) { $redundant = false; $non_numeric_types[] = new TString(); + } elseif ($type instanceof TScalar) { + $redundant = false; + $non_numeric_types[] = new TString(); + $non_numeric_types[] = new TBool(); } elseif (!$type->isNumericType()) { $non_numeric_types[] = $type; } else { diff --git a/tests/TypeReconciliation/ConditionalTest.php b/tests/TypeReconciliation/ConditionalTest.php index b060700df93..a51c73af5b9 100644 --- a/tests/TypeReconciliation/ConditionalTest.php +++ b/tests/TypeReconciliation/ConditionalTest.php @@ -197,6 +197,20 @@ function foo ($a) { '$a' => 'string', ], ], + 'typeRefinementonWithNegatedIsNumeric' => [ + 'code' => ' [ 'code' => ' 4 ? "hello" : true; From 38cc316ce9e6542c522378a7165695961c8ed3d4 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sun, 19 Feb 2023 06:02:12 -0400 Subject: [PATCH 093/109] Update tests/TypeReconciliation/ConditionalTest.php --- tests/TypeReconciliation/ConditionalTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TypeReconciliation/ConditionalTest.php b/tests/TypeReconciliation/ConditionalTest.php index a51c73af5b9..ff8fed4dc5b 100644 --- a/tests/TypeReconciliation/ConditionalTest.php +++ b/tests/TypeReconciliation/ConditionalTest.php @@ -203,7 +203,7 @@ function foo ($a) { * @param scalar $v * @return bool|string */ - function toString($) + function toString($v) { if (is_numeric($v)) { return false; From 5df21fe448589609b6c91ac77fe5d07b61cd1b61 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 19 Feb 2023 16:57:23 +0100 Subject: [PATCH 094/109] Always use 0x7FFEBFFF opcache optimization level (fixes #9340) --- src/Psalm/Internal/Fork/PsalmRestarter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index f02a33614a7..a784b7b7097 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -66,6 +66,10 @@ protected function requiresRestart($default): bool if (((int) ini_get('opcache.jit')) === 0) { return true; } + + if (ini_get('opcache.optimization_level') !== '0x7FFEBFFF') { + return true; + } } return $default || $this->required; @@ -98,6 +102,7 @@ protected function restart(array $command): void '-dopcache.enable_cli=true', '-dopcache.jit_buffer_size=512M', '-dopcache.jit=1205', + '-dopcache.optimization_level=0x7FFEBFFF', ]; } From 1b0f322bc7ba2110f137bf27c82ebf750dd4aa75 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Sun, 19 Feb 2023 20:31:55 -0400 Subject: [PATCH 095/109] Fix `PsalmRestarter::restart()` signature XdebugHandler v2 did not have the param type hint Fixes vimeo/psalm#9345 --- src/Psalm/Internal/Fork/PsalmRestarter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index a784b7b7097..36457a79629 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -79,8 +79,9 @@ protected function requiresRestart($default): bool * No type hint to allow xdebug-handler v1 and v2 usage * * @param string[] $command + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint */ - protected function restart(array $command): void + protected function restart($command): void { if ($this->required && $this->tmpIni) { $regex = '/^\s*(extension\s*=.*(' . implode('|', $this->disabled_extensions) . ').*)$/mi'; From bec8ddf525987c5ea0ae593fdea9348234e60ca9 Mon Sep 17 00:00:00 2001 From: Ismail Turan Date: Tue, 24 Jan 2023 11:32:09 +0100 Subject: [PATCH 096/109] fix (DateTime|DateTimeImmutable)::modify() return types vimeo#9042 caused issues to any called method on an instance of DateTime|DateTimeImmutable after calling the modify method. This fixes vimeo#9171 --- .../DateTimeModifyReturnTypeProvider.php | 7 +-- tests/DateTimeTest.php | 58 ++++++++++++++++++- tests/MethodCallTest.php | 2 +- 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php index 83d32a7ca01..b693d788ff1 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php @@ -8,7 +8,6 @@ use Psalm\Plugin\EventHandler\MethodReturnTypeProviderInterface; use Psalm\Type; use Psalm\Type\Atomic\TLiteralString; -use Psalm\Type\Atomic\TNamedObject; use Psalm\Type\Union; /** @@ -57,11 +56,7 @@ public static function getMethodReturnType(MethodReturnTypeProviderEvent $event) return Type::getFalse(); } if ($has_date_time && !$has_false) { - return Type::intersectUnionTypes( - Type::parseString($event->getCalledFqClasslikeName() ?? $event->getFqClasslikeName()), - new Union([new TNamedObject('static')]), - $statements_source->getCodebase(), - ); + return Type::parseString($event->getCalledFqClasslikeName() ?? $event->getFqClasslikeName()); } return null; diff --git a/tests/DateTimeTest.php b/tests/DateTimeTest.php index 3d640568487..afaede82ef3 100644 --- a/tests/DateTimeTest.php +++ b/tests/DateTimeTest.php @@ -44,8 +44,8 @@ function getString(): string $b = $dateTimeImmutable->modify(getString()); ', 'assertions' => [ - '$a' => 'DateTime&static', - '$b' => 'DateTimeImmutable&static', + '$a' => 'DateTime', + '$b' => 'DateTimeImmutable', ], ], 'modifyWithInvalidConstant' => [ @@ -88,6 +88,18 @@ function getString(): string '$b' => 'DateTimeImmutable|false', ], ], + 'otherMethodAfterModify' => [ + 'code' => 'modify("+1 day")->setTime(0, 0); + $b = $dateTimeImmutable->modify("+1 day")->setTime(0, 0); + ', + 'assertions' => [ + '$a' => 'DateTime|false', + '$b' => 'DateTimeImmutable', + ], + ], 'modifyStaticReturn' => [ 'code' => 'modify("+7 days"); ', 'assertions' => [ - '$mod' => 'Subclass&static', + '$mod' => 'Subclass', + ], + ], + 'otherMethodAfterModifyStaticReturn' => [ + 'code' => 'modify("+1 day")->setTime(0, 0); + ', + 'assertions' => [ + '$mod' => 'Subclass', + ], + ], + 'formatAfterModify' => [ + 'code' => 'modify("+1 day")->format("Y-m-d"); + $b = $dateTimeImmutable->modify("+1 day")->format("Y-m-d"); + ', + 'assertions' => [ + '$a' => 'false|string', + '$b' => 'string', + ], + ], + 'formatAfterModifyStaticReturn' => [ + 'code' => 'modify("+1 day")->format("Y-m-d"); + ', + 'assertions' => [ + '$format' => 'string', ], ], ]; diff --git a/tests/MethodCallTest.php b/tests/MethodCallTest.php index e2030863f24..c5dd9c76231 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -263,7 +263,7 @@ final class MyDate extends DateTimeImmutable {} $b = (new DateTimeImmutable())->modify("+3 hours");', 'assertions' => [ '$yesterday' => 'MyDate', - '$b' => 'DateTimeImmutable&static', + '$b' => 'DateTimeImmutable', ], ], 'magicCall' => [ From 88a3d288de021206f584d0be65be9a4593eb8392 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 20 Feb 2023 12:49:59 +0100 Subject: [PATCH 097/109] Workaround arm64 opcache bug (fixes #9350) --- .../Statements/Expression/BinaryOp/ConcatAnalyzer.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index 44dc2859b7d..61899ef83b7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -2,6 +2,7 @@ namespace Psalm\Internal\Analyzer\Statements\Expression\BinaryOp; +use AssertionError; use PhpParser; use Psalm\CodeLocation; use Psalm\Config; @@ -41,7 +42,6 @@ use Psalm\Type\Union; use UnexpectedValueException; -use function assert; use function count; use function reset; use function strlen; @@ -178,8 +178,12 @@ public static function analyze( } if ($literal_concat) { - assert(count($result_type_parts) === $combinations); - assert(count($result_type_parts) !== 0); // #8163 + if (count($result_type_parts) === 0) { + throw new AssertionError("The number of parts cannot be 0!"); + } + if (count($result_type_parts) !== $combinations) { + throw new AssertionError("The number of parts does not match!"); + } $result_type = new Union($result_type_parts); } } From a01c6348786d9b6a5a8697e8c8b4e901744fe280 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 20 Feb 2023 13:49:58 +0100 Subject: [PATCH 098/109] Run tests with opcache --- .github/workflows/ci.yml | 2 +- .github/workflows/windows-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ded89da5cd1..4fefbe3a081 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,7 @@ jobs: ini-values: zend.assertions=1, assert.exception=1 tools: composer:v2 coverage: none - extensions: none, curl, dom, filter, intl, json, libxml, mbstring, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter + extensions: none, curl, dom, filter, intl, json, libxml, mbstring, opcache, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter - uses: actions/checkout@v3 diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 8e202adf150..8bc4039113e 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -58,7 +58,7 @@ jobs: ini-values: zend.assertions=1, assert.exception=1 tools: composer:v2 coverage: none - extensions: none, curl, dom, filter, intl, json, libxml, mbstring, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter + extensions: none, curl, dom, filter, intl, json, libxml, mbstring, openssl, opcache, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter - uses: actions/checkout@v3 From 484043a5a1d4c992b9488461dd14dabcc877b6fe Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 20 Feb 2023 13:54:55 +0100 Subject: [PATCH 099/109] Enable JIT --- .github/workflows/ci.yml | 2 +- .github/workflows/windows-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fefbe3a081..552dc6b7363 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.1' - ini-values: zend.assertions=1, assert.exception=1 + ini-values: zend.assertions=1, assert.exception=1, opcache.enable_cli=1, opcache.jit=function, opcache.jit_buffer_size=512M tools: composer:v2 coverage: none extensions: none, curl, dom, filter, intl, json, libxml, mbstring, opcache, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 8bc4039113e..396b6fff8d8 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -55,7 +55,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.0' - ini-values: zend.assertions=1, assert.exception=1 + ini-values: zend.assertions=1, assert.exception=1, opcache.enable_cli=1, opcache.jit=function, opcache.jit_buffer_size=512M tools: composer:v2 coverage: none extensions: none, curl, dom, filter, intl, json, libxml, mbstring, openssl, opcache, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter From c23de496cfd671c63966af750f83131601bd19a6 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Mon, 20 Feb 2023 14:45:04 -0600 Subject: [PATCH 100/109] Replace use of DOMParentNode::append() with appendChild() --- src/Psalm/ErrorBaseline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/ErrorBaseline.php b/src/Psalm/ErrorBaseline.php index 227132769d2..9a22ec8295b 100644 --- a/src/Psalm/ErrorBaseline.php +++ b/src/Psalm/ErrorBaseline.php @@ -269,7 +269,7 @@ private static function writeToFile( $codeNode = $baselineDoc->createElement('code'); $textContent = trim($selection); if ($textContent !== htmlspecialchars($textContent)) { - $codeNode->append($baselineDoc->createCDATASection($textContent)); + $codeNode->appendChild($baselineDoc->createCDATASection($textContent)); } else { $codeNode->textContent = trim($textContent); } From a03299f3d0af75a39ff82e12ba5ca67dcaff4853 Mon Sep 17 00:00:00 2001 From: Evan Shaw Date: Tue, 21 Feb 2023 14:20:53 +1300 Subject: [PATCH 101/109] Include setrawcookie as an impure function --- src/Psalm/Internal/Codebase/Functions.php | 2 +- tests/UnusedCodeTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Codebase/Functions.php b/src/Psalm/Internal/Codebase/Functions.php index 7435756a93c..9ba277fecaf 100644 --- a/src/Psalm/Internal/Codebase/Functions.php +++ b/src/Psalm/Internal/Codebase/Functions.php @@ -425,7 +425,7 @@ public function isCallMapFunctionPure( 'call_user_func', 'call_user_func_array', 'define', 'create_function', // http - 'header', 'header_remove', 'http_response_code', 'setcookie', + 'header', 'header_remove', 'http_response_code', 'setcookie', 'setrawcookie', // output buffer 'ob_start', 'ob_end_clean', 'ob_get_clean', 'readfile', 'printf', 'var_dump', 'phpinfo', diff --git a/tests/UnusedCodeTest.php b/tests/UnusedCodeTest.php index c9ea004b77a..fdbced4a0bb 100644 --- a/tests/UnusedCodeTest.php +++ b/tests/UnusedCodeTest.php @@ -666,6 +666,13 @@ function makesACounter(int $i) : Counter { return $c; }', ], + 'setRawCookieImpure' => [ + 'code' => ' [ 'code' => ' Date: Mon, 20 Feb 2023 23:04:40 -0400 Subject: [PATCH 102/109] Revert "#7387 Add asserting non-empty-string by strlen" This reverts commit 0ef7ec100a365fc8855047ca5ced4a9bc554e059. --- .../Statements/Expression/AssertionFinder.php | 335 +----------------- tests/TypeReconciliation/EmptyTest.php | 32 +- 2 files changed, 31 insertions(+), 336 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php index 352382720b0..cd3d910a936 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php @@ -444,12 +444,8 @@ private static function scrapeEqualityAssertions( ); } - - $count = null; $count_equality_position = self::hasCountEqualityCheck($conditional, $count); - $strlen = null; - $strlen_equality_position = self::hasStrlenEqualityCheck($conditional, $strlen); if ($count_equality_position) { $if_types = []; @@ -500,58 +496,6 @@ private static function scrapeEqualityAssertions( return $if_types ? [$if_types] : []; } - if ($strlen_equality_position) { - $if_types = []; - - if ($strlen_equality_position === self::ASSIGNMENT_TO_RIGHT) { - $strlen_expr = $conditional->left; - } elseif ($strlen_equality_position === self::ASSIGNMENT_TO_LEFT) { - $strlen_expr = $conditional->right; - } else { - throw new UnexpectedValueException('$strlen_equality_position value'); - } - - /** @var PhpParser\Node\Expr\FuncCall $strlen_expr */ - if (!isset($strlen_expr->getArgs()[0])) { - return []; - } - $var_name = ExpressionIdentifier::getExtendedVarId( - $strlen_expr->getArgs()[0]->value, - $this_class_name, - $source, - ); - - if ($source instanceof StatementsAnalyzer) { - $var_type = $source->node_data->getType($conditional->left); - $other_type = $source->node_data->getType($conditional->right); - - if ($codebase - && $other_type - && $var_type - && $conditional instanceof PhpParser\Node\Expr\BinaryOp\Identical - ) { - self::handleParadoxicalAssertions( - $source, - $var_type, - $this_class_name, - $other_type, - $codebase, - $conditional, - ); - } - } - - if ($var_name) { - if ($strlen > 0) { - $if_types[$var_name] = [[new Assertion\NonEmpty()]]; - } else { - $if_types[$var_name] = [[new Empty_()]]; - } - } - - return $if_types ? [$if_types] : []; - } - if (!$source instanceof StatementsAnalyzer) { return []; } @@ -724,9 +668,6 @@ private static function scrapeInequalityAssertions( $count = null; $count_inequality_position = self::hasCountEqualityCheck($conditional, $count); - $strlen = null; - $strlen_inequality_position = self::hasStrlenEqualityCheck($conditional, $strlen); - if ($count_inequality_position) { $if_types = []; @@ -776,58 +717,6 @@ private static function scrapeInequalityAssertions( return $if_types ? [$if_types] : []; } - if ($strlen_inequality_position) { - $if_types = []; - - if ($strlen_inequality_position === self::ASSIGNMENT_TO_RIGHT) { - $strlen_expr = $conditional->left; - } elseif ($strlen_inequality_position === self::ASSIGNMENT_TO_LEFT) { - $strlen_expr = $conditional->right; - } else { - throw new UnexpectedValueException('$strlen_inequality_position value'); - } - - /** @var PhpParser\Node\Expr\FuncCall $strlen_expr */ - if (!isset($strlen_expr->getArgs()[0])) { - return []; - } - $var_name = ExpressionIdentifier::getExtendedVarId( - $strlen_expr->getArgs()[0]->value, - $this_class_name, - $source, - ); - - if ($source instanceof StatementsAnalyzer) { - $var_type = $source->node_data->getType($conditional->left); - $other_type = $source->node_data->getType($conditional->right); - - if ($codebase - && $other_type - && $var_type - && $conditional instanceof PhpParser\Node\Expr\BinaryOp\NotIdentical - ) { - self::handleParadoxicalAssertions( - $source, - $var_type, - $this_class_name, - $other_type, - $codebase, - $conditional, - ); - } - } - - if ($var_name) { - if ($strlen > 0) { - $if_types[$var_name] = [[new Assertion\Empty_()]]; - } else { - $if_types[$var_name] = [[new Assertion\NonEmpty()]]; - } - } - - return $if_types ? [$if_types] : []; - } - if (!$source instanceof StatementsAnalyzer) { return []; } @@ -1650,34 +1539,10 @@ protected static function hasGetClassCheck( protected static function hasNonEmptyCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, ?int &$min_count - ) { - return self::hasNonEmptyCountOrStrlenEqualityCheck($conditional, $min_count, ['count']); - } - - /** - * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional - * @return false|int - */ - protected static function hasNonEmptyStrlenEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$min_count - ) { - return self::hasNonEmptyCountOrStrlenEqualityCheck($conditional, $min_count, ['strlen', 'mb_strlen']); - } - - /** - * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional - * @param array $funcCallNames - * @return false|int - */ - protected static function hasNonEmptyCountOrStrlenEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$min_value, - array $funcCallNames ) { if ($conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name - && in_array(strtolower($conditional->left->name->parts[0]), $funcCallNames) + && strtolower($conditional->left->name->parts[0]) === 'count' && $conditional->left->getArgs() && ($conditional instanceof BinaryOp\Greater || $conditional instanceof BinaryOp\GreaterOrEqual) ) { @@ -1686,7 +1551,7 @@ protected static function hasNonEmptyCountOrStrlenEqualityCheck( $comparison_adjustment = $conditional instanceof BinaryOp\Greater ? 1 : 0; } elseif ($conditional->right instanceof PhpParser\Node\Expr\FuncCall && $conditional->right->name instanceof PhpParser\Node\Name - && in_array(strtolower($conditional->right->name->parts[0]), $funcCallNames) + && strtolower($conditional->right->name->parts[0]) === 'count' && $conditional->right->getArgs() && ($conditional instanceof BinaryOp\Smaller || $conditional instanceof BinaryOp\SmallerOrEqual) ) { @@ -1701,7 +1566,7 @@ protected static function hasNonEmptyCountOrStrlenEqualityCheck( if ($compare_to instanceof PhpParser\Node\Scalar\LNumber && $compare_to->value > (-1 * $comparison_adjustment) ) { - $min_value = $compare_to->value + $comparison_adjustment; + $min_count = $compare_to->value + $comparison_adjustment; return $assignment_to; } @@ -1716,34 +1581,10 @@ protected static function hasNonEmptyCountOrStrlenEqualityCheck( protected static function hasLessThanCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, ?int &$max_count - ) { - return self::hasLessThanCountOrStrlenEqualityCheck($conditional, $max_count, ['count']); - } - - /** - * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional - * @return false|int - */ - protected static function hasLessThanStrlenEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$max_strlen - ) { - return self::hasLessThanCountOrStrlenEqualityCheck($conditional, $max_strlen, ['strlen', 'mb_strlen']); - } - - /** - * @param Greater|GreaterOrEqual|Smaller|SmallerOrEqual $conditional - * @param array $funcCallNames - * @return false|int - */ - protected static function hasLessThanCountOrStrlenEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$max_value, - array $funcCallNames ) { $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name - && in_array(strtolower($conditional->left->name->parts[0]), $funcCallNames) + && strtolower($conditional->left->name->parts[0]) === 'count' && $conditional->left->getArgs(); $operator_less_than_or_equal = @@ -1754,7 +1595,7 @@ protected static function hasLessThanCountOrStrlenEqualityCheck( && $operator_less_than_or_equal && $conditional->right instanceof PhpParser\Node\Scalar\LNumber ) { - $max_value = $conditional->right->value - + $max_count = $conditional->right->value - ($conditional instanceof PhpParser\Node\Expr\BinaryOp\Smaller ? 1 : 0); return self::ASSIGNMENT_TO_RIGHT; @@ -1762,7 +1603,7 @@ protected static function hasLessThanCountOrStrlenEqualityCheck( $right_count = $conditional->right instanceof PhpParser\Node\Expr\FuncCall && $conditional->right->name instanceof PhpParser\Node\Name - && in_array(strtolower($conditional->right->name->parts[0]), $funcCallNames) + && strtolower($conditional->right->name->parts[0]) === 'count' && $conditional->right->getArgs(); $operator_greater_than_or_equal = @@ -1773,7 +1614,7 @@ protected static function hasLessThanCountOrStrlenEqualityCheck( && $operator_greater_than_or_equal && $conditional->left instanceof PhpParser\Node\Scalar\LNumber ) { - $max_value = $conditional->left->value - + $max_count = $conditional->left->value - ($conditional instanceof PhpParser\Node\Expr\BinaryOp\Greater ? 1 : 0); return self::ASSIGNMENT_TO_LEFT; @@ -1789,49 +1630,25 @@ protected static function hasLessThanCountOrStrlenEqualityCheck( protected static function hasCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional, ?int &$count - ) { - return self::hasCountOrStrlenEqualityCheck($conditional, $count, ['count']); - } - - /** - * @param Equal|Identical|NotEqual|NotIdentical $conditional - * @return false|int - */ - protected static function hasStrlenEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$count - ) { - return self::hasCountOrStrlenEqualityCheck($conditional, $count, ['strlen', 'mb_strlen']); - } - - /** - * @param Equal|Identical|NotEqual|NotIdentical $conditional - * @param array $funcCallNames - * @return false|int - */ - protected static function hasCountOrStrlenEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional, - ?int &$resultValue, - array $funcCallNames ) { $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name - && in_array(strtolower($conditional->left->name->parts[0]), $funcCallNames) + && strtolower($conditional->left->name->parts[0]) === 'count' && $conditional->left->getArgs(); if ($left_count && $conditional->right instanceof PhpParser\Node\Scalar\LNumber) { - $resultValue = $conditional->right->value; + $count = $conditional->right->value; return self::ASSIGNMENT_TO_RIGHT; } $right_count = $conditional->right instanceof PhpParser\Node\Expr\FuncCall && $conditional->right->name instanceof PhpParser\Node\Name - && in_array(strtolower($conditional->right->name->parts[0]), $funcCallNames) + && strtolower($conditional->right->name->parts[0]) === 'count' && $conditional->right->getArgs(); if ($right_count && $conditional->left instanceof PhpParser\Node\Scalar\LNumber) { - $resultValue = $conditional->left->value; + $count = $conditional->left->value; return self::ASSIGNMENT_TO_LEFT; } @@ -1966,37 +1783,15 @@ protected static function hasInferiorNumberCheck( protected static function hasReconcilableNonEmptyCountEqualityCheck( PhpParser\Node\Expr\BinaryOp $conditional ) { - return self::hasReconcilableNonEmptyCountOrStrlenEqualityCheck($conditional, ['count']); - } - - /** - * @param PhpParser\Node\Expr\BinaryOp\Greater|PhpParser\Node\Expr\BinaryOp\GreaterOrEqual $conditional - * @return false|int - */ - protected static function hasReconcilableNonEmptyStrlenEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional - ) { - return self::hasReconcilableNonEmptyCountOrStrlenEqualityCheck($conditional, ['strlen', 'mb_strlen']); - } - - /** - * @param PhpParser\Node\Expr\BinaryOp\Greater|PhpParser\Node\Expr\BinaryOp\GreaterOrEqual $conditional - * @param array $funcCallNames - * @return false|int - */ - protected static function hasReconcilableNonEmptyCountOrStrlenEqualityCheck( - PhpParser\Node\Expr\BinaryOp $conditional, - array $funcCallNames - ) { - $left_value = $conditional->left instanceof PhpParser\Node\Expr\FuncCall + $left_count = $conditional->left instanceof PhpParser\Node\Expr\FuncCall && $conditional->left->name instanceof PhpParser\Node\Name - && in_array(strtolower($conditional->left->name->parts[0]), $funcCallNames); + && strtolower($conditional->left->name->parts[0]) === 'count'; $right_number = $conditional->right instanceof PhpParser\Node\Scalar\LNumber && $conditional->right->value === ( - $conditional instanceof PhpParser\Node\Expr\BinaryOp\Greater ? 0 : 1); + $conditional instanceof PhpParser\Node\Expr\BinaryOp\Greater ? 0 : 1); - if ($left_value && $right_number) { + if ($left_count && $right_number) { return self::ASSIGNMENT_TO_RIGHT; } @@ -4002,8 +3797,6 @@ private static function getGreaterAssertions( $conditional, $superior_value_comparison, ); - $min_strlen = null; - $strlen_equality_position = self::hasNonEmptyStrlenEqualityCheck($conditional, $min_strlen); if ($count_equality_position) { if ($count_equality_position === self::ASSIGNMENT_TO_RIGHT) { @@ -4034,42 +3827,6 @@ private static function getGreaterAssertions( return $if_types ? [$if_types] : []; } - if ($strlen_equality_position) { - if ($strlen_equality_position === self::ASSIGNMENT_TO_RIGHT) { - $strlened_expr = $conditional->left; - } else { - throw new UnexpectedValueException('$strlen_equality_position value'); - } - - /** @var PhpParser\Node\Expr\FuncCall $strlened_expr */ - if (!isset($strlened_expr->getArgs()[0])) { - return []; - } - $var_name = ExpressionIdentifier::getExtendedVarId( - $strlened_expr->getArgs()[0]->value, - $this_class_name, - $source, - ); - - if ($var_name) { - if (self::hasReconcilableNonEmptyStrlenEqualityCheck($conditional)) { - $if_types[$var_name] = [[new Assertion\NonEmpty()]]; - } else { - if ($min_strlen > 0) { - $if_types[$var_name] = [[new Assertion\NonEmpty()]]; - } else { - $if_types[$var_name] = [[new Empty_()]]; - } - } - } - - if ($var_name) { - $if_types[$var_name] = [[new Assertion\NonEmpty()]]; - } - - return $if_types ? [$if_types] : []; - } - if ($count_inequality_position) { if ($count_inequality_position === self::ASSIGNMENT_TO_LEFT) { $count_expr = $conditional->right; @@ -4146,12 +3903,6 @@ private static function getSmallerAssertions( $count_equality_position = self::hasNonEmptyCountEqualityCheck($conditional, $min_count); $max_count = null; $count_inequality_position = self::hasLessThanCountEqualityCheck($conditional, $max_count); - - $min_strlen = null; - $strlen_equality_position = self::hasNonEmptyStrlenEqualityCheck($conditional, $min_strlen); - $max_strlen = null; - $strlen_inequality_position = self::hasLessThanStrlenEqualityCheck($conditional, $max_strlen); - $inferior_value_comparison = null; $inferior_value_position = self::hasInferiorNumberCheck( $source, @@ -4209,62 +3960,6 @@ private static function getSmallerAssertions( return $if_types ? [$if_types] : []; } - if ($strlen_equality_position) { - if ($strlen_equality_position === self::ASSIGNMENT_TO_LEFT) { - $strlen_expr = $conditional->right; - } else { - throw new UnexpectedValueException('$strlen_equality_position value'); - } - - /** @var PhpParser\Node\Expr\FuncCall $strlen_expr */ - if (!isset($strlen_expr->getArgs()[0])) { - return []; - } - $var_name = ExpressionIdentifier::getExtendedVarId( - $strlen_expr->getArgs()[0]->value, - $this_class_name, - $source, - ); - - if ($var_name) { - if ($min_strlen > 0) { - $if_types[$var_name] = [[new Assertion\NonEmpty()]]; - } else { - $if_types[$var_name] = [[new Empty_()]]; - } - } - - return $if_types ? [$if_types] : []; - } - - if ($strlen_inequality_position) { - if ($strlen_inequality_position === self::ASSIGNMENT_TO_RIGHT) { - $strlen_expr = $conditional->left; - } else { - throw new UnexpectedValueException('$strlen_inequality_position value'); - } - - /** @var PhpParser\Node\Expr\FuncCall $strlen_expr */ - if (!isset($strlen_expr->getArgs()[0])) { - return []; - } - $var_name = ExpressionIdentifier::getExtendedVarId( - $strlen_expr->getArgs()[0]->value, - $this_class_name, - $source, - ); - - if ($var_name) { - if ($max_strlen > 0) { - $if_types[$var_name] = [[new Assertion\NonEmpty()]]; - } else { - $if_types[$var_name] = [[new Empty_()]]; - } - } - - return $if_types ? [$if_types] : []; - } - if ($inferior_value_position) { if ($inferior_value_position === self::ASSIGNMENT_TO_RIGHT) { $var_name = ExpressionIdentifier::getExtendedVarId( diff --git a/tests/TypeReconciliation/EmptyTest.php b/tests/TypeReconciliation/EmptyTest.php index ac95e53a131..628d13b3652 100644 --- a/tests/TypeReconciliation/EmptyTest.php +++ b/tests/TypeReconciliation/EmptyTest.php @@ -414,63 +414,63 @@ function foo(array $arr): void { if (empty($arr["a"])) {} }', ], - 'strlenWithGreaterZero' => [ + 'SKIPPED-strlenWithGreaterZero' => [ 'code' => ' 0 ? $str : "string"; }', ], - 'strlenRighthandWithGreaterZero' => [ + 'SKIPPED-strlenRighthandWithGreaterZero' => [ 'code' => ' [ + 'SKIPPED-strlenWithGreaterEqualsOne' => [ 'code' => '= 1 ? $str : "string"; }', ], - 'strlenRighthandWithGreaterEqualsOne' => [ + 'SKIPPED-strlenRighthandWithGreaterEqualsOne' => [ 'code' => ' [ + 'SKIPPED-strlenWithInequalZero' => [ 'code' => ' [ + 'SKIPPED-strlenRighthandWithInequalZero' => [ 'code' => ' [ + 'SKIPPED-strlenWithEqualOne' => [ 'code' => ' [ + 'SKIPPED-strlenRighthandWithEqualOne' => [ 'code' => ' [ + 'SKIPPED-mb_strlen' => [ 'code' => ' 'MixedReturnTypeCoercion', ], - 'preventStrlenGreaterMinusOne' => [ + 'SKIPPED-preventStrlenGreaterMinusOne' => [ 'code' => ' 'LessSpecificReturnStatement', ], - 'preventRighthandStrlenGreaterMinusOne' => [ + 'SKIPPED-preventRighthandStrlenGreaterMinusOne' => [ 'code' => ' 'LessSpecificReturnStatement', ], - 'preventStrlenGreaterEqualsZero' => [ + 'SKIPPED-preventStrlenGreaterEqualsZero' => [ 'code' => ' 'LessSpecificReturnStatement', ], - 'preventStrlenEqualsZero' => [ + 'SKIPPED-preventStrlenEqualsZero' => [ 'code' => ' 'InvalidReturnStatement', ], - 'preventStrlenLessThanOne' => [ + 'SKIPPED-preventStrlenLessThanOne' => [ 'code' => ' 'InvalidReturnStatement', ], - 'preventStrlenLessEqualsZero' => [ + 'SKIPPED-preventStrlenLessEqualsZero' => [ 'code' => ' 'InvalidReturnStatement', ], - 'preventStrlenWithConcatenatedString' => [ + 'SKIPPED-preventStrlenWithConcatenatedString' => [ 'code' => ' Date: Mon, 20 Feb 2023 23:13:03 -0400 Subject: [PATCH 103/109] Update baseline --- psalm-baseline.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 66d23cbb8e1..c6faeb97b8d 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + tags['variablesfrom'][0]]]> @@ -238,12 +238,6 @@ $identifier_name - - - $input_path[2] - $input_path[2] - - $trait From 01c19d94ba09d6e06be5bb56638ab04f6c1c8787 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Mon, 20 Feb 2023 23:45:01 -0400 Subject: [PATCH 104/109] Added a bunch of tests from referenced issues --- tests/TypeReconciliation/EmptyTest.php | 106 +++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/tests/TypeReconciliation/EmptyTest.php b/tests/TypeReconciliation/EmptyTest.php index 628d13b3652..c7991804454 100644 --- a/tests/TypeReconciliation/EmptyTest.php +++ b/tests/TypeReconciliation/EmptyTest.php @@ -506,6 +506,112 @@ function nonEmptyString(string $str): string { ', 'assertions' => ['$arr===' => 'list'], ], + 'issue-9205-1' => [ + 'code' => <<<'PHP' + [ + '$lastLabel===' => 'string', + ], + ], + 'issue-9205-2' => [ + 'code' => <<<'PHP' + 0) { + exit; + } + PHP, + 'assertions' => [ + '$x===' => 'string', // perhaps this should be improved in future + ], + ], + 'issue-9205-3' => [ + 'code' => <<<'PHP' + [ + '$x===' => 'string', // can't be improved really + ], + ], + 'issue-9205-4' => [ + 'code' => <<<'PHP' + [ + '$x===' => 'string', // can be improved + ], + ], + 'issue-9349' => [ + 'code' => <<<'PHP' + [ + '$str===' => 'non-falsy-string', // can't be improved + ], + ], + 'issue-9349-2' => [ + 'code' => <<<'PHP' + [ + 'code' => <<<'PHP' + [ + '$a===' => 'string', // can't be improved + ], + ], + 'issue-9341-1' => [ + 'code' => <<<'PHP' + 2) + { + exit; + } + PHP, + 'assertions' => [ + '$GLOBALS[\'sql_query\']===' => 'string', + ], + ], ]; } From c62465ceef489119ab2aeca120d5c676f0c5fa58 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Mon, 20 Feb 2023 22:30:21 -0600 Subject: [PATCH 105/109] Fix several spl callmap methods --- dictionaries/CallMap.php | 146 +++++++++--------- dictionaries/CallMap_71_delta.php | 2 +- dictionaries/CallMap_73_delta.php | 2 + dictionaries/CallMap_74_delta.php | 16 +- dictionaries/CallMap_80_delta.php | 80 +++++++--- dictionaries/CallMap_81_delta.php | 8 + dictionaries/CallMap_historical.php | 144 +++++++++-------- .../Codebase/InternalCallMapHandlerTest.php | 62 -------- 8 files changed, 229 insertions(+), 231 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index 23a89269691..4cc19235b26 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -294,7 +294,7 @@ 'apcu_delete' => ['bool', 'key'=>'string|APCuIterator'], 'apcu_delete\'1' => ['list', 'key'=>'string[]'], 'apcu_enabled' => ['bool'], -'apcu_entry' => ['mixed', 'key'=>'string', 'generator'=>'callable', 'ttl='=>'int'], +'apcu_entry' => ['mixed', 'key'=>'string', 'generator'=>'callable(string):mixed', 'ttl='=>'int'], 'apcu_exists' => ['bool', 'keys'=>'string'], 'apcu_exists\'1' => ['array', 'keys'=>'string[]'], 'apcu_fetch' => ['mixed|false', 'key'=>'string', '&w_success='=>'bool'], @@ -675,10 +675,10 @@ 'closelog' => ['true'], 'Closure::__construct' => ['void'], 'Closure::__invoke' => ['', '...args='=>''], -'Closure::bind' => ['Closure|false', 'old'=>'Closure', 'to'=>'?object', 'scope='=>'object|string'], -'Closure::bindTo' => ['Closure|false', 'new'=>'?object', 'newscope='=>'object|string'], -'Closure::call' => ['', 'to'=>'object', '...parameters='=>''], -'Closure::fromCallable' => ['Closure', 'callable'=>'callable'], +'Closure::bind' => ['?Closure', 'closure'=>'Closure', 'newThis'=>'?object', 'newScope='=>'object|string|null'], +'Closure::bindTo' => ['?Closure', 'newThis'=>'?object', 'newScope='=>'object|string|null'], +'Closure::call' => ['mixed', 'newThis'=>'object', '...args='=>'mixed'], +'Closure::fromCallable' => ['Closure', 'callback'=>'callable'], 'clusterObj::convertToString' => ['string'], 'clusterObj::getFilterString' => ['string'], 'clusterObj::getGroupString' => ['string'], @@ -2871,10 +2871,10 @@ 'FilterIterator::next' => ['void'], 'FilterIterator::rewind' => ['void'], 'FilterIterator::valid' => ['bool'], -'finfo::__construct' => ['void', 'options='=>'int', 'magic_file='=>'string'], -'finfo::buffer' => ['string|false', 'string'=>'string', 'options='=>'int', 'context='=>'resource'], -'finfo::file' => ['string|false', 'file_name'=>'string', 'options='=>'int', 'context='=>'resource'], -'finfo::set_flags' => ['bool', 'options'=>'int'], +'finfo::__construct' => ['void', 'flags='=>'int', 'magic_database='=>'?string'], +'finfo::buffer' => ['string|false', 'string'=>'string', 'flags='=>'int', 'context='=>'?resource'], +'finfo::file' => ['string|false', 'filename'=>'string', 'flags='=>'int', 'context='=>'?resource'], +'finfo::set_flags' => ['bool', 'flags'=>'int'], 'finfo_buffer' => ['string|false', 'finfo'=>'finfo', 'string'=>'string', 'flags='=>'int', 'context='=>'resource'], 'finfo_close' => ['bool', 'finfo'=>'finfo'], 'finfo_file' => ['string|false', 'finfo'=>'finfo', 'filename'=>'string', 'flags='=>'int', 'context='=>'resource'], @@ -3166,7 +3166,7 @@ 'Generator::next' => ['void'], 'Generator::rewind' => ['void'], 'Generator::send' => ['mixed', 'value'=>'mixed'], -'Generator::throw' => ['mixed', 'exception'=>'Exception|Throwable'], +'Generator::throw' => ['mixed', 'exception'=>'Throwable'], 'Generator::valid' => ['bool'], 'geoip_asnum_by_name' => ['string|false', 'hostname'=>'string'], 'geoip_continent_code_by_name' => ['string|false', 'hostname'=>'string'], @@ -6464,14 +6464,14 @@ 'Locale::acceptFromHttp' => ['string|false', 'header'=>'string'], 'Locale::canonicalize' => ['string', 'locale'=>'string'], 'Locale::composeLocale' => ['string', 'subtags'=>'array'], -'Locale::filterMatches' => ['bool', 'langtag'=>'string', 'locale'=>'string', 'canonicalize='=>'bool'], +'Locale::filterMatches' => ['?bool', 'languageTag'=>'string', 'locale'=>'string', 'canonicalize='=>'bool'], 'Locale::getAllVariants' => ['array', 'locale'=>'string'], 'Locale::getDefault' => ['string'], -'Locale::getDisplayLanguage' => ['string', 'locale'=>'string', 'in_locale='=>'string'], -'Locale::getDisplayName' => ['string', 'locale'=>'string', 'in_locale='=>'string'], -'Locale::getDisplayRegion' => ['string', 'locale'=>'string', 'in_locale='=>'string'], -'Locale::getDisplayScript' => ['string', 'locale'=>'string', 'in_locale='=>'string'], -'Locale::getDisplayVariant' => ['string', 'locale'=>'string', 'in_locale='=>'string'], +'Locale::getDisplayLanguage' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], +'Locale::getDisplayName' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], +'Locale::getDisplayRegion' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], +'Locale::getDisplayScript' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], +'Locale::getDisplayVariant' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], 'Locale::getKeywords' => ['array|false', 'locale'=>'string'], 'Locale::getPrimaryLanguage' => ['string', 'locale'=>'string'], 'Locale::getRegion' => ['string', 'locale'=>'string'], @@ -8138,12 +8138,12 @@ 'NoRewindIterator::next' => ['void'], 'NoRewindIterator::rewind' => ['void'], 'NoRewindIterator::valid' => ['bool'], -'Normalizer::getRawDecomposition' => ['string|null', 'input'=>'string'], -'Normalizer::isNormalized' => ['bool', 'input'=>'string', 'form='=>'int'], -'Normalizer::normalize' => ['string', 'input'=>'string', 'form='=>'int'], -'normalizer_get_raw_decomposition' => ['string|null', 'string'=>'string'], +'Normalizer::getRawDecomposition' => ['?string', 'string'=>'string', 'form='=>'int'], +'Normalizer::isNormalized' => ['bool', 'string'=>'string', 'form='=>'int'], +'Normalizer::normalize' => ['string|false', 'string'=>'string', 'form='=>'int'], +'normalizer_get_raw_decomposition' => ['string|null', 'string'=>'string', 'form='=>'int'], 'normalizer_is_normalized' => ['bool', 'string'=>'string', 'form='=>'int'], -'normalizer_normalize' => ['string', 'string'=>'string', 'form='=>'int'], +'normalizer_normalize' => ['string|false', 'string'=>'string', 'form='=>'int'], 'notes_body' => ['array', 'server'=>'string', 'mailbox'=>'string', 'msg_number'=>'int'], 'notes_copy_db' => ['bool', 'from_database_name'=>'string', 'to_database_name'=>'string'], 'notes_create_db' => ['bool', 'database_name'=>'string'], @@ -8996,7 +8996,7 @@ 'PDFlib::utf16_to_utf8' => ['string', 'utf16string'=>'string'], 'PDFlib::utf32_to_utf16' => ['string', 'utf32string'=>'string', 'ordering'=>'string'], 'PDFlib::utf8_to_utf16' => ['string', 'utf8string'=>'string', 'ordering'=>'string'], -'PDO::__construct' => ['void', 'dsn'=>'string', 'username='=>'?string', 'passwd='=>'?string', 'options='=>'?array'], +'PDO::__construct' => ['void', 'dsn'=>'string', 'username='=>'?string', 'password='=>'?string', 'options='=>'?array'], 'PDO::__sleep' => ['list'], 'PDO::__wakeup' => ['void'], 'PDO::beginTransaction' => ['bool'], @@ -9004,7 +9004,7 @@ 'PDO::cubrid_schema' => ['array', 'schema_type'=>'int', 'table_name='=>'string', 'col_name='=>'string'], 'PDO::errorCode' => ['?string'], 'PDO::errorInfo' => ['array{0: ?string, 1: ?int, 2: ?string, 3?: mixed, 4?: mixed}'], -'PDO::exec' => ['int|false', 'query'=>'string'], +'PDO::exec' => ['int|false', 'statement'=>'string'], 'PDO::getAttribute' => ['mixed', 'attribute'=>'int'], 'PDO::getAvailableDrivers' => ['array'], 'PDO::inTransaction' => ['bool'], @@ -9018,12 +9018,12 @@ 'PDO::pgsqlLOBCreate' => ['string'], 'PDO::pgsqlLOBOpen' => ['resource', 'oid'=>'string', 'mode='=>'string'], 'PDO::pgsqlLOBUnlink' => ['bool', 'oid'=>'string'], -'PDO::prepare' => ['PDOStatement|false', 'statement'=>'string', 'options='=>'array'], -'PDO::query' => ['PDOStatement|false', 'sql'=>'string'], -'PDO::query\'1' => ['PDOStatement|false', 'sql'=>'string', 'fetch_column'=>'int', 'colno='=>'int'], -'PDO::query\'2' => ['PDOStatement|false', 'sql'=>'string', 'fetch_class'=>'int', 'classname'=>'string', 'ctorargs'=>'array'], -'PDO::query\'3' => ['PDOStatement|false', 'sql'=>'string', 'fetch_into'=>'int', 'object'=>'object'], -'PDO::quote' => ['string|false', 'string'=>'string', 'paramtype='=>'int'], +'PDO::prepare' => ['PDOStatement|false', 'query'=>'string', 'options='=>'array'], +'PDO::query' => ['PDOStatement|false', 'query'=>'string'], +'PDO::query\'1' => ['PDOStatement|false', 'query'=>'string', 'fetch_column'=>'int', 'colno='=>'int'], +'PDO::query\'2' => ['PDOStatement|false', 'query'=>'string', 'fetch_class'=>'int', 'classname'=>'string', 'constructorArgs'=>'array'], +'PDO::query\'3' => ['PDOStatement|false', 'query'=>'string', 'fetch_into'=>'int', 'object'=>'object'], +'PDO::quote' => ['string|false', 'string'=>'string', 'type='=>'int'], 'PDO::rollBack' => ['bool'], 'PDO::setAttribute' => ['bool', 'attribute'=>'int', 'value'=>''], 'PDO::sqliteCreateAggregate' => ['bool', 'function_name'=>'string', 'step_func'=>'callable', 'finalize_func'=>'callable', 'num_args='=>'int'], @@ -9039,8 +9039,8 @@ 'PDOException::getTraceAsString' => ['string'], 'PDOStatement::__sleep' => ['list'], 'PDOStatement::__wakeup' => ['void'], -'PDOStatement::bindColumn' => ['bool', 'column'=>'mixed', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], -'PDOStatement::bindParam' => ['bool', 'param,'=>'string|int', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], +'PDOStatement::bindColumn' => ['bool', 'column'=>'string|int', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], +'PDOStatement::bindParam' => ['bool', 'param'=>'string|int', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], 'PDOStatement::bindValue' => ['bool', 'param'=>'string|int', 'value'=>'mixed', 'type='=>'int'], 'PDOStatement::closeCursor' => ['bool'], 'PDOStatement::columnCount' => ['int'], @@ -9051,8 +9051,8 @@ 'PDOStatement::fetch' => ['mixed', 'mode='=>'int', 'cursorOrientation='=>'int', 'cursorOffset='=>'int'], 'PDOStatement::fetchAll' => ['array', 'mode='=>'int', '...args='=>'mixed'], 'PDOStatement::fetchColumn' => ['mixed', 'column='=>'int'], -'PDOStatement::fetchObject' => ['object|false', 'class='=>'?string', 'ctorArgs='=>'?array'], -'PDOStatement::getAttribute' => ['mixed', 'attribute'=>'int'], +'PDOStatement::fetchObject' => ['object|false', 'class='=>'?string', 'constructorArgs='=>'array'], +'PDOStatement::getAttribute' => ['mixed', 'name'=>'int'], 'PDOStatement::getColumnMeta' => ['array|false', 'column'=>'int'], 'PDOStatement::nextRowset' => ['bool'], 'PDOStatement::rowCount' => ['int'], @@ -12305,14 +12305,14 @@ 'SplDoublyLinkedList::valid' => ['bool'], 'SplEnum::__construct' => ['void', 'initial_value='=>'mixed', 'strict='=>'bool'], 'SplEnum::getConstList' => ['array', 'include_default='=>'bool'], -'SplFileInfo::__construct' => ['void', 'file_name'=>'string'], +'SplFileInfo::__construct' => ['void', 'filename'=>'string'], 'SplFileInfo::__toString' => ['string'], 'SplFileInfo::__wakeup' => ['void'], 'SplFileInfo::getATime' => ['int|false'], 'SplFileInfo::getBasename' => ['string', 'suffix='=>'string'], 'SplFileInfo::getCTime' => ['int|false'], 'SplFileInfo::getExtension' => ['string'], -'SplFileInfo::getFileInfo' => ['SplFileInfo', 'class_name='=>'string'], +'SplFileInfo::getFileInfo' => ['SplFileInfo', 'class='=>'?string'], 'SplFileInfo::getFilename' => ['string'], 'SplFileInfo::getGroup' => ['int|false'], 'SplFileInfo::getInode' => ['int|false'], @@ -12320,7 +12320,7 @@ 'SplFileInfo::getMTime' => ['int|false'], 'SplFileInfo::getOwner' => ['int|false'], 'SplFileInfo::getPath' => ['string'], -'SplFileInfo::getPathInfo' => ['SplFileInfo|null', 'class_name='=>'string'], +'SplFileInfo::getPathInfo' => ['SplFileInfo|null', 'class='=>'?string'], 'SplFileInfo::getPathname' => ['string'], 'SplFileInfo::getPerms' => ['int|false'], 'SplFileInfo::getRealPath' => ['string|false'], @@ -12332,27 +12332,27 @@ 'SplFileInfo::isLink' => ['bool'], 'SplFileInfo::isReadable' => ['bool'], 'SplFileInfo::isWritable' => ['bool'], -'SplFileInfo::openFile' => ['SplFileObject', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>'resource'], -'SplFileInfo::setFileClass' => ['void', 'class_name='=>'string'], -'SplFileInfo::setInfoClass' => ['void', 'class_name='=>'string'], -'SplFileObject::__construct' => ['void', 'filename'=>'string', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>''], +'SplFileInfo::openFile' => ['SplFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'?resource'], +'SplFileInfo::setFileClass' => ['void', 'class='=>'string'], +'SplFileInfo::setInfoClass' => ['void', 'class='=>'string'], +'SplFileObject::__construct' => ['void', 'filename'=>'string', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'?resource'], 'SplFileObject::__toString' => ['string'], 'SplFileObject::current' => ['string|array|false'], 'SplFileObject::eof' => ['bool'], 'SplFileObject::fflush' => ['bool'], 'SplFileObject::fgetc' => ['string|false'], -'SplFileObject::fgetcsv' => ['list|array{0: null}|false|null', 'seperator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], +'SplFileObject::fgetcsv' => ['list|array{0: null}|false', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], 'SplFileObject::fgets' => ['string'], -'SplFileObject::flock' => ['bool', 'operation'=>'int', '&w_wouldblock='=>'int'], +'SplFileObject::flock' => ['bool', 'operation'=>'int', '&w_wouldBlock='=>'int'], 'SplFileObject::fpassthru' => ['int'], -'SplFileObject::fputcsv' => ['int|false', 'fields'=>'array', 'seperator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], +'SplFileObject::fputcsv' => ['int|false', 'fields'=>'array', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string', 'eol='=>'string', 'eol='=>'string'], 'SplFileObject::fread' => ['string|false', 'length'=>'int'], 'SplFileObject::fscanf' => ['array|int', 'format'=>'string', '&...w_vars='=>'string|int|float'], -'SplFileObject::fseek' => ['int', 'pos'=>'int', 'whence='=>'int'], +'SplFileObject::fseek' => ['int', 'offset'=>'int', 'whence='=>'int'], 'SplFileObject::fstat' => ['array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int, 6: int, 7: int, 8: int, 9: int, 10: int, 11: int, 12: int, dev: int, ino: int, mode: int, nlink: int, uid: int, gid: int, rdev: int, size: int, atime: int, mtime: int, ctime: int, blksize: int, blocks: int}'], 'SplFileObject::ftell' => ['int|false'], 'SplFileObject::ftruncate' => ['bool', 'size'=>'int'], -'SplFileObject::fwrite' => ['int', 'string'=>'string', 'length='=>'int'], +'SplFileObject::fwrite' => ['int|false', 'data'=>'string', 'length='=>'int'], 'SplFileObject::getATime' => ['int|false'], 'SplFileObject::getBasename' => ['string', 'suffix='=>'string'], 'SplFileObject::getChildren' => ['null'], @@ -12360,7 +12360,7 @@ 'SplFileObject::getCTime' => ['int|false'], 'SplFileObject::getCurrentLine' => ['string'], 'SplFileObject::getExtension' => ['string'], -'SplFileObject::getFileInfo' => ['SplFileInfo', 'class_name='=>'string'], +'SplFileObject::getFileInfo' => ['SplFileInfo', 'class='=>'?string'], 'SplFileObject::getFilename' => ['string'], 'SplFileObject::getFlags' => ['int'], 'SplFileObject::getGroup' => ['int|false'], @@ -12370,7 +12370,7 @@ 'SplFileObject::getMTime' => ['int|false'], 'SplFileObject::getOwner' => ['int|false'], 'SplFileObject::getPath' => ['string'], -'SplFileObject::getPathInfo' => ['SplFileInfo|null', 'class_name='=>'string'], +'SplFileObject::getPathInfo' => ['SplFileInfo|null', 'class='=>'?string'], 'SplFileObject::getPathname' => ['string'], 'SplFileObject::getPerms' => ['int|false'], 'SplFileObject::getRealPath' => ['false|string'], @@ -12385,14 +12385,14 @@ 'SplFileObject::isWritable' => ['bool'], 'SplFileObject::key' => ['int'], 'SplFileObject::next' => ['void'], -'SplFileObject::openFile' => ['SplFileObject', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>'resource'], +'SplFileObject::openFile' => ['SplFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'?resource'], 'SplFileObject::rewind' => ['void'], -'SplFileObject::seek' => ['void', 'line_pos'=>'int'], -'SplFileObject::setCsvControl' => ['void', 'delimiter='=>'string', 'enclosure='=>'string', 'escape='=>'string'], -'SplFileObject::setFileClass' => ['void', 'class_name='=>'string'], +'SplFileObject::seek' => ['void', 'line'=>'int'], +'SplFileObject::setCsvControl' => ['void', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], +'SplFileObject::setFileClass' => ['void', 'class='=>'string'], 'SplFileObject::setFlags' => ['void', 'flags'=>'int'], -'SplFileObject::setInfoClass' => ['void', 'class_name='=>'string'], -'SplFileObject::setMaxLineLen' => ['void', 'max_len'=>'int'], +'SplFileObject::setInfoClass' => ['void', 'class='=>'string'], +'SplFileObject::setMaxLineLen' => ['void', 'maxLength'=>'int'], 'SplFileObject::valid' => ['bool'], 'SplFixedArray::__construct' => ['void', 'size='=>'int'], 'SplFixedArray::__wakeup' => ['void'], @@ -12526,24 +12526,24 @@ 'SplSubject::attach' => ['void', 'observer'=>'SplObserver'], 'SplSubject::detach' => ['void', 'observer'=>'SplObserver'], 'SplSubject::notify' => ['void'], -'SplTempFileObject::__construct' => ['void', 'max_memory='=>'int'], +'SplTempFileObject::__construct' => ['void', 'maxMemory='=>'int'], 'SplTempFileObject::__toString' => ['string'], -'SplTempFileObject::current' => ['array|false|string'], +'SplTempFileObject::current' => ['string|array|false'], 'SplTempFileObject::eof' => ['bool'], 'SplTempFileObject::fflush' => ['bool'], -'SplTempFileObject::fgetc' => ['false|string'], -'SplTempFileObject::fgetcsv' => ['list|array{0: null}|false|null', 'seperator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], +'SplTempFileObject::fgetc' => ['string|false'], +'SplTempFileObject::fgetcsv' => ['list|array{0: null}|false', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], 'SplTempFileObject::fgets' => ['string'], -'SplTempFileObject::flock' => ['bool', 'operation'=>'int', '&wouldblock='=>'int'], +'SplTempFileObject::flock' => ['bool', 'operation'=>'int', '&w_wouldBlock='=>'int'], 'SplTempFileObject::fpassthru' => ['int'], -'SplTempFileObject::fputcsv' => ['false|int', 'fields'=>'array', 'seperator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], -'SplTempFileObject::fread' => ['false|string', 'length'=>'int'], -'SplTempFileObject::fscanf' => ['bool', 'format'=>'string', '&...w_vars='=>'array|array|array'], -'SplTempFileObject::fseek' => ['int', 'pos'=>'int', 'whence='=>'int'], +'SplTempFileObject::fputcsv' => ['int|false', 'fields'=>'array', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string', 'eol='=>'string'], +'SplTempFileObject::fread' => ['string|false', 'length'=>'int'], +'SplTempFileObject::fscanf' => ['array|int', 'format'=>'string', '&...w_vars='=>'string|int|float'], +'SplTempFileObject::fseek' => ['int', 'offset'=>'int', 'whence='=>'int'], 'SplTempFileObject::fstat' => ['array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int, 6: int, 7: int, 8: int, 9: int, 10: int, 11: int, 12: int, dev: int, ino: int, mode: int, nlink: int, uid: int, gid: int, rdev: int, size: int, atime: int, mtime: int, ctime: int, blksize: int, blocks: int}'], -'SplTempFileObject::ftell' => ['int'], +'SplTempFileObject::ftell' => ['int|false'], 'SplTempFileObject::ftruncate' => ['bool', 'size'=>'int'], -'SplTempFileObject::fwrite' => ['int', 'string'=>'string', 'length='=>'int'], +'SplTempFileObject::fwrite' => ['int|false', 'data'=>'string', 'length='=>'int'], 'SplTempFileObject::getATime' => ['int|false'], 'SplTempFileObject::getBasename' => ['string', 'suffix='=>'string'], 'SplTempFileObject::getChildren' => ['null'], @@ -12551,7 +12551,7 @@ 'SplTempFileObject::getCTime' => ['int|false'], 'SplTempFileObject::getCurrentLine' => ['string'], 'SplTempFileObject::getExtension' => ['string'], -'SplTempFileObject::getFileInfo' => ['SplFileInfo', 'class_name='=>'string'], +'SplTempFileObject::getFileInfo' => ['SplFileInfo', 'class='=>'?string'], 'SplTempFileObject::getFilename' => ['string'], 'SplTempFileObject::getFlags' => ['int'], 'SplTempFileObject::getGroup' => ['int|false'], @@ -12561,10 +12561,10 @@ 'SplTempFileObject::getMTime' => ['int|false'], 'SplTempFileObject::getOwner' => ['int|false'], 'SplTempFileObject::getPath' => ['string'], -'SplTempFileObject::getPathInfo' => ['SplFileInfo', 'class_name='=>'string'], +'SplTempFileObject::getPathInfo' => ['SplFileInfo|null', 'class='=>'?string'], 'SplTempFileObject::getPathname' => ['string'], 'SplTempFileObject::getPerms' => ['int|false'], -'SplTempFileObject::getRealPath' => ['string|false'], +'SplTempFileObject::getRealPath' => ['false|string'], 'SplTempFileObject::getSize' => ['int|false'], 'SplTempFileObject::getType' => ['string|false'], 'SplTempFileObject::hasChildren' => ['false'], @@ -12576,14 +12576,14 @@ 'SplTempFileObject::isWritable' => ['bool'], 'SplTempFileObject::key' => ['int'], 'SplTempFileObject::next' => ['void'], -'SplTempFileObject::openFile' => ['SplFileObject', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>'resource'], +'SplTempFileObject::openFile' => ['SplTempFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'?resource'], 'SplTempFileObject::rewind' => ['void'], -'SplTempFileObject::seek' => ['void', 'line_pos'=>'int'], -'SplTempFileObject::setCsvControl' => ['void', 'delimiter='=>'string', 'enclosure='=>'string', 'escape='=>'string'], -'SplTempFileObject::setFileClass' => ['void', 'class_name='=>'string'], +'SplTempFileObject::seek' => ['void', 'line'=>'int'], +'SplTempFileObject::setCsvControl' => ['void', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], +'SplTempFileObject::setFileClass' => ['void', 'class='=>'string'], 'SplTempFileObject::setFlags' => ['void', 'flags'=>'int'], -'SplTempFileObject::setInfoClass' => ['void', 'class_name='=>'string'], -'SplTempFileObject::setMaxLineLen' => ['void', 'max_len'=>'int'], +'SplTempFileObject::setInfoClass' => ['void', 'class='=>'string'], +'SplTempFileObject::setMaxLineLen' => ['void', 'maxLength'=>'int'], 'SplTempFileObject::valid' => ['bool'], 'SplType::__construct' => ['void', 'initial_value='=>'mixed', 'strict='=>'bool'], 'Spoofchecker::__construct' => ['void'], diff --git a/dictionaries/CallMap_71_delta.php b/dictionaries/CallMap_71_delta.php index 163e60c74ec..93bb8cae3ce 100644 --- a/dictionaries/CallMap_71_delta.php +++ b/dictionaries/CallMap_71_delta.php @@ -16,7 +16,7 @@ */ return [ 'added' => [ - 'Closure::fromCallable' => ['Closure', 'callable'=>'callable'], + 'Closure::fromCallable' => ['Closure', 'callback'=>'callable'], 'curl_multi_errno' => ['int|false', 'mh'=>'resource'], 'curl_share_errno' => ['int|false', 'sh'=>'resource'], 'curl_share_strerror' => ['?string', 'error_code'=>'int'], diff --git a/dictionaries/CallMap_73_delta.php b/dictionaries/CallMap_73_delta.php index d33ad5c5fa5..568603b6bc8 100644 --- a/dictionaries/CallMap_73_delta.php +++ b/dictionaries/CallMap_73_delta.php @@ -28,6 +28,7 @@ 'JsonException::getPrevious' => ['?Throwable'], 'JsonException::getTrace' => ['list\',args?:array}>'], 'JsonException::getTraceAsString' => ['string'], + 'Normalizer::getRawDecomposition' => ['?string', 'string'=>'string', 'form='=>'int'], 'SplPriorityQueue::isCorrupted' => ['bool'], 'array_key_first' => ['int|string|null', 'array'=>'array'], 'array_key_last' => ['int|string|null', 'array'=>'array'], @@ -40,6 +41,7 @@ 'hrtime' => ['array{0:int,1:int}|false', 'as_number='=>'false'], 'hrtime\'1' => ['int|float|false', 'as_number='=>'true'], 'is_countable' => ['bool', 'value'=>'mixed'], + 'normalizer_get_raw_decomposition' => ['string|null', 'string'=>'string', 'form='=>'int'], 'net_get_interfaces' => ['array>|false'], 'openssl_pkey_derive' => ['string|false', 'public_key'=>'mixed', 'private_key'=>'mixed', 'key_length='=>'?int'], 'session_set_cookie_params\'1' => ['bool', 'options'=>'array{lifetime?:?int,path?:?string,domain?:?string,secure?:?bool,httponly?:?bool,samesite?:?string}'], diff --git a/dictionaries/CallMap_74_delta.php b/dictionaries/CallMap_74_delta.php index dbd4408f49d..87872004a22 100644 --- a/dictionaries/CallMap_74_delta.php +++ b/dictionaries/CallMap_74_delta.php @@ -25,13 +25,21 @@ 'old' => ['?string', 'languageTag'=>'array', 'locale'=>'string', 'canonicalize='=>'bool', 'defaultLocale='=>'string'], 'new' => ['?string', 'languageTag'=>'array', 'locale'=>'string', 'canonicalize='=>'bool', 'defaultLocale='=>'?string'], ], + 'SplFileObject::fwrite' => [ + 'old' => ['int', 'data'=>'string', 'length='=>'int'], + 'new' => ['int|false', 'data'=>'string', 'length='=>'int'], + ], + 'SplTempFileObject::fwrite' => [ + 'old' => ['int', 'data'=>'string', 'length='=>'int'], + 'new' => ['int|false', 'data'=>'string', 'length='=>'int'], + ], 'array_merge' => [ - 'old' => ['array', '...arrays'=>'array'], - 'new' => ['array', '...arrays='=>'array'], + 'old' => ['array', '...arrays'=>'array'], + 'new' => ['array', '...arrays='=>'array'], ], 'array_merge_recursive' => [ - 'old' => ['array', '...arrays'=>'array'], - 'new' => ['array', '...arrays='=>'array'], + 'old' => ['array', '...arrays'=>'array'], + 'new' => ['array', '...arrays='=>'array'], ], 'gzread' => [ 'old' => ['string|0', 'stream'=>'resource', 'length'=>'int'], diff --git a/dictionaries/CallMap_80_delta.php b/dictionaries/CallMap_80_delta.php index 2bebb5bac2e..b2cc5c427eb 100644 --- a/dictionaries/CallMap_80_delta.php +++ b/dictionaries/CallMap_80_delta.php @@ -85,6 +85,10 @@ 'old' => ['void', 'message='=>'string', 'code='=>'int', 'severity='=>'int', 'filename='=>'string', 'line='=>'int', 'previous='=>'?Throwable'], 'new' => ['void', 'message='=>'string', 'code='=>'int', 'severity='=>'int', 'filename='=>'?string', 'line='=>'?int', 'previous='=>'?Throwable'], ], + 'finfo::__construct' => [ + 'old' => ['void', 'flags='=>'int', 'magic_database='=>'string'], + 'new' => ['void', 'flags='=>'int', 'magic_database='=>'?string'], + ], 'IntlDateFormatter::__construct' => [ 'old' => ['void', 'locale'=>'?string', 'datetype'=>'null|int', 'timetype'=>'null|int', 'timezone='=>'IntlTimeZone|DateTimeZone|string|null', 'calendar='=>'IntlCalendar|int|null', 'pattern='=>'?string'], 'new' => ['void', 'locale'=>'?string', 'dateType'=>'int', 'timeType'=>'int', 'timezone='=>'IntlTimeZone|DateTimeZone|string|null', 'calendar='=>'IntlCalendar|int|null', 'pattern='=>'?string'], @@ -146,8 +150,28 @@ 'new' => ['void', 'lenient'=>'bool'], ], 'IntlDateFormatter::setTimeZone' => [ - 'old' => ['null|false', 'zone'=>'IntlTimeZone|DateTimeZone|string|null'], - 'new' => ['null|false', 'timezone'=>'IntlTimeZone|DateTimeZone|string|null'], + 'old' => ['null|false', 'zone'=>'IntlTimeZone|DateTimeZone|string|null'], + 'new' => ['null|false', 'timezone'=>'IntlTimeZone|DateTimeZone|string|null'], + ], + 'Locale::getDisplayLanguage' => [ + 'old' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'new' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], + ], + 'Locale::getDisplayName' => [ + 'old' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'new' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], + ], + 'Locale::getDisplayRegion' => [ + 'old' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'new' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], + ], + 'Locale::getDisplayScript' => [ + 'old' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'new' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], + ], + 'Locale::getDisplayVariant' => [ + 'old' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'new' => ['string', 'locale'=>'string', 'displayLocale='=>'?string'], ], 'NumberFormatter::__construct' => [ 'old' => ['void', 'locale'=>'string', 'style'=>'int', 'pattern='=>'string'], @@ -157,18 +181,6 @@ 'old' => ['NumberFormatter|null', 'locale'=>'string', 'style'=>'int', 'pattern='=>'string'], 'new' => ['NumberFormatter|null', 'locale'=>'string', 'style'=>'int', 'pattern='=>'?string'], ], - 'PDOStatement::bindColumn' => [ - 'old' => ['bool', 'column'=>'mixed', '&rw_param'=>'mixed', 'type='=>'int', 'maxlen='=>'int', 'driverdata='=>'mixed'], - 'new' => ['bool', 'column'=>'mixed', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], - ], - 'PDOStatement::bindParam' => [ - 'old' => ['bool', 'paramno'=>'mixed', '&rw_param'=>'mixed', 'type='=>'int', 'maxlen='=>'int', 'driverdata='=>'mixed'], - 'new' => ['bool', 'param,'=>'string|int', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], - ], - 'PDOStatement::bindValue' => [ - 'old' => ['bool', 'paramno'=>'mixed', 'param'=>'mixed', 'type='=>'int'], - 'new' => ['bool', 'param'=>'string|int', 'value'=>'mixed', 'type='=>'int'], - ], 'PDOStatement::debugDumpParams' => [ 'old' => ['void'], 'new' => ['bool|null'], @@ -193,10 +205,6 @@ 'old' => ['string|int|float|bool|null', 'column_number='=>'int'], 'new' => ['mixed', 'column='=>'int'], ], - 'PDOStatement::fetchObject' => [ - 'old' => ['object|false', 'class_name='=>'string', 'ctor_args='=>'array'], - 'new' => ['object|false', 'class='=>'?string', 'ctorArgs='=>'?array'], - ], 'PDOStatement::setFetchMode' => [ 'old' => ['bool', 'mode'=>'int'], 'new' => ['bool', 'mode'=>'int', '...args='=>'mixed'], @@ -273,6 +281,42 @@ 'old' => ['mixed', 'object='=>'object'], 'new' => ['mixed', 'object='=>'null|object'], ], + 'SplFileInfo::getFileInfo' => [ + 'old' => ['SplFileInfo', 'class='=>'string'], + 'new' => ['SplFileInfo', 'class='=>'?string'], + ], + 'SplFileInfo::getPathInfo' => [ + 'old' => ['SplFileInfo|null', 'class='=>'string'], + 'new' => ['SplFileInfo|null', 'class='=>'?string'], + ], + 'SplFileInfo::openFile' => [ + 'old' => ['SplFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'resource'], + 'new' => ['SplFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'?resource'], + ], + 'SplFileObject::getFileInfo' => [ + 'old' => ['SplFileInfo', 'class='=>'string'], + 'new' => ['SplFileInfo', 'class='=>'?string'], + ], + 'SplFileObject::getPathInfo' => [ + 'old' => ['SplFileInfo|null', 'class='=>'string'], + 'new' => ['SplFileInfo|null', 'class='=>'?string'], + ], + 'SplFileObject::openFile' => [ + 'old' => ['SplFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'resource'], + 'new' => ['SplFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'?resource'], + ], + 'SplTempFileObject::getFileInfo' => [ + 'old' => ['SplFileInfo', 'class='=>'string'], + 'new' => ['SplFileInfo', 'class='=>'?string'], + ], + 'SplTempFileObject::getPathInfo' => [ + 'old' => ['SplFileInfo|null', 'class='=>'string'], + 'new' => ['SplFileInfo|null', 'class='=>'?string'], + ], + 'SplTempFileObject::openFile' => [ + 'old' => ['SplTempFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'resource'], + 'new' => ['SplTempFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'?resource'], + ], 'tidy::__construct' => [ 'old' => ['void', 'filename='=>'string', 'config='=>'array|string', 'encoding='=>'string', 'useIncludePath='=>'bool'], 'new' => ['void', 'filename='=>'?string', 'config='=>'array|string|null', 'encoding='=>'?string', 'useIncludePath='=>'bool'], diff --git a/dictionaries/CallMap_81_delta.php b/dictionaries/CallMap_81_delta.php index 081e4adf25b..6d76650b638 100644 --- a/dictionaries/CallMap_81_delta.php +++ b/dictionaries/CallMap_81_delta.php @@ -66,6 +66,14 @@ 'old' => ['DOMDocumentFragment|false'], 'new' => ['DOMDocumentFragment'], ], + 'SplFileObject::fputcsv' => [ + 'old' => ['int|false', 'fields'=>'array', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], + 'new' => ['int|false', 'fields'=>'array', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string', 'eol='=>'string'], + ], + 'SplTempFileObject::fputcsv' => [ + 'old' => ['int|false', 'fields'=>'array', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], + 'new' => ['int|false', 'fields'=>'array', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string', 'eol='=>'string'], + ], 'finfo_buffer' => [ 'old' => ['string|false', 'finfo'=>'resource', 'string'=>'string', 'flags='=>'int', 'context='=>'resource'], 'new' => ['string|false', 'finfo'=>'finfo', 'string'=>'string', 'flags='=>'int', 'context='=>'resource'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index e4f52d08dff..b572739420a 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -335,9 +335,9 @@ 'ClosedGeneratorException::getTraceAsString' => ['string'], 'Closure::__construct' => ['void'], 'Closure::__invoke' => ['', '...args='=>''], - 'Closure::bind' => ['Closure|false', 'old'=>'Closure', 'to'=>'?object', 'scope='=>'object|string'], - 'Closure::bindTo' => ['Closure|false', 'new'=>'?object', 'newscope='=>'object|string'], - 'Closure::call' => ['', 'to'=>'object', '...parameters='=>''], + 'Closure::bind' => ['?Closure', 'closure'=>'Closure', 'newThis'=>'?object', 'newScope='=>'object|string|null'], + 'Closure::bindTo' => ['?Closure', 'newThis'=>'?object', 'newScope='=>'object|string|null'], + 'Closure::call' => ['mixed', 'newThis'=>'object', '...args='=>'mixed'], 'Collator::__construct' => ['void', 'locale'=>'string'], 'Collator::asort' => ['bool', '&rw_arr'=>'array', 'sort_flag='=>'int'], 'Collator::compare' => ['int|false', 'string1'=>'string', 'string2'=>'string'], @@ -1745,7 +1745,7 @@ 'Generator::next' => ['void'], 'Generator::rewind' => ['void'], 'Generator::send' => ['mixed', 'value'=>'mixed'], - 'Generator::throw' => ['mixed', 'exception'=>'Exception|Throwable'], + 'Generator::throw' => ['mixed', 'exception'=>'Throwable'], 'Generator::valid' => ['bool'], 'GlobIterator::__construct' => ['void', 'path'=>'string', 'flags='=>'int'], 'GlobIterator::count' => ['int'], @@ -3399,14 +3399,14 @@ 'Locale::acceptFromHttp' => ['string|false', 'header'=>'string'], 'Locale::canonicalize' => ['string', 'locale'=>'string'], 'Locale::composeLocale' => ['string', 'subtags'=>'array'], - 'Locale::filterMatches' => ['bool', 'langtag'=>'string', 'locale'=>'string', 'canonicalize='=>'bool'], + 'Locale::filterMatches' => ['?bool', 'languageTag'=>'string', 'locale'=>'string', 'canonicalize='=>'bool'], 'Locale::getAllVariants' => ['array', 'locale'=>'string'], 'Locale::getDefault' => ['string'], - 'Locale::getDisplayLanguage' => ['string', 'locale'=>'string', 'in_locale='=>'string'], - 'Locale::getDisplayName' => ['string', 'locale'=>'string', 'in_locale='=>'string'], - 'Locale::getDisplayRegion' => ['string', 'locale'=>'string', 'in_locale='=>'string'], - 'Locale::getDisplayScript' => ['string', 'locale'=>'string', 'in_locale='=>'string'], - 'Locale::getDisplayVariant' => ['string', 'locale'=>'string', 'in_locale='=>'string'], + 'Locale::getDisplayLanguage' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'Locale::getDisplayName' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'Locale::getDisplayRegion' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'Locale::getDisplayScript' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], + 'Locale::getDisplayVariant' => ['string', 'locale'=>'string', 'displayLocale='=>'string'], 'Locale::getKeywords' => ['array|false', 'locale'=>'string'], 'Locale::getPrimaryLanguage' => ['string', 'locale'=>'string'], 'Locale::getRegion' => ['string', 'locale'=>'string'], @@ -4268,9 +4268,8 @@ 'NoRewindIterator::next' => ['void'], 'NoRewindIterator::rewind' => ['void'], 'NoRewindIterator::valid' => ['bool'], - 'Normalizer::getRawDecomposition' => ['string|null', 'input'=>'string'], - 'Normalizer::isNormalized' => ['bool', 'input'=>'string', 'form='=>'int'], - 'Normalizer::normalize' => ['string', 'input'=>'string', 'form='=>'int'], + 'Normalizer::isNormalized' => ['bool', 'string'=>'string', 'form='=>'int'], + 'Normalizer::normalize' => ['string|false', 'string'=>'string', 'form='=>'int'], 'NumberFormatter::__construct' => ['void', 'locale'=>'string', 'style'=>'int', 'pattern='=>'string'], 'NumberFormatter::create' => ['NumberFormatter|null', 'locale'=>'string', 'style'=>'int', 'pattern='=>'string'], 'NumberFormatter::format' => ['string|false', 'num'=>'', 'type='=>'int'], @@ -4710,7 +4709,7 @@ 'PDFlib::utf16_to_utf8' => ['string', 'utf16string'=>'string'], 'PDFlib::utf32_to_utf16' => ['string', 'utf32string'=>'string', 'ordering'=>'string'], 'PDFlib::utf8_to_utf16' => ['string', 'utf8string'=>'string', 'ordering'=>'string'], - 'PDO::__construct' => ['void', 'dsn'=>'string', 'username='=>'?string', 'passwd='=>'?string', 'options='=>'?array'], + 'PDO::__construct' => ['void', 'dsn'=>'string', 'username='=>'?string', 'password='=>'?string', 'options='=>'?array'], 'PDO::__sleep' => ['list'], 'PDO::__wakeup' => ['void'], 'PDO::beginTransaction' => ['bool'], @@ -4718,7 +4717,7 @@ 'PDO::cubrid_schema' => ['array', 'schema_type'=>'int', 'table_name='=>'string', 'col_name='=>'string'], 'PDO::errorCode' => ['?string'], 'PDO::errorInfo' => ['array{0: ?string, 1: ?int, 2: ?string, 3?: mixed, 4?: mixed}'], - 'PDO::exec' => ['int|false', 'query'=>'string'], + 'PDO::exec' => ['int|false', 'statement'=>'string'], 'PDO::getAttribute' => ['mixed', 'attribute'=>'int'], 'PDO::getAvailableDrivers' => ['array'], 'PDO::inTransaction' => ['bool'], @@ -4732,12 +4731,12 @@ 'PDO::pgsqlLOBCreate' => ['string'], 'PDO::pgsqlLOBOpen' => ['resource', 'oid'=>'string', 'mode='=>'string'], 'PDO::pgsqlLOBUnlink' => ['bool', 'oid'=>'string'], - 'PDO::prepare' => ['PDOStatement|false', 'statement'=>'string', 'options='=>'array'], - 'PDO::query' => ['PDOStatement|false', 'sql'=>'string'], - 'PDO::query\'1' => ['PDOStatement|false', 'sql'=>'string', 'fetch_column'=>'int', 'colno='=>'int'], - 'PDO::query\'2' => ['PDOStatement|false', 'sql'=>'string', 'fetch_class'=>'int', 'classname'=>'string', 'ctorargs'=>'array'], - 'PDO::query\'3' => ['PDOStatement|false', 'sql'=>'string', 'fetch_into'=>'int', 'object'=>'object'], - 'PDO::quote' => ['string|false', 'string'=>'string', 'paramtype='=>'int'], + 'PDO::prepare' => ['PDOStatement|false', 'query'=>'string', 'options='=>'array'], + 'PDO::query' => ['PDOStatement|false', 'query'=>'string'], + 'PDO::query\'1' => ['PDOStatement|false', 'query'=>'string', 'fetch_column'=>'int', 'colno='=>'int'], + 'PDO::query\'2' => ['PDOStatement|false', 'query'=>'string', 'fetch_class'=>'int', 'classname'=>'string', 'constructorArgs'=>'array'], + 'PDO::query\'3' => ['PDOStatement|false', 'query'=>'string', 'fetch_into'=>'int', 'object'=>'object'], + 'PDO::quote' => ['string|false', 'string'=>'string', 'type='=>'int'], 'PDO::rollBack' => ['bool'], 'PDO::setAttribute' => ['bool', 'attribute'=>'int', 'value'=>''], 'PDO::sqliteCreateAggregate' => ['bool', 'function_name'=>'string', 'step_func'=>'callable', 'finalize_func'=>'callable', 'num_args='=>'int'], @@ -4752,9 +4751,9 @@ 'PDOException::getTraceAsString' => ['string'], 'PDOStatement::__sleep' => ['list'], 'PDOStatement::__wakeup' => ['void'], - 'PDOStatement::bindColumn' => ['bool', 'column'=>'mixed', '&rw_param'=>'mixed', 'type='=>'int', 'maxlen='=>'int', 'driverdata='=>'mixed'], - 'PDOStatement::bindParam' => ['bool', 'paramno'=>'mixed', '&rw_param'=>'mixed', 'type='=>'int', 'maxlen='=>'int', 'driverdata='=>'mixed'], - 'PDOStatement::bindValue' => ['bool', 'paramno'=>'mixed', 'param'=>'mixed', 'type='=>'int'], + 'PDOStatement::bindColumn' => ['bool', 'column'=>'string|int', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], + 'PDOStatement::bindParam' => ['bool', 'param'=>'string|int', '&rw_var'=>'mixed', 'type='=>'int', 'maxLength='=>'int', 'driverOptions='=>'mixed'], + 'PDOStatement::bindValue' => ['bool', 'param'=>'string|int', 'value'=>'mixed', 'type='=>'int'], 'PDOStatement::closeCursor' => ['bool'], 'PDOStatement::columnCount' => ['int'], 'PDOStatement::debugDumpParams' => ['void'], @@ -4764,8 +4763,8 @@ 'PDOStatement::fetch' => ['mixed', 'how='=>'int', 'orientation='=>'int', 'offset='=>'int'], 'PDOStatement::fetchAll' => ['array|false', 'how='=>'int', 'fetch_argument='=>'int|string|callable', 'ctor_args='=>'?array'], 'PDOStatement::fetchColumn' => ['string|int|float|bool|null', 'column_number='=>'int'], - 'PDOStatement::fetchObject' => ['object|false', 'class_name='=>'string', 'ctor_args='=>'array'], - 'PDOStatement::getAttribute' => ['mixed', 'attribute'=>'int'], + 'PDOStatement::fetchObject' => ['object|false', 'class='=>'?string', 'constructorArgs='=>'array'], + 'PDOStatement::getAttribute' => ['mixed', 'name'=>'int'], 'PDOStatement::getColumnMeta' => ['array|false', 'column'=>'int'], 'PDOStatement::nextRowset' => ['bool'], 'PDOStatement::rowCount' => ['int'], @@ -7520,14 +7519,14 @@ 'SplDoublyLinkedList::valid' => ['bool'], 'SplEnum::__construct' => ['void', 'initial_value='=>'mixed', 'strict='=>'bool'], 'SplEnum::getConstList' => ['array', 'include_default='=>'bool'], - 'SplFileInfo::__construct' => ['void', 'file_name'=>'string'], + 'SplFileInfo::__construct' => ['void', 'filename'=>'string'], 'SplFileInfo::__toString' => ['string'], 'SplFileInfo::__wakeup' => ['void'], 'SplFileInfo::getATime' => ['int|false'], 'SplFileInfo::getBasename' => ['string', 'suffix='=>'string'], 'SplFileInfo::getCTime' => ['int|false'], 'SplFileInfo::getExtension' => ['string'], - 'SplFileInfo::getFileInfo' => ['SplFileInfo', 'class_name='=>'string'], + 'SplFileInfo::getFileInfo' => ['SplFileInfo', 'class='=>'string'], 'SplFileInfo::getFilename' => ['string'], 'SplFileInfo::getGroup' => ['int|false'], 'SplFileInfo::getInode' => ['int|false'], @@ -7535,7 +7534,7 @@ 'SplFileInfo::getMTime' => ['int|false'], 'SplFileInfo::getOwner' => ['int|false'], 'SplFileInfo::getPath' => ['string'], - 'SplFileInfo::getPathInfo' => ['SplFileInfo|null', 'class_name='=>'string'], + 'SplFileInfo::getPathInfo' => ['SplFileInfo|null', 'class='=>'string'], 'SplFileInfo::getPathname' => ['string'], 'SplFileInfo::getPerms' => ['int|false'], 'SplFileInfo::getRealPath' => ['string|false'], @@ -7547,28 +7546,28 @@ 'SplFileInfo::isLink' => ['bool'], 'SplFileInfo::isReadable' => ['bool'], 'SplFileInfo::isWritable' => ['bool'], - 'SplFileInfo::openFile' => ['SplFileObject', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>'resource'], - 'SplFileInfo::setFileClass' => ['void', 'class_name='=>'string'], - 'SplFileInfo::setInfoClass' => ['void', 'class_name='=>'string'], - 'SplFileObject::__construct' => ['void', 'filename'=>'string', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>''], + 'SplFileInfo::openFile' => ['SplFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'resource'], + 'SplFileInfo::setFileClass' => ['void', 'class='=>'string'], + 'SplFileInfo::setInfoClass' => ['void', 'class='=>'string'], + 'SplFileObject::__construct' => ['void', 'filename'=>'string', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'?resource'], 'SplFileObject::__toString' => ['string'], 'SplFileObject::current' => ['string|array|false'], 'SplFileObject::eof' => ['bool'], 'SplFileObject::fflush' => ['bool'], 'SplFileObject::fgetc' => ['string|false'], - 'SplFileObject::fgetcsv' => ['list|array{0: null}|false|null', 'seperator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], + 'SplFileObject::fgetcsv' => ['list|array{0: null}|false', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], 'SplFileObject::fgets' => ['string|false'], 'SplFileObject::fgetss' => ['string|false', 'allowable_tags='=>'string'], - 'SplFileObject::flock' => ['bool', 'operation'=>'int', '&w_wouldblock='=>'int'], + 'SplFileObject::flock' => ['bool', 'operation'=>'int', '&w_wouldBlock='=>'int'], 'SplFileObject::fpassthru' => ['int'], - 'SplFileObject::fputcsv' => ['int|false', 'fields'=>'array', 'seperator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], + 'SplFileObject::fputcsv' => ['int|false', 'fields'=>'array', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], 'SplFileObject::fread' => ['string|false', 'length'=>'int'], 'SplFileObject::fscanf' => ['array|int', 'format'=>'string', '&...w_vars='=>'string|int|float'], - 'SplFileObject::fseek' => ['int', 'pos'=>'int', 'whence='=>'int'], + 'SplFileObject::fseek' => ['int', 'offset'=>'int', 'whence='=>'int'], 'SplFileObject::fstat' => ['array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int, 6: int, 7: int, 8: int, 9: int, 10: int, 11: int, 12: int, dev: int, ino: int, mode: int, nlink: int, uid: int, gid: int, rdev: int, size: int, atime: int, mtime: int, ctime: int, blksize: int, blocks: int}'], 'SplFileObject::ftell' => ['int|false'], 'SplFileObject::ftruncate' => ['bool', 'size'=>'int'], - 'SplFileObject::fwrite' => ['int', 'string'=>'string', 'length='=>'int'], + 'SplFileObject::fwrite' => ['int', 'data'=>'string', 'length='=>'int'], 'SplFileObject::getATime' => ['int|false'], 'SplFileObject::getBasename' => ['string', 'suffix='=>'string'], 'SplFileObject::getCTime' => ['int|false'], @@ -7576,7 +7575,7 @@ 'SplFileObject::getCsvControl' => ['array'], 'SplFileObject::getCurrentLine' => ['string|false'], 'SplFileObject::getExtension' => ['string'], - 'SplFileObject::getFileInfo' => ['SplFileInfo', 'class_name='=>'string'], + 'SplFileObject::getFileInfo' => ['SplFileInfo', 'class='=>'string'], 'SplFileObject::getFilename' => ['string'], 'SplFileObject::getFlags' => ['int'], 'SplFileObject::getGroup' => ['int|false'], @@ -7586,7 +7585,7 @@ 'SplFileObject::getMTime' => ['int|false'], 'SplFileObject::getOwner' => ['int|false'], 'SplFileObject::getPath' => ['string'], - 'SplFileObject::getPathInfo' => ['SplFileInfo|null', 'class_name='=>'string'], + 'SplFileObject::getPathInfo' => ['SplFileInfo|null', 'class='=>'string'], 'SplFileObject::getPathname' => ['string'], 'SplFileObject::getPerms' => ['int|false'], 'SplFileObject::getRealPath' => ['false|string'], @@ -7601,14 +7600,14 @@ 'SplFileObject::isWritable' => ['bool'], 'SplFileObject::key' => ['int'], 'SplFileObject::next' => ['void'], - 'SplFileObject::openFile' => ['SplFileObject', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>'resource'], + 'SplFileObject::openFile' => ['SplFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'resource'], 'SplFileObject::rewind' => ['void'], - 'SplFileObject::seek' => ['void', 'line_pos'=>'int'], - 'SplFileObject::setCsvControl' => ['void', 'delimiter='=>'string', 'enclosure='=>'string', 'escape='=>'string'], - 'SplFileObject::setFileClass' => ['void', 'class_name='=>'string'], + 'SplFileObject::seek' => ['void', 'line'=>'int'], + 'SplFileObject::setCsvControl' => ['void', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], + 'SplFileObject::setFileClass' => ['void', 'class='=>'string'], 'SplFileObject::setFlags' => ['void', 'flags'=>'int'], - 'SplFileObject::setInfoClass' => ['void', 'class_name='=>'string'], - 'SplFileObject::setMaxLineLen' => ['void', 'max_len'=>'int'], + 'SplFileObject::setInfoClass' => ['void', 'class='=>'string'], + 'SplFileObject::setMaxLineLen' => ['void', 'maxLength'=>'int'], 'SplFileObject::valid' => ['bool'], 'SplFixedArray::__construct' => ['void', 'size='=>'int'], 'SplFixedArray::__wakeup' => ['void'], @@ -7741,25 +7740,25 @@ 'SplSubject::attach' => ['void', 'observer'=>'SplObserver'], 'SplSubject::detach' => ['void', 'observer'=>'SplObserver'], 'SplSubject::notify' => ['void'], - 'SplTempFileObject::__construct' => ['void', 'max_memory='=>'int'], + 'SplTempFileObject::__construct' => ['void', 'maxMemory='=>'int'], 'SplTempFileObject::__toString' => ['string'], - 'SplTempFileObject::current' => ['array|false|string'], + 'SplTempFileObject::current' => ['string|array|false'], 'SplTempFileObject::eof' => ['bool'], 'SplTempFileObject::fflush' => ['bool'], - 'SplTempFileObject::fgetc' => ['false|string'], - 'SplTempFileObject::fgetcsv' => ['list|array{0: null}|false|null', 'seperator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], + 'SplTempFileObject::fgetc' => ['string|false'], + 'SplTempFileObject::fgetcsv' => ['list|array{0: null}|false', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], 'SplTempFileObject::fgets' => ['string'], 'SplTempFileObject::fgetss' => ['string', 'allowable_tags='=>'string'], - 'SplTempFileObject::flock' => ['bool', 'operation'=>'int', '&wouldblock='=>'int'], + 'SplTempFileObject::flock' => ['bool', 'operation'=>'int', '&w_wouldBlock='=>'int'], 'SplTempFileObject::fpassthru' => ['int'], - 'SplTempFileObject::fputcsv' => ['false|int', 'fields'=>'array', 'seperator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], - 'SplTempFileObject::fread' => ['false|string', 'length'=>'int'], - 'SplTempFileObject::fscanf' => ['bool', 'format'=>'string', '&...w_vars='=>'array|array|array'], - 'SplTempFileObject::fseek' => ['int', 'pos'=>'int', 'whence='=>'int'], + 'SplTempFileObject::fputcsv' => ['int|false', 'fields'=>'array', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], + 'SplTempFileObject::fread' => ['string|false', 'length'=>'int'], + 'SplTempFileObject::fscanf' => ['array|int', 'format'=>'string', '&...w_vars='=>'string|int|float'], + 'SplTempFileObject::fseek' => ['int', 'offset'=>'int', 'whence='=>'int'], 'SplTempFileObject::fstat' => ['array{0: int, 1: int, 2: int, 3: int, 4: int, 5: int, 6: int, 7: int, 8: int, 9: int, 10: int, 11: int, 12: int, dev: int, ino: int, mode: int, nlink: int, uid: int, gid: int, rdev: int, size: int, atime: int, mtime: int, ctime: int, blksize: int, blocks: int}'], - 'SplTempFileObject::ftell' => ['int'], + 'SplTempFileObject::ftell' => ['int|false'], 'SplTempFileObject::ftruncate' => ['bool', 'size'=>'int'], - 'SplTempFileObject::fwrite' => ['int', 'string'=>'string', 'length='=>'int'], + 'SplTempFileObject::fwrite' => ['int', 'data'=>'string', 'length='=>'int'], 'SplTempFileObject::getATime' => ['int|false'], 'SplTempFileObject::getBasename' => ['string', 'suffix='=>'string'], 'SplTempFileObject::getCTime' => ['int|false'], @@ -7767,7 +7766,7 @@ 'SplTempFileObject::getCsvControl' => ['array'], 'SplTempFileObject::getCurrentLine' => ['string'], 'SplTempFileObject::getExtension' => ['string'], - 'SplTempFileObject::getFileInfo' => ['SplFileInfo', 'class_name='=>'string'], + 'SplTempFileObject::getFileInfo' => ['SplFileInfo', 'class='=>'string'], 'SplTempFileObject::getFilename' => ['string'], 'SplTempFileObject::getFlags' => ['int'], 'SplTempFileObject::getGroup' => ['int|false'], @@ -7777,10 +7776,10 @@ 'SplTempFileObject::getMTime' => ['int|false'], 'SplTempFileObject::getOwner' => ['int|false'], 'SplTempFileObject::getPath' => ['string'], - 'SplTempFileObject::getPathInfo' => ['SplFileInfo', 'class_name='=>'string'], + 'SplTempFileObject::getPathInfo' => ['SplFileInfo|null', 'class='=>'string'], 'SplTempFileObject::getPathname' => ['string'], 'SplTempFileObject::getPerms' => ['int|false'], - 'SplTempFileObject::getRealPath' => ['string|false'], + 'SplTempFileObject::getRealPath' => ['false|string'], 'SplTempFileObject::getSize' => ['int|false'], 'SplTempFileObject::getType' => ['string|false'], 'SplTempFileObject::hasChildren' => ['false'], @@ -7792,14 +7791,14 @@ 'SplTempFileObject::isWritable' => ['bool'], 'SplTempFileObject::key' => ['int'], 'SplTempFileObject::next' => ['void'], - 'SplTempFileObject::openFile' => ['SplFileObject', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>'resource'], + 'SplTempFileObject::openFile' => ['SplTempFileObject', 'mode='=>'string', 'useIncludePath='=>'bool', 'context='=>'resource'], 'SplTempFileObject::rewind' => ['void'], - 'SplTempFileObject::seek' => ['void', 'line_pos'=>'int'], - 'SplTempFileObject::setCsvControl' => ['void', 'delimiter='=>'string', 'enclosure='=>'string', 'escape='=>'string'], - 'SplTempFileObject::setFileClass' => ['void', 'class_name='=>'string'], + 'SplTempFileObject::seek' => ['void', 'line'=>'int'], + 'SplTempFileObject::setCsvControl' => ['void', 'separator='=>'string', 'enclosure='=>'string', 'escape='=>'string'], + 'SplTempFileObject::setFileClass' => ['void', 'class='=>'string'], 'SplTempFileObject::setFlags' => ['void', 'flags'=>'int'], - 'SplTempFileObject::setInfoClass' => ['void', 'class_name='=>'string'], - 'SplTempFileObject::setMaxLineLen' => ['void', 'max_len'=>'int'], + 'SplTempFileObject::setInfoClass' => ['void', 'class='=>'string'], + 'SplTempFileObject::setMaxLineLen' => ['void', 'maxLength'=>'int'], 'SplTempFileObject::valid' => ['bool'], 'SplType::__construct' => ['void', 'initial_value='=>'mixed', 'strict='=>'bool'], 'Spoofchecker::__construct' => ['void'], @@ -9328,7 +9327,7 @@ 'apcu_delete' => ['bool', 'key'=>'string|APCuIterator'], 'apcu_delete\'1' => ['list', 'key'=>'string[]'], 'apcu_enabled' => ['bool'], - 'apcu_entry' => ['mixed', 'key'=>'string', 'generator'=>'callable', 'ttl='=>'int'], + 'apcu_entry' => ['mixed', 'key'=>'string', 'generator'=>'callable(string):mixed', 'ttl='=>'int'], 'apcu_exists' => ['bool', 'keys'=>'string'], 'apcu_exists\'1' => ['array', 'keys'=>'string[]'], 'apcu_fetch' => ['mixed|false', 'key'=>'string', '&w_success='=>'bool'], @@ -10510,10 +10509,10 @@ 'filter_list' => ['array'], 'filter_var' => ['mixed|false', 'value'=>'mixed', 'filter='=>'int', 'options='=>'array|int'], 'filter_var_array' => ['array|false|null', 'array'=>'array', 'options='=>'array|int', 'add_empty='=>'bool'], - 'finfo::__construct' => ['void', 'options='=>'int', 'magic_file='=>'string'], - 'finfo::buffer' => ['string|false', 'string'=>'string', 'options='=>'int', 'context='=>'resource'], - 'finfo::file' => ['string|false', 'file_name'=>'string', 'options='=>'int', 'context='=>'resource'], - 'finfo::set_flags' => ['bool', 'options'=>'int'], + 'finfo::__construct' => ['void', 'flags='=>'int', 'magic_database='=>'string'], + 'finfo::buffer' => ['string|false', 'string'=>'string', 'flags='=>'int', 'context='=>'?resource'], + 'finfo::file' => ['string|false', 'filename'=>'string', 'flags='=>'int', 'context='=>'?resource'], + 'finfo::set_flags' => ['bool', 'flags'=>'int'], 'finfo_buffer' => ['string|false', 'finfo'=>'resource', 'string'=>'string', 'flags='=>'int', 'context='=>'resource'], 'finfo_close' => ['bool', 'finfo'=>'resource'], 'finfo_file' => ['string|false', 'finfo'=>'resource', 'filename'=>'string', 'flags='=>'int', 'context='=>'resource'], @@ -12995,9 +12994,8 @@ 'ngettext' => ['string', 'singular'=>'string', 'plural'=>'string', 'count'=>'int'], 'nl2br' => ['string', 'string'=>'string', 'use_xhtml='=>'bool'], 'nl_langinfo' => ['string|false', 'item'=>'int'], - 'normalizer_get_raw_decomposition' => ['string|null', 'string'=>'string'], 'normalizer_is_normalized' => ['bool', 'string'=>'string', 'form='=>'int'], - 'normalizer_normalize' => ['string', 'string'=>'string', 'form='=>'int'], + 'normalizer_normalize' => ['string|false', 'string'=>'string', 'form='=>'int'], 'notes_body' => ['array', 'server'=>'string', 'mailbox'=>'string', 'msg_number'=>'int'], 'notes_copy_db' => ['bool', 'from_database_name'=>'string', 'to_database_name'=>'string'], 'notes_create_db' => ['bool', 'database_name'=>'string'], diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index c9130378962..8da1eb8997c 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -73,7 +73,6 @@ class InternalCallMapHandlerTest extends TestCase * @var array> */ private static array $ignoredFunctions = [ - 'apcu_entry', 'array_multisort', 'arrayiterator::asort', 'arrayiterator::ksort', @@ -103,10 +102,6 @@ class InternalCallMapHandlerTest extends TestCase 'cachingiterator::offsetset', 'cachingiterator::offsetunset', 'callbackfilteriterator::__construct', - 'closure::bind', - 'closure::bindto', - 'closure::call', - 'closure::fromcallable', 'collator::asort', 'collator::getattribute', 'collator::setattribute', @@ -198,11 +193,6 @@ class InternalCallMapHandlerTest extends TestCase 'filesystemiterator::setfileclass', 'filesystemiterator::setflags', 'filesystemiterator::setinfoclass', - 'finfo::__construct', - 'finfo::buffer', - 'finfo::file', - 'finfo::set_flags', - 'generator::throw', 'globiterator::__construct', 'globiterator::getfileinfo', 'globiterator::getpathinfo', @@ -371,12 +361,6 @@ class InternalCallMapHandlerTest extends TestCase 'jsonexception::__construct', 'limititerator::__construct', 'limititerator::seek', - 'locale::filtermatches', - 'locale::getdisplaylanguage', - 'locale::getdisplayname', - 'locale::getdisplayregion', - 'locale::getdisplayscript', - 'locale::getdisplayvariant', 'lzf_compress', 'lzf_decompress', 'mailparse_msg_extract_part', @@ -402,10 +386,6 @@ class InternalCallMapHandlerTest extends TestCase 'mysqli_stmt::__construct', 'mysqli_stmt::bind_param', 'mysqli_stmt_bind_param', - 'normalizer::getrawdecomposition', - 'normalizer::isnormalized', - 'normalizer::normalize', - 'normalizer_get_raw_decomposition', 'numberformatter::formatcurrency', 'numberformatter::getattribute', 'numberformatter::getsymbol', @@ -464,14 +444,6 @@ class InternalCallMapHandlerTest extends TestCase 'odbc_procedures', 'odbc_result', 'openssl_pkcs7_read', - 'pdo::__construct', - 'pdo::exec', - 'pdo::prepare', - 'pdo::quote', - 'pdostatement::bindcolumn', - 'pdostatement::bindparam', - 'pdostatement::fetchobject', - 'pdostatement::getattribute', 'phar::__construct', 'phar::addemptydir', 'phar::addfile', @@ -584,26 +556,6 @@ class InternalCallMapHandlerTest extends TestCase 'spldoublylinkedlist::offsetset', 'spldoublylinkedlist::setiteratormode', 'spldoublylinkedlist::unserialize', - 'splfileinfo::__construct', - 'splfileinfo::getfileinfo', - 'splfileinfo::getpathinfo', - 'splfileinfo::openfile', - 'splfileinfo::setfileclass', - 'splfileinfo::setinfoclass', - 'splfileobject::__construct', - 'splfileobject::fgetcsv', - 'splfileobject::flock', - 'splfileobject::fputcsv', - 'splfileobject::fseek', - 'splfileobject::fwrite', - 'splfileobject::getfileinfo', - 'splfileobject::getpathinfo', - 'splfileobject::openfile', - 'splfileobject::seek', - 'splfileobject::setcsvcontrol', - 'splfileobject::setfileclass', - 'splfileobject::setinfoclass', - 'splfileobject::setmaxlinelen', 'splfixedarray::fromarray', 'splfixedarray::offsetset', 'splmaxheap::compare', @@ -622,20 +574,6 @@ class InternalCallMapHandlerTest extends TestCase 'splstack::add', 'splstack::offsetset', 'splstack::unserialize', - 'spltempfileobject::__construct', - 'spltempfileobject::fgetcsv', - 'spltempfileobject::flock', - 'spltempfileobject::fputcsv', - 'spltempfileobject::fseek', - 'spltempfileobject::fwrite', - 'spltempfileobject::getfileinfo', - 'spltempfileobject::getpathinfo', - 'spltempfileobject::openfile', - 'spltempfileobject::seek', - 'spltempfileobject::setcsvcontrol', - 'spltempfileobject::setfileclass', - 'spltempfileobject::setinfoclass', - 'spltempfileobject::setmaxlinelen', 'sqlite3::__construct', 'sqlite3::open', 'sqlsrv_connect', From 575da79801f6068d24664e2a944e7874507bed6a Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 21 Feb 2023 10:09:58 +0100 Subject: [PATCH 106/109] Fix #9363 --- .../Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index 61899ef83b7..394f3bbdb05 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -178,6 +178,8 @@ public static function analyze( } if ($literal_concat) { + (function (int $_): void { + })($combinations); if (count($result_type_parts) === 0) { throw new AssertionError("The number of parts cannot be 0!"); } From f665e719fbcd7feb3e544bc2fcacf7dceba77548 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 21 Feb 2023 15:44:18 +0100 Subject: [PATCH 107/109] Describe changes --- .../Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index 394f3bbdb05..f4d356641de 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -178,6 +178,7 @@ public static function analyze( } if ($literal_concat) { + // Bypass opcache bug: https://github.com/php/php-src/issues/10635 (function (int $_): void { })($combinations); if (count($result_type_parts) === 0) { From ea32d203b659fa782d42e6711a07274be0c72393 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Thu, 23 Feb 2023 22:14:58 -0400 Subject: [PATCH 108/109] Disable `opcache.preload` if it's enabled Fixes vimeo/psalm#9382 Also reorganized the opcache settings check a bit and enforced `opcache.jit_buffer_size` --- src/Psalm/Internal/Fork/PsalmRestarter.php | 66 +++++++++++++++++----- 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index 36457a79629..589c354ca49 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -14,6 +14,8 @@ use function in_array; use function ini_get; use function preg_replace; +use function strlen; +use function strtolower; use const PHP_VERSION_ID; @@ -22,6 +24,14 @@ */ class PsalmRestarter extends XdebugHandler { + private const REQUIRED_OPCACHE_SETTINGS = [ + 'enable_cli' => true, + 'jit' => 1205, + 'jit_buffer_size' => 512 * 1024 * 1024, + 'optimization_level' => '0x7FFEBFFF', + 'preload' => '', + ]; + private bool $required = false; /** @@ -53,28 +63,54 @@ protected function requiresRestart($default): bool static fn(string $extension): bool => extension_loaded($extension) ); - if (PHP_VERSION_ID >= 8_00_00 && (extension_loaded('opcache') || extension_loaded('Zend OPcache'))) { + $opcache_loaded = extension_loaded('opcache') || extension_loaded('Zend OPcache'); + + if (PHP_VERSION_ID >= 8_00_00 && $opcache_loaded) { // restart to enable JIT if it's not configured in the optimal way - if (!in_array(ini_get('opcache.enable_cli'), ['1', 'true', true, 1])) { - return true; - } + $opcache_settings = [ + 'enable_cli' => in_array(ini_get('opcache.enable_cli'), ['1', 'true', true, 1]), + 'jit' => (int) ini_get('opcache.jit'), + 'optimization_level' => (string) ini_get('opcache.optimization_level'), + 'preload' => (string) ini_get('opcache.preload'), + 'jit_buffer_size' => self::toBytes(ini_get('opcache.jit_buffer_size')), + ]; - if (((int) ini_get('opcache.jit')) !== 1205) { - return true; + foreach (self::REQUIRED_OPCACHE_SETTINGS as $ini_name => $required_value) { + if ($opcache_settings[$ini_name] !== $required_value) { + return true; + } } + } - if (((int) ini_get('opcache.jit')) === 0) { - return true; - } + return $default || $this->required; + } - if (ini_get('opcache.optimization_level') !== '0x7FFEBFFF') { - return true; - } + private static function toBytes(string $value): int + { + $unit = strtolower($value[strlen($value) - 1]); + + if (in_array($unit, ['g', 'm', 'k'], true)) { + $value = (int) $value; + } else { + $unit = ''; + $value = (int) $value; } - return $default || $this->required; + switch ($unit) { + case 'g': + $value *= 1024; + // no break + case 'm': + $value *= 1024; + // no break + case 'k': + $value *= 1024; + } + + return $value; } + /** * No type hint to allow xdebug-handler v1 and v2 usage * @@ -93,17 +129,19 @@ protected function restart($command): void } $additional_options = []; + $opcache_loaded = extension_loaded('opcache') || extension_loaded('Zend OPcache'); // executed in the parent process (before restart) // if it wasn't loaded then we apparently don't have opcache installed and there's no point trying // to tweak it // If we're running on 7.4 there's no JIT available - if (PHP_VERSION_ID >= 8_00_00 && (extension_loaded('opcache') || extension_loaded('Zend OPcache'))) { + if (PHP_VERSION_ID >= 8_00_00 && $opcache_loaded) { $additional_options = [ '-dopcache.enable_cli=true', '-dopcache.jit_buffer_size=512M', '-dopcache.jit=1205', '-dopcache.optimization_level=0x7FFEBFFF', + '-dopcache.preload=', ]; } From 38d1abc13a470fbadc765b88155d86ac05e1a53f Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Fri, 24 Feb 2023 20:38:15 -0400 Subject: [PATCH 109/109] Don't crash on empty `jit_buffer_size` Fixes vimeo/psalm#9396 --- src/Psalm/Internal/Fork/PsalmRestarter.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Psalm/Internal/Fork/PsalmRestarter.php b/src/Psalm/Internal/Fork/PsalmRestarter.php index 589c354ca49..32c255ca227 100644 --- a/src/Psalm/Internal/Fork/PsalmRestarter.php +++ b/src/Psalm/Internal/Fork/PsalmRestarter.php @@ -87,6 +87,10 @@ protected function requiresRestart($default): bool private static function toBytes(string $value): int { + if (strlen($value) === 0) { + return 0; + } + $unit = strtolower($value[strlen($value) - 1]); if (in_array($unit, ['g', 'm', 'k'], true)) {