diff --git a/lib/jblond/Diff.php b/lib/jblond/Diff.php index 9c01f74..3bb3ce0 100644 --- a/lib/jblond/Diff.php +++ b/lib/jblond/Diff.php @@ -87,7 +87,7 @@ class Diff * The values can be of type string or array. * If the type is string, it's split into array elements by line-end characters. * - * Options for comparison can be set by using the third parameter. The format of this value is expected to be a + * Options for comparison can be set by using the third parameter. The format of this value is expected to be an * associative array where each key-value pair represents an option and its value (E.g. ['context' => 3], ...). * When a keyName matches the name of a default option, that option's value will be overridden by the key's value. * Any other keyName (and it's value) can be added as an option, but will not be used if not implemented. @@ -110,7 +110,7 @@ public function __construct($version1, $version2, array $options = []) } /** - * Get the type of a variable. + * Get the kind of variable. * * The return value depend on the type of variable: * 0 If the type is 'array' @@ -200,11 +200,11 @@ public function render(object $renderer) * @param int|null $end The last element of the range to get. * If not supplied, only the element at start will be returned. * - * @return array Array containing all of the elements of the specified range. + * @return array Array containing all the elements of the specified range. * @throws OutOfRangeException When the value of start or end are invalid to define a range. * */ - public function getArrayRange(array $array, int $start = 0, $end = null): array + public function getArrayRange(array $array, int $start = 0, ?int $end = null): array { if ($start < 0 || $end < 0 || $end < $start) { throw new OutOfRangeException('Start parameter must be lower than End parameter while both are positive!'); @@ -274,7 +274,7 @@ public function getGroupedOpCodes(): array * * @return float Similarity ratio. */ - public function getSimilarity($method = Similarity::CALC_DEFAULT): float + public function getSimilarity(int $method = Similarity::CALC_DEFAULT): float { if ($this->similarity !== null) { return $this->similarity; diff --git a/lib/jblond/Diff/Renderer/Html/Merged.php b/lib/jblond/Diff/Renderer/Html/Merged.php index 4a16e96..6883378 100644 --- a/lib/jblond/Diff/Renderer/Html/Merged.php +++ b/lib/jblond/Diff/Renderer/Html/Merged.php @@ -22,7 +22,7 @@ class Merged extends MainRenderer implements SubRendererInterface /** * @var array Associative array containing the default options available for this renderer and their default * value. - * - format Format of the texts. + * - format The Format of the texts. * - insertMarkers Markers for inserted text. * - deleteMarkers Markers for removed text. * - title1 Title of the 1st version of text. diff --git a/lib/jblond/Diff/Renderer/Html/SideBySide.php b/lib/jblond/Diff/Renderer/Html/SideBySide.php index 2878589..72a23e2 100644 --- a/lib/jblond/Diff/Renderer/Html/SideBySide.php +++ b/lib/jblond/Diff/Renderer/Html/SideBySide.php @@ -26,7 +26,7 @@ class SideBySide extends MainRenderer implements SubRendererInterface /** * @var array Associative array containing the default options available for this renderer and their default * value. - * - format Format of the texts. + * - format The Format of the texts. * - insertMarkers Markers for inserted text. * - deleteMarkers Markers for removed text. * - title1 Title of the 1st version of text. diff --git a/lib/jblond/Diff/Renderer/Html/Unified.php b/lib/jblond/Diff/Renderer/Html/Unified.php index 31d17e8..cd8cd00 100644 --- a/lib/jblond/Diff/Renderer/Html/Unified.php +++ b/lib/jblond/Diff/Renderer/Html/Unified.php @@ -26,7 +26,7 @@ class Unified extends MainRenderer implements SubRendererInterface /** * @var array Associative array containing the default options available for this renderer and their default * value. - * - format Format of the texts. + * - format The Format of the texts. * - insertMarkers Markers for inserted text. * - deleteMarkers Markers for removed text. * - title1 Title of the 1st version of text. diff --git a/lib/jblond/Diff/Renderer/MainRenderer.php b/lib/jblond/Diff/Renderer/MainRenderer.php index eee5cce..91a6330 100644 --- a/lib/jblond/Diff/Renderer/MainRenderer.php +++ b/lib/jblond/Diff/Renderer/MainRenderer.php @@ -116,7 +116,7 @@ protected function renderSequences(): array foreach ($group as $code) { [$tag, $startOld, $endOld, $startNew, $endNew] = $code; /** - * $code is an array describing a op-code which includes: + * $code is an array describing an op-code which includes: * 0 - The type of tag (as described below) for the op code. * 1 - The beginning line in the first sequence. * 2 - The end line in the first sequence. @@ -351,7 +351,7 @@ private function getOuterChange(string $oldString, string $newString): array $limit = min(mb_strlen($oldString), mb_strlen($newString)); // Find the position of the first character which is different between old and new. - // Starts at the begin of the strings. + // Starts at the beginning of the strings. // Stops at the end of the shortest string. while ($start < $limit && mb_substr($oldString, $start, 1) == mb_substr($newString, $start, 1)) { ++$start; @@ -375,7 +375,7 @@ private function getOuterChange(string $oldString, string $newString): array /** * Helper function that will fill the changes-array for the renderer with default values. - * Every time a operation changes (specified by $tag) , a new element will be appended to this array. + * Every time an operation changes (specified by $tag) , a new element will be appended to this array. * * The index of the last element of the array is always returned. * diff --git a/lib/jblond/Diff/Renderer/Text/UnifiedCli.php b/lib/jblond/Diff/Renderer/Text/UnifiedCli.php index 3c6a36b..50b11d3 100644 --- a/lib/jblond/Diff/Renderer/Text/UnifiedCli.php +++ b/lib/jblond/Diff/Renderer/Text/UnifiedCli.php @@ -112,12 +112,12 @@ private function output(): string } /** - * @param $string - * @param string $color + * @param string $string + * @param string $color * * @return string */ - private function colorizeString($string, $color = ''): string + private function colorizeString(string $string, string $color = ''): string { if ($this->options['cliColor']) { return $this->colors->getColoredString($string, $color); diff --git a/lib/jblond/Diff/SequenceMatcher.php b/lib/jblond/Diff/SequenceMatcher.php index 701a598..32af5d4 100644 --- a/lib/jblond/Diff/SequenceMatcher.php +++ b/lib/jblond/Diff/SequenceMatcher.php @@ -73,7 +73,7 @@ class SequenceMatcher /** * The constructor. With the sequences being passed, they'll be set for the - * sequence matcher and it will perform a basic cleanup & calculate junk + * sequence matcher, and it will perform a basic cleanup & calculate junk * elements. * * @param string|array $old A string or array containing the lines to compare against. @@ -215,7 +215,7 @@ private function chainB() * content of the different files but can still provide context as to where the * changes are. * - * @return array Nested array of all of the grouped op codes. + * @return array Nested array of all the grouped op codes. */ public function getGroupedOpCodes(): array { @@ -295,7 +295,7 @@ public function getGroupedOpCodes(): array } /** - * Return a list of all of the op codes for the differences between the + * Return a list of all the op codes for the differences between the * two strings. * * The nested array returned contains an array describing the op code @@ -366,7 +366,7 @@ public function getOpCodes(): array } /** - * Return a nested set of arrays for all of the matching sub-sequences + * Return a nested set of arrays for all the matching sub-sequences * in the strings $a and $b. * * Each block contains the lower constraint of the block in $a, the lower @@ -479,7 +479,7 @@ function ($aArray, $bArray) { * lower and upper constraints for each sequence. (for the first sequence, * $alo - $ahi and for the second sequence, $blo - $bhi) * - * Essentially, of all of the maximal matching blocks, return the one that + * Essentially, of all the maximal matching blocks, return the one that * starts earliest in $a, and all of those maximal matching blocks that * start earliest in $a, return the one that starts earliest in $b. * diff --git a/tests/Diff/SequenceMatcherTest.php b/tests/Diff/SequenceMatcherTest.php index b968609..16f8d3d 100644 --- a/tests/Diff/SequenceMatcherTest.php +++ b/tests/Diff/SequenceMatcherTest.php @@ -73,7 +73,7 @@ public function testGetGroupedOpCodesIgnoreWhitespaceTrue() { // Test with ignoreWhitespace enabled. Both sequences are considered to be the same. // Note: The sequenceMatcher evaluates the string character by character. Option ignoreWhitespace will ignore - // if the difference if the character is a tab in one sequence and a space in the other. + // if the difference is the character or is a tab in one sequence and a space in the other. $sequenceMatcher = new SequenceMatcher( "\t54321ABXDE12345 ", " 54321ABXDE12345\t",