feat: generate the Function Runtime Catalogue from probe measurementsUnverified
Measured on php84 (PHP 8.4.28) and php85 (PHP 8.5.13) on 2026-11-22.
3c0ed4c parent: 5bab469 modified
composer.json +1 -0 | @@ -17,6 +17,7 @@ | ||
| 17 | 17 | ], |
| 18 | 18 | "require": { |
| 19 | 19 | "php": ">=8.4", |
| 20 | + "composer/semver": "^3.4", | |
| 20 | 21 | "riverline/multipart-parser": "^2.3", |
| 21 | 22 | "symfony/http-foundation": "^7.4 || ^8.0", |
| 22 | 23 | "symfony/http-kernel": "^7.4 || ^8.0", |
| @@ -17,6 +17,7 @@ | |||
| 17 | ], | 17 | ], |
| 18 | "require": { | 18 | "require": { |
| 19 | "php": ">=8.4", | 19 | "php": ">=8.4", |
| 20 | + "composer/semver": "^3.4", | ||
| 20 | "riverline/multipart-parser": "^2.3", | 21 | "riverline/multipart-parser": "^2.3", |
| 21 | "symfony/http-foundation": "^7.4 || ^8.0", | 22 | "symfony/http-foundation": "^7.4 || ^8.0", |
| 22 | "symfony/http-kernel": "^7.4 || ^8.0", | 23 | "symfony/http-kernel": "^7.4 || ^8.0", |
added
probe/catalogue.php +15 -0 | new file mode 100644 | ||
| @@ -0,0 +1,15 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +declare(strict_types=1); | |
| 4 | + | |
| 5 | +/* | |
| 6 | + * Regenerates resources/function-runtimes.php from the probe outputs in tests/Fixtures/FunctionRuntimes, | |
| 7 | + * saved with the probe's "runtime" mode: see docs/probe-results.md#function-runtime-catalogue. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +use JDecool\ScalewayRuntime\FunctionRuntimeCatalogue; | |
| 11 | + | |
| 12 | +require __DIR__.'/../vendor/autoload.php'; | |
| 13 | + | |
| 14 | +$files = glob(__DIR__.'/../tests/Fixtures/FunctionRuntimes/*.json') ?: []; | |
| 15 | +file_put_contents(FunctionRuntimeCatalogue::FILE, FunctionRuntimeCatalogue::generate(array_map(static fn (string $file): string => (string) file_get_contents($file), $files))); | |
| new file mode 100644 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +declare(strict_types=1); | ||
| 4 | + | ||
| 5 | +/* | ||
| 6 | + * Regenerates resources/function-runtimes.php from the probe outputs in tests/Fixtures/FunctionRuntimes, | ||
| 7 | + * saved with the probe's "runtime" mode: see docs/probe-results.md#function-runtime-catalogue. | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +use JDecool\ScalewayRuntime\FunctionRuntimeCatalogue; | ||
| 11 | + | ||
| 12 | +require __DIR__.'/../vendor/autoload.php'; | ||
| 13 | + | ||
| 14 | +$files = glob(__DIR__.'/../tests/Fixtures/FunctionRuntimes/*.json') ?: []; | ||
| 15 | +file_put_contents(FunctionRuntimeCatalogue::FILE, FunctionRuntimeCatalogue::generate(array_map(static fn (string $file): string => (string) file_get_contents($file), $files))); | ||
added
resources/function-runtimes.php +259 -0 | new file mode 100644 | ||
| @@ -0,0 +1,259 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +declare(strict_types=1); | |
| 4 | + | |
| 5 | +// Generated by probe/catalogue.php from tests/Fixtures/FunctionRuntimes: do not edit by hand. | |
| 6 | + | |
| 7 | +return [ | |
| 8 | + 'php84' => [ | |
| 9 | + 'measuredAt' => '2026-11-22T11:47:13Z', | |
| 10 | + 'php' => '8.4.28', | |
| 11 | + 'extensions' => [ | |
| 12 | + 'ext-amqp' => '2.2.0', | |
| 13 | + 'ext-apcu' => '5.1.28', | |
| 14 | + 'ext-ast' => '1.1.4', | |
| 15 | + 'ext-bcmath' => '8.4.28', | |
| 16 | + 'ext-bz2' => '8.4.28', | |
| 17 | + 'ext-calendar' => '8.4.28', | |
| 18 | + 'ext-csv' => '0.3.0', | |
| 19 | + 'ext-ctype' => '8.4.28', | |
| 20 | + 'ext-curl' => '8.4.28', | |
| 21 | + 'ext-date' => '8.4.28', | |
| 22 | + 'ext-dba' => '8.4.28', | |
| 23 | + 'ext-decimal' => '2.0.1', | |
| 24 | + 'ext-dom' => '20031129', | |
| 25 | + 'ext-ds' => '2.0.0', | |
| 26 | + 'ext-enchant' => '8.4.28', | |
| 27 | + 'ext-ev' => '1.3.1', | |
| 28 | + 'ext-event' => '3.2.0', | |
| 29 | + 'ext-excimer' => '1.2.6', | |
| 30 | + 'ext-exif' => '8.4.28', | |
| 31 | + 'ext-ffi' => '8.4.28', | |
| 32 | + 'ext-fileinfo' => '8.4.28', | |
| 33 | + 'ext-filter' => '8.4.28', | |
| 34 | + 'ext-gd' => '8.4.28', | |
| 35 | + 'ext-geospatial' => '0.3.5', | |
| 36 | + 'ext-gettext' => '8.4.28', | |
| 37 | + 'ext-gmp' => '8.4.28', | |
| 38 | + 'ext-gnupg' => '1.5.4', | |
| 39 | + 'ext-grpc' => '1.85.0', | |
| 40 | + 'ext-hash' => '8.4.28', | |
| 41 | + 'ext-iconv' => '8.4.28', | |
| 42 | + 'ext-igbinary' => '3.2.17RC1', | |
| 43 | + 'ext-imap' => '1.0.3', | |
| 44 | + 'ext-inotify' => '3.0.1', | |
| 45 | + 'ext-intl' => '8.4.28', | |
| 46 | + 'ext-ion' => '0.2.1', | |
| 47 | + 'ext-json' => '8.4.28', | |
| 48 | + 'ext-json_post' => '1.1.0', | |
| 49 | + 'ext-ldap' => '8.4.28', | |
| 50 | + 'ext-libsmbclient' => '1.2.0dev', | |
| 51 | + 'ext-libxml' => '8.4.28', | |
| 52 | + 'ext-luasandbox' => '4.1.3', | |
| 53 | + 'ext-lz4' => '0.4.3', | |
| 54 | + 'ext-lzf' => '1.7.0', | |
| 55 | + 'ext-mailparse' => '3.2.0', | |
| 56 | + 'ext-maxminddb' => '1.15.0', | |
| 57 | + 'ext-mbstring' => '8.4.28', | |
| 58 | + 'ext-memcache' => '8.2', | |
| 59 | + 'ext-memcached' => '3.4.0', | |
| 60 | + 'ext-mongodb' => '2.5.8', | |
| 61 | + 'ext-msgpack' => '3.0.1', | |
| 62 | + 'ext-mysqli' => '8.4.28', | |
| 63 | + 'ext-mysqlnd' => '0', | |
| 64 | + 'ext-oauth' => '2.0.10', | |
| 65 | + 'ext-oci8' => '3.4.1', | |
| 66 | + 'ext-odbc' => '8.4.28', | |
| 67 | + 'ext-openssl' => '8.4.28', | |
| 68 | + 'ext-parle' => '0.8.5', | |
| 69 | + 'ext-pcntl' => '8.4.28', | |
| 70 | + 'ext-pcov' => '1.0.12', | |
| 71 | + 'ext-pcre' => '8.4.28', | |
| 72 | + 'ext-pdo' => '8.4.28', | |
| 73 | + 'ext-pdo_dblib' => '8.4.28', | |
| 74 | + 'ext-pdo_firebird' => '8.4.28', | |
| 75 | + 'ext-pdo_mysql' => '8.4.28', | |
| 76 | + 'ext-pdo_oci' => '1.2.0', | |
| 77 | + 'ext-pdo_odbc' => '8.4.28', | |
| 78 | + 'ext-pdo_pgsql' => '8.4.28', | |
| 79 | + 'ext-pdo_sqlite' => '8.4.28', | |
| 80 | + 'ext-pdo_sqlsrv' => '5.13.3', | |
| 81 | + 'ext-pgsql' => '8.4.28', | |
| 82 | + 'ext-phar' => '8.4.28', | |
| 83 | + 'ext-php_trie' => '0.1.2', | |
| 84 | + 'ext-posix' => '8.4.28', | |
| 85 | + 'ext-protobuf' => '5.36.2', | |
| 86 | + 'ext-pspell' => '1.0.1', | |
| 87 | + 'ext-random' => '8.4.28', | |
| 88 | + 'ext-rdkafka' => '6.0.5', | |
| 89 | + 'ext-readline' => '8.4.28', | |
| 90 | + 'ext-redis' => '6.3.0', | |
| 91 | + 'ext-reflection' => '8.4.28', | |
| 92 | + 'ext-session' => '8.4.28', | |
| 93 | + 'ext-shmop' => '8.4.28', | |
| 94 | + 'ext-simdjson' => '4.0.0', | |
| 95 | + 'ext-simplexml' => '8.4.28', | |
| 96 | + 'ext-smbclient' => '1.2.0dev', | |
| 97 | + 'ext-snappy' => '0.2.1', | |
| 98 | + 'ext-snmp' => '8.4.28', | |
| 99 | + 'ext-soap' => '8.4.28', | |
| 100 | + 'ext-sockets' => '8.4.28', | |
| 101 | + 'ext-sodium' => '8.4.28', | |
| 102 | + 'ext-solr' => '2.9.3', | |
| 103 | + 'ext-spl' => '8.4.28', | |
| 104 | + 'ext-spx' => '0.4.21', | |
| 105 | + 'ext-sqlite3' => '8.4.28', | |
| 106 | + 'ext-sqlsrv' => '5.13.3', | |
| 107 | + 'ext-ssh2' => '1.6.1', | |
| 108 | + 'ext-stomp' => '2.0.3', | |
| 109 | + 'ext-sysvmsg' => '8.4.28', | |
| 110 | + 'ext-sysvsem' => '8.4.28', | |
| 111 | + 'ext-sysvshm' => '8.4.28', | |
| 112 | + 'ext-tidy' => '8.4.28', | |
| 113 | + 'ext-timezonedb' => '2026.6', | |
| 114 | + 'ext-tokenizer' => '8.4.28', | |
| 115 | + 'ext-uploadprogress' => '2.0.2', | |
| 116 | + 'ext-uuid' => '1.3.0', | |
| 117 | + 'ext-vips' => '1.0.13', | |
| 118 | + 'ext-xdiff' => '2.2.0', | |
| 119 | + 'ext-xlswriter' => '3.0.0', | |
| 120 | + 'ext-xml' => '8.4.28', | |
| 121 | + 'ext-xmldiff' => '1.1.6', | |
| 122 | + 'ext-xmlreader' => '8.4.28', | |
| 123 | + 'ext-xmlrpc' => '1.0.0RC3', | |
| 124 | + 'ext-xmlwriter' => '8.4.28', | |
| 125 | + 'ext-xsl' => '8.4.28', | |
| 126 | + 'ext-yac' => '3.0.2', | |
| 127 | + 'ext-yaml' => '2.3.0', | |
| 128 | + 'ext-zend-opcache' => '8.4.28', | |
| 129 | + 'ext-zephir_parser' => '2.11.0', | |
| 130 | + 'ext-zip' => '1.22.8', | |
| 131 | + 'ext-zlib' => '8.4.28', | |
| 132 | + 'ext-zstd' => '0.18.0', | |
| 133 | + ], | |
| 134 | + ], | |
| 135 | + 'php85' => [ | |
| 136 | + 'measuredAt' => '2026-11-22T11:44:54Z', | |
| 137 | + 'php' => '8.5.13', | |
| 138 | + 'extensions' => [ | |
| 139 | + 'ext-amqp' => '2.2.0', | |
| 140 | + 'ext-apcu' => '5.1.28', | |
| 141 | + 'ext-ast' => '1.1.4', | |
| 142 | + 'ext-bcmath' => '8.5.13', | |
| 143 | + 'ext-bz2' => '8.5.13', | |
| 144 | + 'ext-calendar' => '8.5.13', | |
| 145 | + 'ext-csv' => '0.3.0', | |
| 146 | + 'ext-ctype' => '8.5.13', | |
| 147 | + 'ext-curl' => '8.5.13', | |
| 148 | + 'ext-date' => '8.5.13', | |
| 149 | + 'ext-dba' => '8.5.13', | |
| 150 | + 'ext-decimal' => '2.0.1', | |
| 151 | + 'ext-dom' => '20031129', | |
| 152 | + 'ext-ds' => '2.0.0', | |
| 153 | + 'ext-enchant' => '8.5.13', | |
| 154 | + 'ext-ev' => '1.3.1', | |
| 155 | + 'ext-event' => '3.2.0', | |
| 156 | + 'ext-excimer' => '1.2.6', | |
| 157 | + 'ext-exif' => '8.5.13', | |
| 158 | + 'ext-ffi' => '8.5.13', | |
| 159 | + 'ext-fileinfo' => '8.5.13', | |
| 160 | + 'ext-filter' => '8.5.13', | |
| 161 | + 'ext-gd' => '8.5.13', | |
| 162 | + 'ext-gettext' => '8.5.13', | |
| 163 | + 'ext-gmp' => '8.5.13', | |
| 164 | + 'ext-gnupg' => '1.5.4', | |
| 165 | + 'ext-grpc' => '1.85.0', | |
| 166 | + 'ext-hash' => '8.5.13', | |
| 167 | + 'ext-iconv' => '8.5.13', | |
| 168 | + 'ext-igbinary' => '3.2.17RC1', | |
| 169 | + 'ext-imap' => '1.0.3', | |
| 170 | + 'ext-inotify' => '3.0.1', | |
| 171 | + 'ext-intl' => '8.5.13', | |
| 172 | + 'ext-ion' => '0.2.1', | |
| 173 | + 'ext-json' => '8.5.13', | |
| 174 | + 'ext-json_post' => '1.1.0', | |
| 175 | + 'ext-ldap' => '8.5.13', | |
| 176 | + 'ext-lexbor' => '8.5.13', | |
| 177 | + 'ext-libsmbclient' => '1.2.0dev', | |
| 178 | + 'ext-libxml' => '8.5.13', | |
| 179 | + 'ext-luasandbox' => '4.1.3', | |
| 180 | + 'ext-lz4' => '0.4.3', | |
| 181 | + 'ext-lzf' => '1.7.0', | |
| 182 | + 'ext-mailparse' => '3.2.0', | |
| 183 | + 'ext-maxminddb' => '1.15.0', | |
| 184 | + 'ext-mbstring' => '8.5.13', | |
| 185 | + 'ext-memcached' => '3.4.0', | |
| 186 | + 'ext-mongodb' => '2.5.8', | |
| 187 | + 'ext-msgpack' => '3.0.1', | |
| 188 | + 'ext-mysqli' => '8.5.13', | |
| 189 | + 'ext-mysqlnd' => '0', | |
| 190 | + 'ext-oauth' => '2.0.10', | |
| 191 | + 'ext-oci8' => '3.4.1', | |
| 192 | + 'ext-odbc' => '8.5.13', | |
| 193 | + 'ext-openssl' => '8.5.13', | |
| 194 | + 'ext-pcntl' => '8.5.13', | |
| 195 | + 'ext-pcov' => '1.0.12', | |
| 196 | + 'ext-pcre' => '8.5.13', | |
| 197 | + 'ext-pdo' => '8.5.13', | |
| 198 | + 'ext-pdo_dblib' => '8.5.13', | |
| 199 | + 'ext-pdo_firebird' => '8.5.13', | |
| 200 | + 'ext-pdo_mysql' => '8.5.13', | |
| 201 | + 'ext-pdo_oci' => '1.2.0', | |
| 202 | + 'ext-pdo_odbc' => '8.5.13', | |
| 203 | + 'ext-pdo_pgsql' => '8.5.13', | |
| 204 | + 'ext-pdo_sqlite' => '8.5.13', | |
| 205 | + 'ext-pdo_sqlsrv' => '5.13.3', | |
| 206 | + 'ext-pgsql' => '8.5.13', | |
| 207 | + 'ext-phar' => '8.5.13', | |
| 208 | + 'ext-posix' => '8.5.13', | |
| 209 | + 'ext-protobuf' => '5.36.2', | |
| 210 | + 'ext-pspell' => '1.0.1', | |
| 211 | + 'ext-random' => '8.5.13', | |
| 212 | + 'ext-rdkafka' => '6.0.5', | |
| 213 | + 'ext-readline' => '8.5.13', | |
| 214 | + 'ext-redis' => '6.3.0', | |
| 215 | + 'ext-reflection' => '8.5.13', | |
| 216 | + 'ext-session' => '8.5.13', | |
| 217 | + 'ext-shmop' => '8.5.13', | |
| 218 | + 'ext-simdjson' => '4.0.0', | |
| 219 | + 'ext-simplexml' => '8.5.13', | |
| 220 | + 'ext-smbclient' => '1.2.0dev', | |
| 221 | + 'ext-snappy' => '0.2.1', | |
| 222 | + 'ext-snmp' => '8.5.13', | |
| 223 | + 'ext-soap' => '8.5.13', | |
| 224 | + 'ext-sockets' => '8.5.13', | |
| 225 | + 'ext-sodium' => '8.5.13', | |
| 226 | + 'ext-solr' => '2.9.3', | |
| 227 | + 'ext-spl' => '8.5.13', | |
| 228 | + 'ext-spx' => '0.4.21', | |
| 229 | + 'ext-sqlite3' => '8.5.13', | |
| 230 | + 'ext-sqlsrv' => '5.13.3', | |
| 231 | + 'ext-ssh2' => '1.6.1', | |
| 232 | + 'ext-sysvmsg' => '8.5.13', | |
| 233 | + 'ext-sysvsem' => '8.5.13', | |
| 234 | + 'ext-sysvshm' => '8.5.13', | |
| 235 | + 'ext-tidy' => '8.5.13', | |
| 236 | + 'ext-timezonedb' => '2026.6', | |
| 237 | + 'ext-tokenizer' => '8.5.13', | |
| 238 | + 'ext-uploadprogress' => '2.0.2', | |
| 239 | + 'ext-uri' => '8.5.13', | |
| 240 | + 'ext-uuid' => '1.3.0', | |
| 241 | + 'ext-vips' => '1.0.13', | |
| 242 | + 'ext-xdiff' => '2.2.0', | |
| 243 | + 'ext-xlswriter' => '3.0.0', | |
| 244 | + 'ext-xml' => '8.5.13', | |
| 245 | + 'ext-xmldiff' => '1.1.6', | |
| 246 | + 'ext-xmlreader' => '8.5.13', | |
| 247 | + 'ext-xmlrpc' => '1.0.0RC3', | |
| 248 | + 'ext-xmlwriter' => '8.5.13', | |
| 249 | + 'ext-xsl' => '8.5.13', | |
| 250 | + 'ext-yac' => '3.0.2', | |
| 251 | + 'ext-yaml' => '2.3.0', | |
| 252 | + 'ext-zend-opcache' => '8.5.13', | |
| 253 | + 'ext-zephir_parser' => '2.11.0', | |
| 254 | + 'ext-zip' => '1.22.8', | |
| 255 | + 'ext-zlib' => '8.5.13', | |
| 256 | + 'ext-zstd' => '0.18.0', | |
| 257 | + ], | |
| 258 | + ], | |
| 259 | +]; | |
| new file mode 100644 | |||
| @@ -0,0 +1,259 @@ | |||
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +declare(strict_types=1); | ||
| 4 | + | ||
| 5 | +// Generated by probe/catalogue.php from tests/Fixtures/FunctionRuntimes: do not edit by hand. | ||
| 6 | + | ||
| 7 | +return [ | ||
| 8 | + 'php84' => [ | ||
| 9 | + 'measuredAt' => '2026-11-22T11:47:13Z', | ||
| 10 | + 'php' => '8.4.28', | ||
| 11 | + 'extensions' => [ | ||
| 12 | + 'ext-amqp' => '2.2.0', | ||
| 13 | + 'ext-apcu' => '5.1.28', | ||
| 14 | + 'ext-ast' => '1.1.4', | ||
| 15 | + 'ext-bcmath' => '8.4.28', | ||
| 16 | + 'ext-bz2' => '8.4.28', | ||
| 17 | + 'ext-calendar' => '8.4.28', | ||
| 18 | + 'ext-csv' => '0.3.0', | ||
| 19 | + 'ext-ctype' => '8.4.28', | ||
| 20 | + 'ext-curl' => '8.4.28', | ||
| 21 | + 'ext-date' => '8.4.28', | ||
| 22 | + 'ext-dba' => '8.4.28', | ||
| 23 | + 'ext-decimal' => '2.0.1', | ||
| 24 | + 'ext-dom' => '20031129', | ||
| 25 | + 'ext-ds' => '2.0.0', | ||
| 26 | + 'ext-enchant' => '8.4.28', | ||
| 27 | + 'ext-ev' => '1.3.1', | ||
| 28 | + 'ext-event' => '3.2.0', | ||
| 29 | + 'ext-excimer' => '1.2.6', | ||
| 30 | + 'ext-exif' => '8.4.28', | ||
| 31 | + 'ext-ffi' => '8.4.28', | ||
| 32 | + 'ext-fileinfo' => '8.4.28', | ||
| 33 | + 'ext-filter' => '8.4.28', | ||
| 34 | + 'ext-gd' => '8.4.28', | ||
| 35 | + 'ext-geospatial' => '0.3.5', | ||
| 36 | + 'ext-gettext' => '8.4.28', | ||
| 37 | + 'ext-gmp' => '8.4.28', | ||
| 38 | + 'ext-gnupg' => '1.5.4', | ||
| 39 | + 'ext-grpc' => '1.85.0', | ||
| 40 | + 'ext-hash' => '8.4.28', | ||
| 41 | + 'ext-iconv' => '8.4.28', | ||
| 42 | + 'ext-igbinary' => '3.2.17RC1', | ||
| 43 | + 'ext-imap' => '1.0.3', | ||
| 44 | + 'ext-inotify' => '3.0.1', | ||
| 45 | + 'ext-intl' => '8.4.28', | ||
| 46 | + 'ext-ion' => '0.2.1', | ||
| 47 | + 'ext-json' => '8.4.28', | ||
| 48 | + 'ext-json_post' => '1.1.0', | ||
| 49 | + 'ext-ldap' => '8.4.28', | ||
| 50 | + 'ext-libsmbclient' => '1.2.0dev', | ||
| 51 | + 'ext-libxml' => '8.4.28', | ||
| 52 | + 'ext-luasandbox' => '4.1.3', | ||
| 53 | + 'ext-lz4' => '0.4.3', | ||
| 54 | + 'ext-lzf' => '1.7.0', | ||
| 55 | + 'ext-mailparse' => '3.2.0', | ||
| 56 | + 'ext-maxminddb' => '1.15.0', | ||
| 57 | + 'ext-mbstring' => '8.4.28', | ||
| 58 | + 'ext-memcache' => '8.2', | ||
| 59 | + 'ext-memcached' => '3.4.0', | ||
| 60 | + 'ext-mongodb' => '2.5.8', | ||
| 61 | + 'ext-msgpack' => '3.0.1', | ||
| 62 | + 'ext-mysqli' => '8.4.28', | ||
| 63 | + 'ext-mysqlnd' => '0', | ||
| 64 | + 'ext-oauth' => '2.0.10', | ||
| 65 | + 'ext-oci8' => '3.4.1', | ||
| 66 | + 'ext-odbc' => '8.4.28', | ||
| 67 | + 'ext-openssl' => '8.4.28', | ||
| 68 | + 'ext-parle' => '0.8.5', | ||
| 69 | + 'ext-pcntl' => '8.4.28', | ||
| 70 | + 'ext-pcov' => '1.0.12', | ||
| 71 | + 'ext-pcre' => '8.4.28', | ||
| 72 | + 'ext-pdo' => '8.4.28', | ||
| 73 | + 'ext-pdo_dblib' => '8.4.28', | ||
| 74 | + 'ext-pdo_firebird' => '8.4.28', | ||
| 75 | + 'ext-pdo_mysql' => '8.4.28', | ||
| 76 | + 'ext-pdo_oci' => '1.2.0', | ||
| 77 | + 'ext-pdo_odbc' => '8.4.28', | ||
| 78 | + 'ext-pdo_pgsql' => '8.4.28', | ||
| 79 | + 'ext-pdo_sqlite' => '8.4.28', | ||
| 80 | + 'ext-pdo_sqlsrv' => '5.13.3', | ||
| 81 | + 'ext-pgsql' => '8.4.28', | ||
| 82 | + 'ext-phar' => '8.4.28', | ||
| 83 | + 'ext-php_trie' => '0.1.2', | ||
| 84 | + 'ext-posix' => '8.4.28', | ||
| 85 | + 'ext-protobuf' => '5.36.2', | ||
| 86 | + 'ext-pspell' => '1.0.1', | ||
| 87 | + 'ext-random' => '8.4.28', | ||
| 88 | + 'ext-rdkafka' => '6.0.5', | ||
| 89 | + 'ext-readline' => '8.4.28', | ||
| 90 | + 'ext-redis' => '6.3.0', | ||
| 91 | + 'ext-reflection' => '8.4.28', | ||
| 92 | + 'ext-session' => '8.4.28', | ||
| 93 | + 'ext-shmop' => '8.4.28', | ||
| 94 | + 'ext-simdjson' => '4.0.0', | ||
| 95 | + 'ext-simplexml' => '8.4.28', | ||
| 96 | + 'ext-smbclient' => '1.2.0dev', | ||
| 97 | + 'ext-snappy' => '0.2.1', | ||
| 98 | + 'ext-snmp' => '8.4.28', | ||
| 99 | + 'ext-soap' => '8.4.28', | ||
| 100 | + 'ext-sockets' => '8.4.28', | ||
| 101 | + 'ext-sodium' => '8.4.28', | ||
| 102 | + 'ext-solr' => '2.9.3', | ||
| 103 | + 'ext-spl' => '8.4.28', | ||
| 104 | + 'ext-spx' => '0.4.21', | ||
| 105 | + 'ext-sqlite3' => '8.4.28', | ||
| 106 | + 'ext-sqlsrv' => '5.13.3', | ||
| 107 | + 'ext-ssh2' => '1.6.1', | ||
| 108 | + 'ext-stomp' => '2.0.3', | ||
| 109 | + 'ext-sysvmsg' => '8.4.28', | ||
| 110 | + 'ext-sysvsem' => '8.4.28', | ||
| 111 | + 'ext-sysvshm' => '8.4.28', | ||
| 112 | + 'ext-tidy' => '8.4.28', | ||
| 113 | + 'ext-timezonedb' => '2026.6', | ||
| 114 | + 'ext-tokenizer' => '8.4.28', | ||
| 115 | + 'ext-uploadprogress' => '2.0.2', | ||
| 116 | + 'ext-uuid' => '1.3.0', | ||
| 117 | + 'ext-vips' => '1.0.13', | ||
| 118 | + 'ext-xdiff' => '2.2.0', | ||
| 119 | + 'ext-xlswriter' => '3.0.0', | ||
| 120 | + 'ext-xml' => '8.4.28', | ||
| 121 | + 'ext-xmldiff' => '1.1.6', | ||
| 122 | + 'ext-xmlreader' => '8.4.28', | ||
| 123 | + 'ext-xmlrpc' => '1.0.0RC3', | ||
| 124 | + 'ext-xmlwriter' => '8.4.28', | ||
| 125 | + 'ext-xsl' => '8.4.28', | ||
| 126 | + 'ext-yac' => '3.0.2', | ||
| 127 | + 'ext-yaml' => '2.3.0', | ||
| 128 | + 'ext-zend-opcache' => '8.4.28', | ||
| 129 | + 'ext-zephir_parser' => '2.11.0', | ||
| 130 | + 'ext-zip' => '1.22.8', | ||
| 131 | + 'ext-zlib' => '8.4.28', | ||
| 132 | + 'ext-zstd' => '0.18.0', | ||
| 133 | + ], | ||
| 134 | + ], | ||
| 135 | + 'php85' => [ | ||
| 136 | + 'measuredAt' => '2026-11-22T11:44:54Z', | ||
| 137 | + 'php' => '8.5.13', | ||
| 138 | + 'extensions' => [ | ||
| 139 | + 'ext-amqp' => '2.2.0', | ||
| 140 | + 'ext-apcu' => '5.1.28', | ||
| 141 | + 'ext-ast' => '1.1.4', | ||
| 142 | + 'ext-bcmath' => '8.5.13', | ||
| 143 | + 'ext-bz2' => '8.5.13', | ||
| 144 | + 'ext-calendar' => '8.5.13', | ||
| 145 | + 'ext-csv' => '0.3.0', | ||
| 146 | + 'ext-ctype' => '8.5.13', | ||
| 147 | + 'ext-curl' => '8.5.13', | ||
| 148 | + 'ext-date' => '8.5.13', | ||
| 149 | + 'ext-dba' => '8.5.13', | ||
| 150 | + 'ext-decimal' => '2.0.1', | ||
| 151 | + 'ext-dom' => '20031129', | ||
| 152 | + 'ext-ds' => '2.0.0', | ||
| 153 | + 'ext-enchant' => '8.5.13', | ||
| 154 | + 'ext-ev' => '1.3.1', | ||
| 155 | + 'ext-event' => '3.2.0', | ||
| 156 | + 'ext-excimer' => '1.2.6', | ||
| 157 | + 'ext-exif' => '8.5.13', | ||
| 158 | + 'ext-ffi' => '8.5.13', | ||
| 159 | + 'ext-fileinfo' => '8.5.13', | ||
| 160 | + 'ext-filter' => '8.5.13', | ||
| 161 | + 'ext-gd' => '8.5.13', | ||
| 162 | + 'ext-gettext' => '8.5.13', | ||
| 163 | + 'ext-gmp' => '8.5.13', | ||
| 164 | + 'ext-gnupg' => '1.5.4', | ||
| 165 | + 'ext-grpc' => '1.85.0', | ||
| 166 | + 'ext-hash' => '8.5.13', | ||
| 167 | + 'ext-iconv' => '8.5.13', | ||
| 168 | + 'ext-igbinary' => '3.2.17RC1', | ||
| 169 | + 'ext-imap' => '1.0.3', | ||
| 170 | + 'ext-inotify' => '3.0.1', | ||
| 171 | + 'ext-intl' => '8.5.13', | ||
| 172 | + 'ext-ion' => '0.2.1', | ||
| 173 | + 'ext-json' => '8.5.13', | ||
| 174 | + 'ext-json_post' => '1.1.0', | ||
| 175 | + 'ext-ldap' => '8.5.13', | ||
| 176 | + 'ext-lexbor' => '8.5.13', | ||
| 177 | + 'ext-libsmbclient' => '1.2.0dev', | ||
| 178 | + 'ext-libxml' => '8.5.13', | ||
| 179 | + 'ext-luasandbox' => '4.1.3', | ||
| 180 | + 'ext-lz4' => '0.4.3', | ||
| 181 | + 'ext-lzf' => '1.7.0', | ||
| 182 | + 'ext-mailparse' => '3.2.0', | ||
| 183 | + 'ext-maxminddb' => '1.15.0', | ||
| 184 | + 'ext-mbstring' => '8.5.13', | ||
| 185 | + 'ext-memcached' => '3.4.0', | ||
| 186 | + 'ext-mongodb' => '2.5.8', | ||
| 187 | + 'ext-msgpack' => '3.0.1', | ||
| 188 | + 'ext-mysqli' => '8.5.13', | ||
| 189 | + 'ext-mysqlnd' => '0', | ||
| 190 | + 'ext-oauth' => '2.0.10', | ||
| 191 | + 'ext-oci8' => '3.4.1', | ||
| 192 | + 'ext-odbc' => '8.5.13', | ||
| 193 | + 'ext-openssl' => '8.5.13', | ||
| 194 | + 'ext-pcntl' => '8.5.13', | ||
| 195 | + 'ext-pcov' => '1.0.12', | ||
| 196 | + 'ext-pcre' => '8.5.13', | ||
| 197 | + 'ext-pdo' => '8.5.13', | ||
| 198 | + 'ext-pdo_dblib' => '8.5.13', | ||
| 199 | + 'ext-pdo_firebird' => '8.5.13', | ||
| 200 | + 'ext-pdo_mysql' => '8.5.13', | ||
| 201 | + 'ext-pdo_oci' => '1.2.0', | ||
| 202 | + 'ext-pdo_odbc' => '8.5.13', | ||
| 203 | + 'ext-pdo_pgsql' => '8.5.13', | ||
| 204 | + 'ext-pdo_sqlite' => '8.5.13', | ||
| 205 | + 'ext-pdo_sqlsrv' => '5.13.3', | ||
| 206 | + 'ext-pgsql' => '8.5.13', | ||
| 207 | + 'ext-phar' => '8.5.13', | ||
| 208 | + 'ext-posix' => '8.5.13', | ||
| 209 | + 'ext-protobuf' => '5.36.2', | ||
| 210 | + 'ext-pspell' => '1.0.1', | ||
| 211 | + 'ext-random' => '8.5.13', | ||
| 212 | + 'ext-rdkafka' => '6.0.5', | ||
| 213 | + 'ext-readline' => '8.5.13', | ||
| 214 | + 'ext-redis' => '6.3.0', | ||
| 215 | + 'ext-reflection' => '8.5.13', | ||
| 216 | + 'ext-session' => '8.5.13', | ||
| 217 | + 'ext-shmop' => '8.5.13', | ||
| 218 | + 'ext-simdjson' => '4.0.0', | ||
| 219 | + 'ext-simplexml' => '8.5.13', | ||
| 220 | + 'ext-smbclient' => '1.2.0dev', | ||
| 221 | + 'ext-snappy' => '0.2.1', | ||
| 222 | + 'ext-snmp' => '8.5.13', | ||
| 223 | + 'ext-soap' => '8.5.13', | ||
| 224 | + 'ext-sockets' => '8.5.13', | ||
| 225 | + 'ext-sodium' => '8.5.13', | ||
| 226 | + 'ext-solr' => '2.9.3', | ||
| 227 | + 'ext-spl' => '8.5.13', | ||
| 228 | + 'ext-spx' => '0.4.21', | ||
| 229 | + 'ext-sqlite3' => '8.5.13', | ||
| 230 | + 'ext-sqlsrv' => '5.13.3', | ||
| 231 | + 'ext-ssh2' => '1.6.1', | ||
| 232 | + 'ext-sysvmsg' => '8.5.13', | ||
| 233 | + 'ext-sysvsem' => '8.5.13', | ||
| 234 | + 'ext-sysvshm' => '8.5.13', | ||
| 235 | + 'ext-tidy' => '8.5.13', | ||
| 236 | + 'ext-timezonedb' => '2026.6', | ||
| 237 | + 'ext-tokenizer' => '8.5.13', | ||
| 238 | + 'ext-uploadprogress' => '2.0.2', | ||
| 239 | + 'ext-uri' => '8.5.13', | ||
| 240 | + 'ext-uuid' => '1.3.0', | ||
| 241 | + 'ext-vips' => '1.0.13', | ||
| 242 | + 'ext-xdiff' => '2.2.0', | ||
| 243 | + 'ext-xlswriter' => '3.0.0', | ||
| 244 | + 'ext-xml' => '8.5.13', | ||
| 245 | + 'ext-xmldiff' => '1.1.6', | ||
| 246 | + 'ext-xmlreader' => '8.5.13', | ||
| 247 | + 'ext-xmlrpc' => '1.0.0RC3', | ||
| 248 | + 'ext-xmlwriter' => '8.5.13', | ||
| 249 | + 'ext-xsl' => '8.5.13', | ||
| 250 | + 'ext-yac' => '3.0.2', | ||
| 251 | + 'ext-yaml' => '2.3.0', | ||
| 252 | + 'ext-zend-opcache' => '8.5.13', | ||
| 253 | + 'ext-zephir_parser' => '2.11.0', | ||
| 254 | + 'ext-zip' => '1.22.8', | ||
| 255 | + 'ext-zlib' => '8.5.13', | ||
| 256 | + 'ext-zstd' => '0.18.0', | ||
| 257 | + ], | ||
| 258 | + ], | ||
| 259 | +]; | ||
added
src/FunctionRuntimeCatalogue.php +129 -0 | new file mode 100644 | ||
| @@ -0,0 +1,129 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +declare(strict_types=1); | |
| 4 | + | |
| 5 | +namespace JDecool\ScalewayRuntime; | |
| 6 | + | |
| 7 | +use Composer\Semver\VersionParser; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * The PHP version and the extensions measured on each supported Function Runtime, named and versioned as Composer sees | |
| 11 | + * them there, generated from the probe's output (see docs/probe-results.md#function-runtime-catalogue). | |
| 12 | + * | |
| 13 | + * @phpstan-type FunctionRuntime array{measuredAt: string, php: string, extensions: array<string, string>} | |
| 14 | + */ | |
| 15 | +final readonly class FunctionRuntimeCatalogue | |
| 16 | +{ | |
| 17 | + public const string FILE = __DIR__.'/../resources/function-runtimes.php'; | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * @param array<string, FunctionRuntime> $functionRuntimes by name, as "php84" | |
| 21 | + */ | |
| 22 | + public function __construct( | |
| 23 | + public array $functionRuntimes, | |
| 24 | + ) { | |
| 25 | + } | |
| 26 | + | |
| 27 | + public static function load(): self | |
| 28 | + { | |
| 29 | + /** @var array<string, FunctionRuntime> $functionRuntimes */ | |
| 30 | + $functionRuntimes = require self::FILE; | |
| 31 | + | |
| 32 | + return new self($functionRuntimes); | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * @return FunctionRuntime | |
| 37 | + */ | |
| 38 | + public function get(string $name): array | |
| 39 | + { | |
| 40 | + return $this->functionRuntimes[$name] ?? throw new \InvalidArgumentException(\sprintf('"%s" is not a measured Function Runtime: use %s.', $name, implode(' or ', array_keys($this->functionRuntimes)))); | |
| 41 | + } | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * Turns the outputs of the probe's "runtime" mode into the catalogue file. PHP and its extensions get the names and | |
| 45 | + * versions of Composer's PlatformRepository, so that constraints are evaluated as Scaleway's "composer install" does. | |
| 46 | + * | |
| 47 | + * @param list<string> $probeOutputs | |
| 48 | + */ | |
| 49 | + public static function generate(array $probeOutputs): string | |
| 50 | + { | |
| 51 | + $parser = new VersionParser(); | |
| 52 | + $functionRuntimes = []; | |
| 53 | + foreach ($probeOutputs as $json) { | |
| 54 | + $measurement = json_decode($json, true, 512, \JSON_THROW_ON_ERROR); | |
| 55 | + if (!\is_array($measurement) || !\is_string($measuredAt = $measurement['measuredAt'] ?? null) || !\is_string($php = $measurement['phpVersion'] ?? null) || !\is_array($extensions = $measurement['extensions'] ?? null)) { | |
| 56 | + throw new \UnexpectedValueException('A probe output must hold "measuredAt", "phpVersion" and "extensions".'); | |
| 57 | + } | |
| 58 | + // Scaleway names its Function Runtimes after the PHP minor version. | |
| 59 | + if (1 !== preg_match('/^(\d+)\.(\d+)\./', $php, $match)) { | |
| 60 | + throw new \UnexpectedValueException(\sprintf('"%s" is not a PHP version.', $php)); | |
| 61 | + } | |
| 62 | + $name = 'php'.$match[1].$match[2]; | |
| 63 | + if (isset($functionRuntimes[$name])) { | |
| 64 | + throw new \UnexpectedValueException(\sprintf('Two probe outputs measure %s: keep one.', $name)); | |
| 65 | + } | |
| 66 | + | |
| 67 | + $versions = []; | |
| 68 | + foreach ($extensions as $extension => $version) { | |
| 69 | + // Composer does not register these two as packages. | |
| 70 | + if (\in_array($extension, ['Core', 'standard'], true)) { | |
| 71 | + continue; | |
| 72 | + } | |
| 73 | + $versions['ext-'.str_replace(' ', '-', strtolower((string) $extension))] = self::composerVersion($parser, \is_string($version) ? $version : '0'); | |
| 74 | + } | |
| 75 | + ksort($versions); | |
| 76 | + | |
| 77 | + $functionRuntimes[$name] = [ | |
| 78 | + 'measuredAt' => $measuredAt, | |
| 79 | + 'php' => self::composerPhpVersion($parser, $php), | |
| 80 | + 'extensions' => $versions, | |
| 81 | + ]; | |
| 82 | + } | |
| 83 | + ksort($functionRuntimes); | |
| 84 | + | |
| 85 | + return "<?php\n\ndeclare(strict_types=1);\n\n// Generated by probe/catalogue.php from tests/Fixtures/FunctionRuntimes: do not edit by hand.\n\nreturn ".self::export($functionRuntimes, '').";\n"; | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * Composer keeps a parseable PHP_VERSION whole, so that "8.5.0-RC1" stays a pre-release, and cuts the others, as | |
| 90 | + * "8.4.28-1+deb12", before their first "~", "+" or "-". | |
| 91 | + */ | |
| 92 | + private static function composerPhpVersion(VersionParser $parser, string $version): string | |
| 93 | + { | |
| 94 | + try { | |
| 95 | + $parser->normalize($version); | |
| 96 | + | |
| 97 | + return $version; | |
| 98 | + } catch (\UnexpectedValueException) { | |
| 99 | + return (string) preg_replace('/^([^~+-]+).*$/', '$1', $version); | |
| 100 | + } | |
| 101 | + } | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * Composer's fallback for a version it cannot parse, as "mysqlnd 8.4.28": its leading digits, or "0". | |
| 105 | + */ | |
| 106 | + private static function composerVersion(VersionParser $parser, string $version): string | |
| 107 | + { | |
| 108 | + try { | |
| 109 | + $parser->normalize($version); | |
| 110 | + | |
| 111 | + return $version; | |
| 112 | + } catch (\UnexpectedValueException) { | |
| 113 | + return 1 === preg_match('/^(\d+\.\d+\.\d+(?:\.\d+)?)/', $version, $match) ? $match[1] : '0'; | |
| 114 | + } | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * @param array<mixed> $values | |
| 119 | + */ | |
| 120 | + private static function export(array $values, string $indent): string | |
| 121 | + { | |
| 122 | + $lines = []; | |
| 123 | + foreach ($values as $key => $value) { | |
| 124 | + $lines[] = $indent.' '.var_export($key, true).' => '.(\is_array($value) ? self::export($value, $indent.' ') : var_export($value, true)).','; | |
| 125 | + } | |
| 126 | + | |
| 127 | + return "[\n".implode("\n", $lines)."\n".$indent.']'; | |
| 128 | + } | |
| 129 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +declare(strict_types=1); | ||
| 4 | + | ||
| 5 | +namespace JDecool\ScalewayRuntime; | ||
| 6 | + | ||
| 7 | +use Composer\Semver\VersionParser; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * The PHP version and the extensions measured on each supported Function Runtime, named and versioned as Composer sees | ||
| 11 | + * them there, generated from the probe's output (see docs/probe-results.md#function-runtime-catalogue). | ||
| 12 | + * | ||
| 13 | + * @phpstan-type FunctionRuntime array{measuredAt: string, php: string, extensions: array<string, string>} | ||
| 14 | + */ | ||
| 15 | +final readonly class FunctionRuntimeCatalogue | ||
| 16 | +{ | ||
| 17 | + public const string FILE = __DIR__.'/../resources/function-runtimes.php'; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * @param array<string, FunctionRuntime> $functionRuntimes by name, as "php84" | ||
| 21 | + */ | ||
| 22 | + public function __construct( | ||
| 23 | + public array $functionRuntimes, | ||
| 24 | + ) { | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public static function load(): self | ||
| 28 | + { | ||
| 29 | + /** @var array<string, FunctionRuntime> $functionRuntimes */ | ||
| 30 | + $functionRuntimes = require self::FILE; | ||
| 31 | + | ||
| 32 | + return new self($functionRuntimes); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * @return FunctionRuntime | ||
| 37 | + */ | ||
| 38 | + public function get(string $name): array | ||
| 39 | + { | ||
| 40 | + return $this->functionRuntimes[$name] ?? throw new \InvalidArgumentException(\sprintf('"%s" is not a measured Function Runtime: use %s.', $name, implode(' or ', array_keys($this->functionRuntimes)))); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Turns the outputs of the probe's "runtime" mode into the catalogue file. PHP and its extensions get the names and | ||
| 45 | + * versions of Composer's PlatformRepository, so that constraints are evaluated as Scaleway's "composer install" does. | ||
| 46 | + * | ||
| 47 | + * @param list<string> $probeOutputs | ||
| 48 | + */ | ||
| 49 | + public static function generate(array $probeOutputs): string | ||
| 50 | + { | ||
| 51 | + $parser = new VersionParser(); | ||
| 52 | + $functionRuntimes = []; | ||
| 53 | + foreach ($probeOutputs as $json) { | ||
| 54 | + $measurement = json_decode($json, true, 512, \JSON_THROW_ON_ERROR); | ||
| 55 | + if (!\is_array($measurement) || !\is_string($measuredAt = $measurement['measuredAt'] ?? null) || !\is_string($php = $measurement['phpVersion'] ?? null) || !\is_array($extensions = $measurement['extensions'] ?? null)) { | ||
| 56 | + throw new \UnexpectedValueException('A probe output must hold "measuredAt", "phpVersion" and "extensions".'); | ||
| 57 | + } | ||
| 58 | + // Scaleway names its Function Runtimes after the PHP minor version. | ||
| 59 | + if (1 !== preg_match('/^(\d+)\.(\d+)\./', $php, $match)) { | ||
| 60 | + throw new \UnexpectedValueException(\sprintf('"%s" is not a PHP version.', $php)); | ||
| 61 | + } | ||
| 62 | + $name = 'php'.$match[1].$match[2]; | ||
| 63 | + if (isset($functionRuntimes[$name])) { | ||
| 64 | + throw new \UnexpectedValueException(\sprintf('Two probe outputs measure %s: keep one.', $name)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + $versions = []; | ||
| 68 | + foreach ($extensions as $extension => $version) { | ||
| 69 | + // Composer does not register these two as packages. | ||
| 70 | + if (\in_array($extension, ['Core', 'standard'], true)) { | ||
| 71 | + continue; | ||
| 72 | + } | ||
| 73 | + $versions['ext-'.str_replace(' ', '-', strtolower((string) $extension))] = self::composerVersion($parser, \is_string($version) ? $version : '0'); | ||
| 74 | + } | ||
| 75 | + ksort($versions); | ||
| 76 | + | ||
| 77 | + $functionRuntimes[$name] = [ | ||
| 78 | + 'measuredAt' => $measuredAt, | ||
| 79 | + 'php' => self::composerPhpVersion($parser, $php), | ||
| 80 | + 'extensions' => $versions, | ||
| 81 | + ]; | ||
| 82 | + } | ||
| 83 | + ksort($functionRuntimes); | ||
| 84 | + | ||
| 85 | + return "<?php\n\ndeclare(strict_types=1);\n\n// Generated by probe/catalogue.php from tests/Fixtures/FunctionRuntimes: do not edit by hand.\n\nreturn ".self::export($functionRuntimes, '').";\n"; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * Composer keeps a parseable PHP_VERSION whole, so that "8.5.0-RC1" stays a pre-release, and cuts the others, as | ||
| 90 | + * "8.4.28-1+deb12", before their first "~", "+" or "-". | ||
| 91 | + */ | ||
| 92 | + private static function composerPhpVersion(VersionParser $parser, string $version): string | ||
| 93 | + { | ||
| 94 | + try { | ||
| 95 | + $parser->normalize($version); | ||
| 96 | + | ||
| 97 | + return $version; | ||
| 98 | + } catch (\UnexpectedValueException) { | ||
| 99 | + return (string) preg_replace('/^([^~+-]+).*$/', '$1', $version); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * Composer's fallback for a version it cannot parse, as "mysqlnd 8.4.28": its leading digits, or "0". | ||
| 105 | + */ | ||
| 106 | + private static function composerVersion(VersionParser $parser, string $version): string | ||
| 107 | + { | ||
| 108 | + try { | ||
| 109 | + $parser->normalize($version); | ||
| 110 | + | ||
| 111 | + return $version; | ||
| 112 | + } catch (\UnexpectedValueException) { | ||
| 113 | + return 1 === preg_match('/^(\d+\.\d+\.\d+(?:\.\d+)?)/', $version, $match) ? $match[1] : '0'; | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * @param array<mixed> $values | ||
| 119 | + */ | ||
| 120 | + private static function export(array $values, string $indent): string | ||
| 121 | + { | ||
| 122 | + $lines = []; | ||
| 123 | + foreach ($values as $key => $value) { | ||
| 124 | + $lines[] = $indent.' '.var_export($key, true).' => '.(\is_array($value) ? self::export($value, $indent.' ') : var_export($value, true)).','; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + return "[\n".implode("\n", $lines)."\n".$indent.']'; | ||
| 128 | + } | ||
| 129 | +} | ||
added
tests/Fixtures/FunctionRuntimes/php84.json +129 -0 | new file mode 100644 | ||
| @@ -0,0 +1,129 @@ | ||
| 1 | +{ | |
| 2 | + "measuredAt": "2026-11-22T11:47:13Z", | |
| 3 | + "phpVersion": "8.4.28", | |
| 4 | + "extensions": { | |
| 5 | + "Core": "8.4.28", | |
| 6 | + "date": "8.4.28", | |
| 7 | + "libxml": "8.4.28", | |
| 8 | + "openssl": "8.4.28", | |
| 9 | + "pcre": "8.4.28", | |
| 10 | + "sqlite3": "8.4.28", | |
| 11 | + "zlib": "8.4.28", | |
| 12 | + "ctype": "8.4.28", | |
| 13 | + "curl": "8.4.28", | |
| 14 | + "dom": "20031129", | |
| 15 | + "fileinfo": "8.4.28", | |
| 16 | + "filter": "8.4.28", | |
| 17 | + "hash": "8.4.28", | |
| 18 | + "iconv": "8.4.28", | |
| 19 | + "json": "8.4.28", | |
| 20 | + "mbstring": "8.4.28", | |
| 21 | + "SPL": "8.4.28", | |
| 22 | + "session": "8.4.28", | |
| 23 | + "PDO": "8.4.28", | |
| 24 | + "pdo_sqlite": "8.4.28", | |
| 25 | + "bz2": "8.4.28", | |
| 26 | + "posix": "8.4.28", | |
| 27 | + "random": "8.4.28", | |
| 28 | + "readline": "8.4.28", | |
| 29 | + "Reflection": "8.4.28", | |
| 30 | + "standard": "8.4.28", | |
| 31 | + "SimpleXML": "8.4.28", | |
| 32 | + "tokenizer": "8.4.28", | |
| 33 | + "xml": "8.4.28", | |
| 34 | + "xmlreader": "8.4.28", | |
| 35 | + "xmlwriter": "8.4.28", | |
| 36 | + "mysqlnd": "mysqlnd 8.4.28", | |
| 37 | + "amqp": "2.2.0", | |
| 38 | + "apcu": "5.1.28", | |
| 39 | + "ast": "1.1.4", | |
| 40 | + "bcmath": "8.4.28", | |
| 41 | + "Phar": "8.4.28", | |
| 42 | + "calendar": "8.4.28", | |
| 43 | + "csv": "0.3.0", | |
| 44 | + "dba": "8.4.28", | |
| 45 | + "decimal": "2.0.1", | |
| 46 | + "ds": "2.0.0", | |
| 47 | + "enchant": "8.4.28", | |
| 48 | + "sockets": "8.4.28", | |
| 49 | + "excimer": "1.2.6", | |
| 50 | + "exif": "8.4.28", | |
| 51 | + "FFI": "8.4.28", | |
| 52 | + "gd": "8.4.28", | |
| 53 | + "geospatial": "0.3.5", | |
| 54 | + "gettext": "8.4.28", | |
| 55 | + "gmp": "8.4.28", | |
| 56 | + "gnupg": "1.5.4", | |
| 57 | + "grpc": "1.85.0", | |
| 58 | + "igbinary": "3.2.17RC1", | |
| 59 | + "imap": "1.0.3", | |
| 60 | + "inotify": "3.0.1", | |
| 61 | + "intl": "8.4.28", | |
| 62 | + "ion": "0.2.1", | |
| 63 | + "json_post": "1.1.0", | |
| 64 | + "ldap": "8.4.28", | |
| 65 | + "luasandbox": "4.1.3", | |
| 66 | + "lz4": "0.4.3", | |
| 67 | + "lzf": "1.7.0", | |
| 68 | + "mailparse": "3.2.0", | |
| 69 | + "maxminddb": "1.15.0", | |
| 70 | + "memcache": "8.2", | |
| 71 | + "mongodb": "2.5.8", | |
| 72 | + "msgpack": "3.0.1", | |
| 73 | + "mysqli": "8.4.28", | |
| 74 | + "OAuth": "2.0.10", | |
| 75 | + "odbc": "8.4.28", | |
| 76 | + "parle": "0.8.5", | |
| 77 | + "pcntl": "8.4.28", | |
| 78 | + "pcov": "1.0.12", | |
| 79 | + "pdo_dblib": "8.4.28", | |
| 80 | + "PDO_Firebird": "8.4.28", | |
| 81 | + "pdo_mysql": "8.4.28", | |
| 82 | + "PDO_ODBC": "8.4.28", | |
| 83 | + "pdo_pgsql": "8.4.28", | |
| 84 | + "pdo_sqlsrv": "5.13.3", | |
| 85 | + "pgsql": "8.4.28", | |
| 86 | + "php_trie": "0.1.2", | |
| 87 | + "protobuf": "5.36.2", | |
| 88 | + "pspell": "1.0.1", | |
| 89 | + "rdkafka": "6.0.5", | |
| 90 | + "redis": "6.3.0", | |
| 91 | + "shmop": "8.4.28", | |
| 92 | + "simdjson": "4.0.0", | |
| 93 | + "smbclient": "1.2.0dev", | |
| 94 | + "snappy": "0.2.1", | |
| 95 | + "snmp": "8.4.28", | |
| 96 | + "soap": "8.4.28", | |
| 97 | + "ev": "1.3.1", | |
| 98 | + "sodium": "8.4.28", | |
| 99 | + "solr": "2.9.3", | |
| 100 | + "SPX": "0.4.21", | |
| 101 | + "sqlsrv": "5.13.3", | |
| 102 | + "ssh2": "1.6.1", | |
| 103 | + "Stomp": "2.0.3", | |
| 104 | + "sysvmsg": "8.4.28", | |
| 105 | + "sysvsem": "8.4.28", | |
| 106 | + "sysvshm": "8.4.28", | |
| 107 | + "tidy": "8.4.28", | |
| 108 | + "timezonedb": "2026.6", | |
| 109 | + "uploadprogress": "2.0.2", | |
| 110 | + "uuid": "1.3.0", | |
| 111 | + "vips": "1.0.13", | |
| 112 | + "xdiff": "2.2.0", | |
| 113 | + "xlswriter": "3.0.0", | |
| 114 | + "xmldiff": "1.1.6", | |
| 115 | + "xmlrpc": "1.0.0RC3", | |
| 116 | + "xsl": "8.4.28", | |
| 117 | + "yac": "3.0.2", | |
| 118 | + "yaml": "2.3.0", | |
| 119 | + "zephir_parser": "2.11.0", | |
| 120 | + "zip": "1.22.8", | |
| 121 | + "zstd": "0.18.0", | |
| 122 | + "event": "3.2.0", | |
| 123 | + "memcached": "3.4.0", | |
| 124 | + "oci8": "3.4.1", | |
| 125 | + "PDO_OCI": "1.2.0", | |
| 126 | + "libsmbclient": "1.2.0dev", | |
| 127 | + "Zend OPcache": "8.4.28" | |
| 128 | + } | |
| 129 | +} | |
| \ No newline at end of file | ||
| new file mode 100644 | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | +{ | ||
| 2 | + "measuredAt": "2026-11-22T11:47:13Z", | ||
| 3 | + "phpVersion": "8.4.28", | ||
| 4 | + "extensions": { | ||
| 5 | + "Core": "8.4.28", | ||
| 6 | + "date": "8.4.28", | ||
| 7 | + "libxml": "8.4.28", | ||
| 8 | + "openssl": "8.4.28", | ||
| 9 | + "pcre": "8.4.28", | ||
| 10 | + "sqlite3": "8.4.28", | ||
| 11 | + "zlib": "8.4.28", | ||
| 12 | + "ctype": "8.4.28", | ||
| 13 | + "curl": "8.4.28", | ||
| 14 | + "dom": "20031129", | ||
| 15 | + "fileinfo": "8.4.28", | ||
| 16 | + "filter": "8.4.28", | ||
| 17 | + "hash": "8.4.28", | ||
| 18 | + "iconv": "8.4.28", | ||
| 19 | + "json": "8.4.28", | ||
| 20 | + "mbstring": "8.4.28", | ||
| 21 | + "SPL": "8.4.28", | ||
| 22 | + "session": "8.4.28", | ||
| 23 | + "PDO": "8.4.28", | ||
| 24 | + "pdo_sqlite": "8.4.28", | ||
| 25 | + "bz2": "8.4.28", | ||
| 26 | + "posix": "8.4.28", | ||
| 27 | + "random": "8.4.28", | ||
| 28 | + "readline": "8.4.28", | ||
| 29 | + "Reflection": "8.4.28", | ||
| 30 | + "standard": "8.4.28", | ||
| 31 | + "SimpleXML": "8.4.28", | ||
| 32 | + "tokenizer": "8.4.28", | ||
| 33 | + "xml": "8.4.28", | ||
| 34 | + "xmlreader": "8.4.28", | ||
| 35 | + "xmlwriter": "8.4.28", | ||
| 36 | + "mysqlnd": "mysqlnd 8.4.28", | ||
| 37 | + "amqp": "2.2.0", | ||
| 38 | + "apcu": "5.1.28", | ||
| 39 | + "ast": "1.1.4", | ||
| 40 | + "bcmath": "8.4.28", | ||
| 41 | + "Phar": "8.4.28", | ||
| 42 | + "calendar": "8.4.28", | ||
| 43 | + "csv": "0.3.0", | ||
| 44 | + "dba": "8.4.28", | ||
| 45 | + "decimal": "2.0.1", | ||
| 46 | + "ds": "2.0.0", | ||
| 47 | + "enchant": "8.4.28", | ||
| 48 | + "sockets": "8.4.28", | ||
| 49 | + "excimer": "1.2.6", | ||
| 50 | + "exif": "8.4.28", | ||
| 51 | + "FFI": "8.4.28", | ||
| 52 | + "gd": "8.4.28", | ||
| 53 | + "geospatial": "0.3.5", | ||
| 54 | + "gettext": "8.4.28", | ||
| 55 | + "gmp": "8.4.28", | ||
| 56 | + "gnupg": "1.5.4", | ||
| 57 | + "grpc": "1.85.0", | ||
| 58 | + "igbinary": "3.2.17RC1", | ||
| 59 | + "imap": "1.0.3", | ||
| 60 | + "inotify": "3.0.1", | ||
| 61 | + "intl": "8.4.28", | ||
| 62 | + "ion": "0.2.1", | ||
| 63 | + "json_post": "1.1.0", | ||
| 64 | + "ldap": "8.4.28", | ||
| 65 | + "luasandbox": "4.1.3", | ||
| 66 | + "lz4": "0.4.3", | ||
| 67 | + "lzf": "1.7.0", | ||
| 68 | + "mailparse": "3.2.0", | ||
| 69 | + "maxminddb": "1.15.0", | ||
| 70 | + "memcache": "8.2", | ||
| 71 | + "mongodb": "2.5.8", | ||
| 72 | + "msgpack": "3.0.1", | ||
| 73 | + "mysqli": "8.4.28", | ||
| 74 | + "OAuth": "2.0.10", | ||
| 75 | + "odbc": "8.4.28", | ||
| 76 | + "parle": "0.8.5", | ||
| 77 | + "pcntl": "8.4.28", | ||
| 78 | + "pcov": "1.0.12", | ||
| 79 | + "pdo_dblib": "8.4.28", | ||
| 80 | + "PDO_Firebird": "8.4.28", | ||
| 81 | + "pdo_mysql": "8.4.28", | ||
| 82 | + "PDO_ODBC": "8.4.28", | ||
| 83 | + "pdo_pgsql": "8.4.28", | ||
| 84 | + "pdo_sqlsrv": "5.13.3", | ||
| 85 | + "pgsql": "8.4.28", | ||
| 86 | + "php_trie": "0.1.2", | ||
| 87 | + "protobuf": "5.36.2", | ||
| 88 | + "pspell": "1.0.1", | ||
| 89 | + "rdkafka": "6.0.5", | ||
| 90 | + "redis": "6.3.0", | ||
| 91 | + "shmop": "8.4.28", | ||
| 92 | + "simdjson": "4.0.0", | ||
| 93 | + "smbclient": "1.2.0dev", | ||
| 94 | + "snappy": "0.2.1", | ||
| 95 | + "snmp": "8.4.28", | ||
| 96 | + "soap": "8.4.28", | ||
| 97 | + "ev": "1.3.1", | ||
| 98 | + "sodium": "8.4.28", | ||
| 99 | + "solr": "2.9.3", | ||
| 100 | + "SPX": "0.4.21", | ||
| 101 | + "sqlsrv": "5.13.3", | ||
| 102 | + "ssh2": "1.6.1", | ||
| 103 | + "Stomp": "2.0.3", | ||
| 104 | + "sysvmsg": "8.4.28", | ||
| 105 | + "sysvsem": "8.4.28", | ||
| 106 | + "sysvshm": "8.4.28", | ||
| 107 | + "tidy": "8.4.28", | ||
| 108 | + "timezonedb": "2026.6", | ||
| 109 | + "uploadprogress": "2.0.2", | ||
| 110 | + "uuid": "1.3.0", | ||
| 111 | + "vips": "1.0.13", | ||
| 112 | + "xdiff": "2.2.0", | ||
| 113 | + "xlswriter": "3.0.0", | ||
| 114 | + "xmldiff": "1.1.6", | ||
| 115 | + "xmlrpc": "1.0.0RC3", | ||
| 116 | + "xsl": "8.4.28", | ||
| 117 | + "yac": "3.0.2", | ||
| 118 | + "yaml": "2.3.0", | ||
| 119 | + "zephir_parser": "2.11.0", | ||
| 120 | + "zip": "1.22.8", | ||
| 121 | + "zstd": "0.18.0", | ||
| 122 | + "event": "3.2.0", | ||
| 123 | + "memcached": "3.4.0", | ||
| 124 | + "oci8": "3.4.1", | ||
| 125 | + "PDO_OCI": "1.2.0", | ||
| 126 | + "libsmbclient": "1.2.0dev", | ||
| 127 | + "Zend OPcache": "8.4.28" | ||
| 128 | + } | ||
| 129 | +} | ||
| \ No newline at end of file | \ No newline at end of file | ||
added
tests/Fixtures/FunctionRuntimes/php85.json +126 -0 | new file mode 100644 | ||
| @@ -0,0 +1,126 @@ | ||
| 1 | +{ | |
| 2 | + "measuredAt": "2026-11-22T11:44:54Z", | |
| 3 | + "phpVersion": "8.5.13", | |
| 4 | + "extensions": { | |
| 5 | + "Core": "8.5.13", | |
| 6 | + "date": "8.5.13", | |
| 7 | + "lexbor": "8.5.13", | |
| 8 | + "openssl": "8.5.13", | |
| 9 | + "pcre": "8.5.13", | |
| 10 | + "sqlite3": "8.5.13", | |
| 11 | + "zlib": "8.5.13", | |
| 12 | + "ctype": "8.5.13", | |
| 13 | + "curl": "8.5.13", | |
| 14 | + "uri": "8.5.13", | |
| 15 | + "json": "8.5.13", | |
| 16 | + "fileinfo": "8.5.13", | |
| 17 | + "filter": "8.5.13", | |
| 18 | + "hash": "8.5.13", | |
| 19 | + "iconv": "8.5.13", | |
| 20 | + "SPL": "8.5.13", | |
| 21 | + "mbstring": "8.5.13", | |
| 22 | + "Zend OPcache": "8.5.13", | |
| 23 | + "session": "8.5.13", | |
| 24 | + "standard": "8.5.13", | |
| 25 | + "PDO": "8.5.13", | |
| 26 | + "pdo_sqlite": "8.5.13", | |
| 27 | + "bz2": "8.5.13", | |
| 28 | + "posix": "8.5.13", | |
| 29 | + "random": "8.5.13", | |
| 30 | + "readline": "8.5.13", | |
| 31 | + "Reflection": "8.5.13", | |
| 32 | + "libxml": "8.5.13", | |
| 33 | + "SimpleXML": "8.5.13", | |
| 34 | + "tokenizer": "8.5.13", | |
| 35 | + "dom": "20031129", | |
| 36 | + "xml": "8.5.13", | |
| 37 | + "xmlreader": "8.5.13", | |
| 38 | + "xmlwriter": "8.5.13", | |
| 39 | + "mysqlnd": "mysqlnd 8.5.13", | |
| 40 | + "amqp": "2.2.0", | |
| 41 | + "apcu": "5.1.28", | |
| 42 | + "ast": "1.1.4", | |
| 43 | + "bcmath": "8.5.13", | |
| 44 | + "Phar": "8.5.13", | |
| 45 | + "calendar": "8.5.13", | |
| 46 | + "csv": "0.3.0", | |
| 47 | + "dba": "8.5.13", | |
| 48 | + "decimal": "2.0.1", | |
| 49 | + "ds": "2.0.0", | |
| 50 | + "enchant": "8.5.13", | |
| 51 | + "sockets": "8.5.13", | |
| 52 | + "excimer": "1.2.6", | |
| 53 | + "exif": "8.5.13", | |
| 54 | + "FFI": "8.5.13", | |
| 55 | + "gd": "8.5.13", | |
| 56 | + "gettext": "8.5.13", | |
| 57 | + "gmp": "8.5.13", | |
| 58 | + "gnupg": "1.5.4", | |
| 59 | + "grpc": "1.85.0", | |
| 60 | + "igbinary": "3.2.17RC1", | |
| 61 | + "imap": "1.0.3", | |
| 62 | + "inotify": "3.0.1", | |
| 63 | + "intl": "8.5.13", | |
| 64 | + "ion": "0.2.1", | |
| 65 | + "json_post": "1.1.0", | |
| 66 | + "ldap": "8.5.13", | |
| 67 | + "luasandbox": "4.1.3", | |
| 68 | + "lz4": "0.4.3", | |
| 69 | + "lzf": "1.7.0", | |
| 70 | + "mailparse": "3.2.0", | |
| 71 | + "maxminddb": "1.15.0", | |
| 72 | + "mongodb": "2.5.8", | |
| 73 | + "msgpack": "3.0.1", | |
| 74 | + "mysqli": "8.5.13", | |
| 75 | + "OAuth": "2.0.10", | |
| 76 | + "odbc": "8.5.13", | |
| 77 | + "pcntl": "8.5.13", | |
| 78 | + "pcov": "1.0.12", | |
| 79 | + "pdo_dblib": "8.5.13", | |
| 80 | + "PDO_Firebird": "8.5.13", | |
| 81 | + "pdo_mysql": "8.5.13", | |
| 82 | + "PDO_ODBC": "8.5.13", | |
| 83 | + "pdo_pgsql": "8.5.13", | |
| 84 | + "pdo_sqlsrv": "5.13.3", | |
| 85 | + "pgsql": "8.5.13", | |
| 86 | + "protobuf": "5.36.2", | |
| 87 | + "pspell": "1.0.1", | |
| 88 | + "rdkafka": "6.0.5", | |
| 89 | + "redis": "6.3.0", | |
| 90 | + "shmop": "8.5.13", | |
| 91 | + "simdjson": "4.0.0", | |
| 92 | + "smbclient": "1.2.0dev", | |
| 93 | + "snappy": "0.2.1", | |
| 94 | + "snmp": "8.5.13", | |
| 95 | + "soap": "8.5.13", | |
| 96 | + "ev": "1.3.1", | |
| 97 | + "sodium": "8.5.13", | |
| 98 | + "solr": "2.9.3", | |
| 99 | + "SPX": "0.4.21", | |
| 100 | + "sqlsrv": "5.13.3", | |
| 101 | + "ssh2": "1.6.1", | |
| 102 | + "sysvmsg": "8.5.13", | |
| 103 | + "sysvsem": "8.5.13", | |
| 104 | + "sysvshm": "8.5.13", | |
| 105 | + "tidy": "8.5.13", | |
| 106 | + "timezonedb": "2026.6", | |
| 107 | + "uploadprogress": "2.0.2", | |
| 108 | + "uuid": "1.3.0", | |
| 109 | + "vips": "1.0.13", | |
| 110 | + "xdiff": "2.2.0", | |
| 111 | + "xlswriter": "3.0.0", | |
| 112 | + "xmldiff": "1.1.6", | |
| 113 | + "xmlrpc": "1.0.0RC3", | |
| 114 | + "xsl": "8.5.13", | |
| 115 | + "yac": "3.0.2", | |
| 116 | + "yaml": "2.3.0", | |
| 117 | + "zephir_parser": "2.11.0", | |
| 118 | + "zip": "1.22.8", | |
| 119 | + "zstd": "0.18.0", | |
| 120 | + "event": "3.2.0", | |
| 121 | + "memcached": "3.4.0", | |
| 122 | + "oci8": "3.4.1", | |
| 123 | + "PDO_OCI": "1.2.0", | |
| 124 | + "libsmbclient": "1.2.0dev" | |
| 125 | + } | |
| 126 | +} | |
| \ No newline at end of file | ||
| new file mode 100644 | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | +{ | ||
| 2 | + "measuredAt": "2026-11-22T11:44:54Z", | ||
| 3 | + "phpVersion": "8.5.13", | ||
| 4 | + "extensions": { | ||
| 5 | + "Core": "8.5.13", | ||
| 6 | + "date": "8.5.13", | ||
| 7 | + "lexbor": "8.5.13", | ||
| 8 | + "openssl": "8.5.13", | ||
| 9 | + "pcre": "8.5.13", | ||
| 10 | + "sqlite3": "8.5.13", | ||
| 11 | + "zlib": "8.5.13", | ||
| 12 | + "ctype": "8.5.13", | ||
| 13 | + "curl": "8.5.13", | ||
| 14 | + "uri": "8.5.13", | ||
| 15 | + "json": "8.5.13", | ||
| 16 | + "fileinfo": "8.5.13", | ||
| 17 | + "filter": "8.5.13", | ||
| 18 | + "hash": "8.5.13", | ||
| 19 | + "iconv": "8.5.13", | ||
| 20 | + "SPL": "8.5.13", | ||
| 21 | + "mbstring": "8.5.13", | ||
| 22 | + "Zend OPcache": "8.5.13", | ||
| 23 | + "session": "8.5.13", | ||
| 24 | + "standard": "8.5.13", | ||
| 25 | + "PDO": "8.5.13", | ||
| 26 | + "pdo_sqlite": "8.5.13", | ||
| 27 | + "bz2": "8.5.13", | ||
| 28 | + "posix": "8.5.13", | ||
| 29 | + "random": "8.5.13", | ||
| 30 | + "readline": "8.5.13", | ||
| 31 | + "Reflection": "8.5.13", | ||
| 32 | + "libxml": "8.5.13", | ||
| 33 | + "SimpleXML": "8.5.13", | ||
| 34 | + "tokenizer": "8.5.13", | ||
| 35 | + "dom": "20031129", | ||
| 36 | + "xml": "8.5.13", | ||
| 37 | + "xmlreader": "8.5.13", | ||
| 38 | + "xmlwriter": "8.5.13", | ||
| 39 | + "mysqlnd": "mysqlnd 8.5.13", | ||
| 40 | + "amqp": "2.2.0", | ||
| 41 | + "apcu": "5.1.28", | ||
| 42 | + "ast": "1.1.4", | ||
| 43 | + "bcmath": "8.5.13", | ||
| 44 | + "Phar": "8.5.13", | ||
| 45 | + "calendar": "8.5.13", | ||
| 46 | + "csv": "0.3.0", | ||
| 47 | + "dba": "8.5.13", | ||
| 48 | + "decimal": "2.0.1", | ||
| 49 | + "ds": "2.0.0", | ||
| 50 | + "enchant": "8.5.13", | ||
| 51 | + "sockets": "8.5.13", | ||
| 52 | + "excimer": "1.2.6", | ||
| 53 | + "exif": "8.5.13", | ||
| 54 | + "FFI": "8.5.13", | ||
| 55 | + "gd": "8.5.13", | ||
| 56 | + "gettext": "8.5.13", | ||
| 57 | + "gmp": "8.5.13", | ||
| 58 | + "gnupg": "1.5.4", | ||
| 59 | + "grpc": "1.85.0", | ||
| 60 | + "igbinary": "3.2.17RC1", | ||
| 61 | + "imap": "1.0.3", | ||
| 62 | + "inotify": "3.0.1", | ||
| 63 | + "intl": "8.5.13", | ||
| 64 | + "ion": "0.2.1", | ||
| 65 | + "json_post": "1.1.0", | ||
| 66 | + "ldap": "8.5.13", | ||
| 67 | + "luasandbox": "4.1.3", | ||
| 68 | + "lz4": "0.4.3", | ||
| 69 | + "lzf": "1.7.0", | ||
| 70 | + "mailparse": "3.2.0", | ||
| 71 | + "maxminddb": "1.15.0", | ||
| 72 | + "mongodb": "2.5.8", | ||
| 73 | + "msgpack": "3.0.1", | ||
| 74 | + "mysqli": "8.5.13", | ||
| 75 | + "OAuth": "2.0.10", | ||
| 76 | + "odbc": "8.5.13", | ||
| 77 | + "pcntl": "8.5.13", | ||
| 78 | + "pcov": "1.0.12", | ||
| 79 | + "pdo_dblib": "8.5.13", | ||
| 80 | + "PDO_Firebird": "8.5.13", | ||
| 81 | + "pdo_mysql": "8.5.13", | ||
| 82 | + "PDO_ODBC": "8.5.13", | ||
| 83 | + "pdo_pgsql": "8.5.13", | ||
| 84 | + "pdo_sqlsrv": "5.13.3", | ||
| 85 | + "pgsql": "8.5.13", | ||
| 86 | + "protobuf": "5.36.2", | ||
| 87 | + "pspell": "1.0.1", | ||
| 88 | + "rdkafka": "6.0.5", | ||
| 89 | + "redis": "6.3.0", | ||
| 90 | + "shmop": "8.5.13", | ||
| 91 | + "simdjson": "4.0.0", | ||
| 92 | + "smbclient": "1.2.0dev", | ||
| 93 | + "snappy": "0.2.1", | ||
| 94 | + "snmp": "8.5.13", | ||
| 95 | + "soap": "8.5.13", | ||
| 96 | + "ev": "1.3.1", | ||
| 97 | + "sodium": "8.5.13", | ||
| 98 | + "solr": "2.9.3", | ||
| 99 | + "SPX": "0.4.21", | ||
| 100 | + "sqlsrv": "5.13.3", | ||
| 101 | + "ssh2": "1.6.1", | ||
| 102 | + "sysvmsg": "8.5.13", | ||
| 103 | + "sysvsem": "8.5.13", | ||
| 104 | + "sysvshm": "8.5.13", | ||
| 105 | + "tidy": "8.5.13", | ||
| 106 | + "timezonedb": "2026.6", | ||
| 107 | + "uploadprogress": "2.0.2", | ||
| 108 | + "uuid": "1.3.0", | ||
| 109 | + "vips": "1.0.13", | ||
| 110 | + "xdiff": "2.2.0", | ||
| 111 | + "xlswriter": "3.0.0", | ||
| 112 | + "xmldiff": "1.1.6", | ||
| 113 | + "xmlrpc": "1.0.0RC3", | ||
| 114 | + "xsl": "8.5.13", | ||
| 115 | + "yac": "3.0.2", | ||
| 116 | + "yaml": "2.3.0", | ||
| 117 | + "zephir_parser": "2.11.0", | ||
| 118 | + "zip": "1.22.8", | ||
| 119 | + "zstd": "0.18.0", | ||
| 120 | + "event": "3.2.0", | ||
| 121 | + "memcached": "3.4.0", | ||
| 122 | + "oci8": "3.4.1", | ||
| 123 | + "PDO_OCI": "1.2.0", | ||
| 124 | + "libsmbclient": "1.2.0dev" | ||
| 125 | + } | ||
| 126 | +} | ||
| \ No newline at end of file | \ No newline at end of file | ||
added
tests/FunctionRuntimeCatalogueTest.php +112 -0 | new file mode 100644 | ||
| @@ -0,0 +1,112 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +declare(strict_types=1); | |
| 4 | + | |
| 5 | +namespace JDecool\ScalewayRuntime\Tests; | |
| 6 | + | |
| 7 | +use JDecool\ScalewayRuntime\FunctionRuntimeCatalogue; | |
| 8 | +use PHPUnit\Framework\TestCase; | |
| 9 | + | |
| 10 | +final class FunctionRuntimeCatalogueTest extends TestCase | |
| 11 | +{ | |
| 12 | + public function testCommittedCatalogueIsGeneratedFromTheProbeOutputs(): void | |
| 13 | + { | |
| 14 | + $files = glob(__DIR__.'/Fixtures/FunctionRuntimes/*.json') ?: []; | |
| 15 | + self::assertNotEmpty($files); | |
| 16 | + | |
| 17 | + self::assertSame( | |
| 18 | + FunctionRuntimeCatalogue::generate(array_map(static fn (string $file): string => (string) file_get_contents($file), $files)), | |
| 19 | + file_get_contents(FunctionRuntimeCatalogue::FILE), | |
| 20 | + 'resources/function-runtimes.php is out of date: run "php probe/catalogue.php".', | |
| 21 | + ); | |
| 22 | + } | |
| 23 | + | |
| 24 | + public function testMeasuredFunctionRuntimesAreSupported(): void | |
| 25 | + { | |
| 26 | + $catalogue = FunctionRuntimeCatalogue::load(); | |
| 27 | + | |
| 28 | + self::assertSame(['php84', 'php85'], array_keys($catalogue->functionRuntimes)); | |
| 29 | + self::assertMatchesRegularExpression('/^8\.4\.\d+$/', $catalogue->get('php84')['php']); | |
| 30 | + } | |
| 31 | + | |
| 32 | + public function testNamesAndVersionsAreComposers(): void | |
| 33 | + { | |
| 34 | + $catalogue = self::generated([ | |
| 35 | + 'measuredAt' => '2026-11-22T11:47:13Z', | |
| 36 | + 'phpVersion' => '8.4.28-1+deb12', | |
| 37 | + 'extensions' => [ | |
| 38 | + 'Core' => '8.4.28', | |
| 39 | + 'standard' => '8.4.28', | |
| 40 | + 'Zend OPcache' => '8.4.28', | |
| 41 | + 'PDO_OCI' => '1.2.0', | |
| 42 | + 'mysqlnd' => 'mysqlnd 8.4.28', | |
| 43 | + 'oddity' => '1.2.3 build 4', | |
| 44 | + 'unversioned' => false, | |
| 45 | + 'igbinary' => '3.2.17RC1', | |
| 46 | + ], | |
| 47 | + ]); | |
| 48 | + | |
| 49 | + self::assertSame([ | |
| 50 | + 'php84' => [ | |
| 51 | + 'measuredAt' => '2026-11-22T11:47:13Z', | |
| 52 | + 'php' => '8.4.28', | |
| 53 | + 'extensions' => [ | |
| 54 | + 'ext-igbinary' => '3.2.17RC1', | |
| 55 | + 'ext-mysqlnd' => '0', | |
| 56 | + 'ext-oddity' => '1.2.3', | |
| 57 | + 'ext-pdo_oci' => '1.2.0', | |
| 58 | + 'ext-unversioned' => '0', | |
| 59 | + 'ext-zend-opcache' => '8.4.28', | |
| 60 | + ], | |
| 61 | + ], | |
| 62 | + ], $catalogue->functionRuntimes); | |
| 63 | + } | |
| 64 | + | |
| 65 | + public function testParseablePhpVersionIsKeptWhole(): void | |
| 66 | + { | |
| 67 | + $catalogue = self::generated(['measuredAt' => '2026-11-22T11:47:13Z', 'phpVersion' => '8.5.0-RC1', 'extensions' => []]); | |
| 68 | + | |
| 69 | + self::assertSame('8.5.0-RC1', $catalogue->get('php85')['php']); | |
| 70 | + } | |
| 71 | + | |
| 72 | + public function testTwoMeasurementsOfTheSameFunctionRuntimeAreRefused(): void | |
| 73 | + { | |
| 74 | + $measurement = json_encode(['measuredAt' => '2026-11-22T11:47:13Z', 'phpVersion' => '8.4.28', 'extensions' => []], \JSON_THROW_ON_ERROR); | |
| 75 | + | |
| 76 | + $this->expectExceptionMessage('Two probe outputs measure php84: keep one.'); | |
| 77 | + | |
| 78 | + FunctionRuntimeCatalogue::generate([$measurement, str_replace('8.4.28', '8.4.29', $measurement)]); | |
| 79 | + } | |
| 80 | + | |
| 81 | + public function testIncompleteMeasurementIsRefused(): void | |
| 82 | + { | |
| 83 | + $this->expectExceptionMessage('A probe output must hold "measuredAt", "phpVersion" and "extensions".'); | |
| 84 | + | |
| 85 | + FunctionRuntimeCatalogue::generate(['{"phpVersion": "8.4.28"}']); | |
| 86 | + } | |
| 87 | + | |
| 88 | + public function testUnmeasuredFunctionRuntimeIsRefused(): void | |
| 89 | + { | |
| 90 | + $this->expectExceptionMessage('"php83" is not a measured Function Runtime: use php84 or php85.'); | |
| 91 | + | |
| 92 | + FunctionRuntimeCatalogue::load()->get('php83'); | |
| 93 | + } | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * @param array<string, mixed> $measurement | |
| 97 | + */ | |
| 98 | + private static function generated(array $measurement): FunctionRuntimeCatalogue | |
| 99 | + { | |
| 100 | + $file = tempnam(sys_get_temp_dir(), 'catalogue'); | |
| 101 | + self::assertNotFalse($file); | |
| 102 | + try { | |
| 103 | + file_put_contents($file, FunctionRuntimeCatalogue::generate([json_encode($measurement, \JSON_THROW_ON_ERROR)])); | |
| 104 | + /** @var array<string, array{measuredAt: string, php: string, extensions: array<string, string>}> $functionRuntimes */ | |
| 105 | + $functionRuntimes = require $file; | |
| 106 | + | |
| 107 | + return new FunctionRuntimeCatalogue($functionRuntimes); | |
| 108 | + } finally { | |
| 109 | + unlink($file); | |
| 110 | + } | |
| 111 | + } | |
| 112 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +declare(strict_types=1); | ||
| 4 | + | ||
| 5 | +namespace JDecool\ScalewayRuntime\Tests; | ||
| 6 | + | ||
| 7 | +use JDecool\ScalewayRuntime\FunctionRuntimeCatalogue; | ||
| 8 | +use PHPUnit\Framework\TestCase; | ||
| 9 | + | ||
| 10 | +final class FunctionRuntimeCatalogueTest extends TestCase | ||
| 11 | +{ | ||
| 12 | + public function testCommittedCatalogueIsGeneratedFromTheProbeOutputs(): void | ||
| 13 | + { | ||
| 14 | + $files = glob(__DIR__.'/Fixtures/FunctionRuntimes/*.json') ?: []; | ||
| 15 | + self::assertNotEmpty($files); | ||
| 16 | + | ||
| 17 | + self::assertSame( | ||
| 18 | + FunctionRuntimeCatalogue::generate(array_map(static fn (string $file): string => (string) file_get_contents($file), $files)), | ||
| 19 | + file_get_contents(FunctionRuntimeCatalogue::FILE), | ||
| 20 | + 'resources/function-runtimes.php is out of date: run "php probe/catalogue.php".', | ||
| 21 | + ); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public function testMeasuredFunctionRuntimesAreSupported(): void | ||
| 25 | + { | ||
| 26 | + $catalogue = FunctionRuntimeCatalogue::load(); | ||
| 27 | + | ||
| 28 | + self::assertSame(['php84', 'php85'], array_keys($catalogue->functionRuntimes)); | ||
| 29 | + self::assertMatchesRegularExpression('/^8\.4\.\d+$/', $catalogue->get('php84')['php']); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public function testNamesAndVersionsAreComposers(): void | ||
| 33 | + { | ||
| 34 | + $catalogue = self::generated([ | ||
| 35 | + 'measuredAt' => '2026-11-22T11:47:13Z', | ||
| 36 | + 'phpVersion' => '8.4.28-1+deb12', | ||
| 37 | + 'extensions' => [ | ||
| 38 | + 'Core' => '8.4.28', | ||
| 39 | + 'standard' => '8.4.28', | ||
| 40 | + 'Zend OPcache' => '8.4.28', | ||
| 41 | + 'PDO_OCI' => '1.2.0', | ||
| 42 | + 'mysqlnd' => 'mysqlnd 8.4.28', | ||
| 43 | + 'oddity' => '1.2.3 build 4', | ||
| 44 | + 'unversioned' => false, | ||
| 45 | + 'igbinary' => '3.2.17RC1', | ||
| 46 | + ], | ||
| 47 | + ]); | ||
| 48 | + | ||
| 49 | + self::assertSame([ | ||
| 50 | + 'php84' => [ | ||
| 51 | + 'measuredAt' => '2026-11-22T11:47:13Z', | ||
| 52 | + 'php' => '8.4.28', | ||
| 53 | + 'extensions' => [ | ||
| 54 | + 'ext-igbinary' => '3.2.17RC1', | ||
| 55 | + 'ext-mysqlnd' => '0', | ||
| 56 | + 'ext-oddity' => '1.2.3', | ||
| 57 | + 'ext-pdo_oci' => '1.2.0', | ||
| 58 | + 'ext-unversioned' => '0', | ||
| 59 | + 'ext-zend-opcache' => '8.4.28', | ||
| 60 | + ], | ||
| 61 | + ], | ||
| 62 | + ], $catalogue->functionRuntimes); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public function testParseablePhpVersionIsKeptWhole(): void | ||
| 66 | + { | ||
| 67 | + $catalogue = self::generated(['measuredAt' => '2026-11-22T11:47:13Z', 'phpVersion' => '8.5.0-RC1', 'extensions' => []]); | ||
| 68 | + | ||
| 69 | + self::assertSame('8.5.0-RC1', $catalogue->get('php85')['php']); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public function testTwoMeasurementsOfTheSameFunctionRuntimeAreRefused(): void | ||
| 73 | + { | ||
| 74 | + $measurement = json_encode(['measuredAt' => '2026-11-22T11:47:13Z', 'phpVersion' => '8.4.28', 'extensions' => []], \JSON_THROW_ON_ERROR); | ||
| 75 | + | ||
| 76 | + $this->expectExceptionMessage('Two probe outputs measure php84: keep one.'); | ||
| 77 | + | ||
| 78 | + FunctionRuntimeCatalogue::generate([$measurement, str_replace('8.4.28', '8.4.29', $measurement)]); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public function testIncompleteMeasurementIsRefused(): void | ||
| 82 | + { | ||
| 83 | + $this->expectExceptionMessage('A probe output must hold "measuredAt", "phpVersion" and "extensions".'); | ||
| 84 | + | ||
| 85 | + FunctionRuntimeCatalogue::generate(['{"phpVersion": "8.4.28"}']); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public function testUnmeasuredFunctionRuntimeIsRefused(): void | ||
| 89 | + { | ||
| 90 | + $this->expectExceptionMessage('"php83" is not a measured Function Runtime: use php84 or php85.'); | ||
| 91 | + | ||
| 92 | + FunctionRuntimeCatalogue::load()->get('php83'); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * @param array<string, mixed> $measurement | ||
| 97 | + */ | ||
| 98 | + private static function generated(array $measurement): FunctionRuntimeCatalogue | ||
| 99 | + { | ||
| 100 | + $file = tempnam(sys_get_temp_dir(), 'catalogue'); | ||
| 101 | + self::assertNotFalse($file); | ||
| 102 | + try { | ||
| 103 | + file_put_contents($file, FunctionRuntimeCatalogue::generate([json_encode($measurement, \JSON_THROW_ON_ERROR)])); | ||
| 104 | + /** @var array<string, array{measuredAt: string, php: string, extensions: array<string, string>}> $functionRuntimes */ | ||
| 105 | + $functionRuntimes = require $file; | ||
| 106 | + | ||
| 107 | + return new FunctionRuntimeCatalogue($functionRuntimes); | ||
| 108 | + } finally { | ||
| 109 | + unlink($file); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | +} | ||