Skip to content

Incorrect behavior of AnnotationToAttributeRector: null value should not be changed to "null" on @Route content #9098

@samsonasik

Description

@samsonasik

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/1ea29bcf-820f-4b15-865b-5813921292f8

<?php

namespace Symfony\Component\Routing\Annotation
{
    class Route {}
    
    class Foo
    {
        /** 
         * @Route("/some/{id}", defaults={"id" = null})
         */
    	public function indexAction()
        {
        }
    }
}

Responsible rules

  • AnnotationToAttributeRector

Expected Behavior

-        #[Route(path: '/some/{id}', defaults: ['id' => 'null'])]
+        #[Route(path: '/some/{id}', defaults: ['id' => null])]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions