diff options
5 files changed, 38 insertions, 94 deletions
diff --git a/apps/accessibility/lib/AccessibilityProvider.php b/apps/accessibility/lib/AccessibilityProvider.php index 417cf7d039c..80ba4753dfa 100644 --- a/apps/accessibility/lib/AccessibilityProvider.php +++ b/apps/accessibility/lib/AccessibilityProvider.php @@ -33,22 +33,10 @@ use OCP\IURLGenerator; class AccessibilityProvider { - /** @var string */ - protected $appName; + protected string $appName; + private IURLGenerator $urlGenerator; + private IL10N $l; - /** @var IURLGenerator */ - private $urlGenerator; - - /** @var IL10N */ - private $l; - - /** - * Account constructor. - * - * @param string $appName - * @param IURLGenerator $urlGenerator - * @param IL10N $l - */ public function __construct(string $appName, IURLGenerator $urlGenerator, IL10N $l) { @@ -57,7 +45,10 @@ class AccessibilityProvider { $this->l = $l; } - public function getThemes() { + /** + * @psalm-return array<array-key, array{id: string, img: string, title: string, enableLabel: string, text: string}> + */ + public function getThemes(): array { return [ [ 'id' => 'dark', @@ -69,7 +60,10 @@ class AccessibilityProvider { ]; } - public function getHighContrast() { + /** + * @psalm-return array{id: string, img: string, title: string, enableLabel: string, text: string} + */ + public function getHighContrast(): array { return [ 'id' => 'highcontrast', 'img' => $this->urlGenerator->imagePath($this->appName, 'mode-highcontrast.jpg'), @@ -79,7 +73,10 @@ class AccessibilityProvider { ]; } - public function getFonts() { + /** + * @psalm-return array<array-key, array{id: string, img: string, title: string, enableLabel: string, text: string}> + */ + public function getFonts(): array { return [ [ 'id' => 'fontdyslexic', diff --git a/apps/accessibility/lib/Controller/AccessibilityController.php b/apps/accessibility/lib/Controller/AccessibilityController.php index 7a5a82085dc..d175e3167cc 100644 --- a/apps/accessibility/lib/Controller/AccessibilityController.php +++ b/apps/accessibility/lib/Controller/AccessibilityController.php @@ -48,36 +48,19 @@ use ScssPhp\ScssPhp\OutputStyle; class AccessibilityController extends Controller { - /** @var string */ - protected $appName; - - /** @var string */ - protected $serverRoot; - - /** @var IConfig */ - private $config; - - /** @var LoggerInterface */ - private $logger; - - /** @var ITimeFactory */ - protected $timeFactory; - - /** @var IUserSession */ - private $userSession; - - /** @var IconsCacher */ - protected $iconsCacher; - - /** @var \OC_Defaults */ - private $defaults; - - /** @var null|string */ - private $injectedVariables; - - /** @var string */ - private $appRoot; + protected string $serverRoot; + private IConfig $config; + private LoggerInterface $logger; + protected ITimeFactory $timeFactory; + private IUserSession $userSession; + protected IconsCacher $iconsCacher; + private \OC_Defaults $defaults; + private ?string $injectedVariables = null; + private string $appRoot; + /** + * @param string $appName + */ public function __construct(string $appName, IRequest $request, IConfig $config, @@ -104,8 +87,6 @@ class AccessibilityController extends Controller { * @PublicPage * @NoCSRFRequired * @NoSameSiteCookieRequired - * - * @return DataDisplayResponse */ public function getCss(): DataDisplayResponse { $css = ''; @@ -186,8 +167,6 @@ class AccessibilityController extends Controller { /** * Return an array with the user theme & font settings - * - * @return array */ private function getUserValues(): array { $userTheme = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false); @@ -210,10 +189,6 @@ class AccessibilityController extends Controller { /** * Add the correct uri prefix to make uri valid again - * - * @param string $css - * @param string $webDir - * @return string */ private function rebaseUrls(string $css, string $webDir): string { $re = '/url\([\'"]([^\/][\.\w?=\/-]*)[\'"]\)/x'; @@ -226,9 +201,8 @@ class AccessibilityController extends Controller { * Remove all matches from the $rule regex * * @param string $css string to parse - * @return string */ - private function invertSvgIconsColor(string $css) { + private function invertSvgIconsColor(string $css): string { return str_replace( ['color=000&', 'color=fff&', 'color=***&'], ['color=***&', 'color=000&', 'color=fff&'], diff --git a/apps/accessibility/lib/Controller/ConfigController.php b/apps/accessibility/lib/Controller/ConfigController.php index 592c2268eb8..3cc66ed4cb4 100644 --- a/apps/accessibility/lib/Controller/ConfigController.php +++ b/apps/accessibility/lib/Controller/ConfigController.php @@ -41,32 +41,13 @@ use OCP\PreConditionNotMetException; class ConfigController extends OCSController { - /** @var string */ - protected $appName; - - /** @var string */ - protected $userId; - - /** @var string */ - protected $serverRoot; - - /** @var IConfig */ - private $config; - - /** @var IUserSession */ - private $userSession; - - /** @var AccessibilityProvider */ - private $accessibilityProvider; + protected string $userId; + private IConfig $config; + private IUserSession $userSession; + private AccessibilityProvider $accessibilityProvider; /** * Config constructor. - * - * @param string $appName - * @param IRequest $request - * @param IConfig $config - * @param IUserSession $userSession - * @param AccessibilityProvider $accessibilityProvider */ public function __construct(string $appName, IRequest $request, @@ -74,7 +55,6 @@ class ConfigController extends OCSController { IUserSession $userSession, AccessibilityProvider $accessibilityProvider) { parent::__construct($appName, $request); - $this->appName = $appName; $this->config = $config; $this->userSession = $userSession; $this->accessibilityProvider = $accessibilityProvider; @@ -102,7 +82,8 @@ class ConfigController extends OCSController { * * Set theme or font config * - * @param string $key theme or font + * @param string $key the theme or font + * @param string|false $value the value * @return DataResponse * @throws OCSBadRequestException|PreConditionNotMetException */ diff --git a/apps/accessibility/lib/Migration/RepairUserConfig.php b/apps/accessibility/lib/Migration/RepairUserConfig.php index 45a2ca3c095..c15280ae26d 100644 --- a/apps/accessibility/lib/Migration/RepairUserConfig.php +++ b/apps/accessibility/lib/Migration/RepairUserConfig.php @@ -35,17 +35,11 @@ use OCP\Migration\IRepairStep; class RepairUserConfig implements IRepairStep { - /** @var IUserManager */ - protected $userManager; - - /** @var IConfig */ - protected $config; + protected IUserManager $userManager; + protected IConfig $config; /** * MigrateUserConfig constructor. - * - * @param IConfig $config - * @param IUserManager $userManager */ public function __construct(IConfig $config, IUserManager $userManager) { diff --git a/apps/accessibility/lib/Service/JSDataService.php b/apps/accessibility/lib/Service/JSDataService.php index d705957a49c..e3a562de394 100644 --- a/apps/accessibility/lib/Service/JSDataService.php +++ b/apps/accessibility/lib/Service/JSDataService.php @@ -31,10 +31,8 @@ use OCP\IConfig; use OCP\IUserSession; class JSDataService extends InitialStateProvider { - /** @var IUserSession */ - private $userSession; - /** @var IConfig */ - private $config; + private IUserSession $userSession; + private IConfig $config; public function __construct( IUserSession $userSession, |