Skip to content

Commit baadcd4

Browse files
authored
Apply fixes from StyleCI (#222)
1 parent 667ffc5 commit baadcd4

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

Collector/Collector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getName()
6262
*/
6363
public function activateStack(Stack $stack)
6464
{
65-
if ($this->activeStack !== null) {
65+
if (null !== $this->activeStack) {
6666
$stack->setParent($this->activeStack);
6767
}
6868

@@ -141,7 +141,7 @@ public function getFailedStacks()
141141
public function getClients()
142142
{
143143
$stacks = array_filter($this->data['stacks'], function (Stack $stack) {
144-
return $stack->getParent() === null;
144+
return null === $stack->getParent();
145145
});
146146

147147
return array_unique(array_map(function (Stack $stack) {
@@ -157,7 +157,7 @@ public function getClients()
157157
public function getClientRootStacks($client)
158158
{
159159
return array_filter($this->data['stacks'], function (Stack $stack) use ($client) {
160-
return $stack->getClient() == $client && $stack->getParent() == null;
160+
return $stack->getClient() == $client && null == $stack->getParent();
161161
});
162162
}
163163

Collector/ProfileClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function sendAsyncRequest(RequestInterface $request)
7777
{
7878
$activateStack = true;
7979
$stack = $this->collector->getActiveStack();
80-
if ($stack === null) {
80+
if (null === $stack) {
8181
//When using a discovered client not wrapped in a PluginClient, we don't have a stack from StackPlugin. So
8282
//we create our own stack and activate it!
8383
$stack = new Stack('Default', $this->formatter->formatRequest($request));
@@ -120,7 +120,7 @@ public function sendAsyncRequest(RequestInterface $request)
120120
public function sendRequest(RequestInterface $request)
121121
{
122122
$stack = $this->collector->getActiveStack();
123-
if ($stack === null) {
123+
if (null === $stack) {
124124
//When using a discovered client not wrapped in a PluginClient, we don't have a stack from StackPlugin. So
125125
//we create our own stack but don't activate it.
126126
$stack = new Stack('Default', $this->formatter->formatRequest($request));

Collector/Stack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function getParent()
120120
/**
121121
* @param Stack $parent
122122
*/
123-
public function setParent(Stack $parent)
123+
public function setParent(self $parent)
124124
{
125125
$this->parent = $parent;
126126
}

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private function configureClients(ArrayNodeDefinition $root)
175175
->end()
176176
->validate()
177177
->ifTrue(function ($config) {
178-
return $config['factory'] === 'httplug.factory.auto' && !empty($config['config']);
178+
return 'httplug.factory.auto' === $config['factory'] && !empty($config['config']);
179179
})
180180
->thenInvalid('If you want to use the "config" key you must also specify a valid "factory".')
181181
->end()

DependencyInjection/HttplugExtension.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function configureClients(ContainerBuilder $container, array $config)
8989
$clients = [];
9090

9191
foreach ($config['clients'] as $name => $arguments) {
92-
if ($first === null) {
92+
if (null === $first) {
9393
// Save the name of the first configured client.
9494
$first = $name;
9595
}
@@ -99,7 +99,7 @@ private function configureClients(ContainerBuilder $container, array $config)
9999
}
100100

101101
// If we have clients configured
102-
if ($first !== null) {
102+
if (null !== $first) {
103103
// If we do not have a client named 'default'
104104
if (!isset($config['clients']['default'])) {
105105
// Alias the first client to httplug.client.default
@@ -153,6 +153,7 @@ private function configurePluginByName($name, Definition $definition, array $con
153153
->replaceArgument(0, new Reference($config['cache_pool']))
154154
->replaceArgument(1, new Reference($config['stream_factory']))
155155
->replaceArgument(2, $options);
156+
156157
break;
157158
case 'cookie':
158159
$definition->replaceArgument(0, new Reference($config['cookie_jar']));
@@ -369,7 +370,7 @@ private function createUri(ContainerBuilder $container, $serviceId, $uri)
369370
private function configureAutoDiscoveryClients(ContainerBuilder $container, array $config)
370371
{
371372
$httpClient = $config['discovery']['client'];
372-
if ($httpClient !== 'auto') {
373+
if ('auto' !== $httpClient) {
373374
$container->removeDefinition('httplug.auto_discovery.auto_discovered_client');
374375
$container->removeDefinition('httplug.collector.auto_discovered_client');
375376

@@ -380,7 +381,7 @@ private function configureAutoDiscoveryClients(ContainerBuilder $container, arra
380381
}
381382

382383
$asyncHttpClient = $config['discovery']['async_client'];
383-
if ($asyncHttpClient !== 'auto') {
384+
if ('auto' !== $asyncHttpClient) {
384385
$container->removeDefinition('httplug.auto_discovery.auto_discovered_async');
385386
$container->removeDefinition('httplug.collector.auto_discovered_async');
386387

Discovery/ConfiguredClientsStrategy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public function __construct(HttpClient $httpClient = null, HttpAsyncClient $asyn
4343
*/
4444
public static function getCandidates($type)
4545
{
46-
if ($type === HttpClient::class && self::$client !== null) {
46+
if (HttpClient::class === $type && null !== self::$client) {
4747
return [['class' => function () {
4848
return self::$client;
4949
}]];
5050
}
5151

52-
if ($type === HttpAsyncClient::class && self::$asyncClient !== null) {
52+
if (HttpAsyncClient::class === $type && null !== self::$asyncClient) {
5353
return [['class' => function () {
5454
return self::$asyncClient;
5555
}]];

0 commit comments

Comments
 (0)