Increase minimal PHP version? #302

Open
opened 2020-04-27 09:38:35 +00:00 by matthijskooijman · 2 comments
matthijskooijman commented 2020-04-27 09:38:35 +00:00 (Migrated from github.com)

Currently, we document the minimal PHP version at 5.6. However, newer PHP version have interesting features that we might want to use. Also, 5.6 is already six years old, and e.g. 7.0 was released 5 years ago already. PHP7.0 is also the default version in Debian stretch (oldstable), Debian stable already has PHP7.3.

So, upgrading would probably be feasible. What are interesting things we would gain?

@laurensmartina, @RoukePouw, Anything else to add to this list?

Currently, we document the minimal PHP version at 5.6. However, newer PHP version have interesting features that we might want to use. Also, 5.6 is already [six years old](https://en.wikipedia.org/wiki/PHP#Release_history), and e.g. 7.0 was released 5 years ago already. PHP7.0 is [also the default version in Debian stretch (oldstable)](https://packages.debian.org/search?keywords=php&searchon=names&exact=1&suite=all&section=all), Debian stable already has PHP7.3. So, upgrading would probably be feasible. What are interesting things we would gain? - More complete typing hinting (e.g. also non-class types like `int`, `string`, etc since PHP7) and `iterable` from 7.1: https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration - Return type hinting in PHP7.0 and nullable and void return type hints in PHP7.1: https://www.php.net/manual/en/functions.returning-values.php#functions.returning-values.type-declaration - The "null coalescing operator" `??` which allows simplifying things like `return isset($array[$key]) ? $array[$key] : $default` since 7.0. - List destructuring assignments with `[]`, simplifies handling multiple return values from a function, e.g. `[$a, $b] = someFunc();`. This was already possible with `list($a, $b) = someFunc();`, but since 7.0 this supports `[]` as well, and since 7.1 this supports associative arrays as well (but that is probably less readable). - 7.4 has [typed instance properties/attributes](https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.typed-properties), [arrow functions](https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.arrow-functions) (more compact anonymous functions). @laurensmartina, @RoukePouw, Anything else to add to this list?
matthijskooijman commented 2020-05-12 14:31:08 +00:00 (Migrated from github.com)

One more thing: Upgrading to 7.1 allows updating php-dom-wrapper to the latest version (since a while, we've only been backporting fixes, rather than just updating to complete new versions).

One more thing: Upgrading to 7.1 allows updating php-dom-wrapper to the latest version (since a while, we've only been backporting fixes, rather than just updating to complete new versions).
matthijskooijman commented 2020-05-15 14:27:11 +00:00 (Migrated from github.com)

PHP 7.4 also adds type annotations to class attributes, but that is only released a few months ago, so probably too new.

PHP 7.4 also adds [type annotations to class attributes](https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.typed-properties), but that is only released a few months ago, so probably too new.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
harmen/hypha#302
No description provided.