Commit eafefd89 authored by catch's avatar catch
Browse files

Issue #2619482 by cburschka, ankit.singh, ravi.shankar, jungle, daffie:...

Issue #2619482 by cburschka, ankit.singh, ravi.shankar, jungle, daffie: Convert all get_called_class()/get_class() to static::
parent 488b2cee
Loading
Loading
Loading
Loading
+2 −2
Changes for core/lib/Drupal/Component/Datetime/DateTimePlus.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ public function __call($method, array $args) {
      throw new \Exception('DateTime object not set.');
    }
    if (!method_exists($this->dateTimeObject, $method)) {
      throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
      throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method));
    }

    $result = call_user_func_array([$this->dateTimeObject, $method], $args);
@@ -399,7 +399,7 @@ public function diff($datetime2, $absolute = FALSE) {
   */
  public static function __callStatic($method, $args) {
    if (!method_exists('\DateTime', $method)) {
      throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
      throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method));
    }
    return call_user_func_array(['\DateTime', $method], $args);
  }
+1 −1
Changes for core/lib/Drupal/Component/Utility/ToStringTrait.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ public function __toString() {
    catch (\Exception $e) {
      // User errors in __toString() methods are considered fatal in the Drupal
      // error handler.
      trigger_error(get_class($e) . ' thrown while calling __toString on a ' . get_class($this) . ' object in ' . $e->getFile() . ' on line ' . $e->getLine() . ': ' . $e->getMessage(), E_USER_ERROR);
      trigger_error(get_class($e) . ' thrown while calling __toString on a ' . static::class . ' object in ' . $e->getFile() . ' on line ' . $e->getLine() . ': ' . $e->getMessage(), E_USER_ERROR);
      // In case we are using another error handler that did not fatal on the
      // E_USER_ERROR, we terminate execution. However, for test purposes allow
      // a return value.
+1 −1
Changes for core/lib/Drupal/Component/Utility/Xss.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ public static function filter($string, array $html_tags = NULL) {
    $string = preg_replace('/&([A-Za-z][A-Za-z0-9]*;)/', '&\1', $string);
    $html_tags = array_flip($html_tags);
    // Late static binding does not work inside anonymous functions.
    $class = get_called_class();
    $class = static::class;
    $splitter = function ($matches) use ($html_tags, $class) {
      return $class::split($matches[1], $html_tags, $class);
    };
+1 −1
Changes for core/lib/Drupal/Core/Database/Connection.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1822,7 +1822,7 @@ public static function createConnectionOptionsFromUrl($url, $root) {
    }

    // Use reflection to get the namespace of the class being called.
    $reflector = new \ReflectionClass(get_called_class());
    $reflector = new \ReflectionClass(static::class);

    $database = [
      'driver' => $url_components['scheme'],
+1 −1
Changes for core/lib/Drupal/Core/Datetime/Element/Datelist.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ class Datelist extends DateElementBase {
   * {@inheritdoc}
   */
  public function getInfo() {
    $class = get_class($this);
    $class = static::class;
    return [
      '#input' => TRUE,
      '#element_validate' => [
Loading