diff --git a/composer.json b/composer.json index 824fca4e0..f349d6526 100644 --- a/composer.json +++ b/composer.json @@ -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": [ diff --git a/composer.lock b/composer.lock index 63ac32667..4dffc3408 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,27 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d8b68c69f0a1a77f0e687bbcdc2511f9", + "content-hash": "013eed64e35416a4970a4208fdbe7490", "packages": [ { "name": "jetbrains/phpstorm-stubs", - "version": "v2024.2", + "version": "v2024.3", "source": { "type": "git", "url": "https://github.com/JetBrains/phpstorm-stubs.git", - "reference": "cf7e447ddfa7f0cbab0c1dd38392f0cb05f9881c" + "reference": "0e82bdfe850c71857ee4ee3501ed82a9fc5d043c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/cf7e447ddfa7f0cbab0c1dd38392f0cb05f9881c", - "reference": "cf7e447ddfa7f0cbab0c1dd38392f0cb05f9881c", + "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/0e82bdfe850c71857ee4ee3501ed82a9fc5d043c", + "reference": "0e82bdfe850c71857ee4ee3501ed82a9fc5d043c", "shasum": "" }, "require-dev": { - "friendsofphp/php-cs-fixer": "v3.46.0", - "nikic/php-parser": "v5.0.0", - "phpdocumentor/reflection-docblock": "5.3.0", - "phpunit/phpunit": "10.5.5" + "friendsofphp/php-cs-fixer": "v3.64.0", + "nikic/php-parser": "v5.3.1", + "phpdocumentor/reflection-docblock": "5.6.0", + "phpunit/phpunit": "11.4.3" }, "type": "library", "autoload": { @@ -49,9 +49,9 @@ "type" ], "support": { - "source": "https://github.com/JetBrains/phpstorm-stubs/tree/v2024.2" + "source": "https://github.com/JetBrains/phpstorm-stubs/tree/v2024.3" }, - "time": "2024-06-17T19:18:18+00:00" + "time": "2024-12-14T08:03:12+00:00" }, { "name": "nikic/php-parser", diff --git a/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php b/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php index 9ed9284db..89a693d8c 100644 --- a/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php +++ b/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php @@ -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; @@ -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); }, @@ -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); } @@ -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 @@ -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); }, @@ -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]; } } @@ -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], ]; }