class StaticReflectionParser

Same name and namespace in other branches
  1. 11.x core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser
  2. 11.x core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php \Drupal\Component\Annotation\Doctrine\StaticReflectionParser
  3. 10 core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser
  4. 10 core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php \Drupal\Component\Annotation\Doctrine\StaticReflectionParser
  5. 9 core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser
  6. 9 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

  • class \Drupal\migrate\Plugin\Discovery\StaticReflectionParser extends \Doctrine\Common\Reflection\StaticReflectionParser

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 \Doctrine\Common\Reflection\StaticReflectionParser $parser
   *   The current static parser.
   * @param $finder
   *   The class finder. Must implement
   *   \Doctrine\Common\Reflection\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);
    }
  }

}

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