From 79c92da8c14de61dccc015f04c3900aac4bd4179 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 24 Apr 2019 11:01:37 +0200 Subject: Formatting ```bash php-cs-fixer fix --allow-risky=yes --rules=@PSR2,psr4,mb_str_functions.php_unit_construct,php_unit_ordered_covers,trailing_comma_in_multiline_array --rules='{"array_syntax": {"syntax":"short"}}' [tests/|src/] ``` --- src/Config/ConfigServiceProvider.php | 2 +- src/Container/ServiceProvider.php | 8 ++++++-- src/Controllers/Metrics/Controller.php | 4 ++-- src/Controllers/Metrics/MetricsEngine.php | 3 ++- src/Controllers/Metrics/Stats.php | 2 +- src/Database/Migration/Migrate.php | 3 ++- src/Exceptions/Handlers/Legacy.php | 3 ++- src/Exceptions/Handlers/LegacyDevelopment.php | 2 +- src/Http/Exceptions/HttpException.php | 2 +- src/Http/MessageTrait.php | 1 - src/Http/Psr7ServiceProvider.php | 1 - src/Http/Request.php | 3 +-- src/Http/UrlGenerator.php | 2 +- src/Logger/EngelsystemLogger.php | 5 +++++ src/Mail/Transport/Transport.php | 12 +++++++++--- src/Middleware/LegacyMiddleware.php | 2 +- 16 files changed, 35 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/Config/ConfigServiceProvider.php b/src/Config/ConfigServiceProvider.php index cb8e96ce..2c320fdd 100644 --- a/src/Config/ConfigServiceProvider.php +++ b/src/Config/ConfigServiceProvider.php @@ -59,8 +59,8 @@ class ConfigServiceProvider extends ServiceProvider /** @var Config $config */ $config = $this->app->get('config'); - /** @var EventConfig[] $values */ try { + /** @var EventConfig[] $values */ $values = $this->eventConfig->newQuery()->get(['name', 'value']); } catch (QueryException $e) { return; diff --git a/src/Container/ServiceProvider.php b/src/Container/ServiceProvider.php index 2a1bbebf..c9a0324e 100644 --- a/src/Container/ServiceProvider.php +++ b/src/Container/ServiceProvider.php @@ -22,10 +22,14 @@ abstract class ServiceProvider /** * Register container bindings */ - public function register() { } + public function register() + { + } /** * Called after other services had been registered */ - public function boot() { } + public function boot() + { + } } diff --git a/src/Controllers/Metrics/Controller.php b/src/Controllers/Metrics/Controller.php index 86c21562..e0824c05 100644 --- a/src/Controllers/Metrics/Controller.php +++ b/src/Controllers/Metrics/Controller.php @@ -117,7 +117,7 @@ class Controller extends BaseController 'type' => 'counter', [ 'labels' => ['level' => LogLevel::EMERGENCY], - 'value' => $this->stats->logEntries(LogLevel::EMERGENCY) + 'value' => $this->stats->logEntries(LogLevel::EMERGENCY), ], ['labels' => ['level' => LogLevel::ALERT], 'value' => $this->stats->logEntries(LogLevel::ALERT)], ['labels' => ['level' => LogLevel::CRITICAL], 'value' => $this->stats->logEntries(LogLevel::CRITICAL)], @@ -132,7 +132,7 @@ class Controller extends BaseController $data['scrape_duration_seconds'] = [ 'type' => 'gauge', 'help' => 'Duration of the current request', - microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT', $now) + microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT', $now), ]; return $this->response diff --git a/src/Controllers/Metrics/MetricsEngine.php b/src/Controllers/Metrics/MetricsEngine.php index eeb47d8a..1e0f6957 100644 --- a/src/Controllers/Metrics/MetricsEngine.php +++ b/src/Controllers/Metrics/MetricsEngine.php @@ -69,7 +69,8 @@ class MetricsEngine implements EngineInterface '%s%s %s', $name, $this->renderLabels($row), - $this->renderValue($row)); + $this->renderValue($row) + ); } /** diff --git a/src/Controllers/Metrics/Stats.php b/src/Controllers/Metrics/Stats.php index c841be10..a2b37d0c 100644 --- a/src/Controllers/Metrics/Stats.php +++ b/src/Controllers/Metrics/Stats.php @@ -27,6 +27,7 @@ class Stats */ public function arrivedUsers($working = null): int { + /** @var QueryBuilder $query */ $query = $this ->getQuery('users') ->join('users_state', 'user_id', '=', 'id') @@ -40,7 +41,6 @@ class Stats ->distinct(); $query->where(function ($query) use ($working) { - /** @var QueryBuilder $query */ if ($working) { $query ->whereNotNull('ShiftEntry.SID') diff --git a/src/Database/Migration/Migrate.php b/src/Database/Migration/Migrate.php index 4e238152..c8ee9456 100644 --- a/src/Database/Migration/Migrate.php +++ b/src/Database/Migration/Migrate.php @@ -36,7 +36,8 @@ class Migrate { $this->app = $app; $this->schema = $schema; - $this->output = function () { }; + $this->output = function () { + }; } /** diff --git a/src/Exceptions/Handlers/Legacy.php b/src/Exceptions/Handlers/Legacy.php index 39683f72..461dabe1 100644 --- a/src/Exceptions/Handlers/Legacy.php +++ b/src/Exceptions/Handlers/Legacy.php @@ -21,7 +21,8 @@ class Legacy implements HandlerInterface */ public function report(Throwable $e) { - error_log(sprintf('Exception: Code: %s, Message: %s, File: %s:%u, Trace: %s', + error_log(sprintf( + 'Exception: Code: %s, Message: %s, File: %s:%u, Trace: %s', $e->getCode(), $e->getMessage(), $this->stripBasePath($e->getFile()), diff --git a/src/Exceptions/Handlers/LegacyDevelopment.php b/src/Exceptions/Handlers/LegacyDevelopment.php index 86f86f4c..cfa4efa4 100644 --- a/src/Exceptions/Handlers/LegacyDevelopment.php +++ b/src/Exceptions/Handlers/LegacyDevelopment.php @@ -48,7 +48,7 @@ class LegacyDevelopment extends Legacy $return[] = [ 'file' => $path . ':' . $line, - $functionName => isset($trace['args']) ? $trace['args'] : null, + $functionName => $trace['args'] ?? null, ]; } diff --git a/src/Http/Exceptions/HttpException.php b/src/Http/Exceptions/HttpException.php index 07853d1e..6efc2fad 100644 --- a/src/Http/Exceptions/HttpException.php +++ b/src/Http/Exceptions/HttpException.php @@ -48,4 +48,4 @@ class HttpException extends RuntimeException { return $this->statusCode; } -} \ No newline at end of file +} diff --git a/src/Http/MessageTrait.php b/src/Http/MessageTrait.php index 17fbf5db..0b12ce61 100644 --- a/src/Http/MessageTrait.php +++ b/src/Http/MessageTrait.php @@ -2,7 +2,6 @@ namespace Engelsystem\Http; - use Nyholm\Psr7\Stream; use Psr\Http\Message\StreamInterface; diff --git a/src/Http/Psr7ServiceProvider.php b/src/Http/Psr7ServiceProvider.php index a9194272..d58ee6e9 100644 --- a/src/Http/Psr7ServiceProvider.php +++ b/src/Http/Psr7ServiceProvider.php @@ -13,7 +13,6 @@ use Psr\Http\Message\UploadedFileFactoryInterface; use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory; use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface; - class Psr7ServiceProvider extends ServiceProvider { public function register() diff --git a/src/Http/Request.php b/src/Http/Request.php index 8b5abf2f..0e1acf76 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -328,9 +328,8 @@ class Request extends SymfonyRequest implements ServerRequestInterface public function getUploadedFiles() { $files = []; + /** @var SymfonyFile $file */ foreach ($this->files as $file) { - /** @var SymfonyFile $file */ - $files[] = new UploadedFile( $file->getRealPath(), $file->getSize(), diff --git a/src/Http/UrlGenerator.php b/src/Http/UrlGenerator.php index 7ced769e..d84a02b5 100644 --- a/src/Http/UrlGenerator.php +++ b/src/Http/UrlGenerator.php @@ -4,7 +4,7 @@ namespace Engelsystem\Http; /** * Provides urls when rewriting on the webserver is enabled. (default) - * + * * The urls have the form /? */ class UrlGenerator implements UrlGeneratorInterface diff --git a/src/Logger/EngelsystemLogger.php b/src/Logger/EngelsystemLogger.php index aab8026a..aead90fb 100644 --- a/src/Logger/EngelsystemLogger.php +++ b/src/Logger/EngelsystemLogger.php @@ -23,6 +23,11 @@ class EngelsystemLogger extends AbstractLogger /** @var LogEntry */ protected $log; + /** + * EngelsystemLogger constructor. + * + * @param LogEntry $log + */ public function __construct(LogEntry $log) { $this->log = $log; diff --git a/src/Mail/Transport/Transport.php b/src/Mail/Transport/Transport.php index 691faf60..b83620a6 100644 --- a/src/Mail/Transport/Transport.php +++ b/src/Mail/Transport/Transport.php @@ -21,12 +21,16 @@ abstract class Transport implements SwiftTransport /** * Start this Transport mechanism. */ - public function start() { } + public function start() + { + } /** * Stop this Transport mechanism. */ - public function stop() { } + public function stop() + { + } /** * Check if this Transport mechanism is alive. @@ -59,7 +63,9 @@ abstract class Transport implements SwiftTransport * * @param Swift_Events_EventListener $plugin */ - public function registerPlugin(Swift_Events_EventListener $plugin) { } + public function registerPlugin(Swift_Events_EventListener $plugin) + { + } /** * Returns a unified list of all recipients diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php index 0aca3813..2467f25c 100644 --- a/src/Middleware/LegacyMiddleware.php +++ b/src/Middleware/LegacyMiddleware.php @@ -29,7 +29,7 @@ class LegacyMiddleware implements MiddlewareInterface 'users', 'user_driver_licenses', 'user_password_recovery', - 'user_worklog' + 'user_worklog', ]; /** @var ContainerInterface */ -- cgit v1.2.3-54-g00ecf