@@ -50,15 +50,12 @@ public function process(
5050 bool $ onlyFiles ,
5151 array $ analysedFiles ,
5252 bool $ hasInternalErrors ,
53- bool $ generateBaseline ,
54- bool $ ignoreNewErrors ,
5553 ): IgnoredErrorHelperProcessedResult
5654 {
57- // if we are generating the baseline, we dont want ignore Errors configuration to affect the errors we output
58- $ unmatchedIgnoredErrors = $ generateBaseline ? [] : $ this ->ignoreErrors ;
55+ $ unmatchedIgnoredErrors = $ this ->ignoreErrors ;
5956 $ stringErrors = [];
6057
61- $ processIgnoreError = function (Error $ error , int $ i , $ ignore ) use ($ generateBaseline , &$ unmatchedIgnoredErrors , &$ stringErrors ): bool {
58+ $ processIgnoreError = function (Error $ error , int $ i , $ ignore ) use (&$ unmatchedIgnoredErrors , &$ stringErrors ): bool {
6259 $ shouldBeIgnored = false ;
6360 if (is_string ($ ignore )) {
6461 $ shouldBeIgnored = IgnoredError::shouldIgnore ($ this ->fileHelper , $ error , $ ignore , null , null );
@@ -68,8 +65,7 @@ public function process(
6865 } else {
6966 if (isset ($ ignore ['path ' ])) {
7067 $ shouldBeIgnored = IgnoredError::shouldIgnore ($ this ->fileHelper , $ error , $ ignore ['message ' ] ?? null , $ ignore ['identifier ' ] ?? null , $ ignore ['path ' ]);
71- // only ignore errors when not generating the baseline, because it need to contain all errors
72- if ($ shouldBeIgnored && !$ generateBaseline ) {
68+ if ($ shouldBeIgnored ) {
7369 if (isset ($ ignore ['count ' ])) {
7470 $ realCount = $ unmatchedIgnoredErrors [$ i ]['realCount ' ] ?? 0 ;
7571 $ realCount ++;
@@ -119,12 +115,12 @@ public function process(
119115 'Error message "%s" cannot be ignored, use excludePaths instead. ' ,
120116 $ error ->getMessage (),
121117 );
122- return false ;
118+ return true ;
123119 }
124- return true ;
120+ return false ;
125121 }
126122
127- return false ;
123+ return true ;
128124 };
129125
130126 $ ignoredErrors = [];
@@ -134,16 +130,12 @@ public function process(
134130 foreach ($ this ->ignoreErrorsByFile [$ filePath ] as $ ignoreError ) {
135131 $ i = $ ignoreError ['index ' ];
136132 $ ignore = $ ignoreError ['ignoreError ' ];
137- $ isIgnoreMatch = $ processIgnoreError ($ error , $ i , $ ignore );
138- if (!$ isIgnoreMatch ) {
139- continue ;
140- }
141-
142- if (!$ generateBaseline ) {
133+ $ result = $ processIgnoreError ($ error , $ i , $ ignore );
134+ if (!$ result ) {
143135 unset($ errors [$ errorIndex ]);
144136 $ ignoredErrors [] = [$ error , $ ignore ];
137+ continue 2 ;
145138 }
146- continue 2 ;
147139 }
148140 }
149141
@@ -154,16 +146,12 @@ public function process(
154146 foreach ($ this ->ignoreErrorsByFile [$ normalizedTraitFilePath ] as $ ignoreError ) {
155147 $ i = $ ignoreError ['index ' ];
156148 $ ignore = $ ignoreError ['ignoreError ' ];
157- $ isIgnoreMatch = $ processIgnoreError ($ error , $ i , $ ignore );
158- if (!$ isIgnoreMatch ) {
159- continue ;
160- }
161-
162- if (!$ generateBaseline ) {
149+ $ result = $ processIgnoreError ($ error , $ i , $ ignore );
150+ if (!$ result ) {
163151 unset($ errors [$ errorIndex ]);
164152 $ ignoredErrors [] = [$ error , $ ignore ];
153+ continue 2 ;
165154 }
166- continue 2 ;
167155 }
168156 }
169157 }
@@ -172,24 +160,13 @@ public function process(
172160 $ i = $ ignoreError ['index ' ];
173161 $ ignore = $ ignoreError ['ignoreError ' ];
174162
175- $ isIgnoreMatch = $ processIgnoreError ($ error , $ i , $ ignore );
176- if (!$ isIgnoreMatch ) {
177- continue ;
178- }
179-
180- if (!$ generateBaseline ) {
163+ $ result = $ processIgnoreError ($ error , $ i , $ ignore );
164+ if (!$ result ) {
181165 unset($ errors [$ errorIndex ]);
182166 $ ignoredErrors [] = [$ error , $ ignore ];
167+ continue 2 ;
183168 }
184- continue 2 ;
185169 }
186-
187- if (!$ ignoreNewErrors ) {
188- continue ;
189- }
190-
191- // if the error was not ignored, it is a new error, don't return it when $ignoreNewErrors is set
192- unset($ errors [$ errorIndex ]);
193170 }
194171
195172 $ errors = array_values ($ errors );
0 commit comments