Skip to content

Commit 2a89d22

Browse files
committed
Generate files for multiple versions
tl;dr: replace ```php $function_list = read_docs(); generate_files($function_list, "../generated/"); ``` with ```php foreach(["8.1", "8.2", "8.3", "8.4"] as $version) { exec("cd docs && git checkout $version"); $function_list = read_docs(); generate_files($function_list, "../generated/$version/"); } ``` generate a bunch of stubs like generated/misc.php: ```php <?php if(PHP_VERSION == "8.1") require_once __DIR__ . "/8.1/misc.php"; if(PHP_VERSION == "8.2") require_once __DIR__ . "/8.2/misc.php"; if(PHP_VERSION == "8.3") require_once __DIR__ . "/8.3/misc.php"; if(PHP_VERSION == "8.4") require_once __DIR__ . "/8.4/misc.php"; ``` This also automates generation of "deprecated" `safe` functions (ie, instead of hard-coding `deprecated/apache.php`, any functions which needed safe wrappers in 8.1 but no longer need safe wrappers in 8.2 will have no-op stubs generated instead) Currently the `Exceptions` are shared between all versions, which I _think_ is a good idea? (Thoughts, anybody?) This isn't even remotely tested, just a proof of concept to show what this kind of approach might look like
1 parent 9d660d3 commit 2a89d22

File tree

499 files changed

+216762
-40219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

499 files changed

+216762
-40219
lines changed

composer.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,10 @@
77
"lib/DateTime.php",
88
"lib/DateTimeImmutable.php",
99
"lib/Exceptions/",
10-
"deprecated/Exceptions/",
1110
"generated/Exceptions/"
1211
],
1312
"files": [
14-
"deprecated/array.php",
15-
"deprecated/datetime.php",
16-
"deprecated/libevent.php",
17-
"deprecated/misc.php",
18-
"deprecated/password.php",
19-
"deprecated/mssql.php",
20-
"deprecated/stats.php",
21-
"deprecated/strings.php",
2213
"lib/special_cases.php",
23-
"deprecated/mysqli.php",
2414
"generated/apache.php",
2515
"generated/apcu.php",
2616
"generated/array.php",
@@ -42,6 +32,7 @@
4232
"generated/ftp.php",
4333
"generated/funchand.php",
4434
"generated/gettext.php",
35+
"generated/gmp.php",
4536
"generated/gnupg.php",
4637
"generated/hash.php",
4738
"generated/ibase.php",
@@ -59,6 +50,7 @@
5950
"generated/mbstring.php",
6051
"generated/misc.php",
6152
"generated/mysql.php",
53+
"generated/mysqli.php",
6254
"generated/network.php",
6355
"generated/oci8.php",
6456
"generated/opcache.php",
@@ -111,7 +103,7 @@
111103
"php-parallel-lint/php-parallel-lint": "^1.4"
112104
},
113105
"scripts": {
114-
"lint": "parallel-lint deprecated/ lib/ tests/",
106+
"lint": "parallel-lint lib/ tests/",
115107
"test": "phpunit",
116108
"phpstan": "phpstan analyse",
117109
"cs-fix": "phpcbf",

deprecated/Exceptions/LibeventException.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

deprecated/Exceptions/PasswordException.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

deprecated/Exceptions/StatsException.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

deprecated/array.php

Lines changed: 0 additions & 301 deletions
This file was deleted.

0 commit comments

Comments
 (0)