From 022a1c85c18474ffac913359c0069b647098f8f9 Mon Sep 17 00:00:00 2001 From: Darwin Date: Wed, 1 Nov 2017 18:27:45 +0100 Subject: [PATCH] Deprecated classes & Symfony requirements --- Hydrator/HydrateWithMapTrait.php | 2 +- Ldap/LdapManager.php | 2 +- Security/Factory/FormLoginLdapFactory.php | 6 +++--- Security/Factory/HttpBasicLdapFactory.php | 8 ++++---- composer.json | 16 ++++++++-------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Hydrator/HydrateWithMapTrait.php b/Hydrator/HydrateWithMapTrait.php index ed9e76c..4a795a8 100644 --- a/Hydrator/HydrateWithMapTrait.php +++ b/Hydrator/HydrateWithMapTrait.php @@ -37,7 +37,7 @@ protected function hydrateUserWithAttributesMap( unset($ldapValue['count']); } - if (count($ldapValue) === 1) { + if (1 === count($ldapValue)) { $value = array_shift($ldapValue); } else { $value = $ldapValue; diff --git a/Ldap/LdapManager.php b/Ldap/LdapManager.php index 665c29f..fa47f89 100644 --- a/Ldap/LdapManager.php +++ b/Ldap/LdapManager.php @@ -94,7 +94,7 @@ public function findUserBy(array $criteria) throw new \Exception('This search can only return a single user'); } - if ($entries['count'] == 0) { + if (0 == $entries['count']) { return null; } $user = $this->hydrator->hydrate($entries[0]); diff --git a/Security/Factory/FormLoginLdapFactory.php b/Security/Factory/FormLoginLdapFactory.php index fcba9a1..339f604 100644 --- a/Security/Factory/FormLoginLdapFactory.php +++ b/Security/Factory/FormLoginLdapFactory.php @@ -4,8 +4,8 @@ use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Reference; /** @@ -50,7 +50,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $userPro $providerId = $provider.'.'.$id; $container - ->setDefinition($providerId, new DefinitionDecorator($provider)) + ->setDefinition($providerId, new ChildDefinition($provider)) ->replaceArgument(1, $id) // Provider Key ->replaceArgument(2, new Reference($userProviderId)) // User Provider ; @@ -62,7 +62,7 @@ protected function createListener(ContainerBuilder $container, $id, $config) { $listenerId = 'security.authentication.listener.form'; - $listener = new DefinitionDecorator($listenerId); + $listener = new ChildDefinition($listenerId); $listener->replaceArgument(4, $id); $listener->replaceArgument(5, $config); diff --git a/Security/Factory/HttpBasicLdapFactory.php b/Security/Factory/HttpBasicLdapFactory.php index 3842150..005ca28 100644 --- a/Security/Factory/HttpBasicLdapFactory.php +++ b/Security/Factory/HttpBasicLdapFactory.php @@ -5,7 +5,7 @@ use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\DefinitionDecorator; +use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\Reference; /** @@ -58,7 +58,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $userPro $providerId = $provider.'.'.$id; $container - ->setDefinition($providerId, new DefinitionDecorator($provider)) + ->setDefinition($providerId, new ChildDefinition($provider)) ->replaceArgument(1, $id) // Provider Key ->replaceArgument(2, new Reference($userProviderId)) // User Provider ; @@ -70,7 +70,7 @@ protected function createListener(ContainerBuilder $container, $id, $entryPointI { // listener $listenerId = 'security.authentication.listener.basic.'.$id; - $listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.authentication.listener.basic')); + $listener = $container->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.basic')); $listener->replaceArgument(2, $id); $listener->replaceArgument(3, new Reference($entryPointId)); @@ -85,7 +85,7 @@ protected function createEntryPoint(ContainerBuilder $container, $id, $config, $ $entryPointId = 'security.authentication.basic_entry_point.'.$id; $container - ->setDefinition($entryPointId, new DefinitionDecorator('security.authentication.basic_entry_point')) + ->setDefinition($entryPointId, new ChildDefinition('security.authentication.basic_entry_point')) ->addArgument($config['realm']) ; diff --git a/composer.json b/composer.json index 3d246d2..192ad36 100644 --- a/composer.json +++ b/composer.json @@ -17,20 +17,20 @@ "require": { "php": ">=5.5", "psr/log": "~1.0", - "symfony/config": "2.3 - 3", - "symfony/dependency-injection": "2.3 - 3", - "symfony/polyfill-php56": "^1.1", - "symfony/security": "2.3 - 3", - "symfony/security-bundle": "2.3 - 3", - "zendframework/zend-ldap": "2.5 - 3" + "symfony/config": "2.3 - 4", + "symfony/dependency-injection": "2.3 - 4", + "symfony/polyfill-php56": "^1.6", + "symfony/security": "2.3 - 4", + "symfony/security-bundle": "2.3 - 4", + "zendframework/zend-ldap": "2.5 - 4" }, "require-dev": { "friendsofphp/php-cs-fixer": "@stable", "fr3d/psr3-message-assertions": "0.1.*", - "friendsofsymfony/user-bundle": "~1.3", + "friendsofsymfony/user-bundle": "~2.0", "maks3w/phpunit-methods-trait": "^4.6", "phpunit/phpunit": "^4.6", - "symfony/validator": "2.3 - 3" + "symfony/validator": "2.3 - 4" }, "suggest": { "symfony/validator": "Allow pre-validate for existing users before register new ones",