Skip to content

Cannot get name on "PhpParser\Node\Expr\MethodCall" node. Use $node->name instead. #2364

@brendt

Description

@brendt
Subject Details
Rector version e.g. v0.6
PHP version PHP 7.3
Full Command vendor/bin/rector process app/ --set php74 --dry-run

Current Behaviour

Could not process "<path>/app/Admin/Payments/Resources/PaymentResource.php" file,
         due to:
         "Cannot get name on "PhpParser\Node\Expr\MethodCall" node. Use $node->name instead. Called in:
         vendor/rector/rector/src/Rector/AbstractRector/NameResolverTrait.php:31".

Minimal PHP Code Causing Issue

<?php

namespace App\Admin\Payments\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

/**
 * @mixin \App\Domain\Payment\Models\Payment
 */
class PaymentResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => $this->id,
            'checkout_url' => $this->checkout_url,
            'status' => $this->status,
            'used_provider' => $this->used_provider,
            'has_errors' => $this->hasErrors(),
            'payment_method' => $this->getPaymentMethod()::getName(),
            'payment_method_identifier' => $this->getPaymentMethod()::getId(),
            'is_paid' => $this->isPaid(),
            'paid_at' => optional($this->paid_at)->format('d/m/Y h:i'),
            'is_cancelled' => $this->isCancelled(),
            'cancelled_at' => optional($this->canceled_at)->format('d/m/Y h:i'),
            'is_failed' => $this->isFailed(),
            'failed_at' => optional($this->failed_at)->format('d/m/Y h:i'),
            'platform' => $this->platform,
            'platform_type' => $this->platform_type,
            'payment_url' => $this->getPaymentUrl(),
        ];
    }
}

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