Fixed PHPStan detections.

This commit is contained in:
flash 2024-03-28 20:14:54 +00:00
parent 154d82de02
commit 5cda6fbe25
3 changed files with 84 additions and 71 deletions

144
composer.lock generated
View File

@ -68,16 +68,16 @@
},
{
"name": "nikic/php-parser",
"version": "v5.0.0",
"version": "v5.0.2",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc"
"reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13",
"reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13",
"shasum": ""
},
"require": {
@ -120,26 +120,27 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2"
},
"time": "2024-01-07T17:17:35+00:00"
"time": "2024-03-05T20:51:40+00:00"
},
{
"name": "phar-io/manifest",
"version": "2.0.3",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/phar-io/manifest.git",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53"
"reference": "54750ef60c58e43759730615a392c31c80e23176"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176",
"reference": "54750ef60c58e43759730615a392c31c80e23176",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-phar": "*",
"ext-xmlwriter": "*",
"phar-io/version": "^3.0.1",
@ -180,9 +181,15 @@
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": {
"issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/2.0.3"
"source": "https://github.com/phar-io/manifest/tree/2.0.4"
},
"time": "2021-07-20T11:28:43+00:00"
"funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
"time": "2024-03-03T12:33:53+00:00"
},
{
"name": "phar-io/version",
@ -237,16 +244,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.10.57",
"version": "1.10.66",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e"
"reference": "94779c987e4ebd620025d9e5fdd23323903950bd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e",
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/94779c987e4ebd620025d9e5fdd23323903950bd",
"reference": "94779c987e4ebd620025d9e5fdd23323903950bd",
"shasum": ""
},
"require": {
@ -295,20 +302,20 @@
"type": "tidelift"
}
],
"time": "2024-01-24T11:51:34+00:00"
"time": "2024-03-28T16:17:31+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "10.1.11",
"version": "10.1.14",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "78c3b7625965c2513ee96569a4dbb62601784145"
"reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145",
"reference": "78c3b7625965c2513ee96569a4dbb62601784145",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b",
"reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b",
"shasum": ""
},
"require": {
@ -365,7 +372,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14"
},
"funding": [
{
@ -373,7 +380,7 @@
"type": "github"
}
],
"time": "2023-12-21T15:38:30+00:00"
"time": "2024-03-12T15:33:41+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -620,16 +627,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.5.10",
"version": "10.5.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "50b8e314b6d0dd06521dc31d1abffa73f25f850c"
"reference": "18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/50b8e314b6d0dd06521dc31d1abffa73f25f850c",
"reference": "50b8e314b6d0dd06521dc31d1abffa73f25f850c",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd",
"reference": "18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd",
"shasum": ""
},
"require": {
@ -701,7 +708,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.10"
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.16"
},
"funding": [
{
@ -717,20 +724,20 @@
"type": "tidelift"
}
],
"time": "2024-02-04T09:07:51+00:00"
"time": "2024-03-28T10:08:10+00:00"
},
{
"name": "sebastian/cli-parser",
"version": "2.0.0",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/cli-parser.git",
"reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae"
"reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae",
"reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae",
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084",
"reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084",
"shasum": ""
},
"require": {
@ -765,7 +772,8 @@
"homepage": "https://github.com/sebastianbergmann/cli-parser",
"support": {
"issues": "https://github.com/sebastianbergmann/cli-parser/issues",
"source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0"
"security": "https://github.com/sebastianbergmann/cli-parser/security/policy",
"source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1"
},
"funding": [
{
@ -773,7 +781,7 @@
"type": "github"
}
],
"time": "2023-02-03T06:58:15+00:00"
"time": "2024-03-02T07:12:49+00:00"
},
{
"name": "sebastian/code-unit",
@ -1023,16 +1031,16 @@
},
{
"name": "sebastian/diff",
"version": "5.1.0",
"version": "5.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f"
"reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e",
"reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e",
"shasum": ""
},
"require": {
@ -1040,7 +1048,7 @@
},
"require-dev": {
"phpunit/phpunit": "^10.0",
"symfony/process": "^4.2 || ^5"
"symfony/process": "^6.4"
},
"type": "library",
"extra": {
@ -1078,7 +1086,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"security": "https://github.com/sebastianbergmann/diff/security/policy",
"source": "https://github.com/sebastianbergmann/diff/tree/5.1.0"
"source": "https://github.com/sebastianbergmann/diff/tree/5.1.1"
},
"funding": [
{
@ -1086,20 +1094,20 @@
"type": "github"
}
],
"time": "2023-12-22T10:55:06+00:00"
"time": "2024-03-02T07:15:17+00:00"
},
{
"name": "sebastian/environment",
"version": "6.0.1",
"version": "6.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951"
"reference": "8074dbcd93529b357029f5cc5058fd3e43666984"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951",
"reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984",
"reference": "8074dbcd93529b357029f5cc5058fd3e43666984",
"shasum": ""
},
"require": {
@ -1114,7 +1122,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "6.0-dev"
"dev-main": "6.1-dev"
}
},
"autoload": {
@ -1142,7 +1150,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"security": "https://github.com/sebastianbergmann/environment/security/policy",
"source": "https://github.com/sebastianbergmann/environment/tree/6.0.1"
"source": "https://github.com/sebastianbergmann/environment/tree/6.1.0"
},
"funding": [
{
@ -1150,20 +1158,20 @@
"type": "github"
}
],
"time": "2023-04-11T05:39:26+00:00"
"time": "2024-03-23T08:47:14+00:00"
},
{
"name": "sebastian/exporter",
"version": "5.1.1",
"version": "5.1.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc"
"reference": "955288482d97c19a372d3f31006ab3f37da47adf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc",
"reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf",
"reference": "955288482d97c19a372d3f31006ab3f37da47adf",
"shasum": ""
},
"require": {
@ -1220,7 +1228,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"security": "https://github.com/sebastianbergmann/exporter/security/policy",
"source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1"
"source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2"
},
"funding": [
{
@ -1228,20 +1236,20 @@
"type": "github"
}
],
"time": "2023-09-24T13:22:09+00:00"
"time": "2024-03-02T07:17:12+00:00"
},
{
"name": "sebastian/global-state",
"version": "6.0.1",
"version": "6.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4"
"reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4",
"reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9",
"reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9",
"shasum": ""
},
"require": {
@ -1275,14 +1283,14 @@
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"homepage": "https://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"security": "https://github.com/sebastianbergmann/global-state/security/policy",
"source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1"
"source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2"
},
"funding": [
{
@ -1290,7 +1298,7 @@
"type": "github"
}
],
"time": "2023-07-19T07:19:23+00:00"
"time": "2024-03-02T07:19:19+00:00"
},
{
"name": "sebastian/lines-of-code",
@ -1636,16 +1644,16 @@
},
{
"name": "theseer/tokenizer",
"version": "1.2.2",
"version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96"
"reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
"reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2",
"reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2",
"shasum": ""
},
"require": {
@ -1674,7 +1682,7 @@
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/1.2.2"
"source": "https://github.com/theseer/tokenizer/tree/1.2.3"
},
"funding": [
{
@ -1682,7 +1690,7 @@
"type": "github"
}
],
"time": "2023-11-20T00:12:19+00:00"
"time": "2024-03-03T12:36:25+00:00"
}
],
"aliases": [],

View File

@ -5,11 +5,14 @@
namespace Index\Http\Routing;
use Attribute;
use ReflectionObject;
/**
* Provides an attribute for marking methods in a class as handlers.
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
abstract class HandlerAttribute {
class HandlerAttribute {
public function __construct(private string $path) {}
/**

View File

@ -9,7 +9,7 @@ class ResolvedRouteInfo {
public function __construct(
private array $middlewares,
private array $supportedMethods,
private ?callable $handler,
private mixed $handler,
private array $args,
) {}
@ -19,6 +19,8 @@ class ResolvedRouteInfo {
if($result !== null)
return $result;
}
return null;
}
public function hasHandler(): bool {
@ -34,6 +36,6 @@ class ResolvedRouteInfo {
}
public function dispatch(array $args): mixed {
return $this->handler(...array_merge($args, $this->args));
return ($this->handler)(...array_merge($args, $this->args));
}
}