@@ -133,6 +133,16 @@ static function (string $className): bool {
133133 return false ;
134134 }
135135
136+ // Missing in JetBrains/phpstorm-stubs
137+ /** @var list<class-string> $missingClasses */
138+ $ missingClasses = ['NoDiscard ' ];
139+ if (
140+ PHP_VERSION_ID >= 80500
141+ && in_array ($ className , $ missingClasses , true )
142+ ) {
143+ return false ;
144+ }
145+
136146 // Check only always enabled extensions
137147 return in_array ($ reflection ->getExtensionName (), self ::EXTENSIONS , true );
138148 },
@@ -188,8 +198,17 @@ private function assertSameClassAttributes(CoreReflectionClass $original, Reflec
188198 $ this ->assertSameInterfaces ($ original , $ stubbed );
189199
190200 foreach ($ original ->getMethods () as $ method ) {
201+ $ methodName = $ original ->getName () . '# ' . $ method ->getName ();
202+
203+ // Needs fixes in JetBrains/phpstorm-stubs
204+ if (
205+ in_array ($ methodName , ['Closure#getCurrent ' ], true )
206+ ) {
207+ continue ;
208+ }
209+
191210 $ stubbedMethod = $ stubbed ->getMethod ($ method ->getName ());
192- self ::assertNotNull ($ stubbedMethod );
211+ self ::assertNotNull ($ stubbedMethod, $ methodName );
193212
194213 $ this ->assertSameMethodAttributes ($ method , $ stubbedMethod );
195214 }
@@ -204,10 +223,19 @@ private function assertSameClassAttributes(CoreReflectionClass $original, Reflec
204223 $ originalConstantName = $ originalConstant ->getName ();
205224 assert ($ originalConstantName !== '' );
206225
226+ $ constantName = $ original ->getName () . ':: ' . $ originalConstant ->getName ();
227+
228+ // Needs fixes in JetBrains/phpstorm-stubs
229+ if (
230+ in_array ($ constantName , ['Attribute::TARGET_CONSTANT ' ], true )
231+ ) {
232+ continue ;
233+ }
234+
207235 $ stubbedConstant = $ stubbed ->getConstant ($ originalConstantName );
208236
209- self ::assertNotNull ($ stubbedConstant );
210- self ::assertSame ($ originalConstant ->getValue (), $ stubbedConstant ->getValue ());
237+ self ::assertNotNull ($ stubbedConstant, $ constantName );
238+ self ::assertSame ($ originalConstant ->getValue (), $ stubbedConstant ->getValue (), $ constantName );
211239 }
212240 }
213241
@@ -301,6 +329,20 @@ public static function internalFunctionsProvider(): array
301329 static function (string $ functionName ): bool {
302330 $ reflection = new CoreReflectionFunction ($ functionName );
303331
332+ // Missing in JetBrains/phpstorm-stubs
333+ if (
334+ PHP_VERSION_ID >= 80500
335+ && in_array ($ functionName , [
336+ 'array_first ' ,
337+ 'array_last ' ,
338+ 'clone ' ,
339+ 'get_error_handler ' ,
340+ 'get_exception_handler ' ,
341+ ], true )
342+ ) {
343+ return false ;
344+ }
345+
304346 // Check only always enabled extensions
305347 return in_array ($ reflection ->getExtensionName (), self ::EXTENSIONS , true );
306348 },
@@ -361,6 +403,18 @@ public static function internalConstantsProvider(): array
361403 }
362404
363405 foreach ($ extensionConstants as $ constantName => $ constantValue ) {
406+ // Missing in JetBrains/phpstorm-stubs
407+ if (
408+ PHP_VERSION_ID >= 80500
409+ && in_array ($ constantName , [
410+ 'IMAGETYPE_SVG ' ,
411+ 'IMAGETYPE_HEIF ' ,
412+ 'PHP_BUILD_DATE ' ,
413+ ], true )
414+ ) {
415+ continue ;
416+ }
417+
364418 $ provider [] = [$ constantName , $ constantValue , $ extensionName ];
365419 }
366420 }
0 commit comments