Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DeadCode] Check TemplateType instance check on Dead*TagValueNodeAnalyzer #6400

Merged
merged 3 commits into from
Oct 26, 2024

Conversation

samsonasik
Copy link
Member

per #6399 (comment)

Check TemplateType instance on specific Dead*TagValueNodeAnalyzer, ensuring existing equal type check still works.

Only on dead code rules that mark it as used, as defined in Class_ @template

@samsonasik
Copy link
Member Author

samsonasik commented Oct 26, 2024

By this, the mixed native param type with @template usage cause downgrade rule apply:

➜  rector-src git:(check-template) bin/rector process src/PhpAttribute/Contract/AnnotationToAttributeMapperInterface.php --config build/config/config-downgrade.php --dry-run --clear
-cache
 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1 file with changes
===================

1) src/PhpAttribute/Contract/AnnotationToAttributeMapperInterface.php:10

    ---------- begin diff ----------
@@ @@
  */
     /**
-     * @param T $value
+     * @param mixed $value
      */
-    public function map(mixed $value): Expr;
+    public function map($value): Expr;
 }
    ----------- end diff -----------

Applied rules:
 * DowngradeMixedTypeDeclarationRector

if type param is equal, it should be keep as T as is. I will look more.

@samsonasik
Copy link
Member Author

should be ok now

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 61a787e into main Oct 26, 2024
36 checks passed
@samsonasik samsonasik deleted the check-template branch October 26, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant