diff --git a/core/lib/Drupal/Core/Plugin/Discovery/TemplateDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/TemplateDiscovery.php index 4f9f737..3f466a6 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/TemplateDiscovery.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/TemplateDiscovery.php @@ -115,7 +115,7 @@ * * @var string */ - protected $masterProvider; + protected $rootProvider; /** * Constructs a TemplateDiscovery object. @@ -127,7 +127,7 @@ * @param string $file_cache_key_suffix * The file cache key suffix. This should be unique for each class that * extends this abstract class. - * @param string $master_provider + * @param string $root_provider * (optional) The name of a provider that is allowed to provide plugins on * behalf of other extensions. * @param string $id_key @@ -137,10 +137,10 @@ * (optional) Regular expression pattern to filter file names. Defaults to * a pattern that finds files with extension .html.twig. */ - public function __construct(array $directories, string $file_cache_key_suffix, string $master_provider = '', string $id_key = 'id', string $file_filter = '/\.html\.twig$/i') { + public function __construct(array $directories, string $file_cache_key_suffix, string $root_provider = '', string $id_key = 'id', string $file_filter = '/\.html\.twig$/i') { $this->directories = $directories; $this->fileCacheKeySuffix = $file_cache_key_suffix; - $this->masterProvider = $master_provider; + $this->rootProvider = $root_provider; $this->idKey = $id_key; $this->fileFilter = $file_filter; } @@ -184,7 +184,7 @@ public function getDefinitions() { * * @see \Drupal\Component\FrontMatter\FrontMatter */ - public function findAll() { + public function findAll(): array { $all = []; $files = $this->findFiles(); @@ -204,7 +204,7 @@ public function findAll() { $plugin_id = substr(basename($file), 0, -10); list($file_name_provider,) = explode('.', $plugin_id, 2); if ($provider !== $file_name_provider && - (empty($this->masterProvider) || $provider != $this->masterProvider)) { + (empty($this->rootProvider) || $provider != $this->rootProvider)) { throw new DiscoveryException("$file file name should begin with '$provider'"); } $data = [ @@ -260,14 +260,14 @@ public function findAll() { * An array whose keys are files containing plugins, and whose values are * the provider (extension defining the plugin). */ - protected function findFiles() { + protected function findFiles(): array { $file_list = []; foreach ($this->directories as $provider => $directories) { $directories = (array) $directories; foreach ($directories as $directory) { if (is_dir($directory)) { - /** @var \SplFileInfo $fileInfo */ $iterator = new RegexDirectoryIterator($directory, $this->fileFilter); + /** @var \SplFileInfo $fileInfo */ foreach ($iterator as $fileInfo) { $file_list[$fileInfo->getPathname()] = $provider; }