File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -819,21 +819,28 @@ public function disableFilters(): static
819819 */
820820 public function skipFilters (callable $ callback , ?array $ filterNames = null ): mixed
821821 {
822+ if (\is_null ($ filterNames )) {
823+ $ initial = $ this ->filter ;
824+ $ this ->disableFilters ();
825+
826+ try {
827+ return $ callback ();
828+ } finally {
829+ $ this ->filter = $ initial ;
830+ }
831+ }
832+
822833 $ previousFilter = $ this ->filter ;
823834 $ previousDisabledFilters = $ this ->disabledFilters ;
824835
825- if (\is_null ($ filterNames )) {
826- $ this ->disableFilters () ;
836+ if (\count ($ filterNames ) === 0 ) {
837+ $ this ->disabledFilters = [] ;
827838 } else {
828- if (\count ($ filterNames ) === 0 ) {
829- $ this ->disabledFilters = [];
830- } else {
831- $ disabledFilters = [];
832- foreach ($ filterNames as $ filterName ) {
833- $ disabledFilters [$ filterName ] = true ;
834- }
835- $ this ->disabledFilters = $ disabledFilters ;
839+ $ disabledFilters = [];
840+ foreach ($ filterNames as $ filterName ) {
841+ $ disabledFilters [$ filterName ] = true ;
836842 }
843+ $ this ->disabledFilters = $ disabledFilters ;
837844 }
838845
839846 try {
You can’t perform that action at this time.
0 commit comments