From de09fc95c57fda4c2ed42bb1eed80bd7305260ac Mon Sep 17 00:00:00 2001 From: Dave Long Date: Sun, 12 Mar 2023 19:15:58 +0000 Subject: [PATCH] Issue #3322743 by Spokje, mondrake: Fix PHPStan L2 errors "Parameter $foo of method Foo::bar() has invalid type Foo\Baz." and "Method Foo::bar() has invalid return type Foo\Baz. " --- .../Plugin/Scaffold/Operations/OperationFactory.php | 2 +- .../Scaffold/Operations/ScaffoldFileCollection.php | 2 +- .../Plugin/Discovery/StaticDiscoveryDecorator.php | 2 +- core/lib/Drupal/Core/Archiver/Tar.php | 6 +++--- .../Drupal/Core/Config/Entity/ConfigEntityStorage.php | 3 ++- .../Core/EventSubscriber/RequestCloseSubscriber.php | 2 +- .../Core/Plugin/CategorizingPluginManagerTrait.php | 2 -- .../Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php | 2 +- core/lib/Drupal/Core/Session/SessionManager.php | 2 +- core/lib/Drupal/Core/Utility/LinkGenerator.php | 4 ++-- .../CKEditorStylesheetsWarningTest.php | 2 +- .../tests/src/FunctionalJavascript/ImageTestBase.php | 2 +- .../tests/src/FunctionalJavascript/LanguageTest.php | 2 +- .../ckeditor5/tests/src/Kernel/LanguageTest.php | 2 +- .../tests/config_test/src/ConfigTestController.php | 4 ++-- .../src/Functional/ContentTranslationWorkflowsTest.php | 2 +- core/modules/field/src/Entity/FieldConfig.php | 2 +- .../tests/src/Functional/ManageDisplayTest.php | 2 +- .../history/src/Controller/HistoryController.php | 2 +- .../modules/jsonapi/src/Normalizer/FieldNormalizer.php | 2 +- .../menu_ui/tests/src/Functional/MenuUiTest.php | 2 +- .../src/Plugin/Discovery/ProviderFilterDecorator.php | 2 +- .../modules/migrate/tests/src/Unit/process/LogTest.php | 2 +- core/modules/system/src/Form/ModulesEnabledTrait.php | 2 +- .../menu_test/src/Controller/MenuTestController.php | 6 +++--- core/modules/user/src/Form/EntityPermissionsForm.php | 4 ++-- .../user/tests/src/Functional/UserAdminTest.php | 2 +- .../tests/src/Kernel/Handler/FilterStringTest.php | 2 +- core/phpstan-baseline.neon | 10 +++++----- .../Plugin/Context/ContextAwarePluginTraitTest.php | 4 ++-- core/tests/Drupal/Tests/BrowserTestBase.php | 2 +- core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php | 8 ++++---- core/tests/Drupal/Tests/Core/Image/ImageTest.php | 2 +- 33 files changed, 48 insertions(+), 49 deletions(-) diff --git a/composer/Plugin/Scaffold/Operations/OperationFactory.php b/composer/Plugin/Scaffold/Operations/OperationFactory.php index 9b10f89fbfc..6346923b713 100644 --- a/composer/Plugin/Scaffold/Operations/OperationFactory.php +++ b/composer/Plugin/Scaffold/Operations/OperationFactory.php @@ -122,7 +122,7 @@ class OperationFactory { /** * Checks to see if the specified scaffold file exists and has content. * - * @param Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $file + * @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $file * Scaffold file to check. * * @return bool diff --git a/composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php b/composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php index 098c63c42f3..a1bacf597d7 100644 --- a/composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php +++ b/composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php @@ -96,7 +96,7 @@ class ScaffoldFileCollection implements \IteratorAggregate { /** * Scans through a list of scaffold files and determines if any has contents. * - * @param Drupal\Composer\Plugin\Scaffold\ScaffoldFileInfo[] $scaffold_files + * @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFileInfo[] $scaffold_files * List of scaffold files, path: ScaffoldFileInfo * * @return bool diff --git a/core/lib/Drupal/Component/Plugin/Discovery/StaticDiscoveryDecorator.php b/core/lib/Drupal/Component/Plugin/Discovery/StaticDiscoveryDecorator.php index d9277db770d..72405d51394 100644 --- a/core/lib/Drupal/Component/Plugin/Discovery/StaticDiscoveryDecorator.php +++ b/core/lib/Drupal/Component/Plugin/Discovery/StaticDiscoveryDecorator.php @@ -26,7 +26,7 @@ class StaticDiscoveryDecorator extends StaticDiscovery { * * @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface $decorated * The discovery object that is being decorated. - * @param \Callable $registerDefinitions + * @param callable|null $registerDefinitions * (optional) A callback or closure used for registering additional * definitions. */ diff --git a/core/lib/Drupal/Core/Archiver/Tar.php b/core/lib/Drupal/Core/Archiver/Tar.php index aaa5d2aadc9..2b03bce2bcd 100644 --- a/core/lib/Drupal/Core/Archiver/Tar.php +++ b/core/lib/Drupal/Core/Archiver/Tar.php @@ -85,11 +85,11 @@ class Tar implements ArchiverInterface { * Retrieves the tar engine itself. * * In some cases it may be necessary to directly access the underlying - * Archive_Tar object for implementation-specific logic. This is for advanced + * ArchiveTar object for implementation-specific logic. This is for advanced * use only as it is not shared by other implementations of ArchiveInterface. * - * @return Archive_Tar - * The Archive_Tar object used by this object. + * @return ArchiveTar + * The ArchiveTar object used by this object. */ public function getArchive() { return $this->tar; diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php index 3a0bed4ef40..d58aac4c667 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php @@ -410,7 +410,7 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora * @param bool $is_syncing * Is the configuration entity being created as part of a config sync. * - * @return \Drupal\Core\Config\ConfigEntityInterface + * @return \Drupal\Core\Config\Entity\ConfigEntityInterface * The configuration entity. * * @see \Drupal\Core\Config\Entity\ConfigEntityStorageInterface::createFromStorageRecord() @@ -422,6 +422,7 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora $values[$this->uuidKey] = $this->uuidService->generate(); } $data = $this->mapFromStorageRecords([$values]); + /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */ $entity = current($data); $entity->original = clone $entity; $entity->setSyncing($is_syncing); diff --git a/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php index bfde31939b4..f397bf25e92 100644 --- a/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php @@ -35,7 +35,7 @@ class RequestCloseSubscriber implements EventSubscriberInterface { * removed/changed. Also, if possible, do more light-weight shutdowns on * AJAX requests. * - * @param Symfony\Component\HttpKernel\Event\TerminateEvent $event + * @param \Symfony\Component\HttpKernel\Event\TerminateEvent $event * The Event to process. */ public function onTerminate(TerminateEvent $event) { diff --git a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php index 2d6ed8bb75f..1ce14468026 100644 --- a/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php +++ b/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php @@ -74,7 +74,6 @@ trait CategorizingPluginManagerTrait { * {@inheritdoc} */ public function getCategories() { - /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ // Fetch all categories from definitions and remove duplicates. $categories = array_unique(array_values(array_map(function ($definition) { return $definition['category']; @@ -88,7 +87,6 @@ trait CategorizingPluginManagerTrait { */ public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') { // Sort the plugins first by category, then by label. - /** @var \Drupal\Core\Plugin\CategorizingPluginManagerTrait|\Drupal\Component\Plugin\PluginManagerInterface $this */ $definitions = $definitions ?? $this->getDefinitions(); uasort($definitions, function ($a, $b) use ($label_key) { if ((string) $a['category'] != (string) $b['category']) { diff --git a/core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php b/core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php index 9e9df9f71dd..6ddb85cb9ec 100644 --- a/core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php +++ b/core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php @@ -15,7 +15,7 @@ class FormRouteEnhancer implements EnhancerInterface { /** * Returns whether the enhancer runs on the current route. * - * @param \Drupal\Core\Routing\Enhancer\Route $route + * @param \Symfony\Component\Routing\Route $route * The current route. * * @return bool diff --git a/core/lib/Drupal/Core/Session/SessionManager.php b/core/lib/Drupal/Core/Session/SessionManager.php index c3288da08e3..88cd771dda4 100644 --- a/core/lib/Drupal/Core/Session/SessionManager.php +++ b/core/lib/Drupal/Core/Session/SessionManager.php @@ -77,7 +77,7 @@ class SessionManager extends NativeSessionStorage implements SessionManagerInter * The session metadata bag. * @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration * The session configuration interface. - * @param \Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy|Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler|\SessionHandlerInterface|null $handler + * @param \Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy|\SessionHandlerInterface|null $handler * The object to register as a PHP session handler. * @see \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage::setSaveHandler() */ diff --git a/core/lib/Drupal/Core/Utility/LinkGenerator.php b/core/lib/Drupal/Core/Utility/LinkGenerator.php index 336eebb1e24..e3f3fe418e1 100644 --- a/core/lib/Drupal/Core/Utility/LinkGenerator.php +++ b/core/lib/Drupal/Core/Utility/LinkGenerator.php @@ -191,14 +191,14 @@ class LinkGenerator implements LinkGeneratorInterface { /** * Generates the link. * - * @param Drupal\Core\GeneratedLink $generated_link + * @param \Drupal\Core\GeneratedLink $generated_link * The generated link, along with its associated cacheability metadata. * @param array $attributes * The attributes of the generated link. * @param array $variables * The link text, url, and other options. * - * @return Drupal\Core\GeneratedLink + * @return \Drupal\Core\GeneratedLink * The generated link, along with its associated cacheability metadata. */ protected function doGenerate($generated_link, $attributes, $variables) { diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditorStylesheetsWarningTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditorStylesheetsWarningTest.php index 0d32076798a..a83ff5f26e5 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditorStylesheetsWarningTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditorStylesheetsWarningTest.php @@ -54,7 +54,7 @@ class CKEditorStylesheetsWarningTest extends CKEditor5TestBase { /** * Data provider for testWarningFilterUI(). * - * @return \string[][] + * @return string[][] * An array with the theme to enable and the warning message to check. */ public function providerTestWarningFilterUi() { diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php index 0f8e8071a36..8690f005785 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/ImageTestBase.php @@ -595,7 +595,7 @@ abstract class ImageTestBase extends CKEditor5TestBase { /** * Data provider for ::testWidth(). * - * @return \string[][] + * @return string[][] */ public function providerWidth(): array { return [ diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php index 3482643af31..3bc40cd178a 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php @@ -80,7 +80,7 @@ JS; /** * Data provider for ensuring CKEditor 5 UI translations are loaded. * - * @return \string[][] + * @return string[][] */ public function provider(): array { return [ diff --git a/core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php b/core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php index c5bfa506ac0..0b3ddc59ff7 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php @@ -94,7 +94,7 @@ class LanguageTest extends KernelTestBase { /** * Provides a list of language code pairs. * - * @return \string[][] + * @return string[][] */ public function provider(): array { $random_langcode = $this->randomMachineName(); diff --git a/core/modules/config/tests/config_test/src/ConfigTestController.php b/core/modules/config/tests/config_test/src/ConfigTestController.php index 3a1b5f53e1e..63d03f14780 100644 --- a/core/modules/config/tests/config_test/src/ConfigTestController.php +++ b/core/modules/config/tests/config_test/src/ConfigTestController.php @@ -27,7 +27,7 @@ class ConfigTestController extends ControllerBase { /** * Enables a ConfigTest object. * - * @param \Drupal\config_test\ConfigTest $config_test + * @param \Drupal\config_test\Entity\ConfigTest $config_test * The ConfigTest object to enable. * * @return \Symfony\Component\HttpFoundation\RedirectResponse @@ -41,7 +41,7 @@ class ConfigTestController extends ControllerBase { /** * Disables a ConfigTest object. * - * @param \Drupal\config_test\ConfigTest $config_test + * @param \Drupal\config_test\Entity\ConfigTest $config_test * The ConfigTest object to disable. * * @return \Symfony\Component\HttpFoundation\RedirectResponse diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php index de500b19fb7..c8b740e0477 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php @@ -151,7 +151,7 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase { /** * Creates a test entity and translate it. * - * @param Drupal\User\UserInterface|null $user + * @param \Drupal\User\UserInterface|null $user * (optional) The entity owner. */ protected function setupEntity(UserInterface $user = NULL) { diff --git a/core/modules/field/src/Entity/FieldConfig.php b/core/modules/field/src/Entity/FieldConfig.php index 709c6eccd6f..f43a7987487 100644 --- a/core/modules/field/src/Entity/FieldConfig.php +++ b/core/modules/field/src/Entity/FieldConfig.php @@ -370,7 +370,7 @@ class FieldConfig extends FieldConfigBase implements FieldConfigInterface { * @param string $field_name * Name of the field. * - * @return Drupal\field\FieldConfigInterface|null + * @return \Drupal\field\FieldConfigInterface|null * The field config entity if one exists for the provided field * name, otherwise NULL. */ diff --git a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php index c0fcef06e2a..d1af28fc86c 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php @@ -384,7 +384,7 @@ class ManageDisplayTest extends BrowserTestBase { /** * Extracts all options from a select element. * - * @param Behat\Mink\Element\NodeElement $element + * @param \Behat\Mink\Element\NodeElement $element * The select element field information. * * @return array diff --git a/core/modules/history/src/Controller/HistoryController.php b/core/modules/history/src/Controller/HistoryController.php index ca3498ead8a..2763b152703 100644 --- a/core/modules/history/src/Controller/HistoryController.php +++ b/core/modules/history/src/Controller/HistoryController.php @@ -20,7 +20,7 @@ class HistoryController extends ControllerBase { * @param \Symfony\Component\HttpFoundation\Request $request * The request of the page. * - * @return Symfony\Component\HttpFoundation\JsonResponse + * @return \Symfony\Component\HttpFoundation\JsonResponse * The JSON response. */ public function getNodeReadTimestamps(Request $request) { diff --git a/core/modules/jsonapi/src/Normalizer/FieldNormalizer.php b/core/modules/jsonapi/src/Normalizer/FieldNormalizer.php index 4a0acae15d3..206d4ec4320 100644 --- a/core/modules/jsonapi/src/Normalizer/FieldNormalizer.php +++ b/core/modules/jsonapi/src/Normalizer/FieldNormalizer.php @@ -83,7 +83,7 @@ class FieldNormalizer extends NormalizerBase implements DenormalizerInterface { * @param array $context * The context array. * - * @return \Drupal\jsonapi\Normalizer\Value\FieldItemNormalizerValue[] + * @return \Drupal\jsonapi\Normalizer\FieldItemNormalizer[] * The array of normalized field items. */ protected function normalizeFieldItems(FieldItemListInterface $field, $format, array $context) { diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php index bd848ee3902..96411404b56 100644 --- a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php @@ -823,7 +823,7 @@ class MenuUiTest extends BrowserTestBase { /** * Changes the parent of a menu link using the UI. * - * @param \Drupal\menu_link_content\MenuLinkContent $item + * @param \Drupal\menu_link_content\Entity\MenuLinkContent $item * The menu link item to move. * @param int $parent * The id of the new parent. diff --git a/core/modules/migrate/src/Plugin/Discovery/ProviderFilterDecorator.php b/core/modules/migrate/src/Plugin/Discovery/ProviderFilterDecorator.php index 6f5df50959c..2fa96795dce 100644 --- a/core/modules/migrate/src/Plugin/Discovery/ProviderFilterDecorator.php +++ b/core/modules/migrate/src/Plugin/Discovery/ProviderFilterDecorator.php @@ -55,7 +55,7 @@ class ProviderFilterDecorator implements DiscoveryInterface { * A callable, gets passed a provider name, should return TRUE if the * provider exists and FALSE if not. * - * @return array|\mixed[] + * @return array * An array of plugin definitions. If a definition is an array and has a * provider key that provider is guaranteed to exist. */ diff --git a/core/modules/migrate/tests/src/Unit/process/LogTest.php b/core/modules/migrate/tests/src/Unit/process/LogTest.php index 56c6817d524..ea8b31e6cb8 100644 --- a/core/modules/migrate/tests/src/Unit/process/LogTest.php +++ b/core/modules/migrate/tests/src/Unit/process/LogTest.php @@ -32,7 +32,7 @@ class LogTest extends MigrateProcessTestCase { /** * Provides data for testLog. * - * @return \string[][] + * @return string[][] * An array of test data arrays. */ public function providerTestLog() { diff --git a/core/modules/system/src/Form/ModulesEnabledTrait.php b/core/modules/system/src/Form/ModulesEnabledTrait.php index 881d8b3b3db..469ecdd957c 100644 --- a/core/modules/system/src/Form/ModulesEnabledTrait.php +++ b/core/modules/system/src/Form/ModulesEnabledTrait.php @@ -63,7 +63,7 @@ trait ModulesEnabledTrait { * * @param string[] $modules * Enabled module names, keyed by machine names. - * @param Drupal\Core\Config\PreExistingConfigException $exception + * @param \Drupal\Core\Config\PreExistingConfigException $exception * Exception thrown if configuration with the same name already exists. * * @return \Drupal\Core\StringTranslation\PluralTranslatableMarkup diff --git a/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php b/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php index 8472b99a183..de7b7c6590c 100644 --- a/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php +++ b/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php @@ -37,11 +37,11 @@ class MenuTestController extends ControllerBase { /** * Constructs the MenuTestController object. * - * @param \Drupal\menu_test\Controller\ThemeManagerInterface $theme_manager + * @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager * The theme manager. - * @param \Drupal\menu_test\Controller\ThemeNegotiatorInterface $theme_negotiator + * @param \Drupal\Core\Theme\ThemeNegotiatorInterface $theme_negotiator * The theme negotiator. - * @param \Drupal\menu_test\Controller\RouteMatchInterface $route_match + * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * The current route match. */ public function __construct(ThemeManagerInterface $theme_manager, ThemeNegotiatorInterface $theme_negotiator, RouteMatchInterface $route_match) { diff --git a/core/modules/user/src/Form/EntityPermissionsForm.php b/core/modules/user/src/Form/EntityPermissionsForm.php index a787fe32391..d1a49cf4568 100644 --- a/core/modules/user/src/Form/EntityPermissionsForm.php +++ b/core/modules/user/src/Form/EntityPermissionsForm.php @@ -54,7 +54,7 @@ class EntityPermissionsForm extends UserPermissionsForm { * The role storage. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. - * @param Drupal\Core\Config\ConfigManagerInterface $config_manager + * @param \Drupal\Core\Config\ConfigManagerInterface $config_manager * The configuration entity manager. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity type manager service. @@ -116,7 +116,7 @@ class EntityPermissionsForm extends UserPermissionsForm { * The current state of the form. * @param string $bundle_entity_type * (optional) The entity type ID. - * @param string|Drupal\Core\Entity\EntityInterface $bundle + * @param string|\Drupal\Core\Entity\EntityInterface $bundle * (optional) Either the bundle name or the bundle object. */ public function buildForm(array $form, FormStateInterface $form_state, string $bundle_entity_type = NULL, $bundle = NULL): array { diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php index 32f9673b724..046a4095c1b 100644 --- a/core/modules/user/tests/src/Functional/UserAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -33,7 +33,7 @@ class UserAdminTest extends BrowserTestBase { /** * Gets the xpath selector for a user account. * - * @param \Drupal\user\Entity\UserInterface $user + * @param \Drupal\user\UserInterface $user * The user to get the link for. * * @return string diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php index 291e658599d..98e058763fe 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php @@ -71,7 +71,7 @@ class FilterStringTest extends ViewsKernelTestBase { /** * Build and return a Page view of the views_test_data table. * - * @return view + * @return \Drupal\views\ViewExecutable */ protected function getBasicPageView() { $view = Views::getView('test_view'); diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon index 38538dd6a36..4b0b775af4c 100644 --- a/core/phpstan-baseline.neon +++ b/core/phpstan-baseline.neon @@ -202,7 +202,7 @@ parameters: - message: "#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#" - count: 3 + count: 1 path: lib/Drupal/Core/Action/ActionManager.php - @@ -237,7 +237,7 @@ parameters: - message: "#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#" - count: 2 + count: 1 path: lib/Drupal/Core/Block/BlockManager.php - @@ -272,7 +272,7 @@ parameters: - message: "#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#" - count: 3 + count: 1 path: lib/Drupal/Core/Condition/ConditionManager.php - @@ -527,7 +527,7 @@ parameters: - message: "#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#" - count: 3 + count: 1 path: lib/Drupal/Core/Field/FieldTypePluginManager.php - @@ -3157,7 +3157,7 @@ parameters: - message: "#^Call to method getDefinitions\\(\\) on an unknown class Drupal\\\\Core\\\\Plugin\\\\CategorizingPluginManagerTrait\\.$#" - count: 3 + count: 1 path: tests/Drupal/Tests/Core/Plugin/CategorizingPluginManagerTraitTest.php - diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php index 1cd9e4ada84..6126e0992e4 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php @@ -28,14 +28,14 @@ class ContextAwarePluginTraitTest extends KernelTestBase { /** * The plugin instance under test. * - * @var \Drupal\Core\Plugin\ContextAwarePluginTrait + * @var \Drupal\KernelTests\Core\Plugin\Context\TestContextAwarePlugin */ private $plugin; /** * The configurable plugin instance under test. * - * @var \Drupal\Core\Plugin\ContextAwarePluginTrait + * @var \Drupal\KernelTests\Core\Plugin\Context\TestConfigurableContextAwarePlugin */ private $configurablePlugin; diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 283cffc0b63..4bb41d8f71e 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -283,7 +283,7 @@ abstract class BrowserTestBase extends TestCase { /** * Gets an instance of the default Mink driver. * - * @return Behat\Mink\Driver\DriverInterface + * @return \Behat\Mink\Driver\DriverInterface * Instance of default Mink driver. * * @throws \InvalidArgumentException diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php index d3e148c4cd3..9af542afa20 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -415,15 +415,15 @@ class EntityUrlTest extends UnitTestCase { * Returns a mock entity for testing. * * @param string $class - * The class name to mock. Should be \Drupal\Core\Entity\Entity or a - * subclass. + * The class name to mock. Should be \Drupal\Tests\Core\Entity\UrlTestEntity + * or a subclass. * @param array $values * An array of entity values to construct the mock entity with. * @param array $methods * (optional) An array of additional methods to mock on the entity object. * The getEntityType() and entityTypeBundleInfo() methods are always mocked. * - * @return \Drupal\Core\Entity\Entity|\PHPUnit\Framework\MockObject\MockObject + * @return \Drupal\Tests\Core\Entity\UrlTestEntity|\PHPUnit\Framework\MockObject\MockObject */ protected function getEntity($class, array $values, array $methods = []) { $methods = array_merge($methods, ['getEntityType', 'entityTypeBundleInfo']); @@ -454,7 +454,7 @@ class EntityUrlTest extends UnitTestCase { * The expected route name of the generated URL. * @param array $expected_route_parameters * The expected route parameters of the generated URL. - * @param \Drupal\Core\Entity\Entity|\PHPUnit\Framework\MockObject\MockObject $entity + * @param \Drupal\Tests\Core\Entity\UrlTestEntity|\PHPUnit\Framework\MockObject\MockObject $entity * The entity that is expected to be set as a URL option. * @param bool $has_language * Whether or not the URL is expected to have a language option. diff --git a/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/core/tests/Drupal/Tests/Core/Image/ImageTest.php index ece030d5195..93b02ef1970 100644 --- a/core/tests/Drupal/Tests/Core/Image/ImageTest.php +++ b/core/tests/Drupal/Tests/Core/Image/ImageTest.php @@ -73,7 +73,7 @@ class ImageTest extends UnitTestCase { * * @param string $class_name * The name of the GD toolkit operation class to be mocked. - * @param \Drupal\Core\Image\ImageToolkitInterface $toolkit + * @param \Drupal\Core\ImageToolkit\ImageToolkitInterface $toolkit * The image toolkit object. * * @return \PHPUnit\Framework\MockObject\MockObject