diff --git a/src/Tree/EntityTreeBuilder.php b/src/Tree/EntityTreeBuilder.php index c701c9938822e29c4dc82b9cc29e1fd0c1b4ae50..52a063acc228e9ad8bcae315e5beac84da817b03 100644 --- a/src/Tree/EntityTreeBuilder.php +++ b/src/Tree/EntityTreeBuilder.php @@ -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(); diff --git a/src/Tree/TaxonomyTreeBuilder.php b/src/Tree/TaxonomyTreeBuilder.php index b106379b5942f33981e096c3611a248855699cbd..8e2ad2695425fb6c411392abc3da7f0bca693cf2 100644 --- a/src/Tree/TaxonomyTreeBuilder.php +++ b/src/Tree/TaxonomyTreeBuilder.php @@ -34,14 +34,19 @@ class TaxonomyTreeBuilder 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) { // Setup the language code for this tree. // Use current language by default. if (empty($langCode)) { @@ -126,14 +131,14 @@ class TaxonomyTreeBuilder 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(); diff --git a/src/Tree/TreeBuilderInterface.php b/src/Tree/TreeBuilderInterface.php index 356f9c176f3b1e67120d136a21215cb4e1ab00b0..5a01e0e6806fbf2c9067e7cfa50b33ddd41b8fd3 100644 --- a/src/Tree/TreeBuilderInterface.php +++ b/src/Tree/TreeBuilderInterface.php @@ -14,14 +14,19 @@ interface 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); /** * Create a tree node.