Gets the arguments to pass to the service constructor/factory method.
public getArguments ( ) : array | ||
return | array | The array of arguments |
use Symfony\Component\DependencyInjection\Definition; $definition = new Definition(MyService::class); $definition->addArgument('argument1'); $definition->addArgument(new Reference('another_service')); $arguments = $definition->getArguments(); var_dump($arguments); // ['argument1', $anotherServiceInstance]
use Symfony\Component\DependencyInjection\Definition; $definition = new Definition(MyService::class, ['arg1', 'arg2']); $arguments = $definition->getArguments(); var_dump($arguments); // ['arg1', 'arg2']In this example, we created a new service definition for the `MyService` class and passed two arguments to its constructor directly in the definition object. We then retrieved the arguments using the `getArguments()` method. The Symfony\Component\DependencyInjection package library provides a set of PHP classes to manage dependency injection of services in PHP apps.
public getArguments ( ) : array | ||
return | array | The array of arguments |