xp-framework / rfc

One of the major deficiencies in the development of many projects is that there is no roadmap or strategy available other than in the developers' heads. The XP team publishes its decisions by documenting change requests in form of RFCs.
2 stars 1 forks source link

Drop PHP 7 support #343

Open thekid opened 1 year ago

thekid commented 1 year ago

Scope of Change

This RFC suggests dropping PHP 7 support

Rationale

PHP 7.4 is EOL since November 28, 2022: https://twitter.com/official_php/status/1597203297537957888

Functionality

Security considerations

n/a

Speed impact

Better

Dependencies

Major version

Related documents

https://www.php.net/releases/8.0/en.php

thekid commented 1 year ago

As long as it's not a major hassle to support PHP 7.x we can also continue to keep compatibility with it, though.

thekid commented 1 year ago

It could be worthwhile dropping PHP < 7.4 for:

thekid commented 1 year ago

All PHP 8.0 features @ https://wiki.php.net/rfc#php_80

thekid commented 8 months ago

https://externals.io/message/122214

This would introduce the situation of not being able to write nullable parameters in a way that works for all PHP versions. PHP 7.0 needs T $arg= null, which would be deprecated and create warnings.

One argument more to only keep support for PHP 7.4

thekid commented 6 months ago

This would introduce the situation of not being able to write nullable parameters in a way that works for all PHP versions

Made XP 11 compatible by suppressing this specific error, see https://github.com/xp-framework/core/releases/tag/v11.9.0

thekid commented 6 months ago

The case for dropping 7.0 (but retaining 7.x)

This would introduce the situation of not being able to write nullable parameters in a way that works for all PHP versions

We should safely be able to drop at least PHP 7.0 as even really old Ubuntu versions come with 7.2:

This would allow us to restore full compatibility with the implicit nullable types deprecation as we can use https://wiki.php.net/rfc/nullable_types syntax while still supporting the broadest possible range of PHP versions!


Dropping 7.0 would also make these conditionals unnecessary:

$ grep -Hrn PHP_VERSION src/main/php/  | grep 70100
src/main/php/lang/ClassLoader.class.php:231:        $constraint= (PHP_VERSION_ID >= 70100 ? $t->getName() : $t->__toString());
src/main/php/lang/ClassLoader.class.php:233:        $constraint= '\\'.(PHP_VERSION_ID >= 70100 ? $t->getName() : $t->__toString());
src/main/php/lang/ClassLoader.class.php:253:      $decl.= ':'.(PHP_VERSION_ID >= 70100 ? $t->getName() : $t->__toString());
src/main/php/lang/ClassLoader.class.php:255:      $decl.= ': \\'.(PHP_VERSION_ID >= 70100 ? $t->getName() : $t->__toString());
src/main/php/lang/ClassLoader.class.php:303:            if (null !== $t && 'void' === (PHP_VERSION_ID >= 70100 ? $t->getName() : $t->__toString())) {
src/main/php/lang/Environment.class.php:17:    foreach (PHP_VERSION_ID >= 70100 ? getenv() : $_SERVER as $name => $value) {
src/main/php/lang/Environment.class.php:32:    $variables= PHP_VERSION_ID >= 70100 ? getenv() : $_SERVER;
src/main/php/lang/reflect/Field.class.php:99:      $name= PHP_VERSION_ID >= 70100 ? $t->getName() : $t->__toString();
src/main/php/lang/reflect/Parameter.class.php:107:      $name= PHP_VERSION_ID >= 70100 ? $t->getName() : $t->__toString();
src/main/php/lang/reflect/Routine.class.php:168:      $name= PHP_VERSION_ID >= 70100 ? $t->getName() : $t->__toString();
src/main/php/lang/Type.class.php:256:      $name= PHP_VERSION_ID >= 70100 ? $type->getName() : $type->__toString();

PHP 7.1 comes with a variety of syntactical features:

See https://wiki.php.net/rfc#php_71

PHP 7.2, 7.3 and 7.4 offer the following on top:

See https://wiki.php.net/rfc#php_72, https://wiki.php.net/rfc#php_73 and https://wiki.php.net/rfc#php_74


Our path forward could be as follows:

  1. XP 12 drops PHP 7.0 support
  2. XP 13 drops PHP 7.1 - 7.3 support
    • Released November 2024, two years after PHP 7.4 EOL
    • Minimum requirement: PHP 7.4
    • Removes XP relection API
  3. XP 14 drops PHP 7 support alltogether
    • Released 2025
    • Minimum requirement: PHP 8.0

Alternatively, a more "agressive" (see above for how long PHP 7.4 has been EOL) path could be:

  1. XP 12 drops PHP 7.0 - 7.3 support
  2. XP 13 drops PHP 7 support alltogether
    • Released November 2024, two years after PHP 7.4 EOL
    • Minimum requirement: PHP 8.0
    • Removes XP relection API
thekid commented 6 months ago

For contrast: Symfony, Laravel and PHPUnit all require PHP 8.2 at the time of writing

thekid commented 6 months ago

XP 12 is released!

https://github.com/xp-framework/core/releases/tag/v12.0.0

thekid commented 6 months ago

Alternatively, a more "agressive" (see above for how long PHP 7.4 has been EOL) path could be: [...] XP 12 drops PHP 7.0 - 7.3 support

Following this path, quite a bit of libraries have been pushed to 7.4+ in the meantime

thekid commented 1 month ago

See https://github.com/xp-forge/aws/pull/18/commits/613264ffc3c61f3badb9170f4244e1520a4a029a