@@ -110,7 +110,7 @@ class SequenceMatcher
110110 * @param string|array|null $junkCallback Either an array or string that references a callback function
111111 * (if there is one) to determine 'junk' characters.
112112 */
113- public function __construct ($ a , $ b , $ options , $ junkCallback = null )
113+ public function __construct ($ a , $ b , array $ options , $ junkCallback = null )
114114 {
115115 $ this ->a = array ();
116116 $ this ->b = array ();
@@ -122,7 +122,7 @@ public function __construct($a, $b, $options, $junkCallback = null)
122122 /**
123123 * @param array $options
124124 */
125- public function setOptions ($ options )
125+ public function setOptions (array $ options )
126126 {
127127 $ this ->options = array_merge ($ this ->defaultOptions , $ options );
128128 }
@@ -237,7 +237,7 @@ private function chainB()
237237 * @param string $b
238238 * @return bool $b True if the character is considered junk. False if not.
239239 */
240- private function isBJunk ($ b ) : bool
240+ private function isBJunk (string $ b ) : bool
241241 {
242242 if (isset ($ this ->junkDict [$ b ])) {
243243 return true ;
@@ -266,7 +266,7 @@ private function isBJunk($b) : bool
266266 * @return array Array containing the longest match that includes the starting position in $a,
267267 * start in $b and the length/size.
268268 */
269- public function findLongestMatch ($ alo , $ ahi , $ blo , $ bhi ) : array
269+ public function findLongestMatch (int $ alo , int $ ahi , int $ blo , int $ bhi ) : array
270270 {
271271 $ a = $ this ->a ;
272272 $ b = $ this ->b ;
@@ -349,7 +349,7 @@ public function findLongestMatch($alo, $ahi, $blo, $bhi) : array
349349 * @param int $bIndex Line number to check against in b.
350350 * @return bool True if the lines are different and false if not.
351351 */
352- public function linesAreDifferent ($ aIndex , $ bIndex ) : bool
352+ public function linesAreDifferent (int $ aIndex , int $ bIndex ) : bool
353353 {
354354 $ lineA = $ this ->a [$ aIndex ];
355355 $ lineB = $ this ->b [$ bIndex ];
@@ -554,7 +554,7 @@ public function getOpCodes() : array
554554 * @param int $context The number of lines of context to provide around the groups.
555555 * @return array Nested array of all of the grouped op codes.
556556 */
557- public function getGroupedOpcodes ($ context = 3 ) : array
557+ public function getGroupedOpcodes (int $ context = 3 ) : array
558558 {
559559 $ opCodes = $ this ->getOpCodes ();
560560 if (empty ($ opCodes )) {
@@ -652,7 +652,7 @@ public function ratio() : float
652652 * @param array $triple Array containing the matching block triple to add to the running total.
653653 * @return int The new running total for the number of matches.
654654 */
655- private function ratioReduce ($ sum , $ triple ) : int
655+ private function ratioReduce (int $ sum , array $ triple ) : int
656656 {
657657 return $ sum + ($ triple [count ($ triple ) - 1 ]);
658658 }
@@ -665,7 +665,7 @@ private function ratioReduce($sum, $triple) : int
665665 * @param int $length The length of the two strings.
666666 * @return float The calculated ratio.
667667 */
668- private function calculateRatio ($ matches , $ length = 0 ) : float
668+ private function calculateRatio (int $ matches , int $ length = 0 ) : float
669669 {
670670 if ($ length ) {
671671 return 2 * ($ matches / $ length );
@@ -683,7 +683,7 @@ private function calculateRatio($matches, $length = 0) : float
683683 * @param mixed $default The value to return as the default value if the key doesn't exist.
684684 * @return mixed The value from the array if the key exists or otherwise the default.
685685 */
686- private function arrayGetDefault ($ array , $ key , $ default )
686+ private function arrayGetDefault (array $ array , $ key , $ default )
687687 {
688688 if (isset ($ array [$ key ])) {
689689 return $ array [$ key ];
@@ -698,7 +698,7 @@ private function arrayGetDefault($array, $key, $default)
698698 * @param array $b Second array to compare.
699699 * @return int -1, 0 or 1, as expected by the usort function.
700700 */
701- private function tupleSort ($ a , $ b ) : int
701+ private function tupleSort (array $ a , array $ b ) : int
702702 {
703703 $ max = max (count ($ a ), count ($ b ));
704704 for ($ i = 0 ; $ i < $ max ; ++$ i ) {
0 commit comments