File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ private function detectUnmatchedLineEndings(array $diff): bool
182182 return false ;
183183 }
184184
185- private function getLinebreak ($ line ): string
185+ private function getLinebreak (int | string $ line ): string
186186 {
187187 if (!is_string ($ line )) {
188188 return '' ;
Original file line number Diff line number Diff line change @@ -127,8 +127,10 @@ public function getDiff(array $diff): string
127127 : $ diff ;
128128 }
129129
130- private function writeDiffHunks ($ output , array $ diff ): void
130+ private function writeDiffHunks (mixed $ output , array $ diff ): void
131131 {
132+ assert (is_resource ($ output ));
133+
132134 // detect "No newline at end of file" and insert into `$diff` if needed
133135
134136 $ upperLimit = count ($ diff );
@@ -278,8 +280,10 @@ private function writeHunk(
278280 int $ fromRange ,
279281 int $ toStart ,
280282 int $ toRange ,
281- $ output
283+ mixed $ output
282284 ): void {
285+ assert (is_resource ($ output ));
286+
283287 fwrite ($ output , '@@ - ' . $ fromStart );
284288
285289 if (!$ this ->collapseRanges || 1 !== $ fromRange ) {
Original file line number Diff line number Diff line change @@ -75,8 +75,10 @@ public function getDiff(array $diff): string
7575 : $ diff ;
7676 }
7777
78- private function writeDiffHunks ($ output , array $ diff ): void
78+ private function writeDiffHunks (mixed $ output , array $ diff ): void
7979 {
80+ assert (is_resource ($ output ));
81+
8082 // detect "No newline at end of file" and insert into `$diff` if needed
8183
8284 $ upperLimit = count ($ diff );
@@ -224,8 +226,10 @@ private function writeHunk(
224226 int $ fromRange ,
225227 int $ toStart ,
226228 int $ toRange ,
227- $ output
229+ mixed $ output
228230 ): void {
231+ assert (is_resource ($ output ));
232+
229233 if ($ this ->addLineNumbers ) {
230234 fwrite ($ output , '@@ - ' . $ fromStart );
231235
You can’t perform that action at this time.
0 commit comments