diff --git a/build/baseline-pre-8.0.neon b/build/baseline-pre-8.0.neon index d170a8d4a9..6beae4c095 100644 --- a/build/baseline-pre-8.0.neon +++ b/build/baseline-pre-8.0.neon @@ -37,7 +37,7 @@ parameters: path: ../src/Reflection/ClassReflection.php - - rawMessage: 'Method PHPStan\Reflection\ClassReflection::findConstructor() should return PHPStan\BetterReflection\Reflection\Adapter\ReflectionMethod|null but returns ReflectionMethod.' + rawMessage: 'Method PHPStan\Reflection\ClassReflection::findConstructor() should return PHPStan\BetterReflection\Reflection\Adapter\ReflectionMethod|null but returns ReflectionMethod.' identifier: return.type count: 2 path: ../src/Reflection/ClassReflection.php diff --git a/composer.json b/composer.json index 7219ef39d7..1636ea804d 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "hoa/compiler": "3.17.08.08", "hoa/exception": "^1.0", "hoa/file": "1.17.07.11", - "jetbrains/phpstorm-stubs": "dev-master#87940f228f9c3e6446e40d6cc3668f249fe871a5", + "jetbrains/phpstorm-stubs": "dev-master#ba8e203170c8e3b58082a895ca13213fd0324ddd", "nette/bootstrap": "^3.0", "nette/di": "^3.1.4", "nette/neon": "3.3.4", diff --git a/composer.lock b/composer.lock index d9f2158470..fa5261b70b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "018f18ace63a6268bd90ea37daca0d80", + "content-hash": "8d184fa42dda962c38eb71e7cd358776", "packages": [ { "name": "clue/ndjson-react", @@ -1632,12 +1632,12 @@ "source": { "type": "git", "url": "https://github.com/JetBrains/phpstorm-stubs", - "reference": "87940f228f9c3e6446e40d6cc3668f249fe871a5" + "reference": "ba8e203170c8e3b58082a895ca13213fd0324ddd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/87940f228f9c3e6446e40d6cc3668f249fe871a5", - "reference": "87940f228f9c3e6446e40d6cc3668f249fe871a5", + "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/ba8e203170c8e3b58082a895ca13213fd0324ddd", + "reference": "ba8e203170c8e3b58082a895ca13213fd0324ddd", "shasum": "" }, "require-dev": { @@ -1669,7 +1669,7 @@ "stubs", "type" ], - "time": "2026-05-16T11:58:25+00:00" + "time": "2026-06-05T12:22:13+00:00" }, { "name": "nette/bootstrap", diff --git a/conf/config.neon b/conf/config.neon index df8f46567a..040b55b5d4 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -132,10 +132,8 @@ parameters: stubFiles: - ../stubs/Memcached.stub - ../stubs/Redis.stub - - ../stubs/ReflectionAttribute.stub - - ../stubs/ReflectionClassConstant.stub + - ../stubs/ReflectionEnum.stub - ../stubs/ReflectionFunctionAbstract.stub - - ../stubs/ReflectionMethod.stub - ../stubs/ReflectionParameter.stub - ../stubs/ReflectionProperty.stub - ../stubs/iterable.stub diff --git a/resources/constantToFunctionParameterMap.php b/resources/constantToFunctionParameterMap.php index c38b9fbed3..aba98a8110 100644 --- a/resources/constantToFunctionParameterMap.php +++ b/resources/constantToFunctionParameterMap.php @@ -1810,7 +1810,7 @@ ], 'DOMDocument::schemaValidate' => [ - 'options' => [ + 'flags' => [ 'type' => 'bitmask', 'constants' => [ 'LIBXML_SCHEMA_CREATE', diff --git a/src/PhpDoc/ReflectionClassStubFilesExtension.php b/src/PhpDoc/ReflectionClassStubFilesExtension.php deleted file mode 100644 index f47fe54bba..0000000000 --- a/src/PhpDoc/ReflectionClassStubFilesExtension.php +++ /dev/null @@ -1,29 +0,0 @@ -phpVersion->supportsLazyObjects()) { - return [ - __DIR__ . '/../../stubs/ReflectionClass.stub', - ]; - } - - return [ - __DIR__ . '/../../stubs/ReflectionClassWithLazyObjects.stub', - ]; - } - -} diff --git a/src/PhpDoc/ReflectionEnumStubFilesExtension.php b/src/PhpDoc/ReflectionEnumStubFilesExtension.php deleted file mode 100644 index d48519b735..0000000000 --- a/src/PhpDoc/ReflectionEnumStubFilesExtension.php +++ /dev/null @@ -1,29 +0,0 @@ -phpVersion->supportsEnums()) { - return []; - } - - if (!$this->phpVersion->supportsLazyObjects()) { - return [__DIR__ . '/../../stubs/ReflectionEnum.stub']; - } - - return [__DIR__ . '/../../stubs/ReflectionEnumWithLazyObjects.stub']; - } - -} diff --git a/stubs/ReflectionAttribute.stub b/stubs/ReflectionAttribute.stub deleted file mode 100644 index 0bac59de5b..0000000000 --- a/stubs/ReflectionAttribute.stub +++ /dev/null @@ -1,21 +0,0 @@ - - */ - public function getName() : string - { - } - - /** - * @return T - */ - public function newInstance() : object - { - } -} diff --git a/stubs/ReflectionClass.stub b/stubs/ReflectionClass.stub deleted file mode 100644 index fc751cee66..0000000000 --- a/stubs/ReflectionClass.stub +++ /dev/null @@ -1,56 +0,0 @@ - - */ - public $name; - - /** - * @param T|class-string $argument - * @throws ReflectionException - */ - public function __construct($argument) {} - - /** - * @return class-string - */ - public function getName() : string; - - /** - * @return non-empty-string - */ - public function getShortName() : string; - - /** - * @param mixed ...$args - * - * @return T - */ - public function newInstance(...$args) {} - - /** - * @param array $args - * - * @return T - */ - public function newInstanceArgs(array $args) {} - - /** - * @return T - */ - public function newInstanceWithoutConstructor(); - - /** - * @return list> - */ - public function getAttributes(?string $name = null, int $flags = 0) - { - } -} diff --git a/stubs/ReflectionClassConstant.stub b/stubs/ReflectionClassConstant.stub deleted file mode 100644 index 4396980e06..0000000000 --- a/stubs/ReflectionClassConstant.stub +++ /dev/null @@ -1,11 +0,0 @@ -> - */ - public function getAttributes(?string $name = null, int $flags = 0) - { - } -} diff --git a/stubs/ReflectionClassWithLazyObjects.stub b/stubs/ReflectionClassWithLazyObjects.stub deleted file mode 100644 index a840f5247b..0000000000 --- a/stubs/ReflectionClassWithLazyObjects.stub +++ /dev/null @@ -1,118 +0,0 @@ - - */ - public $name; - - /** - * @param T|class-string $argument - * @throws ReflectionException - */ - public function __construct($argument) {} - - /** - * @return class-string - */ - public function getName() : string; - - /** - * @return non-empty-string - */ - public function getShortName() : string; - - /** - * @param mixed ...$args - * - * @return T - */ - public function newInstance(...$args) {} - - /** - * @param array $args - * - * @return T - */ - public function newInstanceArgs(array $args) {} - - /** - * @return T - */ - public function newInstanceWithoutConstructor(); - - /** - * @return list> - */ - public function getAttributes(?string $name = null, int $flags = 0) - { - } - - /** - * @param callable(T): void $initializer - * @return T - */ - public function newLazyGhost(callable $initializer, int $options = 0): object - { - } - - /** - * @param callable(T): T $factory - * @return T - */ - public function newLazyProxy(callable $factory, int $options = 0): object - { - } - - /** - * @param T $object - * @param callable(T): void $initializer - */ - public function resetAsLazyGhost(object $object, callable $initializer, int $options = 0): void - { - } - - /** - * @param T $object - * @param callable(T): T $factory - */ - public function resetAsLazyProxy(object $object, callable $factory, int $options = 0): void - { - } - - /** - * @param T $object - * @return T - */ - public function initializeLazyObject(object $object): object - { - } - - /** - * @param T $object - * @return T - */ - public function markLazyObjectAsInitialized(object $object): object - { - } - - /** - * @param T $object - */ - public function getLazyInitializer(object $object): ?callable - { - } - - /** - * @param T $object - */ - public function isUninitializedLazyObject(object $object): bool - { - } -} diff --git a/stubs/ReflectionEnum.stub b/stubs/ReflectionEnum.stub index 9968c5c7e3..4f75f666d7 100644 --- a/stubs/ReflectionEnum.stub +++ b/stubs/ReflectionEnum.stub @@ -1,29 +1,14 @@ + * @template-covariant TReflectedClass of UnitEnum + * @extends ReflectionClass */ class ReflectionEnum extends ReflectionClass { - /** - * @return (T is BackedEnum ? ReflectionEnumBackedCase[] : ReflectionEnumUnitCase[]) - */ - public function getCases(): array {} - - /** - * @return (T is BackedEnum ? ReflectionEnumBackedCase : ReflectionEnumUnitCase) - * @throws ReflectionException - */ - public function getCase(string $name): ReflectionEnumUnitCase {} - - /** - * @phpstan-assert-if-true self $this + * @phpstan-assert-if-true self $this * @phpstan-assert-if-true !null $this->getBackingType() */ public function isBacked(): bool {} - - public function getBackingType(): ?ReflectionNamedType {} - } diff --git a/stubs/ReflectionEnumWithLazyObjects.stub b/stubs/ReflectionEnumWithLazyObjects.stub deleted file mode 100644 index 92ec6c660b..0000000000 --- a/stubs/ReflectionEnumWithLazyObjects.stub +++ /dev/null @@ -1,29 +0,0 @@ - - */ -class ReflectionEnum extends ReflectionClass -{ - - /** - * @return (T is BackedEnum ? ReflectionEnumBackedCase[] : ReflectionEnumUnitCase[]) - */ - public function getCases(): array {} - - /** - * @return (T is BackedEnum ? ReflectionEnumBackedCase : ReflectionEnumUnitCase) - * @throws ReflectionException - */ - public function getCase(string $name): ReflectionEnumUnitCase {} - - /** - * @phpstan-assert-if-true self $this - * @phpstan-assert-if-true !null $this->getBackingType() - */ - public function isBacked(): bool {} - - public function getBackingType(): ?ReflectionNamedType {} - -} diff --git a/stubs/ReflectionFunctionAbstract.stub b/stubs/ReflectionFunctionAbstract.stub index da1a6edc18..54d768fbdc 100644 --- a/stubs/ReflectionFunctionAbstract.stub +++ b/stubs/ReflectionFunctionAbstract.stub @@ -2,19 +2,6 @@ abstract class ReflectionFunctionAbstract { - - /** - * @return string|false - */ - public function getFileName () {} - - /** - * @return list> - */ - public function getAttributes(?string $name = null, int $flags = 0) - { - } - /** * @phpstan-assert-if-true !null $this->getReturnType() */ @@ -28,5 +15,4 @@ abstract class ReflectionFunctionAbstract public function hasTentativeReturnType(): bool { } - } diff --git a/stubs/ReflectionMethod.stub b/stubs/ReflectionMethod.stub deleted file mode 100644 index cb060a6c97..0000000000 --- a/stubs/ReflectionMethod.stub +++ /dev/null @@ -1,16 +0,0 @@ -> - */ - public function getAttributes(?string $name = null, int $flags = 0) - { - } - /** * @phpstan-assert-if-true !null $this->getType() */ public function hasType(): bool { } - } diff --git a/stubs/ReflectionProperty.stub b/stubs/ReflectionProperty.stub index 4cfb92d0db..e80a44dad1 100644 --- a/stubs/ReflectionProperty.stub +++ b/stubs/ReflectionProperty.stub @@ -2,19 +2,10 @@ class ReflectionProperty { - - /** - * @return list> - */ - public function getAttributes(?string $name = null, int $flags = 0) - { - } - /** * @phpstan-assert-if-true !null $this->getType() */ public function hasType(): bool { } - }