WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
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
23 changes: 23 additions & 0 deletions resources/functionMap_php85delta.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php // phpcs:ignoreFile

/**
* This contains the information needed to convert the function signatures for php 8.5 to php 8.4 (and vice versa)
*
* This has two sections.
* The 'new' section contains function/method names from FunctionSignatureMap (And alternates, if applicable) that do not exist in php8.4 or have different signatures in php 8.5.
* If they were just updated, the function/method will be present in the 'added' signatures.
* The 'old' signatures contains the signatures that are different in php 8.4.
* Functions are expected to be removed only in major releases of php.
*
* @see FunctionSignatureMap.php
*
* @phan-file-suppress PhanPluginMixedKeyNoKey (read by Phan when analyzing this file)
*/
return [
'new' => [
'chr' => ['non-empty-string', 'ascii'=>'int<0,255>'],
],
'old' => [
'chr' => ['non-empty-string', 'ascii'=>'int'],
]
];
4 changes: 4 additions & 0 deletions src/Reflection/SignatureMap/FunctionSignatureMapProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ public function getSignatureMap(): array
$signatureMap = $this->computeSignatureMapFile($signatureMap, __DIR__ . '/../../../resources/functionMap_php84delta.php');
}

if ($this->phpVersion->getVersionId() >= 80500) {
$signatureMap = $this->computeSignatureMapFile($signatureMap, __DIR__ . '/../../../resources/functionMap_php85delta.php');
}

return self::$signatureMaps[$cacheKey] = $signatureMap;
}

Expand Down
11 changes: 11 additions & 0 deletions tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,17 @@ public function testClone(): void
]);
}

#[RequiresPhp('>= 8.5')]
public function testBug13930(): void
{
$this->analyse([__DIR__ . '/data/bug-13930.php'], [
[
'Parameter #1 $codepoint of function chr expects int<0, 255>, 256 given.',
9,
],
]);
}

#[RequiresPhp('>= 8.1')]
public function testBug13862(): void
{
Expand Down
11 changes: 11 additions & 0 deletions tests/PHPStan/Rules/Functions/data/bug-13930.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php declare(strict_types = 1);

namespace Bug13930;

class HelloWorld
{
public function sayHello() : void
{
var_dump(chr(256));
}
}
Loading