From 6e0794962ac5eeab97798ad7607b91b4633bdca8 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle <patrizio@bekerle.com> Date: Thu, 18 Nov 2021 11:24:42 +0100 Subject: [PATCH] Fix linter errors --- src/API/LDAPApiProviderInterface.php | 8 -------- src/DependencyInjection/Configuration.php | 9 +++++++-- src/Service/DummyLDAPApiProvider.php | 3 ++- src/Service/LDAPApi.php | 3 +-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/API/LDAPApiProviderInterface.php b/src/API/LDAPApiProviderInterface.php index 29cd264..396c226 100644 --- a/src/API/LDAPApiProviderInterface.php +++ b/src/API/LDAPApiProviderInterface.php @@ -10,19 +10,11 @@ interface LDAPApiProviderInterface { /** * Allows manipulation of the person with a hash array of $attributes at the end of "personFromUserItem". - * - * @param array $attributes - * @param Person $person - * @param bool $full */ public function personFromUserItemPostHook(array $attributes, Person $person, bool $full = false); /** * Allows to fetch a person for a services by service id. - * - * @param string $service - * @param string $serviceID - * @return Person */ public function getPersonForExternalServiceHook(string $service, string $serviceID): Person; } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index c028728..4cac8a9 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Dbp\Relay\LdapPersonProviderBundle\DependencyInjection; +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -19,7 +20,11 @@ class Configuration implements ConfigurationInterface ->scalarNode('person_cache_path')->end() ->scalarNode('ldap_cache_path')->end() ->end(); - $treeBuilder->getRootNode()->append($cacheNode); + + /** @var ArrayNodeDefinition $rootNode */ + $rootNode = $treeBuilder->getRootNode(); + + $rootNode->append($cacheNode); $ldapBuilder = new TreeBuilder('ldap'); $ldapNode = $ldapBuilder->getRootNode() @@ -41,7 +46,7 @@ class Configuration implements ConfigurationInterface ->end(); $ldapNode->append($attributesNode); - $treeBuilder->getRootNode()->append($ldapNode); + $rootNode->append($ldapNode); return $treeBuilder; } diff --git a/src/Service/DummyLDAPApiProvider.php b/src/Service/DummyLDAPApiProvider.php index 2733138..4ed67b1 100644 --- a/src/Service/DummyLDAPApiProvider.php +++ b/src/Service/DummyLDAPApiProvider.php @@ -21,7 +21,8 @@ class DummyLDAPApiProvider implements LDAPApiProviderInterface // $person->setBirthDate($birthDate); } - public function getPersonForExternalServiceHook(string $service, string $serviceID): Person { + public function getPersonForExternalServiceHook(string $service, string $serviceID): Person + { // For example, you can use the service and serviceID to get the person from some other service. // if ($service === 'SOME-SERVICE') { diff --git a/src/Service/LDAPApi.php b/src/Service/LDAPApi.php index 075855e..8caed5a 100644 --- a/src/Service/LDAPApi.php +++ b/src/Service/LDAPApi.php @@ -23,7 +23,6 @@ use Psr\Cache\CacheItemPoolInterface; use Psr\Container\ContainerInterface; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; -use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Psr16Cache; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\HttpFoundation\Response; @@ -267,7 +266,7 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface // Remove all value with numeric keys $attributes = []; - foreach($user->getAttributes() as $key => $value) { + foreach ($user->getAttributes() as $key => $value) { if (!is_numeric($key)) { $attributes[$key] = $value; } -- GitLab