private static function isValidArrayItem(Expr $item)
    {
        $value = ($item instanceof ArrayItem) ? $item->value : $item;

        while ($value instanceof ArrayDimFetch || $value instanceof PropertyFetch) {
            $value = $value->var;
        }

        // We just kind of give up if it's a method call. We can't tell if it's
        // valid via static analysis.
        return $value instanceof Variable || $value instanceof MethodCall || $value instanceof FuncCall;
    }
private static function isValidArrayItem(Expr $item)
    {
        $value = ($item instanceof ArrayItem) ? $item->value : $item;

        while ($value instanceof ArrayDimFetch || $value instanceof PropertyFetch) {
            $value = $value->var;
        }

        // We just kind of give up if it's a method call. We can't tell if it's
        // valid via static analysis.
        return $value instanceof Variable || $value instanceof MethodCall || $value instanceof FuncCall;
    }
private static function isValidArrayItem ( Expr $ item ) { $ value = ( $ item instanceof ArrayItem ) ? $ item -> value : $ item ; while ( $ value instanceof ArrayDimFetch || $ value instanceof PropertyFetch ) { $ value = $ value -> var ; } // We just kind of give up if it's a method call. We can't tell if it's // valid via static analysis. return $ value instanceof Variable || $ value instanceof MethodCall || $ value instanceof FuncCall ; }
Validate whether a given item in an array is valid for short assignment.

@param Expr $item

@return bool
Validate whether a given item in an array is valid for short assignment .