Skip to content

Commit 06ae404

Browse files
committed
Add support for PHP 8.4
Calling new ReflectionMethod with a single argument is deprecated
1 parent d747f65 commit 06ae404

File tree

3 files changed

+56
-49
lines changed

3 files changed

+56
-49
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ jobs:
129129
- "8.1"
130130
- "8.2"
131131
- "8.3"
132+
- "8.4"
132133
count: ${{ fromJson(needs.chunk-matrix.outputs.count) }}
133134
chunk: ${{ fromJson(needs.chunk-matrix.outputs.chunks) }}
134135

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
18+
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
1919
"ext-SimpleXML": "*",
2020
"ext-ctype": "*",
2121
"ext-dom": "*",
@@ -30,7 +30,7 @@
3030
"composer/xdebug-handler": "^2.0 || ^3.0",
3131
"dnoegel/php-xdg-base-dir": "^0.1.1",
3232
"felixfbecker/advanced-json-rpc": "^3.1",
33-
"felixfbecker/language-server-protocol": "^1.5.2",
33+
"felixfbecker/language-server-protocol": "^1.5.3",
3434
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0",
3535
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
3636
"nikic/php-parser": "^4.17",
@@ -47,7 +47,7 @@
4747
},
4848
"require-dev": {
4949
"ext-curl": "*",
50-
"amphp/phpunit-util": "^2.0",
50+
"amphp/phpunit-util": "^2.0.1",
5151
"bamarni/composer-bin-plugin": "^1.4",
5252
"brianium/paratest": "^6.9",
5353
"mockery/mockery": "^1.5",

tests/Internal/Codebase/InternalCallMapHandlerTest.php

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
use const PHP_MAJOR_VERSION;
4646
use const PHP_MINOR_VERSION;
4747
use const PHP_VERSION;
48+
use const PHP_VERSION_ID;
4849

4950
/** @group callmap */
5051
class InternalCallMapHandlerTest extends TestCase
@@ -78,8 +79,8 @@ class InternalCallMapHandlerTest extends TestCase
7879
'array_multisort',
7980
'datefmt_create' => ['8.0'],
8081
'fiber::start',
81-
'get_class' => ['8.3'],
82-
'get_parent_class' => ['8.3'],
82+
'get_class' => ['8.3', '8.4'],
83+
'get_parent_class' => ['8.3', '8.4'],
8384
'imagefilledpolygon',
8485
'imagegd',
8586
'imagegd2',
@@ -97,7 +98,7 @@ class InternalCallMapHandlerTest extends TestCase
9798
'mailparse_msg_get_structure',
9899
'mailparse_msg_parse',
99100
'mailparse_stream_encode',
100-
'mb_check_encoding' => ['8.1', '8.2', '8.3'],
101+
'mb_check_encoding' => ['8.1', '8.2', '8.3', '8.4'],
101102
'memcached::cas', // memcached 3.2.0 has incorrect reflection
102103
'memcached::casbykey', // memcached 3.2.0 has incorrect reflection
103104
'oauth::fetch',
@@ -175,60 +176,60 @@ class InternalCallMapHandlerTest extends TestCase
175176
* @var array<int|string, string|list<string>>
176177
*/
177178
private static array $ignoredReturnTypeOnlyFunctions = [
178-
'appenditerator::getinneriterator' => ['8.1', '8.2', '8.3'],
179-
'appenditerator::getiteratorindex' => ['8.1', '8.2', '8.3'],
180-
'cachingiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
181-
'callbackfilteriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
179+
'appenditerator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
180+
'appenditerator::getiteratorindex' => ['8.1', '8.2', '8.3', '8.4'],
181+
'cachingiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
182+
'callbackfilteriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
182183
'curl_multi_getcontent',
183-
'datetime::add' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
184-
'datetime::modify' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
185-
'datetime::createfromformat' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
184+
'datetime::add' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
185+
'datetime::modify' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
186+
'datetime::createfromformat' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
186187
'datetime::createfromimmutable' => ['8.1'],
187188
'datetime::createfrominterface',
188-
'datetime::setdate' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
189-
'datetime::setisodate' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
190-
'datetime::settime' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
191-
'datetime::settimestamp' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
192-
'datetime::settimezone' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
193-
'datetime::sub' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
189+
'datetime::setdate' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
190+
'datetime::setisodate' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
191+
'datetime::settime' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
192+
'datetime::settimestamp' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
193+
'datetime::settimezone' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
194+
'datetime::sub' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
194195
'datetimeimmutable::createfrominterface',
195196
'fiber::getcurrent',
196-
'filteriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
197+
'filteriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
197198
'get_cfg_var', // Ignore array return type
198-
'infiniteiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
199-
'iteratoriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
200-
'limititerator::getinneriterator' => ['8.1', '8.2', '8.3'],
201-
'locale::getallvariants' => ['8.1', '8.2', '8.3'],
202-
'locale::getkeywords' => ['8.1', '8.2', '8.3'],
203-
'locale::getprimarylanguage' => ['8.1', '8.2', '8.3'],
204-
'locale::getregion' => ['8.1', '8.2', '8.3'],
205-
'locale::getscript' => ['8.1', '8.2', '8.3'],
206-
'locale::parselocale' => ['8.1', '8.2', '8.3'],
207-
'messageformatter::create' => ['8.1', '8.2', '8.3'],
208-
'multipleiterator::current' => ['8.1', '8.2', '8.3'],
209-
'mysqli::get_charset' => ['8.1', '8.2', '8.3'],
210-
'mysqli_stmt::get_warnings' => ['8.1', '8.2', '8.3'],
199+
'infiniteiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
200+
'iteratoriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
201+
'limititerator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
202+
'locale::getallvariants' => ['8.1', '8.2', '8.3', '8.4'],
203+
'locale::getkeywords' => ['8.1', '8.2', '8.3', '8.4'],
204+
'locale::getprimarylanguage' => ['8.1', '8.2', '8.3', '8.4'],
205+
'locale::getregion' => ['8.1', '8.2', '8.3', '8.4'],
206+
'locale::getscript' => ['8.1', '8.2', '8.3', '8.4'],
207+
'locale::parselocale' => ['8.1', '8.2', '8.3', '8.4'],
208+
'messageformatter::create' => ['8.1', '8.2', '8.3', '8.4'],
209+
'multipleiterator::current' => ['8.1', '8.2', '8.3', '8.4'],
210+
'mysqli::get_charset' => ['8.1', '8.2', '8.3', '8.4'],
211+
'mysqli_stmt::get_warnings' => ['8.1', '8.2', '8.3', '8.4'],
211212
'mysqli_stmt_get_warnings',
212213
'mysqli_stmt_insert_id',
213-
'norewinditerator::getinneriterator' => ['8.1', '8.2', '8.3'],
214+
'norewinditerator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
214215
'passthru',
215-
'recursivecachingiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
216-
'recursivecallbackfilteriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
217-
'recursivefilteriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
218-
'recursiveregexiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
216+
'recursivecachingiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
217+
'recursivecallbackfilteriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
218+
'recursivefilteriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
219+
'recursiveregexiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
219220
'reflectionclass::getstaticproperties' => ['8.1', '8.2'],
220-
'reflectionclass::newinstanceargs' => ['8.1', '8.2', '8.3'],
221-
'reflectionfunction::getclosurescopeclass' => ['8.1', '8.2', '8.3'],
222-
'reflectionfunction::getclosurethis' => ['8.1', '8.2', '8.3'],
223-
'reflectionmethod::getclosurescopeclass' => ['8.1', '8.2', '8.3'],
224-
'reflectionmethod::getclosurethis' => ['8.1', '8.2', '8.3'],
221+
'reflectionclass::newinstanceargs' => ['8.1', '8.2', '8.3', '8.4'],
222+
'reflectionfunction::getclosurescopeclass' => ['8.1', '8.2', '8.3', '8.4'],
223+
'reflectionfunction::getclosurethis' => ['8.1', '8.2', '8.3', '8.4'],
224+
'reflectionmethod::getclosurescopeclass' => ['8.1', '8.2', '8.3', '8.4'],
225+
'reflectionmethod::getclosurethis' => ['8.1', '8.2', '8.3', '8.4'],
225226
'reflectionobject::getstaticproperties' => ['8.1', '8.2'],
226-
'reflectionobject::newinstanceargs' => ['8.1', '8.2', '8.3'],
227-
'regexiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
227+
'reflectionobject::newinstanceargs' => ['8.1', '8.2', '8.3', '8.4'],
228+
'regexiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
228229
'register_shutdown_function' => ['8.0', '8.1'],
229-
'splfileobject::fscanf' => ['8.1', '8.2', '8.3'],
230-
'spltempfileobject::fscanf' => ['8.1', '8.2', '8.3'],
231-
'xsltprocessor::transformtoxml' => ['8.1', '8.2', '8.3'],
230+
'splfileobject::fscanf' => ['8.1', '8.2', '8.3', '8.4'],
231+
'spltempfileobject::fscanf' => ['8.1', '8.2', '8.3', '8.4'],
232+
'xsltprocessor::transformtoxml' => ['8.1', '8.2', '8.3', '8.4'],
232233
];
233234

234235
/**
@@ -519,7 +520,12 @@ private function getReflectionFunction(string $functionName): ?ReflectionFunctio
519520
{
520521
try {
521522
if (strpos($functionName, '::') !== false) {
522-
return new ReflectionMethod($functionName);
523+
if (PHP_VERSION_ID < 8_03_00) {
524+
[$className, , $methodName] = explode(':', $functionName, 3);
525+
return new ReflectionMethod($className, $methodName);
526+
}
527+
528+
return ReflectionMethod::createFromMethodName($functionName);
523529
}
524530

525531
/** @var callable-string $functionName */

0 commit comments

Comments
 (0)