From ee06a96792c6396e0711df86514d460ecf390200 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 29 Mar 2020 12:50:25 +0200 Subject: [PATCH] fix function return type hint cs --- Algorithm/Clustering/Point.php | 2 +- Application/ApplicationManager.php | 2 +- Math/Numerics/Integration.php | 8 ++++---- .../Forecast/Regression/LevelLevelRegression.php | 2 +- .../Forecast/Regression/LevelLogRegression.php | 2 +- .../Forecast/Regression/LogLevelRegression.php | 2 +- .../Forecast/Regression/LogLogRegression.php | 2 +- .../Forecast/Regression/MultipleLinearRegression.php | 2 +- .../Forecast/Regression/RegressionAbstract.php | 2 +- Stdlib/Base/Heap.php | 2 +- Utils/TaskSchedule/Interval.php | 2 +- tests/Bootstrap.php | 4 ++-- tests/DataStorage/Cache/Connection/MemCachedTest.php | 2 +- .../DataStorage/Cache/Connection/RedisCacheTest.php | 2 +- tests/Log/FileLoggerTest.php | 2 +- tests/Math/Geometry/Shape/D2/PolygonTest.php | 4 ++-- tests/Math/Geometry/Shape/D3/PrismTest.php | 2 +- tests/Math/Numerics/IntegrationTest.php | 10 +++++----- tests/Math/Topology/Metrics2DTest.php | 2 +- tests/Socket/Client/ClientTest.php | 2 +- tests/Socket/Client/ClientTestHelper.php | 2 +- tests/Socket/Server/ServerTest.php | 2 +- tests/Stdlib/Base/HeapTest.php | 12 ++++++------ .../IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php | 2 +- 24 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Algorithm/Clustering/Point.php b/Algorithm/Clustering/Point.php index 9900e06ec..dc4989ea7 100644 --- a/Algorithm/Clustering/Point.php +++ b/Algorithm/Clustering/Point.php @@ -65,7 +65,7 @@ class Point implements PointInterface /** * {@inheritdoc} */ - public function getCoordinates(): array + public function getCoordinates() : array { return $this->coordinates; } diff --git a/Application/ApplicationManager.php b/Application/ApplicationManager.php index 42185372c..20a8db4d9 100644 --- a/Application/ApplicationManager.php +++ b/Application/ApplicationManager.php @@ -69,7 +69,7 @@ final class ApplicationManager * * @since 1.0.0 */ - private function loadInfo(string $appPath): ApplicationInfo + private function loadInfo(string $appPath) : ApplicationInfo { $path = \realpath($appPath); diff --git a/Math/Numerics/Integration.php b/Math/Numerics/Integration.php index ce1900351..88174a44f 100644 --- a/Math/Numerics/Integration.php +++ b/Math/Numerics/Integration.php @@ -61,7 +61,7 @@ final class Integration * * @since 1.0.0 */ - public static function intRightRect(float $from, float $to, float $n, \Closure $func): float + public static function intRightRect(float $from, float $to, float $n, \Closure $func) : float { $h = ($to - $from) / $n; $sum = 0.0; @@ -85,7 +85,7 @@ final class Integration * * @since 1.0.0 */ - public static function intMiddleRect(float $from, float $to, float $n, \Closure $func): float + public static function intMiddleRect(float $from, float $to, float $n, \Closure $func) : float { $h = ($to - $from) / $n; $sum = 0.0; @@ -109,7 +109,7 @@ final class Integration * * @since 1.0.0 */ - public static function intTrapezium(float $from, float $to, float $n, \Closure $func): float + public static function intTrapezium(float $from, float $to, float $n, \Closure $func) : float { $h = ($to - $from) / $n; $sum = $func($from) + $func($to); @@ -133,7 +133,7 @@ final class Integration * * @since 1.0.0 */ - public static function intSimpson(float $from, float $to, float $n, \Closure $func): float + public static function intSimpson(float $from, float $to, float $n, \Closure $func) : float { $h = ($to - $from) / $n; $sum1 = 0.0; diff --git a/Math/Statistic/Forecast/Regression/LevelLevelRegression.php b/Math/Statistic/Forecast/Regression/LevelLevelRegression.php index 66198ef94..878d80263 100644 --- a/Math/Statistic/Forecast/Regression/LevelLevelRegression.php +++ b/Math/Statistic/Forecast/Regression/LevelLevelRegression.php @@ -35,7 +35,7 @@ final class LevelLevelRegression extends RegressionAbstract /** * {@inheritdoc} */ - public static function getElasticity(float $b1, float $y, float $x): float + public static function getElasticity(float $b1, float $y, float $x) : float { return $b1 * $x / $y; } diff --git a/Math/Statistic/Forecast/Regression/LevelLogRegression.php b/Math/Statistic/Forecast/Regression/LevelLogRegression.php index e2e4fc388..f8ee9edbe 100644 --- a/Math/Statistic/Forecast/Regression/LevelLogRegression.php +++ b/Math/Statistic/Forecast/Regression/LevelLogRegression.php @@ -53,7 +53,7 @@ final class LevelLogRegression extends RegressionAbstract /** * {@inheritdoc} */ - public static function getElasticity(float $b1, float $y, float $x): float + public static function getElasticity(float $b1, float $y, float $x) : float { return $b1 / $y; } diff --git a/Math/Statistic/Forecast/Regression/LogLevelRegression.php b/Math/Statistic/Forecast/Regression/LogLevelRegression.php index 80791db75..9e1dda4ca 100644 --- a/Math/Statistic/Forecast/Regression/LogLevelRegression.php +++ b/Math/Statistic/Forecast/Regression/LogLevelRegression.php @@ -53,7 +53,7 @@ final class LogLevelRegression extends RegressionAbstract /** * {@inheritdoc} */ - public static function getElasticity(float $b1, float $y, float $x): float + public static function getElasticity(float $b1, float $y, float $x) : float { return $b1 * $x; } diff --git a/Math/Statistic/Forecast/Regression/LogLogRegression.php b/Math/Statistic/Forecast/Regression/LogLogRegression.php index f79952d54..94c05e7be 100644 --- a/Math/Statistic/Forecast/Regression/LogLogRegression.php +++ b/Math/Statistic/Forecast/Regression/LogLogRegression.php @@ -54,7 +54,7 @@ final class LogLogRegression extends RegressionAbstract /** * {@inheritdoc} */ - public static function getElasticity(float $b1, float $y, float $x): float + public static function getElasticity(float $b1, float $y, float $x) : float { return $b1; } diff --git a/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php b/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php index be156bc9b..90361da73 100644 --- a/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php +++ b/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php @@ -60,7 +60,7 @@ final class MultipleLinearRegression extends RegressionAbstract /** * {@inheritdoc} */ - public static function getElasticity(float $b1, float $y, float $x): float + public static function getElasticity(float $b1, float $y, float $x) : float { return 0.0; } diff --git a/Math/Statistic/Forecast/Regression/RegressionAbstract.php b/Math/Statistic/Forecast/Regression/RegressionAbstract.php index 7bb3ff228..93d32bd0e 100644 --- a/Math/Statistic/Forecast/Regression/RegressionAbstract.php +++ b/Math/Statistic/Forecast/Regression/RegressionAbstract.php @@ -203,5 +203,5 @@ abstract class RegressionAbstract * * @since 1.0.0 */ - abstract public static function getElasticity(float $b1, float $x, float $y): float; + abstract public static function getElasticity(float $b1, float $x, float $y) : float; } diff --git a/Stdlib/Base/Heap.php b/Stdlib/Base/Heap.php index e8e24d0bd..f82ca1263 100644 --- a/Stdlib/Base/Heap.php +++ b/Stdlib/Base/Heap.php @@ -266,7 +266,7 @@ class Heap * * @since 1.0.0 */ - public function getNSmallest(int $n): array + public function getNSmallest(int $n) : array { $nodes = $this->nodes; \uasort($nodes, $this->compare); diff --git a/Utils/TaskSchedule/Interval.php b/Utils/TaskSchedule/Interval.php index 888c142db..06e83103e 100644 --- a/Utils/TaskSchedule/Interval.php +++ b/Utils/TaskSchedule/Interval.php @@ -549,7 +549,7 @@ class Interval implements \Serializable * * @since 1.0.0 */ - public function unserialize($serialized): void + public function unserialize($serialized) : void { $data = \json_decode($serialized, true); diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 032704909..5b04ce30d 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -306,7 +306,7 @@ DataMapperAbstract::setConnection($GLOBALS['dbpool']->get()); $GLOBALS['frameworkpath'] = '/'; -function phpServe(): void +function phpServe() : void { // OS detection $isWindows = \stristr(\php_uname('s'), 'Windows') !== false; @@ -358,7 +358,7 @@ function phpServe(): void ) . \PHP_EOL; // Kill the web server when the process ends - \register_shutdown_function(function() use ($killCommand, $pid): void { + \register_shutdown_function(function() use ($killCommand, $pid) : void { echo \PHP_EOL . \sprintf('Stopping server...') . \PHP_EOL; echo \sprintf(' %s - Killing process with ID %d', \date('r'), $pid) . \PHP_EOL; \exec($killCommand . $pid); diff --git a/tests/DataStorage/Cache/Connection/MemCachedTest.php b/tests/DataStorage/Cache/Connection/MemCachedTest.php index 86e29fc89..03c92286a 100644 --- a/tests/DataStorage/Cache/Connection/MemCachedTest.php +++ b/tests/DataStorage/Cache/Connection/MemCachedTest.php @@ -39,7 +39,7 @@ class MemCachedTest extends \PHPUnit\Framework\TestCase $this->cache = new MemCached($GLOBALS['CONFIG']['cache']['memcached']); } - protected function tearDown(): void + protected function tearDown() : void { $this->cache->flushAll(); } diff --git a/tests/DataStorage/Cache/Connection/RedisCacheTest.php b/tests/DataStorage/Cache/Connection/RedisCacheTest.php index 39e9c6c87..3aea5dcf8 100644 --- a/tests/DataStorage/Cache/Connection/RedisCacheTest.php +++ b/tests/DataStorage/Cache/Connection/RedisCacheTest.php @@ -39,7 +39,7 @@ class RedisCacheTest extends \PHPUnit\Framework\TestCase $this->cache = new RedisCache($GLOBALS['CONFIG']['cache']['redis']); } - protected function tearDown(): void + protected function tearDown() : void { $this->cache->flushAll(); } diff --git a/tests/Log/FileLoggerTest.php b/tests/Log/FileLoggerTest.php index 400bb3d58..a58e63f6b 100644 --- a/tests/Log/FileLoggerTest.php +++ b/tests/Log/FileLoggerTest.php @@ -28,7 +28,7 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase { protected FileLogger $log; - protected function setUp(): void + protected function setUp() : void { if (\file_exists(__DIR__ . '/' . \date('Y-m-d') . '.log')) { \unlink(__DIR__ . '/' . \date('Y-m-d') . '.log'); diff --git a/tests/Math/Geometry/Shape/D2/PolygonTest.php b/tests/Math/Geometry/Shape/D2/PolygonTest.php index 462742742..1a188725e 100644 --- a/tests/Math/Geometry/Shape/D2/PolygonTest.php +++ b/tests/Math/Geometry/Shape/D2/PolygonTest.php @@ -151,7 +151,7 @@ class PolygonTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Geometry\Shape\D2\Polygon * @group framework */ - public function testRegularAreaByLength(): void + public function testRegularAreaByLength() : void { self::assertEqualsWithDelta(3 * 3, Polygon::getRegularAreaByLength(3.0, 4), 0.01); } @@ -161,7 +161,7 @@ class PolygonTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Geometry\Shape\D2\Polygon * @group framework */ - public function testRegularAreaByRadius(): void + public function testRegularAreaByRadius() : void { self::assertEqualsWithDelta(3 * 3 , Polygon::getRegularAreaByRadius(1.5, 4), 0.01); } diff --git a/tests/Math/Geometry/Shape/D3/PrismTest.php b/tests/Math/Geometry/Shape/D3/PrismTest.php index cfeac6d12..103082a0c 100644 --- a/tests/Math/Geometry/Shape/D3/PrismTest.php +++ b/tests/Math/Geometry/Shape/D3/PrismTest.php @@ -48,7 +48,7 @@ class PrismTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Geometry\Shape\D3\Prism * @group framework */ - public function testSurface(): void + public function testSurface() : void { self::assertEqualsWithDelta(3 * 3 * 2 + 3 * 12 * 4, Prism::getSurfaceRegularLength(3, 4, 12), 0.01); } diff --git a/tests/Math/Numerics/IntegrationTest.php b/tests/Math/Numerics/IntegrationTest.php index 427ffa318..3f5f6f089 100644 --- a/tests/Math/Numerics/IntegrationTest.php +++ b/tests/Math/Numerics/IntegrationTest.php @@ -32,7 +32,7 @@ class IntegrationTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Numerics\Integration * @group framework */ - public function testLRect(): void + public function testLRect() : void { self::assertEqualsWithDelta(0.235322, Integration::intLeftRect(0.0, 1.0, 100.0, function($x) { return $x**3; }), 0.001); self::assertEqualsWithDelta(4.654000, Integration::intLeftRect(1.0, 100.0, 1000.0, function($x) { return 1 / $x; }), 0.001); @@ -45,7 +45,7 @@ class IntegrationTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Numerics\Integration * @group framework */ - public function testRRect(): void + public function testRRect() : void { self::assertEqualsWithDelta(0.245025, Integration::intRightRect(0.0, 1.0, 100.0, function($x) { return $x**3; }), 0.001); self::assertEqualsWithDelta(4.555991, Integration::intRightRect(1.0, 100.0, 1000.0, function($x) { return 1 / $x; }), 0.001); @@ -58,7 +58,7 @@ class IntegrationTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Numerics\Integration * @group framework */ - public function testMRect(): void + public function testMRect() : void { self::assertEqualsWithDelta(0.240137, Integration::intMiddleRect(0.0, 1.0, 100.0, function($x) { return $x**3; }), 0.001); self::assertEqualsWithDelta(4.603772, Integration::intMiddleRect(1.0, 100.0, 1000.0, function($x) { return 1 / $x; }), 0.001); @@ -71,7 +71,7 @@ class IntegrationTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Numerics\Integration * @group framework */ - public function testTrapeze(): void + public function testTrapeze() : void { self::assertEqualsWithDelta(0.250025, Integration::intTrapezium(0.0, 1.0, 100.0, function($x) { return $x**3; }), 0.001); self::assertEqualsWithDelta(4.605986, Integration::intTrapezium(1.0, 100.0, 1000.0, function($x) { return 1 / $x; }), 0.001); @@ -84,7 +84,7 @@ class IntegrationTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Numerics\Integration * @group framework */ - public function testSimpson(): void + public function testSimpson() : void { self::assertEqualsWithDelta(0.25, Integration::intSimpson(0.0, 1.0, 100.0, function ($x) { return $x ** 3; }), 0.001); self::assertEqualsWithDelta(4.605170, Integration::intSimpson(1.0, 100.0, 1000.0, function ($x) { return 1 / $x; }), 0.001); diff --git a/tests/Math/Topology/Metrics2DTest.php b/tests/Math/Topology/Metrics2DTest.php index 59303a872..5346ce96a 100644 --- a/tests/Math/Topology/Metrics2DTest.php +++ b/tests/Math/Topology/Metrics2DTest.php @@ -151,7 +151,7 @@ class Metrics2DTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Math\Topology\Metrics2D * @group framework */ - public function testUlam(): void + public function testUlam() : void { self::assertEquals( 2, diff --git a/tests/Socket/Client/ClientTest.php b/tests/Socket/Client/ClientTest.php index 49e301a47..7f0a45db9 100644 --- a/tests/Socket/Client/ClientTest.php +++ b/tests/Socket/Client/ClientTest.php @@ -92,7 +92,7 @@ class ClientTest extends \PHPUnit\Framework\TestCase $socket->addPacket('help' . "\r"); $socket->addPacket('shutdown' . "\r"); - $this->app->router->add('^shutdown$', function() use ($socket): void { $socket->shutdown(); }); + $this->app->router->add('^shutdown$', function() use ($socket) : void { $socket->shutdown(); }); $socket->run(); diff --git a/tests/Socket/Client/ClientTestHelper.php b/tests/Socket/Client/ClientTestHelper.php index 4961eaf69..4c97b953d 100644 --- a/tests/Socket/Client/ClientTestHelper.php +++ b/tests/Socket/Client/ClientTestHelper.php @@ -66,6 +66,6 @@ $socket = new Server($app); $socket->create('127.0.0.1', $config['socket']['master']['port']); $socket->setLimit(1); -$app->router->add('^shutdown$', function($app, $request) use ($socket): void { $socket->shutdown($request); }); +$app->router->add('^shutdown$', function($app, $request) use ($socket) : void { $socket->shutdown($request); }); $socket->run(); diff --git a/tests/Socket/Server/ServerTest.php b/tests/Socket/Server/ServerTest.php index ffe5d2efc..7b97138ea 100644 --- a/tests/Socket/Server/ServerTest.php +++ b/tests/Socket/Server/ServerTest.php @@ -85,7 +85,7 @@ class ServerTest extends \PHPUnit\Framework\TestCase $socket->create('127.0.0.1', $GLOBALS['CONFIG']['socket']['master']['port']); $socket->setLimit(1); - $this->app->router->add('^shutdown$', function($app, $request) use ($socket): void { $socket->shutdown($request); }); + $this->app->router->add('^shutdown$', function($app, $request) use ($socket) : void { $socket->shutdown($request); }); $socket->run(); diff --git a/tests/Stdlib/Base/HeapTest.php b/tests/Stdlib/Base/HeapTest.php index cba76382e..db97d77aa 100644 --- a/tests/Stdlib/Base/HeapTest.php +++ b/tests/Stdlib/Base/HeapTest.php @@ -176,7 +176,7 @@ class HeapTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Stdlib\Base\Heap * @group framework */ - public function testContains(): void + public function testContains() : void { $heap = new Heap(); for ($i = 1; $i < 6; ++$i) { @@ -197,7 +197,7 @@ class HeapTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Stdlib\Base\Heap * @group framework */ - public function testContainsItem(): void + public function testContainsItem() : void { $heap = new Heap(); for ($i = 1; $i < 6; ++$i) { @@ -218,7 +218,7 @@ class HeapTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Stdlib\Base\Heap * @group framework */ - public function testUpdate(): void + public function testUpdate() : void { $heap = new Heap(); $items = []; @@ -282,7 +282,7 @@ class HeapTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Stdlib\Base\Heap * @group framework */ - public function testNLargest(): void + public function testNLargest() : void { $heap = new Heap(); $heap->push(1); @@ -299,7 +299,7 @@ class HeapTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Stdlib\Base\Heap * @group framework */ - public function testClear(): void + public function testClear() : void { $heap = new Heap(); for ($i = 1; $i < 6; ++$i) { @@ -315,7 +315,7 @@ class HeapTest extends \PHPUnit\Framework\TestCase * @covers phpOMS\Stdlib\Base\Heap * @group framework */ - public function testEmpty(): void + public function testEmpty() : void { $heap = new Heap(); self::assertTrue($heap->isEmpty()); diff --git a/tests/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php b/tests/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php index ce8dc3c26..82a8b900e 100644 --- a/tests/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php +++ b/tests/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapperTest.php @@ -54,7 +54,7 @@ class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase $this->sqlite = new SQLiteConnection(['db' => 'sqlite', 'database' => __DIR__ . '/spreadsheet.db']); } - protected function tearDown(): void + protected function tearDown() : void { if (\file_exists(__DIR__ . '/spreadsheet.db')) { \unlink(__DIR__ . '/spreadsheet.db');