Closed thekid closed 4 years ago
Typical diff, clearly showing other libraries will need updates, too:
diff --git a/.travis.yml b/.travis.yml
index 87f5cdb..5ab646d 100755
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,6 @@ language: php
dist: trusty
php:
- - 5.6
- 7.0
- 7.1
- 7.2
diff --git a/ChangeLog.md b/ChangeLog.md
index 0156cb5..1ba7821 100755
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -3,6 +3,14 @@ Data sequences change log
## ?.?.? / ????-??-??
+## 9.0.0 / ????-??-??
+
+* Added support for XP 10 and newer versions of library dependencies
+ (@thekid)
+* Implemented xp-framework/rfc#334: Drop PHP 5.6. The minimum required
+ PHP version is now 7.0.0!
+ (@thekid)
+
## 8.0.3 / 2019-09-29
* Added PHP 7.4 compatibility - @thekid
diff --git a/composer.json b/composer.json
index 60fba7f..b638cd8 100755
--- a/composer.json
+++ b/composer.json
@@ -6,12 +6,12 @@
"description" : "Data sequences",
"keywords": ["module", "xp"],
"require" : {
- "xp-framework/core": "^9.0 | ^8.0 | ^7.0 | ^6.5",
- "xp-framework/collections": "^8.0 | ^7.0 | ^6.5",
- "php" : ">=5.6.0"
+ "xp-framework/core": "^10.0 | ^9.0 | ^8.0 | ^7.0",
+ "xp-framework/collections": "^9.0 | ^8.0 | ^7.0",
+ "php" : ">=7.0.0"
},
"require-dev" : {
- "xp-framework/unittest": "^9.0 | ^8.0 | ^7.0 | ^6.5"
+ "xp-framework/unittest": "^10.0 | ^9.0 | ^8.0 | ^7.0"
},
"autoload" : {
"files" : ["src/main/php/autoload.php"]
Group use statements via script:
<?php namespace rfc334;
use io\collections\iterate\{FilteredIOCollectionIterator, ExtensionEqualsFilter} from 'xp-framework/io-collections';
use io\collections\{FileCollection, FileElement} from 'xp-framework/io-collections';
use io\streams\LinesIn;
use util\cmd\Console;
function rewrite(FileElement $origin, FileElement $target): FileElement {
$use= [];
$out= $target->out();
foreach (new LinesIn($origin->in()) as $line) {
if (0 === strncmp($line, '<?php', 5)) {
$out->write($line);
} else if (0 === strncmp($line, 'use ', 4)) {
$type= rtrim(substr($line, 4), '; ');
$p= strrpos($type, '\\');
$namespace= substr($type, 0, $p);
if ('{' === $type[$p + 1]) {
$use[$namespace]= array_merge($use[$namespace] ?? [], preg_split('/, ?/', substr($type, $p + 2, -1)));
} else {
$use[$namespace][]= substr($type, $p + 1);
}
} else if ($use) {
ksort($use);
foreach ($use as $namespace => $classes) {
if (1 === sizeof($classes)) {
$out->write(sprintf("\nuse %s\%s;", $namespace, $classes[0]));
} else {
sort($classes);
$out->write(sprintf("\nuse %s\{%s};", $namespace, implode(', ', $classes)));
}
}
$out->write("\n");
$use= null;
} else {
$out->write("\n".$line);
}
}
$out->close();
return $target;
}
$src= new FilteredIOCollectionIterator(
new FileCollection($argv[1] ?? 'src'),
new ExtensionEqualsFilter(\xp::CLASS_FILE_EXT),
true
);
foreach ($src as $file) {
Console::write('> ', $file->getURI(), ': ');
$target= rewrite($file, $file->getOrigin()->newElement('.rewrite'));
rename($target->getURI(), $file->getURI());
Console::writeLine('OK');
}
Usage:
$ xp group-use.script.php
> ...\src\main\php\util\data\Aggregations.class.php: OK
> ...\src\main\php\util\data\CannotReset.class.php: OK
# ...
$ git diff
# ...
✅ XP Unittests https://github.com/xp-framework/unittest
✅ XP Compiler (https://github.com/xp-framework/compiler/) & plugins (https://github.com/xp-lang)
Current state:
$ grep 'xp-framework/rfc#334' */ChangeLog.md | cut -d / -f 1
ast
compiler
credentials
hashing
keepass
marshalling
neo4j
php-compact-methods
php-is-operator
php-switch-expression
redis-sessions
redis
tokenize
unittest
uri
websockets
webtest
xp-enums
24 libraries left to go
14 libraries left to go
6 libraries left to go
$ grep '>=5.6.0' */composer.json | wc -l
0
Scope of Change
This RFC suggests dropping PHP 5.6 support from all libraries.
Rationale
According to https://blog.packagist.com/php-versions-stats-2019-1-edition/ from May 2019, PHP 5 has roughly 10% market share.
Functionality
Dropping PHP 5.6 will be done in conjunction with adding support for XP 10 - see #333
Infrastructure
Code
\Exception
, replace with\Throwable
- https://wiki.php.net/rfc/throwable-interface$a ?? $default
instead ofisset($a) ? $a : $default
- see https://wiki.php.net/rfc/isset_ternarynewinstance
calls can be replaced by https://wiki.php.net/rfc/anonymous_classesyield from
can be used - see https://wiki.php.net/rfc/generator-delegation($this->callback)()
instead of temporary variablesSecurity considerations
PHP 5.6 is EOL
Speed impact
Better, we can start dropping constructs and BC code for PHP 5.
Dependencies
Major release of each and every library
Related documents