minor phpstan tweaks

This commit is contained in:
Andrew Dolgov 2021-10-22 13:49:08 +03:00
parent 3b70d1f622
commit 9f734c9050
5 changed files with 15 additions and 12 deletions

View File

@ -307,6 +307,7 @@ class API extends Handler {
$article_ids = explode(',', clean($_REQUEST['article_id'] ?? '')); $article_ids = explode(',', clean($_REQUEST['article_id'] ?? ''));
$sanitize_content = self::_param_to_bool($_REQUEST['sanitize'] ?? true); $sanitize_content = self::_param_to_bool($_REQUEST['sanitize'] ?? true);
// @phpstan-ignore-next-line
if (count($article_ids)) { if (count($article_ids)) {
$entries = ORM::for_table('ttrss_entries') $entries = ORM::for_table('ttrss_entries')
->table_alias('e') ->table_alias('e')
@ -369,7 +370,6 @@ class API extends Handler {
} }
$this->_wrap(self::STATUS_OK, $articles); $this->_wrap(self::STATUS_OK, $articles);
// @phpstan-ignore-next-line
} else { } else {
$this->_wrap(self::STATUS_ERR, ['error' => self::E_INCORRECT_USAGE]); $this->_wrap(self::STATUS_ERR, ['error' => self::E_INCORRECT_USAGE]);
} }

View File

@ -190,6 +190,7 @@ abstract class FeedItem_Common extends FeedItem {
}, $tmp); }, $tmp);
// remove empty values // remove empty values
// @phpstan-ignore-next-line
$tmp = array_filter($tmp, 'strlen'); $tmp = array_filter($tmp, 'strlen');
asort($tmp); asort($tmp);

View File

@ -53,6 +53,10 @@ class Handler_Public extends Handler {
if ($handler) { if ($handler) {
$qfh_ret = $handler->get_headlines(PluginHost::feed_to_pfeed_id((int)$feed), $params); $qfh_ret = $handler->get_headlines(PluginHost::feed_to_pfeed_id((int)$feed), $params);
} else {
user_error("Failed to find handler for plugin feed ID: $feed", E_USER_ERROR);
return false;
} }
} else { } else {

View File

@ -1,7 +1,6 @@
parameters: parameters:
level: 5 level: 5
ignoreErrors: ignoreErrors:
# - '#Constant.*not found#'
- '#Constant.*\b(SUBSTRING_FOR_DATE|SCHEMA_VERSION|SELF_USER_AGENT|LABEL_BASE_INDEX|PLUGIN_FEED_BASE_INDEX)\b.*not found#' - '#Constant.*\b(SUBSTRING_FOR_DATE|SCHEMA_VERSION|SELF_USER_AGENT|LABEL_BASE_INDEX|PLUGIN_FEED_BASE_INDEX)\b.*not found#'
- '#Comparison operation ">" between int<1, max> and 0 is always true.#' - '#Comparison operation ">" between int<1, max> and 0 is always true.#'
- '#Access to an undefined property DOMNode::\$tagName.#' - '#Access to an undefined property DOMNode::\$tagName.#'

View File

@ -23,41 +23,41 @@ use Composer\Semver\VersionParser;
class InstalledVersions class InstalledVersions
{ {
private static $installed = array ( private static $installed = array (
'root' => 'root' =>
array ( array (
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'a73e3bec45c5523910c711cf882976b71781ac9e', 'reference' => 'a73e3bec45c5523910c711cf882976b71781ac9e',
'name' => '__root__', 'name' => '__root__',
), ),
'versions' => 'versions' =>
array ( array (
'__root__' => '__root__' =>
array ( array (
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'a73e3bec45c5523910c711cf882976b71781ac9e', 'reference' => 'a73e3bec45c5523910c711cf882976b71781ac9e',
), ),
'fivefilters/readability.php' => 'fivefilters/readability.php' =>
array ( array (
'pretty_version' => 'v2.1.0', 'pretty_version' => 'v2.1.0',
'version' => '2.1.0.0', 'version' => '2.1.0.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '7617a912b6c527909168f5d41d263792f171c42a', 'reference' => '7617a912b6c527909168f5d41d263792f171c42a',
), ),
'psr/log' => 'psr/log' =>
array ( array (
'pretty_version' => '1.1.4', 'pretty_version' => '1.1.4',
'version' => '1.1.4.0', 'version' => '1.1.4.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
@ -285,7 +285,6 @@ class InstalledVersions
$installed = array(); $installed = array();
if (self::$canGetVendors) { if (self::$canGetVendors) {
// @phpstan-ignore-next-line
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) { if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir]; $installed[] = self::$installedByVendor[$vendorDir];