diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index 9d8d09fac61..7e13e4f1727 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -2055,7 +2055,7 @@ public function isTypeContainedByType( bool $ignore_null = false, bool $ignore_false = false, bool $allow_interface_equality = false, - bool $allow_float_int_equality = true + bool $allow_float_int_equality = true, ): bool { return UnionTypeComparator::isContainedBy( $this, diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 7d505710328..502b9504ec7 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -1593,7 +1593,7 @@ public function examineParamTypes( StatementsAnalyzer $statements_analyzer, Context $context, Codebase $codebase, - ?PhpParser\Node $stmt = null + ?PhpParser\Node $stmt = null, ): void { $storage = $this->getFunctionLikeStorage($statements_analyzer); diff --git a/src/Psalm/Internal/Analyzer/IssueData.php b/src/Psalm/Internal/Analyzer/IssueData.php index 5d3df583db3..e948337ce45 100644 --- a/src/Psalm/Internal/Analyzer/IssueData.php +++ b/src/Psalm/Internal/Analyzer/IssueData.php @@ -43,7 +43,7 @@ public function __construct( public int $error_level = -1, public ?array $taint_trace = null, public ?array $other_references = null, - public readonly ?string $dupe_key = null + public readonly ?string $dupe_key = null, ) { $this->link = $shortcode ? 'https://psalm.dev/' . str_pad((string) $shortcode, 3, "0", STR_PAD_LEFT) : ''; } diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php index 9575253b85c..d6bc276e025 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php @@ -243,13 +243,11 @@ public static function analyze( } /** - * @param string|int $literal_array_key - * @return false|int * @psalm-assert-if-false !numeric $literal_array_key */ public static function getLiteralArrayKeyInt( - $literal_array_key - ) { + string|int $literal_array_key, + ): false|int { if (is_int($literal_array_key)) { return $literal_array_key; } diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php index ec2a2c35c80..ec07e8c0715 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php @@ -49,7 +49,6 @@ use function implode; use function in_array; use function is_string; -use function preg_match; use function str_contains; use function strlen; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php index 771b8a30ef4..10d14b45f18 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php @@ -308,8 +308,8 @@ private static function analyzeOperands( bool &$has_valid_left_operand, bool &$has_valid_right_operand, bool &$has_string_increment, - ?Union &$result_type = null -Btw ): ?Union { + ?Union &$result_type = null, + ): ?Union { if (($left_type_part instanceof TLiteralInt || $left_type_part instanceof TLiteralFloat) && ($right_type_part instanceof TLiteralInt || $right_type_part instanceof TLiteralFloat) && ( diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index 2fbca15d27f..84f75075ed7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -61,7 +61,7 @@ public static function analyze( PhpParser\Node\Expr $left, PhpParser\Node\Expr $right, Context $context, - ?Union &$result_type = null + ?Union &$result_type = null, ): void { $codebase = $statements_analyzer->getCodebase(); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php index d871c891d63..34938c5972e 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php @@ -1307,7 +1307,7 @@ private static function verifyCallableInContext( CodeLocation $arg_location, Context $context, Codebase $codebase, - StatementsAnalyzer $statements_analyzer + StatementsAnalyzer $statements_analyzer, ): ?bool { $method_identifier = $cased_method_id !== null ? ' of ' . $cased_method_id : ''; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php index 68af0a51c47..f4b7e5c09f7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php @@ -78,7 +78,7 @@ public static function analyze( StatementsAnalyzer $statements_analyzer, PhpParser\Node\Expr\New_ $stmt, Context $context, - ?TemplateResult $template_result = null + ?TemplateResult $template_result = null, ): bool { $fq_class_name = null; @@ -312,7 +312,7 @@ private static function analyzeNamedConstructor( string $fq_class_name, bool $from_static, bool $can_extend, - ?TemplateResult $template_result = null + ?TemplateResult $template_result = null, ): void { $storage = $codebase->classlike_storage_provider->get($fq_class_name); diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php index b32b05749bc..8cb088d450b 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/CastAnalyzer.php @@ -54,7 +54,6 @@ use function array_merge; use function array_pop; use function array_values; -use function get_class; use function range; use function strtolower; diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php index cc83c113501..547c212e6af 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php @@ -480,7 +480,7 @@ public static function getArrayAccessTypeGivenOffset( ?string $extended_var_id, Context $context, ?PhpParser\Node\Expr $assign_value = null, - ?Union $replacement_type = null + ?Union $replacement_type = null, ): Union { $offset_type = $offset_type_original->getBuilder(); diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index b47827b2dcd..90cebe3f301 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -76,6 +76,7 @@ use function str_repeat; use function str_starts_with; use function strlen; +use function strpos; use function substr; use function wordwrap; diff --git a/src/Psalm/Internal/Codebase/Analyzer.php b/src/Psalm/Internal/Codebase/Analyzer.php index 5456f8b188d..33c48358d9e 100644 --- a/src/Psalm/Internal/Codebase/Analyzer.php +++ b/src/Psalm/Internal/Codebase/Analyzer.php @@ -1180,7 +1180,7 @@ public function addNodeType( string $file_path, PhpParser\Node $node, string $node_type, - ?PhpParser\Node $parent_node = null + ?PhpParser\Node $parent_node = null, ): void { if ($node_type === '') { throw new UnexpectedValueException('non-empty node_type expected'); diff --git a/src/Psalm/Internal/Codebase/ConstantTypeResolver.php b/src/Psalm/Internal/Codebase/ConstantTypeResolver.php index c4d786a107a..73584f3c4e8 100644 --- a/src/Psalm/Internal/Codebase/ConstantTypeResolver.php +++ b/src/Psalm/Internal/Codebase/ConstantTypeResolver.php @@ -61,7 +61,7 @@ public static function resolve( ClassLikes $classlikes, UnresolvedConstantComponent $c, ?StatementsAnalyzer $statements_analyzer = null, - array $visited_constant_ids = [] + array $visited_constant_ids = [], ): Atomic { $c_id = spl_object_id($c); diff --git a/src/Psalm/Internal/Codebase/Methods.php b/src/Psalm/Internal/Codebase/Methods.php index 31ca312ab6b..71739ce5e51 100644 --- a/src/Psalm/Internal/Codebase/Methods.php +++ b/src/Psalm/Internal/Codebase/Methods.php @@ -941,7 +941,7 @@ public function getMethodReturnsByRef(MethodIdentifier $method_id): bool public function getMethodReturnTypeLocation( MethodIdentifier $method_id, - ?CodeLocation &$defined_location = null + ?CodeLocation &$defined_location = null, ): ?CodeLocation { $method_id = $this->getDeclaringMethodId($method_id); diff --git a/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php b/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php index 625e515ac18..8d79a41037f 100644 --- a/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php @@ -20,7 +20,6 @@ use Psalm\Type\Atomic; use Psalm\Type\Atomic\TArray; use Psalm\Type\Atomic\TCallable; -use Psalm\Type\Atomic\TCallableArray; use Psalm\Type\Atomic\TCallableInterface; use Psalm\Type\Atomic\TClassString; use Psalm\Type\Atomic\TClosure; @@ -43,12 +42,11 @@ final class CallableTypeComparator { /** - * @param TClosure|TCallableInterface $input_type_part * @param TCallable|TClosure $container_type_part */ public static function isContainedBy( Codebase $codebase, - $input_type_part, + TClosure|TCallableInterface $input_type_part, Atomic $container_type_part, ?TypeComparisonResult $atomic_comparison_result, ): bool { diff --git a/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php b/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php index 3518ef69ddf..de8d509eb13 100644 --- a/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php @@ -40,6 +40,7 @@ use Psalm\Type\Atomic\TTraitString; use Psalm\Type\Atomic\TTrue; +use function get_class; use function is_numeric; use function strtolower; diff --git a/src/Psalm/Internal/Type/ParseTree/Value.php b/src/Psalm/Internal/Type/ParseTree/Value.php index 287211421f6..94a434da8ea 100644 --- a/src/Psalm/Internal/Type/ParseTree/Value.php +++ b/src/Psalm/Internal/Type/ParseTree/Value.php @@ -18,7 +18,7 @@ public function __construct( public int $offset_start, public int $offset_end, ?string $text, - ?ParseTree $parent = null + ?ParseTree $parent = null, ) { $this->parent = $parent; $this->text = $text === $value ? null : $text; diff --git a/src/Psalm/Internal/Type/TypeParser.php b/src/Psalm/Internal/Type/TypeParser.php index 39156787c5d..b1656a2333f 100644 --- a/src/Psalm/Internal/Type/TypeParser.php +++ b/src/Psalm/Internal/Type/TypeParser.php @@ -89,8 +89,6 @@ use function defined; use function end; use function explode; -use function filter_var; -use function get_class; use function in_array; use function is_int; use function is_numeric; diff --git a/src/Psalm/Type/Atomic/TCallableInterface.php b/src/Psalm/Type/Atomic/TCallableInterface.php index e25f076d1a7..54e9a3b26db 100644 --- a/src/Psalm/Type/Atomic/TCallableInterface.php +++ b/src/Psalm/Type/Atomic/TCallableInterface.php @@ -1,5 +1,7 @@