PHPStan corrections

This commit is contained in:
Alex Cabal 2025-05-07 22:01:48 -05:00
parent 30cd00dbb7
commit afab78af46
32 changed files with 77 additions and 40 deletions

View file

@ -1,8 +1,10 @@
{ {
"license": "CC0-1.0", "config": {
"platform": { "platform": {
"php": "8.1.2" "php": "8.1.2"
}
}, },
"license": "CC0-1.0",
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"": "lib/" "": "lib/"
@ -18,6 +20,7 @@
"thecodingmachine/phpstan-safe-rule": "^1.4.0" "thecodingmachine/phpstan-safe-rule": "^1.4.0"
}, },
"require": { "require": {
"php": "8.1.2",
"thecodingmachine/safe": "^3.0.2", "thecodingmachine/safe": "^3.0.2",
"phpmailer/phpmailer": "^6.6.0", "phpmailer/phpmailer": "^6.6.0",
"ramsey/uuid": "^4.7.6", "ramsey/uuid": "^4.7.6",

68
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "958c9c0a2d1f5242e7c4952657999fe4", "content-hash": "1b1f74df92cf6b3dec3cc1e3c039eb83",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -288,16 +288,16 @@
}, },
{ {
"name": "phpmailer/phpmailer", "name": "phpmailer/phpmailer",
"version": "v6.9.3", "version": "v6.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git", "url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "2f5c94fe7493efc213f643c23b1b1c249d40f47e" "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2f5c94fe7493efc213f643c23b1b1c249d40f47e", "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144",
"reference": "2f5c94fe7493efc213f643c23b1b1c249d40f47e", "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -357,7 +357,7 @@
"description": "PHPMailer is a full-featured email creation and transfer class for PHP", "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": { "support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues", "issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.9.3" "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.10.0"
}, },
"funding": [ "funding": [
{ {
@ -365,7 +365,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-11-24T18:04:13+00:00" "time": "2025-04-24T15:19:31+00:00"
}, },
{ {
"name": "ramsey/collection", "name": "ramsey/collection",
@ -601,19 +601,20 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.31.0", "version": "v1.32.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493",
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-iconv": "*",
"php": ">=7.2" "php": ">=7.2"
}, },
"provide": { "provide": {
@ -661,7 +662,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0"
}, },
"funding": [ "funding": [
{ {
@ -677,20 +678,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-09-09T11:45:10+00:00" "time": "2024-12-23T08:48:59+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v6.4.19", "version": "v6.4.20",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3" "reference": "e2a61c16af36c9a07e5c9906498b73e091949a20"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3", "url": "https://api.github.com/repos/symfony/process/zipball/e2a61c16af36c9a07e5c9906498b73e091949a20",
"reference": "7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3", "reference": "e2a61c16af36c9a07e5c9906498b73e091949a20",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -722,7 +723,7 @@
"description": "Executes commands in sub-processes", "description": "Executes commands in sub-processes",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/process/tree/v6.4.19" "source": "https://github.com/symfony/process/tree/v6.4.20"
}, },
"funding": [ "funding": [
{ {
@ -738,20 +739,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-02-04T13:35:48+00:00" "time": "2025-03-10T17:11:00+00:00"
}, },
{ {
"name": "thecodingmachine/safe", "name": "thecodingmachine/safe",
"version": "v3.0.2", "version": "v3.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thecodingmachine/safe.git", "url": "https://github.com/thecodingmachine/safe.git",
"reference": "22ffad3248982a784f9870a37aeb2e522bd19645" "reference": "234f6fe34a0bead8c5ae1cfc0800539442e6f619"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thecodingmachine/safe/zipball/22ffad3248982a784f9870a37aeb2e522bd19645", "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/234f6fe34a0bead8c5ae1cfc0800539442e6f619",
"reference": "22ffad3248982a784f9870a37aeb2e522bd19645", "reference": "234f6fe34a0bead8c5ae1cfc0800539442e6f619",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -861,7 +862,7 @@
"description": "PHP core functions that throw exceptions instead of returning FALSE on error", "description": "PHP core functions that throw exceptions instead of returning FALSE on error",
"support": { "support": {
"issues": "https://github.com/thecodingmachine/safe/issues", "issues": "https://github.com/thecodingmachine/safe/issues",
"source": "https://github.com/thecodingmachine/safe/tree/v3.0.2" "source": "https://github.com/thecodingmachine/safe/tree/v3.1.1"
}, },
"funding": [ "funding": [
{ {
@ -877,7 +878,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-02-19T19:23:00+00:00" "time": "2025-04-28T07:56:17+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -941,16 +942,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "2.1.11", "version": "2.1.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "8ca5f79a8f63c49b2359065832a654e1ec70ac30" "reference": "8f2e03099cac24ff3b379864d171c5acbfc6b9a2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/8ca5f79a8f63c49b2359065832a654e1ec70ac30", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8f2e03099cac24ff3b379864d171c5acbfc6b9a2",
"reference": "8ca5f79a8f63c49b2359065832a654e1ec70ac30", "reference": "8f2e03099cac24ff3b379864d171c5acbfc6b9a2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -995,7 +996,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-03-24T13:45:00+00:00" "time": "2025-05-02T15:32:28+00:00"
}, },
{ {
"name": "thecodingmachine/phpstan-safe-rule", "name": "thecodingmachine/phpstan-safe-rule",
@ -1061,7 +1062,12 @@
"stability-flags": [], "stability-flags": [],
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": {
"php": "8.1.2"
},
"platform-dev": [], "platform-dev": [],
"platform-overrides": {
"php": "8.1.2"
},
"plugin-api-version": "2.6.0" "plugin-api-version": "2.6.0"
} }

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
$artist = null; $artist = null;

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
$isReviewerView = Session::$User?->Benefits->CanReviewArtwork ?? false; $isReviewerView = Session::$User?->Benefits->CanReviewArtwork ?? false;

View file

@ -1,4 +1,6 @@
<? <?
use function Safe\session_start;
try{ try{
session_start(); session_start();
$httpMethod = HttpInput::ValidateRequestMethod([Enums\HttpMethod::Delete]); $httpMethod = HttpInput::ValidateRequestMethod([Enums\HttpMethod::Delete]);

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
try{ try{

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
try{ try{

View file

@ -1,9 +1,11 @@
<? <?
use function Safe\session_start;
try{ try{
session_start(); session_start();
$httpMethod = HttpInput::ValidateRequestMethod([Enums\HttpMethod::Post, Enums\HttpMethod::Patch, Enums\HttpMethod::Put]); $httpMethod = HttpInput::ValidateRequestMethod([Enums\HttpMethod::Post, Enums\HttpMethod::Patch, Enums\HttpMethod::Put]);
$exceptionRedirectUrl = '/artworks/new'; $exceptionRedirectUrl = '/artworks/new';
$artwork = new Artwork();
if(HttpInput::IsRequestTooLarge()){ if(HttpInput::IsRequestTooLarge()){
throw new Exceptions\InvalidRequestException('File upload too large.'); throw new Exceptions\InvalidRequestException('File upload too large.');
@ -18,8 +20,6 @@ try{
if(!Session::$User->Benefits->CanUploadArtwork){ if(!Session::$User->Benefits->CanUploadArtwork){
throw new Exceptions\InvalidPermissionsException(); throw new Exceptions\InvalidPermissionsException();
} }
$artwork = new Artwork();
$artwork->FillFromHttpPost(); $artwork->FillFromHttpPost();
$artwork->SubmitterUserId = Session::$User->UserId ?? null; $artwork->SubmitterUserId = Session::$User->UserId ?? null;
@ -54,8 +54,6 @@ try{
$exceptionRedirectUrl = $originalArtwork->EditUrl; $exceptionRedirectUrl = $originalArtwork->EditUrl;
$artwork = new Artwork();
try{ try{
$artwork->FillFromHttpPost(); $artwork->FillFromHttpPost();
} }

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
/** @var string $identifier Passed from script this is included from. */ /** @var string $identifier Passed from script this is included from. */
$ebook = null; $ebook = null;

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
use Gregwar\Captcha\CaptchaBuilder; use Gregwar\Captcha\CaptchaBuilder;

View file

@ -1,4 +1,6 @@
<? <?
use function Safe\session_start;
session_start(); session_start();
$subscription = new NewsletterSubscription(); $subscription = new NewsletterSubscription();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function \Safe\session_unset; use function \Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,5 +1,6 @@
<? <?
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
try{ try{

View file

@ -3,6 +3,7 @@
// we don't want to reveal the vote ID to the web browser. It should only be sent via email // we don't want to reveal the vote ID to the web browser. It should only be sent via email
// confirmation link. // confirmation link.
use function Safe\session_start;
use function \Safe\session_unset; use function \Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
try{ try{

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,7 +1,6 @@
<? <?
use PhpParser\Node\Stmt\For_; use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
try{ try{

View file

@ -4,6 +4,7 @@
* GET /projects/new * GET /projects/new
*/ */
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,5 +1,7 @@
<? <?
use function Safe\session_start;
try{ try{
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
try{ try{

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
try{ try{

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
use function Safe\session_unset; use function Safe\session_unset;
session_start(); session_start();

View file

@ -1,4 +1,5 @@
<? <?
use function Safe\session_start;
try{ try{
session_start(); session_start();