Skip to content

Commit 7a6cd9d

Browse files
committed
PHPStan level 4
1 parent ea9fbd6 commit 7a6cd9d

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Changed
1616
* Updated `symfony/phpunit-bridge` to `6.0` by @franmomu [#2067](https://github.com/ruflin/Elastica/pull/2067)
1717
* Updated `php-cs-fixer` to `3.8.0` [#2074](https://github.com/ruflin/Elastica/pull/2074)
18+
* Increased `PHPStan` level to `4` [#2080](https://github.com/ruflin/Elastica/pull/2080)
1819
### Deprecated
1920
* Deprecated `Elastica\Reindex::WAIT_FOR_COMPLETION_FALSE`, use a boolean as parameter instead by @franmomu [#2070](https://github.com/ruflin/Elastica/pull/2070)
2021
* Passing anything else than a boolean as 1st argument to `Reindex::setWaitForCompletion`, pass a boolean instead by @franmomu [#2070](https://github.com/ruflin/Elastica/pull/2070)

phpstan-baseline.neon

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,31 @@ parameters:
7575
count: 1
7676
path: tests/DocumentTest.php
7777

78+
-
79+
message: "#^Dead catch \\- Elastica\\\\Exception\\\\InvalidException is never thrown in the try block\\.$#"
80+
count: 1
81+
path: tests/DocumentTest.php
82+
83+
-
84+
message: "#^Expression \"\\$document\\-\\>field5\" on a separate line does not do anything\\.$#"
85+
count: 1
86+
path: tests/DocumentTest.php
87+
88+
-
89+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
90+
count: 1
91+
path: tests/DocumentTest.php
92+
93+
-
94+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
95+
count: 1
96+
path: tests/IndexTest.php
97+
98+
-
99+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
100+
count: 2
101+
path: tests/Multi/SearchTest.php
102+
78103
-
79104
message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#"
80105
count: 2
@@ -95,6 +120,16 @@ parameters:
95120
count: 1
96121
path: tests/QueryBuilderTest.php
97122

123+
-
124+
message: "#^Expression \"\\$index\\-\\>search\\('elastica search'\\)\\[3\\]\" on a separate line does not do anything\\.$#"
125+
count: 1
126+
path: tests/ResultSetTest.php
127+
128+
-
129+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
130+
count: 1
131+
path: tests/SnapshotTest.php
132+
98133
-
99134
message: "#^Call to an undefined method GuzzleHttp\\\\Exception\\\\TransferException\\:\\:getRequest\\(\\)\\.$#"
100135
count: 6

phpstan.neon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ includes:
33
- phpstan-baseline.neon
44

55
parameters:
6-
level: 3
6+
level: 4
77
paths:
88
- src
99
- tests
1010
excludePaths:
1111
- src/Transport/HttpAdapter.php
1212
- src/Query/Match.php
13+
treatPhpDocTypesAsCertain: false
1314
ignoreErrors:
1415
# we don't have different constructors for parent/child
1516
- '~^Unsafe usage of new static\(\)\.$~'

tests/Collapse/CollapseTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ public function testSetInnerHitsOverridesExistingValue(): void
112112
$collapse->setInnerHits($innerHits1);
113113
$collapse->addInnerHits($innerHits2);
114114

115-
$this->assertCount(2, $collapse->getParam('inner_hits'));
116-
$this->assertIsArray($collapse->getParam('inner_hits'));
117-
$this->assertEquals($innerHits1, $collapse->getParam('inner_hits')[0]);
118-
$this->assertEquals($innerHits2, $collapse->getParam('inner_hits')[1]);
115+
$innerHits = $collapse->getParam('inner_hits');
116+
117+
$this->assertCount(2, $innerHits);
118+
$this->assertIsArray($innerHits);
119+
$this->assertEquals($innerHits1, $innerHits[0]);
120+
$this->assertEquals($innerHits2, $innerHits[1]);
119121

120122
$innerHitsOverride = new InnerHits();
121123
$innerHitsOverride->setName('override');

0 commit comments

Comments
 (0)