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


PHP CodeBase::hasMethodWithFQSEN方法代码示例

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


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

 /**
  * @return Method[]|\Generator
  * The set of all alternates to this method
  */
 public function alternateGenerator(CodeBase $code_base) : \Generator
 {
     $alternate_id = 0;
     $fqsen = $this->getFQSEN();
     while ($code_base->hasMethodWithFQSEN($fqsen)) {
         (yield $code_base->getMethodByFQSEN($fqsen));
         $fqsen = $fqsen->withAlternateId(++$alternate_id);
     }
 }
开发者ID:tpunt,项目名称:phan,代码行数:13,代码来源:Method.php

示例3: getMethodByNameInContext

 /**
  * @return Method
  * The method with the given name
  */
 public function getMethodByNameInContext(CodeBase $code_base, string $name, Context $context) : Method
 {
     $method_fqsen = FullyQualifiedMethodName::make($this->getFQSEN(), $name);
     if (!$code_base->hasMethodWithFQSEN($method_fqsen)) {
         if ('__construct' === $name) {
             // Create a default constructor if its requested
             // but doesn't exist yet
             $default_constructor = Method::defaultConstructorForClassInContext($this, $context, $code_base);
             $this->addMethod($code_base, $default_constructor, $this->getParentTypeOption());
             return $default_constructor;
         }
         throw new CodeBaseException($method_fqsen, "Method with name {$name} does not exist for class {$this->getFQSEN()}.");
     }
     return $code_base->getMethodByFQSEN($method_fqsen);
 }
开发者ID:etsy,项目名称:phan,代码行数:19,代码来源:Clazz.php

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