From c1d2b61df0e6adcbab2b5dd53bc8003ad09ea3da Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Mon, 6 Nov 2017 07:38:28 +0000 Subject: [PATCH] Apply fixes from StyleCI --- EventListener/FlashMessageSubscriber.php | 2 +- EventListener/UserContextSubscriber.php | 4 ++-- Tests/Functional/Fixtures/Session/TestSessionStorage.php | 2 +- Tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php | 4 ++-- UserContext/AnonymousRequestMatcher.php | 2 +- UserContext/RequestMatcher.php | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/EventListener/FlashMessageSubscriber.php b/EventListener/FlashMessageSubscriber.php index 4d79256e..ff36e47a 100644 --- a/EventListener/FlashMessageSubscriber.php +++ b/EventListener/FlashMessageSubscriber.php @@ -65,7 +65,7 @@ public static function getSubscribedEvents() */ public function onKernelResponse(FilterResponseEvent $event) { - if ($event->getRequestType() !== HttpKernel::MASTER_REQUEST) { + if (HttpKernel::MASTER_REQUEST !== $event->getRequestType()) { return; } diff --git a/EventListener/UserContextSubscriber.php b/EventListener/UserContextSubscriber.php index ebb31a7a..8a1fc3a9 100644 --- a/EventListener/UserContextSubscriber.php +++ b/EventListener/UserContextSubscriber.php @@ -100,7 +100,7 @@ public function __construct( */ public function onKernelRequest(GetResponseEvent $event) { - if ($event->getRequestType() != HttpKernelInterface::MASTER_REQUEST) { + if (HttpKernelInterface::MASTER_REQUEST != $event->getRequestType()) { return; } @@ -154,7 +154,7 @@ private function isAnonymous(Request $request) */ public function onKernelResponse(FilterResponseEvent $event) { - if ($event->getRequestType() != HttpKernelInterface::MASTER_REQUEST) { + if (HttpKernelInterface::MASTER_REQUEST != $event->getRequestType()) { return; } diff --git a/Tests/Functional/Fixtures/Session/TestSessionStorage.php b/Tests/Functional/Fixtures/Session/TestSessionStorage.php index 8e13fc28..fb91c596 100644 --- a/Tests/Functional/Fixtures/Session/TestSessionStorage.php +++ b/Tests/Functional/Fixtures/Session/TestSessionStorage.php @@ -105,7 +105,7 @@ public function getBag($name) */ public function registerBag(SessionBagInterface $bag) { - if ($bag->getName() == 'attributes') { + if ('attributes' == $bag->getName()) { $bag->set('_security_secured_area', serialize(new UsernamePasswordToken('user', 'user', 'in_memory', array('ROLE_USER')))); } diff --git a/Tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php b/Tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php index a27f51cf..386d304d 100644 --- a/Tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php +++ b/Tests/Unit/DependencyInjection/FOSHttpCacheExtensionTest.php @@ -401,7 +401,7 @@ private function assertMatcherCreated(ContainerBuilder $container, array $attrib $matcherId = null; foreach ($container->getDefinitions() as $id => $definition) { if ($definition instanceof DefinitionDecorator && - $definition->getParent() === 'fos_http_cache.request_matcher' + 'fos_http_cache.request_matcher' === $definition->getParent() ) { if ($matcherDefinition) { $this->fail('More then one request matcher was created'); @@ -420,7 +420,7 @@ private function assertMatcherCreated(ContainerBuilder $container, array $attrib $ruleDefinition = null; foreach ($container->getDefinitions() as $definition) { if ($definition instanceof DefinitionDecorator && - $definition->getParent() === 'fos_http_cache.rule_matcher' + 'fos_http_cache.rule_matcher' === $definition->getParent() ) { if ($ruleDefinition) { $this->fail('More then one rule matcher was created'); diff --git a/UserContext/AnonymousRequestMatcher.php b/UserContext/AnonymousRequestMatcher.php index 4d251b17..b5dc8a35 100644 --- a/UserContext/AnonymousRequestMatcher.php +++ b/UserContext/AnonymousRequestMatcher.php @@ -33,7 +33,7 @@ public function matches(Request $request) { foreach ($this->userIdentifierHeaders as $header) { if ($request->headers->has($header)) { - if (strtolower($header) === 'cookie' && 0 === $request->cookies->count()) { + if ('cookie' === strtolower($header) && 0 === $request->cookies->count()) { // ignore empty cookie header continue; } diff --git a/UserContext/RequestMatcher.php b/UserContext/RequestMatcher.php index 2e3f069e..10d055fe 100644 --- a/UserContext/RequestMatcher.php +++ b/UserContext/RequestMatcher.php @@ -31,11 +31,11 @@ public function __construct($accept = 'application/vnd.fos.user-context-hash', $ */ public function matches(Request $request) { - if ($this->accept !== null && $this->accept != $request->headers->get('accept', null)) { + if (null !== $this->accept && $this->accept != $request->headers->get('accept', null)) { return false; } - if ($this->method !== null && $this->method != $request->getMethod()) { + if (null !== $this->method && $this->method != $request->getMethod()) { return false; }