Skip to content

Commit c4e019b

Browse files
committed
refactor: set phpstan level to max
1 parent 5925fa6 commit c4e019b

37 files changed

+253
-176
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
->enable('ordered_imports')
3131
->enable('ordered_interfaces')
3232
->enable('phpdoc_line_span')
33+
->enable('PedroTroller/line_break_between_method_arguments', ['max-length' => 90])
3334
->disable('method_chaining_indentation')
3435
->disable('no_break_comment')
3536
->disable('no_superfluous_phpdoc_tags')

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 8
2+
level: max
33
paths:
44
- src
55
- spec/PHPSpec

rector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Rector\Config\RectorConfig;
66
use Rector\Core\ValueObject\PhpVersion;
77
use Rector\Set\ValueObject\LevelSetList;
8+
use Rector\Set\ValueObject\SetList;
89

910
return static function (RectorConfig $rectorConfig): void {
1011
$rectorConfig
@@ -25,6 +26,8 @@
2526
->sets(
2627
[
2728
LevelSetList::UP_TO_PHP_80,
29+
SetList::CODE_QUALITY,
30+
SetList::DEAD_CODE,
2831
]
2932
)
3033
;

spec/Knp/DictionaryBundle/DependencyInjection/Compiler/DictionaryBuildingPassSpec.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ function it_is_initializable()
2020
$this->shouldHaveType(DictionaryBuildingPass::class);
2121
}
2222

23-
function it_builds_a_value_as_key_dictionary_from_the_config(ContainerBuilder $container)
24-
{
23+
function it_builds_a_value_as_key_dictionary_from_the_config(
24+
ContainerBuilder $container
25+
) {
2526
$config = [
2627
'dictionaries' => [
2728
'dico1' => [
@@ -66,8 +67,9 @@ function it_builds_a_value_as_key_dictionary_from_the_config(ContainerBuilder $c
6667
$this->process($container);
6768
}
6869

69-
function it_builds_a_value_dictionary_from_the_config(ContainerBuilder $container)
70-
{
70+
function it_builds_a_value_dictionary_from_the_config(
71+
ContainerBuilder $container
72+
) {
7173
$config = [
7274
'dictionaries' => [
7375
'dico1' => [
@@ -109,8 +111,9 @@ function it_builds_a_value_dictionary_from_the_config(ContainerBuilder $containe
109111
$this->process($container);
110112
}
111113

112-
function it_builds_a_key_value_dictionary_from_the_config(ContainerBuilder $container)
113-
{
114+
function it_builds_a_key_value_dictionary_from_the_config(
115+
ContainerBuilder $container
116+
) {
114117
$config = [
115118
'dictionaries' => [
116119
'dico1' => [

spec/Knp/DictionaryBundle/Dictionary/CombinedSpec.php

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111

1212
final class CombinedSpec extends ObjectBehavior
1313
{
14-
function let(Dictionary $dictionary1, Dictionary $dictionary2, Dictionary $dictionary3)
15-
{
14+
function let(
15+
Dictionary $dictionary1,
16+
Dictionary $dictionary2,
17+
Dictionary $dictionary3
18+
) {
1619
$this->beConstructedWith(
1720
'combined_dictionary',
1821
$dictionary1,
@@ -31,8 +34,11 @@ function it_is_a_dictionary()
3134
$this->shouldImplement(Dictionary::class);
3235
}
3336

34-
function it_access_to_value_like_an_array($dictionary1, $dictionary2, $dictionary3)
35-
{
37+
function it_access_to_value_like_an_array(
38+
$dictionary1,
39+
$dictionary2,
40+
$dictionary3
41+
) {
3642
$dictionary1->getIterator()->willReturn(new ArrayIterator(['foo1' => 'foo10']));
3743

3844
$dictionary2->getIterator()->willReturn(new ArrayIterator(['bar1' => 'bar10']));
@@ -44,8 +50,11 @@ function it_access_to_value_like_an_array($dictionary1, $dictionary2, $dictionar
4450
$this['baz1']->shouldBe('baz10');
4551
}
4652

47-
function it_getvalues_should_return_dictionaries_values($dictionary1, $dictionary2, $dictionary3)
48-
{
53+
function it_getvalues_should_return_dictionaries_values(
54+
$dictionary1,
55+
$dictionary2,
56+
$dictionary3
57+
) {
4958
$dictionary1->getIterator()->willReturn(new ArrayIterator([
5059
'foo1' => 'foo10',
5160
'foo2' => 'foo20',
@@ -75,8 +84,11 @@ function it_getvalues_should_return_dictionaries_values($dictionary1, $dictionar
7584
]);
7685
}
7786

78-
function it_can_iterate_over_dictionaries($dictionary1, $dictionary2, $dictionary3)
79-
{
87+
function it_can_iterate_over_dictionaries(
88+
$dictionary1,
89+
$dictionary2,
90+
$dictionary3
91+
) {
8092
$dictionary1->getIterator()->willReturn(new ArrayIterator([
8193
'foo1' => 'foo10',
8294
'foo2' => 'foo20',
@@ -100,8 +112,11 @@ function it_can_iterate_over_dictionaries($dictionary1, $dictionary2, $dictionar
100112
]);
101113
}
102114

103-
function it_sums_the_count_of_elements($dictionary1, $dictionary2, $dictionary3)
104-
{
115+
function it_sums_the_count_of_elements(
116+
$dictionary1,
117+
$dictionary2,
118+
$dictionary3
119+
) {
105120
$dictionary1->getIterator()->willReturn(new ArrayIterator([
106121
'foo1' => 'foo10',
107122
]));

spec/Knp/DictionaryBundle/Dictionary/Factory/AggregateSpec.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ function it_is_a_factory()
2222
$this->shouldHaveType(Factory::class);
2323
}
2424

25-
function it_supports_if_one_factory_supports(Factory $factory1, Factory $factory2, Factory $factory3)
26-
{
25+
function it_supports_if_one_factory_supports(
26+
Factory $factory1,
27+
Factory $factory2,
28+
Factory $factory3
29+
) {
2730
$this->addFactory($factory1);
2831
$this->addFactory($factory2);
2932

spec/Knp/DictionaryBundle/Dictionary/Factory/CombinedSpec.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ function it_supports_specific_config()
3333
$this->supports(['type' => 'combined'])->shouldReturn(true);
3434
}
3535

36-
function it_creates_a_dictionary(Dictionary $dictionary1, Dictionary $dictionary2, Dictionary $dictionary3)
37-
{
36+
function it_creates_a_dictionary(
37+
Dictionary $dictionary1,
38+
Dictionary $dictionary2,
39+
Dictionary $dictionary3
40+
) {
3841
$dictionary1->getIterator()->willReturn(new ArrayIterator(['foo1' => 'foo10', 'foo2' => 'foo20']));
3942
$dictionary1->getName()->willReturn('dictionary1');
4043

spec/Knp/DictionaryBundle/Dictionary/Factory/ExtendedSpec.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ function it_supports_specific_config()
3333
$this->supports(['extends' => 'my_dictionary'])->shouldReturn(true);
3434
}
3535

36-
function it_creates_a_dictionary($factory, Dictionary $initialDictionary, Dictionary $extendsDictionary)
37-
{
36+
function it_creates_a_dictionary(
37+
$factory,
38+
Dictionary $initialDictionary,
39+
Dictionary $extendsDictionary
40+
) {
3841
$initialDictionary->getName()->willReturn('initial_dictionary');
3942
$initialDictionary->getIterator()->willReturn(new ArrayIterator(['foo1', 'foo2']));
4043

spec/Knp/DictionaryBundle/Dictionary/InvokableSpec.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ function it_access_to_value_like_an_array()
101101
$this['baz']->shouldReturn(2);
102102
}
103103

104-
function it_throws_an_exception_if_callable_returns_somthing_else_than_an_array_or_an_array_access($nothing)
105-
{
104+
function it_throws_an_exception_if_callable_returns_somthing_else_than_an_array_or_an_array_access(
105+
$nothing
106+
) {
106107
$this->beConstructedWith('foo', function (): void {
107108
});
108109

spec/PHPSpec/OneOfMatcher.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ protected function matches($subject, array $arguments): bool
3232
}
3333

3434
/**
35-
* @param mixed $subject
35+
* @param string $subject
3636
* @param mixed[] $arguments
3737
*/
38-
protected function getFailureException(string $name, $subject, array $arguments): FailureException
39-
{
40-
if (1 === \count($arguments) && \is_array(current($arguments))) {
38+
protected function getFailureException(
39+
string $name,
40+
$subject,
41+
array $arguments
42+
): FailureException {
43+
if ([] !== \count($arguments) && \is_array(current($arguments))) {
4144
$arguments = current($arguments);
4245
}
4346

@@ -51,12 +54,15 @@ protected function getFailureException(string $name, $subject, array $arguments)
5154
}
5255

5356
/**
54-
* @param mixed $subject
57+
* @param string $subject
5558
* @param mixed[] $arguments
5659
*/
57-
protected function getNegativeFailureException(string $name, $subject, array $arguments): FailureException
58-
{
59-
if (1 === \count($arguments) && \is_array(current($arguments))) {
60+
protected function getNegativeFailureException(
61+
string $name,
62+
$subject,
63+
array $arguments
64+
): FailureException {
65+
if ([] !== \count($arguments) && \is_array(current($arguments))) {
6066
$arguments = current($arguments);
6167
}
6268

0 commit comments

Comments
 (0)