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

ValueResolver confused by __DIR__ constant #9035

Closed
jtojnar opened this issue Feb 23, 2025 · 4 comments · Fixed by rectorphp/rector-src#6756
Closed

ValueResolver confused by __DIR__ constant #9035

jtojnar opened this issue Feb 23, 2025 · 4 comments · Fixed by rectorphp/rector-src#6756
Labels

Comments

@jtojnar
Copy link

jtojnar commented Feb 23, 2025

Bug Report

Subject Details
Rector version 2.0.9

I am trying to upgrade a custom Rector rule from old version of Rector in j0k3r/graby#365 but in 2.0, it no longer appears to be able to handle __DIR__ constant.

Minimal PHP Code Causing Issue

https://getrector.com/demo/4c428282-bbc7-46b6-9db4-eab6d9e90f2f

Inserting var_dump (not allowed on the demo server) would show:

array(1) {
  ["bar"]=>
  NULL
}

Expected Behaviour

It should resolve the __DIR__ constant in the context of refactored file:

array(1) {
  ["bar"]=>
  array(1) {
    ["foo"]=> "/home/jtojnar/Projects/graby/tests/bar"
  }
}
@jtojnar jtojnar added the bug label Feb 23, 2025
@samsonasik
Copy link
Member

The feature seems removed at PR:

which remove get dir and file due to removal of usage of CurrentFileProvider on ValueResolver by @TomasVotruba

@TomasVotruba
Copy link
Member

TomasVotruba commented Feb 24, 2025

@samsonasik Could you cover this with test? PHPStan used to cover __DIR__ before.
If that is not the case, we should revert it.

@samsonasik
Copy link
Member

sure, I will do

@TomasVotruba
Copy link
Member

👍

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

Successfully merging a pull request may close this issue.

3 participants