thrownewInvalidArgumentException(sprintf('Service "_instanceof" key must be an array, "%s" given in "%s".',\gettype($instanceof),$file));
}
$this->instanceof=[];
$this->isLoadingInstanceof=true;
foreach($instanceofas$id=>$service){
if(!$service||!\is_array($service)){
thrownewInvalidArgumentException(sprintf('Type definition "%s" must be a non-empty array within "_instanceof" in "%s". Check your YAML syntax.',$id,$file));
thrownewInvalidArgumentException(sprintf('Service "_defaults" key must be an array, "%s" given in "%s".',\gettype($defaults),$file));
}
foreach($defaultsas$key=>$default){
if(!isset(self::DEFAULTS_KEYWORDS[$key])){
thrownewInvalidArgumentException(sprintf('The configuration key "%s" cannot be used to define a default value in "%s". Allowed keys are "%s".',$key,$file,implode('", "',self::DEFAULTS_KEYWORDS)));
}
}
if(isset($defaults['tags'])){
if(!\is_array($tags=$defaults['tags'])){
thrownewInvalidArgumentException(sprintf('Parameter "tags" in "_defaults" must be an array in "%s". Check your YAML syntax.',$file));
}
foreach($tagsas$tag){
if(!\is_array($tag)){
$tag=['name'=>$tag];
}
if(!isset($tag['name'])){
thrownewInvalidArgumentException(sprintf('A "tags" entry in "_defaults" is missing a "name" key in "%s".',$file));
}
$name=$tag['name'];
unset($tag['name']);
if(!\is_string($name)||''===$name){
thrownewInvalidArgumentException(sprintf('The tag name in "_defaults" must be a non-empty string in "%s".',$file));
thrownewInvalidArgumentException(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type in "%s". Check your YAML syntax.',$name,$attribute,$file));
}
}
}
}
if(isset($defaults['bind'])){
if(!\is_array($defaults['bind'])){
thrownewInvalidArgumentException(sprintf('Parameter "bind" in "_defaults" must be an array in "%s". Check your YAML syntax.',$file));
thrownewInvalidArgumentException(sprintf('Service names that start with an underscore are reserved. Rename the "%s" service or define it in XML instead.',$id));
thrownewInvalidArgumentException(sprintf('A service definition must be an array or a string starting with "@" but "%s" found for service "%s" in "%s". Check your YAML syntax.',\gettype($service),$id,$file));
thrownewInvalidArgumentException(sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias", "public" and "deprecated".',$key,$id,$file));
}
if('deprecated'===$key){
$alias->setDeprecated(true,$value);
}
}
return;
}
if($this->isLoadingInstanceof){
$definition=newChildDefinition('');
}elseif(isset($service['parent'])){
if(!empty($this->instanceof)){
thrownewInvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.',$id));
}
foreach($defaultsas$k=>$v){
if('tags'===$k){
// since tags are never inherited from parents, there is no confusion
// thus we can safely add them as defaults to ChildDefinition
continue;
}
if('bind'===$k){
thrownewInvalidArgumentException(sprintf('Attribute "bind" on service "%s" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file.',$id));
}
if(!isset($service[$k])){
thrownewInvalidArgumentException(sprintf('Attribute "%s" on service "%s" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.',$k,$id));
thrownewInvalidArgumentException(sprintf('The value of the "parent" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").',$id,$service['parent'],substr($service['parent'],1)));
thrownewInvalidArgumentException(sprintf('Invalid method call for service "%s": expected map or array, "%s" given in "%s".',$id,$callinstanceofTaggedValue?'!'.$call->getTag():\gettype($call),$file));
}
if(\is_string($k)){
thrownewInvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in "%s"?',$id,$k,$file));
thrownewInvalidArgumentException(sprintf('Unsupported tag "!%s", did you mean "!returns_clone" for service "%s" in "%s"?',$args->getTag(),$id,$file));
}
$returnsClone=true;
$args=$args->getValue();
}else{
$returnsClone=false;
}
}elseif(empty($call[0])){
thrownewInvalidArgumentException(sprintf('Invalid call for service "%s": the method must be defined as the first index of an array or as the only key of a map in "%s".',$id,$file));
}else{
$method=$call[0];
$args=$call[1]??[];
$returnsClone=$call[2]??false;
}
}
if(!\is_array($args)){
thrownewInvalidArgumentException(sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in "%s". Check your YAML syntax.',$method,$id,$file));
thrownewInvalidArgumentException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in "%s". Check your YAML syntax.',$id,$name,$attribute,$file));
thrownewInvalidArgumentException(sprintf('The value of the "decorates" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").',$id,$service['decorates'],substr($decorates,1)));
thrownewInvalidArgumentException(sprintf('Invalid value "%s" for attribute "decoration_on_invalid" on service "%s". Did you mean null (without quotes) in "%s"?',$decorationOnInvalid,$id,$file));
}else{
thrownewInvalidArgumentException(sprintf('Invalid value "%s" for attribute "decoration_on_invalid" on service "%s". Did you mean "exception", "ignore" or null in "%s"?',$decorationOnInvalid,$id,$file));
thrownewInvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try setting "autoconfigure: false" for the service.',$id));
thrownewInvalidArgumentException(sprintf('A "resource" attribute must be set when the "namespace" attribute is set for service "%s" in "%s". Check your YAML syntax.',$id,$file));
}
if(\array_key_exists('resource',$service)){
if(!\is_string($service['resource'])){
thrownewInvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.',$id,$file));
thrownewInvalidArgumentException(sprintf('The value of the "%s" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s" in "%s").',$parameter,$id,$callable,substr($callable,1),$file));
@trigger_error(sprintf('Using short %s syntax for service "%s" is deprecated since Symfony 4.4, use "[\'@%s\', \'%s\']" instead.',$parameter,$id,...$parts),\E_USER_DEPRECATED);
thrownewInvalidArgumentException(sprintf('Parameter "%s" must contain an array with two elements for service "%s" in "%s". Check your YAML syntax.',$parameter,$id,$file));
}
thrownewInvalidArgumentException(sprintf('Parameter "%s" must be a string or an array for service "%s" in "%s". Check your YAML syntax.',$parameter,$id,$file));
thrownewInvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".',$namespace,$file,$namespace,$extensionNamespaces?sprintf('"%s"',implode('", "',$extensionNamespaces)):'none'));
thrownewInvalidArgumentException(sprintf('"!%s" tag contains unsupported key "%s"; supported ones are "tag", "index_by", "default_index_method", and "default_priority_method".',$value->getTag(),implode('", "',$diff)));
thrownew\LogicException('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".');
thrownewInvalidArgumentException(sprintf('The configuration key "%s" is unsupported for definition "%s" in "%s". Allowed configuration keys are "%s".',$key,$id,$file,implode('", "',$keywords)));