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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
<?
use function Safe\session_start;
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. */
$ebook = null;

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,6 @@
<?
use Ramsey\Uuid\Uuid;
use function Safe\session_start;
use function Safe\session_unset;
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
// confirmation link.
use function Safe\session_start;
use function \Safe\session_unset;
session_start();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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