diff --git a/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php b/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php
index b61ff4867961145e3d263bed832324101edef4dc..62b241ca7af6f32f3ac769b1835c8e151ca9aeb0 100644
--- a/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php
+++ b/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php
@@ -136,7 +136,7 @@ public function accept() {
     if ($name[0] == '.') {
       return FALSE;
     }
-    if ($this->isDir()) {
+    if ($this->current()->isDir()) {
       // If this is a subdirectory of a base search path, only recurse into the
       // fixed list of expected extension type directory names. Required for
       // scanning the top-level/root directory; without this condition, we would
diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index bc417f5fd362587585427f5526a7a9b2848fc8c0..789c919edb9577ff8d7234000096b20983fb17f2 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -245,11 +245,6 @@ parameters:
 			count: 2
 			path: lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
 
-		-
-			message: "#^Call to an undefined method Drupal\\\\Core\\\\Extension\\\\Discovery\\\\RecursiveExtensionFilterIterator\\:\\:isDir\\(\\)\\.$#"
-			count: 1
-			path: lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php
-
 		-
 			message: "#^Method Drupal\\\\Core\\\\Field\\\\FieldItemBase\\:\\:generateSampleValue\\(\\) should return array but return statement is missing\\.$#"
 			count: 1