From 0dfcb0a19c87df46af9fa0cbaa7215eac7d98d9e Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 10:41:30 -0400 Subject: [PATCH 01/21] Sort .gitignore --- .gitignore | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index cb308cf..b7abcb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,15 @@ -.idea/ -.vscode/ -vendor/ -composer.phar -composer.lock +*.sublime-* +.DS_Store .phpunit.result.cache -coverage/ -*.sublime* +.runway-config.json +.runway-creds.json +/.idea +/.vscode +/coverage +/vendor clover.xml +composer.lock +composer.phar phpcs.xml phpstan.neon phpunit.xml -.runway-config.json -.runway-creds.json -.DS_Store From a148d8750fb17e1a28a2dbffe10cef6ead802626 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 10:49:25 -0400 Subject: [PATCH 02/21] Simplify code coverage generation --- composer.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/composer.json b/composer.json index 70a09ca..a667866 100644 --- a/composer.json +++ b/composer.json @@ -72,7 +72,6 @@ "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 +84,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", From 34bc93cccca1e03d2a27c4ef29573cb613ecc59f Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 10:58:27 -0400 Subject: [PATCH 03/21] Combine PHPStan and PHPCS in lint script --- composer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 70a09ca..17c4cda 100644 --- a/composer.json +++ b/composer.json @@ -99,9 +99,11 @@ "rm server.pid", "echo \"Performance Tests Completed.\"" ], - "lint": "phpstan --no-progress --memory-limit=256M", + "lint": [ + "phpstan --no-progress --memory-limit=256M -n", + "phpcs" + ], "beautify": "phpcbf", - "phpcs": "phpcs", "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');\"", From df326534feb2feecf623e9f1a69167484b25276f Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:07:53 -0400 Subject: [PATCH 04/21] let composer sort require-dev --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 70a09ca..533b6fe 100644 --- a/composer.json +++ b/composer.json @@ -45,8 +45,8 @@ } }, "require-dev": { - "ext-mbstring": "*", "ext-fileinfo": "*", + "ext-mbstring": "*", "ext-pdo_sqlite": "*", "flightphp/container": "^1.3", "flightphp/runway": "^1.2", From 2aa8515b111b8642b29a1d0534d7ca2ca9a229bd Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:08:04 -0400 Subject: [PATCH 05/21] update phpstan ^2.2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 533b6fe..204c516 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "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", "squizlabs/php_codesniffer": "^4.0" From fbfdcc5a23e4934dec835be082699ff1a748e12b Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:08:30 -0400 Subject: [PATCH 06/21] add schema to phpstan.dist.neon for autocomplete --- phpstan.dist.neon | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 57ab298..26c1754 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fadrian06/phpstan/refs/heads/add-schema/schema.json + includes: - vendor/phpstan/phpstan/conf/bleedingEdge.neon - phpstan-baseline.neon From 104f344352c1a8ed1c9be8f50ad1fd57dd44abd1 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:08:54 -0400 Subject: [PATCH 07/21] remove index.php from phpstan --- phpstan.dist.neon | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 26c1754..a2fff61 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -8,5 +8,4 @@ parameters: level: 6 paths: - flight - - index.php treatPhpDocTypesAsCertain: false From ec3c2ec04e1dbfffdb8c12e004f4a72f0940adab Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:09:09 -0400 Subject: [PATCH 08/21] enable treat phpdoc types as certain --- phpstan.dist.neon | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.dist.neon b/phpstan.dist.neon index a2fff61..2928eca 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -8,4 +8,3 @@ parameters: level: 6 paths: - flight - treatPhpDocTypesAsCertain: false From 5ac0ab48a7fe73a14d390876ba6a16d750379d5b Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:37:29 -0400 Subject: [PATCH 09/21] Fix Property flight\net\Route::$alias (string) on left side of ?? is not nullable. --- flight/commands/RouteCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/commands/RouteCommand.php b/flight/commands/RouteCommand.php index 0ff8dc0..b35f03e 100644 --- a/flight/commands/RouteCommand.php +++ b/flight/commands/RouteCommand.php @@ -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) : '-' ]; From 2c47c5ec0e207542fee7278a5f426d7058a36e1d Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:38:18 -0400 Subject: [PATCH 10/21] simplify Request@getHeader and @header docblocks --- flight/net/Request.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/flight/net/Request.php b/flight/net/Request.php index fdaa7cb..24f02a5 100644 --- a/flight/net/Request.php +++ b/flight/net/Request.php @@ -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); } From 04afcb16e88151746149b0788b3fb7200e91aba5 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:38:37 -0400 Subject: [PATCH 11/21] disable again phpstan treatPhpDocTypesAsCertain --- phpstan.dist.neon | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 2928eca..a2fff61 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -8,3 +8,4 @@ parameters: level: 6 paths: - flight + treatPhpDocTypesAsCertain: false From 3eb34464fbc9f29077cae40f0c52919de4a3b1e2 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:39:05 -0400 Subject: [PATCH 12/21] save Dispatcher::parseStringClassAndMethod phpstan ignore to fix later --- phpstan-baseline.neon | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e69de29..0db8468 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -0,0 +1,7 @@ +parameters: + ignoreErrors: + - + rawMessage: 'Method flight\core\Dispatcher::parseStringClassAndMethod() should return array{class-string|object, string} but returns non-empty-list.' + identifier: return.type + count: 1 + path: flight/core/Dispatcher.php From 23d749b8c0ae3ea446d0df1c5155c607d1b40743 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:40:53 -0400 Subject: [PATCH 13/21] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- phpstan.dist.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.dist.neon b/phpstan.dist.neon index a2fff61..1d9e153 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -1,4 +1,4 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/fadrian06/phpstan/refs/heads/add-schema/schema.json +# yaml-language-server: $schema=https://raw.githubusercontent.com/fadrian06/phpstan/add-schema/schema.json includes: - vendor/phpstan/phpstan/conf/bleedingEdge.neon From 2f533dcdf41428d340e3f06410f33c1f86251ad7 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:44:11 -0400 Subject: [PATCH 14/21] Combine phpcs in lint in ai instructions --- .gemini/GEMINI.md | 3 +-- .github/copilot-instructions.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.gemini/GEMINI.md b/.gemini/GEMINI.md index 59a33e4..4c6da83 100644 --- a/.gemini/GEMINI.md +++ b/.gemini/GEMINI.md @@ -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) +- Lint code & Check code style: `composer lint` (uses phpstan/phpstan, level 6) - Beautify code: `composer beautify` (uses squizlabs/php_codesniffer, PSR1) -- Check code style: `composer phpcs` - Test coverage: `composer test-coverage` ## Coding Standards diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 59a33e4..4c6da83 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -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) +- Lint code & Check code style: `composer lint` (uses phpstan/phpstan, level 6) - Beautify code: `composer beautify` (uses squizlabs/php_codesniffer, PSR1) -- Check code style: `composer phpcs` - Test coverage: `composer test-coverage` ## Coding Standards From 867a5647084644c977dc90ace5db0a4842ef8607 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:52:15 -0400 Subject: [PATCH 15/21] composer require -W --dev spatie/phpunit-watcher --- composer.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 70a09ca..ed7742a 100644 --- a/composer.json +++ b/composer.json @@ -56,6 +56,7 @@ "phpstan/phpstan": "^2.1", "phpunit/phpunit": "^9.6", "rregeer/phpunit-coverage-check": "^0.3.1", + "spatie/phpunit-watcher": "^1.23", "squizlabs/php_codesniffer": "^4.0" }, "config": { @@ -67,10 +68,7 @@ }, "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", From 036a9a53155198275e7bea283de4e49b2026a0ed Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:52:31 -0400 Subject: [PATCH 16/21] sort phpunit-watcher.yml --- phpunit-watcher.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/phpunit-watcher.yml b/phpunit-watcher.yml index 5b5fe13..d942a41 100644 --- a/phpunit-watcher.yml +++ b/phpunit-watcher.yml @@ -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' From 6d0bbdb9a6db773190cbd2f14aa6ebd232518e39 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:53:09 -0400 Subject: [PATCH 17/21] ignore .phpunit-watcher.yml to allow contributors customize phpunit-watcher --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cb308cf..ee01cae 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ phpunit.xml .runway-config.json .runway-creds.json .DS_Store +.phpunit-watcher.yml From e3f314b2acfd4028558dcbd99369c2acef3200df Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 11:56:27 -0400 Subject: [PATCH 18/21] add .phpunit-watcher.yml creation after composer install --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ed7742a..b0d02df 100644 --- a/composer.json +++ b/composer.json @@ -103,7 +103,8 @@ "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": { From c975f5551bccf28ec405d4d0a0387d557a71bdfd Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 12:11:35 -0400 Subject: [PATCH 19/21] rename beautify -> format --- composer.json | 2 +- phpcs.xml.dist | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 70a09ca..f0e1da1 100644 --- a/composer.json +++ b/composer.json @@ -100,7 +100,7 @@ "echo \"Performance Tests Completed.\"" ], "lint": "phpstan --no-progress --memory-limit=256M", - "beautify": "phpcbf", + "format": "phpcbf -q", "phpcs": "phpcs", "post-install-cmd": [ "@php -r \"if (!file_exists('phpcs.xml')) copy('phpcs.xml.dist', 'phpcs.xml');\"", diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 2c95c3e..6694874 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -2,26 +2,10 @@ - - - - - - - - - - - - - - - - - - - index.php flight tests + + + From 760ac1a858c734040cbec0bedebacf2a349594c9 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 12:12:01 -0400 Subject: [PATCH 20/21] composer format --- tests/SimplePdoTest.php | 2 +- tests/named-arguments/FlightTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/SimplePdoTest.php b/tests/SimplePdoTest.php index 4e97dd7..08f8e16 100644 --- a/tests/SimplePdoTest.php +++ b/tests/SimplePdoTest.php @@ -88,7 +88,7 @@ class SimplePdoTest extends TestCase public function testRunQueryWithoutParamsWithMaxQueryMetrics(): void { - $db = new class( + $db = new class ( 'sqlite::memory:', null, null, diff --git a/tests/named-arguments/FlightTest.php b/tests/named-arguments/FlightTest.php index 6593450..0d5abff 100644 --- a/tests/named-arguments/FlightTest.php +++ b/tests/named-arguments/FlightTest.php @@ -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) { // From 4e244c8172b1684c933e1c9a000e50a069fc22de Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Tue, 23 Jun 2026 12:17:58 -0400 Subject: [PATCH 21/21] rename beautify -> format in ai instructions --- .gemini/GEMINI.md | 2 +- .github/copilot-instructions.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemini/GEMINI.md b/.gemini/GEMINI.md index 59a33e4..9161c9f 100644 --- a/.gemini/GEMINI.md +++ b/.gemini/GEMINI.md @@ -16,7 +16,7 @@ This is the main FlightPHP core library for building fast, simple, and extensibl - 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) +- Format code: `composer format` (uses squizlabs/php_codesniffer, PSR1) - Check code style: `composer phpcs` - Test coverage: `composer test-coverage` diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 59a33e4..9161c9f 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -16,7 +16,7 @@ This is the main FlightPHP core library for building fast, simple, and extensibl - 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) +- Format code: `composer format` (uses squizlabs/php_codesniffer, PSR1) - Check code style: `composer phpcs` - Test coverage: `composer test-coverage`