Skip to content

Commit

Permalink
Merge pull request #3060 from stof/fix_more_deprecations
Browse files Browse the repository at this point in the history
Fix more deprecations
  • Loading branch information
stof authored Jul 6, 2023
2 parents 627efd4 + c397959 commit de68488
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/CheckForSessionPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class CheckForSessionPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if ($container->hasParameter('fos_user.session_needed') && !$container->has('session.storage.factory') && !$container->has('session')) {
$message = 'FOSUserBundle requires the "session" to be available for the enabled features.';
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/CheckForSwiftMailerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class CheckForSwiftMailerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
// if the mailer isn't needed, then no error needed
if (!$container->has('fos_user.mailer')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class ConfigurePasswordHasherPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if ($container->has('security.password_hasher_factory')) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class InjectRememberMeServicesPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
$firewallName = $container->getParameter('fos_user.firewall_name');
$loginManager = $container->getDefinition('fos_user.security.login_manager');
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/InjectUserCheckerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class InjectUserCheckerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
$firewallName = $container->getParameter('fos_user.firewall_name');
$loginManager = $container->findDefinition('fos_user.security.login_manager');
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/ValidationPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class ValidationPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasParameter('fos_user.storage')) {
return;
Expand Down
9 changes: 5 additions & 4 deletions DependencyInjection/FOSUserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class FOSUserExtension extends Extension
private static $doctrineDrivers = [
'orm' => [
'registry' => 'doctrine',
'tag' => 'doctrine.event_subscriber',
'tag' => 'doctrine.event_listener',
],
'mongodb' => [
'registry' => 'doctrine_mongodb',
'tag' => 'doctrine_mongodb.odm.event_subscriber',
'tag' => 'doctrine_mongodb.odm.event_listener',
],
'couchdb' => [
'registry' => 'doctrine_couchdb',
'tag' => 'doctrine_couchdb.event_subscriber',
'tag' => 'doctrine_couchdb.event_listener',
'listener_class' => 'FOS\UserBundle\Doctrine\CouchDB\UserListener',
],
];
Expand Down Expand Up @@ -97,7 +97,8 @@ public function load(array $configs, ContainerBuilder $container): void

if ($config['use_listener'] && isset(self::$doctrineDrivers[$config['db_driver']])) {
$listenerDefinition = $container->getDefinition('fos_user.user_listener');
$listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag']);
$listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag'], ['event' => 'prePersist']);
$listenerDefinition->addTag(self::$doctrineDrivers[$config['db_driver']]['tag'], ['event' => 'preUpdate']);
if (isset(self::$doctrineDrivers[$config['db_driver']]['listener_class'])) {
$listenerDefinition->setClass(self::$doctrineDrivers[$config['db_driver']]['listener_class']);
}
Expand Down
4 changes: 2 additions & 2 deletions FOSUserBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class FOSUserBundle extends Bundle
{
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new ConfigurePasswordHasherPass());
Expand All @@ -44,7 +44,7 @@ public function build(ContainerBuilder $container)
$this->addRegisterMappingsPass($container);
}

private function addRegisterMappingsPass(ContainerBuilder $container)
private function addRegisterMappingsPass(ContainerBuilder $container): void
{
$mappings = [
realpath(__DIR__.'/Resources/config/doctrine-mapping') => 'FOS\UserBundle\Model',
Expand Down
2 changes: 1 addition & 1 deletion Validator/Initializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(CanonicalFieldsUpdater $canonicalFieldsUpdater)
/**
* @param object $object
*/
public function initialize($object)
public function initialize($object): void
{
if ($object instanceof UserInterface) {
$this->canonicalFieldsUpdater->updateCanonicalFields($object);
Expand Down

0 comments on commit de68488

Please sign in to comment.