Change record status: 
Project: 
Introduced in branch: 
9.1.x
Introduced in version: 
9.1.5
Description: 

The method Drupal\Core\Database\StatementPrefetch::fetchObject() and its interface Drupal\Core\Database\StatementInterface::fetchObject() are mimicking the PDO implementation of fetchObject(). See: https://www.php.net/manual/en/pdostatement.fetchobject.php. That method has the 2 parameters (as optional).
The 2 added parameters are defined as:

  /**
   * Fetches the next row and returns it as an object.
   *
   * The object will be of the class specified by StatementInterface::setFetchMode()
   * or stdClass if not specified.
   *
   * @param string|null $class_name
   *   Name of the created class.
   * @param array $constructor_args
   *   Elements of this array are passed to the constructor.
   *
   * @return mixed
   *   The object of specified class or \stdClass if not specified. Returns
   *   FALSE or NULL if there is no next row.
   */
  public function fetchObject($class_name = NULL, $constructor_args = []);
Impacts: 
Module developers