Apply some fixes of phpcs

pull/567/head
fadrian06 11 months ago
parent fcfe8adc5d
commit 3fba60ca7f

@ -27,7 +27,8 @@ use flight\net\Route;
* # Core methods
* @method void start() Starts engine
* @method void stop() Stops framework and outputs current response
* @method void halt(int $code = 200, string $message = '', bool $actuallyExit = true) Stops processing and returns a given response.
* @method void halt(int $code = 200, string $message = '', bool $actuallyExit = true)
* Stops processing and returns a given response.
*
* # Routing
* @method Route route(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
@ -464,7 +465,12 @@ class Engine
// Run any before middlewares
if (count($route->middleware) > 0) {
$at_least_one_middleware_failed = $this->processMiddleware($route->middleware, $route->params, 'before');
$at_least_one_middleware_failed = $this->processMiddleware(
$route->middleware,
$route->params,
'before'
);
if ($at_least_one_middleware_failed === true) {
$failed_middleware_check = true;
break;

@ -10,8 +10,6 @@ use flight\net\Router;
use flight\template\View;
use flight\net\Route;
require_once __DIR__ . '/autoload.php';
/**
* The Flight class is a static representation of the framework.
*
@ -140,6 +138,8 @@ class Flight
*/
public static function __callStatic(string $name, array $params)
{
require_once __DIR__ . '/autoload.php';
return Dispatcher::invokeMethod([self::app(), $name], $params);
}
@ -147,8 +147,6 @@ class Flight
public static function app(): Engine
{
if (!self::$initialized) {
require_once __DIR__ . '/autoload.php';
self::setEngine(new Engine());
self::$initialized = true;
}

@ -1,7 +1,9 @@
<?php
// require 'flight/Flight.php';
require 'flight/autoload.php';
declare(strict_types=1);
require 'flight/Flight.php';
// require 'flight/autoload.php';
Flight::route('/', function () {
echo 'hello world!';

@ -9,12 +9,11 @@
</description>
<arg name="colors" />
<arg name="tab-width" value="4" />
<rule ref="PSR12" />
<rule ref="PSR1">
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
<rule ref="PSR12" />
<rule ref="Generic">
<exclude name="Generic.Files.LineEndings.InvalidEOLChar" />
<exclude name="Generic.PHP.ClosingPHPTag.NotFound" />
<exclude name="Generic.PHP.UpperCaseConstant.Found" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
@ -39,6 +38,11 @@
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen" />
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose" />
</rule>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="ignoreComments" value="true" />
</properties>
</rule>
<file>flight/</file>
<file>tests/</file>
<exclude-pattern>tests/views/*</exclude-pattern>

Loading…
Cancel
Save