Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / migrate / src / Plugin / Discovery / StaticReflectionParser.php
1 <?php
2
3 namespace Drupal\migrate\Plugin\Discovery;
4
5 use Doctrine\Common\Reflection\StaticReflectionParser as BaseStaticReflectionParser;
6
7 /**
8  * Allows getting the reflection parser for the parent class.
9  *
10  * @internal
11  *   This is a temporary solution to the fact that migration source plugins have
12  *   more than one provider. This functionality will be moved to core in
13  *   https://www.drupal.org/node/2786355.
14  */
15 class StaticReflectionParser extends BaseStaticReflectionParser {
16
17   /**
18    * If the current class extends another, get the parser for the latter.
19    *
20    * @param \Doctrine\Common\Reflection\StaticReflectionParser $parser
21    *   The current static parser.
22    * @param $finder
23    *   The class finder. Must implement
24    *   \Doctrine\Common\Reflection\ClassFinderInterface, but can do so
25    *   implicitly (i.e., implements the interface's methods but not the actual
26    *   interface).
27    *
28    * @return static|null
29    *   The static parser for the parent if there's a parent class or NULL.
30    */
31   public static function getParentParser(BaseStaticReflectionParser $parser, $finder) {
32     // Ensure the class has been parsed before accessing the parentClassName
33     // property.
34     $parser->parse();
35     if ($parser->parentClassName) {
36       return new static($parser->parentClassName, $finder, $parser->classAnnotationOptimize);
37     }
38   }
39
40 }