Verified Commit f3bb2ebd authored by Jess's avatar Jess
Browse files

Issue #3531412 by alexpott, xjm, nicxvan, catch, longwave: New constants in...

Issue #3531412 by alexpott, xjm, nicxvan, catch, longwave: New constants in \Drupal\Core\Theme\Registry are private but they are accessed with static::
parent 4a461032
Loading
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ public function getBaseHook($hook) {
   */
  protected function build() {
    $cache = [
      static::PREPROCESS_INVOKES => [],
      self::PREPROCESS_INVOKES => [],
    ];
    $fixed_preprocess_functions = $this->collectModulePreprocess($cache, 'preprocess');
    // First, preprocess the theme hooks advertised by modules. This will
@@ -674,7 +674,7 @@ protected function processExtension(array &$cache, $name, $type, $theme, $path)
    // template.
    if ($type == 'theme' || $type == 'base_theme') {
      foreach ($cache as $hook => $info) {
        if ($hook == static::PREPROCESS_INVOKES) {
        if ($hook == self::PREPROCESS_INVOKES) {
          continue;
        }
        // Check only if not registered by the theme or engine.
@@ -826,7 +826,7 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) {
          // Add missing preprocessor to existing hook.
          $cache[$hook]['preprocess functions'][] = $preprocessor;
          if (isset($invokes[$preprocessor])) {
            $cache[static::PREPROCESS_INVOKES][$preprocessor] = $invokes[$preprocessor];
            $cache[self::PREPROCESS_INVOKES][$preprocessor] = $invokes[$preprocessor];
          }
        }
        elseif (!isset($cache[$hook]) && strpos($hook, '__')) {
@@ -836,7 +836,7 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) {
          $this->completeSuggestion($hook, $cache);
          $cache[$hook]['preprocess functions'][] = $preprocessor;
          if (isset($invokes[$preprocessor])) {
            $cache[static::PREPROCESS_INVOKES][$preprocessor] = $invokes[$preprocessor];
            $cache[self::PREPROCESS_INVOKES][$preprocessor] = $invokes[$preprocessor];
          }
        }
      }
@@ -845,7 +845,7 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) {
    // hooks. This ensures that derivative hooks have a complete set of variable
    // preprocess functions.
    foreach ($cache as $hook => $info) {
      if ($hook == static::PREPROCESS_INVOKES) {
      if ($hook == self::PREPROCESS_INVOKES) {
        continue;
      }
      // The 'base hook' is only applied to derivative hooks already registered
@@ -953,7 +953,7 @@ public function getPrefixGroupedUserFunctions($prefixes = []) {
   */
  protected function addFixedPreprocessFunctions(array &$cache, array $fixed_preprocess_functions, array $old_cache = []): void {
    foreach (array_keys(array_diff_key($cache, $old_cache)) as $hook) {
      if ($hook == static::PREPROCESS_INVOKES) {
      if ($hook == self::PREPROCESS_INVOKES) {
        continue;
      }
      if (!isset($cache[$hook]['preprocess functions'])) {
@@ -990,7 +990,7 @@ protected function collectModulePreprocess(array &$cache, string $hook): array {
    // implementations are not executed.
    $this->moduleHandler->invokeAllWith($hook, function (callable $callable, string $module) use ($hook, &$cache, &$preprocess_functions) {
      $function = $module . '_' . $hook;
      $cache[static::PREPROCESS_INVOKES][$function] = ['module' => $module, 'hook' => $hook];
      $cache[self::PREPROCESS_INVOKES][$function] = ['module' => $module, 'hook' => $hook];
      $preprocess_functions[] = $function;
    });
    return $preprocess_functions;
+2 −2
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class RowCountExceptionTest extends UnitTestCase {
   */
  public static function providerTestExceptionMessage() {
    return [
      [static::DEFAULT_EXCEPTION_MESSAGE, ''],
      [self::DEFAULT_EXCEPTION_MESSAGE, ''],
      ['test', 'test'],
    ];
  }
@@ -47,7 +47,7 @@ public function testExceptionMessage($expected, $message): void {
   */
  public function testExceptionMessageNull(): void {
    $e = new RowCountException(NULL);
    $this->assertSame(static::DEFAULT_EXCEPTION_MESSAGE, $e->getMessage());
    $this->assertSame(self::DEFAULT_EXCEPTION_MESSAGE, $e->getMessage());
  }

}