Skip to content

Commit fb7b473

Browse files
gmponosdbu
authored andcommitted
Declare strict types (#375)
* Enable strict rule and allow risky rules * Added phpunit cache to gitignore * Fix codestyle issues
1 parent 297bf2f commit fb7b473

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+109
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/.phpunit.result.cache
12
/.php_cs.cache
23
/behat.yml
34
/build/

.php_cs.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ $finder = PhpCsFixer\Finder::create()
77
;
88

99
return PhpCsFixer\Config::create()
10+
->setRiskyAllowed(true)
1011
->setRules([
1112
'@Symfony' => true,
1213
'array_syntax' => ['syntax' => 'short'],
14+
'declare_strict_types' => true,
1315
'visibility_required' => [
1416
'elements' => [
1517
'const',

src/ClientFactory/AutoDiscoveryFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Http\Discovery\HttpClientDiscovery;

src/ClientFactory/BuzzFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Buzz\Client\FileGetContents;

src/ClientFactory/ClientFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Http\Client\HttpClient;

src/ClientFactory/CurlFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Http\Client\Curl\Client;

src/ClientFactory/DummyClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
@trigger_error('The '.__NAMESPACE__.'\DummyClient interface is deprecated since version 1.7 and will be removed in 2.0.', E_USER_DEPRECATED);

src/ClientFactory/Guzzle5Factory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use GuzzleHttp\Client;

src/ClientFactory/Guzzle6Factory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Http\Adapter\Guzzle6\Client;

src/ClientFactory/MockFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Http\Client\HttpClient;

src/ClientFactory/PluginClientFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
@trigger_error('The '.__NAMESPACE__.'\PluginClientFactory class is deprecated since version 1.8 and will be removed in 2.0. Use Http\Client\Common\PluginClientFactory instead.', E_USER_DEPRECATED);

src/ClientFactory/ReactFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Http\Adapter\React\Client;

src/ClientFactory/SocketFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Http\Client\Socket\Client;

src/ClientFactory/SymfonyFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\ClientFactory;
46

57
use Psr\Http\Message\ResponseFactoryInterface;

src/Collector/Collector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
use Symfony\Component\HttpFoundation\Request;

src/Collector/Formatter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
use Exception;

src/Collector/PluginClientFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
use Http\Client\Common\Plugin;

src/Collector/PluginClientFactoryListener.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
use Http\Client\Common\PluginClientFactory as DefaultPluginClientFactory;

src/Collector/Profile.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
/**

src/Collector/ProfileClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
use Http\Client\Common\FlexibleHttpClient;

src/Collector/ProfileClientFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
use Http\Client\Common\FlexibleHttpClient;

src/Collector/ProfilePlugin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
use Exception;

src/Collector/Stack.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
/**

src/Collector/StackPlugin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector;
46

57
use Exception;

src/Collector/Twig/HttpMessageMarkupExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Collector\Twig;
46

57
use Twig\Extension\AbstractExtension;

src/DependencyInjection/Configuration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\DependencyInjection;
46

57
use Http\Client\Common\Plugin\Cache\Generator\CacheKeyGenerator;

src/DependencyInjection/HttplugExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\DependencyInjection;
46

57
use Http\Client\Common\BatchClient;

src/Discovery/ConfiguredClientsStrategy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Discovery;
46

57
use Http\Client\HttpClient;

src/HttplugBundle.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle;
46

57
use Symfony\Component\HttpKernel\Bundle\Bundle;

tests/Functional/DiscoveredClientsTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Functional;
46

57
use Http\Client\HttpAsyncClient;
@@ -11,9 +13,9 @@
1113
use Http\HttplugBundle\Discovery\ConfiguredClientsStrategy;
1214
use Nyholm\NSA;
1315
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
16+
use Symfony\Component\EventDispatcher\Event as LegacyEvent;
1417
use Symfony\Component\HttpKernel\Kernel;
1518
use Symfony\Contracts\EventDispatcher\Event;
16-
use Symfony\Component\EventDispatcher\Event as LegacyEvent;
1719

1820
class DiscoveredClientsTest extends WebTestCase
1921
{

tests/Functional/DiscoveryTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\DependencyInjection\Compiler;
46

7+
use Http\Adapter\Guzzle6\Client;
58
use Http\Client\HttpAsyncClient;
69
use Http\Client\HttpClient;
710
use Http\Discovery\HttpClientDiscovery;
@@ -13,7 +16,6 @@
1316
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\ContainerBuilderHasAliasConstraint;
1417
use PHPUnit\Framework\Constraint\LogicalNot;
1518
use Symfony\Component\DependencyInjection\Definition;
16-
use Http\Adapter\Guzzle6\Client;
1719

1820
/**
1921
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>

tests/Functional/ProfilerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Functional;
46

57
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

tests/Functional/ProfilingTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Functional;
46

57
use GuzzleHttp\Psr7\Request;

tests/Functional/ServiceInstantiationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Functional;
46

57
use GuzzleHttp\Psr7\Request as GuzzleRequest;

tests/Unit/ClientFactory/BuzzFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
46

57
use Http\Adapter\Buzz\Client;

tests/Unit/ClientFactory/CurlFactoryTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
46

5-
use Http\HttplugBundle\ClientFactory\CurlFactory;
67
use Http\Client\Curl\Client;
8+
use Http\HttplugBundle\ClientFactory\CurlFactory;
79
use PHPUnit\Framework\TestCase;
810
use Psr\Http\Message\ResponseFactoryInterface;
911
use Psr\Http\Message\StreamFactoryInterface;

tests/Unit/ClientFactory/Guzzle6FactoryTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
46

5-
use Http\HttplugBundle\ClientFactory\Guzzle6Factory;
67
use Http\Adapter\Guzzle6\Client;
8+
use Http\HttplugBundle\ClientFactory\Guzzle6Factory;
79
use PHPUnit\Framework\TestCase;
810

911
/**

tests/Unit/ClientFactory/MockFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* This file is part of the HttplugBundle package.
46
*

tests/Unit/ClientFactory/ReactFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
46

57
use Http\Adapter\React\Client;

tests/Unit/ClientFactory/SocketFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
46

57
use Http\Client\Socket\Client;

tests/Unit/ClientFactory/SymfonyFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
46

57
use Http\HttplugBundle\ClientFactory\SymfonyFactory;

tests/Unit/Collector/CollectorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\Collector;
46

57
use Http\HttplugBundle\Collector\Collector;

tests/Unit/Collector/FormatterTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\Collector;
46

57
use GuzzleHttp\Psr7\Request;

tests/Unit/Collector/PluginClientFactoryListenerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\Collector;
46

57
use Http\Client\Common\PluginClientFactory as DefaultPluginClientFactory;

tests/Unit/Collector/ProfileClientFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\Collector;
46

57
use Http\Client\HttpClient;

tests/Unit/Collector/ProfileClientTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Http\HttplugBundle\Tests\Unit\Collector;
46

57
use GuzzleHttp\Psr7\Request;

0 commit comments

Comments
 (0)