Skip to content

Commit 8b14dae

Browse files
committed
Add "final" to classes non-inherited
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
1 parent ee6e5a3 commit 8b14dae

File tree

16 files changed

+41
-41
lines changed

16 files changed

+41
-41
lines changed

src/Diff.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @see http://github.com/chrisboulton/php-diff
1818
*/
19-
class Diff
19+
final class Diff
2020
{
2121
/**
2222
* @var array array of the options that have been applied for generating the diff
@@ -26,27 +26,27 @@ class Diff
2626
/**
2727
* @var string[] the "old" sequence to use as the basis for the comparison
2828
*/
29-
protected $a = [];
29+
private $a = [];
3030

3131
/**
3232
* @var string[] the "new" sequence to generate the changes for
3333
*/
34-
protected $b = [];
34+
private $b = [];
3535

3636
/**
3737
* @var null|SequenceMatcher the sequence matcher
3838
*/
39-
protected $sequenceMatcher;
39+
private $sequenceMatcher;
4040

4141
/**
4242
* @var null|array array containing the generated opcodes for the differences between the two items
4343
*/
44-
protected $groupedCodes;
44+
private $groupedCodes;
4545

4646
/**
4747
* @var array associative array of the default options available for the diff class and their default value
4848
*/
49-
protected static $defaultOptions = [
49+
private static $defaultOptions = [
5050
// show how many neighbor lines
5151
'context' => 3,
5252
// ignore case difference
@@ -231,7 +231,7 @@ public function render(AbstractRenderer $renderer): string
231231
*
232232
* @return string[] array of all of the lines between the specified range
233233
*/
234-
protected function getText(array $lines, int $start = 0, ?int $end = null): array
234+
private function getText(array $lines, int $start = 0, ?int $end = null): array
235235
{
236236
if ($start === 0 && (!isset($end) || $end === \count($lines))) {
237237
return $lines;

src/DiffHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Jfcherng\Diff\Renderer\RendererConstant;
88
use Jfcherng\Diff\Utility\RendererFactory;
99

10-
class DiffHelper
10+
final class DiffHelper
1111
{
1212
/**
1313
* Get the information about available templates.

src/Exception/FileNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Exception;
88
use Throwable;
99

10-
class FileNotFoundException extends Exception
10+
final class FileNotFoundException extends Exception
1111
{
1212
public function __construct(string $filepath = '', int $code = 0, Throwable $previous = null)
1313
{

src/Renderer/Html/Inline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**
1010
* Inline HTML diff generator.
1111
*/
12-
class Inline extends AbstractHtml
12+
final class Inline extends AbstractHtml
1313
{
1414
/**
1515
* {@inheritdoc}

src/Renderer/Html/Json.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Json diff generator.
99
*/
10-
class Json extends AbstractHtml
10+
final class Json extends AbstractHtml
1111
{
1212
/**
1313
* {@inheritdoc}

src/Renderer/Html/LineRenderer/Char.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Jfcherng\Diff\Utility\SequenceMatcher;
99
use Jfcherng\Utility\MbString;
1010

11-
class Char extends AbstractLineRenderer
11+
final class Char extends AbstractLineRenderer
1212
{
1313
/**
1414
* {@inheritdoc}

src/Renderer/Html/LineRenderer/Line.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Jfcherng\Utility\MbString;
88

9-
class Line extends AbstractLineRenderer
9+
final class Line extends AbstractLineRenderer
1010
{
1111
/**
1212
* {@inheritdoc}

src/Renderer/Html/LineRenderer/None.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Jfcherng\Utility\MbString;
88

9-
class None extends AbstractLineRenderer
9+
final class None extends AbstractLineRenderer
1010
{
1111
/**
1212
* {@inheritdoc}

src/Renderer/Html/LineRenderer/Word.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Jfcherng\Diff\Utility\SequenceMatcher;
99
use Jfcherng\Utility\MbString;
1010

11-
class Word extends AbstractLineRenderer
11+
final class Word extends AbstractLineRenderer
1212
{
1313
/**
1414
* {@inheritdoc}

src/Renderer/Html/SideBySide.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**
1010
* Side by Side HTML diff generator.
1111
*/
12-
class SideBySide extends AbstractHtml
12+
final class SideBySide extends AbstractHtml
1313
{
1414
/**
1515
* {@inheritdoc}

0 commit comments

Comments
 (0)