Skip to content

feat(php-version): Check php version in config #347

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

Merged

Conversation

olivernybroe
Copy link
Collaborator

Q A
Bug fix? yes
New feature? yes
Fixed tickets #346

This PR adds support for checking composer file directly in the preset.
This enables the support for checking if we should enable enableNativeTypeHint when php version is lower than 7.4 in composer file.

The initial work for it is ready, however right now it only supports checking the php version if the version is formatted as 7.1 or ^7.1, I haven't been able to find a way to make it work for all types yet without having to write the code for all scenarios.

- Add a class for composer config
Copy link
Collaborator

@Jibbarth Jibbarth left a comment

Choose a reason for hiding this comment

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

Great work ! I like the Composer class, which can later allow us to drop dependency to composer.

I just made a quick review, I'll try to reread it tonight 😉

However, I think we shouldn't rely on illuminate/support in the code to avoid much dependencies and possible version conflict. WDYT ?

@olivernybroe
Copy link
Collaborator Author

@Jibbarth One thing is that I used ?Composer a lot of places, because there might not be a composer file. However our phpstan settings disallows that.
What do you propose here? I would think that either remove the rule or returning a Composer object with no data in it.

@Jibbarth
Copy link
Collaborator

Jibbarth commented Feb 3, 2020

@olivernybroe 🤔 I think I prefer a Composer object with empty data.

Copy link
Collaborator

@Jibbarth Jibbarth left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@olivernybroe
Copy link
Collaborator Author

@Jibbarth Just made a little change so it should be able to parse more version constraint strings.

Copy link
Collaborator

@Jibbarth Jibbarth left a comment

Choose a reason for hiding this comment

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

I'm wonder if we could avoid all this Composer $composer passed in all Preset.

Maybe there is something to do with the container ? 🤔

Anyway, that could be refactoring later. I just left one comment about the array_filter.

@olivernybroe
Copy link
Collaborator Author

@Jibbarth Might be possible yeah 😄
But I agree that we should wait with that for now.

Nice catch, was a array_filter I didn't need, should be good for a final review now.

Copy link
Collaborator

@Jibbarth Jibbarth left a comment

Choose a reason for hiding this comment

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

Good job @olivernybroe 👍

@olivernybroe olivernybroe merged commit 134655b into nunomaduro:master Feb 10, 2020
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