Skip to content

[ComposerBased] Pin version-bound tests to a test-specific composer.json instead of the repo root - #513

Merged
TomasVotruba merged 2 commits into
mainfrom
skip-orm-setup-renames-below-3-5
Aug 22, 2026
Merged

[ComposerBased] Pin version-bound tests to a test-specific composer.json instead of the repo root#513
TomasVotruba merged 2 commits into
mainfrom
skip-orm-setup-renames-below-3-5

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Aug 22, 2026

Copy link
Copy Markdown
Member

Problem

ComposerBasedTest had no provideComposerJsonFilePath() override, so InstalledPackageResolver fell back to the repo root composer.json (getcwd()) to resolve the version-bound rules. The version-bound fixtures then depended on whatever doctrine/* happened to be installed locally, and on the root's declared ranges — not on a version the test controls.

This surfaced via rectorphp/rector-src#8363: once a distributed package resolves to its lowest declared version, the root doctrine/orm: ^3.0 floor dropped the ORMSetup >=3.5 renames and version_bound_orm_setup_renames broke.

Fix

Pin the version-bound tests to a test-specific composer.json, via the existing provideComposerJsonFilePath() hook:

protected function provideComposerJsonFilePath(): ?string
{
    return __DIR__ . '/composer.json';
}
{
    "require": {
        "doctrine/orm": "^3.5",
        "doctrine/dbal": "^4.0"
    }
}

Those floors match the APIs the three fixtures target (doctrine/orm >=3.5 for the ORMSetup renames and >=2.9 for the annotation-to-attribute pass, doctrine/dbal >=4.0 for the getSchemaManager/isFullfilledBy renames). The root composer.json no longer influences the result.

This path (composerJsonFilePath set) resolves versions straight from the declared constraints, so it is independent of rector-src#8363 and green on the current released rector-src as well — verified locally, 3/3.

@TomasVotruba
TomasVotruba force-pushed the skip-orm-setup-renames-below-3-5 branch from 2d4ccf0 to 2f9bb53 Compare August 22, 2026 18:15
@TomasVotruba TomasVotruba changed the title [ComposerBased] Skip ORMSetup >=3.5 renames when the package declares a lower orm floor Require doctrine/orm ^3.5 so version-bound ORMSetup renames target the declared floor Aug 22, 2026
@TomasVotruba
TomasVotruba force-pushed the skip-orm-setup-renames-below-3-5 branch from 2f9bb53 to e5bff20 Compare August 22, 2026 18:23
@TomasVotruba TomasVotruba changed the title Require doctrine/orm ^3.5 so version-bound ORMSetup renames target the declared floor [ComposerBased] Pin version-bound tests to a test-specific composer.json instead of the repo root Aug 22, 2026
@TomasVotruba
TomasVotruba enabled auto-merge (squash) August 22, 2026 18:24
@TomasVotruba
TomasVotruba merged commit 6b8e03d into main Aug 22, 2026
7 checks passed
@TomasVotruba
TomasVotruba deleted the skip-orm-setup-renames-below-3-5 branch August 22, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants