From fb643cd862207d1eb96f081721ff2ff5618b164f Mon Sep 17 00:00:00 2001 From: Rutam21 Date: Sun, 23 Oct 2022 01:17:21 +0530 Subject: [PATCH 1/7] Issue-4370: Added Code Analyzer To utopia-php/framework --- .github/ISSUE_TEMPLATE/bug.yaml | 3 +- .github/workflows/codeql-analysis.yml | 21 +++++++++ README.md | 2 +- composer.json | 8 +++- composer.lock | 63 ++++++++++++++++++++++++++- src/App.php | 2 - src/Response.php | 4 +- src/Validator/Range.php | 2 +- tests/Validator/ArrayListTest.php | 4 +- tests/e2e/ResponseTest.php | 3 ++ tests/e2e/server.php | 6 ++- 11 files changed, 101 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index ceb70666..c034a667 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -51,8 +51,7 @@ body: label: "🐘 PHP Version" description: "What version of PHP are you running?" options: - - PHP 7.3.x - - PHP 7.4.x + - PHP 8.0 - Different version (specify in environment) validations: required: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..efa930a0 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,21 @@ +name: "CodeQL" + +on: [pull_request] +jobs: + lint: + name: CodeQL + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - run: git checkout HEAD^2 + + - name: Run CodeQL + run: | + docker run --rm -v $PWD:/app composer sh -c \ + "composer install --profile --ignore-platform-reqs && composer check" + \ No newline at end of file diff --git a/README.md b/README.md index e170c8f9..c657d040 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ $app->run($request, $response); ## System Requirements -Utopia Framework requires PHP 7.3 or later. We recommend using the latest PHP version whenever possible. +Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible. ## More from Utopia diff --git a/composer.json b/composer.json index 701de8d8..751e2d68 100755 --- a/composer.json +++ b/composer.json @@ -11,14 +11,18 @@ "email": "eldad@appwrite.io" } ], + "scripts": { + "check": "./vendor/bin/phpstan analyse -l 5 src tests" + }, "autoload": { "psr-4": {"Utopia\\": "src/"} }, "require": { - "php": ">=8.0.0" + "php": ">=8.0" }, "require-dev": { "phpunit/phpunit": "^9.5.25", - "vimeo/psalm": "^4.27.0" + "vimeo/psalm": "^4.27.0", + "phpstan/phpstan": "1.9.x-dev" } } diff --git a/composer.lock b/composer.lock index ab25a46e..47418229 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c36fede687e8b4f6012d974a8ba48833", + "content-hash": "fd0519059e9165b087d98b1100b789b5", "packages": [], "packages-dev": [ { @@ -1162,6 +1162,65 @@ }, "time": "2022-03-15T21:29:03+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.8.8", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/08310ce271984587e2a4cda94e1ac66510a6ea07", + "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.8.8" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2022-10-06T12:51:57+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.17", @@ -3668,7 +3727,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.0.0" + "php": ">=8.0" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git a/src/App.php b/src/App.php index 61259910..2c3d0d56 100755 --- a/src/App.php +++ b/src/App.php @@ -757,10 +757,8 @@ public function run(Request $request, Response $response): static * @param string $key * @param array $param * @param mixed $value - * @param array $resources * * @throws Exception - * * @return void */ protected function validate(string $key, array $param, mixed $value): void diff --git a/src/Response.php b/src/Response.php index 8f58dde7..361d040f 100755 --- a/src/Response.php +++ b/src/Response.php @@ -485,9 +485,9 @@ protected function end(string $content = null): void * Generate HTTP response output including the response header (+cookies) and body and prints them. * * @param string $body - * @param bool $last * * @return void + * @param bool $end */ public function chunk(string $body = '', bool $end = false): void { @@ -623,11 +623,9 @@ protected function appendCookies(): static * * @param string $url complete absolute URI for redirection as required by the internet standard RFC 2616 (HTTP 1.1) * @param int $statusCode valid HTTP status code - * @param null $exit * * @throws Exception * @see http://tools.ietf.org/html/rfc2616 - * * @return void */ public function redirect(string $url, int $statusCode = 301): void diff --git a/src/Validator/Range.php b/src/Validator/Range.php index 80148e12..85a1e466 100755 --- a/src/Validator/Range.php +++ b/src/Validator/Range.php @@ -140,7 +140,7 @@ public function isValid(mixed $value): bool break; case self::TYPE_FLOAT: $value = $value + 0; - if(!is_float($value) && !is_int($value)) { + if(!is_float($value) && is_int($value)) { return false; } break; diff --git a/tests/Validator/ArrayListTest.php b/tests/Validator/ArrayListTest.php index b2cf4fd8..20969388 100755 --- a/tests/Validator/ArrayListTest.php +++ b/tests/Validator/ArrayListTest.php @@ -21,7 +21,7 @@ class ArrayListTest extends TestCase public function testCanValidateTextValues(): void { $arrayList = new ArrayList(new Text(100)); - $this->assertTrue($arrayList->isArray(), true); + $this->assertTrue($arrayList->isArray(), 'true'); $this->assertTrue($arrayList->isValid([0 => 'string', 1 => 'string'])); $this->assertTrue($arrayList->isValid(['string', 'string'])); $this->assertFalse($arrayList->isValid(['string', 'string', 3])); @@ -35,7 +35,7 @@ public function testCanValidateNumericValues(): void { $arrayList = new ArrayList(new Numeric()); $this->assertTrue($arrayList->isValid([1, 2, 3])); - $this->assertFalse($arrayList->isValid(1, '2', 3)); + $this->assertFalse($arrayList->isValid(1)); $this->assertFalse($arrayList->isValid('string')); $this->assertEquals(\Utopia\Validator::TYPE_MIXED, $arrayList->getType()); $this->assertInstanceOf(Numeric::class, $arrayList->getValidator()); diff --git a/tests/e2e/ResponseTest.php b/tests/e2e/ResponseTest.php index a23b15a3..aa4f6c95 100644 --- a/tests/e2e/ResponseTest.php +++ b/tests/e2e/ResponseTest.php @@ -14,6 +14,9 @@ public function setUp(): void public function tearDown(): void { + /** + * @phpstan-ignore-next-line + */ $this->client = null; } diff --git a/tests/e2e/server.php b/tests/e2e/server.php index e9d900b8..ceeea1e7 100644 --- a/tests/e2e/server.php +++ b/tests/e2e/server.php @@ -21,7 +21,8 @@ App::get('/chunked') ->inject('response') ->action(function ($response) { - /** @var Utopia/Response $response */ + /** @var Utopia /Response $response + * @phpstan-ignore-next-line */ foreach (["Hello ", "World!"] as $key => $word) { $response->chunk($word, $key == 1); } @@ -30,7 +31,8 @@ App::get('/redirect') ->inject('response') ->action(function($response) { - /** @var Utopia/Response $response */ + /** @var Utopia /Response $response + * @phpstan-ignore-next-line */ $response->redirect('/'); }); From 02aeab6dd256754cb6bdc780e2cf575bc9e2ee4d Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 27 Jan 2023 15:33:00 +0000 Subject: [PATCH 2/7] feat: linter fixes --- composer.json | 15 +-- composer.lock | 167 +++++++++++++++++---------------- src/App.php | 2 - src/Response.php | 5 +- src/Validator/IP.php | 1 - src/Validator/Range.php | 1 + tests/AppTest.php | 2 + tests/Validator/DomainTest.php | 2 +- tests/Validator/HostTest.php | 2 +- tests/Validator/IPTest.php | 4 +- tests/e2e/server.php | 6 +- 11 files changed, 101 insertions(+), 106 deletions(-) diff --git a/composer.json b/composer.json index 2969c2bf..3fb769b5 100644 --- a/composer.json +++ b/composer.json @@ -5,21 +5,13 @@ "keywords": ["php","framework", "upf"], "license": "MIT", "minimum-stability": "stable", - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - } - ], - "scripts": { - "check": "./vendor/bin/phpstan analyse -l 5 src tests" - }, "autoload": { "psr-4": {"Utopia\\": "src/"} }, "scripts": { "lint": "./vendor/bin/pint --test", - "format": "./vendor/bin/pint" + "format": "./vendor/bin/pint", + "check": "./vendor/bin/phpstan analyse -l 5 src tests" }, "require": { "php": ">=8.0" @@ -27,6 +19,7 @@ "require-dev": { "phpunit/phpunit": "^9.5.25", "vimeo/psalm": "4.27.0", - "laravel/pint": "^1.2" + "laravel/pint": "^1.2", + "phpstan/phpstan": "1.9.x-dev" } } diff --git a/composer.lock b/composer.lock index 6bb173b8..d905473c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0d8902092178991e4a2f0a121a32c1ef", + "content-hash": "f89715e407bde4aecfdff0a0961815de", "packages": [], "packages-dev": [ { @@ -503,30 +503,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -553,7 +553,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -569,7 +569,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "felixfbecker/advanced-json-rpc", @@ -674,16 +674,16 @@ }, { "name": "laravel/pint", - "version": "v1.2.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86" + "reference": "0e7ffdb0af871be10d798e234772ea5d4020ae4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/1d276e4c803397a26cc337df908f55c2a4e90d86", - "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86", + "url": "https://api.github.com/repos/laravel/pint/zipball/0e7ffdb0af871be10d798e234772ea5d4020ae4a", + "reference": "0e7ffdb0af871be10d798e234772ea5d4020ae4a", "shasum": "" }, "require": { @@ -694,11 +694,11 @@ "php": "^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.11.0", - "illuminate/view": "^9.27", - "laravel-zero/framework": "^9.1.3", - "mockery/mockery": "^1.5.0", - "nunomaduro/larastan": "^2.2", + "friendsofphp/php-cs-fixer": "~3.13.1", + "illuminate/view": "^9.32.0", + "laravel-zero/framework": "^9.2.0", + "mockery/mockery": "^1.5.1", + "nunomaduro/larastan": "^2.2.0", "nunomaduro/termwind": "^1.14.0", "pestphp/pest": "^1.22.1" }, @@ -736,7 +736,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2022-09-13T15:07:15+00:00" + "time": "2023-01-10T20:03:42+00:00" }, { "name": "myclabs/deep-copy", @@ -799,16 +799,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v4.0.0", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" + "reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", - "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/cfa81ea1d35294d64adb9c68aa4cb9e92400e53f", + "reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f", "shasum": "" }, "require": { @@ -844,22 +844,22 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.1.0" }, - "time": "2020-12-01T19:48:11+00:00" + "time": "2022-12-08T20:46:14+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -900,9 +900,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "time": "2022-11-12T15:38:23+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "openlss/lib-array2xml", @@ -1235,16 +1235,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.8", + "version": "1.9.x-dev", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07" + "reference": "81b8cc491a8900946b732d922a0e581b2913a359" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/08310ce271984587e2a4cda94e1ac66510a6ea07", - "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/81b8cc491a8900946b732d922a0e581b2913a359", + "reference": "81b8cc491a8900946b732d922a0e581b2913a359", "shasum": "" }, "require": { @@ -1274,7 +1274,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.8" + "source": "https://github.com/phpstan/phpstan/tree/1.9.x" }, "funding": [ { @@ -1290,20 +1290,20 @@ "type": "tidelift" } ], - "time": "2022-10-06T12:51:57+00:00" + "time": "2023-01-26T12:21:06+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.19", + "version": "9.2.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", "shasum": "" }, "require": { @@ -1359,7 +1359,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" }, "funding": [ { @@ -1367,7 +1367,7 @@ "type": "github" } ], - "time": "2022-11-18T07:47:47+00:00" + "time": "2023-01-26T08:26:55+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1612,20 +1612,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.26", + "version": "9.5.28", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -1694,7 +1694,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" }, "funding": [ { @@ -1710,7 +1710,7 @@ "type": "tidelift" } ], - "time": "2022-10-28T06:00:21+00:00" + "time": "2023-01-14T12:32:24+00:00" }, { "name": "psr/container", @@ -2781,16 +2781,16 @@ }, { "name": "symfony/console", - "version": "v6.1.7", + "version": "v6.2.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a1282bd0c096e0bdb8800b104177e2ce404d8815" + "reference": "3e294254f2191762c1d137aed4b94e966965e985" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a1282bd0c096e0bdb8800b104177e2ce404d8815", - "reference": "a1282bd0c096e0bdb8800b104177e2ce404d8815", + "url": "https://api.github.com/repos/symfony/console/zipball/3e294254f2191762c1d137aed4b94e966965e985", + "reference": "3e294254f2191762c1d137aed4b94e966965e985", "shasum": "" }, "require": { @@ -2857,7 +2857,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.1.7" + "source": "https://github.com/symfony/console/tree/v6.2.5" }, "funding": [ { @@ -2873,20 +2873,20 @@ "type": "tidelift" } ], - "time": "2022-10-26T21:42:49+00:00" + "time": "2023-01-01T08:38:09+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.1.1", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918" + "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", - "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", "shasum": "" }, "require": { @@ -2895,7 +2895,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.1-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -2924,7 +2924,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" }, "funding": [ { @@ -2940,7 +2940,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T11:15:52+00:00" + "time": "2022-11-25T10:21:52+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3357,16 +3357,16 @@ }, { "name": "symfony/service-contracts", - "version": "v3.1.1", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "925e713fe8fcacf6bc05e936edd8dd5441a21239" + "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/925e713fe8fcacf6bc05e936edd8dd5441a21239", - "reference": "925e713fe8fcacf6bc05e936edd8dd5441a21239", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", "shasum": "" }, "require": { @@ -3382,7 +3382,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.1-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -3422,7 +3422,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.1.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" }, "funding": [ { @@ -3438,20 +3438,20 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:18:58+00:00" + "time": "2022-11-25T10:21:52+00:00" }, { "name": "symfony/string", - "version": "v6.1.7", + "version": "v6.2.5", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "823f143370880efcbdfa2dbca946b3358c4707e5" + "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/823f143370880efcbdfa2dbca946b3358c4707e5", - "reference": "823f143370880efcbdfa2dbca946b3358c4707e5", + "url": "https://api.github.com/repos/symfony/string/zipball/b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", + "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", "shasum": "" }, "require": { @@ -3467,6 +3467,7 @@ "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", + "symfony/intl": "^6.2", "symfony/translation-contracts": "^2.0|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, @@ -3507,7 +3508,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.1.7" + "source": "https://github.com/symfony/string/tree/v6.2.5" }, "funding": [ { @@ -3523,7 +3524,7 @@ "type": "tidelift" } ], - "time": "2022-10-10T09:34:31+00:00" + "time": "2023-01-01T08:38:09+00:00" }, { "name": "theseer/tokenizer", @@ -3794,7 +3795,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "phpstan/phpstan": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/App.php b/src/App.php index 58924a9b..46bb871b 100755 --- a/src/App.php +++ b/src/App.php @@ -699,7 +699,6 @@ public function run(Request $request, Response $response): static if (! self::$sorted) { foreach (self::$routes as $method => $list) { //adding route alias in $routes foreach ($list as $key => $route) { - /** @var Route $route */ foreach (array_keys($route->getAliases()) as $path) { self::$routes[$method][$path] = $route; } @@ -791,7 +790,6 @@ public function run(Request $request, Response $response): static * @param string $key * @param array $param * @param mixed $value - * @param array $resources * @return void * * @throws Exception diff --git a/src/Response.php b/src/Response.php index 2faa48fb..826a2b07 100755 --- a/src/Response.php +++ b/src/Response.php @@ -525,9 +525,9 @@ protected function end(string $content = null): void * Generate HTTP response output including the response header (+cookies) and body and prints them. * * @param string $body - * @param bool $last - * @return void * @param bool $end + * + * @return void */ public function chunk(string $body = '', bool $end = false): void { @@ -659,7 +659,6 @@ protected function appendCookies(): static * * @param string $url complete absolute URI for redirection as required by the internet standard RFC 2616 (HTTP 1.1) * @param int $statusCode valid HTTP status code - * @param null $exit * @return void * * @throws Exception diff --git a/src/Validator/IP.php b/src/Validator/IP.php index f7a66266..3a69dc13 100644 --- a/src/Validator/IP.php +++ b/src/Validator/IP.php @@ -82,7 +82,6 @@ public function isValid($value): bool default: return false; - break; } return false; diff --git a/src/Validator/Range.php b/src/Validator/Range.php index 8142f9a1..4d0432cb 100755 --- a/src/Validator/Range.php +++ b/src/Validator/Range.php @@ -132,6 +132,7 @@ public function isValid(mixed $value): bool break; case self::TYPE_FLOAT: $value = $value + 0; + /** @phpstan-ignore-next-line */ if (! is_float($value) && ! is_int($value)) { return false; } diff --git a/tests/AppTest.php b/tests/AppTest.php index 21e47372..cbc52c2a 100755 --- a/tests/AppTest.php +++ b/tests/AppTest.php @@ -416,6 +416,8 @@ public function providerRouteMatching(): array */ public function testCanMatchRoute(string $method, string $path): void { + $expected = ''; + switch ($method) { case App::REQUEST_METHOD_GET: $expected = App::get($path); diff --git a/tests/Validator/DomainTest.php b/tests/Validator/DomainTest.php index 69c6beee..30561b4e 100644 --- a/tests/Validator/DomainTest.php +++ b/tests/Validator/DomainTest.php @@ -29,7 +29,7 @@ public function setUp(): void public function tearDown(): void { - $this->domain = null; + unset($this->domain); } public function testIsValid() diff --git a/tests/Validator/HostTest.php b/tests/Validator/HostTest.php index f8f192d1..a2290479 100644 --- a/tests/Validator/HostTest.php +++ b/tests/Validator/HostTest.php @@ -29,7 +29,7 @@ public function setUp():void public function tearDown():void { - $this->host = null; + unset($this->host); } public function testIsValid() diff --git a/tests/Validator/IPTest.php b/tests/Validator/IPTest.php index 1be8f78a..09bf2ef7 100644 --- a/tests/Validator/IPTest.php +++ b/tests/Validator/IPTest.php @@ -17,9 +17,11 @@ class IPTest extends TestCase { + protected ?IP $validator = null; + public function tearDown():void { - $this->validator = null; + unset($this->validator); } public function testIsValidIP() diff --git a/tests/e2e/server.php b/tests/e2e/server.php index 64db8d56..33cb9f00 100644 --- a/tests/e2e/server.php +++ b/tests/e2e/server.php @@ -20,8 +20,7 @@ App::get('/chunked') ->inject('response') - ->action(function ($response) { - /** @var Utopia/Response $response */ + ->action(function (Response $response) { foreach (['Hello ', 'World!'] as $key => $word) { $response->chunk($word, $key == 1); } @@ -29,8 +28,7 @@ App::get('/redirect') ->inject('response') - ->action(function ($response) { - /** @var Utopia/Response $response */ + ->action(function (Response $response) { $response->redirect('/'); }); From 6aa28e2aaace6dbb2b7a807d7b13e127849a4239 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 27 Jan 2023 17:25:57 +0000 Subject: [PATCH 3/7] feat: phpstan fixes --- tests/e2e/ResponseTest.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/e2e/ResponseTest.php b/tests/e2e/ResponseTest.php index 099817c2..546a32ca 100644 --- a/tests/e2e/ResponseTest.php +++ b/tests/e2e/ResponseTest.php @@ -14,10 +14,7 @@ public function setUp(): void public function tearDown(): void { - /** - * @phpstan-ignore-next-line - */ - $this->client = null; + unset($this->client); } /** From 52cb316e5c44bf1b7fb1f9af3fa2d8f2392bc7d5 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 6 Apr 2023 14:54:34 +0000 Subject: [PATCH 4/7] feat: review comments --- src/Validator/Range.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Validator/Range.php b/src/Validator/Range.php index 4d0432cb..d0e7f20f 100755 --- a/src/Validator/Range.php +++ b/src/Validator/Range.php @@ -131,11 +131,10 @@ public function isValid(mixed $value): bool } break; case self::TYPE_FLOAT: - $value = $value + 0; - /** @phpstan-ignore-next-line */ - if (! is_float($value) && ! is_int($value)) { + if (! is_numeric($value) ) { return false; } + $value = $value + 0.0; break; default: return false; From 84734d355779fc1823f26726e53adcfe0d00b2da Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 6 Apr 2023 14:56:35 +0000 Subject: [PATCH 5/7] feat: update composer --- composer.lock | 291 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 221 insertions(+), 70 deletions(-) diff --git a/composer.lock b/composer.lock index 5fb5b074..6f8a74f3 100644 --- a/composer.lock +++ b/composer.lock @@ -501,6 +501,49 @@ }, "time": "2019-12-04T15:06:13+00:00" }, + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" + }, { "name": "doctrine/instantiator", "version": "2.0.0", @@ -674,16 +717,16 @@ }, { "name": "laravel/pint", - "version": "v1.6.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "e48e3fadd7863d6b7d03464f5c4f211a828b890f" + "reference": "4b8f2ef22bfcddd1d163cfd282e3f42ee1a5cce2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/e48e3fadd7863d6b7d03464f5c4f211a828b890f", - "reference": "e48e3fadd7863d6b7d03464f5c4f211a828b890f", + "url": "https://api.github.com/repos/laravel/pint/zipball/4b8f2ef22bfcddd1d163cfd282e3f42ee1a5cce2", + "reference": "4b8f2ef22bfcddd1d163cfd282e3f42ee1a5cce2", "shasum": "" }, "require": { @@ -694,13 +737,13 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.14.4", - "illuminate/view": "^10.0.0", - "laravel-zero/framework": "^10.0.0", + "friendsofphp/php-cs-fixer": "^3.16.0", + "illuminate/view": "^10.5.1", + "laravel-zero/framework": "^10.0.2", "mockery/mockery": "^1.5.1", - "nunomaduro/larastan": "^2.4.0", + "nunomaduro/larastan": "^2.5.1", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^1.22.4" + "pestphp/pest": "^2.4.0" }, "bin": [ "builds/pint" @@ -736,20 +779,20 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2023-02-21T15:44:57+00:00" + "time": "2023-04-04T13:08:09+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -787,7 +830,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -795,7 +838,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "netresearch/jsonmapper", @@ -850,16 +893,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.15.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", "shasum": "" }, "require": { @@ -900,9 +943,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { "name": "openlss/lib-array2xml", @@ -1180,24 +1223,27 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "dfc078e8af9c99210337325ff5aa152872c98714" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714", + "reference": "dfc078e8af9c99210337325ff5aa152872c98714", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -1229,22 +1275,126 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1" }, - "time": "2022-10-14T12:47:21+00:00" + "time": "2023-03-27T19:02:04+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.18.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "882eabc9b6a12e25c27091a261397f9c8792e722" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/882eabc9b6a12e25c27091a261397f9c8792e722", + "reference": "882eabc9b6a12e25c27091a261397f9c8792e722", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.18.0" + }, + "time": "2023-04-06T07:26:43+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.9.x-dev", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "6c0217aa2b146c3e28474e8be3e87188fac55dac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6c0217aa2b146c3e28474e8be3e87188fac55dac", + "reference": "6c0217aa2b146c3e28474e8be3e87188fac55dac", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.9.x" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-02-18T15:01:46+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.25", + "version": "9.2.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954" + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e2b40518197a8c0d4b08bc34dfff1c99c508954", - "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", "shasum": "" }, "require": { @@ -1266,8 +1416,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -1300,7 +1450,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.25" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" }, "funding": [ { @@ -1308,7 +1458,7 @@ "type": "github" } ], - "time": "2023-02-25T05:32:00+00:00" + "time": "2023-03-06T12:58:08+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1553,16 +1703,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.4", + "version": "9.6.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d" + "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d", - "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b65d59a059d3004a040c16a82e07bbdf6cfdd115", + "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115", "shasum": "" }, "require": { @@ -1595,8 +1745,8 @@ "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -1635,7 +1785,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.6" }, "funding": [ { @@ -1651,7 +1802,7 @@ "type": "tidelift" } ], - "time": "2023-02-27T13:06:37+00:00" + "time": "2023-03-27T11:43:46+00:00" }, { "name": "psr/container", @@ -2722,16 +2873,16 @@ }, { "name": "symfony/console", - "version": "v6.2.5", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3e294254f2191762c1d137aed4b94e966965e985" + "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3e294254f2191762c1d137aed4b94e966965e985", - "reference": "3e294254f2191762c1d137aed4b94e966965e985", + "url": "https://api.github.com/repos/symfony/console/zipball/3582d68a64a86ec25240aaa521ec8bc2342b369b", + "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b", "shasum": "" }, "require": { @@ -2793,12 +2944,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.5" + "source": "https://github.com/symfony/console/tree/v6.2.8" }, "funding": [ { @@ -2814,20 +2965,20 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-03-29T21:42:15+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", "shasum": "" }, "require": { @@ -2865,7 +3016,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" }, "funding": [ { @@ -2881,7 +3032,7 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:25:55+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3298,16 +3449,16 @@ }, { "name": "symfony/service-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" + "reference": "a8c9cedf55f314f3a186041d19537303766df09a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a", "shasum": "" }, "require": { @@ -3363,7 +3514,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" }, "funding": [ { @@ -3379,20 +3530,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/string", - "version": "v6.2.5", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0" + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", - "reference": "b2dac0fa27b1ac0f9c0c0b23b43977f12308d0b0", + "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", "shasum": "" }, "require": { @@ -3449,7 +3600,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.5" + "source": "https://github.com/symfony/string/tree/v6.2.8" }, "funding": [ { @@ -3465,7 +3616,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:38:09+00:00" + "time": "2023-03-20T16:06:02+00:00" }, { "name": "theseer/tokenizer", From 60ba0548f36ed9b6e6c70058ffcd03258f3ad1f8 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 6 Apr 2023 21:20:14 +0000 Subject: [PATCH 6/7] feat:update tests --- tests/Validator/DomainTest.php | 7 ++----- tests/Validator/HostTest.php | 7 ++----- tests/Validator/IPTest.php | 2 +- tests/e2e/ResponseTest.php | 9 +++------ 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/tests/Validator/DomainTest.php b/tests/Validator/DomainTest.php index 30561b4e..55202bf9 100644 --- a/tests/Validator/DomainTest.php +++ b/tests/Validator/DomainTest.php @@ -17,10 +17,7 @@ class DomainTest extends TestCase { - /** - * @var Domain - */ - protected $domain = null; + protected ?Domain $domain = null; public function setUp(): void { @@ -29,7 +26,7 @@ public function setUp(): void public function tearDown(): void { - unset($this->domain); + $this->domain = null; } public function testIsValid() diff --git a/tests/Validator/HostTest.php b/tests/Validator/HostTest.php index a2290479..e035c5be 100644 --- a/tests/Validator/HostTest.php +++ b/tests/Validator/HostTest.php @@ -17,10 +17,7 @@ class HostTest extends TestCase { - /** - * @var Host - */ - protected $host = null; + protected ?Host $host = null; public function setUp():void { @@ -29,7 +26,7 @@ public function setUp():void public function tearDown():void { - unset($this->host); + $this->host = null; } public function testIsValid() diff --git a/tests/Validator/IPTest.php b/tests/Validator/IPTest.php index 09bf2ef7..e0cc283b 100644 --- a/tests/Validator/IPTest.php +++ b/tests/Validator/IPTest.php @@ -21,7 +21,7 @@ class IPTest extends TestCase public function tearDown():void { - unset($this->validator); + $this->validator = null; } public function testIsValidIP() diff --git a/tests/e2e/ResponseTest.php b/tests/e2e/ResponseTest.php index 546a32ca..61a19ba1 100644 --- a/tests/e2e/ResponseTest.php +++ b/tests/e2e/ResponseTest.php @@ -7,6 +7,8 @@ class ResponseTest extends TestCase { + protected ?Client $client; + public function setUp(): void { $this->client = new Client(); @@ -14,14 +16,9 @@ public function setUp(): void public function tearDown(): void { - unset($this->client); + $this->client = null; } - /** - * @var Client - */ - protected $client; - public function testResponse() { $response = $this->client->call(Client::METHOD_GET, '/'); From e3680071af74a9358d490ae435b90858ef3ed3bf Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 6 Apr 2023 21:32:17 +0000 Subject: [PATCH 7/7] feat: update tests --- tests/Validator/DomainTest.php | 7 +------ tests/Validator/HostTest.php | 7 +------ tests/Validator/IPTest.php | 7 +------ tests/e2e/ResponseTest.php | 7 +------ 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/tests/Validator/DomainTest.php b/tests/Validator/DomainTest.php index 55202bf9..ca14a20e 100644 --- a/tests/Validator/DomainTest.php +++ b/tests/Validator/DomainTest.php @@ -17,18 +17,13 @@ class DomainTest extends TestCase { - protected ?Domain $domain = null; + protected Domain $domain; public function setUp(): void { $this->domain = new Domain(); } - public function tearDown(): void - { - $this->domain = null; - } - public function testIsValid() { // Assertions diff --git a/tests/Validator/HostTest.php b/tests/Validator/HostTest.php index e035c5be..e9efd5ce 100644 --- a/tests/Validator/HostTest.php +++ b/tests/Validator/HostTest.php @@ -17,18 +17,13 @@ class HostTest extends TestCase { - protected ?Host $host = null; + protected Host $host; public function setUp():void { $this->host = new Host(['example.io', 'subdomain.example.test', 'localhost']); } - public function tearDown():void - { - $this->host = null; - } - public function testIsValid() { // Assertions diff --git a/tests/Validator/IPTest.php b/tests/Validator/IPTest.php index e0cc283b..124be488 100644 --- a/tests/Validator/IPTest.php +++ b/tests/Validator/IPTest.php @@ -17,12 +17,7 @@ class IPTest extends TestCase { - protected ?IP $validator = null; - - public function tearDown():void - { - $this->validator = null; - } + protected IP $validator; public function testIsValidIP() { diff --git a/tests/e2e/ResponseTest.php b/tests/e2e/ResponseTest.php index 61a19ba1..a2f684da 100644 --- a/tests/e2e/ResponseTest.php +++ b/tests/e2e/ResponseTest.php @@ -7,18 +7,13 @@ class ResponseTest extends TestCase { - protected ?Client $client; + protected Client $client; public function setUp(): void { $this->client = new Client(); } - public function tearDown(): void - { - $this->client = null; - } - public function testResponse() { $response = $this->client->call(Client::METHOD_GET, '/');