Skip to content

Conversation

@calebdw
Copy link
Contributor

@calebdw calebdw commented Sep 15, 2025

Hello!

This fixes some more bugs in the rector:

  1. cases on self were not being renamed
  2. prevents enum constants from being renamed

Thanks!

@calebdw calebdw force-pushed the calebdw/push-utwsxnywtlln branch from e205535 to 70b25a3 Compare September 15, 2025 01:09
@calebdw calebdw force-pushed the calebdw/push-utwsxnywtlln branch from 70b25a3 to 5b75d94 Compare September 15, 2025 03:17
@TomasVotruba
Copy link
Member

Looks good, thank you 👍

@TomasVotruba TomasVotruba merged commit d02183a into rectorphp:main Sep 15, 2025
49 checks passed
@calebdw calebdw deleted the calebdw/push-utwsxnywtlln branch September 15, 2025 12:01

$enumClassName = $classConstFetch->class->toString();
if (! $this->reflectionProvider->hasClass($enumClassName)) {
if ($this->isUsedOutsideOfProject($classConstFetch->class)) {
Copy link
Member

@samsonasik samsonasik Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self should can be recefenced to current classreflection name, if it is ThisType, should be utilze $type->getStaticObjectType() so can look up correct target name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self should can be recefenced to current classreflection name

If the rector is processing self then it should be guaranteed to be a path used in withPaths

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let see it in the wild :),

/cc @marcelthole @boesing in case you have a chance to test latest "rector/rector": "dev-main" for EnumCaseToPascalCaseRector rule :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants