Merge branch 'master' into sort-.gitignore

pull/703/head
n0nag0n 18 hours ago committed by GitHub
commit 61db3b2fcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,9 +15,8 @@ This is the main FlightPHP core library for building fast, simple, and extensibl
## Development & Testing
- Run tests: `composer test` (uses phpunit/phpunit and spatie/phpunit-watcher)
- Run test server: `composer test-server` or `composer test-server-v2`
- Lint code: `composer lint` (uses phpstan/phpstan, level 6)
- Beautify code: `composer beautify` (uses squizlabs/php_codesniffer, PSR1)
- Check code style: `composer phpcs`
- Lint code & Check code style: `composer lint` (uses phpstan/phpstan, level 6)
- Beautify code: `composer format` (uses squizlabs/php_codesniffer, PSR1)
- Test coverage: `composer test-coverage`
## Coding Standards

@ -15,9 +15,8 @@ This is the main FlightPHP core library for building fast, simple, and extensibl
## Development & Testing
- Run tests: `composer test` (uses phpunit/phpunit and spatie/phpunit-watcher)
- Run test server: `composer test-server` or `composer test-server-v2`
- Lint code: `composer lint` (uses phpstan/phpstan, level 6)
- Beautify code: `composer beautify` (uses squizlabs/php_codesniffer, PSR1)
- Check code style: `composer phpcs`
- Lint code & Check code style: `composer lint` (uses phpstan/phpstan, level 6)
- Beautify code: `composer format` (uses squizlabs/php_codesniffer, PSR1)
- Test coverage: `composer test-coverage`
## Coding Standards

3
.gitignore vendored

@ -13,3 +13,6 @@ composer.phar
phpcs.xml
phpstan.neon
phpunit.xml
.runway-config.json
.runway-creds.json
.phpunit-watcher.yml

@ -45,17 +45,18 @@
}
},
"require-dev": {
"ext-mbstring": "*",
"ext-fileinfo": "*",
"ext-mbstring": "*",
"ext-pdo_sqlite": "*",
"flightphp/container": "^1.3",
"flightphp/runway": "^1.2",
"league/container": "^4.2",
"level-2/dice": "^4.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan": "^2.2",
"phpunit/phpunit": "^9.6",
"rregeer/phpunit-coverage-check": "^0.3.1",
"spatie/phpunit-watcher": "^1.23",
"squizlabs/php_codesniffer": "^4.0"
},
"config": {
@ -67,12 +68,8 @@
},
"scripts": {
"test": "phpunit",
"test-watcher": [
"phpunit-watcher || composer global require spatie/phpunit-watcher --dev",
"phpunit-watcher watch"
],
"test-watcher": "phpunit-watcher watch",
"test-coverage": [
"rm -f clover.xml",
"@putenv XDEBUG_MODE=coverage",
"phpunit --coverage-html=coverage --coverage-clover=clover.xml",
"coverage-check clover.xml 100"
@ -85,11 +82,6 @@
"echo \"Running Test Server\"",
"@php -S localhost:8000 -t tests/server-v2"
],
"test-coverage:win": [
"del clover.xml",
"phpunit --coverage-html=coverage --coverage-clover=clover.xml",
"coverage-check clover.xml 100"
],
"test-performance": [
"echo \"Running Performance Tests...\"",
"@php -S localhost:8077 -t tests/performance/ > /dev/null 2>&1 & echo $! > server.pid",
@ -99,13 +91,16 @@
"rm server.pid",
"echo \"Performance Tests Completed.\""
],
"lint": "phpstan --no-progress --memory-limit=256M",
"beautify": "phpcbf",
"phpcs": "phpcs",
"lint": [
"phpstan --no-progress --memory-limit=256M -n",
"phpcs"
],
"format": "phpcbf -q",
"post-install-cmd": [
"@php -r \"if (!file_exists('phpcs.xml')) copy('phpcs.xml.dist', 'phpcs.xml');\"",
"@php -r \"if (!file_exists('phpstan.neon')) copy('phpstan.dist.neon', 'phpstan.neon');\"",
"@php -r \"if (!file_exists('phpunit.xml')) copy('phpunit.xml.dist', 'phpunit.xml');\""
"@php -r \"if (!file_exists('phpunit.xml')) copy('phpunit.xml.dist', 'phpunit.xml');\"",
"@php -r \"if (!file_exists('.phpunit-watcher.yml')) copy('phpunit-watcher.yml', '.phpunit-watcher.yml');\""
]
},
"suggest": {

@ -99,7 +99,7 @@ class RouteCommand extends AbstractBaseCommand
$arrayOfRoutes[] = [
'Pattern' => $route->pattern,
'Methods' => implode(', ', $route->methods),
'Alias' => $route->alias ?? '',
'Alias' => $route->alias,
'Streamed' => $route->is_streamed ? 'Yes' : 'No',
'Middleware' => !empty($middlewares) ? implode(",", $middlewares) : '-'
];

@ -348,10 +348,8 @@ class Request
*
* @param string $header Header name. Can be caps, lowercase, or mixed.
* @param string $default Default value if the header does not exist
*
* @return string
*/
public static function getHeader(string $header, $default = ''): string
public static function getHeader(string $header, string $default = ''): string
{
$header = 'HTTP_' . strtoupper(str_replace('-', '_', $header));
return self::getVar($header, $default);
@ -380,10 +378,8 @@ class Request
*
* @param string $header Header name. Can be caps, lowercase, or mixed.
* @param string $default Default value if the header does not exist
*
* @return string
*/
public static function header(string $header, $default = ''): string
public static function header(string $header, string $default = ''): string
{
return self::getHeader($header, $default);
}

@ -2,26 +2,10 @@
<ruleset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<!-- <arg name="report" value="source" /> -->
<!-- <arg name="report" value="summary" /> -->
<!-- <arg name="report" value="diff" /> -->
<arg name="report" value="full" />
<arg name="report-width" value="80" />
<arg name="colors" />
<arg name="encoding" value="utf-8" />
<arg name="tab-width" value="4" />
<rule ref="PSR1">
</rule>
<rule ref="PSR2">
</rule>
<rule ref="PSR12">
<exclude name="PSR12.Classes.AnonClassDeclaration.SpaceAfterKeyword"/>
</rule>
<file>index.php</file>
<file>flight</file>
<file>tests</file>
<rule ref="PSR1" />
<rule ref="PSR2" />
<rule ref="PSR12" />
</ruleset>

@ -0,0 +1,7 @@
parameters:
ignoreErrors:
-
rawMessage: 'Method flight\core\Dispatcher::parseStringClassAndMethod() should return array{class-string|object, string} but returns non-empty-list<string>.'
identifier: return.type
count: 1
path: flight/core/Dispatcher.php

@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/fadrian06/phpstan/add-schema/schema.json
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- phpstan-baseline.neon
@ -6,5 +8,4 @@ parameters:
level: 6
paths:
- flight
- index.php
treatPhpDocTypesAsCertain: false

@ -1,13 +1,13 @@
hideManual: true
watch:
directories:
- tests
- flight
fileMask: '*.php'
notifications:
passingTests: false
failingTests: false
passingTests: false
phpunit:
binaryPath: ./vendor/bin/phpunit
arguments: '--stop-on-failure'
binaryPath: ./vendor/bin/phpunit
timeout: 180
watch:
directories:
- tests
- flight
fileMask: '*.php'

@ -88,7 +88,7 @@ class SimplePdoTest extends TestCase
public function testRunQueryWithoutParamsWithMaxQueryMetrics(): void
{
$db = new class(
$db = new class (
'sqlite::memory:',
null,
null,

@ -75,7 +75,7 @@ final class FlightTest extends TestCase
{
$dateTime = new DateTimeImmutable();
$controller = new class($dateTime) {
$controller = new class ($dateTime) {
public function __construct(private DateTimeImmutable $dateTime)
{
//

Loading…
Cancel
Save