From 4ccfbb233a6a518b692a6b087ffc4c422215961f Mon Sep 17 00:00:00 2001 From: Punyapal Shah Date: Tue, 31 Dec 2024 18:03:17 +0530 Subject: [PATCH 1/2] chore: update phpstan and rector to 2.0 --- composer.json | 4 +- composer.lock | 238 +++++++++++++++++++++++++------------------------- phpstan.neon | 2 - 3 files changed, 121 insertions(+), 123 deletions(-) diff --git a/composer.json b/composer.json index 7ae2b30cb..9b84d773b 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require-dev": { "barryvdh/laravel-debugbar": "^3.14.10", "fakerphp/faker": "^1.24.1", - "larastan/larastan": "^2.9.12", + "larastan/larastan": "^3.0.0", "laravel/pint": "^1.18.3", "laravel/sail": "^1.39.1", "mockery/mockery": "^1.6.12", @@ -33,7 +33,7 @@ "pestphp/pest": "^3.7.1", "pestphp/pest-plugin-laravel": "^3.0.0", "pestphp/pest-plugin-type-coverage": "^3.2.1", - "rector/rector": "^1.2.10" + "rector/rector": "^2.0.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index a6661ad1c..bd138139d 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": "1548bc2e71ed255cdb98565282a5b0ff", + "content-hash": "50208e5c9f987d1bfb4237a1d5779e9d", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -1079,16 +1079,16 @@ }, { "name": "egulias/email-validator", - "version": "4.0.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "ebaaf5be6c0286928352e054f2d5125608e5405e" + "reference": "b115554301161fa21467629f1e1391c1936de517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ebaaf5be6c0286928352e054f2d5125608e5405e", - "reference": "ebaaf5be6c0286928352e054f2d5125608e5405e", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/b115554301161fa21467629f1e1391c1936de517", + "reference": "b115554301161fa21467629f1e1391c1936de517", "shasum": "" }, "require": { @@ -1134,7 +1134,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.2" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.3" }, "funding": [ { @@ -1142,7 +1142,7 @@ "type": "github" } ], - "time": "2023-10-06T06:47:41+00:00" + "time": "2024-12-27T00:36:43+00:00" }, { "name": "filament/actions", @@ -2253,16 +2253,16 @@ }, { "name": "intervention/image", - "version": "3.10.0", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/Intervention/image.git", - "reference": "1ddc9a096b3a641958515700e09be910bf03a5bd" + "reference": "8230387f14d5727745934673ebe70fdbe161f581" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Intervention/image/zipball/1ddc9a096b3a641958515700e09be910bf03a5bd", - "reference": "1ddc9a096b3a641958515700e09be910bf03a5bd", + "url": "https://api.github.com/repos/Intervention/image/zipball/8230387f14d5727745934673ebe70fdbe161f581", + "reference": "8230387f14d5727745934673ebe70fdbe161f581", "shasum": "" }, "require": { @@ -2309,7 +2309,7 @@ ], "support": { "issues": "https://github.com/Intervention/image/issues", - "source": "https://github.com/Intervention/image/tree/3.10.0" + "source": "https://github.com/Intervention/image/tree/3.10.1" }, "funding": [ { @@ -2325,7 +2325,7 @@ "type": "ko_fi" } ], - "time": "2024-12-21T07:41:40+00:00" + "time": "2024-12-27T14:53:08+00:00" }, { "name": "kirschbaum-development/eloquent-power-joins", @@ -3094,16 +3094,16 @@ }, { "name": "league/commonmark", - "version": "2.6.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "d150f911e0079e90ae3c106734c93137c184f932" + "reference": "d990688c91cedfb69753ffc2512727ec646df2ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d150f911e0079e90ae3c106734c93137c184f932", - "reference": "d150f911e0079e90ae3c106734c93137c184f932", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d990688c91cedfb69753ffc2512727ec646df2ad", + "reference": "d990688c91cedfb69753ffc2512727ec646df2ad", "shasum": "" }, "require": { @@ -3197,7 +3197,7 @@ "type": "tidelift" } ], - "time": "2024-12-07T15:34:16+00:00" + "time": "2024-12-29T14:10:59+00:00" }, { "name": "league/config", @@ -4177,16 +4177,16 @@ }, { "name": "nesbot/carbon", - "version": "3.8.3", + "version": "3.8.4", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "f01cfa96468f4c38325f507ab81a4f1d2cd93cfe" + "reference": "129700ed449b1f02d70272d2ac802357c8c30c58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/f01cfa96468f4c38325f507ab81a4f1d2cd93cfe", - "reference": "f01cfa96468f4c38325f507ab81a4f1d2cd93cfe", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/129700ed449b1f02d70272d2ac802357c8c30c58", + "reference": "129700ed449b1f02d70272d2ac802357c8c30c58", "shasum": "" }, "require": { @@ -4279,7 +4279,7 @@ "type": "tidelift" } ], - "time": "2024-12-21T18:03:19+00:00" + "time": "2024-12-27T09:25:35+00:00" }, { "name": "nette/schema", @@ -4431,16 +4431,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -4483,9 +4483,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "nunomaduro/laravel-optimize-database", @@ -6321,16 +6321,16 @@ }, { "name": "spatie/color", - "version": "1.6.3", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/spatie/color.git", - "reference": "45c4354ffa7e65f05c502b009834ecac7928daa3" + "reference": "614f1e0674262c620db908998a11eacd16494835" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/color/zipball/45c4354ffa7e65f05c502b009834ecac7928daa3", - "reference": "45c4354ffa7e65f05c502b009834ecac7928daa3", + "url": "https://api.github.com/repos/spatie/color/zipball/614f1e0674262c620db908998a11eacd16494835", + "reference": "614f1e0674262c620db908998a11eacd16494835", "shasum": "" }, "require": { @@ -6368,7 +6368,7 @@ ], "support": { "issues": "https://github.com/spatie/color/issues", - "source": "https://github.com/spatie/color/tree/1.6.3" + "source": "https://github.com/spatie/color/tree/1.7.0" }, "funding": [ { @@ -6376,7 +6376,7 @@ "type": "github" } ], - "time": "2024-12-23T11:00:34+00:00" + "time": "2024-12-30T14:23:15+00:00" }, { "name": "spatie/invade", @@ -6514,16 +6514,16 @@ }, { "name": "spatie/laravel-package-tools", - "version": "1.17.0", + "version": "1.18.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-package-tools.git", - "reference": "9ab30fd24f677e5aa370ea4cf6b41c517d16cf85" + "reference": "8332205b90d17164913244f4a8e13ab7e6761d29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/9ab30fd24f677e5aa370ea4cf6b41c517d16cf85", - "reference": "9ab30fd24f677e5aa370ea4cf6b41c517d16cf85", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/8332205b90d17164913244f4a8e13ab7e6761d29", + "reference": "8332205b90d17164913244f4a8e13ab7e6761d29", "shasum": "" }, "require": { @@ -6562,7 +6562,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-package-tools/issues", - "source": "https://github.com/spatie/laravel-package-tools/tree/1.17.0" + "source": "https://github.com/spatie/laravel-package-tools/tree/1.18.0" }, "funding": [ { @@ -6570,7 +6570,7 @@ "type": "github" } ], - "time": "2024-12-09T16:29:14+00:00" + "time": "2024-12-30T13:13:39+00:00" }, { "name": "spatie/mailcoach-mailer", @@ -6882,12 +6882,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -7105,12 +7105,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -8625,12 +8625,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -8885,12 +8885,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -9858,40 +9858,40 @@ }, { "name": "larastan/larastan", - "version": "v2.9.12", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/larastan/larastan.git", - "reference": "19012b39fbe4dede43dbe0c126d9681827a5e908" + "reference": "b2e24e1605cff1d1097ccb6fb8af3bbd1dfe1c6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/larastan/larastan/zipball/19012b39fbe4dede43dbe0c126d9681827a5e908", - "reference": "19012b39fbe4dede43dbe0c126d9681827a5e908", + "url": "https://api.github.com/repos/larastan/larastan/zipball/b2e24e1605cff1d1097ccb6fb8af3bbd1dfe1c6f", + "reference": "b2e24e1605cff1d1097ccb6fb8af3bbd1dfe1c6f", "shasum": "" }, "require": { "ext-json": "*", - "illuminate/console": "^9.52.16 || ^10.28.0 || ^11.16", - "illuminate/container": "^9.52.16 || ^10.28.0 || ^11.16", - "illuminate/contracts": "^9.52.16 || ^10.28.0 || ^11.16", - "illuminate/database": "^9.52.16 || ^10.28.0 || ^11.16", - "illuminate/http": "^9.52.16 || ^10.28.0 || ^11.16", - "illuminate/pipeline": "^9.52.16 || ^10.28.0 || ^11.16", - "illuminate/support": "^9.52.16 || ^10.28.0 || ^11.16", - "php": "^8.0.2", + "illuminate/console": "^11.15.0", + "illuminate/container": "^11.15.0", + "illuminate/contracts": "^11.15.0", + "illuminate/database": "^11.15.0", + "illuminate/http": "^11.15.0", + "illuminate/pipeline": "^11.15.0", + "illuminate/support": "^11.15.0", + "php": "^8.2", "phpmyadmin/sql-parser": "^5.9.0", - "phpstan/phpstan": "^1.12.11" + "phpstan/phpstan": "^2.0.2" }, "require-dev": { "doctrine/coding-standard": "^12.0", - "laravel/framework": "^9.52.16 || ^10.28.0 || ^11.16", - "mockery/mockery": "^1.5.1", - "nikic/php-parser": "^4.19.1", - "orchestra/canvas": "^7.11.1 || ^8.11.0 || ^9.0.2", - "orchestra/testbench-core": "^7.33.0 || ^8.13.0 || ^9.0.9", - "phpstan/phpstan-deprecation-rules": "^1.2", - "phpunit/phpunit": "^9.6.13 || ^10.5.16" + "laravel/framework": "^11.15.0", + "mockery/mockery": "^1.6", + "nikic/php-parser": "^5.3", + "orchestra/canvas": "^v9.1.3", + "orchestra/testbench-core": "^9.5.2", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpunit/phpunit": "^10.5.16" }, "suggest": { "orchestra/testbench": "Using Larastan for analysing a package needs Testbench" @@ -9926,7 +9926,7 @@ "email": "enunomaduro@gmail.com" } ], - "description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel", + "description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel", "keywords": [ "PHPStan", "code analyse", @@ -9939,7 +9939,7 @@ ], "support": { "issues": "https://github.com/larastan/larastan/issues", - "source": "https://github.com/larastan/larastan/tree/v2.9.12" + "source": "https://github.com/larastan/larastan/tree/v3.0.2" }, "funding": [ { @@ -9947,20 +9947,20 @@ "type": "github" } ], - "time": "2024-11-26T23:09:02+00:00" + "time": "2024-11-26T23:15:21+00:00" }, { "name": "laravel/pint", - "version": "v1.18.3", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "cef51821608239040ab841ad6e1c6ae502ae3026" + "reference": "8169513746e1bac70c85d6ea1524d9225d4886f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/cef51821608239040ab841ad6e1c6ae502ae3026", - "reference": "cef51821608239040ab841ad6e1c6ae502ae3026", + "url": "https://api.github.com/repos/laravel/pint/zipball/8169513746e1bac70c85d6ea1524d9225d4886f0", + "reference": "8169513746e1bac70c85d6ea1524d9225d4886f0", "shasum": "" }, "require": { @@ -9971,10 +9971,10 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.65.0", - "illuminate/view": "^10.48.24", - "larastan/larastan": "^2.9.11", - "laravel-zero/framework": "^10.4.0", + "friendsofphp/php-cs-fixer": "^3.66.0", + "illuminate/view": "^10.48.25", + "larastan/larastan": "^2.9.12", + "laravel-zero/framework": "^10.48.25", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.17.0", "pestphp/pest": "^2.36.0" @@ -10013,7 +10013,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-11-26T15:34:00+00:00" + "time": "2024-12-30T16:20:10+00:00" }, { "name": "laravel/sail", @@ -10786,16 +10786,16 @@ }, { "name": "pestphp/pest-plugin-type-coverage", - "version": "v3.2.1", + "version": "v3.2.3", "source": { "type": "git", "url": "https://github.com/pestphp/pest-plugin-type-coverage.git", - "reference": "e6ec9cca8984cdd0baccb563ae123aa60aa966c8" + "reference": "0a1bddf74683c19131a375231fdaf32542ae1473" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest-plugin-type-coverage/zipball/e6ec9cca8984cdd0baccb563ae123aa60aa966c8", - "reference": "e6ec9cca8984cdd0baccb563ae123aa60aa966c8", + "url": "https://api.github.com/repos/pestphp/pest-plugin-type-coverage/zipball/0a1bddf74683c19131a375231fdaf32542ae1473", + "reference": "0a1bddf74683c19131a375231fdaf32542ae1473", "shasum": "" }, "require": { @@ -10838,7 +10838,7 @@ "unit" ], "support": { - "source": "https://github.com/pestphp/pest-plugin-type-coverage/tree/v3.2.1" + "source": "https://github.com/pestphp/pest-plugin-type-coverage/tree/v3.2.3" }, "funding": [ { @@ -10854,7 +10854,7 @@ "type": "patreon" } ], - "time": "2024-12-12T16:47:27+00:00" + "time": "2024-12-28T10:25:41+00:00" }, { "name": "phar-io/manifest", @@ -11285,20 +11285,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.13", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9b469068840cfa031e1deaf2fa1886d00e20680f" + "reference": "2392d360fdf54ea253aa6c68cad1d4ba2e54e927" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b469068840cfa031e1deaf2fa1886d00e20680f", - "reference": "9b469068840cfa031e1deaf2fa1886d00e20680f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2392d360fdf54ea253aa6c68cad1d4ba2e54e927", + "reference": "2392d360fdf54ea253aa6c68cad1d4ba2e54e927", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -11339,7 +11339,7 @@ "type": "github" } ], - "time": "2024-12-17T17:00:20+00:00" + "time": "2024-12-31T07:30:03+00:00" }, { "name": "phpunit/php-code-coverage", @@ -11767,21 +11767,21 @@ }, { "name": "rector/rector", - "version": "1.2.10", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "40f9cf38c05296bd32f444121336a521a293fa61" + "reference": "df5de7b80deced1ea7f719a0b4d02e4aee87dd21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/40f9cf38c05296bd32f444121336a521a293fa61", - "reference": "40f9cf38c05296bd32f444121336a521a293fa61", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/df5de7b80deced1ea7f719a0b4d02e4aee87dd21", + "reference": "df5de7b80deced1ea7f719a0b4d02e4aee87dd21", "shasum": "" }, "require": { - "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.12.5" + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.0.4" }, "conflict": { "rector/rector-doctrine": "*", @@ -11814,7 +11814,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.10" + "source": "https://github.com/rectorphp/rector/tree/2.0.4" }, "funding": [ { @@ -11822,7 +11822,7 @@ "type": "github" } ], - "time": "2024-11-08T13:59:10+00:00" + "time": "2024-12-26T23:06:19+00:00" }, { "name": "sebastian/cli-parser", @@ -12982,22 +12982,22 @@ }, { "name": "tomasvotruba/type-coverage", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/TomasVotruba/type-coverage.git", - "reference": "01498b5cef67fa433e2f9f38b696d0ecd5131dca" + "reference": "4c3cd7bf660dfd9025d5f583eb32101f9aaf8fde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TomasVotruba/type-coverage/zipball/01498b5cef67fa433e2f9f38b696d0ecd5131dca", - "reference": "01498b5cef67fa433e2f9f38b696d0ecd5131dca", + "url": "https://api.github.com/repos/TomasVotruba/type-coverage/zipball/4c3cd7bf660dfd9025d5f583eb32101f9aaf8fde", + "reference": "4c3cd7bf660dfd9025d5f583eb32101f9aaf8fde", "shasum": "" }, "require": { "nette/utils": "^3.2 || ^4.0", - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.3" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "type": "phpstan-extension", "extra": { @@ -13023,7 +13023,7 @@ ], "support": { "issues": "https://github.com/TomasVotruba/type-coverage/issues", - "source": "https://github.com/TomasVotruba/type-coverage/tree/1.0.0" + "source": "https://github.com/TomasVotruba/type-coverage/tree/2.0.1" }, "funding": [ { @@ -13035,18 +13035,18 @@ "type": "github" } ], - "time": "2024-10-01T15:41:12+00:00" + "time": "2024-12-26T11:46:24+00:00" } ], "aliases": [], "minimum-stability": "dev", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.3", "ext-imagick": "^3.7.0" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/phpstan.neon b/phpstan.neon index 899d4d6a3..9fa3b1bae 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,8 +3,6 @@ includes: - vendor/phpstan/phpstan/conf/bleedingEdge.neon parameters: - checkMissingIterableValueType: true - level: max paths: From 74377d88fc539a26058dbd05cf2eb69efc50c294 Mon Sep 17 00:00:00 2001 From: Punyapal Shah Date: Tue, 31 Dec 2024 18:03:23 +0530 Subject: [PATCH 2/2] chore: add type annotations for validated variables in various controllers and Livewire components --- .../Commands/PerformDatabaseBackupCommand.php | 9 +++-- app/EventActions/UpdateQuestionHashtags.php | 2 +- .../Widgets/QuestionOverview.php | 1 + .../Auth/UpdatePasswordController.php | 1 + app/Http/Controllers/UserAvatarController.php | 3 +- .../UserGitHubUsernameController.php | 6 ++- .../Controllers/UserTimezoneController.php | 1 + app/Jobs/CleanUnusedUploadedImages.php | 1 + app/Livewire/Links/Create.php | 1 + app/Livewire/Links/Edit.php | 1 + .../Profile/TwoFactorAuthenticationForm.php | 2 +- app/Livewire/Questions/Create.php | 1 + app/Livewire/Questions/Edit.php | 1 + app/Services/MetaData.php | 39 +++++++++++-------- .../CodeProviderParsable.php | 4 +- config/debugbar.php | 2 +- database/factories/PanAnalyticFactory.php | 2 +- 17 files changed, 49 insertions(+), 28 deletions(-) diff --git a/app/Console/Commands/PerformDatabaseBackupCommand.php b/app/Console/Commands/PerformDatabaseBackupCommand.php index 83675e45e..bcb342d93 100644 --- a/app/Console/Commands/PerformDatabaseBackupCommand.php +++ b/app/Console/Commands/PerformDatabaseBackupCommand.php @@ -34,8 +34,11 @@ public function handle(): void $glob = File::glob(database_path('backups/*.sql')); - collect($glob)->sort()->reverse()->slice(4)->each( - fn (string $backup): bool => File::delete($backup), - ); + collect($glob)->sort()->reverse()->slice(4)->filter( + fn (mixed $backup): bool => is_string($backup), + ) + ->each( + fn (string $backup): bool => File::delete($backup), + ); } } diff --git a/app/EventActions/UpdateQuestionHashtags.php b/app/EventActions/UpdateQuestionHashtags.php index ba17551ef..086ff9ff3 100644 --- a/app/EventActions/UpdateQuestionHashtags.php +++ b/app/EventActions/UpdateQuestionHashtags.php @@ -21,7 +21,7 @@ public function __construct( } /** - * @return array{attached: array, detached: array, updated: array} + * @return array{attached: array, detached: array, updated: array} */ public function handle(): array { diff --git a/app/Filament/Resources/QuestionResource/Widgets/QuestionOverview.php b/app/Filament/Resources/QuestionResource/Widgets/QuestionOverview.php index dddc206ee..0197bd43f 100644 --- a/app/Filament/Resources/QuestionResource/Widgets/QuestionOverview.php +++ b/app/Filament/Resources/QuestionResource/Widgets/QuestionOverview.php @@ -26,6 +26,7 @@ protected function getStats(): array ->selectRaw('COUNT(*) AS total, SUM(is_reported) AS reported, SUM(is_ignored) AS ignored') ->first(); + /** @var array $counts */ $counts = $counts !== null ? $counts->attributesToArray() : ['total' => 0, 'reported' => 0, 'ignored' => 0]; return [ diff --git a/app/Http/Controllers/Auth/UpdatePasswordController.php b/app/Http/Controllers/Auth/UpdatePasswordController.php index a517cf648..1cb82dff2 100644 --- a/app/Http/Controllers/Auth/UpdatePasswordController.php +++ b/app/Http/Controllers/Auth/UpdatePasswordController.php @@ -19,6 +19,7 @@ public function __invoke(Request $request): RedirectResponse { $user = type($request->user())->as(User::class); + /** @var array $validated */ $validated = $request->validateWithBag('updatePassword', [ 'current_password' => ['required', 'current_password'], 'password' => ['required', Password::defaults(), 'confirmed'], diff --git a/app/Http/Controllers/UserAvatarController.php b/app/Http/Controllers/UserAvatarController.php index 8bcdf3668..c6dbd784a 100644 --- a/app/Http/Controllers/UserAvatarController.php +++ b/app/Http/Controllers/UserAvatarController.php @@ -36,7 +36,8 @@ public function destroy(Request $request): RedirectResponse UpdateUserAvatar::dispatchSync( $user, - service: $user->github_username ? 'github' : 'gravatar', + null, + $user->github_username ? 'github' : 'gravatar', ); return to_route('profile.edit') diff --git a/app/Http/Controllers/UserGitHubUsernameController.php b/app/Http/Controllers/UserGitHubUsernameController.php index 5fe4114c8..d63c73d53 100644 --- a/app/Http/Controllers/UserGitHubUsernameController.php +++ b/app/Http/Controllers/UserGitHubUsernameController.php @@ -33,6 +33,7 @@ public function update(Request $request): RedirectResponse $user = type($request->user())->as(User::class); try { + /** @var array $validated */ $validated = Validator::validate([ 'github_username' => $githubUser->getNickname(), ], [ @@ -62,8 +63,9 @@ public function update(Request $request): RedirectResponse if (! $user->is_uploaded_avatar) { UpdateUserAvatar::dispatch( - user: $user, - service: 'github', + $user, + null, + 'github', ); } diff --git a/app/Http/Controllers/UserTimezoneController.php b/app/Http/Controllers/UserTimezoneController.php index 563251455..4820ad89e 100644 --- a/app/Http/Controllers/UserTimezoneController.php +++ b/app/Http/Controllers/UserTimezoneController.php @@ -14,6 +14,7 @@ */ public function update(Request $request): void { + /** @var array $validated */ $validated = $request->validate([ 'timezone' => ['required', 'string', 'max:255', new ValidTimezone], ]); diff --git a/app/Jobs/CleanUnusedUploadedImages.php b/app/Jobs/CleanUnusedUploadedImages.php index e206b40c8..a7ce3588c 100644 --- a/app/Jobs/CleanUnusedUploadedImages.php +++ b/app/Jobs/CleanUnusedUploadedImages.php @@ -46,6 +46,7 @@ public function handle(): void collect($this->getDateRange($lastRunTime, $fiveMinutesAgo)) ->flatMap(fn (string $date): array => $disk->allFiles("images/{$date}")) + ->filter(fn (mixed $file): bool => is_string($file)) ->filter(function (string $file) use ($disk, $lastRunTime, $fiveMinutesAgo): bool { $lastModified = Carbon::createFromTimestamp($disk->lastModified($file)); diff --git a/app/Livewire/Links/Create.php b/app/Livewire/Links/Create.php index 44503ece3..425ce3128 100644 --- a/app/Livewire/Links/Create.php +++ b/app/Livewire/Links/Create.php @@ -47,6 +47,7 @@ public function store(Request $request): void $this->url = "https://{$this->url}"; } + /** @var array $validated */ $validated = $this->validate([ 'description' => 'required|max:100', 'url' => ['required', 'max:100', 'url', 'starts_with:https'], diff --git a/app/Livewire/Links/Edit.php b/app/Livewire/Links/Edit.php index 19fafbdf8..857de0193 100644 --- a/app/Livewire/Links/Edit.php +++ b/app/Livewire/Links/Edit.php @@ -42,6 +42,7 @@ public function update(Request $request): void $this->url = "https://{$this->url}"; } + /** @var array $validated */ $validated = $this->validate([ 'description' => 'required|max:100', 'url' => ['required', 'max:100', 'url', 'starts_with:https'], diff --git a/app/Livewire/Profile/TwoFactorAuthenticationForm.php b/app/Livewire/Profile/TwoFactorAuthenticationForm.php index ed3d67e64..88395f42e 100644 --- a/app/Livewire/Profile/TwoFactorAuthenticationForm.php +++ b/app/Livewire/Profile/TwoFactorAuthenticationForm.php @@ -78,7 +78,7 @@ public function enableTwoFactorAuthentication(EnableTwoFactorAuthentication $ena */ public function confirmTwoFactorAuthentication(ConfirmTwoFactorAuthentication $confirm): void { - $confirm(auth()->user(), $this->pull('code')); + $confirm(auth()->user(), type($this->pull('code'))->asString()); $this->showingQrCode = false; $this->showingConfirmation = false; diff --git a/app/Livewire/Questions/Create.php b/app/Livewire/Questions/Create.php index 00e409429..02eeca556 100644 --- a/app/Livewire/Questions/Create.php +++ b/app/Livewire/Questions/Create.php @@ -120,6 +120,7 @@ static function (string $attribute, mixed $value, Closure $fail): void { /** @var UploadedFile $value */ $dimensions = $value->dimensions(); if (is_array($dimensions)) { + /** @var array $dimensions */ [$width, $height] = $dimensions; $aspectRatio = $width / $height; $maxAspectRatio = 2 / 5; diff --git a/app/Livewire/Questions/Edit.php b/app/Livewire/Questions/Edit.php index df9113111..860f41c30 100644 --- a/app/Livewire/Questions/Edit.php +++ b/app/Livewire/Questions/Edit.php @@ -48,6 +48,7 @@ public function update(Request $request): void return; } + /** @var array $validated */ $validated = $this->validate([ 'answer' => ['required', 'string', 'max:1000', new NoBlankCharacters], ]); diff --git a/app/Services/MetaData.php b/app/Services/MetaData.php index 707c1e863..72b2fc028 100644 --- a/app/Services/MetaData.php +++ b/app/Services/MetaData.php @@ -89,7 +89,7 @@ public function checkExistsAndSize(string $image): bool /** * Get the meta-data for a given URL. * - * @return Collection + * @return Collection */ private function getData(): Collection { @@ -108,14 +108,14 @@ private function getData(): Collection // Laravel Http Client, Guzzle, and PSR-7 } - return $data; + return $data->filter(fn (mixed $value): bool => is_string($value) && $value !== ''); } /** * Fetch the oEmbed data for a given URL. * * @param array $options - * @return Collection + * @return Collection */ private function fetchOEmbed(string $service, array $options): Collection { @@ -127,20 +127,19 @@ private function fetchOEmbed(string $service, array $options): Collection ); if ($response->ok()) { - /** @var Collection $data */ $data = $response->collect(); } } catch (ConnectionException) { // Catch but not capture the exception } - return $data; + return $data->filter(fn (mixed $value): bool => is_string($value) && $value !== ''); } /** * Parse the response body for MetaData. * - * @return Collection + * @return Collection */ private function parseContent(string $content): Collection { @@ -149,7 +148,8 @@ private function parseContent(string $content): Collection $interested_in = ['og', 'twitter']; $allowed = ['title', 'description', 'keywords', 'image', 'site_name', 'url', 'type']; - $data = collect(); + /** @var Collection $data */ + $data = new Collection(); $metas = $doc->getElementsByTagName('meta'); if ($metas->count() > 0) { @@ -178,14 +178,13 @@ private function parseContent(string $content): Collection } } - return $data->filter(fn (?string $value): bool => (string) $value !== ''); - + return $data->filter(fn (string $value): bool => $value !== ''); } /** * Parse the response body for MetaData. * - * @return Collection + * @return Collection * * @throws ConnectionException */ @@ -225,9 +224,13 @@ private function parse(string $html): Collection ); if ($vimeo->isNotEmpty()) { foreach ($vimeo as $key => $value) { - $key === 'html' - ? $data->put($key, $this->ensureCorrectSize((string) $value)) - : $data->put($key, $value); + $value = $key === 'html' + ? $this->ensureCorrectSize((string) $value) + : $value; + + if ($value !== '') { + $data->put($key, $value); + } } } } @@ -242,9 +245,13 @@ private function parse(string $html): Collection if ($youtube->isNotEmpty()) { foreach ($youtube as $key => $value) { - $key === 'html' - ? $data->put($key, $this->ensureCorrectSize((string) $value)) - : $data->put($key, $value); + $value = $key === 'html' + ? $this->ensureCorrectSize((string) $value) + : $value; + + if ($value !== '') { + $data->put($key, $value); + } } } } diff --git a/app/Services/ParsableContentProviders/CodeProviderParsable.php b/app/Services/ParsableContentProviders/CodeProviderParsable.php index 6a0e00199..d57b63f2b 100644 --- a/app/Services/ParsableContentProviders/CodeProviderParsable.php +++ b/app/Services/ParsableContentProviders/CodeProviderParsable.php @@ -33,8 +33,8 @@ function (array $matches): string { $highlighted = $highlighter->highlight('plaintext', $code); } // @codeCoverageIgnoreEnd - $highlightedCode = $highlighted->value; - $highlightedLanguage = $highlighted->language; + $highlightedCode = type($highlighted->value)->asString(); + $highlightedLanguage = type($highlighted->language)->asString(); return '
'.$highlightedCode.'
'; }, diff --git a/config/debugbar.php b/config/debugbar.php index b33c33710..dec1ef8fd 100644 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -235,7 +235,7 @@ ], 'views' => [ 'timeline' => false, // Add the views to the timeline (Experimental) - 'data' => false, //true for all data, 'keys' for only names, false for no parameters. + 'data' => false, // true for all data, 'keys' for only names, false for no parameters. 'group' => 50, // Group duplicate views. Pass value to auto-group, or true/false to force 'exclude_paths' => [ // Add the paths which you don't want to appear in the views 'vendor/filament', // Exclude Filament components by default diff --git a/database/factories/PanAnalyticFactory.php b/database/factories/PanAnalyticFactory.php index db9d12cf3..5e3ef8629 100644 --- a/database/factories/PanAnalyticFactory.php +++ b/database/factories/PanAnalyticFactory.php @@ -20,7 +20,7 @@ public function definition(): array { return [ 'name' => $this->faker->name, - 'impressions' => fn (array $attributes): int => $attributes['hovers'] + $attributes['clicks'], + 'impressions' => fn (array $attributes): int => type($attributes['hovers'])->asInt() + type($attributes['clicks'])->asInt(), 'hovers' => $this->faker->randomNumber(), 'clicks' => $this->faker->randomNumber(), ];