Added code format

pull/498/head
fadrian06 1 year ago
parent ba0c6bda33
commit 42ec161d8a

@ -0,0 +1,12 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
indent_size = 2

1
.gitignore vendored

@ -2,3 +2,4 @@
vendor/
composer.phar
composer.lock
*.sublime-workspace

@ -22,7 +22,10 @@
"ext-json": "*"
},
"autoload": {
"files": [ "flight/autoload.php", "flight/Flight.php" ]
"files": [
"flight/autoload.php",
"flight/Flight.php"
]
},
"require-dev": {
"phpunit/phpunit": "^9.5",

@ -0,0 +1,21 @@
{
"folders": [
{
"path": ".",
}
],
"settings": {
"LSP": {
"LSP-intelephense": {
"settings": {
"intelephense.environment.phpVersion": "7.4.0",
"intelephense.format.braces": "psr12",
},
},
"formatters":
{
"embedding.php": "LSP-intelephense"
},
},
},
}

@ -397,9 +397,10 @@ class Engine
*/
public function _error($e): void
{
$msg = sprintf('<h1>500 Internal Server Error</h1>' .
'<h3>%s (%s)</h3>' .
'<pre>%s</pre>',
$msg = sprintf(
'<h1>500 Internal Server Error</h1>' .
'<h3>%s (%s)</h3>' .
'<pre>%s</pre>',
$e->getMessage(),
$e->getCode(),
$e->getTraceAsString()
@ -524,8 +525,8 @@ class Engine
->status(404)
->write(
'<h1>404 Not Found</h1>' .
'<h3>The page you have requested could not be found.</h3>' .
str_repeat(' ', 512)
'<h3>The page you have requested could not be found.</h3>' .
str_repeat(' ', 512)
)
->send();
}
@ -644,8 +645,10 @@ class Engine
$this->response()->header('ETag', $id);
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
$_SERVER['HTTP_IF_NONE_MATCH'] === $id) {
if (
isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
$_SERVER['HTTP_IF_NONE_MATCH'] === $id
) {
$this->halt(304);
}
}
@ -659,8 +662,10 @@ class Engine
{
$this->response()->header('Last-Modified', gmdate('D, d M Y H:i:s \G\M\T', $time));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $time) {
if (
isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $time
) {
$this->halt(304);
}
}

@ -23,7 +23,7 @@ use flight\template\View;
* @method static void stop() Stops the framework and sends a response.
* @method static void halt(int $code = 200, string $message = '') Stop the framework with an optional status code and message.
*
* @method static void route(string $pattern, callable $callback) Maps a URL pattern to a callback.
* @method static void route(string $pattern, callable $callback, bool $pass_route = false) Maps a URL pattern to a callback.
* @method static Router router() Returns Router instance.
*
* @method static void map(string $name, callable $callback) Creates a custom framework method.
@ -80,8 +80,9 @@ class Flight
* @param ?Closure(T $instance): void $callback Perform actions with the instance
* @return void
*/
static function register($name, $class, $params = array(), $callback = null) {
static::__callStatic('register', func_get_args());
static function register($name, $class, $params = array(), $callback = null)
{
static::__callStatic('register', func_get_args());
}
/**

@ -251,7 +251,8 @@ class Response
'%s %d %s',
$_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1',
$this->status,
self::$codes[$this->status]),
self::$codes[$this->status]
),
true,
$this->status
);

@ -0,0 +1,3 @@
<?php
class ReturnTypeWillChange {}

@ -1,10 +1,10 @@
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
level: 6
excludePaths:
- vendor
paths:
- flight
- index.php
level: 6
excludePaths:
- vendor
paths:
- flight
- index.php

Loading…
Cancel
Save