File tree Expand file tree Collapse file tree 8 files changed +44
-6
lines changed Expand file tree Collapse file tree 8 files changed +44
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## [ 3.0.0-rc3] - 2023-04-17
8
+
9
+ ### Fixed
10
+ - Fatal error when analyzing snippets like ` $a->{$b} ` or ` $a->{<some_expression>} ` .
11
+ - Fatal error when analyzing snippets like ` $a->{$b}() ` or ` $a->{<some_expression>}() ` .
12
+
13
+ ### Updates
14
+ - Update to PHPUnit 10.1
15
+
7
16
## [ 3.0.0-rc2] - 2023-04-17
8
17
9
18
### New features
Original file line number Diff line number Diff line change 33
33
},
34
34
"require-dev" : {
35
35
"phake/phake" : " ^4.4.0" ,
36
- "phpstan/extension-installer" : " ^1.2 " ,
36
+ "phpstan/extension-installer" : " ^1.3 " ,
37
37
"phpstan/phpstan" : " ^1.10" ,
38
38
"phpstan/phpstan-deprecation-rules" : " ^1.1" ,
39
39
"phpstan/phpstan-phpunit" : " ^1.3" ,
40
40
"phpstan/phpstan-strict-rules" : " ^1.5" ,
41
- "phpunit/phpunit" : " ^10.0 " ,
41
+ "phpunit/phpunit" : " ^10.1 " ,
42
42
"sebastian/comparator" : " >=5.0.0" ,
43
43
"squizlabs/php_codesniffer" : " ^3.7" ,
44
44
"symfony/dom-crawler" : " ^6.2" ,
Original file line number Diff line number Diff line change 24
24
</testsuite >
25
25
</testsuites >
26
26
27
- <coverage >
27
+ <source >
28
28
<include >
29
29
<directory suffix =" .php" >../src</directory >
30
30
</include >
31
-
31
+ </source >
32
+ <coverage >
32
33
<report >
33
34
<html outputDirectory =" reports/phpunit/coverage-html/" />
34
35
<xml outputDirectory =" reports/phpunit/coverage-xml/" />
Original file line number Diff line number Diff line change @@ -55,7 +55,6 @@ public function readJson(string $path): mixed
55
55
/**
56
56
* {@inheritDoc}
57
57
* @throws JsonException
58
- * @codeCoverageIgnore Cannot be tested as file_get_contents is calling a URI, and we cannot fake its results.
59
58
* @infection-ignore-all Cannot be tested as file_get_contents is calling a URI, and we cannot fake its results.
60
59
*/
61
60
public function httpReadJson (string $ uri ): stdClass
Original file line number Diff line number Diff line change 62
62
* This class is the technical entrypoint and thus, can't be unit tested.
63
63
* The behavior of this class is tested via functional tests.
64
64
*
65
- * @codeCoverageIgnore Technical class that can only be tested functionally.
66
65
* @infection-ignore-all Technical class that can only be tested functionally.
67
66
*/
68
67
final class DependencyInjectionProcessor
Original file line number Diff line number Diff line change 14
14
use PhpParser \Node ;
15
15
use PhpParser \Node \Stmt ;
16
16
use PhpParser \NodeVisitorAbstract ;
17
+ use Stringable ;
17
18
use function array_filter ;
18
19
use function array_map ;
19
20
use function in_array ;
21
+ use function is_string ;
20
22
use function property_exists ;
21
23
22
24
/**
@@ -198,6 +200,8 @@ private function getPropertyFetchTreeNodes(Node $node): array
198
200
&& property_exists ($ node ->var , 'name ' )
199
201
&& !($ node ->var ->name instanceof Node \Expr \Variable) // Prevents failure when $a->$b.
200
202
&& 'this ' === (string )$ node ->var ->name
203
+ // Prevents failures when $a->{$name} or $a->{<expr>}
204
+ && (is_string ($ node ->name ) || $ node ->name instanceof Stringable)
201
205
) {
202
206
return [$ this ->graph ->gather ((string )$ node ->name )];
203
207
}
@@ -219,6 +223,8 @@ private function getMethodCallTreeNodes(Node $node): array
219
223
&& property_exists ($ node ->var , 'name ' )
220
224
&& !($ node ->var ->name instanceof Node \Expr \Variable) // Prevents failure when $a->$b(), or $c().
221
225
&& 'this ' === (string )$ node ->var ->name
226
+ // Prevents failures when $a->{$name}() or $a->{<expr>}()
227
+ && (is_string ($ node ->name ) || $ node ->name instanceof Stringable)
222
228
) {
223
229
return [$ this ->graph ->gather ($ node ->name . '() ' )];
224
230
}
Original file line number Diff line number Diff line change 5
5
6
6
use Hal \Component \File \Reader ;
7
7
use JsonException ;
8
+ use PHPUnit \Framework \Attributes \IgnoreMethodForCodeCoverage ;
8
9
use PHPUnit \Framework \TestCase ;
9
10
use function chmod ;
10
11
use function file_put_contents ;
11
12
use function touch ;
12
13
14
+ // Cannot be tested as file_get_contents is calling a URI, and we cannot fake its results.
15
+ #[IgnoreMethodForCodeCoverage(Reader::class, 'httpReadJson ' )]
13
16
final class ReaderTest extends TestCase
14
17
{
15
18
use TraitTestSystem;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ declare (strict_types=1 );
3
+
4
+ namespace Tests \Hal \DependencyInjection ;
5
+
6
+ use Hal \DependencyInjection \DependencyInjectionProcessor ;
7
+ use PHPUnit \Framework \Attributes \DoesNotPerformAssertions ;
8
+ use PHPUnit \Framework \Attributes \IgnoreClassForCodeCoverage ;
9
+ use PHPUnit \Framework \TestCase ;
10
+
11
+ /**
12
+ * Ignores DependencyInjectionProcessor::class because this is a technical class that can only be tested functionally.
13
+ */
14
+ #[DoesNotPerformAssertions]
15
+ #[IgnoreClassForCodeCoverage(DependencyInjectionProcessor::class)]
16
+ final class DependencyInjectionProcessorTest extends TestCase
17
+ {
18
+ public function test (): void
19
+ {
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments