Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PHP 8.4 #10928

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
count: ${{ fromJson(needs.chunk-matrix.outputs.count) }}
chunk: ${{ fromJson(needs.chunk-matrix.outputs.chunks) }}

Expand All @@ -148,7 +149,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
ini-values: zend.assertions=1, assert.exception=1, opcache.enable_cli=1, opcache.jit=function, opcache.jit_buffer_size=512M
ini-values: zend.assertions=1, assert.exception=1
tools: composer:v2
coverage: none
extensions: none, curl, dom, filter, intl, json, libxml, mbstring, opcache, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"composer/xdebug-handler": "^2.0 || ^3.0",
"dnoegel/php-xdg-base-dir": "^0.1.1",
"felixfbecker/advanced-json-rpc": "^3.1",
"felixfbecker/language-server-protocol": "^1.5.2",
"felixfbecker/language-server-protocol": "^1.5.3",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0",
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"nikic/php-parser": "^5.0.0",
Expand Down
3 changes: 3 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,9 @@
</RiskyTruthyFalsyComparison>
</file>
<file src="tests/Internal/Codebase/InternalCallMapHandlerTest.php">
<MixedReturnStatement>
<code><![CDATA[ReflectionMethod::createFromMethodName($functionName)]]></code>
</MixedReturnStatement>
<RiskyTruthyFalsyComparison>
<code><![CDATA[empty($normalizedEntry['type'])]]></code>
</RiskyTruthyFalsyComparison>
Expand Down
97 changes: 51 additions & 46 deletions tests/Internal/Codebase/InternalCallMapHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
use const PHP_MAJOR_VERSION;
use const PHP_MINOR_VERSION;
use const PHP_VERSION;
use const PHP_VERSION_ID;

/** @group callmap */
class InternalCallMapHandlerTest extends TestCase
Expand Down Expand Up @@ -80,8 +81,8 @@ class InternalCallMapHandlerTest extends TestCase
'array_multisort',
'datefmt_create' => ['8.0'],
'fiber::start',
'get_class' => ['8.3'],
'get_parent_class' => ['8.3'],
'get_class' => ['8.3', '8.4'],
'get_parent_class' => ['8.3', '8.4'],
'imagefilledpolygon',
'imagegd',
'imagegd2',
Expand All @@ -99,7 +100,7 @@ class InternalCallMapHandlerTest extends TestCase
'mailparse_msg_get_structure',
'mailparse_msg_parse',
'mailparse_stream_encode',
'mb_check_encoding' => ['8.1', '8.2', '8.3'],
'mb_check_encoding' => ['8.1', '8.2', '8.3', '8.4'],
'memcached::cas', // memcached 3.2.0 has incorrect reflection
'memcached::casbykey', // memcached 3.2.0 has incorrect reflection
'oauth::fetch',
Expand Down Expand Up @@ -177,60 +178,60 @@ class InternalCallMapHandlerTest extends TestCase
* @var array<int|string, string|list<string>>
*/
private static array $ignoredReturnTypeOnlyFunctions = [
'appenditerator::getinneriterator' => ['8.1', '8.2', '8.3'],
'appenditerator::getiteratorindex' => ['8.1', '8.2', '8.3'],
'cachingiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'callbackfilteriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'appenditerator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'appenditerator::getiteratorindex' => ['8.1', '8.2', '8.3', '8.4'],
'cachingiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'callbackfilteriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'curl_multi_getcontent',
'datetime::add' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::modify' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::createfromformat' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::add' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetime::modify' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetime::createfromformat' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetime::createfromimmutable' => ['8.1'],
'datetime::createfrominterface',
'datetime::setdate' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::setisodate' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::settime' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::settimestamp' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::settimezone' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::sub' => ['8.1', '8.2', '8.3'], // DateTime does not contain static
'datetime::setdate' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetime::setisodate' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetime::settime' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetime::settimestamp' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetime::settimezone' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetime::sub' => ['8.1', '8.2', '8.3', '8.4'], // DateTime does not contain static
'datetimeimmutable::createfrominterface',
'fiber::getcurrent',
'filteriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'filteriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'get_cfg_var', // Ignore array return type
'infiniteiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'iteratoriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'limititerator::getinneriterator' => ['8.1', '8.2', '8.3'],
'locale::getallvariants' => ['8.1', '8.2', '8.3'],
'locale::getkeywords' => ['8.1', '8.2', '8.3'],
'locale::getprimarylanguage' => ['8.1', '8.2', '8.3'],
'locale::getregion' => ['8.1', '8.2', '8.3'],
'locale::getscript' => ['8.1', '8.2', '8.3'],
'locale::parselocale' => ['8.1', '8.2', '8.3'],
'messageformatter::create' => ['8.1', '8.2', '8.3'],
'multipleiterator::current' => ['8.1', '8.2', '8.3'],
'mysqli::get_charset' => ['8.1', '8.2', '8.3'],
'mysqli_stmt::get_warnings' => ['8.1', '8.2', '8.3'],
'infiniteiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'iteratoriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'limititerator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'locale::getallvariants' => ['8.1', '8.2', '8.3', '8.4'],
'locale::getkeywords' => ['8.1', '8.2', '8.3', '8.4'],
'locale::getprimarylanguage' => ['8.1', '8.2', '8.3', '8.4'],
'locale::getregion' => ['8.1', '8.2', '8.3', '8.4'],
'locale::getscript' => ['8.1', '8.2', '8.3', '8.4'],
'locale::parselocale' => ['8.1', '8.2', '8.3', '8.4'],
'messageformatter::create' => ['8.1', '8.2', '8.3', '8.4'],
'multipleiterator::current' => ['8.1', '8.2', '8.3', '8.4'],
'mysqli::get_charset' => ['8.1', '8.2', '8.3', '8.4'],
'mysqli_stmt::get_warnings' => ['8.1', '8.2', '8.3', '8.4'],
'mysqli_stmt_get_warnings',
'mysqli_stmt_insert_id',
'norewinditerator::getinneriterator' => ['8.1', '8.2', '8.3'],
'norewinditerator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'passthru',
'recursivecachingiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'recursivecallbackfilteriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'recursivefilteriterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'recursiveregexiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'recursivecachingiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'recursivecallbackfilteriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'recursivefilteriterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'recursiveregexiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'reflectionclass::getstaticproperties' => ['8.1', '8.2'],
'reflectionclass::newinstanceargs' => ['8.1', '8.2', '8.3'],
'reflectionfunction::getclosurescopeclass' => ['8.1', '8.2', '8.3'],
'reflectionfunction::getclosurethis' => ['8.1', '8.2', '8.3'],
'reflectionmethod::getclosurescopeclass' => ['8.1', '8.2', '8.3'],
'reflectionmethod::getclosurethis' => ['8.1', '8.2', '8.3'],
'reflectionclass::newinstanceargs' => ['8.1', '8.2', '8.3', '8.4'],
'reflectionfunction::getclosurescopeclass' => ['8.1', '8.2', '8.3', '8.4'],
'reflectionfunction::getclosurethis' => ['8.1', '8.2', '8.3', '8.4'],
'reflectionmethod::getclosurescopeclass' => ['8.1', '8.2', '8.3', '8.4'],
'reflectionmethod::getclosurethis' => ['8.1', '8.2', '8.3', '8.4'],
'reflectionobject::getstaticproperties' => ['8.1', '8.2'],
'reflectionobject::newinstanceargs' => ['8.1', '8.2', '8.3'],
'regexiterator::getinneriterator' => ['8.1', '8.2', '8.3'],
'reflectionobject::newinstanceargs' => ['8.1', '8.2', '8.3', '8.4'],
'regexiterator::getinneriterator' => ['8.1', '8.2', '8.3', '8.4'],
'register_shutdown_function' => ['8.0', '8.1'],
'splfileobject::fscanf' => ['8.1', '8.2', '8.3'],
'spltempfileobject::fscanf' => ['8.1', '8.2', '8.3'],
'xsltprocessor::transformtoxml' => ['8.1', '8.2', '8.3'],
'splfileobject::fscanf' => ['8.1', '8.2', '8.3', '8.4'],
'spltempfileobject::fscanf' => ['8.1', '8.2', '8.3', '8.4'],
'xsltprocessor::transformtoxml' => ['8.1', '8.2', '8.3', '8.4'],
];

/**
Expand Down Expand Up @@ -521,7 +522,11 @@ private function getReflectionFunction(string $functionName): ?ReflectionFunctio
{
try {
if (strpos($functionName, '::') !== false) {
return new ReflectionMethod($functionName);
if (PHP_VERSION_ID < 8_03_00) {
return new ReflectionMethod($functionName);
}

return ReflectionMethod::createFromMethodName($functionName);
}

/** @var callable-string $functionName */
Expand Down
Loading