[TikiWiki-commits] [Git][tikiwiki/tiki][master] [UPD] Update Squizlabs/php_codesniffer from v3 to v4
"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <691faf8ac0ab5_2a1d27c00832d0@gitlab-sidekiq-low-urgency-cpu-bound-v2-7f698d98f7-9cl95.mail> |
ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
ac9acef6 by ushindi bienvenu at 2025-11-21T00:06:40+00:00
[UPD] Update Squizlabs/php_codesniffer from v3 to v4
---
* [UPD] Update Squizlabs/php_codesniffer from v3 to v4
See merge request tikiwiki/tiki!8592
- - - - -
10 changed files:
- doc/devtools/codesniffer/standards/TikiIgnore/Helpers/IgnoreListTrait.php
- + doc/devtools/codesniffer/standards/TikiIgnore/Helpers/SafeIgnoreList.php
- doc/devtools/codesniffer/standards/TikiIgnore/Sniffs/Classes/IgnoreValidClassNameSniff.php
- doc/devtools/codesniffer/standards/TikiIgnore/Sniffs/Methods/IgnoreCamelCapsMethodNameSniff.php
- doc/devtools/codesniffer/standards/TikiIgnore/Sniffs/Methods/IgnoreMethodDeclarationSniff.php
- doc/devtools/codesniffer/standards/TikiIgnore/generate_ignore_list.php
- doc/devtools/codesniffer/standards/TikiIgnore/ignore_list.json
- phpcs.xml.dist
- vendor_bundled/composer.json
- vendor_bundled/composer.lock
Changes:
=====================================
doc/devtools/codesniffer/standards/TikiIgnore/Helpers/IgnoreListTrait.php
=====================================
@@ -6,6 +6,8 @@
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
namespace Tiki\Standards\TikiIgnore\Helpers;
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'SafeIgnoreList.php';
+
trait IgnoreListTrait
{
protected $ignoreSniffList;
@@ -46,8 +48,8 @@ trait IgnoreListTrait
{
$line = $tokens[$stackPtr]['line'];
if (empty($phpcsFile->tokenizer->ignoredLines[$line])) {
- $phpcsFile->tokenizer->ignoredLines[$line] = [];
+ $phpcsFile->tokenizer->ignoredLines[$line] = SafeIgnoreList::forLine();
}
- $phpcsFile->tokenizer->ignoredLines[$line][$sniff] = true;
+ SafeIgnoreList::markIgnored($phpcsFile->tokenizer->ignoredLines[$line], $sniff);
}
}
=====================================
doc/devtools/codesniffer/standards/TikiIgnore/Helpers/SafeIgnoreList.php
=====================================
@@ -0,0 +1,22 @@
+<?php
+
+namespace Tiki\Standards\TikiIgnore\Helpers;
+
+use PHP_CodeSniffer\Util\IgnoreList;
+
+class SafeIgnoreList
+{
+ public static function forLine(): IgnoreList
+ {
+ // Using the internal factory safely.
+ return IgnoreList::getInstanceIgnoringNothing();
+ }
+
+ /**
+ * Mark a given sniff as ignored on the given line.
+ */
+ public static function markIgnored(IgnoreList $ignoreList, string $sniffCode): void
+ {
+ $ignoreList->set($sniffCode, true);
+ }
+}
=====================================
doc/devtools/codesniffer/standards/TikiIgnore/Sniffs/Classes/IgnoreValidClassNameSniff.php
=====================================
@@ -17,11 +17,11 @@ class IgnoreValidClassNameSniff implements Sniff
{
use IgnoreListTrait;
- protected const SNIFF_NOT_CAMEL_CAPS = 'Squiz.Classes.ValidClassName.NotCamelCaps';
+ protected const SNIFF_NOT_PASCAL_CASE = 'Squiz.Classes.ValidClassName.NotPascalCase';
public function __construct()
{
- $this->loadIgnoreList([self::SNIFF_NOT_CAMEL_CAPS]);
+ $this->loadIgnoreList([self::SNIFF_NOT_PASCAL_CASE]);
}
/**
@@ -75,8 +75,8 @@ class IgnoreValidClassNameSniff implements Sniff
// Check for PascalCase format.
$valid = Common::isCamelCaps($name, true, true, false);
if ($valid === false) {
- if ($this->inIgnoreList(self::SNIFF_NOT_CAMEL_CAPS, $phpcsFile->path, $name)) {
- $this->ignoreToken(self::SNIFF_NOT_CAMEL_CAPS, $phpcsFile, $tokens, $stackPtr);
+ if ($this->inIgnoreList(self::SNIFF_NOT_PASCAL_CASE, $phpcsFile->path, $name)) {
+ $this->ignoreToken(self::SNIFF_NOT_PASCAL_CASE, $phpcsFile, $tokens, $stackPtr);
}
}
}
=====================================
doc/devtools/codesniffer/standards/TikiIgnore/Sniffs/Methods/IgnoreCamelCapsMethodNameSniff.php
=====================================
@@ -6,9 +6,11 @@
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
namespace Tiki\Standards\TikiIgnore\Sniffs\Methods;
+require_once __DIR__ . DIRECTORY_SEPARATOR . '../../Helpers/SafeIgnoreList.php';
+
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff;
-use PHP_CodeSniffer\Util\Common;
+use Tiki\Standards\TikiIgnore\Helpers\SafeIgnoreList;
class IgnoreCamelCapsMethodNameSniff extends CamelCapsMethodNameSniff
{
@@ -57,13 +59,19 @@ class IgnoreCamelCapsMethodNameSniff extends CamelCapsMethodNameSniff
}
$methodName = $phpcsFile->getDeclarationName($stackPtr);
- if ($methodName === null) {
+ if (empty($methodName)) {
// Ignore closures.
return;
}
+
+ if ($tokens[$currScope]['code'] === T_ANON_CLASS) {
+ // Skipping anonymous class in {$phpcsFile->pat[$currScope]['line']}
+ return;
+ }
+
$className = $phpcsFile->getDeclarationName($currScope);
- if (isset($className) === false) {
+ if (! isset($className)) {
// ignore anonymous class.
return;
}
@@ -88,8 +96,8 @@ class IgnoreCamelCapsMethodNameSniff extends CamelCapsMethodNameSniff
$line = $tokens[$stackPtr]['line'];
if (empty($phpcsFile->tokenizer->ignoredLines[$line])) {
- $phpcsFile->tokenizer->ignoredLines[$line] = [];
+ $phpcsFile->tokenizer->ignoredLines[$line] = SafeIgnoreList::forLine();
}
- $phpcsFile->tokenizer->ignoredLines[$line][$this->ignoreSniff] = true;
+ SafeIgnoreList::markIgnored($phpcsFile->tokenizer->ignoredLines[$line], $this->ignoreSniff,);
}
}
=====================================
doc/devtools/codesniffer/standards/TikiIgnore/Sniffs/Methods/IgnoreMethodDeclarationSniff.php
=====================================
@@ -51,7 +51,7 @@ class IgnoreMethodDeclarationSniff extends AbstractScopeSniff
}
$methodName = $phpcsFile->getDeclarationName($stackPtr);
- if ($methodName === null) {
+ if (empty($methodName)) {
// Ignore closures.
return;
}
=====================================
doc/devtools/codesniffer/standards/TikiIgnore/generate_ignore_list.php
=====================================
@@ -74,7 +74,7 @@ $process = [
return $matches[1] . ':' . $matches[2];
},
- 'Squiz.Classes.ValidClassName.NotCamelCaps' => function ($file, $message) {
+ 'Squiz.Classes.ValidClassName.NotPascalCase' => function ($file, $message) {
$parts = explode('"', $message['message']);
return $parts[1];
},
=====================================
doc/devtools/codesniffer/standards/TikiIgnore/ignore_list.json
=====================================
The diff for this file was not included because it is too large.
=====================================
phpcs.xml.dist
=====================================
@@ -159,7 +159,7 @@
<exclude-pattern>lib/cypht/integration/*</exclude-pattern>
<exclude-pattern>lib/cypht/modules/*</exclude-pattern>
</rule>
- <rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
+ <rule ref="Squiz.Classes.ValidClassName.NotPascalCase">
<exclude-pattern>lib/cypht/integration/*</exclude-pattern>
<exclude-pattern>lib/cypht/modules/*</exclude-pattern>
</rule>
=====================================
vendor_bundled/composer.json
=====================================
@@ -1,3 +1,4 @@
+
{
"name": "tiki/tiki",
"description": "Tiki Wiki CMS Groupware",
@@ -81,9 +82,6 @@
" Initialised by lib/setup/errortracking.php when ",
" error_tracking_enabled_php is set",
"",
- " squizlabs/php_codesniffer:",
- " We use version ~3.0 instead of ~4.0 because new version is currently in the pre-release phase",
- "",
" steverhoades/oauth2-openid-connect-client:",
" Provides namespace OpenIDConnectClient",
" Used by lib/OpenIdConnectLib.php",
@@ -303,7 +301,7 @@
"phpunit/phpunit": "~10.5.26",
"rector/rector": "~2.0",
"sebastian/diff": "~5.1",
- "squizlabs/php_codesniffer": "~3.1",
+ "squizlabs/php_codesniffer": "~4.0",
"stevegrunwell/phpunit-markup-assertions": "~2.0",
"symfony/browser-kit": "~6.4",
"symfony/http-client": "~6.4",
=====================================
vendor_bundled/composer.lock
=====================================
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "1badbd3e1e8454d815f3c93d134478e7",
+ "content-hash": "0877d6830395eb5bb77543082e8c9708",
"packages": [
{
"name": "amphp/amp",
@@ -17010,18 +17010,18 @@
"source": {
"type": "git",
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
- "reference": "ec975efc6752a2a41c2d0823e9c5e464c3c2dbb6"
+ "reference": "ff4efdd80e094a81fd6329b570c9a632f21d42b4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/ec975efc6752a2a41c2d0823e9c5e464c3c2dbb6",
- "reference": "ec975efc6752a2a41c2d0823e9c5e464c3c2dbb6",
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/ff4efdd80e094a81fd6329b570c9a632f21d42b4",
+ "reference": "ff4efdd80e094a81fd6329b570c9a632f21d42b4",
"shasum": ""
},
"require": {
"php": ">=5.4",
"phpcsstandards/phpcsutils": "^1.1.2",
- "squizlabs/php_codesniffer": "^3.13.3"
+ "squizlabs/php_codesniffer": "^3.13.3 || ^4.0"
},
"replace": {
"wimg/php-compatibility": "*"
@@ -17096,20 +17096,20 @@
"type": "thanks_dev"
}
],
- "time": "2025-09-05T15:02:16+00:00"
+ "time": "2025-10-30T20:24:19+00:00"
},
{
"name": "phpcsstandards/phpcsutils",
- "version": "1.1.2",
+ "version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/PHPCSUtils.git",
- "reference": "b22b59e3d9ec8fe4953e42c7d59117c6eae70eae"
+ "reference": "8b8e17615d04f2fc2cd46fc1d2fd888fa21b3cf9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/b22b59e3d9ec8fe4953e42c7d59117c6eae70eae",
- "reference": "b22b59e3d9ec8fe4953e42c7d59117c6eae70eae",
+ "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/8b8e17615d04f2fc2cd46fc1d2fd888fa21b3cf9",
+ "reference": "8b8e17615d04f2fc2cd46fc1d2fd888fa21b3cf9",
"shasum": ""
},
"require": {
@@ -17189,7 +17189,7 @@
"type": "thanks_dev"
}
],
- "time": "2025-09-05T00:00:03+00:00"
+ "time": "2025-10-16T16:39:32+00:00"
},
{
"name": "phpstan/phpstan",
@@ -18729,37 +18729,32 @@
},
{
"name": "squizlabs/php_codesniffer",
- "version": "3.13.4",
+ "version": "4.0.1",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
- "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119"
+ "reference": "0525c73950de35ded110cffafb9892946d7771b5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119",
- "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119",
+ "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0525c73950de35ded110cffafb9892946d7771b5",
+ "reference": "0525c73950de35ded110cffafb9892946d7771b5",
"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"
@@ -18778,7 +18773,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",
@@ -18809,7 +18804,7 @@
"type": "thanks_dev"
}
],
- "time": "2025-09-05T05:47:09+00:00"
+ "time": "2025-11-10T16:43:36+00:00"
},
{
"name": "stevegrunwell/phpunit-markup-assertions",
@@ -19099,7 +19094,7 @@
"ext-openssl": "*",
"ext-zip": "*"
},
- "platform-dev": {},
+ "platform-dev": [],
"platform-overrides": {
"php": "8.1",
"ext-ldap": "0",
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ac9acef63cfeef79a217b48609ca4eda70f4be57
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ac9acef63cfeef79a217b48609ca4eda70f4be57
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs