Skip to content

Fix more generic types #43903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class MessengerTransportDoctrineSchemaSubscriber implements EventSubscribe
private $transports;

/**
* @param iterable<int, TransportInterface> $transports
* @param iterable<mixed, TransportInterface> $transports
*/
public function __construct(iterable $transports)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class PdoCacheAdapterDoctrineSchemaSubscriber implements EventSubscriber
private $pdoAdapters;

/**
* @param iterable<int, PdoAdapter> $pdoAdapters
* @param iterable<mixed, PdoAdapter> $pdoAdapters
*/
public function __construct(iterable $pdoAdapters)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class RememberMeTokenProviderDoctrineSchemaSubscriber implements EventSubs
private $rememberMeHandlers;

/**
* @param iterable<int, RememberMeHandlerInterface> $rememberMeHandlers
* @param iterable<mixed, RememberMeHandlerInterface> $rememberMeHandlers
*/
public function __construct(iterable $rememberMeHandlers)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ExpressionCacheWarmer implements CacheWarmerInterface
private $expressionLanguage;

/**
* @param iterable<int, Expression> $expressions
* @param iterable<mixed, Expression> $expressions
*/
public function __construct(iterable $expressions, ExpressionLanguage $expressionLanguage)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MainConfiguration implements ConfigurationInterface
private $userProviderFactories;

/**
* @param array<int, SecurityFactoryInterface|AuthenticatorFactoryInterface> $factories
* @param array<array-key, SecurityFactoryInterface|AuthenticatorFactoryInterface> $factories
*/
public function __construct(array $factories, array $userProviderFactories)
{
Expand Down Expand Up @@ -220,7 +220,7 @@ private function addAccessControlSection(ArrayNodeDefinition $rootNode)
}

/**
* @param array<int, SecurityFactoryInterface|AuthenticatorFactoryInterface> $factories
* @param array<array-key, SecurityFactoryInterface|AuthenticatorFactoryInterface> $factories
*/
private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $factories)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
private $requestMatchers = [];
private $expressions = [];
private $contextListeners = [];
/** @var array<array{0: int, 1: AuthenticatorFactoryInterface|SecurityFactoryInterface}> */
/** @var list<array{int, AuthenticatorFactoryInterface|SecurityFactoryInterface}> */
private $factories = [];
/** @var (AuthenticatorFactoryInterface|SecurityFactoryInterface)[] */
/** @var list<AuthenticatorFactoryInterface|SecurityFactoryInterface> */
private $sortedFactories = [];
private $userProviderFactories = [];
private $statelessFirewallKeys = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class FirewallContext
private $logoutListener;
private $config;

/**
* @param iterable<mixed, callable> $listeners
*/
public function __construct(iterable $listeners, ExceptionListener $exceptionListener = null, LogoutListener $logoutListener = null, FirewallConfig $config = null)
{
$this->listeners = $listeners;
Expand All @@ -40,6 +43,9 @@ public function getConfig()
return $this->config;
}

/**
* @return iterable<mixed, callable>
*/
public function getListeners(): iterable
{
return $this->listeners;
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Config/ResourceCheckerConfigCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
private $file;

/**
* @var iterable<int, ResourceCheckerInterface>
* @var iterable<mixed, ResourceCheckerInterface>
*/
private $resourceCheckers;

/**
* @param string $file The absolute cache path
* @param iterable<int, ResourceCheckerInterface> $resourceCheckers The ResourceCheckers to use for the freshness check
* @param string $file The absolute cache path
* @param iterable<mixed, ResourceCheckerInterface> $resourceCheckers The ResourceCheckers to use for the freshness check
*/
public function __construct(string $file, iterable $resourceCheckers = [])
{
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Console/Helper/HelperSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
*/
class HelperSet implements \IteratorAggregate
{
/**
* @var Helper[]
*/
/** @var array<string, Helper> */
private $helpers = [];
private $command;

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Crawler implements \Countable, \IteratorAggregate
private $document;

/**
* @var \DOMNode[]
* @var list<\DOMNode>
*/
private $nodes = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/EventDispatcher/GenericEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function offsetExists($key)
/**
* IteratorAggregate for iterating over the object like an array.
*
* @return \ArrayIterator
* @return \ArrayIterator<string, mixed>
*/
#[\ReturnTypeWillChange]
public function getIterator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @template TKey
* @template TValue
* @template-covariant TKey
* @template-covariant TValue
*
* @extends \FilterIterator<TKey, TValue>
*/
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/Form/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(FormConfigInterface $config)
/**
* Unsupported method.
*
* @param mixed $offset
* @param string $offset
*
* @return bool
*/
Expand All @@ -64,7 +64,7 @@ public function offsetExists($offset)
*
* This method should not be invoked.
*
* @param mixed $offset
* @param string $offset
*
* @return FormInterface
*
Expand All @@ -81,8 +81,8 @@ public function offsetGet($offset)
*
* This method should not be invoked.
*
* @param mixed $offset
* @param mixed $value
* @param string $offset
* @param FormInterface $value
*
* @return void
*
Expand All @@ -99,7 +99,7 @@ public function offsetSet($offset, $value)
*
* This method should not be invoked.
*
* @param mixed $offset
* @param string $offset
*
* @return void
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@

/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @implements \IteratorAggregate<int, string>
*/
class ViolationPath implements \IteratorAggregate, PropertyPathInterface
{
/**
* @var string[]
* @var list<string>
*/
private $elements = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @extends \Traversable<string, self>
* @extends \Traversable<string, FormBuilderInterface>
*/
interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuilderInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormErrorIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \Array
private $errors;

/**
* @param array<int, FormError|self> $errors
* @param list<FormError|self> $errors
*
* @throws InvalidArgumentException If the errors are invalid
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Form/Util/OrderedHashMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
/**
* The keys of the map in the order in which they were inserted or changed.
*
* @var array
* @var list<TKey>
*/
private $orderedKeys = [];

/**
* References to the cursors of all open iterators.
*
* @var array
* @var array<int, int>
*/
private $managedCursors = [];

Expand All @@ -116,7 +116,7 @@ public function offsetExists($key)
/**
* {@inheritdoc}
*
* @return mixed
* @return TValue
*/
#[\ReturnTypeWillChange]
public function offsetGet($key)
Expand Down
24 changes: 12 additions & 12 deletions src/Symfony/Component/Form/Util/OrderedHashMapIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,54 @@
*
* @internal
*
* @template TKey
* @template TValue
* @template-covariant TKey of array-key
* @template-covariant TValue
*
* @implements \Iterator<TKey, TValue>
*/
class OrderedHashMapIterator implements \Iterator
{
/**
* @var array
* @var array<TKey, TValue>
*/
private $elements;

/**
* @var array
* @var list<TKey>
*/
private $orderedKeys;

/**
* @var int
*/
private $cursor;
private $cursor = 0;

/**
* @var int
*/
private $cursorId;

/**
* @var array
* @var array<int, int>
*/
private $managedCursors;

/**
* @var string|int|null
* @var TKey|null
*/
private $key;

/**
* @var mixed
* @var TValue|null
*/
private $current;

/**
* @param array<TKey, TValue> $elements The elements of the map, indexed by their
* keys
* @param array $orderedKeys The keys of the map in the order in which
* @param list<TKey> $orderedKeys The keys of the map in the order in which
* they should be iterated
* @param array $managedCursors An array from which to reference the
* @param array<int, int> $managedCursors An array from which to reference the
* iterator's cursor as long as it is alive.
* This array is managed by the corresponding
* {@link OrderedHashMap} instance to support
Expand Down Expand Up @@ -105,7 +105,7 @@ public function __destruct()
/**
* {@inheritdoc}
*
* @return mixed
* @return TValue|null
*/
#[\ReturnTypeWillChange]
public function current()
Expand All @@ -132,7 +132,7 @@ public function next(): void
/**
* {@inheritdoc}
*
* @return mixed
* @return TKey|null
*/
#[\ReturnTypeWillChange]
public function key()
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/HttpFoundation/HeaderBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @implements \IteratorAggregate<string, array<int, string|null>>
* @implements \IteratorAggregate<string, list<string|null>>
*/
class HeaderBag implements \IteratorAggregate, \Countable
{
protected const UPPER = '_ABCDEFGHIJKLMNOPQRSTUVWXYZ';
protected const LOWER = '-abcdefghijklmnopqrstuvwxyz';

/**
* @var array<string, array<int, string|null>>
* @var array<string, list<string|null>>
*/
protected $headers = [];
protected $cacheControl = [];
Expand Down Expand Up @@ -255,7 +255,7 @@ public function removeCacheControlDirective(string $key)
/**
* Returns an iterator for headers.
*
* @return \ArrayIterator<string, array<int, string|null>>
* @return \ArrayIterator<string, list<string|null>>
*/
#[\ReturnTypeWillChange]
public function getIterator()
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class_exists(ConfigCache::class);
abstract class Kernel implements KernelInterface, RebootableInterface, TerminableInterface
{
/**
* @var BundleInterface[]
* @var array<string, BundleInterface>
*/
protected $bundles = [];

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpKernel/KernelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface KernelInterface extends HttpKernelInterface
/**
* Returns an array of bundles to register.
*
* @return iterable<BundleInterface>
* @return iterable<mixed, BundleInterface>
*/
public function registerBundles();

Expand All @@ -55,7 +55,7 @@ public function shutdown();
/**
* Gets the registered bundle instances.
*
* @return BundleInterface[]
* @return array<string, BundleInterface>
*/
public function getBundles();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
class BufferedBundleReader implements BundleReaderInterface
{
private $reader;
/** @var RingBuffer<string, mixed> */
private $buffer;

/**
Expand Down
Loading