autofixes

This commit is contained in:
Dennis Eichhorn 2019-08-10 23:23:06 +02:00
parent 64198f0562
commit 9d6ecedba2
10 changed files with 11 additions and 18 deletions

View File

@ -27,7 +27,7 @@ class SelectionSort implements SortInterface
public static function sort(array $list, int $order = SortOrder::ASC) : array public static function sort(array $list, int $order = SortOrder::ASC) : array
{ {
$n = \count($list); $n = \count($list);
for ($i = 0; $i < $n - 1; ++$i) { for ($i = 0; $i < $n - 1; ++$i) {
$min = $i; $min = $i;

View File

@ -24,5 +24,5 @@ namespace phpOMS\Algorithm\Sort;
*/ */
interface SortableInterface interface SortableInterface
{ {
public function compare(SortableInterface $obj, int $order = SortOrder::ASC) : bool; public function compare(self $obj, int $order = SortOrder::ASC) : bool;
} }

View File

@ -15,7 +15,6 @@
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\BubbleSort; use phpOMS\Algorithm\Sort\BubbleSort;
use phpOMS\Algorithm\Sort\SortableInterface;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php'; 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,] [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,]
); );
} }
} }

View File

@ -15,7 +15,6 @@
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\CocktailShakerSort; use phpOMS\Algorithm\Sort\CocktailShakerSort;
use phpOMS\Algorithm\Sort\SortableInterface;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php'; 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,] [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,]
); );
} }
} }

View File

@ -15,7 +15,6 @@
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\CombSort; use phpOMS\Algorithm\Sort\CombSort;
use phpOMS\Algorithm\Sort\SortableInterface;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php'; 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,] [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,]
); );
} }
} }

View File

@ -15,7 +15,6 @@
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\GnomeSort; use phpOMS\Algorithm\Sort\GnomeSort;
use phpOMS\Algorithm\Sort\SortableInterface;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php'; 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,] [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,]
); );
} }
} }

View File

@ -23,7 +23,7 @@ class NumericElement implements SortableInterface
{ {
public $value = 0; public $value = 0;
public function __construct($value) public function __construct($value)
{ {
$this->value = $value; $this->value = $value;
} }
@ -32,4 +32,4 @@ class NumericElement implements SortableInterface
{ {
return $order === SortOrder::ASC ? $this->value > $obj->value : $this->value < $obj->value; return $order === SortOrder::ASC ? $this->value > $obj->value : $this->value < $obj->value;
} }
} }

View File

@ -15,7 +15,6 @@
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\OddEvenSort; use phpOMS\Algorithm\Sort\OddEvenSort;
use phpOMS\Algorithm\Sort\SortableInterface;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php'; 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,] [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,]
); );
} }
} }

View File

@ -15,7 +15,6 @@
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\QuickSort; use phpOMS\Algorithm\Sort\QuickSort;
use phpOMS\Algorithm\Sort\SortableInterface;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php'; 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,] [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,]
); );
} }
} }

View File

@ -15,7 +15,6 @@
namespace phpOMS\tests\Algorithm\Sort; namespace phpOMS\tests\Algorithm\Sort;
use phpOMS\Algorithm\Sort\SelectionSort; use phpOMS\Algorithm\Sort\SelectionSort;
use phpOMS\Algorithm\Sort\SortableInterface;
use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php'; 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,] [8, 5, 4, 2, 1], [$newList[0]->value, $newList[1]->value, $newList[2]->value, $newList[3]->value, $newList[4]->value,]
); );
} }
} }