Mercurial > hg > isophonics-drupal-site
annotate core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\migrate\Plugin\Discovery; |
Chris@0 | 4 |
Chris@0 | 5 use Doctrine\Common\Reflection\StaticReflectionParser as BaseStaticReflectionParser; |
Chris@0 | 6 |
Chris@0 | 7 /** |
Chris@0 | 8 * Allows getting the reflection parser for the parent class. |
Chris@0 | 9 * |
Chris@0 | 10 * @internal |
Chris@0 | 11 * This is a temporary solution to the fact that migration source plugins have |
Chris@0 | 12 * more than one provider. This functionality will be moved to core in |
Chris@0 | 13 * https://www.drupal.org/node/2786355. |
Chris@0 | 14 */ |
Chris@0 | 15 class StaticReflectionParser extends BaseStaticReflectionParser { |
Chris@0 | 16 |
Chris@0 | 17 /** |
Chris@0 | 18 * If the current class extends another, get the parser for the latter. |
Chris@0 | 19 * |
Chris@0 | 20 * @param \Doctrine\Common\Reflection\StaticReflectionParser $parser |
Chris@0 | 21 * The current static parser. |
Chris@0 | 22 * @param $finder |
Chris@0 | 23 * The class finder. Must implement |
Chris@0 | 24 * \Doctrine\Common\Reflection\ClassFinderInterface, but can do so |
Chris@0 | 25 * implicitly (i.e., implements the interface's methods but not the actual |
Chris@0 | 26 * interface). |
Chris@0 | 27 * |
Chris@0 | 28 * @return static|null |
Chris@0 | 29 * The static parser for the parent if there's a parent class or NULL. |
Chris@0 | 30 */ |
Chris@0 | 31 public static function getParentParser(BaseStaticReflectionParser $parser, $finder) { |
Chris@0 | 32 // Ensure the class has been parsed before accessing the parentClassName |
Chris@0 | 33 // property. |
Chris@0 | 34 $parser->parse(); |
Chris@0 | 35 if ($parser->parentClassName) { |
Chris@0 | 36 return new static($parser->parentClassName, $finder, $parser->classAnnotationOptimize); |
Chris@0 | 37 } |
Chris@0 | 38 } |
Chris@0 | 39 |
Chris@0 | 40 } |