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

[SecurityBundle] add parameter type declarations where possible #32778

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
Jul 29, 2019
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 @@ -34,7 +34,7 @@ public function isOptional()
return true;
}

public function warmUp($cacheDir)
public function warmUp(string $cacheDir)
{
foreach ($this->expressions as $expression) {
$this->expressionLanguage->parse($expression, ['token', 'user', 'object', 'subject', 'roles', 'request', 'trust_resolver']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __invoke(RequestEvent $event)
/**
* Proxies all method calls to the original listener.
*/
public function __call($method, $arguments)
public function __call(string $method, array $arguments)
{
return $this->listener->{$method}(...$arguments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
'failure_path_parameter' => '_failure_path',
];

public function create(ContainerBuilder $container, $id, $config, $userProviderId, $defaultEntryPointId)
public function create(ContainerBuilder $container, string $id, array $config, string $userProviderId, ?string $defaultEntryPointId)
{
// authentication provider
$authProviderId = $this->createAuthProvider($container, $id, $config, $userProviderId);
Expand Down Expand Up @@ -89,7 +89,7 @@ public function addConfiguration(NodeDefinition $node)
}
}

final public function addOption($name, $default = null)
final public function addOption(string $name, $default = null)
{
$this->options[$name] = $default;
}
Expand All @@ -98,14 +98,9 @@ final public function addOption($name, $default = null)
* Subclasses must return the id of a service which implements the
* AuthenticationProviderInterface.
*
* @param ContainerBuilder $container
* @param string $id The unique id of the firewall
* @param array $config The options array for this listener
* @param string $userProviderId The id of the user provider
*
* @return string never null, the id of the authentication provider
*/
abstract protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId);
abstract protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId);

/**
* Subclasses must return the id of the abstract listener template.
Expand All @@ -128,14 +123,9 @@ abstract protected function getListenerId();
* Subclasses may create an entry point of their as they see fit. The
* default implementation does not change the default entry point.
*
* @param ContainerBuilder $container
* @param string $id
* @param array $config
* @param string $defaultEntryPointId
*
* @return string the entry point id
* @return string|null the entry point id
*/
protected function createEntryPoint($container, $id, $config, $defaultEntryPointId)
protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId)
{
return $defaultEntryPointId;
}
Expand All @@ -146,12 +136,12 @@ protected function createEntryPoint($container, $id, $config, $defaultEntryPoint
*
* @return bool Whether a possibly configured RememberMeServices should be set for this listener
*/
protected function isRememberMeAware($config)
protected function isRememberMeAware(array $config)
{
return $config['remember_me'];
}

protected function createListener($container, $id, $config, $userProvider)
protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider)
{
$listenerId = $this->getListenerId();
$listener = new ChildDefinition($listenerId);
Expand All @@ -166,7 +156,7 @@ protected function createListener($container, $id, $config, $userProvider)
return $listenerId;
}

protected function createAuthenticationSuccessHandler($container, $id, $config)
protected function createAuthenticationSuccessHandler(ContainerBuilder $container, string $id, array $config)
{
$successHandlerId = $this->getSuccessHandlerId($id);
$options = array_intersect_key($config, $this->defaultSuccessHandlerOptions);
Expand All @@ -185,7 +175,7 @@ protected function createAuthenticationSuccessHandler($container, $id, $config)
return $successHandlerId;
}

protected function createAuthenticationFailureHandler($container, $id, $config)
protected function createAuthenticationFailureHandler(ContainerBuilder $container, string $id, array $config)
{
$id = $this->getFailureHandlerId($id);
$options = array_intersect_key($config, $this->defaultFailureHandlerOptions);
Expand All @@ -202,12 +192,12 @@ protected function createAuthenticationFailureHandler($container, $id, $config)
return $id;
}

protected function getSuccessHandlerId($id)
protected function getSuccessHandlerId(string $id)
{
return 'security.authentication.success_handler.'.$id.'.'.str_replace('-', '_', $this->getKey());
}

protected function getFailureHandlerId($id)
protected function getFailureHandlerId(string $id)
{
return 'security.authentication.failure_handler.'.$id.'.'.str_replace('-', '_', $this->getKey());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function getListenerId()
return 'security.authentication.listener.form';
}

protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId)
protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId)
{
$provider = 'security.authentication.provider.dao.'.$id;
$container
Expand All @@ -72,7 +72,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config,
return $provider;
}

protected function createListener($container, $id, $config, $userProvider)
protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider)
{
$listenerId = parent::createListener($container, $id, $config, $userProvider);

Expand All @@ -84,7 +84,7 @@ protected function createListener($container, $id, $config, $userProvider)
return $listenerId;
}

protected function createEntryPoint($container, $id, $config, $defaultEntryPoint)
protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPoint)
{
$entryPointId = 'security.authentication.form_entry_point.'.$id;
$container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class FormLoginLdapFactory extends FormLoginFactory
{
protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId)
protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId)
{
$provider = 'security.authentication.provider.ldap_bind.'.$id;
$definition = $container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function addConfiguration(NodeDefinition $node)
;
}

public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint)
{
$authenticatorIds = $config['authenticators'];
$authenticatorReferences = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class HttpBasicFactory implements SecurityFactoryInterface
{
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint)
{
$provider = 'security.authentication.provider.dao.'.$id;
$container
Expand Down Expand Up @@ -66,7 +66,7 @@ public function addConfiguration(NodeDefinition $node)
;
}

protected function createEntryPoint($container, $id, $config, $defaultEntryPoint)
protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPoint)
{
if (null !== $defaultEntryPoint) {
return $defaultEntryPoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class HttpBasicLdapFactory extends HttpBasicFactory
{
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint)
{
$provider = 'security.authentication.provider.ldap_bind.'.$id;
$definition = $container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getKey()
/**
* {@inheritdoc}
*/
protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId)
protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId)
{
$provider = 'security.authentication.provider.dao.'.$id;
$container
Expand Down Expand Up @@ -81,7 +81,7 @@ protected function isRememberMeAware($config)
/**
* {@inheritdoc}
*/
protected function createListener($container, $id, $config, $userProvider)
protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider)
{
$listenerId = $this->getListenerId();
$listener = new ChildDefinition($listenerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function getKey()
return 'json-login-ldap';
}

protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId)
protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId)
{
$provider = 'security.authentication.provider.ldap_bind.'.$id;
$definition = $container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class RememberMeFactory implements SecurityFactoryInterface
'remember_me_parameter' => '_remember_me',
];

public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
public function create(ContainerBuilder $container, string $id, array $config, ?string $userProvider, ?string $defaultEntryPoint)
{
// authentication provider
$authProviderId = 'security.authentication.provider.rememberme.'.$id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class RemoteUserFactory implements SecurityFactoryInterface
{
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint)
{
$providerId = 'security.authentication.provider.pre_authenticated.'.$id;
$container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@ interface SecurityFactoryInterface
/**
* Configures the container services required to use the authentication listener.
*
* @param ContainerBuilder $container
* @param string $id The unique id of the firewall
* @param array $config The options array for the listener
* @param string $userProvider The service id of the user provider
* @param string $defaultEntryPoint
*
* @return array containing three values:
* - the provider id
* - the listener id
* - the entry point id
*/
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint);
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint);

/**
* Defines the position at which the provider is called.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class X509Factory implements SecurityFactoryInterface
{
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint)
{
$providerId = 'security.authentication.provider.pre_authenticated.'.$id;
$container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class InMemoryFactory implements UserProviderFactoryInterface
{
public function create(ContainerBuilder $container, $id, $config)
public function create(ContainerBuilder $container, string $id, array $config)
{
$definition = $container->setDefinition($id, new ChildDefinition('security.user.provider.in_memory'));
$defaultPassword = new Parameter('container.build_id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class LdapFactory implements UserProviderFactoryInterface
{
public function create(ContainerBuilder $container, $id, $config)
public function create(ContainerBuilder $container, string $id, array $config)
{
$container
->setDefinition($id, new ChildDefinition('security.user.provider.ldap'))
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Bundle/SecurityBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ext-xml": "*",
"symfony/config": "^4.4|^5.0",
"symfony/dependency-injection": "^4.4|^5.0",
"symfony/http-kernel": "^4.4|^5.0",
"symfony/http-kernel": "^5.0",
"symfony/security-core": "^4.4|^5.0",
"symfony/security-csrf": "^4.4|^5.0",
"symfony/security-guard": "^4.4|^5.0",
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.