Argument[Const] : Name : Value[?Const]

@param bool $isConst
@return ArgumentNode
@throws SyntaxErrorException
509620
protected function lexArgument(bool $isConst = false): ArgumentNode
    {
        $start = $this->lexer->getToken();

        /**
         * @return NodeInterface|TypeNodeInterface|ValueNodeInterface
         */
        $parseValue = function () use ($isConst): NodeInterface {
            $this->expect(TokenKindEnum::COLON);
            return $this->lexValue($isConst);
        };

        return new ArgumentNode(
            $this->lexName(),
            $parseValue(),
            $this->createLocation($start)
        );
    }
729096
public function setArgsValues(array $params = null, array $instanceArgs)
    {
        if (is_array($params)) {
            foreach ($params as $param) {
                foreach ($instanceArgs as &$instanceArg) {
                    if (is_null($instanceArg)) {
                        $instanceArg = $param;
                        break;
                    }
                }
            }
        }

        return $instanceArgs;
    }
1079146
protected function setEnums(array $constants)
    {
        $tempConstants = $constants;

        if (\array_key_exists(self::$defaultKey, $tempConstants)) {
            unset($tempConstants[self::$defaultKey]);
        }

        if (empty($tempConstants)) {
            throw new \UnexpectedValueException("No constants set");
        }

        $this->enums         = $tempConstants;
        $this->enumsReversed = \array_flip($this->enums);

        return $this;
    }
655874
function CallArguments_Argument(&$res, $sub)
    {
        if (!empty($res['php'])) {
            $res['php'] .= ', ';
        }

        $res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] :
            str_replace('$$FINAL', 'XML_val', $sub['php']);
    }
1186595
def set_const(const, val):
    ''''''
    try:
        cur = getattr(_c, const)
    except AttributeError:
        raise FSQEnvError(errno.ENOENT, u'no such constant:'\
                          u' {0}'.format(const))
    except TypeError:
        raise TypeError(errno.EINVAL, u'const name must be a string or'\
                        u' unicode object, not:'\
                        u' {0}'.format(const.__class__.__name__))
    should_be = cur.__class__
    try:
        if not isinstance(val, should_be):
            if should_be is unicode or cur is None:
                val = coerce_unicode(val, _c.FSQ_CHARSET)
            elif should_be is int and const.endswith('MODE'):
                val = int(val, 8)
            elif isinstance(cur, numbers.Integral):
                val = int(val)
            else:
                should_be(val)
    except (TypeError, ValueError, ):
        raise FSQEnvError(errno.EINVAL, u'invalid type for constant {0},'\
                          u' should be {1}, not:'\
                          u' {2}'.format(const, should_be.__name__,
                                         val.__class__.__name__))
    setattr(_c, const, val)
    return val
828831
private function validateArgument($type, $input, $possibleValues)
    {
        if (!\in_array($input, $possibleValues, true)) {
            throw new InvalidArgumentException($type . ' parameter "' . $input . '" is wrong. Possible values are: ' . implode(', ', $possibleValues));
        }
    }
1031449
protected function parseObject($isConst)
    {
        $start = $this->token->getStart();
        $this->expect(Token::BRACE_L_TYPE);

        $fieldNames = [];
        $fields = [];
        while (!$this->skip(Token::BRACE_R_TYPE)) {
            array_push($fields, $this->parseObjectField($isConst, $fieldNames));
        }

        return new ObjectValue($fields, $this->location($start));
    }
868817
static function storeConfig($namespace, $name, $value = '', $issystem = 0, $desc = null) 
    {
        $array = [];
        list($array['vtype'], $array['value']) = self::_toString($value);
        $array['desc'] = isset($desc) && $desc ? $desc : '' ;
        isset($issystem) && $array['issystem'] = $issystem;
        if (self::getConfigByName($namespace, $name)) {
            $result = CommonConfigModel::where('namespace', $namespace)
                                        ->where('name', $name)
                                        ->update($array);
        } else {
            $array['name'] = $name;
            $array['namespace'] = $namespace;
            $result = CommonConfigModel::insert($array);
        }
        self::setCache($namespace);
        return $result;
    }
831175
final protected function getRequiredString(array $values, string $name, bool $isFirst = false) : string
    {
        $value = $this->getOptionalString($values, $name, $isFirst);

        if ($value === null) {
            throw new \LogicException(sprintf(
                'Attribute "%s" of annotation %s is required.',
                $name,
                $this->getAnnotationName()
            ));
        }

        return $value;
    }
24075
protected function parseObjectField($isConst, &$fieldNames)
    {
        $start = $this->token->getStart();
        $name = $this->parseName();
        $value = $name->get('value');

        if (array_key_exists($value, $fieldNames)) {
            throw new \Exception(sprintf('Duplicate input object field %s.', $value));
        }

        $fieldNames[$value] = TRUE;
        $this->expect(Token::COLON_TYPE);

        return new ObjectField($name, $this->parseValue($isConst), $this->location($start));
    }
325817
private function buildNestedParams($nestedParams, $origParam, $isProto = false)
    {
        $paramsArray = [];

        foreach ($nestedParams as $param) {
            $nestedParam = explode(' ', trim($param), 3);

            // START proto nested arg missing description workaround
            if (count($nestedParam) < 3 && !$isProto) {
                throw new \Exception('nested param is in an invalid format: '. $param);
            }
            // END proto nested arg missing description workaround

            list($type, $name, $description) = $nestedParam;
            $name = substr($name, 1);
            $description = preg_replace('/\s+/', ' ', $description);

            $types = new Collection(
                array($type),
                $origParam->getDocBlock() ? $origParam->getDocBlock()->getContext() : null
            );

            $paramsArray[] = [
                'name' => substr($origParam->getVariableName(), 1) . '.' . $name,
                'description' => $this->buildDescription($origParam->getDocBlock(), $description, $origParam),
                'types' => $this->handleTypes($types),
                'optional' => null, // @todo
                'nullable' => null //@todo
            ];
        }

        return $paramsArray;
    }
914654
static function createConstantElement( $constant, $variablePlacement = false )
    {
        if ( is_array( $constant ) )
            return eZTemplateNodeTool::createArrayElement( $constant, $variablePlacement );
        else if ( is_string( $constant ) )
            return eZTemplateNodeTool::createStringElement( $constant, $variablePlacement );
        else if ( is_bool( $constant ) )
            return eZTemplateNodeTool::createBooleanElement( $constant, $variablePlacement );
        else if ( is_numeric( $constant ) )
            return eZTemplateNodeTool::createNumericElement( $constant, $variablePlacement );
        else
            return eZTemplateNodeTool::createVoidElement();
    }
889751
private function _const() {
    $node = new ConstantDeclarationStatementNode();
    $this->matchDocComment($node);
    $this->mustMatch(T_CONST, $node);
    $declarations = new CommaListNode();
    do {
      $declarations->addChild($this->constDeclaration());
    } while ($this->tryMatch(',', $declarations));
    $node->addChild($declarations, 'declarations');
    $this->endStatement($node);
    return $node;
  }
446102
protected function setDefault(array $constants)
    {
        if (!isset($constants[self::$defaultKey])) {
            throw new \UnexpectedValueException("No default enum set");
        }

        $this->default = $constants[self::$defaultKey];

        return $this;
    }
651374
protected function getArgValue($data, $arg, $annotation, $includeAnnotationProperty = true)
    {
        if(!is_string($arg))
        {
            return $arg;
        }
        else if(preg_match('/\{:([^\}]+)\}/', $arg, $matches) > 0)
        {
            $argName = $matches[1];
            if('value' === $argName)
            {
                return ObjectArrayHelper::get($data, $annotation->name);
            }
            $list = explode('.', $argName, 2);
            if('data' === $list[0])
            {
                if(isset($list[1]))
                {
                    return ObjectArrayHelper::get($data, $list[1]);
                }
                else
                {
                    return $data;
                }
            }
        }
        else if($includeAnnotationProperty && preg_match('/\{([^\}]+)\}/', $arg, $matches) > 0)
        {
            $argName = $matches[1];
            return ObjectArrayHelper::get($annotation, $argName);
        }
        else
        {
            return $arg;
        }
    }
263148
public function syntax(string $syntax = null)
    {
        if (null === $syntax)
            return $this->syntax;

        $this->syntax = S::syntax()->parse("{{$syntax}| }");
        return $this;
    }
794070
private function inlineArguments(ContainerBuilder $container, array $arguments, $isRoot = false)
    {
        foreach ($arguments as $k => $argument) {
            if ($isRoot) {
                $this->currentId = $k;
            }
            if (is_array($argument)) {
                $arguments[$k] = $this->inlineArguments($container, $argument);
            } elseif ($argument instanceof Reference) {
                if (!$container->hasDefinition($id = (string) $argument)) {
                    continue;
                }

                if ($this->isInlineableDefinition($id, $definition = $container->getDefinition($id))) {
                    $this->compiler->addLogMessage($this->formatter->formatInlineService($this, $id, $this->currentId));

                    if ($definition->isShared()) {
                        $arguments[$k] = $definition;
                    } else {
                        $arguments[$k] = clone $definition;
                    }
                }
            } elseif ($argument instanceof Definition) {
                $argument->setArguments($this->inlineArguments($container, $argument->getArguments()));
                $argument->setMethodCalls($this->inlineArguments($container, $argument->getMethodCalls()));
                $argument->setProperties($this->inlineArguments($container, $argument->getProperties()));

                $configurator = $this->inlineArguments($container, array($argument->getConfigurator()));
                $argument->setConfigurator($configurator[0]);

                $factory = $this->inlineArguments($container, array($argument->getFactory()));
                $argument->setFactory($factory[0]);
            }
        }

        return $arguments;
    }