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 * # Core methods
* @method void start() Starts engine * @method void start() Starts engine
* @method void stop() Stops framework and outputs current response * @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 * # Routing
* @method Route route(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') * @method Route route(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
@ -464,7 +465,12 @@ class Engine
// Run any before middlewares // Run any before middlewares
if (count($route->middleware) > 0) { 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) { if ($at_least_one_middleware_failed === true) {
$failed_middleware_check = true; $failed_middleware_check = true;
break; break;

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

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

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

Loading…
Cancel
Save