当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionFunctionAbstract::returnsReference方法代码示例

本文整理汇总了PHP中ReflectionFunctionAbstract::returnsReference方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionFunctionAbstract::returnsReference方法的具体用法?PHP ReflectionFunctionAbstract::returnsReference怎么用?PHP ReflectionFunctionAbstract::returnsReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReflectionFunctionAbstract的用法示例。


在下文中一共展示了ReflectionFunctionAbstract::returnsReference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fromReflection

 /**
  * Creates a function signature instance from the supplied reflection.
  *
  * @param \ReflectionFunctionAbstract $reflection
  *
  * @return self
  */
 public static function fromReflection(\ReflectionFunctionAbstract $reflection)
 {
     $returnsReference = $reflection->returnsReference();
     $name = $reflection->getShortName();
     $parameterExpressions = self::getParameterExpressionsFromReflection($reflection);
     if ($reflection->isClosure()) {
         return self::closure($returnsReference, $parameterExpressions, array_keys($reflection->getStaticVariables()));
     } elseif ($reflection instanceof \ReflectionMethod) {
         if ($reflection->isPublic()) {
             $accessModifier = self::ACCESS_PUBLIC;
         } elseif ($reflection->isProtected()) {
             $accessModifier = self::ACCESS_PROTECTED;
         } else {
             $accessModifier = self::ACCESS_PRIVATE;
         }
         if ($reflection->isAbstract()) {
             $polymorphModifier = self::POLYMORPH_ABSTRACT;
         } elseif ($reflection->isFinal()) {
             $polymorphModifier = self::POLYMORPH_FINAL;
         } else {
             $polymorphModifier = null;
         }
         return self::method($returnsReference, $accessModifier, $polymorphModifier, $reflection->isStatic(), $name, $parameterExpressions);
     } else {
         return self::func($returnsReference, $name, $parameterExpressions);
     }
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:34,代码来源:FunctionSignature.php

示例2: formatFunction

 /**
  * Format a function signature.
  *
  * @param \ReflectionFunction $reflector
  *
  * @return string Formatted signature.
  */
 private static function formatFunction(\ReflectionFunctionAbstract $reflector)
 {
     return sprintf('<keyword>function</keyword> %s<function>%s</function>(%s)', $reflector->returnsReference() ? '&' : '', self::formatName($reflector), implode(', ', self::formatFunctionParams($reflector)));
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:11,代码来源:SignatureFormatter.php

示例3: parseCallable

 /**
  *
  * @param EntityFunction $callable
  * @param \ReflectionFunctionAbstract $reflection
  * @return $this
  */
 public static function parseCallable(EntityFunction $callable, \ReflectionFunctionAbstract $reflection)
 {
     $doc = $reflection->getDocComment();
     $params = [];
     if ($doc) {
         $info = ToolKit::parseDoc($doc);
         $callable->setDescription($info['desc']);
         $callable->setReturnInfo($info['return']['type'], $reflection->returnsReference(), $info['return']['desc']);
         $callable->setOptions($info['options']);
         $params = $info["params"];
     } else {
         $info = [];
     }
     /* @var \ReflectionParameter[] $params */
     foreach ($reflection->getParameters() as $param) {
         $argument = new EntityArgument($param->name);
         if (isset($params[$param->name]["desc"])) {
             $argument->description = $params[$param->name]["desc"];
         }
         if ($callable->getLine()) {
             $argument->setLine($callable->getLine());
         }
         $argument->setOptional($param->isOptional());
         $argument->setNullAllowed($param->allowsNull());
         $argument->setValue($param->isDefaultValueAvailable() ? $param->getDefaultValue() : null, $param->isPassedByReference());
         $argument->setByRef($param->isPassedByReference());
         /** @var \ReflectionParameter $param */
         if ($param->isArray()) {
             $argument->setCast(Types::ARR);
         }
         if ($c = $param->getClass()) {
             $argument->setCast(Types::OBJECT, $c->name);
         } elseif (isset($info['params'][$param->name])) {
             $_type = $info['params'][$param->name]["type"];
             if (strpos($_type, "|") || $_type === "mixed") {
                 // multiple types or mixed
                 $argument->setCast(Types::MIXED);
             } else {
                 if (strpos($_type, "[]")) {
                     $argument->setCast(Types::ARR, rtrim($_type, '[]'));
                 }
                 if (isset(Types::$codes[$_type])) {
                     $argument->setCast(Types::getType($_type));
                 } else {
                     $argument->setCast(Types::OBJECT, ltrim($_type, '\\'));
                 }
             }
         } else {
             $argument->warning("not documented");
         }
         $callable->pushArgument($argument);
     }
 }
开发者ID:sergeyk-jomedia,项目名称:koda,代码行数:59,代码来源:EntityFile.php

示例4: matchReflector

 public function matchReflector(\ReflectionFunctionAbstract $reflector)
 {
     $this->setReference($reflector->returnsReference());
     foreach ($reflector->getParameters() as $i => $parameter) {
         try {
             $this->getParameterAtIndex($i)->matchReflector($parameter);
         } catch (\OutOfBoundsException $e) {
             $this->appendParameter(ParameterNode::fromReflector($parameter));
         }
     }
     return $this;
 }
开发者ID:kidaa30,项目名称:redcat,代码行数:12,代码来源:FunctionTrait.php


注:本文中的ReflectionFunctionAbstract::returnsReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。