Nimut / testing-framework

TYPO3 testing framework that provides base classes and configuration for PHPUnit tests
GNU General Public License v2.0
52 stars 25 forks source link

[TASK] Set a minimum PHP version in composer.json #85

Closed oliverklee closed 6 years ago

oliverklee commented 6 years ago

This allows IDEs like PhpStorm to automatically determine the PHP language level.

IchHabRecht commented 6 years ago

Hi @oliverklee,

Thank you for your pull request. Unfortunately I don't understand that change request. How does the PHPStorm setting depend on the testing framework? IMHO either the used TYPO3 should define a proper PHP version or the extension that uses the testing framework should. Would you mind to explain why it is necessary to define all those PHP versions in the testing framework and why not simply using ">=5.5, <7.3" is sufficient?

oliverklee commented 6 years ago

How does the PHPStorm setting depend on the testing framework? IMHO either the used TYPO3 should define a proper PHP version or the extension that uses the testing framework should.

This is relevant when opening the TF itself as a project in PhpStorm, e.g. when developing the TF, creating PRs etc.

In theory, PhpStorm could scan through all dependencies and thus determine the minimum and maximum PHP version (e.g., to know whether the null coalesce operator would be allowed), but in practice it can only automatically use the settings in the main composer.json (and I agree that this how it should be).

Would you mind to explain why it is necessary to define all those PHP versions in the testing framework and why not simply using ">=5.5, <7.3" is sufficient?

That would also work. It is a matter of taste. I prefer to have list the single versions explicitly, but I'm fine with either variant.

IchHabRecht commented 6 years ago

I just tested the PHPStorm settings. With and without this patch PHPStorm refers to PHP 5.6 which is perfectly fine IMHO.

oliverklee commented 6 years ago

I just tested the PHPStorm settings. With and without this patch PHPStorm refers to PHP 5.6 which is perfectly fine IMHO.

PHP also allows manually setting the PHP language level in:

Settings > Languages & Frameworks > PHP > PHP language level.

This manual setting is not necessary if the composer.json provides the PHP version requirements, as set in:

Settings > Languages & Frameworks > PHP > Composer > Synchronize IDE Settings with composer.json

(When PhpStorm encounters a composer.json in a project for the first time, it asks whether this setting should be enabled.)