@@ -65,7 +65,7 @@ private function parseBranchOnly() : void
6565 $ matches
6666 );
6767
68- if (empty ($ matches [0 ])) {
68+ if (empty ($ matches [1 ])) {
6969 return ;
7070 }
7171
@@ -90,9 +90,9 @@ private function parseBranchPrepend() : bool
9090 }
9191
9292 $ matches = $ this ->nullifyEmpty ($ matches );
93- $ tag = $ matches [2 ] ?? $ matches [5 ];
93+ $ tag = $ matches [2 ] ?? $ matches [5 ] ?? '' ;
9494 $ number = $ matches [3 ] ?? 0 ;
95- $ branch = $ this ->detectOriginalBranch ($ matches [1 ] ?? $ matches [4 ]);
95+ $ branch = $ this ->detectOriginalBranch ($ matches [1 ] ?? $ matches [4 ] ?? '' );
9696
9797 $ this ->tag = new VersionTag (
9898 $ this ->version ,
@@ -138,10 +138,10 @@ private function parseTagSolo(bool $anywhere=false) : bool
138138 }
139139
140140 $ matches = $ this ->nullifyEmpty ($ matches );
141- $ tag = $ matches [1 ] ?? $ matches [3 ];
141+ $ tag = $ matches [1 ] ?? $ matches [3 ] ?? '' ;
142142 $ number = $ matches [2 ] ?? 0 ;
143143
144- $ branch = str_replace ($ matches [0 ], '- ' , $ this ->tagParts );
144+ $ branch = str_replace (( string ) $ matches [0 ], '- ' , $ this ->tagParts );
145145
146146 while (strpos ($ branch , '-- ' ) !== false ) {
147147 $ branch = str_replace ('-- ' , '- ' , $ branch );
@@ -172,9 +172,9 @@ private function parseBranchAppend() : bool
172172 }
173173
174174 $ matches = $ this ->nullifyEmpty ($ matches );
175- $ tag = $ matches [1 ] ?? $ matches [4 ];
175+ $ tag = $ matches [1 ] ?? $ matches [4 ] ?? '' ;
176176 $ number = $ matches [2 ] ?? 0 ;
177- $ branch = $ matches [3 ] ?? $ matches [5 ];
177+ $ branch = $ matches [3 ] ?? $ matches [5 ] ?? '' ;
178178
179179 $ this ->tag = new VersionTag (
180180 $ this ->version ,
@@ -186,6 +186,10 @@ private function parseBranchAppend() : bool
186186 return true ;
187187 }
188188
189+ /**
190+ * @param array<int,string> $values
191+ * @return array<int,string|null>
192+ */
189193 private function nullifyEmpty (array $ values ) : array
190194 {
191195 foreach ($ values as $ idx => $ value ) {
0 commit comments