We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
11.22.0
8.3.11
No response
Config attribute throws a Illuminate\Contracts\Container\BindingResolutionException if the set value is NULL.
If the value is not NULL, it works as expected.
php artisan app:test-command
Illuminate\Contracts\Container\BindingResolutionException Unresolvable dependency resolving [Parameter #0 [ <required> ?string $bar ]] in class App\Services\TestService at vendor/laravel/framework/src/Illuminate/Container/Container.php:1206 1202▕ protected function unresolvablePrimitive(ReflectionParameter $parameter) 1203▕ { 1204▕ $message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; 1205▕ ➜ 1206▕ throw new BindingResolutionException($message); 1207▕ } 1208▕ 1209▕ /** 1210▕ * Register a new before resolving callback for all types. +22 vendor frames 23 artisan:13 Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))
app/Services/TestService.php
namespace App\Services; use Illuminate\Container\Attributes\Config; class TestService { public function __construct( #[Config('foo.bar')] private ?string $bar, ) {} public function getBar(): ?string { return $this->bar; } }
app/Console/Commands/TestCommand.php
namespace App\Console\Commands; use App\Services\TestService; use Illuminate\Console\Command; class TestCommand extends Command { protected $signature = 'app:test-command'; public function handle(TestService $testService) { $this->info($testService->getBar()); } }
config/foo.php
return [ 'bar' => null, ];
so, run php artisan app:test-command.
The text was updated successfully, but these errors were encountered:
crynobone
Successfully merging a pull request may close this issue.
Laravel Version
11.22.0
PHP Version
8.3.11
Database Driver & Version
No response
Description
Config attribute throws a Illuminate\Contracts\Container\BindingResolutionException if the set value is NULL.
If the value is not NULL, it works as expected.
Steps To Reproduce
app/Services/TestService.php
app/Console/Commands/TestCommand.php
config/foo.php
so, run
php artisan app:test-command
.The text was updated successfully, but these errors were encountered: