8000 [Security] add return types · symfony/symfony@077a238 · GitHub
[go: up one dir, main page]

Skip to content

Commit 077a238

Browse files
[Security] add return types
1 parent 61cf95e commit 077a238

File tree

79 files changed

+139
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+139
-235
lines changed

src/Symfony/Bundle/SecurityBundle/CacheWarmer/ExpressionCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public function __construct(iterable $expressions, ExpressionLanguage $expressio
2929
$this->expressionLanguage = $expressionLanguage;
3030
}
3131

32-
public function isOptional()
32+
public function isOptional(): bool
3333
{
3434
return true;
3535
}
3636

3737
/**
3838
* @return string[]
3939
*/
40-
public function warmUp(string $cacheDir)
40+
public function warmUp(string $cacheDir): array
4141
{
4242
foreach ($this->expressions as $expression) {
4343
$this->expressionLanguage->parse($expression, ['token', 'user', 'object', 'subject', 'role_names', 'request', 'trust_resolver']);

src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,16 @@ public function getUser(): string
230230

231231
/**
232232
* Gets the roles of the user.
233-
*
234-
* @return array|Data
235233
*/
236-
public function getRoles()
234+
public function getRoles(): array|Data
237235
{
238236
return $this->data['roles'];
239237
}
240238

241239
/**
242240
* Gets the inherited roles of the user.
243-
*
244-
* @return array|Data
245241
*/
246-
public function getInheritedRoles()
242+
public function getInheritedRoles(): array|Data
247243
{
248244
return $this->data['inherited_roles'];
249245
}
@@ -282,10 +278,8 @@ public function getImpersonationExitPath(): ?string
282278

283279
/**
284280
* Get the class name of the security token.
285-
*
286-
* @return string|Data|null
287281
*/
288-
public function getTokenClass()
282+
public function getTokenClass(): string|Data|null
289283
{
290284
return $this->data['token_class'];
291285
}
@@ -305,7 +299,7 @@ public function getLogoutUrl(): ?string
305299
*
306300
* @return string[]|Data
307301
*/
308-
public function getVoters()
302+
public function getVoters(): array|Data
309303
{
310304
return $this->data['voters'];
311305
}
@@ -317,28 +311,21 @@ public function getVoterStrategy(): string
317311

318312
/**
319313
* Returns the log of the security decisions made by the access decision manager.
320-
*
321-
* @return array|Data
322314
*/
323-
public function getAccessDecisionLog()
315+
public function getAccessDecisionLog(): array|Data
324316
{
325317
return $this->data['access_decision_log'];
326318
}
327319

328320
/**
329321
* Returns the configuration of the current firewall context.
330-
*
331-
* @return array|Data|null
332322
*/
333-
public function getFirewall()
323+
public function getFirewall(): array|Data|null
334324
{
335325
return $this->data['firewall'];
336326
}
337327

338-
/**
339-
* @return array|Data
340-
*/
341-
public function getListeners()
328+
public function getListeners(): array|Data
342329
{
343330
return $this->data['listeners'];
344331
}

src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ public function __construct(array $factories, array $userProviderFactories)
4242

4343
/**
4444
* Generates the configuration tree builder.
45-
*
46-
* @return TreeBuilder
4745
*/
48-
public function getConfigTreeBuilder()
46+
public function getConfigTreeBuilder(): TreeBuilder
4947
{
5048
$tb = new TreeBuilder('security');
5149
$rootNode = $tb->getRootNode();

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ abstract class AbstractFactory implements AuthenticatorFactoryInterface
4848
'failure_path_parameter' => '_failure_path',
4949
];
5050

51-
final public function addOption(string $name, mixed $default = null)
51+
final public function addOption(string $name, mixed $default = null): void
5252
{
5353
$this->options[$name] = $default;
5454
}

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AuthenticatorFactoryInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ public function getPriority(): int;
2727
/**
2828
* Defines the configuration key used to reference the provider
2929
* in the firewall configuration.
30-
*
31-
* @return string
3230
*/
33-
public function getKey();
31+
public function getKey(): string;
3432

3533
public function addConfiguration(NodeDefinition $builder);
3634

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
1616
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FirewallListenerFactoryInterface;
1717
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface;
18+
use Symfony\Component\Config\Definition\ConfigurationInterface;
1819
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1920
use Symfony\Component\Config\FileLocator;
2021
use Symfony\Component\Console\Application;
@@ -849,17 +850,17 @@ public function addUserProviderFactory(UserProviderFactoryInterface $factory)
849850
/**
850851
* {@inheritdoc}
851852
*/
852-
public function getXsdValidationBasePath()
853+
public function getXsdValidationBasePath(): string|false
853854
{
854855
return __DIR__.'/../Resources/config/schema';
855856
}
856857

857-
public function getNamespace()
858+
public function getNamespace(): string
858859
{
859860
return 'http://symfony.com/schema/dic/security';
860861
}
861862

862-
public function getConfiguration(array $config, ContainerBuilder $container)
863+
public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface
863864
{
864865
// first assemble the factories
865866
return new MainConfiguration($this->getSortedFactories(), $this->userProviderFactories);

src/Symfony/Bundle/SecurityBundle/EventListener/FirewallListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function onKernelFinishRequest(FinishRequestEvent $event)
5959
/**
6060
* {@inheritdoc}
6161
*/
62-
public static function getSubscribedEvents()
62+
public static function getSubscribedEvents(): array
6363
{
6464
return [
6565
KernelEvents::REQUEST => [

src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(ContainerInterface $container, iterable $map)
3333
$this->map = $map;
3434
}
3535

36-
public function getListeners(Request $request)
36+
public function getListeners(Request $request): array
3737
{
3838
$context = $this->getFirewallContext($request);
3939

@@ -44,10 +44,7 @@ public function getListeners(Request $request)
4444
return [$context->getListeners(), $context->getExceptionListener(), $context->getLogoutListener()];
4545
}
4646

47-
/**
48-
* @return FirewallConfig|null
49-
*/
50-
public function getFirewallConfig(Request $request)
47+
public function getFirewallConfig(Request $request): ?FirewallConfig
5148
{
5249
$context = $this->getFirewallContext($request);
5350

src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function isAuthenticated(TokenInterface $token = null): bool
3030
/**
3131
* {@inheritdoc}
3232
*/
33-
public function isRememberMe(TokenInterface $token = null)
33+
public function isRememberMe(TokenInterface $token = null): bool
3434
{
3535
if (null === $token) {
3636
return false;
@@ -42,7 +42,7 @@ public function isRememberMe(TokenInterface $token = null)
4242
/**
4343
* {@inheritdoc}
4444
*/
45-
public function isFullFledged(TokenInterface $token = null)
45+
public function isFullFledged(TokenInterface $token = null): bool
4646
{
4747
if (null === $token || $token instanceof NullToken) {
4848
return false;

src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* Interface for resolving the authentication status of a given token.
1818
*
1919
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
20-
*
21-
* @method bool isAuthenticated(TokenInterface $token = null)
2220
*/
2321
interface AuthenticationTrustResolverInterface
2422
{

0 commit comments

Comments
 (0)
0