fix function return type hint cs

This commit is contained in:
Dennis Eichhorn 2020-03-29 12:50:25 +02:00
parent a72e781e02
commit ee06a96792
24 changed files with 38 additions and 38 deletions

View File

@ -65,7 +65,7 @@ class Point implements PointInterface
/**
* {@inheritdoc}
*/
public function getCoordinates(): array
public function getCoordinates() : array
{
return $this->coordinates;
}

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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');

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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,

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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());

View File

@ -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');