Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
@@ -33,11 +33,13 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
{
|
||||
private $resolverServiceId;
|
||||
private $controllerTag;
|
||||
private $controllerLocator;
|
||||
|
||||
public function __construct($resolverServiceId = 'argument_resolver.service', $controllerTag = 'controller.service_arguments')
|
||||
public function __construct(string $resolverServiceId = 'argument_resolver.service', string $controllerTag = 'controller.service_arguments', string $controllerLocator = 'argument_resolver.controller_locator')
|
||||
{
|
||||
$this->resolverServiceId = $resolverServiceId;
|
||||
$this->controllerTag = $controllerTag;
|
||||
$this->controllerLocator = $controllerLocator;
|
||||
}
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
@@ -126,7 +128,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
if (isset($arguments[$r->name][$p->name])) {
|
||||
$target = $arguments[$r->name][$p->name];
|
||||
if ('?' !== $target[0]) {
|
||||
$invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
|
||||
$invalidBehavior = ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE;
|
||||
} elseif ('' === $target = (string) substr($target, 1)) {
|
||||
throw new InvalidArgumentException(sprintf('A "%s" tag must have non-empty "id" attributes for service "%s".', $this->controllerTag, $id));
|
||||
} elseif ($p->allowsNull() && !$p->isOptional()) {
|
||||
@@ -136,17 +138,22 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
$binding = $bindings[$bindingName];
|
||||
|
||||
list($bindingValue, $bindingId) = $binding->getValues();
|
||||
$binding->setValues(array($bindingValue, $bindingId, true));
|
||||
|
||||
if (!$bindingValue instanceof Reference) {
|
||||
continue;
|
||||
$args[$p->name] = new Reference('.value.'.$container->hash($bindingValue));
|
||||
$container->register((string) $args[$p->name], 'mixed')
|
||||
->setFactory('current')
|
||||
->addArgument(array($bindingValue));
|
||||
} else {
|
||||
$args[$p->name] = $bindingValue;
|
||||
}
|
||||
|
||||
$binding->setValues(array($bindingValue, $bindingId, true));
|
||||
$args[$p->name] = $bindingValue;
|
||||
|
||||
continue;
|
||||
} elseif (!$type || !$autowire) {
|
||||
continue;
|
||||
} elseif (!$p->allowsNull()) {
|
||||
$invalidBehavior = ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE;
|
||||
}
|
||||
|
||||
if (Request::class === $type) {
|
||||
@@ -164,16 +171,18 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
throw new InvalidArgumentException($message);
|
||||
}
|
||||
|
||||
$args[$p->name] = $type ? new TypedReference($target, $type, $r->class, $invalidBehavior) : new Reference($target, $invalidBehavior);
|
||||
$args[$p->name] = $type ? new TypedReference($target, $type, $invalidBehavior) : new Reference($target, $invalidBehavior);
|
||||
}
|
||||
// register the maps as a per-method service-locators
|
||||
if ($args) {
|
||||
$controllers[$id.':'.$r->name] = ServiceLocatorTagPass::register($container, $args);
|
||||
$controllers[$id.'::'.$r->name] = ServiceLocatorTagPass::register($container, $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$container->getDefinition($this->resolverServiceId)
|
||||
->replaceArgument(0, ServiceLocatorTagPass::register($container, $controllers));
|
||||
->replaceArgument(0, $controllerLocatorRef = ServiceLocatorTagPass::register($container, $controllers));
|
||||
|
||||
$container->setAlias($this->controllerLocator, (string) $controllerLocatorRef);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user