Skip to content

Error when curly brace string accessor in a trait method #8993

@robchett

Description

@robchett

Bug Report

Subject Details
Rector version 2.0.7

Minimal PHP Code Causing Issue

<?php

trait A
{
    public function a()
    {
        $a = 'a';
        return $a{1};
    }
}

Output:

Could not process "..." file, due to:
"System error: "Scope not available on "PhpParser\Node\Stmt\ClassMethod" node. Fix scope refresh on changed nodes first"

Expected Behaviour

Change {1} to [1]
It works fine for classes

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