diff --git a/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php b/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
index a2fa804363488d5c2fd0c085e302b80849e4eed2..65e0d98a7fd96b96ba957336f172d2dfe44e865f 100644
--- a/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
@@ -68,6 +68,9 @@ public function getUri() {
    *   TRUE if $mode denotes a readonly mode and the file was opened
    *   successfully, FALSE otherwise.
    *
+   * @throws \BadMethodCallException
+   *   When ::getLocalPath() is not implemented in the concrete driver class.
+   *
    * @see http://php.net/manual/streamwrapper.stream-open.php
    */
   public function stream_open($uri, $mode, $options, &$opened_path) {
@@ -89,6 +92,33 @@ public function stream_open($uri, $mode, $options, &$opened_path) {
     return (bool) $this->handle;
   }
 
+  /**
+   * Returns the canonical absolute path of the URI, if possible.
+   *
+   * @param string $uri
+   *   (optional) The stream wrapper URI to be converted to a canonical
+   *   absolute path. This may point to a directory or another type of file.
+   *
+   * @return string|bool
+   *   If $uri is not set, returns the canonical absolute path of the URI
+   *   previously set by the
+   *   Drupal\Core\StreamWrapper\StreamWrapperInterface::setUri() function.
+   *   If $uri is set and valid for this class, returns its canonical absolute
+   *   path, as determined by the realpath() function. If $uri is set but not
+   *   valid, returns FALSE.
+   *
+   * @throws \BadMethodCallException
+   *   If the method is not implemented in the concrete driver class.
+   *
+   * @todo This method is called by ReadOnlyStream::stream_open on the abstract
+   *   class, and therefore should be defined as well on the abstract class to
+   *   prevent static analysis errors. In D11, consider changing it to an
+   *   abstract method.
+   */
+  protected function getLocalPath($uri = NULL) {
+    throw new \BadMethodCallException(get_class($this) . '::getLocalPath() not implemented.');
+  }
+
   /**
    * Support for flock().
    *
diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon
index 10ac55102806fadcc3f0c56ecf26e603e81b9702..3a6e2d730cf1df469c74d53321599b7d72a8ce79 100644
--- a/core/phpstan-baseline.neon
+++ b/core/phpstan-baseline.neon
@@ -355,11 +355,6 @@ parameters:
 			count: 1
 			path: lib/Drupal/Core/Session/SessionManager.php
 
-		-
-			message: "#^Call to an undefined method Drupal\\\\Core\\\\StreamWrapper\\\\ReadOnlyStream\\:\\:getLocalPath\\(\\)\\.$#"
-			count: 1
-			path: lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
-
 		-
 			message: "#^Method Drupal\\\\Core\\\\Template\\\\AttributeValueBase\\:\\:render\\(\\) should return string but return statement is missing\\.$#"
 			count: 1