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

@@ -22,7 +22,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController {
Minz_Error::error(403);
}
Minz_View::prependTitle(_t('admin.auth.title') . ' · ');
FreshRSS_View::prependTitle(_t('admin.auth.title') . ' · ');
if (Minz_Request::isPost()) {
$ok = true;
@@ -107,8 +107,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController {
public function formLoginAction() {
invalidateHttpCache();
Minz_View::prependTitle(_t('gen.auth.login') . ' · ');
Minz_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js')));
FreshRSS_View::prependTitle(_t('gen.auth.login') . ' · ');
FreshRSS_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js')));
$limits = FreshRSS_Context::$system_conf->limits;
$this->view->cookie_days = round($limits['cookie_duration'] / 86400, 1);
@@ -237,6 +237,6 @@ class FreshRSS_auth_Controller extends Minz_ActionController {
$this->view->show_tos_checkbox = file_exists(join_path(DATA_PATH, 'tos.html'));
$this->view->show_email_field = FreshRSS_Context::$system_conf->force_email_validation;
$this->view->preferred_language = Minz_Translate::getLanguage(null, Minz_Request::getPreferredLanguages(), FreshRSS_Context::$system_conf->language);
Minz_View::prependTitle(_t('gen.auth.registration.title') . ' · ');
FreshRSS_View::prependTitle(_t('gen.auth.registration.title') . ' · ');
}
}