mirror of
https://github.com/scummvm/scummvm-web.git
synced 2026-05-21 05:40:47 +00:00
WEB: Various PHPStan fixes
These fixes are only for correctness.
This commit is contained in:
@@ -21,7 +21,7 @@ abstract class ExceptionHandler
|
||||
$skip_menus = true;
|
||||
} else {
|
||||
foreach ($e->getTrace() as $t) {
|
||||
if (basename($t['file']) == 'MenuModel.php') {
|
||||
if (basename($t['file'] ?? '') == 'MenuModel.php') {
|
||||
$skip_menus = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class FileUtils
|
||||
* Returns whether or not the file exists and is readable
|
||||
*
|
||||
* @param $path the path to the file that will be analyzed
|
||||
* @return whether or not the file exists
|
||||
* @return bool whether or not the file exists
|
||||
*/
|
||||
public static function exists($path)
|
||||
{
|
||||
@@ -24,7 +24,7 @@ class FileUtils
|
||||
* Returns the file size in a human-readable form (e.g. 75.2M).
|
||||
*
|
||||
* @param $path the path to the file that will be analyzed
|
||||
* @return the file size in a human-readable form
|
||||
* @return string the file size in a human-readable form
|
||||
*/
|
||||
public static function getFileSize($path)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ class FileUtils
|
||||
* Returns the extension of the given file.
|
||||
*
|
||||
* @param $path the path to the file that will be analyzed
|
||||
* @return the extension
|
||||
* @return string the extension
|
||||
*/
|
||||
public static function getExtension($path)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ class FileUtils
|
||||
* Returns the SHA-256 hash of the given file.
|
||||
*
|
||||
* @param $path the path to the file that will be analyzed
|
||||
* @return the SHA-256 hash
|
||||
* @return string the SHA-256 hash
|
||||
*/
|
||||
public static function getSha256($path)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ class FileUtils
|
||||
* Returns the date (in ISO 8601 format) that the given file was last modified.
|
||||
*
|
||||
* @param $path the path to the file that will be analyzed
|
||||
* @return the date
|
||||
* @return string the date
|
||||
*/
|
||||
public static function getLastModified($path)
|
||||
{
|
||||
@@ -112,7 +112,7 @@ class FileUtils
|
||||
* that code will work in both environments.
|
||||
*
|
||||
* @param $path the relative path to the file that will be analyzed
|
||||
* @return the path of the file, either relative or absolute
|
||||
* @return string the path of the file, either relative or absolute
|
||||
*/
|
||||
private static function toAbsolutePathIfOnServer($relativePath)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
namespace ScummVM\Models;
|
||||
|
||||
use ScummVM\OrmObjects\GameQuery;
|
||||
use ScummVM\OrmObjects\Screenshot;
|
||||
use ScummVM\OrmObjects\ScreenshotQuery;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
|
||||
/**
|
||||
@@ -19,7 +21,10 @@ class ScreenshotsModel extends BasicModel
|
||||
$categories = ScreenshotQuery::create()->findCategories();
|
||||
$data = [];
|
||||
foreach ($categories as $category) {
|
||||
extract($category);
|
||||
$category_key = $category['category_key'];
|
||||
$category_name = $category['category_name'];
|
||||
$subcategory_key = $category['subcategory_key'];
|
||||
$subcategory_name = $category['subcategory_name'];
|
||||
if (!isset($data[$category_key])) {
|
||||
$data[$category_key] = [
|
||||
'title' => "$category_name Games",
|
||||
@@ -84,7 +89,7 @@ class ScreenshotsModel extends BasicModel
|
||||
/**
|
||||
* Combines multiple screenshots into a single screenshot
|
||||
*
|
||||
* @param ObjectCollection $screenshots
|
||||
* @param Collection $screenshots
|
||||
* @return Screenshot|bool
|
||||
*/
|
||||
private function combineScreenshots(iterable $screenshots)
|
||||
@@ -108,7 +113,7 @@ class ScreenshotsModel extends BasicModel
|
||||
/**
|
||||
* combineSubcategories
|
||||
*
|
||||
* @param ObjectCollection $screenshots
|
||||
* @param Collection $screenshots
|
||||
* @return Screenshot[]
|
||||
*/
|
||||
private function combineSubcategories(iterable $screenshots)
|
||||
@@ -131,7 +136,7 @@ class ScreenshotsModel extends BasicModel
|
||||
/**
|
||||
* Returns the number of screenshot files associated with a given game or series of games
|
||||
* @param $gameOrSeriesId the id of a game or a game series
|
||||
* @return the number of screenshot files
|
||||
* @return int the number of screenshot files
|
||||
*/
|
||||
private function getScreenshotCount(string $gameOrSeriesId)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ class File extends BasicObject
|
||||
private $url;
|
||||
private $extra_info;
|
||||
private $notes;
|
||||
private $subcategory;
|
||||
//private $subcategory;
|
||||
private $user_agent;
|
||||
private $version;
|
||||
|
||||
@@ -25,7 +25,7 @@ class File extends BasicObject
|
||||
$this->category = $data['category'];
|
||||
$this->category_icon = $data['category_icon'];
|
||||
$this->notes = isset($data['notes']) ? $data['notes'] : '';
|
||||
$this->subcategory = $data['subcategory'] ?? null;
|
||||
//$this->subcategory = $data['subcategory'] ?? null;
|
||||
$this->user_agent = isset($data["user_agent"]) ? $data["user_agent"] : "";
|
||||
$this->version = isset($data['version']) ? strtolower($data['version']) : null;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class CompatibilityPage extends Controller
|
||||
$version = $args['version'] ?? null;
|
||||
$target = $args['game'] ?? null;
|
||||
|
||||
$versions = VersionQuery::create()
|
||||
$versions = VersionQuery::create() // @phpstan-ignore method.notFound
|
||||
->orderByMajor('desc')
|
||||
->orderByMinor('desc')
|
||||
->orderByPatch('desc')
|
||||
|
||||
+7
-6
@@ -1,13 +1,14 @@
|
||||
parameters:
|
||||
level: 5
|
||||
treatPhpDocTypesAsCertain: false
|
||||
bootstrapFiles:
|
||||
- include/Constants.php
|
||||
paths:
|
||||
- public_html/index.php
|
||||
- include/
|
||||
excludes_analyse:
|
||||
- include/LocalizationUtils.php
|
||||
- include/DataUtils.php
|
||||
- include/Constants.php
|
||||
|
||||
|
||||
excludePaths:
|
||||
analyse:
|
||||
- include/OrmObjects/Map/*
|
||||
- include/OrmObjects/Base/*
|
||||
universalObjectCratesClasses:
|
||||
- Spatie\YamlFrontMatter\Document
|
||||
|
||||
Reference in New Issue
Block a user