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. "
parent
17aa9182ff
commit
de09fc95c5
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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']) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
*/
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -595,7 +595,7 @@ abstract class ImageTestBase extends CKEditor5TestBase {
|
|||
/**
|
||||
* Data provider for ::testWidth().
|
||||
*
|
||||
* @return \string[][]
|
||||
* @return string[][]
|
||||
*/
|
||||
public function providerWidth(): array {
|
||||
return [
|
||||
|
|
|
@ -80,7 +80,7 @@ JS;
|
|||
/**
|
||||
* Data provider for ensuring CKEditor 5 UI translations are loaded.
|
||||
*
|
||||
* @return \string[][]
|
||||
* @return string[][]
|
||||
*/
|
||||
public function provider(): array {
|
||||
return [
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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
|
||||
|
||||
-
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue