5252use function implode ;
5353use function in_array ;
5454use function is_resource ;
55+ use function is_string ;
5556use function method_exists ;
5657use function preg_replace ;
5758use function sprintf ;
@@ -120,7 +121,8 @@ public function generateClassStub(string $className): StubData|null
120121 ? $ this ->generateStubInNamespace ($ node , $ classReflection ->getNamespaceName ())
121122 : $ this ->generateStub ($ node );
122123
123- $ extensionName = $ classReflection ->getExtensionName () ?: null ;
124+ $ extensionName = $ classReflection ->getExtension ()?->getName();
125+ assert ((is_string ($ extensionName ) && $ extensionName !== '' ) || $ extensionName === null );
124126
125127 return $ this ->createStubData ($ stub , $ extensionName );
126128 }
@@ -147,7 +149,10 @@ public function generateFunctionStub(string $functionName): StubData|null
147149 $ functionNode ->setReturnType ($ this ->formatType ($ returnType ));
148150 }
149151
150- $ extensionName = $ functionReflection ->getExtensionName () ?: null ;
152+ /** @phpstan-ignore-next-line */
153+ $ extensionName = $ functionReflection ->getExtension ()?->getName();
154+ /** @phpstan-ignore-next-line */
155+ assert ((is_string ($ extensionName ) && $ extensionName !== '' ) || $ extensionName === null );
151156
152157 if (! $ functionReflection ->inNamespace ()) {
153158 return $ this ->createStubData ($ this ->generateStub ($ functionNode ->getNode ()), $ extensionName );
@@ -214,7 +219,7 @@ private function addDocComment(
214219 Class_ |Interface_ |Trait_ |Enum_ |Method |Property |Function_ $ node ,
215220 CoreReflectionClass |CoreReflectionMethod |CoreReflectionProperty |CoreReflectionFunction $ reflection ,
216221 ): void {
217- $ docComment = $ reflection ->getDocComment () ? : '' ;
222+ $ docComment = $ reflection ->getDocComment () !== false ? $ reflection -> getDocComment () : '' ;
218223 $ annotations = [];
219224
220225 if (
0 commit comments