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


PHP Node::isStatic方法代码示例

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


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

示例1: enterNode

 function enterNode(\PhpParser\Node $node)
 {
     if ($node instanceof \PhpParser\Node\Stmt\Namespace_) {
         $this->addNamespace(array('namespace' => $node->name->toString(), 'line' => $node->getLine(), 'file' => $this->file));
     }
     if ($node instanceof \PhpParser\Node\Stmt\Use_) {
         foreach ($node->uses as $use) {
             $this->addUse(array('name' => $use->name, 'alias' => $use->alias));
         }
     }
     if ($node instanceof \PhpParser\Node\Stmt\Class_) {
         $this->addClass(array('name' => $node->name, 'extends' => $node->extends, 'implements' => $node->implements, 'abstract' => $node->isAbstract(), 'final' => $node->isFinal(), 'comment' => $node->getDocComment(), 'doc' => $this->doc_comment_parser->parse($node->getDocComment()), 'line' => $node->getLine(), 'file' => $this->file));
     }
     if ($node instanceof \PhpParser\Node\Stmt\Interface_) {
         $this->addInterface(array('name' => $node->name, 'extends' => $node->extends, 'comment' => $node->getDocComment(), 'doc' => $this->doc_comment_parser->parse($node->getDocComment()), 'line' => $node->getLine(), 'file' => $this->file));
     }
     if ($node instanceof \PhpParser\Node\Stmt\ClassMethod) {
         $this->addClassMethod(array('byRef' => $node->byRef, 'name' => $node->name, 'params' => $node->params, 'returnType' => $node->returnType, 'public' => $node->isPublic(), 'protected' => $node->isProtected(), 'private' => $node->isPrivate(), 'abstract' => $node->isAbstract(), 'final' => $node->isFinal(), 'static' => $node->isStatic(), 'comment' => $node->getDocComment(), 'doc' => $this->doc_comment_parser->parse($node->getDocComment()), 'line' => $node->getLine(), 'file' => $this->file));
     }
     if ($node instanceof \PhpParser\Node\Stmt\Property) {
         $this->last_property = $node;
     }
     if ($node instanceof \PhpParser\Node\Stmt\PropertyProperty) {
         $this->addClassProperty(array('name' => $node->name, 'default' => $node->default, 'public' => $this->last_property->isPublic(), 'protected' => $this->last_property->isProtected(), 'private' => $this->last_property->isPrivate(), 'static' => $this->last_property->isStatic(), 'comment' => $node->getDocComment(), 'doc' => $this->doc_comment_parser->parse($node->getDocComment()), 'line' => $node->getLine(), 'file' => $this->file));
     }
     // $this->logger->info(get_class($node));
 }
开发者ID:soundasleep,项目名称:phpdoc2,代码行数:27,代码来源:Parser.php

示例2: defineVariableByValue

 /**
  * @inheritdoc
  * @param Stmt\Property $node
  */
 public function defineVariableByValue(Node $node)
 {
     assert($node instanceof Stmt\Property, 'Only accepts class properties');
     if ($node->isStatic()) {
         return parent::defineVariableByValue($node);
     } else {
         $this->instanceEnvironment->defineVariableByValue($node);
         return $this;
     }
 }
开发者ID:lowjoel,项目名称:phortress,代码行数:14,代码来源:ClassEnvironment.php

示例3: enterNode

 public function enterNode(Node $node)
 {
     switch ($node->getType()) {
         case 'Stmt_Class':
             $this->currentClass = $node->name;
             break;
         case 'Stmt_ClassMethod':
             if ($node->isStatic()) {
                 $this->currentMethod = $node->name;
             }
             break;
         default:
             if (!is_null($this->currentMethod)) {
                 $this->enterMethodCode($node);
             }
     }
 }
开发者ID:trismegiste,项目名称:phpunit-assert-solid,代码行数:17,代码来源:StaticFactory.php

示例4: processNode

 /**
  * @param \PhpParser\Node\Stmt\Property $node
  * @param \PHPStan\Analyser\Scope $scope
  * @return string[]
  */
 public function processNode(Node $node, Scope $scope) : array
 {
     if ($scope->getClass() === null || !$this->broker->hasClass($scope->getClass())) {
         return [];
     }
     $classReflection = $this->broker->getClass($scope->getClass());
     $errors = [];
     foreach ($node->props as $property) {
         if ($property->default === null) {
             continue;
         }
         $propertyReflection = $classReflection->getProperty($property->name);
         $propertyType = $propertyReflection->getType();
         $defaultValueType = $scope->getType($property->default);
         if ($propertyType->accepts($defaultValueType)) {
             continue;
         }
         $errors[] = sprintf('%s %s::$%s (%s) does not accept default value of type %s.', $node->isStatic() ? 'Static property' : 'Property', $scope->getClass(), $property->name, $propertyType->describe(), $defaultValueType->describe());
     }
     return $errors;
 }
开发者ID:phpstan,项目名称:phpstan,代码行数:26,代码来源:DefaultValueTypesAssignedToPropertiesRule.php

示例5: leaveNode

 public function leaveNode(Node $node)
 {
     if ($node instanceof ClassMethod && $node->isStatic()) {
         $this->inStaticMethod = false;
     }
 }
开发者ID:stefk,项目名称:md,代码行数:6,代码来源:StaticThis.php

示例6: compareModifier

 protected function compareModifier(Node $a, Node $b)
 {
     // Within same visibility, goes first
     $cmp = strcmp($b->isStatic(), $a->isStatic());
     if ($cmp !== 0) {
         return $cmp;
     }
     // Within same visibility and ess, abstract goes first
     if ($a instanceof ClassMethod) {
         $cmp = strcmp($b->isAbstract(), $a->isAbstract());
     }
     return $cmp;
 }
开发者ID:nochso,项目名称:phormat,代码行数:13,代码来源:NodeSorter.php


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