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

Update dependency jetbrains/phpstorm-stubs to 2024.3 #1469

Merged
merged 1 commit into from
Dec 17, 2024
Merged
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"require": {
"php": "~8.2.0 || ~8.3.2 || ~8.4.1",
"ext-json": "*",
"jetbrains/phpstorm-stubs": "2024.2",
"jetbrains/phpstorm-stubs": "2024.3",
"nikic/php-parser": "^5.3.1"
},
"authors": [
Expand Down
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use ReflectionParameter as CoreReflectionParameter;
use ReflectionProperty as CoreReflectionProperty;
use Roave\BetterReflection\Reflection\ReflectionClass;
use Roave\BetterReflection\Reflection\ReflectionClassConstant;
use Roave\BetterReflection\Reflection\ReflectionConstant;
use Roave\BetterReflection\Reflection\ReflectionFunction;
use Roave\BetterReflection\Reflection\ReflectionMethod;
Expand Down Expand Up @@ -131,20 +130,6 @@ static function (string $className): bool {
return false;
}

// Missing in JetBrains/phpstorm-stubs
if (
PHP_VERSION_ID >= 80400
&& in_array($className, [
'Deprecated',
'Generator',
'RequestParseBodyException',
'RoundingMode',
'StreamBucket',
], true)
) {
return false;
}

// Check only always enabled extensions
return in_array($reflection->getExtensionName(), self::EXTENSIONS, true);
},
Expand All @@ -167,11 +152,6 @@ public function testInternalClasses(string $className): void
self::assertSame($internalReflection->isInterface(), $class->isInterface());
self::assertSame($internalReflection->isTrait(), $class->isTrait());

if (PHP_VERSION_ID >= 80400 && $className === 'SplObjectStorage') {
// Needs fixes in JetBrains/phpstorm-stubs
return;
}

self::assertSameClassAttributes($internalReflection, $class);
}

Expand Down Expand Up @@ -208,10 +188,18 @@ private function assertSameClassAttributes(CoreReflectionClass $original, Reflec
$this->assertSameMethodAttributes($method, $stubbed->getMethod($method->getName()));
}

self::assertEquals(
$original->getConstants(),
array_map(static fn (ReflectionClassConstant $classConstant) => $classConstant->getValue(), $stubbed->getConstants()),
);
// We don't check getConstants() method because native reflection returns constants and enum cases together

foreach ($original->getReflectionConstants() as $originalConstant) {
if ($originalConstant->isEnumCase()) {
continue;
}

$stubbedConstant = $stubbed->getConstant($originalConstant->getName());

self::assertNotNull($stubbedConstant);
self::assertSame($originalConstant->getValue(), $stubbedConstant->getValue());
}
}

private function assertSameMethodAttributes(CoreReflectionMethod $original, ReflectionMethod $stubbed): void
Expand Down Expand Up @@ -303,25 +291,6 @@ public static function internalFunctionsProvider(): array
static function (string $functionName): bool {
$reflection = new CoreReflectionFunction($functionName);

// Missing in JetBrains/phpstorm-stubs
if (
PHP_VERSION_ID >= 80400
&& in_array($functionName, [
'array_all',
'array_any',
'array_find',
'array_find_key',
'die',
'exit',
'fpow',
'http_clear_last_response_headers',
'http_get_last_response_headers',
'request_parse_body',
], true)
) {
return false;
}

// Check only always enabled extensions
return in_array($reflection->getExtensionName(), self::EXTENSIONS, true);
},
Expand Down Expand Up @@ -382,17 +351,6 @@ public static function internalConstantsProvider(): array
}

foreach ($extensionConstants as $constantName => $constantValue) {
// Missing in JetBrains/phpstorm-stubs
if (
PHP_VERSION_ID >= 80400
&& in_array($constantName, [
'PHP_OUTPUT_HANDLER_PROCESSED',
'PHP_SBINDIR',
], true)
) {
continue;
}

$provider[] = [$constantName, $constantValue, $extensionName];
}
}
Expand Down Expand Up @@ -1162,8 +1120,7 @@ public static function dataPropertyIsDeprecatedInPhpVersion(): array
return [
['DateInterval', 'y', 70000, false],
['DateInterval', 'y', 80000, false],
['DOMDocument', 'actualEncoding', 70000, true],
['DOMDocument', 'actualEncoding', 80000, true],
['DOMDocument', 'actualEncoding', 80400, true],
];
}

Expand Down
Loading