diff --git a/core/lib/Drupal/Core/Extension/ExtensionList.php b/core/lib/Drupal/Core/Extension/ExtensionList.php index 5d0043e869..747ed16ec3 100644 --- a/core/lib/Drupal/Core/Extension/ExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ExtensionList.php @@ -9,7 +9,7 @@ /** * Provides available extensions. * - * The extension list is per extension type, like module theme and profile. + * The extension list is per extension type, like module, theme and profile. */ abstract class ExtensionList { @@ -207,14 +207,14 @@ protected function getPathnamesCacheId() { * Determines if an extension exists in the filesystem. * * @param string $extension_name - * The extension machine name of the extension. + * The machine name of the extension. * * @return bool * TRUE if the extension exists (regardless installed or not) and FALSE if * not. */ public function exists($extension_name) { - $extensions = $this->list(); + $extensions = $this->getList(); return isset($extensions[$extension_name]); } @@ -222,13 +222,13 @@ public function exists($extension_name) { * Returns the human-readable name of the extension. * * @param string $extension_name - * The extension machine name. + * The machine name of the extension. * * @return string * The human-readable name of the extension. * * @throws \InvalidArgumentException - * If there is no extension with the supplied extension human name. + * If there is no extension with the supplied machine name. */ public function getName($extension_name) { return $this->get($extension_name)->info['name']; @@ -238,7 +238,7 @@ public function getName($extension_name) { * Returns a single extension. * * @param string $extension_name - * The extension machine name. + * The machine name of the extension. * * @return \Drupal\Core\Extension\Extension * Processed extension object for the given extension machine name. @@ -247,7 +247,7 @@ public function getName($extension_name) { * If there is no extension with the supplied name. */ public function get($extension_name) { - $extensions = $this->list(); + $extensions = $this->getList(); if (isset($extensions[$extension_name])) { return $extensions[$extension_name]; } @@ -259,9 +259,9 @@ public function get($extension_name) { * Returns all available extensions. * * @return \Drupal\Core\Extension\Extension[] - * Processed extension objects, keyed by extension machine name. + * Processed extension objects, keyed by machine name. */ - public function list() { + public function getList() { if ($this->extensions !== NULL) { return $this->extensions; } @@ -282,7 +282,7 @@ public function list() { * extensions to this raw listing. * * @return \Drupal\Core\Extension\Extension[] - * Unprocessed extension objects, keyed by extension machine name. + * Unprocessed extension objects, keyed by machine name. */ protected function doScanExtensions() { return $this->getExtensionDiscovery()->scan($this->type); @@ -292,7 +292,7 @@ protected function doScanExtensions() { * Builds the list of extensions. * * @return \Drupal\Core\Extension\Extension[] - * Processed extension objects, keyed by extension machine name. + * Processed extension objects, keyed by machine name. * * @throws \Drupal\Core\Extension\InfoParserException * If one of the .info.yml files is incomplete, or causes a parsing error. @@ -396,16 +396,16 @@ public function getAllInstalledInfo() { * Generates the information from .info.yml files for extensions of this type. * * @return array[] - * An array of arrays of .info.yml entries keyed by the extension machine name. + * An array of arrays of .info.yml entries keyed by the machine name. */ protected function recalculateInfo() { return array_map(function (Extension $extension) { return $extension->info; - }, $this->list()); + }, $this->getList()); } /** - * Returns a list of extension file paths keyed by extension machine name. + * Returns a list of extension file paths keyed by machine name. * * @return string[] */ @@ -435,7 +435,7 @@ public function getPathnames() { * An array of .info.yml file locations keyed by the extension machine name. */ protected function recalculatePathnames() { - $extensions = $this->list(); + $extensions = $this->getList(); ksort($extensions); return array_map(function (Extension $extension) { @@ -453,7 +453,7 @@ protected function recalculatePathnames() { * It is not recommended to call this method except in those rare cases. * * @param string $extension_name - * The name of the extension for which the filename is requested. + * The machine name of the extension. * @param string $pathname * The pathname of the extension which is to be set explicitly rather * than by consulting the dynamic extension listing. @@ -492,19 +492,20 @@ public function setPathname($extension_name, $pathname) { * An installation profile maybe be located in any of the following places: * * - core/profiles/baz/baz.info.yml - * - /profiles/baz/baz.info.yml + * - profiles/baz/baz.info.yml * - * Calling ExtensionList::getFilename('foo') will give you one of the above, + * Calling ExtensionList::getPathname('foo') will give you one of the above, * depending on where the extension is located and what type it is. * * @param string $extension_name - * The name of the extension for which the pathname is requested. + * The machine name of the extension for which the pathname is requested. * * @return string - * The filename of the requested extension's .info.yml file. + * The drupal-root relative filename and path of the requested extension's + * .info.yml file. * * @throws \InvalidArgumentException - * If there is no extension with the supplied name. + * If there is no extension with the supplied machine name. */ public function getPathname($extension_name) { if (isset($this->addedPathNames[$extension_name])) { @@ -527,7 +528,7 @@ public function getPathname($extension_name) { * coming from \SplFileInfo. * * @param string $extension_name - * The name of the extension for which the path is requested. + * The machine name of the extension for which the path is requested. * * @return string * The Drupal-root-relative path to the specified extension. diff --git a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php index cb3a448b00..01fcf59095 100644 --- a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php @@ -126,7 +126,7 @@ protected function getProfileDirectories(ExtensionDiscovery $discovery) { * The active profile, if there is one. */ protected function getActiveProfile() { - $profiles = $this->profileList->list(); + $profiles = $this->profileList->getList(); if ($this->installProfile && isset($profiles[$this->installProfile])) { return $profiles[$this->installProfile]; } @@ -140,7 +140,7 @@ protected function getActiveProfile() { protected function doScanExtensions() { $extensions = parent::doScanExtensions(); - $profiles = $this->profileList->list(); + $profiles = $this->profileList->getList(); // Modify the active profile object that was previously added to the module // list. if ($this->installProfile && isset($profiles[$this->installProfile])) { diff --git a/core/modules/system/system.module b/core/modules/system/system.module index ea7be41c4b..f54f28057c 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -993,7 +993,7 @@ function system_get_info($type, $name = NULL) { * @param \Drupal\Core\Extension\Extension[] $modules * The array of all module info. * - * @deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.0. This + * @deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. This * function is no longer used in Drupal core. * * @see https://www.drupal.org/node/2709919 diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php index c40fcee98a..0ab7de5d23 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php @@ -29,7 +29,7 @@ public function testlist() { /** @var \Drupal\Core\Extension\ModuleExtensionList $module_extension_list */ $module_extension_list = \Drupal::service('extension.list.module'); - $extensions = $module_extension_list->list(); + $extensions = $module_extension_list->getList(); $this->assertArrayHasKey('testing', $extensions); $this->assertEquals(1000, $extensions['testing']->weight); diff --git a/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php b/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php index 97bf71cdea..8e1588e926 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php @@ -76,7 +76,7 @@ public function testGet() { public function testList() { $test_extension_list = $this->setupTestExtensionList(); - $extensions = $test_extension_list->list(); + $extensions = $test_extension_list->getList(); $this->assertCount(1, $extensions); $this->assertEquals('test_name', $extensions['test_name']->getName()); }