Compare commits

..

1 commit

Author SHA1 Message Date
Remi Collet
5165d204b1 v3.13.4
(cherry picked from commit 52d2d3edc1)
2025-09-08 10:33:57 +02:00
5 changed files with 86 additions and 64 deletions

3
.gitignore vendored
View file

@ -1,3 +1,2 @@
clog clog
/php-pear-PHP-CodeSniffer-4.0.0-06113cf.tgz /php-pear-PHP-CodeSniffer-3.13.4-ad545ea.tgz
/php-pear-PHP-CodeSniffer-4.0.1-0525c73.tgz

View file

@ -0,0 +1,41 @@
From 472b4f7c56dd95ca4469ed5aad6d6620aa13e03e Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 12 Jan 2024 08:25:58 +0100
Subject: [PATCH] skip tests requiring git repository
---
tests/Core/Filters/GitModifiedTest.php | 3 +++
tests/Core/Filters/GitStagedTest.php | 3 +++
2 files changed, 6 insertions(+)
diff --git a/tests/Core/Filters/GitModifiedTest.php b/tests/Core/Filters/GitModifiedTest.php
index 626fb6531..ca068e144 100644
--- a/tests/Core/Filters/GitModifiedTest.php
+++ b/tests/Core/Filters/GitModifiedTest.php
@@ -211,6 +211,9 @@ final class GitModifiedTest extends AbstractFilterTestCase
*/
public function testExecAlwaysReturnsArray($cmd, $expected)
{
+ if (!is_dir(__DIR__ . '/../../../.git')) {
+ $this->markTestSkipped('Not a git repository');
+ }
$fakeDI = new RecursiveArrayIterator(self::getFakeFileList());
$filter = new GitModified($fakeDI, '/', self::$config, self::$ruleset);
diff --git a/tests/Core/Filters/GitStagedTest.php b/tests/Core/Filters/GitStagedTest.php
index 0009aefa7..cf5f69765 100644
--- a/tests/Core/Filters/GitStagedTest.php
+++ b/tests/Core/Filters/GitStagedTest.php
@@ -211,6 +211,9 @@ final class GitStagedTest extends AbstractFilterTestCase
*/
public function testExecAlwaysReturnsArray($cmd, $expected)
{
+ if (!is_dir(__DIR__ . '/../../../.git')) {
+ $this->markTestSkipped('Not a git repository');
+ }
$fakeDI = new RecursiveArrayIterator(self::getFakeFileList());
$filter = new GitStaged($fakeDI, '/', self::$config, self::$ruleset);
--
2.43.0

View file

@ -1,32 +1,24 @@
diff -up ./bin/phpcbf.rpm ./bin/phpcbf diff -up ./bin/phpcbf.rpm ./bin/phpcbf
--- ./bin/phpcbf.rpm 2025-09-15 14:51:59.780439106 +0200 --- ./bin/phpcbf.rpm 2024-04-02 07:58:25.996735959 +0200
+++ ./bin/phpcbf 2025-09-15 14:53:16.065234768 +0200 +++ ./bin/phpcbf 2024-04-02 07:59:09.906379098 +0200
@@ -21,10 +21,10 @@ @@ -8,7 +8,7 @@
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/ */
// Check if the PHP version and extensions comply with the minimum requirements before anything else. -require_once __DIR__.'/../autoload.php';
-require_once dirname(__DIR__) . '/requirements.php'; +include_once '/usr/share/pear/PHP/CodeSniffer/autoload.php';
+require_once '/usr/share/pear/PHP/CodeSniffer/requirements.php';
PHP_CodeSniffer\checkRequirements();
-require_once dirname(__DIR__) . '/autoload.php';
+require_once '/usr/share/pear/PHP/CodeSniffer/autoload.php';
$runner = new PHP_CodeSniffer\Runner(); $runner = new PHP_CodeSniffer\Runner();
$exitCode = $runner->runPHPCBF(); $exitCode = $runner->runPHPCBF();
diff -up ./bin/phpcs.rpm ./bin/phpcs diff -up ./bin/phpcs.rpm ./bin/phpcs
--- ./bin/phpcs.rpm 2025-09-15 14:51:59.780522757 +0200 --- ./bin/phpcs.rpm 2024-04-02 07:58:25.996735959 +0200
+++ ./bin/phpcs 2025-09-15 14:52:52.535306647 +0200 +++ ./bin/phpcs 2024-04-02 07:59:18.295693037 +0200
@@ -21,10 +21,10 @@ @@ -8,7 +8,7 @@
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/ */
// Check if the PHP version and extensions comply with the minimum requirements before anything else. -require_once __DIR__.'/../autoload.php';
-require_once dirname(__DIR__) . '/requirements.php'; +include_once '/usr/share/pear/PHP/CodeSniffer/autoload.php';
+require_once '/usr/share/pear/PHP/CodeSniffer/requirements.php';
PHP_CodeSniffer\checkRequirements();
-require_once dirname(__DIR__) . '/autoload.php';
+require_once '/usr/share/pear/PHP/CodeSniffer/autoload.php';
$runner = new PHP_CodeSniffer\Runner(); $runner = new PHP_CodeSniffer\Runner();
$exitCode = $runner->runPHPCS(); $exitCode = $runner->runPHPCS();

View file

@ -13,34 +13,31 @@
%bcond_without tests %bcond_without tests
%global gh_commit 0525c73950de35ded110cffafb9892946d7771b5 %global gh_commit ad545ea9c1b7d270ce0fc9cbfb884161cd706119
%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_date 2025-11-10 %global gh_date 2025-09-05
%global gh_owner PHPCSStandards %global gh_owner PHPCSStandards
%global gh_project PHP_CodeSniffer %global gh_project PHP_CodeSniffer
# keep in old PEAR tree # keep in old PEAR tree
%global pear_phpdir %{_datadir}/pear %global pear_phpdir %{_datadir}/pear
%global upstream_version 4.0.1
#global upstream_prever rc1
Name: php-pear-PHP-CodeSniffer Name: php-pear-PHP-CodeSniffer
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} Version: 3.13.4
Release: 1%{?dist} Release: 1%{?dist}
Summary: PHP coding standards enforcement tool Summary: PHP coding standards enforcement tool
License: BSD-3-Clause License: BSD-3-Clause
URL: https://github.com/%{gh_owner}/%{gh_project} URL: https://github.com/%{gh_owner}/%{gh_project}
# git snapshot to retrieve test suite # git snapshot to retrieve test suite
Source0: %{name}-%{upstream_version}%{?upstream_prever}-%{gh_short}.tgz Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh Source1: makesrc.sh
# RPM installation path # RPM installation path
Patch0: %{name}-rpm.patch Patch0: %{name}-rpm.patch
BuildArch: noarch BuildArch: noarch
# 8.1 because of phpunit10 BuildRequires: php(language) >= 5.4
BuildRequires: php(language) >= 8.1
BuildRequires: php-tokenizer BuildRequires: php-tokenizer
BuildRequires: php-xmlwriter BuildRequires: php-xmlwriter
BuildRequires: php-simplexml BuildRequires: php-simplexml
@ -50,17 +47,17 @@ BuildRequires: php-intl
%if %{with tests} %if %{with tests}
BuildRequires: php-bcmath BuildRequires: php-bcmath
# to run test suite, from composer.json "require-dev" # to run test suite, from composer.json "require-dev"
# "phpunit/phpunit": "^8.0 || ^9.3.4 || ^10.5.32 || ^11.3.3" # "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4"
%global phpunit %{_bindir}/phpunit10 %global phpunit %{_bindir}/phpunit9
BuildRequires: phpunit10 >= 10.5.32 BuildRequires: phpunit9 >= 9.3.4
%endif %endif
# from composer.json "require": { # from composer.json "require": {
# "php": ">=7.2.0", # "php": ">=5.4.0",
# "ext-tokenizer": "*", # "ext-tokenizer": "*",
# "ext-xmlwriter": "*", # "ext-xmlwriter": "*",
# "ext-simplexml": "*" # "ext-simplexml": "*"
Requires: php(language) >= 7.2 Requires: php(language) >= 5.4
Requires: php-tokenizer Requires: php-tokenizer
Requires: php-xmlwriter Requires: php-xmlwriter
Requires: php-simplexml Requires: php-simplexml
@ -91,12 +88,11 @@ certain standards, such as PEAR, or user-defined.
%install %install
: Install the library : Install the library
mkdir -p %{buildroot}%{pear_phpdir}/PHP/CodeSniffer mkdir -p %{buildroot}%{pear_phpdir}/PHP/CodeSniffer
cp -pr src %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/src/ cp -pr src %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/src/
cp -pr autoload.php %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/ cp -pr autoload.php %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/
cp -pr requirements.php %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/ cp -p phpcs.xml.dist %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/
cp -p phpcs.xml.dist %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/ cp -p phpcs.xsd %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/
cp -p phpcs.xsd %{buildroot}%{pear_phpdir}/PHP/CodeSniffer/
: Cleanup : Cleanup
find %{buildroot}%{pear_phpdir}/PHP/CodeSniffer -depth -type d -name Tests -exec rm -r {} \; -print find %{buildroot}%{pear_phpdir}/PHP/CodeSniffer -depth -type d -name Tests -exec rm -r {} \; -print
@ -108,34 +104,39 @@ install -Dpm 755 bin/phpcbf %{buildroot}%{_bindir}/phpcbf
%if %{with tests} %if %{with tests}
%check %check
# fails with js: Couldn't read source file
rm src/Standards/Generic/Tests/Debug/JSHintUnitTest.*
# Fix current date # Fix current date
YEAR=$(date +%Y) YEAR=$(date +%Y)
PREV=$(expr $YEAR - 1) PREV=$(expr $YEAR - 1)
sed -e "/@copyright/s/${PREV}/${YEAR}/" \ sed -e "/@copyright/s/${PREV}/${YEAR}/" \
-i src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.1.*.fixed -i src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.1.*.fixed
# Version 4.0.0beta1: Tests: 3871, Assertions: 23018, PHPUnit Deprecations: 777, Skipped: 16. # Version 3.11.2: Tests: 3174, Assertions: 18639, Warnings: 3, Skipped: 19.
# testBrokenRulesetMultiError failing reported as https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/767 # testBrokenRulesetMultiError failing reported as https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/767
ret=0 ret=0
for cmdarg in \ for cmdarg in "php %{phpunit}" php81 php82 php83 php84; do
"php %{phpunit}" \ if which $cmdarg; then
"php81 %{_bindir}/phpunit10" \
"php82 %{_bindir}/phpunit11" \
"php83 %{_bindir}/phpunit11" \
"php84 %{_bindir}/phpunit11" \
"php85 %{_bindir}/phpunit11"
do if which $cmdarg; then
set $cmdarg set $cmdarg
$1 -d memory_limit=-1 $2 \ $1 -d memory_limit=-1 ${2:-%{_bindir}/phpunit9} \
--filter '^((?!(testBrokenRulesetMultiError)).)*$' \ --filter '^((?!(testBrokenRulesetMultiError)).)*$' \
--no-coverage || ret=1 || ret=1
fi fi
done done
exit $ret exit $ret
%endif %endif
%post
# no more from pear channel
if [ -x %{_bindir}/pear ]; then
%{_bindir}/pear uninstall --nodeps --ignore-errors --register-only %{gh_project} >/dev/null || :
fi
%files %files
%{!?_licensedir:%global license %%doc}
%license licence.txt %license licence.txt
%doc *.md %doc *.md
%{pear_phpdir}/PHP %{pear_phpdir}/PHP
@ -144,20 +145,9 @@ exit $ret
%changelog %changelog
* Wed Nov 12 2025 Remi Collet <remi@remirepo.net> - 4.0.1-1
- update to 4.0.1
* Mon Sep 15 2025 Remi Collet <remi@remirepo.net> - 4.0.0-1
- update to 4.0.0
- raise dependency on PHP 7.2
- switch to phpunit10
* Mon Sep 8 2025 Remi Collet <remi@remirepo.net> - 3.13.4-1 * Mon Sep 8 2025 Remi Collet <remi@remirepo.net> - 3.13.4-1
- update to 3.13.4 - update to 3.13.4
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 3.13.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Wed Jun 18 2025 Remi Collet <remi@remirepo.net> - 3.13.2-1 * Wed Jun 18 2025 Remi Collet <remi@remirepo.net> - 3.13.2-1
- update to 3.13.2 - update to 3.13.2

View file

@ -1 +1 @@
SHA512 (php-pear-PHP-CodeSniffer-4.0.1-0525c73.tgz) = 384867fff733de98f3a0cd7105776aa571389e8f11a2d95ba51139a682778650900028722352779bb3b6986f61fa123ceded3d9496de0a05e0872ac21bb1329e SHA512 (php-pear-PHP-CodeSniffer-3.13.4-ad545ea.tgz) = 2506f26e13632b84ac655ac3f5b993bf2227439dba5df528062a68feb8cc0c08724903932176e71b4148b514dd2facc8d226a99b4f046165b28b33b44c0c012f