Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c3adead

Browse filesBrowse files
Add union types
1 parent f4d1e4f commit c3adead
Copy full SHA for c3adead

File tree

Expand file treeCollapse file tree

72 files changed

+237
-430
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

72 files changed

+237
-430
lines changed

‎src/Symfony/Component/Cache/CacheItem.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/CacheItem.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,9 @@ public function getMetadata(): array
151151
/**
152152
* Validates a cache key according to PSR-6.
153153
*
154-
* @param string $key The key to validate
155-
*
156154
* @throws InvalidArgumentException When $key is not valid
157155
*/
158-
public static function validateKey($key): string
156+
public static function validateKey(mixed $key): string
159157
{
160158
if (!\is_string($key)) {
161159
throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', get_debug_type($key)));

‎src/Symfony/Component/Cache/Messenger/EarlyExpirationMessage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Messenger/EarlyExpirationMessage.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function findCallback(ReverseContainer $reverseContainer): callable
8888
return $callback;
8989
}
9090

91-
private function __construct(CacheItem $item, string $pool, $callback)
91+
private function __construct(CacheItem $item, string $pool, string|array $callback)
9292
{
9393
$this->item = $item;
9494
$this->pool = $pool;

‎src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,12 @@ public function saveDeferred(CacheItemInterface $item)
291291
*
292292
* Calling this method also clears the memoized namespace version and thus forces a resynchonization of it.
293293
*
294-
* @param bool $enable
295-
*
296294
* @return bool the previous state of versioning
297295
*/
298-
public function enableVersioning($enable = true)
296+
public function enableVersioning(bool $enable = true)
299297
{
300298
$wasEnabled = $this->versioningIsEnabled;
301-
$this->versioningIsEnabled = (bool) $enable;
299+
$this->versioningIsEnabled = $enable;
302300
$this->namespaceVersion = '';
303301
$this->ids = [];
304302

@@ -356,7 +354,7 @@ private function generateItems(iterable $items, array &$keys): iterable
356354
}
357355
}
358356

359-
private function getId($key)
357+
private function getId(string|int $key)
360358
{
361359
if ($this->versioningIsEnabled && '' === $this->namespaceVersion) {
362360
$this->ids = [];

‎src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/MemcachedTrait.php
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,10 @@ private function init(\Memcached $client, string $namespace, int $defaultLifetim
8484
*
8585
* @throws \ErrorException When invalid options or servers are provided
8686
*/
87-
public static function createConnection($servers, array $options = [])
87+
public static function createConnection(string|array $servers, array $options = [])
8888
{
8989
if (\is_string($servers)) {
9090
$servers = [$servers];
91-
} elseif (!\is_array($servers)) {
92-
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, "%s" given.', \gettype($servers)));
9391
}
9492
if (!static::isSupported()) {
9593
throw new CacheException('Memcached >= 2.2.0 is required.');
@@ -273,7 +271,7 @@ protected function doFetch(array $ids)
273271
/**
274272
* {@inheritdoc}
275273
*/
276-
protected function doHave($id)
274+
protected function doHave(string $id)
277275
{
278276
return false !== $this->getClient()->get(self::encodeKey($id)) || $this->checkResultCode(\Memcached::RES_SUCCESS === $this->client->getResultCode());
279277
}
@@ -298,12 +296,12 @@ protected function doDelete(array $ids)
298296
/**
299297
* {@inheritdoc}
300298
*/
301-
protected function doClear($namespace)
299+
protected function doClear(string $namespace)
302300
{
303301
return '' === $namespace && $this->getClient()->flush();
304302
}
305303

306-
private function checkResultCode($result)
304+
private function checkResultCode(mixed $result)
307305
{
308306
$code = $this->client->getResultCode();
309307

‎src/Symfony/Component/Cache/Traits/RedisTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+4-12Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,14 @@ trait RedisTrait
4747
private $redis;
4848
private $marshaller;
4949

50-
/**
51-
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient
52-
*/
53-
private function init($redisClient, string $namespace, int $defaultLifetime, ?MarshallerInterface $marshaller)
50+
private function init(\Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|RedisProxy|RedisClusterProxy $redisClient, string $namespace, int $defaultLifetime, ?MarshallerInterface $marshaller)
5451
{
5552
parent::__construct($namespace, $defaultLifetime);
5653

5754
if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) {
5855
throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0]));
5956
}
6057

61-
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy && !$redisClient instanceof RedisClusterProxy) {
62-
throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redisClient)));
63-
}
64-
6558
if ($redisClient instanceof \Predis\ClientInterface && $redisClient->getOptions()->exceptions) {
6659
$options = clone $redisClient->getOptions();
6760
\Closure::bind(function () { $this->options['exceptions'] = false; }, $options, $options)();
@@ -82,14 +75,13 @@ private function init($redisClient, string $namespace, int $defaultLifetime, ?Ma
8275
* - redis:///var/run/redis.sock
8376
* - redis://secret@/var/run/redis.sock/13
8477
*
85-
* @param string $dsn
86-
* @param array $options See self::$defaultConnectionOptions
78+
* @param array $options See self::$defaultConnectionOptions
8779
*
8880
* @throws InvalidArgumentException when the DSN is invalid
8981
*
9082
* @return \Redis|\RedisCluster|RedisClusterProxy|RedisProxy|\Predis\ClientInterface According to the "class" option
9183
*/
92-
public static function createConnection($dsn, array $options = [])
84+
public static function createConnection(string $dsn, array $options = [])
9385
{
9486
if (0 === strpos($dsn, 'redis:')) {
9587
$scheme = 'redis';
@@ -498,7 +490,7 @@ protected function doSave(array $values, int $lifetime)
498490
return $failed;
499491
}
500492

501-
private function pipeline(\Closure $generator, $redis = null): \Generator
493+
private function pipeline(\Closure $generator, object $redis = null): \Generator
502494
{
503495
$ids = [];
504496
$redis = $redis ?? $this->redis;

‎src/Symfony/Component/Console/Command/Command.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Command/Command.php
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,9 @@ public function mergeApplicationDefinition(bool $mergeArgs = true)
371371
/**
372372
* Sets an array of argument and option instances.
373373
*
374-
* @param array|InputDefinition $definition An array of argument and option instances or a definition instance
375-
*
376374
* @return $this
377375
*/
378-
public function setDefinition($definition)
376+
public function setDefinition(array|InputDefinition $definition)
379377
{
380378
if ($definition instanceof InputDefinition) {
381379
$this->definition = $definition;
@@ -427,7 +425,7 @@ public function getNativeDefinition()
427425
*
428426
* @return $this
429427
*/
430-
public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
428+
public function addArgument(string $name, int $mode = null, string $description = '', string|array|null $default = null)
431429
{
432430
$this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
433431
if (null !== $this->fullDefinition) {
@@ -448,7 +446,7 @@ public function addArgument(string $name, int $mode = null, string $description
448446
*
449447
* @return $this
450448
*/
451-
public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
449+
public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', string|array|bool|null $default = null)
452450
{
453451
$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
454452
if (null !== $this->fullDefinition) {

‎src/Symfony/Component/Console/Command/LazyCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Command/LazyCommand.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function mergeApplicationDefinition(bool $mergeArgs = true): void
9090
/**
9191
* @return $this
9292
*/
93-
public function setDefinition($definition): self
93+
public function setDefinition(array|InputDefinition $definition): self
9494
{
9595
$this->getCommand()->setDefinition($definition);
9696

@@ -110,7 +110,7 @@ public function getNativeDefinition(): InputDefinition
110110
/**
111111
* @return $this
112112
*/
113-
public function addArgument(string $name, int $mode = null, string $description = '', $default = null): self
113+
public function addArgument(string $name, int $mode = null, string $description = '', string|array|null $default = null): self
114114
{
115115
$this->getCommand()->addArgument($name, $mode, $description, $default);
116116

@@ -120,7 +120,7 @@ public function addArgument(string $name, int $mode = null, string $description
120120
/**
121121
* @return $this
122122
*/
123-
public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null): self
123+
public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', string|array|bool|null $default = null): self
124124
{
125125
$this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
126126

‎src/Symfony/Component/Console/Descriptor/Descriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Descriptor/Descriptor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class Descriptor implements DescriptorInterface
3434
/**
3535
* {@inheritdoc}
3636
*/
37-
public function describe(OutputInterface $output, $object, array $options = [])
37+
public function describe(OutputInterface $output, object $object, array $options = [])
3838
{
3939
$this->output = $output;
4040

‎src/Symfony/Component/Console/Descriptor/DescriptorInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Descriptor/DescriptorInterface.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ interface DescriptorInterface
2222
{
2323
/**
2424
* Describes an object if supported.
25-
*
26-
* @param object $object
2725
*/
28-
public function describe(OutputInterface $output, $object, array $options = []);
26+
public function describe(OutputInterface $output, object $object, array $options = []);
2927
}

‎src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MarkdownDescriptor extends Descriptor
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function describe(OutputInterface $output, $object, array $options = [])
34+
public function describe(OutputInterface $output, object $object, array $options = [])
3535
{
3636
$decorated = $output->isDecorated();
3737
$output->setDecorated(false);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.