镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix method name in StaticCallToMethodCallRector, in case of method is static - #6789

Merged
samsonasik merged 1 commit into
rectorphp:mainfrom
parth391:main
Mar 19, 2025
Merged

samsonasik merged 1 commit into
rectorphp:mainfrom
parth391:main

Conversation

@parth391

Copy link
Copy Markdown
Contributor

This PR fixes method name in StaticCallToMethodCallRector, while method is static and wildcard is used. At the moment method name is been replaced by the *.

Config

$rectorConfig
    ->ruleWithConfiguration(StaticCallToMethodCallRector::class, [
        new StaticCallToMethodCall(
            'Illuminate\Support\Facades\App',
            '*',
            'Illuminate\Foundation\Application',
            '*'
        ),
    ]);

Before

use Illuminate\Support\Facades\App;

class ModelSeeder
{
    public static function seed() {
        App::get(ClassName::class)
            ->handle();
    }
}

After

use Illuminate\Support\Facades\App;

class ModelSeeder
{
    public static function seed() {
        (new \Illuminate\Foundation\Application())->*(SomeClass::class)
             ->handle();
    }
}

Expected

use Illuminate\Support\Facades\App;

class ModelSeeder
{
    public static function seed() {
        (new \Illuminate\Foundation\Application())->get(SomeClass::class)
             ->handle();
    }
}

@samsonasik
samsonasik merged commit d80e482 into rectorphp:main Mar 19, 2025
@samsonasik

Copy link
Copy Markdown
Member

Thank you @parth391

@github-actions

github-actions Bot commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants