Skip to content

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

Merged
samsonasik merged 3 commits intomainfrom
check-template
Oct 26, 2024
Merged

[DeadCode] Check TemplateType instance check on Dead*TagValueNodeAnalyzer#6400
samsonasik merged 3 commits intomainfrom
check-template

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
@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