Add PHPStan (#4021)

* Add PHPStan
#fix https://github.com/FreshRSS/FreshRSS/issues/4016
https://phpstan.org/

```sh
composer run-script phpstan
```

* More fixes

* Fix global variables

* Add .phtml

* Fix merge
https://github.com/FreshRSS/FreshRSS/pull/4090

* Fix more warnings

* Fix view errors and enable in CI

* ReturnTypeWillChange

* Dynamic view type

* Fix Minz static/self bug
This commit is contained in:
Alexandre Alapetite
2021-12-31 17:00:51 +01:00
committed by GitHub
parent 09c84fb3bc
commit 77e9877316
106 changed files with 664 additions and 278 deletions

View File

@@ -108,7 +108,7 @@ class FreshRSS_update_Controller extends Minz_ActionController {
}
public function indexAction() {
Minz_View::prependTitle(_t('admin.update.title') . ' · ');
FreshRSS_View::prependTitle(_t('admin.update.title') . ' · ');
if (file_exists(UPDATE_FILENAME)) {
// There is an update file to apply!
@@ -224,6 +224,7 @@ class FreshRSS_update_Controller extends Minz_ActionController {
$res = !self::hasGitUpdate();
} else {
require(UPDATE_FILENAME);
// @phpstan-ignore-next-line
$res = do_post_update();
}
@@ -244,9 +245,12 @@ class FreshRSS_update_Controller extends Minz_ActionController {
} else {
require(UPDATE_FILENAME);
if (Minz_Request::isPost()) {
// @phpstan-ignore-next-line
save_info_update();
}
// @phpstan-ignore-next-line
if (!need_info_update()) {
// @phpstan-ignore-next-line
$res = apply_update();
} else {
return;
@@ -269,7 +273,7 @@ class FreshRSS_update_Controller extends Minz_ActionController {
* This action displays information about installation.
*/
public function checkInstallAction() {
Minz_View::prependTitle(_t('admin.check_install.title') . ' · ');
FreshRSS_View::prependTitle(_t('admin.check_install.title') . ' · ');
$this->view->status_php = check_install_php();
$this->view->status_files = check_install_files();