Skip to content

Commit

Permalink
Warning in PHP 8.1 when passing the bundle and no exclude options (#5219
Browse files Browse the repository at this point in the history
)

* Prevent warning when passing bundle but no exclude

* PHP CS
  • Loading branch information
claudiu-cristea committed Sep 4, 2022
1 parent ee4df61 commit 828aa21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Drupal/Commands/core/DeployHookCommands.php
Expand Up @@ -174,7 +174,7 @@ public static function updateDoOneDeployHook(string $function, DrushBatchContext
// Module names can include '_deploy', so deploy functions like
// module_deploy_deploy_name() are ambiguous. Check every occurrence.
$components = explode('_', $function);
foreach (array_keys($components, 'deploy', TRUE) as $position) {
foreach (array_keys($components, 'deploy', true) as $position) {
$module = implode('_', array_slice($components, 0, $position));
$name = implode('_', array_slice($components, $position + 1));
$filename = $module . '.deploy';
Expand Down
2 changes: 1 addition & 1 deletion src/Drupal/Commands/core/EntityCommands.php
Expand Up @@ -172,7 +172,7 @@ protected function getQuery(string $entity_type, ?string $ids, array $options):
$idKey = $this->entityTypeManager->getDefinition($entity_type)->getKey('id');
$query = $query->condition($idKey, $ids, 'IN');
} elseif ($options['bundle'] || $options['exclude']) {
if ($exclude = StringUtils::csvToArray($options['exclude'])) {
if ($exclude = StringUtils::csvToArray((string) $options['exclude'])) {
$idKey = $this->entityTypeManager->getDefinition($entity_type)->getKey('id');
$query = $query->condition($idKey, $exclude, 'NOT IN');
}
Expand Down

0 comments on commit 828aa21

Please sign in to comment.