Skip to content
Snippets Groups Projects

Issue #3508229: Fix PHP 8.4 implicit nullable deprecation

3 files
+ 25
10
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -35,14 +35,19 @@ class EntityTreeBuilder implements TreeBuilderInterface {
*
* @param string $entityType
* The type of the entity.
*
* @param string $bundleID
* The bundle ID.
* @param string|null $langCode
* The language code.
* @param int $parent
* The parent entity ID.
* @param int|null $max_depth
* The maximum depth of the tree.
*
* @return array
* All entities in the entity bundle.
*/
public function loadTree(string $entityType, string $bundleID, string $langCode = NULL, int $parent = 0, int $max_depth = NULL) {
public function loadTree(string $entityType, string $bundleID, ?string $langCode = NULL, int $parent = 0, ?int $max_depth = NULL) {
if ($this->hasAccess()) {
if ($bundleID === '*') {
// Load all entities regardless bundles.
@@ -148,14 +153,14 @@ class EntityTreeBuilder implements TreeBuilderInterface {
/**
* Check if a user has the access to the tree.
*
* @param \Drupal\Core\Session\AccountProxyInterface $user
* @param \Drupal\Core\Session\AccountProxyInterface|null $user
* The user object to check.
*
* @return bool
* If the user has the access to the tree return TRUE,
* otherwise return FALSE.
*/
private function hasAccess(AccountProxyInterface $user = NULL) {
private function hasAccess(?AccountProxyInterface $user = NULL) {
// Check current user as default.
if (empty($user)) {
$user = \Drupal::currentUser();
Loading