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

Add missing return types to tests/internal/final methods #42615

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 18, 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
4 changes: 2 additions & 2 deletions 4 .github/patch-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php'):
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/'):
case false !== strpos($file, '/src/Symfony/Component/ErrorHandler/Tests/Fixtures/'):
case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php'):
case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/ParentDummy.php'):
case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/'):
case false !== strpos($file, '/src/Symfony/Component/Runtime/Internal/ComposerPlugin.php'):
case false !== strpos($file, '/src/Symfony/Component/Serializer/Tests/Fixtures/'):
case false !== strpos($file, '/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectOuter.php'):
case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/NotLoadableClass.php'):
case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/ReflectionIntersectionTypeFixture.php'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,8 @@ public function registerContainerConfiguration(LoaderInterface $loader)

/**
* @internal
*
* @return RouteCollection
*/
public function loadRoutes(LoaderInterface $loader)
public function loadRoutes(LoaderInterface $loader): RouteCollection
{
$file = (new \ReflectionObject($this))->getFileName();
/* @var RoutingPhpFileLoader $kernelLoader */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ protected function tearDown(): void
$this->fs->remove($this->translationDir);
}

/**
* @return CommandTester
*/
private function createCommandTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = [])
private function createCommandTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
{
$translator = $this->createMock(Translator::class);
$translator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function getKernelParameters(): array
return $parameters;
}

public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('foo');
$rootNode = $treeBuilder->getRootNode();
Expand All @@ -119,7 +119,7 @@ public function load(array $configs, ContainerBuilder $container)
{
}

public function getNamespace()
public function getNamespace(): string
{
return '';
}
Expand All @@ -129,7 +129,7 @@ public function getXsdValidationBasePath()
return false;
}

public function getAlias()
public function getAlias(): string
{
return 'foo';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
], JsonResponse::HTTP_FORBIDDEN);
}

public function start(Request $request, AuthenticationException $authException = null)
public function start(Request $request, AuthenticationException $authException = null): Response
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface;
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
Expand Down Expand Up @@ -865,39 +866,39 @@ public function createToken(Passport $passport, string $firewallName): TokenInte

class NullAuthenticator implements GuardAuthenticatorInterface
{
public function start(Request $request, AuthenticationException $authException = null)
public function start(Request $request, AuthenticationException $authException = null): Response
{
}

public function supports(Request $request)
public function supports(Request $request): bool
{
}

public function getCredentials(Request $request)
{
}

public function getUser($credentials, UserProviderInterface $userProvider)
public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface
{
}

public function checkCredentials($credentials, UserInterface $user)
public function checkCredentials($credentials, UserInterface $user): bool
{
}

public function createAuthenticatedToken(UserInterface $user, string $providerKey)
public function createAuthenticatedToken(UserInterface $user, string $providerKey): GuardTokenInterface
{
}

public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
{
}

public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey)
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey): ?Response
{
}

public function supportsRememberMe()
public function supportsRememberMe(): bool
{
}
}
Expand All @@ -922,20 +923,20 @@ public function createListeners(ContainerBuilder $container, string $firewallNam
return ['custom_firewall_listener_id'];
}

public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint)
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array
{
$container->register('provider_id', \stdClass::class);
$container->register('listener_id', \stdClass::class);

return ['provider_id', 'listener_id', $defaultEntryPoint];
}

public function getPosition()
public function getPosition(): string
{
return 'form';
}

public function getKey()
public function getKey(): string
{
return 'custom_listener';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class AppCustomAuthenticator extends AbstractGuardAuthenticator
{
public function supports(Request $request)
public function supports(Request $request): bool
{
return false;
}
Expand All @@ -30,28 +30,28 @@ public function getCredentials(Request $request)
{
}

public function getUser($credentials, UserProviderInterface $userProvider)
public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface
{
}

public function checkCredentials($credentials, UserInterface $user)
public function checkCredentials($credentials, UserInterface $user): bool
{
}

public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
{
}

public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response
{
}

public function start(Request $request, AuthenticationException $authException = null)
public function start(Request $request, AuthenticationException $authException = null): Response
{
return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED);
}

public function supportsRememberMe()
public function supportsRememberMe(): bool
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function secureAction()
/**
* {@inheritdoc}
*/
public static function getSubscribedServices()
public static function getSubscribedServices(): array
{
return [
'form.factory' => FormFactoryInterface::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function homepageAction()
/**
* {@inheritdoc}
*/
public static function getSubscribedServices()
public static function getSubscribedServices(): array
{
return [
'twig' => Environment::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function secureAction()
/**
* {@inheritdoc}
*/
public static function getSubscribedServices()
public static function getSubscribedServices(): array
{
return [
'twig' => Environment::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class AppCustomAuthenticator extends AbstractGuardAuthenticator
{
public function supports(Request $request)
public function supports(Request $request): bool
{
return '/manual_login' !== $request->getPathInfo() && '/profile' !== $request->getPathInfo();
}
Expand All @@ -31,29 +31,29 @@ public function getCredentials(Request $request)
throw new AuthenticationException('This should be hit');
}

public function getUser($credentials, UserProviderInterface $userProvider)
public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface
{
}

public function checkCredentials($credentials, UserInterface $user)
public function checkCredentials($credentials, UserInterface $user): bool
{
}

public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
{
return new Response('', 418);
}

public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response
{
}

public function start(Request $request, AuthenticationException $authException = null)
public function start(Request $request, AuthenticationException $authException = null): Response
{
return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED);
}

public function supportsRememberMe()
public function supportsRememberMe(): bool
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;

class TestCustomLoginLinkSuccessHandler implements AuthenticationSuccessHandlerInterface
{
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
public function onAuthenticationSuccess(Request $request, TokenInterface $token): Response
{
return new JsonResponse(['message' => sprintf('Welcome %s!', $token->getUserIdentifier())]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct($kernel)
}
}

public function loadTokenBySeries(string $series)
public function loadTokenBySeries(string $series): PersistentTokenInterface
{
$token = self::$db[$series] ?? false;
if (!$token) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(InMemoryUserProvider $inner)
$this->inner = $inner;
}

public function loadUserByUsername($username)
public function loadUserByUsername($username): UserInterface
{
return $this->inner->loadUserByUsername($username);
}
Expand All @@ -36,7 +36,7 @@ public function loadUserByIdentifier(string $userIdentifier): UserInterface
return $this->inner->loadUserByIdentifier($userIdentifier);
}

public function refreshUser(UserInterface $user)
public function refreshUser(UserInterface $user): UserInterface
{
$user = $this->inner->refreshUser($user);

Expand All @@ -46,7 +46,7 @@ public function refreshUser(UserInterface $user)
return $user;
}

public function supportsClass($class)
public function supportsClass($class): bool
{
return $this->inner->supportsClass($class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getUser($username)
return $this->users[$username];
}

public function loadUserByUsername($username)
public function loadUserByUsername($username): UserInterface
{
return $this->loadUserByIdentifier($username);
}
Expand All @@ -48,7 +48,7 @@ public function loadUserByIdentifier(string $identifier): UserInterface
return $user;
}

public function refreshUser(UserInterface $user)
public function refreshUser(UserInterface $user): UserInterface
{
if (!$user instanceof UserInterface) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_debug_type($user)));
Expand All @@ -60,7 +60,7 @@ public function refreshUser(UserInterface $user)
return new $class($storedUser->getUserIdentifier(), $storedUser->getPassword(), $storedUser->getRoles(), $storedUser->isEnabled());
}

public function supportsClass($class)
public function supportsClass($class): bool
{
return InMemoryUser::class === $class || UserWithoutEquatable::class === $class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function __toString()
/**
* {@inheritdoc}
*/
public function getRoles()
public function getRoles(): array
{
return $this->roles;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
parent::__construct('test', false);
}

public function registerBundles()
public function registerBundles(): iterable
{
return [
new FrameworkBundle(),
Expand Down Expand Up @@ -59,7 +59,7 @@ public function getCacheDir(): string
return sys_get_temp_dir().'/cache-'.spl_object_hash($this);
}

public function getLogDir()
public function getLogDir(): string
{
return sys_get_temp_dir().'/log-'.spl_object_hash($this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

namespace Symfony\Component\Config\Tests\Fixtures\Configuration;

use Symfony\Component\Config\Definition\NodeInterface;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;

class CustomNodeDefinition extends NodeDefinition
{
protected function createNode()
protected function createNode(): NodeInterface
{
return new CustomNode();
}
Expand Down
4 changes: 1 addition & 3 deletions 4 src/Symfony/Component/Console/Terminal.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ public function getHeight()

/**
* @internal
*
* @return bool
*/
public static function hasSttyAvailable()
public static function hasSttyAvailable(): bool
{
if (null !== self::$stty) {
return self::$stty;
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.