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

Remove php version from composer.json #462

Closed
kevinquillen opened this issue Feb 13, 2019 · 7 comments · Fixed by #648
Closed

Remove php version from composer.json #462

kevinquillen opened this issue Feb 13, 2019 · 7 comments · Fixed by #648
Assignees
Labels
composer.json Quick fix State: In progress The issue is being worked on Type: Chore Issue is a related to a maintenance

Comments

@kevinquillen
Copy link

Including this line in composer.json causes PHPStorm to lock certain settings like setting your PHP language level.

When I removed "php": ">=5.6", and ran composer update --lock, I could then set my language level in PHPStorm, pictured below.

screen shot 2019-02-13 at 2 04 40 pm

I think this might be a bug related to Composer/PHPStorm, but it is not a simple thing for others to find, particularly when they are configuring aspects of PHPStorm for development.

@johncronan
Copy link

This seems like as good a place as any to note that, now that the Drupal version is 8.7, that requirement should be >=7.0 (if present at all).

@cybtachyon
Copy link

I wouldn't necessarily consider this a bug - you can override this in PHPStorm:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000794610-When-marking-sources-PhpStorm-automatically-returns-to-previous-settings-on-restart?page=1#community_comment_115000659650

The default is very useful in that it prevents you from using language level features that don't fit the Drupal minimum requirements.... assuming you plan on contributing your code back to the community.

@kevinquillen
Copy link
Author

It is a bug because it interferes with IDE settings, requiring a user to have to go track that down, as opposed to bumping it (mentioned in that very same link). It would not allow me to do anything at all, and it wasn't clear why or how to rectify that from the IDE.

Even so, at this date:

Drupal 8 will require PHP 7 starting May 1, 2019, on the day of the release of Drupal 8.7.0.

So it sounds like it should be bumped in accordance anyway.

@j3ll3nl
Copy link

j3ll3nl commented Oct 22, 2019

Allready moved up to 7.0.8 with #518

@leymannx
Copy link
Collaborator

Core 8 composer.json has "php": "^7.0.8" and core 9 composer.json has "php": ">=7.3.0" already. So I guess that should already be enough actually.

We could move the PHP requirement to the platform reqs like drupal/drupal does it. How does that sound?

Ping @webflo @jcnventura

@AlexSkrypnyk
Copy link
Collaborator

About platform version constraints

There are 2 places to determine the PHP platform requirements:

  1. The require.php version value in composer.json.
  2. The config.platform version value in composer.json.

The purpose of require.php is to set the minimum PHP language requirements
for a package. For example, the minimum version required for Drupal 10 is 8.0.2
or above, which can be specified as >=8.

The purpose of config.platform is to set the PHP language requirements for the
specific instance of the package running in the current environment. For
example, while the minimum version required for Drupal 10 is 8.0.2 or above, the
actual PHP version on the hosting provider could be 8.1.0. The value of this
field should provide your exact version of PHP with all 3 parts of the version.

Which versions to specify in a Drupal site?

It is recommended to specify require.php as a range constraint (e.g. >=8.1)
to ensure it is used as the minimum requirement for project dependencies.

It is also recommended to specify config.platform as a specific version (e.g.
8.1.19) constraint to ensure that only the package versions supported by your
current environment are used.

Once the PHP version of your environment is updated, the config.platform
value should also be updated to the specific version.

What should we do in this project?

This project includes drupal/core which already has require.php added. The consumer project spun up using this template would inherit that constraint. Unless we want to explicitly state the PHP version in composer.json, we should remove require.php from composer.json.

config.platform is a platform-specific. This template is a pure composer template and it is not tied to a specific platform. I suggest to remove the config.platform requirements as there is no platform/stack with a specific version of PHP provided in this project.

@leymannx
Copy link
Collaborator

Yes to remove both. Remove require.php and remove config.platform.

The dependencies already cover that logic and it's not on the template to dictate over them or needing to keep up with them.

@AlexSkrypnyk AlexSkrypnyk added Type: Chore Issue is a related to a maintenance State: Confirmed The issue was triaged and confirmed for development labels May 13, 2024
@AlexSkrypnyk AlexSkrypnyk added State: In progress The issue is being worked on and removed State: Confirmed The issue was triaged and confirmed for development labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
composer.json Quick fix State: In progress The issue is being worked on Type: Chore Issue is a related to a maintenance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants