Skip to content

Commit a5267c0

Browse files
committed
:octocat: phpstan ignore by PHP version (phpstan/phpstan#7843)
1 parent fde2425 commit a5267c0

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

.phpstan/baseline-lt-8.3.neon

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Call to an undefined method Random\\\\Randomizer\\:\\:getBytesFromString\\(\\)\\.$#"
5+
count: 1
6+
path: ../src/Core/OAuth2Provider.php
7+

.phpstan/ignore-by-php-version.php

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
$includes = [];
6+
7+
if(PHP_VERSION_ID < 80300){
8+
$includes[] = __DIR__.'/baseline-lt-8.3.neon';
9+
}
10+
11+
$config = [];
12+
$config['includes'] = $includes;
13+
$config['parameters']['phpVersion'] = PHP_VERSION_ID;
14+
15+
return $config;

phpstan.dist.neon

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ parameters:
1010

1111
treatPhpDocTypesAsCertain: false
1212

13-
13+
# see https://github.com/phpstan/phpstan-src/blob/1.8.x/build/ignore-by-php-version.neon.php
1414
includes:
1515
- phpstan-baseline.neon
16+
- .phpstan/ignore-by-php-version.php
1617
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
1718
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
1819
- vendor/chillerlan/php-settings-container/rules-magic-access.neon

src/Core/OAuth2Provider.php

+1
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ final public function setCodeVerifier(array $params):array{
635635
final public function generateVerifier(int $length):string{
636636

637637
// use the Randomizer if available
638+
// https://github.com/phpstan/phpstan/issues/7843
638639
if(PHP_VERSION_ID >= 80300){
639640
$randomizer = new \Random\Randomizer(new \Random\Engine\Secure);
640641

0 commit comments

Comments
 (0)