Auth/CAS: fix CLI mode

This commit is contained in:
Benjamin Renard 2024-05-27 17:41:05 +02:00
parent 4a190f3f25
commit 62fbdbf1c2
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -22,8 +22,12 @@ class Cas extends Method {
* @return boolean
*/
public static function init() {
// In phpstan context, do not initialize
if (defined('__PHPSTAN_RUNNING__') && constant('__PHPSTAN_RUNNING__')) // @phpstan-ignore-line
// In CLI or Phpstan context, do not initialize
if (
php_sapi_name() == "cli"
// @phpstan-ignore-next-line
|| (defined('__PHPSTAN_RUNNING__') && constant('__PHPSTAN_RUNNING__'))
)
return true;
// Set config default values
App :: set_default(