@@ -120,7 +120,7 @@ private function checkSeaLevels(AnalyzerResult $result, BaselineError $baselineE
120
120
{
121
121
if (
122
122
sscanf (
123
- $ baselineError -> unwrapMessage ( ),
123
+ $ this -> normalizeMessage ( $ baselineError ),
124
124
$ this ->printfToScanfFormat (self ::PROPERTY_TYPE_DEClARATION_SEA_LEVEL_MESSAGE),
125
125
$ absoluteCountMin , $ coveragePercent , $ goalPercent ) >= 2
126
126
) {
@@ -132,7 +132,7 @@ private function checkSeaLevels(AnalyzerResult $result, BaselineError $baselineE
132
132
133
133
if (
134
134
sscanf (
135
- $ baselineError -> unwrapMessage ( ),
135
+ $ this -> normalizeMessage ( $ baselineError ),
136
136
$ this ->printfToScanfFormat (self ::PARAM_TYPE_DEClARATION_SEA_LEVEL_MESSAGE),
137
137
$ absoluteCountMin , $ coveragePercent , $ goalPercent ) >= 2
138
138
) {
@@ -144,7 +144,7 @@ private function checkSeaLevels(AnalyzerResult $result, BaselineError $baselineE
144
144
145
145
if (
146
146
sscanf (
147
- $ baselineError -> unwrapMessage ( ),
147
+ $ this -> normalizeMessage ( $ baselineError ),
148
148
$ this ->printfToScanfFormat (self ::RETURN_TYPE_DEClARATION_SEA_LEVEL_MESSAGE),
149
149
$ absoluteCountMin , $ coveragePercent , $ goalPercent ) >= 2
150
150
) {
@@ -159,6 +159,11 @@ private function printfToScanfFormat(string $format): string {
159
159
// we don't need the float value, therefore simply ignore it, to make the format parseable by sscanf
160
160
// see https://github.com/php/php-src/issues/12126
161
161
// additionally this makes the output format of tomasvotruba/type-coverage 0.2.* compatible with tomasvotruba/type-coverage 0.1.*
162
- return str_replace ('%.1f ' , '' , $ format );
162
+ return str_replace ('%d - %.1f ' , '%d ' , $ format );
163
+ }
164
+
165
+ private function normalizeMessage (BaselineError $ baselineError ): string {
166
+ // makes the message format of tomasvotruba/type-coverage 0.2.* compatible with tomasvotruba/type-coverage 0.1.*
167
+ return \Safe \preg_replace ('/only \d+ \- (\d+).\d %/ ' , 'only $1 % ' , $ baselineError ->unwrapMessage ());
163
168
}
164
169
}
0 commit comments