Skip to content

[NodeAnalyzer] Remove parent lookup on ExprAnalyzer::isNonTypedFromParam()#4389

Merged
samsonasik merged 1 commit intomainfrom
remove-parent-expr-analyzer
Jul 1, 2023
Merged

[NodeAnalyzer] Remove parent lookup on ExprAnalyzer::isNonTypedFromParam()#4389
samsonasik merged 1 commit intomainfrom
remove-parent-expr-analyzer

Conversation

@samsonasik
Copy link
Copy Markdown
Member

Let's try rely on $scope->getNativeType($expr) is a MixedType with non explicit mixed detection instead of climbing lookup parent.

@samsonasik samsonasik requested a review from TomasVotruba as a code owner July 1, 2023 10:08
@samsonasik samsonasik merged commit db5f778 into main Jul 1, 2023
@samsonasik samsonasik deleted the remove-parent-expr-analyzer branch July 1, 2023 10:11
@samsonasik
Copy link
Copy Markdown
Member Author

samsonasik commented Jul 1, 2023

It seems cause changed behaviour on RecastingRemovalRector on CodeIgniter4 project on @param and is_numeric() check:

1) system/HTTP/RequestTrait.php:255

    ---------- begin diff ----------
@@ @@

         // Null filters cause null values to return.
         $filter ??= FILTER_DEFAULT;
-        $flags = is_array($flags) ? $flags : (is_numeric($flags) ? (int) $flags : 0);
+        $flags = is_array($flags) ? $flags : (is_numeric($flags) ? $flags : 0);

         // Return all values when $index is null
         if ($index === null) {
    ----------- end diff -----------

Applied rules:
 * RecastingRemovalRector

which numeric an be : "0", while (int) cast got 0. which seems make error when using strict types, see https://3v4l.org/fn513

@samsonasik
Copy link
Copy Markdown
Member Author

#4390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant