Skip to content

fix: support rector 2.8 - #115

Open
susnux wants to merge 3 commits into
mainfrom
fix/rector-2.8
Open

susnux wants to merge 3 commits into
mainfrom
fix/rector-2.8

Conversation

@susnux

@susnux susnux commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Rector 2.8 broke this library, and with it Nextcloud server's rector setup (nextcloud/server#66578):

  • AnnotationToAttributeRector: Rector 2.8.2 removed Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser. This switches to phpdoc-parser's NodeTraverser with CallablePhpDocNodeVisitor, the way upstream's AnnotationToAttributeRector does now. It also replaces the deprecated PhpVersionFeature with PhpVersion. rector/rector is bumped to ^2.8.2.

  • OC_Helper → OCP\Util: RenameStaticMethodRector is deprecated and now a no-op, so the Nextcloud 25 set silently stopped migrating these calls. It is replaced by a dedicated OcHelperToOcpUtilRector.

  • Breaking: NextcloudNamespaceSkipVoter is removed. Rector 2.8.0 deleted ClassNameImportSkipVoterInterface (Inline class-name import skip voters into ClassNameImportSkipper rectorphp/rector-src#8696) and offers no replacement, so imports can no longer be limited to Nextcloud namespaces.

  • AI assisted

@nickvergessen nickvergessen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did not execute, but looks good

@nickvergessen

Copy link
Copy Markdown
Contributor

Rector 2.8.2 removed its own `PhpDocNodeTraverser` in favour of the
phpdoc-parser `NodeTraverser` and deprecated `PhpVersionFeature`.

Assisted-by: ClaudeCode:claude-opus-5-5
Rector 2.8 turned `RenameStaticMethodRector` into a no-op, so the
`OC_Helper` to `OCP\Util` migration needs its own rule.

Assisted-by: ClaudeCode:claude-opus-5-5
Rector 2.8 removed `ClassNameImportSkipVoterInterface` without a
replacement, so name imports can no longer be limited to Nextcloud
namespaces.

Assisted-by: ClaudeCode:claude-opus-5-5
@susnux

susnux commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

rebased ✅

@susnux
susnux requested a review from CarlSchwan November 18, 2026 22:08
@nickvergessen

Copy link
Copy Markdown
Contributor

Deps are not installable on PHP 8.1 and 8.2 🙈
And we should add 8.4 and 8.5 and tomorrow 8.6 to the testing matrix? :D

@susnux

susnux commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

No its unrelated to this PR, its broken since b9746d0
It sets "ramsey/devtools": "^2.0" but that requires PHP 8.2+, but we set

"platform": {
            "php": "8.1.31"
        },

@nickvergessen

nickvergessen commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Well we try to support 8.1:

"php": "8.1.31"

I guess we need to bump that to 8.2.35:
https://github.com/Roave/SecurityAdvisories/blame/9f18043008504f654d3723c95346357a3af11deb/composer.json#L690

Edit: too slow

@nickvergessen

Copy link
Copy Markdown
Contributor

No its unrelated to this PR, its broken since b9746d0
It sets "ramsey/devtools": "^2.0" but that requires PHP 8.2+, but we set

Not really, back then Roave/SecurityAdvisory:latest still allowed PHP 8.1
ramsey/devtools is requiring latest so since php2shell last month this is broken.
But adjusting the platform should be good enough?

@nickvergessen

Copy link
Copy Markdown
Contributor

@susnux
susnux added this pull request to stack #120 November 18, 2026 22:41
@susnux susnux mentioned this pull request Nov 18, 2026
2 of 7 tasks
@susnux

susnux commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

see stack I created, I think this is the cleanest

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.

AnnotationToAttributeRector fails with rector 2.8: PhpDocNodeTraverser was removed

2 participants