From 9d6ecedba2b88cccbfe351791a3513279f0476e9 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 10 Aug 2019 23:23:06 +0200 Subject: [PATCH] autofixes --- Algorithm/Sort/SelectionSort.php | 2 +- Algorithm/Sort/SortableInterface.php | 2 +- tests/Algorithm/Sort/BubbleSortTest.php | 3 +-- tests/Algorithm/Sort/CocktailShakerSortTest.php | 3 +-- tests/Algorithm/Sort/CombSortTest.php | 3 +-- tests/Algorithm/Sort/GnomeSortTest.php | 3 +-- tests/Algorithm/Sort/NumericElement.php | 4 ++-- tests/Algorithm/Sort/OddEvenSortTest.php | 3 +-- tests/Algorithm/Sort/QuickSortTest.php | 3 +-- tests/Algorithm/Sort/SelectionSortTest.php | 3 +-- 10 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Algorithm/Sort/SelectionSort.php b/Algorithm/Sort/SelectionSort.php index daeca283e..43ba1abc5 100644 --- a/Algorithm/Sort/SelectionSort.php +++ b/Algorithm/Sort/SelectionSort.php @@ -27,7 +27,7 @@ class SelectionSort implements SortInterface public static function sort(array $list, int $order = SortOrder::ASC) : array { $n = \count($list); - + for ($i = 0; $i < $n - 1; ++$i) { $min = $i; diff --git a/Algorithm/Sort/SortableInterface.php b/Algorithm/Sort/SortableInterface.php index e7d306bd7..5f44e5e64 100644 --- a/Algorithm/Sort/SortableInterface.php +++ b/Algorithm/Sort/SortableInterface.php @@ -24,5 +24,5 @@ namespace phpOMS\Algorithm\Sort; */ interface SortableInterface { - public function compare(SortableInterface $obj, int $order = SortOrder::ASC) : bool; + public function compare(self $obj, int $order = SortOrder::ASC) : bool; } diff --git a/tests/Algorithm/Sort/BubbleSortTest.php b/tests/Algorithm/Sort/BubbleSortTest.php index fc80c4caa..81cc429a2 100644 --- a/tests/Algorithm/Sort/BubbleSortTest.php +++ b/tests/Algorithm/Sort/BubbleSortTest.php @@ -15,7 +15,6 @@ namespace phpOMS\tests\Algorithm\Sort; use phpOMS\Algorithm\Sort\BubbleSort; -use phpOMS\Algorithm\Sort\SortableInterface; use phpOMS\Algorithm\Sort\SortOrder; require_once __DIR__ . '/../../Autoloader.php'; @@ -55,4 +54,4 @@ class BubbleSortTest extends \PHPUnit\Framework\TestCase [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,] ); } -} \ No newline at end of file +} diff --git a/tests/Algorithm/Sort/CocktailShakerSortTest.php b/tests/Algorithm/Sort/CocktailShakerSortTest.php index 459584940..5c11f0c78 100644 --- a/tests/Algorithm/Sort/CocktailShakerSortTest.php +++ b/tests/Algorithm/Sort/CocktailShakerSortTest.php @@ -15,7 +15,6 @@ namespace phpOMS\tests\Algorithm\Sort; use phpOMS\Algorithm\Sort\CocktailShakerSort; -use phpOMS\Algorithm\Sort\SortableInterface; use phpOMS\Algorithm\Sort\SortOrder; require_once __DIR__ . '/../../Autoloader.php'; @@ -55,4 +54,4 @@ class CocktailShakerSortTest extends \PHPUnit\Framework\TestCase [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,] ); } -} \ No newline at end of file +} diff --git a/tests/Algorithm/Sort/CombSortTest.php b/tests/Algorithm/Sort/CombSortTest.php index 536b57943..b351ab1e3 100644 --- a/tests/Algorithm/Sort/CombSortTest.php +++ b/tests/Algorithm/Sort/CombSortTest.php @@ -15,7 +15,6 @@ namespace phpOMS\tests\Algorithm\Sort; use phpOMS\Algorithm\Sort\CombSort; -use phpOMS\Algorithm\Sort\SortableInterface; use phpOMS\Algorithm\Sort\SortOrder; require_once __DIR__ . '/../../Autoloader.php'; @@ -55,4 +54,4 @@ class CombSortTest extends \PHPUnit\Framework\TestCase [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,] ); } -} \ No newline at end of file +} diff --git a/tests/Algorithm/Sort/GnomeSortTest.php b/tests/Algorithm/Sort/GnomeSortTest.php index 9e713f92b..34469169a 100644 --- a/tests/Algorithm/Sort/GnomeSortTest.php +++ b/tests/Algorithm/Sort/GnomeSortTest.php @@ -15,7 +15,6 @@ namespace phpOMS\tests\Algorithm\Sort; use phpOMS\Algorithm\Sort\GnomeSort; -use phpOMS\Algorithm\Sort\SortableInterface; use phpOMS\Algorithm\Sort\SortOrder; require_once __DIR__ . '/../../Autoloader.php'; @@ -55,4 +54,4 @@ class GnomeSortTest extends \PHPUnit\Framework\TestCase [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,] ); } -} \ No newline at end of file +} diff --git a/tests/Algorithm/Sort/NumericElement.php b/tests/Algorithm/Sort/NumericElement.php index 1db7733db..a01edcd79 100644 --- a/tests/Algorithm/Sort/NumericElement.php +++ b/tests/Algorithm/Sort/NumericElement.php @@ -23,7 +23,7 @@ class NumericElement implements SortableInterface { public $value = 0; - public function __construct($value) + public function __construct($value) { $this->value = $value; } @@ -32,4 +32,4 @@ class NumericElement implements SortableInterface { return $order === SortOrder::ASC ? $this->value > $obj->value : $this->value < $obj->value; } -} \ No newline at end of file +} diff --git a/tests/Algorithm/Sort/OddEvenSortTest.php b/tests/Algorithm/Sort/OddEvenSortTest.php index d07828d3c..f6cf7856d 100644 --- a/tests/Algorithm/Sort/OddEvenSortTest.php +++ b/tests/Algorithm/Sort/OddEvenSortTest.php @@ -15,7 +15,6 @@ namespace phpOMS\tests\Algorithm\Sort; use phpOMS\Algorithm\Sort\OddEvenSort; -use phpOMS\Algorithm\Sort\SortableInterface; use phpOMS\Algorithm\Sort\SortOrder; require_once __DIR__ . '/../../Autoloader.php'; @@ -55,4 +54,4 @@ class OddEvenSortTest extends \PHPUnit\Framework\TestCase [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,] ); } -} \ No newline at end of file +} diff --git a/tests/Algorithm/Sort/QuickSortTest.php b/tests/Algorithm/Sort/QuickSortTest.php index 263820b09..d1aaa12c7 100644 --- a/tests/Algorithm/Sort/QuickSortTest.php +++ b/tests/Algorithm/Sort/QuickSortTest.php @@ -15,7 +15,6 @@ namespace phpOMS\tests\Algorithm\Sort; use phpOMS\Algorithm\Sort\QuickSort; -use phpOMS\Algorithm\Sort\SortableInterface; use phpOMS\Algorithm\Sort\SortOrder; require_once __DIR__ . '/../../Autoloader.php'; @@ -55,4 +54,4 @@ class QuickSortTest extends \PHPUnit\Framework\TestCase [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,] ); } -} \ No newline at end of file +} diff --git a/tests/Algorithm/Sort/SelectionSortTest.php b/tests/Algorithm/Sort/SelectionSortTest.php index 95979023d..84e328449 100644 --- a/tests/Algorithm/Sort/SelectionSortTest.php +++ b/tests/Algorithm/Sort/SelectionSortTest.php @@ -15,7 +15,6 @@ namespace phpOMS\tests\Algorithm\Sort; use phpOMS\Algorithm\Sort\SelectionSort; -use phpOMS\Algorithm\Sort\SortableInterface; use phpOMS\Algorithm\Sort\SortOrder; require_once __DIR__ . '/../../Autoloader.php'; @@ -55,4 +54,4 @@ class SelectionSortTest extends \PHPUnit\Framework\TestCase [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,] ); } -} \ No newline at end of file +}