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

Config withPhpSets does not work with composer require php-64bit #8890

Closed
Tetragramat opened this issue Nov 8, 2024 · 1 comment · Fixed by rectorphp/rector-src#6432
Closed
Labels

Comments

@Tetragramat
Copy link

Tetragramat commented Nov 8, 2024

Bug Report

Subject Details
Rector version 1.2.2

If I use withPhpSets without arguments on project that has in composer.json php defined only as require.php-64bit then I'll get error.

 [ERROR] We could not find local "composer.json" to determine your PHP version.                                       
         Please, fill the PHP version set in withPhpSets() manually. 

Minimal PHP Code Causing Issue

rector.php

return RectorConfig::configure()
    ->withPhpSets();

composer.json

{
    "require": {
        "php-64bit": "8.1.*",
    }
}

Expected Behaviour

In \Rector\Php\PhpVersionResolver\ProjectComposerJsonPhpVersionResolver::resolve should be added read for php-64bit instead of just php.

That means this line should be changed for example like this

-$requirePhpVersion = $projectComposerJson['require']['php'] ?? null;
+$requirePhpVersion = $projectComposerJson['require']['php'] ?? $projectComposerJson['require']['php-64bit'] ?? null;
@Tetragramat Tetragramat added the bug label Nov 8, 2024
@TomasVotruba
Copy link
Member

Thanks for reporting 💪

Could you send proposed fix?

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.

2 participants