Skip to content

Commit 3f44195

Browse files
committed
Document update grammar in the comments
1 parent 02cf114 commit 3f44195

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

lib/jblond/Diff.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Diff
8787
* The values can be of type string or array.
8888
* If the type is string, it's split into array elements by line-end characters.
8989
*
90-
* Options for comparison can be set by using the third parameter. The format of this value is expected to be a
90+
* Options for comparison can be set by using the third parameter. The format of this value is expected to be an
9191
* associative array where each key-value pair represents an option and its value (E.g. ['context' => 3], ...).
9292
* When a keyName matches the name of a default option, that option's value will be overridden by the key's value.
9393
* 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 = [])
110110
}
111111

112112
/**
113-
* Get the type of a variable.
113+
* Get the kind of variable.
114114
*
115115
* The return value depend on the type of variable:
116116
* 0 If the type is 'array'
@@ -200,11 +200,11 @@ public function render(object $renderer)
200200
* @param int|null $end The last element of the range to get.
201201
* If not supplied, only the element at start will be returned.
202202
*
203-
* @return array Array containing all of the elements of the specified range.
203+
* @return array Array containing all the elements of the specified range.
204204
* @throws OutOfRangeException When the value of start or end are invalid to define a range.
205205
*
206206
*/
207-
public function getArrayRange(array $array, int $start = 0, $end = null): array
207+
public function getArrayRange(array $array, int $start = 0, ?int $end = null): array
208208
{
209209
if ($start < 0 || $end < 0 || $end < $start) {
210210
throw new OutOfRangeException('Start parameter must be lower than End parameter while both are positive!');
@@ -274,7 +274,7 @@ public function getGroupedOpCodes(): array
274274
*
275275
* @return float Similarity ratio.
276276
*/
277-
public function getSimilarity($method = Similarity::CALC_DEFAULT): float
277+
public function getSimilarity(int $method = Similarity::CALC_DEFAULT): float
278278
{
279279
if ($this->similarity !== null) {
280280
return $this->similarity;

lib/jblond/Diff/Renderer/Html/Merged.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Merged extends MainRenderer implements SubRendererInterface
2222
/**
2323
* @var array Associative array containing the default options available for this renderer and their default
2424
* value.
25-
* - format Format of the texts.
25+
* - format The Format of the texts.
2626
* - insertMarkers Markers for inserted text.
2727
* - deleteMarkers Markers for removed text.
2828
* - title1 Title of the 1st version of text.

lib/jblond/Diff/Renderer/Html/SideBySide.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SideBySide extends MainRenderer implements SubRendererInterface
2626
/**
2727
* @var array Associative array containing the default options available for this renderer and their default
2828
* value.
29-
* - format Format of the texts.
29+
* - format The Format of the texts.
3030
* - insertMarkers Markers for inserted text.
3131
* - deleteMarkers Markers for removed text.
3232
* - title1 Title of the 1st version of text.

lib/jblond/Diff/Renderer/Html/Unified.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Unified extends MainRenderer implements SubRendererInterface
2626
/**
2727
* @var array Associative array containing the default options available for this renderer and their default
2828
* value.
29-
* - format Format of the texts.
29+
* - format The Format of the texts.
3030
* - insertMarkers Markers for inserted text.
3131
* - deleteMarkers Markers for removed text.
3232
* - title1 Title of the 1st version of text.

lib/jblond/Diff/Renderer/MainRenderer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected function renderSequences(): array
116116
foreach ($group as $code) {
117117
[$tag, $startOld, $endOld, $startNew, $endNew] = $code;
118118
/**
119-
* $code is an array describing a op-code which includes:
119+
* $code is an array describing an op-code which includes:
120120
* 0 - The type of tag (as described below) for the op code.
121121
* 1 - The beginning line in the first sequence.
122122
* 2 - The end line in the first sequence.
@@ -351,7 +351,7 @@ private function getOuterChange(string $oldString, string $newString): array
351351
$limit = min(mb_strlen($oldString), mb_strlen($newString));
352352

353353
// Find the position of the first character which is different between old and new.
354-
// Starts at the begin of the strings.
354+
// Starts at the beginning of the strings.
355355
// Stops at the end of the shortest string.
356356
while ($start < $limit && mb_substr($oldString, $start, 1) == mb_substr($newString, $start, 1)) {
357357
++$start;
@@ -375,7 +375,7 @@ private function getOuterChange(string $oldString, string $newString): array
375375

376376
/**
377377
* Helper function that will fill the changes-array for the renderer with default values.
378-
* Every time a operation changes (specified by $tag) , a new element will be appended to this array.
378+
* Every time an operation changes (specified by $tag) , a new element will be appended to this array.
379379
*
380380
* The index of the last element of the array is always returned.
381381
*

lib/jblond/Diff/Renderer/Text/UnifiedCli.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ private function output(): string
112112
}
113113

114114
/**
115-
* @param $string
116-
* @param string $color
115+
* @param string $string
116+
* @param string $color
117117
*
118118
* @return string
119119
*/
120-
private function colorizeString($string, $color = ''): string
120+
private function colorizeString(string $string, string $color = ''): string
121121
{
122122
if ($this->options['cliColor']) {
123123
return $this->colors->getColoredString($string, $color);

lib/jblond/Diff/SequenceMatcher.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class SequenceMatcher
7373

7474
/**
7575
* The constructor. With the sequences being passed, they'll be set for the
76-
* sequence matcher and it will perform a basic cleanup & calculate junk
76+
* sequence matcher, and it will perform a basic cleanup & calculate junk
7777
* elements.
7878
*
7979
* @param string|array $old A string or array containing the lines to compare against.
@@ -215,7 +215,7 @@ private function chainB()
215215
* content of the different files but can still provide context as to where the
216216
* changes are.
217217
*
218-
* @return array Nested array of all of the grouped op codes.
218+
* @return array Nested array of all the grouped op codes.
219219
*/
220220
public function getGroupedOpCodes(): array
221221
{
@@ -295,7 +295,7 @@ public function getGroupedOpCodes(): array
295295
}
296296

297297
/**
298-
* Return a list of all of the op codes for the differences between the
298+
* Return a list of all the op codes for the differences between the
299299
* two strings.
300300
*
301301
* The nested array returned contains an array describing the op code
@@ -366,7 +366,7 @@ public function getOpCodes(): array
366366
}
367367

368368
/**
369-
* Return a nested set of arrays for all of the matching sub-sequences
369+
* Return a nested set of arrays for all the matching sub-sequences
370370
* in the strings $a and $b.
371371
*
372372
* Each block contains the lower constraint of the block in $a, the lower
@@ -479,7 +479,7 @@ function ($aArray, $bArray) {
479479
* lower and upper constraints for each sequence. (for the first sequence,
480480
* $alo - $ahi and for the second sequence, $blo - $bhi)
481481
*
482-
* Essentially, of all of the maximal matching blocks, return the one that
482+
* Essentially, of all the maximal matching blocks, return the one that
483483
* starts earliest in $a, and all of those maximal matching blocks that
484484
* start earliest in $a, return the one that starts earliest in $b.
485485
*

tests/Diff/SequenceMatcherTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testGetGroupedOpCodesIgnoreWhitespaceTrue()
7373
{
7474
// Test with ignoreWhitespace enabled. Both sequences are considered to be the same.
7575
// Note: The sequenceMatcher evaluates the string character by character. Option ignoreWhitespace will ignore
76-
// if the difference if the character is a tab in one sequence and a space in the other.
76+
// if the difference is the character or is a tab in one sequence and a space in the other.
7777
$sequenceMatcher = new SequenceMatcher(
7878
"\t54321ABXDE12345 ",
7979
" 54321ABXDE12345\t",

0 commit comments

Comments
 (0)