return sprintf(" [%s, '%s'](\$%s);\n",
$this->
dumpValue($callable[0
]),
$callable[1
],
$variableName);
} return sprintf(" %s(\$%s);\n",
$callable,
$variableName);
} private function addService(string
$id, Definition
$definition): array
{ $this->definitionVariables =
new \
SplObjectStorage();
$this->referenceVariables =
[];
$this->variableCount = 0;
$this->referenceVariables
[$id] =
new Variable('instance'
);
$return =
[];
if ($class =
$definition->
getClass()) { $class =
$class instanceof Parameter ? '%'.
$class.'%' :
$this->container->
resolveEnvPlaceholders($class);
$return[] =
sprintf(str_starts_with($class, '%'
) ? '@return object A %1$s instance' : '@return \%s',
ltrim($class, '\\'
));
} elseif ($definition->
getFactory()) { $factory =
$definition->
getFactory();
if (\
is_string($factory)) { $return[] =
sprintf('@return object An instance returned by %s()',
$factory);
} elseif (\
is_array($factory) && (\
is_string($factory[0
]) ||
$factory[0
] instanceof Definition ||
$factory[0
] instanceof Reference
)) {