class StaticReflectionParser

Same name in this branch
  1. 10 core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php \Drupal\Component\Annotation\Doctrine\StaticReflectionParser
Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser
  2. 9 core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php \Drupal\Component\Annotation\Doctrine\StaticReflectionParser
  3. 8.9.x core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser
  4. 11.x core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser
  5. 11.x core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php \Drupal\Component\Annotation\Doctrine\StaticReflectionParser

Allows getting the reflection parser for the parent class.

@internal This is a temporary solution to the fact that migration source plugins have more than one provider. This functionality will be moved to core in https://www.drupal.org/node/2786355.

Hierarchy

Expanded class hierarchy of StaticReflectionParser

File

core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php, line 15

Namespace

Drupal\migrate\Plugin\Discovery
View source
class StaticReflectionParser extends BaseStaticReflectionParser {
    
    /**
     * If the current class extends another, get the parser for the latter.
     *
     * @param \Drupal\Component\Annotation\Doctrine\StaticReflectionParser $parser
     *   The current static parser.
     * @param $finder
     *   The class finder. Must implement
     *   \Drupal\Component\ClassFinder\ClassFinderInterface, but can do so
     *   implicitly (i.e., implements the interface's methods but not the actual
     *   interface).
     *
     * @return static|null
     *   The static parser for the parent if there's a parent class or NULL.
     */
    public static function getParentParser(BaseStaticReflectionParser $parser, $finder) {
        // Ensure the class has been parsed before accessing the parentClassName
        // property.
        $parser->parse();
        if ($parser->parentClassName) {
            return new static($parser->parentClassName, $finder, $parser->classAnnotationOptimize);
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
StaticReflectionParser::$classAnnotationOptimize protected property Whether the caller only wants class annotations.
StaticReflectionParser::$classAttributes protected property The class attributes.
StaticReflectionParser::$className protected property The fully qualified class name.
StaticReflectionParser::$docComment protected property The docComment of the class.
StaticReflectionParser::$finder protected property A ClassFinder object which finds the class.
StaticReflectionParser::$namespace protected property The namespace of the class.
StaticReflectionParser::$parentClassName protected property The name of the class this class extends, if any.
StaticReflectionParser::$parentStaticReflectionParser protected property The parent PSR-0 Parser.
StaticReflectionParser::$parsed protected property Whether the parser has run.
StaticReflectionParser::$shortClassName protected property The short class name.
StaticReflectionParser::$useStatements protected property The use statements of the class.
StaticReflectionParser::fullySpecifyName private function Converts a name into a fully specified name.
StaticReflectionParser::getClassName public function
StaticReflectionParser::getDocComment public function Gets the doc comment.
StaticReflectionParser::getNamespaceName public function
StaticReflectionParser::getParentParser public static function If the current class extends another, get the parser for the latter.
StaticReflectionParser::getParentStaticReflectionParser protected function
StaticReflectionParser::getReflectionClass public function Gets the ReflectionClass equivalent for this class.
StaticReflectionParser::getStaticReflectionParserForDeclaringClass public function Gets the PSR-0 parser for the declaring class.
StaticReflectionParser::getUseStatements public function Gets the use statements from this file.
StaticReflectionParser::hasClassAttribute public function Determines if the class has the provided class attribute.
StaticReflectionParser::parse protected function
StaticReflectionParser::__construct public function Parses a class residing in a PSR-0 hierarchy.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.