當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CodeBase::getFunctionByFQSEN方法代碼示例

本文整理匯總了PHP中Phan\CodeBase::getFunctionByFQSEN方法的典型用法代碼示例。如果您正苦於以下問題:PHP CodeBase::getFunctionByFQSEN方法的具體用法?PHP CodeBase::getFunctionByFQSEN怎麽用?PHP CodeBase::getFunctionByFQSEN使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phan\CodeBase的用法示例。


在下文中一共展示了CodeBase::getFunctionByFQSEN方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: analyzeDuplicateFunction

 /**
  * Check to see if the given Clazz is a duplicate
  *
  * @return null
  */
 public static function analyzeDuplicateFunction(CodeBase $code_base, FunctionInterface $method)
 {
     $fqsen = $method->getFQSEN();
     if (!$fqsen->isAlternate()) {
         return;
     }
     $original_fqsen = $fqsen->getCanonicalFQSEN();
     if ($original_fqsen instanceof FullyQualifiedFunctionName) {
         if (!$code_base->hasFunctionWithFQSEN($original_fqsen)) {
             return;
         }
         $original_method = $code_base->getFunctionByFQSEN($original_fqsen);
     } else {
         if (!$code_base->hasMethodWithFQSEN($original_fqsen)) {
             return;
         }
         $original_method = $code_base->getMethodByFQSEN($original_fqsen);
     }
     $method_name = $method->getName();
     if (!$method->hasSuppressIssue(Issue::RedefineFunction)) {
         if ($original_method->isInternal()) {
             Issue::maybeEmit($code_base, $method->getContext(), Issue::RedefineFunctionInternal, $method->getFileRef()->getLineNumberStart(), $method_name, $method->getFileRef()->getFile(), $method->getFileRef()->getLineNumberStart());
         } else {
             Issue::maybeEmit($code_base, $method->getContext(), Issue::RedefineFunction, $method->getFileRef()->getLineNumberStart(), $method_name, $method->getFileRef()->getFile(), $method->getFileRef()->getLineNumberStart(), $original_method->getFileRef()->getFile(), $original_method->getFileRef()->getLineNumberStart());
         }
     }
 }
開發者ID:tpunt,項目名稱:phan,代碼行數:32,代碼來源:DuplicateFunctionAnalyzer.php

示例2: getClosure

 /**
  * @return Method
  */
 public function getClosure() : Func
 {
     $closure_fqsen = FullyQualifiedFunctionName::fromClosureInContext($this->context);
     if (!$this->code_base->hasFunctionWithFQSEN($closure_fqsen)) {
         throw new CodeBaseException($closure_fqsen, "Could not find closure {$closure_fqsen}");
     }
     return $this->code_base->getFunctionByFQSEN($closure_fqsen);
 }
開發者ID:ablyler,項目名稱:phan,代碼行數:11,代碼來源:ContextNode.php

示例3: alternateGenerator

 /**
  * @return Func[]|\Generator
  * The set of all alternates to this function
  */
 public function alternateGenerator(CodeBase $code_base) : \Generator
 {
     $alternate_id = 0;
     $fqsen = $this->getFQSEN();
     while ($code_base->hasFunctionWithFQSEN($fqsen)) {
         (yield $code_base->getFunctionByFQSEN($fqsen));
         $fqsen = $fqsen->withAlternateId(++$alternate_id);
     }
 }
開發者ID:ablyler,項目名稱:phan,代碼行數:13,代碼來源:Func.php

示例4: getClosureInScope

 /**
  * @param CodeBase $code_base
  * The code base from which to retrieve the element
  *
  * @return Method
  * Get the closure in this scope or fail real hard
  */
 public function getClosureInScope(CodeBase $code_base) : Func
 {
     assert($this->isClosureScope(), "Must be in closure scope to get closure. Actually in {$this}");
     return $code_base->getFunctionByFQSEN($this->getClosureFQSEN());
 }
開發者ID:nagyistge,項目名稱:phan,代碼行數:12,代碼來源:Context.php

示例5: getFunctionLikeInScope

 /**
  * @param CodeBase $code_base
  * The global code base holding all state
  *
  * @return Element\Func|Element\Method
  * Get the method in this scope or fail real hard
  */
 public function getFunctionLikeInScope(CodeBase $code_base) : FunctionInterface
 {
     assert($this->isInFunctionLikeScope(), "Must be in method scope to get method.");
     $fqsen = $this->getFunctionLikeFQSEN();
     if ($fqsen instanceof FullyQualifiedFunctionName) {
         assert($code_base->hasFunctionWithFQSEN($fqsen), "The function does not exist");
         return $code_base->getFunctionByFQSEN($fqsen);
     }
     if ($fqsen instanceof FullyQualifiedMethodName) {
         assert($code_base->hasMethodWithFQSEN($fqsen), "Method does not exist");
         return $code_base->getMethodByFQSEN($fqsen);
     }
     assert(false, "FQSEN must be for a function or method");
 }
開發者ID:etsy,項目名稱:phan,代碼行數:21,代碼來源:Context.php


注:本文中的Phan\CodeBase::getFunctionByFQSEN方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。