@@ -11,13 +11,19 @@ class DynamicReturnTypeExtensionTest extends \PHPStan\Testing\TypeInferenceTestC
1111 */
1212 public function dataFileAsserts (): iterable
1313 {
14- // Path to a file with actual asserts of expected types:
14+ $ phpstanVersion = self ::getContainer ()->getByType (InstalledPhpStanVersion::class);
15+
16+ if ($ phpstanVersion ->satisfies ('^2.1.18 ' )) {
17+ // Improved rtrim handling in PHPStan 2.1.18 gives different results
18+ yield from self ::gatherAssertTypes (__DIR__ . '/data/slashit-functions.php ' );
19+ }
20+
21+ // Include for all supported PHPStan versions
1522 yield from self ::gatherAssertTypes (__DIR__ . '/data/apply-filters.php ' );
1623 yield from self ::gatherAssertTypes (__DIR__ . '/data/ApplyFiltersTestClass.php ' );
1724 yield from self ::gatherAssertTypes (__DIR__ . '/data/esc-sql.php ' );
1825 yield from self ::gatherAssertTypes (__DIR__ . '/data/normalize-whitespace.php ' );
1926 yield from self ::gatherAssertTypes (__DIR__ . '/data/shortcode-atts.php ' );
20- yield from self ::gatherAssertTypes (__DIR__ . '/data/slashit-functions.php ' );
2127 yield from self ::gatherAssertTypes (__DIR__ . '/data/stripslashes-from-strings-only.php ' );
2228 yield from self ::gatherAssertTypes (__DIR__ . '/data/wp-parse-url.php ' );
2329 yield from self ::gatherAssertTypes (__DIR__ . '/data/wp-slash.php ' );
@@ -34,6 +40,9 @@ public function testFileAsserts(string $assertType, string $file, ...$args): voi
3440
3541 public static function getAdditionalConfigFiles (): array
3642 {
37- return [dirname (__DIR__ ) . '/vendor/szepeviktor/phpstan-wordpress/extension.neon ' ];
43+ return [
44+ dirname (__DIR__ ) . '/vendor/szepeviktor/phpstan-wordpress/extension.neon ' ,
45+ __DIR__ . '/test-services.neon ' ,
46+ ];
3847 }
3948}
0 commit comments