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

Issue #3446107 by bbrala, andypost, xjm: Enforce null coalescing operator ??...

Issue #3446107 by bbrala, andypost, xjm: Enforce null coalescing operator ?? instead of a ternary operator through phpcs

(cherry picked from commit 6e8fd96b)
parent 3927c703
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ public function __construct(
    $this->bin = $bin;
    $this->connection = $connection;
    $this->checksumProvider = $checksum_provider;
    $this->maxRows = $max_rows === NULL ? static::DEFAULT_MAX_ROWS : $max_rows;
    $this->maxRows = $max_rows ?? static::DEFAULT_MAX_ROWS;
  }

  /**
+1 −1
Original line number Diff line number Diff line
@@ -1450,7 +1450,7 @@ public function hasTranslationChanges() {
    $original = $this->original ? $this->original : NULL;

    if (!$original) {
      $id = $this->getOriginalId() !== NULL ? $this->getOriginalId() : $this->id();
      $id = $this->getOriginalId() ?? $this->id();
      $original = $this->entityTypeManager()->getStorage($this->getEntityTypeId())->loadUnchanged($id);
    }

+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public function get(array $elements) {
      return FALSE;
    }

    $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'render';
    $bin = $elements['#cache']['bin'] ?? 'render';
    if (($cache_bin = $this->cacheFactory->get($bin)) && $cache = $cache_bin->get($elements['#cache']['keys'], CacheableMetadata::createFromRenderArray($elements))) {
      if (!$this->requestStack->getCurrentRequest()->isMethodCacheable()) {
        if (!empty(array_filter($cache->tags, fn (string $tag) => str_starts_with($tag, 'CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD:')))) {
+1 −1
Original line number Diff line number Diff line
@@ -251,7 +251,7 @@ protected function getContentEntityTypeIdForCurrentRequest(Request $request) {

    if ($current_route = $request->attributes->get(RouteObjectInterface::ROUTE_OBJECT)) {
      $current_route_path = $current_route->getPath();
      $content_entity_type_id_for_current_route = isset($this->getContentEntityPaths()[$current_route_path]) ? $this->getContentEntityPaths()[$current_route_path] : '';
      $content_entity_type_id_for_current_route = $this->getContentEntityPaths()[$current_route_path] ?? '';
    }

    return $content_entity_type_id_for_current_route;
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ private function checkUrl(LanguageInterface $language, $message) {
    // If the rewritten URL has not a language prefix we pick a random prefix so
    // we can always check the prefixed URL.
    $prefixes = $this->config('language.negotiation')->get('url.prefixes');
    $stored_prefix = isset($prefixes[$language->getId()]) ? $prefixes[$language->getId()] : $this->randomMachineName();
    $stored_prefix = $prefixes[$language->getId()] ?? $this->randomMachineName();
    $this->assertNotEquals($prefix, $stored_prefix, $message);
    $prefix = $stored_prefix;

Loading