Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

self_accessor should correctly replace self in bound closures #7163

Closed
vudaltsov opened this issue Jul 18, 2023 · 2 comments · Fixed by #7349
Closed

self_accessor should correctly replace self in bound closures #7163

vudaltsov opened this issue Jul 18, 2023 · 2 comments · Fixed by #7349
Labels

Comments

@vudaltsov
Copy link
Contributor

Bug report

Currently PHP-CS-Fixer always replaces class with self, even in \Clos

Description

Consider code:

<?php

final class A
{
    public static function a(): void
    {
        (function () {
            var_dump(self::class, A::class);
        })->bindTo(null, B::class)();
    }
}

final class B {}

A::a();

Here we should not replace A::class with self::class, because within bound closure self is B, not A.

https://3v4l.org/38GQA

@vudaltsov vudaltsov changed the title self_accessor should not replace self in bound closures self_accessor should correctly replace self in bound closures Jul 18, 2023
@github-actions

This comment was marked as outdated.

@SpacePossum
Copy link
Contributor

Since this issue has not had any activity within the last 90 days, I have marked it as stale.

it got a PR opened for it 2 weeks ago, also, valid code-breaking-bugs should never be labelled stale IMHO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants