diff --git a/composer.json b/composer.json index daa8bee2..78b2f1e0 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "ext-xmlwriter": "*", "phpstan/phpstan": "^2", "phpstan/phpstan-strict-rules": "^2", - "squizlabs/php_codesniffer": "^3" + "squizlabs/php_codesniffer": "^4" }, "scripts": { "php-lint": "find . -type d -name 'vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null", diff --git a/composer.lock b/composer.lock index 60add3fe..a7d1037c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "02054632764558c26a4fbecc0e408c09", + "content-hash": "8a6dcc1afea2037b32149736705f192e", "packages": [], "packages-dev": [ { "name": "phpstan/phpstan", - "version": "2.1.22", + "version": "2.1.28", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4" + "reference": "578fa296a166605d97b94091f724f1257185d278" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/41600c8379eb5aee63e9413fe9e97273e25d57e4", - "reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/578fa296a166605d97b94091f724f1257185d278", + "reference": "578fa296a166605d97b94091f724f1257185d278", "shasum": "" }, "require": { @@ -63,7 +63,7 @@ "type": "github" } ], - "time": "2025-08-04T19:17:37+00:00" + "time": "2025-09-19T08:58:49+00:00" }, { "name": "phpstan/phpstan-strict-rules", @@ -115,37 +115,32 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.13.2", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5b5e3821314f947dd040c70f7992a64eac89025c" + "reference": "06113cfdaf117fc2165f9cd040bd0f17fcd5242d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c", - "reference": "5b5e3821314f947dd040c70f7992a64eac89025c", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/06113cfdaf117fc2165f9cd040bd0f17fcd5242d", + "reference": "06113cfdaf117fc2165f9cd040bd0f17fcd5242d", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.4.0" + "php": ">=7.2.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + "phpunit/phpunit": "^8.4.0 || ^9.3.4 || ^10.5.32 || 11.3.3 - 11.5.28 || ^11.5.31" }, "bin": [ "bin/phpcbf", "bin/phpcs" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -164,7 +159,7 @@ "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "description": "PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.", "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", @@ -195,7 +190,7 @@ "type": "thanks_dev" } ], - "time": "2025-06-17T22:17:01+00:00" + "time": "2025-09-15T11:28:58+00:00" } ], "aliases": [], diff --git a/phpcs.xml b/phpcs.xml index 6b280687..9c105532 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -2,23 +2,23 @@ - ./.git/ - ./data/config.php - ./data/update.php - ./data/users/*/config.php - ./extensions/ - ./lib/http-conditional.php - ./lib/marienfressinaud/ - ./lib/phpgt/ - ./lib/phpmailer/ - ./lib/simplepie/ - ./node_modules/ - ./p/scripts/vendor/ - ./vendor/ + /\.git/* + /data/config.php + /data/update.php + /data/users/*/config.php + /(?-i:extensions)/* + /lib/http-conditional.php + /lib/marienfressinaud/ + /lib/phpgt/* + /lib/phpmailer/* + /lib/simplepie/* + /node_modules/* + /p/scripts/vendor/* + /vendor/* - ./symbolic/ - ./third-party/ - ./tmp/ + /symbolic/* + /third-party/* + /tmp/* @@ -33,7 +33,8 @@ - + + @@ -45,7 +46,7 @@ - + @@ -64,7 +65,7 @@ - /app/i18n/*\.php$ + /i18n/*\.php$ *\.phtml$ diff --git a/xExtension-Captcha/Controllers/userController.php b/xExtension-Captcha/Controllers/userController.php index fd84eed9..e8fc0a20 100644 --- a/xExtension-Captcha/Controllers/userController.php +++ b/xExtension-Captcha/Controllers/userController.php @@ -16,4 +16,3 @@ public function createAction(): void { parent::createAction(); } } - diff --git a/xExtension-Captcha/extension.php b/xExtension-Captcha/extension.php index fd619630..7cdbe65b 100644 --- a/xExtension-Captcha/extension.php +++ b/xExtension-Captcha/extension.php @@ -185,7 +185,7 @@ public static function loadDependencies(): array { if ($csp_hosts === 'https://www.google.com') { // Original js_url injects script from www.gstatic.com therefore this is needed $csp_hosts .= "/recaptcha/api.js https://www.gstatic.com/recaptcha/"; - } else if ($csp_hosts === 'https://js.hcaptcha.com') { + } elseif ($csp_hosts === 'https://js.hcaptcha.com') { $csp_hosts = 'https://hcaptcha.com https://*.hcaptcha.com'; } $csp = [ diff --git a/xExtension-ImageProxy/extension.php b/xExtension-ImageProxy/extension.php index 8f5150e2..770d2c31 100644 --- a/xExtension-ImageProxy/extension.php +++ b/xExtension-ImageProxy/extension.php @@ -62,7 +62,8 @@ public function handleConfigureAction(): void { FreshRSS_Context::userConf()->_attribute('image_proxy_url', Minz_Request::paramString('image_proxy_url', plaintext: true) ?: self::PROXY_URL); FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_http', Minz_Request::paramBoolean('image_proxy_scheme_http')); FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_https', Minz_Request::paramBoolean('image_proxy_scheme_https')); - FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_default', Minz_Request::paramString('image_proxy_scheme_default', plaintext: true) ?: self::SCHEME_DEFAULT); + FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_default', + Minz_Request::paramString('image_proxy_scheme_default', plaintext: true) ?: self::SCHEME_DEFAULT); FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_include', Minz_Request::paramBoolean('image_proxy_scheme_include')); FreshRSS_Context::userConf()->_attribute('image_proxy_url_encode', Minz_Request::paramBoolean('image_proxy_url_encode')); FreshRSS_Context::userConf()->save(); @@ -143,7 +144,8 @@ public static function swapUris(string $content): string { $newSrc = self::getProxyImageUri($src); /* Due to the URL change, FreshRSS is not aware of already rendered enclosures. - Adding data-xextension-imageproxy-original-src / srcset ensures that original URLs are present in the content for the renderer check FreshRSS_Entry->containsLink. + Adding data-xextension-imageproxy-original-src / srcset ensures that + original URLs are present in the content for the renderer check FreshRSS_Entry->containsLink. */ $img->setAttribute('data-xextension-imageproxy-original-src', $src); $img->setAttribute('src', $newSrc); diff --git a/xExtension-WordHighlighter/extension.php b/xExtension-WordHighlighter/extension.php index 5c285dc3..f6203f2c 100644 --- a/xExtension-WordHighlighter/extension.php +++ b/xExtension-WordHighlighter/extension.php @@ -4,7 +4,7 @@ final class WordHighlighterExtension extends Minz_Extension { - const JSON_ENCODE_CONF = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR; + private const JSON_ENCODE_CONF = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR; public string $word_highlighter_conf = 'test'; public string $permission_problem = ''; @@ -14,8 +14,7 @@ final class WordHighlighterExtension extends Minz_Extension public bool $separate_word_search = false; #[\Override] - public function init(): void - { + public function init(): void { $this->registerTranslates(); // register CSS for WordHighlighter: @@ -36,8 +35,7 @@ public function init(): void } #[\Override] - public function handleConfigureAction(): void - { + public function handleConfigureAction(): void { $this->registerTranslates(); $current_user = Minz_Session::paramString('currentUser'); @@ -48,11 +46,9 @@ public function handleConfigureAction(): void if (!file_exists($configFileJson) && !is_writable($staticPath)) { $tmpPath = explode(EXTENSIONS_PATH . '/', $staticPath); $this->permission_problem = $tmpPath[1] . '/'; - } elseif (file_exists($configFileJson) && !is_writable($configFileJson)) { $tmpPath = explode(EXTENSIONS_PATH . '/', $configFileJson); $this->permission_problem = $tmpPath[1]; - } elseif (Minz_Request::isPost()) { $configWordList = html_entity_decode(Minz_Request::paramString('words_list')); @@ -85,15 +81,13 @@ public function handleConfigureAction(): void $this->case_sensitive = (bool) ($confJson['case_sensitive'] ?? false); $this->separate_word_search = (bool) ($confJson['separate_word_search'] ?? false); $this->word_highlighter_conf = implode("\n", (array) ($confJson['words'] ?? [])); - - } catch (Exception $exception) { + } catch (Exception $exception) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch // probably nothing to do needed } } } - private function jsonToJs(string $jsonStr): string - { + private function jsonToJs(string $jsonStr): string { $js = "window.WordHighlighterConf = " . $jsonStr . ";\n" . "window.WordHighlighterConf.enable_logs && console.log('WordHighlighter: loaded user config:', window.WordHighlighterConf);"; diff --git a/xExtension-YouTube/extension.php b/xExtension-YouTube/extension.php index e67a30a2..eeb739e2 100644 --- a/xExtension-YouTube/extension.php +++ b/xExtension-YouTube/extension.php @@ -34,8 +34,7 @@ final class YouTubeExtension extends Minz_Extension * Initialize this extension */ #[\Override] - public function init(): void - { + public function init(): void { $this->registerHook('entry_before_display', [$this, 'embedYouTubeVideo']); $this->registerHook('check_url_before_add', [self::class, 'convertYoutubeFeedUrl']); $this->registerHook('custom_favicon_hash', [$this, 'iconHashParams']); @@ -289,8 +288,7 @@ public function setIconForFeed(FreshRSS_Feed $feed, bool $setValues = false): Fr return $feed; } - public static function convertYoutubeFeedUrl(string $url): string - { + public static function convertYoutubeFeedUrl(string $url): string { $matches = []; if (preg_match('#^https?://www\.youtube\.com/channel/([0-9a-zA-Z_-]{6,36})#', $url, $matches) === 1) { @@ -309,8 +307,7 @@ public static function convertYoutubeFeedUrl(string $url): string * Do not call that in your extensions init() method, it can't be used there. * @throws FreshRSS_Context_Exception */ - public function loadConfigValues(): void - { + public function loadConfigValues(): void { if (!class_exists('FreshRSS_Context', false) || !FreshRSS_Context::hasUserConf()) { return; } @@ -345,8 +342,7 @@ public function loadConfigValues(): void * Returns the width in pixel for the YouTube player iframe. * You have to call loadConfigValues() before this one, otherwise you get default values. */ - public function getWidth(): int - { + public function getWidth(): int { return $this->width; } @@ -354,8 +350,7 @@ public function getWidth(): int * Returns the height in pixel for the YouTube player iframe. * You have to call loadConfigValues() before this one, otherwise you get default values. */ - public function getHeight(): int - { + public function getHeight(): int { return $this->height; } @@ -363,8 +358,7 @@ public function getHeight(): int * Returns whether this extension displays the content of the YouTube feed. * You have to call loadConfigValues() before this one, otherwise you get default values. */ - public function isShowContent(): bool - { + public function isShowContent(): bool { return $this->showContent; } @@ -372,8 +366,7 @@ public function isShowContent(): bool * Returns whether the automatic icon download option is enabled. * You have to call loadConfigValues() before this one, otherwise you get default values. */ - public function isDownloadIcons(): bool - { + public function isDownloadIcons(): bool { return $this->downloadIcons; } @@ -381,8 +374,7 @@ public function isDownloadIcons(): bool * Returns if this extension should use youtube-nocookie.com instead of youtube.com. * You have to call loadConfigValues() before this one, otherwise you get default values. */ - public function isUseNoCookieDomain(): bool - { + public function isUseNoCookieDomain(): bool { return $this->useNoCookie; } @@ -390,8 +382,7 @@ public function isUseNoCookieDomain(): bool * Inserts the YouTube video iframe into the content of an entry, if the entries link points to a YouTube watch URL. * @throws FreshRSS_Context_Exception */ - public function embedYouTubeVideo(FreshRSS_Entry $entry): FreshRSS_Entry - { + public function embedYouTubeVideo(FreshRSS_Entry $entry): FreshRSS_Entry { $link = $entry->link(); if ($this->isShort($link)) { @@ -410,8 +401,7 @@ public function embedYouTubeVideo(FreshRSS_Entry $entry): FreshRSS_Entry if (stripos($link, 'www.youtube.com/watch?v=') !== false) { $html = $this->getHtmlContentForLink($entry, $link); - } - else { //peertube + } else { //peertube $html = $this->getHtmlPeerTubeContentForLink($entry, $link); } @@ -422,13 +412,12 @@ public function embedYouTubeVideo(FreshRSS_Entry $entry): FreshRSS_Entry /** * Returns an HTML