File tree 3 files changed +5
-14
lines changed
3 files changed +5
-14
lines changed Original file line number Diff line number Diff line change 4
4
.idea /
5
5
.phpunit.cache /
6
6
.php-cs-fixer.cache
7
+ composer.lock
Original file line number Diff line number Diff line change @@ -82,17 +82,7 @@ E.g. in the example the error is `Can not call method`. No additional informatio
82
82
83
83
Create a class that extends ` ConstantErrorFormatter ` and pass the error message to the constructor.
84
84
85
- ``` php
86
- class CallableFromRuleErrorFormatter extends ConstantStringErrorMessageFormatter
87
- {
88
- public function __construct()
89
- {
90
- parent::__construct('Can not call method');
91
- }
92
- }
93
- ```
94
-
95
- The next step is to update the test to tell it to use this formatter.
85
+ Update the test to tell it to use a ` ConstantStringErrorMessageFormatter ` .
96
86
97
87
``` php
98
88
class CallableFromRuleTest extends AbstractRuleTestCase
@@ -102,7 +92,7 @@ class CallableFromRuleTest extends AbstractRuleTestCase
102
92
103
93
protected function getErrorFormatter(): ErrorMessageFormatter
104
94
{
105
- return new CallableFromRuleErrorFormatter( );
95
+ return new ConstantStringErrorMessageFormatter("Can not call method" );
106
96
}
107
97
}
108
98
```
Original file line number Diff line number Diff line change 4
4
5
5
namespace DaveLiddament \PhpstanRuleTestHelper ;
6
6
7
- abstract class ConstantStringErrorMessageFormatter extends ErrorMessageFormatter
7
+ class ConstantStringErrorMessageFormatter extends ErrorMessageFormatter
8
8
{
9
- protected function __construct (
9
+ public function __construct (
10
10
private string $ errorMessage ,
11
11
) {
12
12
}
You can’t perform that action at this time.
0 commit comments