diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d86eeb6f5e5..7d51badcd35 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + tags['variablesfrom'][0]]]> @@ -29,14 +29,6 @@ - - getColumn()]]> - getLineNumber()]]> - raw_file_end]]> - raw_file_start]]> - regex_type]]> - regex_type]]> - docblock_line_number]]> docblock_line_number]]> @@ -80,14 +72,6 @@ - - line]]> - - - - level]]> - - @@ -121,7 +105,6 @@ - @@ -169,13 +152,6 @@ - - - end]]> - start]]> - start]]> - - @@ -206,10 +182,6 @@ name]]> signature_type]]> - - getLine()]]> - getAttribute('startFilePos')]]> - @@ -242,12 +214,6 @@ - - - - - - @@ -265,13 +231,6 @@ - - getLineNumber()]]> - getLine()]]> - function->getLine()]]> - getAttribute('startFilePos')]]> - function->getAttribute('startFilePos')]]> - self]]> self]]> @@ -279,9 +238,6 @@ - - getStartLine()]]> - description]]> @@ -342,10 +298,7 @@ function->name]]> - - count]]> - function->getAttribute('startFilePos')]]> calling_method_id]]> @@ -417,20 +370,6 @@ - - - - - - - - - - - - - - template_types]]> cased_name]]> @@ -448,13 +387,6 @@ - - getMajorAnalysisPhpVersion()]]> - getMinorAnalysisPhpVersion()]]> - getLineNumber()]]> - - - @@ -525,9 +457,6 @@ - - cond->getAttribute('startFilePos')]]> - assigned_var_ids += $switch_scope->new_assigned_var_ids]]> @@ -612,7 +541,6 @@ - value]]> @@ -742,10 +670,6 @@ - - value]]> - - value]]> @@ -827,11 +751,6 @@ byref_constraints[$var_id]->type]]> - - raw_file_end]]> - raw_file_start]]> - - @@ -905,11 +824,6 @@ - - - getAttribute('startFilePos')]]> - - @@ -937,12 +851,6 @@ - - - - - - @@ -957,24 +865,6 @@ - - - - - - - - - - - - - - - - - - @@ -1006,15 +896,6 @@ - - value->getLine()]]> - - - - value->getAttribute('startFilePos')]]> - - - self]]> @@ -1046,17 +927,6 @@ - - - - - - - - - - - @@ -1202,10 +1072,6 @@ - - getArgs())]]> - getArgs())]]> - invalid_method_call_types[0]]]> non_existent_class_method_ids[0]]]> @@ -1292,9 +1158,6 @@ - - - @@ -1370,10 +1233,6 @@ - - value]]> - value]]> - @@ -1447,15 +1306,6 @@ - - getLineNumber()]]> - getLineNumber()]]> - raw_file_end]]> - raw_file_end]]> - raw_file_start]]> - raw_file_start]]> - raw_file_start]]> - @@ -1483,20 +1333,11 @@ - - value->getAttribute('startFilePos')]]> - cond->getAttribute('startFilePos')]]> - - - - var->getAttribute('startFilePos')]]> - - @@ -1528,12 +1369,6 @@ type_start]]> - - - getMajorAnalysisPhpVersion()]]> - getMinorAnalysisPhpVersion()]]> - - @@ -1575,9 +1410,6 @@ - - - getLine()]]> @@ -1593,22 +1425,12 @@ vars_to_initialize]]> - - - - - - - - - - @@ -1656,9 +1478,6 @@ - - - @@ -1667,10 +1486,6 @@ - - - - @@ -1736,12 +1551,6 @@ - - - - - - @@ -1779,11 +1588,6 @@ - - - - - @@ -1809,16 +1613,6 @@ calling_method_id]]> - - - location->getColumn()]]> - location->getLineNumber()]]> - location->getColumn()]]> - location->getLineNumber()]]> - location->getColumn()]]> - location->getLineNumber()]]> - - @@ -1841,14 +1635,6 @@ - - - - raw_file_end]]> - raw_file_start]]> - raw_file_start]]> - raw_file_start]]> - @@ -1894,11 +1680,6 @@ - - - - - readEnv['CI_PR_NUMBER']]]> @@ -1985,9 +1766,6 @@ childConnectTimeout]]> - - - @@ -2020,12 +1798,6 @@ - - - character]]> - line]]> - - @@ -2079,9 +1851,6 @@ - - getLine()]]> - @@ -2149,9 +1918,6 @@ - - - @@ -2174,11 +1940,6 @@ - - - getLine()]]> - getAttribute('startFilePos')]]> - stmts[0]]]> @@ -2205,10 +1966,6 @@ - - code_location->getColumn()]]> - getStartLine()]]> - aliases->uses_start]]> aliases->uses_start]]> @@ -2248,21 +2005,12 @@ - - - - - - getLine()]]> - getAttribute('startFilePos')]]> - - @@ -2284,9 +2032,6 @@ - - - @@ -2301,23 +2046,7 @@ - - - - - - - value]]> - - - - - - - - - @@ -2464,9 +2193,6 @@ - - - @@ -2655,7 +2381,6 @@ - @@ -2691,10 +2416,6 @@ - - - - template_types]]> @@ -2707,13 +2428,6 @@ - - - getLineNumber()]]> - code_location->getLineNumber()]]> - code_location->getLineNumber()]]> - - @@ -2726,14 +2440,6 @@ - code_location->getColumn()]]> - code_location->getColumn()]]> - - - - column_from]]> - line_from]]> - @@ -2745,11 +2451,6 @@ - - - - - @@ -2766,12 +2467,6 @@ - - column_from]]> - column_from]]> - line_from]]> - line_from]]> - link_format]]> @@ -2790,25 +2485,7 @@ - - - column_from]]> - line_from]]> - - - - - from]]> - to]]> - - - - column_from]]> - column_from]]> - line_from]]> - line_from]]> - link_format]]> @@ -2827,69 +2504,16 @@ - - - column_from]]> - column_to]]> - line_from]]> - - - - column_from]]> - line_from]]> - column_from]]> - line_from]]> - taint_trace]]> - - - count]]> - - - - - count]]> - - - - - count]]> - - - - - count]]> - - type]]> - - - value]]> - - - - - value]]> - - - - - value]]> - - - - - value]]> - - type]]> @@ -3086,17 +2710,6 @@ value]]> - - - value]]> - value]]> - - - - - max_string_length]]> - - @@ -3236,14 +2849,6 @@ - - - - - - - - composer_lock]]> @@ -3278,38 +2883,13 @@ - - - getLine()]]> - - - - - getColumn()]]> - getLineNumber()]]> - - - - - - - - - - - - - - - - @@ -3317,12 +2897,6 @@ - - - column_from]]> - line_from]]> - - diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index 9ec221c1b90..ab5bda5fa57 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -465,7 +465,9 @@ private static function analyzeOperand( } if (!$operand_type_match - && (!$comparison_result->scalar_type_match_found || $config->strict_binary_operands) + && (!$comparison_result->scalar_type_match_found + || (!$operand_type->isInt() && $config->strict_binary_operands) + ) ) { if ($has_valid_operand) { IssueBuffer::maybeAdd( diff --git a/tests/BinaryOperationTest.php b/tests/BinaryOperationTest.php index 917e0b97f87..dd5e66aefb2 100644 --- a/tests/BinaryOperationTest.php +++ b/tests/BinaryOperationTest.php @@ -275,23 +275,6 @@ public function testDifferingNumericTypesAdditionInStrictMode(): void $this->analyzeFile('somefile.php', new Context()); } - public function testConcatenationWithNumberInStrictMode(): void - { - $config = Config::getInstance(); - $config->strict_binary_operands = true; - - $this->addFile( - 'somefile.php', - 'expectException(CodeException::class); - $this->expectExceptionMessage('InvalidOperand'); - - $this->analyzeFile('somefile.php', new Context()); - } - public function testImplicitStringConcatenation(): void { $config = Config::getInstance();