diff -u b/core/lib/Drupal/Core/Access/AccessResult.php b/core/lib/Drupal/Core/Access/AccessResult.php --- b/core/lib/Drupal/Core/Access/AccessResult.php +++ b/core/lib/Drupal/Core/Access/AccessResult.php @@ -260,7 +260,7 @@ /** * Convenience method, adds the "user.permissions" cache context. * - * @param \Drupal\Core\Session\AccountInterface|NULL $account + * @param \Drupal\Core\Session\AccountInterface|null $account * An optional account. The optional part is @deprecated, in Drupal 9, * $account will be mandatory. * @@ -271,11 +271,14 @@ // contexts mechanism for more fine grained caching. Otherwise, the right // tags needs to be added manually. if ($this->isCurrentUser($account)) { - $this->addCacheContexts(array('user.permissions')); + $this->addCacheContexts(['user.permissions']); } else { $this->addCacheableDependency($account); - $this->addCacheTags(array_map(function ($rid) { return "config:user.role.$rid";}, (array) $account->getRoles())); + $this->addCacheTags(array_map(function ($rid) { + return "config:user.role.$rid"; + }, + (array) $account->getRoles())); } return $this; } @@ -283,7 +286,7 @@ /** * Indicate this context is only cacheable until an account changes. * - * @param \Drupal\Core\Session\AccountInterface|NULL $account + * @param \Drupal\Core\Session\AccountInterface|null $account * An optional account. The optional part is @deprecated, in Drupal 9, * $account will be mandatory. * @@ -313,7 +316,7 @@ /** * This checks whether an account is the current user. * - * @param \Drupal\Core\Session\AccountInterface|NULL $account + * @param \Drupal\Core\Session\AccountInterface|null $account * An optional account. * * @return bool diff -u b/core/lib/Drupal/Core/Session/CurrentUser.php b/core/lib/Drupal/Core/Session/CurrentUser.php --- b/core/lib/Drupal/Core/Session/CurrentUser.php +++ b/core/lib/Drupal/Core/Session/CurrentUser.php @@ -1,10 +1,5 @@ isAllowed() && $account->hasPermission('delete own ' . $type . ' content')) { - $access = $access->orIf(AccessResult::allowedIf($account->id() == $node->getOwnerId()))->cachePerUser($accout)->addCacheableDependency($node); + $access = $access->orIf(AccessResult::allowedIf($account->id() == $node->getOwnerId()))->cachePerUser($account)->addCacheableDependency($node); } break; diff -u b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php --- b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -950,7 +950,8 @@ $access_result = AccessResult::allowedIfHasPermissions($account, $permissions, $conjunction); $this->assertEquals($expected_access->isAllowed(), $access_result->isAllowed()); - $this->assertEquals($expected_access->isNeutral(), $access_result->isNeutral()); $this->assertEquals($expected_access->isForbidden(), $access_result->isForbidden()); + $this->assertEquals($expected_access->isNeutral(), $access_result->isNeutral()); + $this->assertEquals($expected_access->isForbidden(), $access_result->isForbidden()); } /**