Update Composer dependencies, clean up PHPStan config file, and remove Constants.php from Composer in favor of PHPStan configuration

This commit is contained in:
Alex Cabal 2025-02-28 10:52:16 -06:00
parent c203de4c6b
commit 11e5770413
5 changed files with 22 additions and 24 deletions

View file

@ -6,17 +6,11 @@
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"": "lib/" "": "lib/"
}, }
"files": [
"lib/Constants.php"
]
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [
"lib/" "lib/"
],
"files": [
"lib/Constants.php"
] ]
}, },
"require-dev": { "require-dev": {

12
composer.lock generated
View file

@ -8,16 +8,16 @@
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
"version": "0.12.2", "version": "0.12.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/brick/math.git", "url": "https://github.com/brick/math.git",
"reference": "901eddb1e45a8e0f689302e40af871c181ecbe40" "reference": "866551da34e9a618e64a819ee1e01c20d8a588ba"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/brick/math/zipball/901eddb1e45a8e0f689302e40af871c181ecbe40", "url": "https://api.github.com/repos/brick/math/zipball/866551da34e9a618e64a819ee1e01c20d8a588ba",
"reference": "901eddb1e45a8e0f689302e40af871c181ecbe40", "reference": "866551da34e9a618e64a819ee1e01c20d8a588ba",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -56,7 +56,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/brick/math/issues", "issues": "https://github.com/brick/math/issues",
"source": "https://github.com/brick/math/tree/0.12.2" "source": "https://github.com/brick/math/tree/0.12.3"
}, },
"funding": [ "funding": [
{ {
@ -64,7 +64,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-02-26T10:21:45+00:00" "time": "2025-02-28T13:11:00+00:00"
}, },
{ {
"name": "erusev/parsedown", "name": "erusev/parsedown",

View file

@ -4,11 +4,15 @@ includes:
- ../../vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon - ../../vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
parameters: parameters:
level: 9
ignoreErrors: ignoreErrors:
# Ignore errors caused by Template static class reflection # Ignore errors caused by `Template` static class reflection.
- '#Call to an undefined static method Template::[a-zA-Z0-9\\_]+\(\)\.#' - '#Call to an undefined static method Template::[a-zA-Z0-9\\_]+\(\)\.#'
level:
9 bootstrapFiles:
- %rootDir%/../../../lib/Constants.php
paths: paths:
- %rootDir%/../../../lib - %rootDir%/../../../lib
- %rootDir%/../../../www - %rootDir%/../../../www
@ -23,23 +27,23 @@ parameters:
- %rootDir%/../../../scripts/update-patrons-circle - %rootDir%/../../../scripts/update-patrons-circle
- %rootDir%/../../../scripts/update-project-statuses - %rootDir%/../../../scripts/update-project-statuses
- %rootDir%/../../../templates - %rootDir%/../../../templates
dynamicConstantNames: dynamicConstantNames:
- SITE_STATUS - SITE_STATUS
- DONATION_DRIVES_ENABLED - DONATION_DRIVES_ENABLED
- DONATION_DRIVE_COUNTER_ENABLED - DONATION_DRIVE_COUNTER_ENABLED
earlyTerminatingMethodCalls:
Template:
- Emit403
- Emit404
- RedirectToLogin
exceptions: exceptions:
# PHPStan only uses PHPDocs to compute exception bubbling; without this line, PHPStan assumes that any function without a `@throws` doc throws any number of exceptions, instead of no exceptions. # PHPStan only uses PHPDocs to compute exception bubbling; without this line, PHPStan assumes that any function without a `@throws` doc throws any number of exceptions, instead of no exceptions.
implicitThrows: false implicitThrows: false
check: check:
missingCheckedExceptionInThrows: true missingCheckedExceptionInThrows: true
tooWideThrowType: true tooWideThrowType: true
uncheckedExceptionRegexes: uncheckedExceptionRegexes:
-'#^Safe\\#' - '#^Safe\\#'
uncheckedExceptionClasses: uncheckedExceptionClasses:
- 'Exceptions\DatabaseQueryException' - 'Exceptions\DatabaseQueryException'
- 'Exceptions\MultiSelectMethodNotFoundException' - 'Exceptions\MultiSelectMethodNotFoundException'

View file

@ -1,5 +1,4 @@
<? <?
// Auto-included by Composer in `composer.json` to satisfy PHPStan.
use Safe\DateTimeImmutable; use Safe\DateTimeImmutable;
use function Safe\get_cfg_var; use function Safe\get_cfg_var;
use function Safe\define; use function Safe\define;
@ -15,7 +14,7 @@ const SITE_TZ = new DateTimeZone('America/Chicago');
const SITE_STATUS_LIVE = 'live'; const SITE_STATUS_LIVE = 'live';
const SITE_STATUS_DEV = 'dev'; const SITE_STATUS_DEV = 'dev';
define('SITE_STATUS', get_cfg_var('app.site_status') ?: SITE_STATUS_DEV); // Set in the PHP INI configuration for both CLI and FPM. Have to use `define()` and not `const` so we can use a function. define('SITE_STATUS', get_cfg_var('app.site_status')); // Set in the PHP INI configuration for both CLI and FPM. Have to use `define()` and not `const` so we can use a function.
// No trailing slash on any of the below constants. // No trailing slash on any of the below constants.
if(SITE_STATUS == SITE_STATUS_LIVE){ if(SITE_STATUS == SITE_STATUS_LIVE){

View file

@ -1,6 +1,7 @@
<? <?
// Composer auto-loads the `lib/` directory in `composer.json`. // Composer auto-loads the `lib/` directory in `composer.json`.
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
require_once('Constants.php');
use function Safe\error_log; use function Safe\error_log;
use function Safe\mb_internal_encoding; use function Safe\mb_internal_encoding;