diff -u b/core/lib/Drupal/Core/Plugin/Discovery/FrontMatterDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/FrontMatterDiscovery.php --- b/core/lib/Drupal/Core/Plugin/Discovery/FrontMatterDiscovery.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/FrontMatterDiscovery.php @@ -12,22 +12,22 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; /** - * Provides discovery for files containing FronMatter within a given set of directories. + * Provides discovery for files containing FrontMatter. */ class FrontMatterDiscovery implements DiscoveryInterface { use DiscoveryTrait; /** - * Plugin may appear not on top level of frontmatter. + * Plugin may appear not on top level of FrontMatter. + * + * @var array * * @code * plugins: * layouts: * layout_onecolumn: * @endcode - * - * @var array */ protected $arrayPosition = []; @@ -55,28 +55,27 @@ /** * Contains an array of translatable properties passed along to t(). * - * @see \Drupal\Core\Plugin\Discovery\FrontMatterDiscovery::addTranslatableProperty() - * * @var array + * + * @see \Drupal\Core\Plugin\Discovery\FrontMatterDiscovery::addTranslatableProperty() */ protected $translatableProperties = []; - /** * Constructs a FrontMatterDiscovery object. * * @param array $directories * An array of directories to scan, keyed by the provider. - * @param string $file_filter - * (optional) Regular expression pattern to filter file names. Defaults to - * a pattern that finds files with extension .frontmatter.html.twig. * @param string $file_cache_key_suffix * The file cache key suffix. This should be unique for each class that * extends this abstract class. * @param array $array_position - * Deepth of plugin in FrontMatter array. + * Depth of plugin in FrontMatter array. + * @param string $file_filter + * (optional) Regular expression pattern to filter file names. Defaults to + * a pattern that finds files with extension .frontmatter.html.twig. */ - public function __construct(array $directories, string $file_filter = '/\.frontmatter\.html\.twig$/i', string $file_cache_key_suffix, array $array_position = []) { + public function __construct(array $directories, string $file_cache_key_suffix, array $array_position = [], string $file_filter = '/\.frontmatter\.html\.twig$/i') { $this->arrayPosition = $array_position; $this->directories = $directories; $this->fileFilter = $file_filter; @@ -181,10 +180,11 @@ return $all; } - /** + /** * Returns an array of file paths, keyed by provider. * * @return array + * An array of file paths keyed by provider. */ protected function findFiles() { $file_list = []; @@ -203,7 +203,7 @@ } /** - * Gets an iterator to recursive loop over the files in the provided directory. + * Gets an iterator to recursive loop over files in the provided directory. * * @param string $directory * The directory to scan. @@ -221,2 +221,3 @@ } + } diff -u b/core/lib/Drupal/Core/Plugin/Discovery/FrontMatterDiscoveryDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/FrontMatterDiscoveryDecorator.php --- b/core/lib/Drupal/Core/Plugin/Discovery/FrontMatterDiscoveryDecorator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/FrontMatterDiscoveryDecorator.php @@ -5,10 +5,10 @@ use Drupal\Component\Plugin\Discovery\DiscoveryInterface; /** - * Enables Frontmatter discovery for plugin definitions. + * Enables FrontMatter discovery for plugin definitions. * * You should normally extend this class to add validation for the values in the - * Frontmatter data or to restrict use of the class or derivatives keys. + * FrontMatter data or to restrict use of the class or derivatives keys. */ class FrontMatterDiscoveryDecorator extends FrontMatterDiscovery { @@ -24,14 +24,19 @@ * * @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface $decorated * The discovery object that is being decorated. - * @param string $name - * The file name suffix to use for discovery; for instance, 'test' will - * become 'MODULE.test.yml'. * @param array $directories * An array of directories to scan. + * @param string $file_cache_key_suffix + * The file cache key suffix. This should be unique for each class that + * extends this abstract class. + * @param array $array_position + * Depth of plugin in FrontMatter array. + * @param string $file_filter + * The file name suffix to use for discovery; for instance, 'test' will + * become 'MODULE.test.yml'. */ - public function __construct(DiscoveryInterface $decorated, $directories, $file_filter, $file_cache_key_suffix, $array_position) { - parent::__construct($directories, $file_filter, $file_cache_key_suffix, $array_position); + public function __construct(DiscoveryInterface $decorated, array $directories, string $file_cache_key_suffix, array $array_position, string $file_filter) { + parent::__construct($directories, $file_cache_key_suffix, $array_position, $file_filter); $this->decorated = $decorated; } @@ -45,8 +50,16 @@ /** * Passes through all unknown calls onto the decorated object. + * + * @param string $method + * The method to call on the decorated plugin discovery. + * @param array $args + * The arguments to send to the method. + * + * @return mixed + * The method result. */ - public function __call($method, $args) { + public function __call($method, array $args) { return call_user_func_array([$this->decorated, $method], $args); }