Skip to content

Commit

Permalink
PHPStan 1.11 + minor update dev dependencies (FreshRSS#6459)
Browse files Browse the repository at this point in the history
* PHPStan 1.11 + minor update dev dependencies
https://github.com/phpstan/phpstan/releases/tag/1.11.0

* Comment style
  • Loading branch information
Alkarex authored May 15, 2024
1 parent f958eae commit 2d17c02
Show file tree
Hide file tree
Showing 16 changed files with 139 additions and 194 deletions.
8 changes: 4 additions & 4 deletions app/Controllers/updateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function applyAction(): void {
$res = !self::hasGitUpdate();
} else {
require(UPDATE_FILENAME);
// @phpstan-ignore-next-line
// @phpstan-ignore function.notFound
$res = do_post_update();
}

Expand All @@ -290,12 +290,12 @@ public function applyAction(): void {
} else {
require(UPDATE_FILENAME);
if (Minz_Request::isPost()) {
// @phpstan-ignore-next-line
// @phpstan-ignore function.notFound
save_info_update();
}
// @phpstan-ignore-next-line
// @phpstan-ignore function.notFound
if (!need_info_update()) {
// @phpstan-ignore-next-line
// @phpstan-ignore function.notFound
$res = apply_update();
} else {
return;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ public function _nbEntries(int $value): void {
public function load(bool $loadDetails = false, bool $noCache = false): ?SimplePie {
if ($this->url != '') {
/**
* @phpstan-ignore-next-line
* @throws Minz_FileNotExistException
* @phpstan-ignore if.alwaysFalse
*/
if (CACHE_PATH == '') {
throw new Minz_FileNotExistException(
Expand Down
2 changes: 2 additions & 0 deletions app/Models/TagDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ public function getTagsForEntries(array $entries) {
}
$sql .= ' AND et.id_entry IN (' . str_repeat('?,', count($entries) - 1). '?)';
if (is_array($entries[0])) {
/** @var array<array<string,string>> $entries */
foreach ($entries as $entry) {
if (!empty($entry['id'])) {
$values[] = $entry['id'];
Expand All @@ -394,6 +395,7 @@ public function getTagsForEntries(array $entries) {
$values[] = $entry->id();
}
} else {
/** @var array<numeric-string> $entries */
foreach ($entries as $entry) {
$values[] = $entry;
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/update/apply.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<h1><?= _t('admin.update') ?></h1>

<?php
// @phpstan-ignore-next-line
// @phpstan-ignore function.notFound
ask_info_update();
?>
</main>
2 changes: 1 addition & 1 deletion cli/CliOptionsParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private function appendTypedValidValues(): void {
}

if (!empty($typedValues)) {
// @phpstan-ignore-next-line (change to `@phpstan-ignore property.dynamicName` when upgrading to PHPStan 1.11+)
// @phpstan-ignore property.dynamicName
$this->$name = $types['isArray'] ? $typedValues : array_pop($typedValues);
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/reconfigure.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function __construct() {
}
break;
}
// @phpstan-ignore-next-line (change to `@phpstan-ignore property.dynamicName` when upgrading to PHPStan 1.11+)
// @phpstan-ignore assign.propertyType, property.dynamicName
$systemConf->$name = $value;
}
}
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"ext-phar": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-strict-rules": "^1.6",
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "^3.9"
},
Expand Down
42 changes: 21 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Minz/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function get(string $namespace) {
/**
* The namespace of the current configuration.
* Unused.
* @phpstan-ignore-next-line
* @phpstan-ignore property.onlyWritten
*/
private string $namespace = '';

Expand Down
6 changes: 3 additions & 3 deletions lib/Minz/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function run(): void {
$this->createController (Minz_Request::controllerName ());
$this->controller->init ();
$this->controller->firstAction ();
// @phpstan-ignore-next-line
// @phpstan-ignore booleanNot.alwaysTrue
if (!self::$needsReset) {
$this->launchAction (
Minz_Request::actionName ()
Expand All @@ -53,15 +53,15 @@ public function run(): void {
}
$this->controller->lastAction ();

// @phpstan-ignore-next-line
// @phpstan-ignore booleanNot.alwaysTrue
if (!self::$needsReset) {
$this->controller->declareCspHeader();
$this->controller->view ()->build ();
}
} catch (Minz_Exception $e) {
throw $e;
}
// @phpstan-ignore-next-line
// @phpstan-ignore doWhile.alwaysFalse
} while (self::$needsReset);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Minz/Pdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function lastInsertId($name = null) {
* @param array<int,string> $options
* @return PDOStatement|false
* @throws PDOException if the attribute `PDO::ATTR_ERRMODE` is set to `PDO::ERRMODE_EXCEPTION`
* @phpstan-ignore-next-line
* @phpstan-ignore method.childParameterType, throws.unusedType
*/
#[\Override]
#[\ReturnTypeWillChange]
Expand All @@ -72,7 +72,7 @@ public function prepare($query, $options = []) {
* @param string $statement
* @return int|false
* @throws PDOException if the attribute `PDO::ATTR_ERRMODE` is set to `PDO::ERRMODE_EXCEPTION`
* @phpstan-ignore-next-line
* @phpstan-ignore throws.unusedType
*/
#[\Override]
#[\ReturnTypeWillChange]
Expand All @@ -84,7 +84,7 @@ public function exec($statement) {
/**
* @return PDOStatement|false
* @throws PDOException if the attribute `PDO::ATTR_ERRMODE` is set to `PDO::ERRMODE_EXCEPTION`
* @phpstan-ignore-next-line
* @phpstan-ignore throws.unusedType
*/
#[\Override]
#[\ReturnTypeWillChange]
Expand Down
3 changes: 1 addition & 2 deletions lib/Minz/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ public static function _param(string $key, $value): void {

public function attributeParams(): void {
foreach (Minz_View::$params as $key => $value) {
// TODO: Do not use variable variable (noVariableVariables)
/** @phpstan-ignore-next-line */
// @phpstan-ignore property.dynamicName
$this->$key = $value;
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/http-conditional.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ function httpConditional(int $UnixTimeStamp, int $cacheSeconds = 0, int $cachePr
}
$etagServer = '"' . md5($scriptName . $myQuery . '#' . $dateLastModif) . '"';

// @phpstan-ignore-next-line
// @phpstan-ignore booleanNot.alwaysTrue
if ((!$is412) && isset($_SERVER['HTTP_IF_MATCH'])) { //rfc2616-sec14.html#sec14.24
$etagsClient = stripslashes($_SERVER['HTTP_IF_MATCH']);
$etagsClient = str_ireplace('-gzip', '', $etagsClient);
$is412 = (($etagsClient !== '*') && (strpos($etagsClient, $etagServer) === false));
}
// @phpstan-ignore-next-line
// @phpstan-ignore booleanAnd.leftAlwaysTrue
if ($is304 && isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { //rfc2616-sec14.html#sec14.25 //rfc1945.txt
$nbCond++;
$dateCacheClient = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
Expand Down
2 changes: 1 addition & 1 deletion lib/lib_rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function str_starts_with(string $haystack, string $needle): bool {
define('STDERR', fopen('php://stderr', 'w'));
}
function syslog(int $priority, string $message): bool {
// @phpstan-ignore-next-line
// @phpstan-ignore booleanAnd.rightAlwaysTrue
if (COPY_SYSLOG_TO_STDERR && defined('STDERR') && STDERR) {
return fwrite(STDERR, $message . "\n") != false;
}
Expand Down
Loading

0 comments on commit 2d17c02

Please sign in to comment.