Skip to content

Comments

Fix #617: Add default value for TasksCollection constructor parameter#625

Merged
freekmurze merged 1 commit intomainfrom
fix/issue-617-tasks-collection-default-parameter
Feb 9, 2026
Merged

Fix #617: Add default value for TasksCollection constructor parameter#625
freekmurze merged 1 commit intomainfrom
fix/issue-617-tasks-collection-default-parameter

Conversation

@freekmurze
Copy link
Member

Summary

  • TasksCollection::__construct($taskClassNames) had a required parameter with no default value
  • When Laravel's DI container tries to resolve TasksCollection before the singleton binding is registered (e.g., in custom service providers or artisan commands), it throws: Unresolvable dependency resolving [Parameter #0 [ <required> $taskClassNames ]]

Changes

  • Added default value [] for the $taskClassNames parameter in TasksCollection::__construct()
  • When the singleton is properly bound (normal flow), the config value is passed and the default is never used
  • When resolved without the binding, it gracefully creates an empty collection

Testing

  • All 76 local tests pass (292 assertions)

Fixes #617

🤖 Generated with Claude Code

The $taskClassNames parameter had no default value, causing an
"Unresolvable dependency" error when Laravel's container tried to
resolve TasksCollection before the singleton binding was registered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@freekmurze freekmurze merged commit ca3029c into main Feb 9, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unresolvable dependency resolving [Parameter #0 [ <required> $taskClassNames ]] in class Spatie\Multitenancy\Tasks\TasksCollection

1 participant