Skip to content

More return type fixes #42484

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
Aug 11, 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
1 change: 1 addition & 0 deletions .github/patch-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
switch (true) {
case false !== strpos($file = realpath($file), '/vendor/'):
case false !== strpos($file, '/src/Symfony/Bridge/PhpUnit/'):
case false !== strpos($file, '/Attribute/'):
case false !== strpos($file, '/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php'):
case false !== strpos($file, '/src/Symfony/Component/Cache/Tests/Fixtures/DriverWrapper.php'):
case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadFileName.php'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,10 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
{
}

public function createToken(Passport $passport, string $firewallName): TokenInterface
{
}
}

class NullAuthenticator implements GuardAuthenticatorInterface
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class ArrayCache extends CacheProvider
{
private $data = [];

/**
* @return mixed
*/
protected function doFetch($id)
{
return $this->doContains($id) ? $this->data[$id][0] : false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
Expand Down Expand Up @@ -803,9 +802,7 @@ private function validate($content, string $file): ?array
}

/**
* Resolves services.
*
* @return array|string|Reference|ArgumentInterface
* @return mixed
*/
private function resolveServices($value, string $file, bool $isParameter = false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class ProjectWithXsdExtension extends ProjectExtension
{
public function getXsdValidationBasePath()
public function getXsdValidationBasePath(): string
{
return __DIR__.'/schema';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function __construct(\MongoDB\Client $mongo, array $options)
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function close()
{
return true;
Expand Down Expand Up @@ -135,6 +136,7 @@ protected function doWrite(string $sessionId, string $data)
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function updateTimestamp($sessionId, $data)
{
$expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public function gc($maxlifetime)
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function updateTimestamp($sessionId, $data)
{
return (bool) $this->redis->expire($this->prefix.$sessionId, (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')));
Expand Down
7 changes: 5 additions & 2 deletions src/Symfony/Component/HttpKernel/Tests/KernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,17 +516,20 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('test.extension-registered', true);
}

public function getNamespace()
public function getNamespace(): string
{
return '';
}

/**
* @return false
*/
public function getXsdValidationBasePath()
{
return false;
}

public function getAlias()
public function getAlias(): string
{
return 'test-extension';
}
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function count()
/**
* @return \Traversable
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
if (0 === $this->count()) {
Expand All @@ -91,6 +92,7 @@ public function getIterator()
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$this->toArray();
Expand All @@ -101,6 +103,7 @@ public function offsetExists($offset)
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$this->toArray();
Expand All @@ -111,6 +114,7 @@ public function offsetGet($offset)
/**
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->toArray();
Expand All @@ -121,6 +125,7 @@ public function offsetSet($offset, $value)
/**
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$this->toArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,9 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
{
}

public function createToken(Passport $passport, string $firewallName): TokenInterface
{
}
}
}
4 changes: 2 additions & 2 deletions src/Symfony/Component/Lock/Tests/LockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public function delete(Key $key)
unset($this->keys[spl_object_hash($key)]);
}

public function exists(Key $key)
public function exists(Key $key): bool
{
return isset($this->keys[spl_object_hash($key)]);
}
Expand Down Expand Up @@ -502,7 +502,7 @@ public function delete(Key $key)
unset($this->keys[spl_object_hash($key)]);
}

public function exists(Key $key)
public function exists(Key $key): bool
{
return isset($this->keys[spl_object_hash($key)]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function isAuthenticated(): bool
return true;
}

/**
* @return mixed
*/
public function getCredentials()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ public function setSerializer(SerializerInterface $serializer)

class NotSerializable
{
/**
* @return array
*/
public function __sleep()
{
if (class_exists(\Error::class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,11 @@ public function testNormalizeNotSerializableContext()
public function testDefaultExcludeFromCacheKey()
{
$normalizer = new class(null, null, null, null, null, null, [ObjectNormalizer::EXCLUDE_FROM_CACHE_KEY => ['foo']]) extends ObjectNormalizer {
protected function isCircularReference($object, &$context)
protected function isCircularReference($object, &$context): bool
{
ObjectNormalizerTest::assertContains('foo', $this->defaultContext[ObjectNormalizer::EXCLUDE_FROM_CACHE_KEY]);

return false;
}
};
$normalizer->normalize(new ObjectDummy());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TestNormalizer implements NormalizerInterface
*/
public function normalize($object, string $format = null, array $context = [])
{
return null;
}

/**
Expand Down