From e3b0ee152639b4388b15b78d229107f0caa20e5a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 6 May 2019 11:57:39 +0200 Subject: - update to 2.15.0 - add patch for libpcre2 10.33 from https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4406 --- 4406.patch | 22 ++++++++++++++++++++++ composer.json | 13 +++++++++---- php-cs-fixer-autoload.patch | 18 ++++++++++-------- php-cs-fixer.spec | 30 +++++++++++++++++++----------- 4 files changed, 60 insertions(+), 23 deletions(-) create mode 100644 4406.patch diff --git a/4406.patch b/4406.patch new file mode 100644 index 0000000..48f04f0 --- /dev/null +++ b/4406.patch @@ -0,0 +1,22 @@ +From e5a5149bdb4b11e3b32130a4c0be62b6a7a3306b Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 6 May 2019 11:38:26 +0200 +Subject: [PATCH] Fix escape sequence is invalid in character clas + +--- + src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php b/src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php +index 1db72935b0..a3a24a8cb7 100644 +--- a/src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php ++++ b/src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php +@@ -84,7 +84,7 @@ private function convertElseifToIf(Tokens $tokens, $index) + $whitespace = ''; + for ($previous = $index - 1; $previous > 0; --$previous) { + $token = $tokens[$previous]; +- if ($token->isWhitespace() && Preg::match('/(\R[^\R]*)$/', $token->getContent(), $matches)) { ++ if ($token->isWhitespace() && Preg::match('/(\R[^\n\r]*)$/', $token->getContent(), $matches)) { + $whitespace = $matches[1]; + + break; diff --git a/composer.json b/composer.json index 30e749c..84661d3 100644 --- a/composer.json +++ b/composer.json @@ -35,13 +35,13 @@ "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", "justinrainbow/json-schema": "^5.0", "keradus/cli-executor": "^1.2", - "mikey179/vfsStream": "^1.6", + "mikey179/vfsstream": "^1.6", "php-coveralls/php-coveralls": "^2.1", "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", - "phpunitgoodpractices/traits": "^1.5.1", + "phpunitgoodpractices/traits": "^1.8", "symfony/phpunit-bridge": "^4.0" }, "suggest": { @@ -53,6 +53,11 @@ "config": { "sort-packages": true }, + "extra": { + "branch-alias": { + "dev-master": "2.15-dev" + } + }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" diff --git a/php-cs-fixer-autoload.patch b/php-cs-fixer-autoload.patch index 209084c..e5269d0 100644 --- a/php-cs-fixer-autoload.patch +++ b/php-cs-fixer-autoload.patch @@ -1,7 +1,7 @@ diff -up ./php-cs-fixer.rpm ./php-cs-fixer ---- ./php-cs-fixer.rpm 2018-06-04 08:32:38.764785724 +0200 -+++ ./php-cs-fixer 2018-06-04 08:33:04.580971680 +0200 -@@ -44,25 +44,7 @@ set_error_handler(function ($severity, $ +--- ./php-cs-fixer.rpm 2019-05-06 09:31:03.871240441 +0200 ++++ ./php-cs-fixer 2019-05-06 09:32:17.127721736 +0200 +@@ -43,27 +43,7 @@ set_error_handler(function ($severity, $ } }); @@ -22,6 +22,8 @@ diff -up ./php-cs-fixer.rpm ./php-cs-fixer - } else { - require_once __DIR__.'/vendor/autoload.php'; - } +- +- unset($a); -} -unset($require); +require_once '/usr/share/php/PhpCsFixer/autoload.php'; @@ -29,8 +31,8 @@ diff -up ./php-cs-fixer.rpm ./php-cs-fixer use Composer\XdebugHandler\XdebugHandler; use PhpCsFixer\Console\Application; diff -up ./src/Console/Command/HelpCommand.php.rpm ./src/Console/Command/HelpCommand.php ---- ./src/Console/Command/HelpCommand.php.rpm 2018-06-04 08:27:41.000000000 +0200 -+++ ./src/Console/Command/HelpCommand.php 2018-06-04 08:32:38.764785724 +0200 +--- ./src/Console/Command/HelpCommand.php.rpm 2019-05-06 09:29:43.000000000 +0200 ++++ ./src/Console/Command/HelpCommand.php 2019-05-06 09:31:03.871240441 +0200 @@ -379,6 +379,8 @@ EOF { static $version = null; @@ -41,9 +43,9 @@ diff -up ./src/Console/Command/HelpCommand.php.rpm ./src/Console/Command/HelpCom return $version; } diff -up ./tests/AutoReview/ProjectCodeTest.php.rpm ./tests/AutoReview/ProjectCodeTest.php ---- ./tests/AutoReview/ProjectCodeTest.php.rpm 2018-06-04 08:27:41.000000000 +0200 -+++ ./tests/AutoReview/ProjectCodeTest.php 2018-06-04 08:32:38.764785724 +0200 -@@ -413,8 +413,11 @@ final class ProjectCodeTest extends Test +--- ./tests/AutoReview/ProjectCodeTest.php.rpm 2019-05-06 09:29:43.000000000 +0200 ++++ ./tests/AutoReview/ProjectCodeTest.php 2019-05-06 09:31:03.872240448 +0200 +@@ -412,8 +412,11 @@ final class ProjectCodeTest extends Test ->files() ->name('*.php') ->in(__DIR__.'/../../src') diff --git a/php-cs-fixer.spec b/php-cs-fixer.spec index 0a97c6a..49daa0a 100644 --- a/php-cs-fixer.spec +++ b/php-cs-fixer.spec @@ -10,7 +10,7 @@ # For compatibility with SCL %undefine __brp_mangle_shebangs -%global gh_commit ff401e58261ffc5934a58f795b3f95b355e276cb +%global gh_commit adfab51ae979ee8b0fcbc55aa231ec2786cb1f91 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) #global gh_date 20150717 %global gh_owner FriendsOfPHP @@ -26,7 +26,7 @@ %global gh_diff_short %(c=%{gh_diff_commit}; echo ${c:0:7}) Name: php-cs-fixer -Version: 2.14.2 +Version: 2.15.0 Release: 1%{?gh_date:.%{gh_date}git%{gh_short}}%{?dist} Summary: A tool to automatically fix PHP code style @@ -39,6 +39,8 @@ Source2: makesrc.sh # Use our autoloader Patch0: %{name}-autoload.patch +# Fix escape sequence is invalid in character class +Patch1: https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4406.patch BuildArch: noarch %if %{with_tests} @@ -85,13 +87,13 @@ BuildRequires: php-symfony3-debug # "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", # "keradus/cli-executor": "^1.2", # "justinrainbow/json-schema": "^5.0", -# "mikey179/vfsStream": "^1.6", +# "mikey179/vfsstream": "^1.6", # "php-coveralls/php-coveralls": "^2.1", # "php-cs-fixer/accessible-object": "^1.0", -# "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1", -# "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1", +# "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", +# "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", # "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", -# "phpunitgoodpractices/traits": "^1.5.1", +# "phpunitgoodpractices/traits": "^1.8", # "symfony/phpunit-bridge": "^4.0" # ignored as test using it fail strangely #BuildRequires: php-composer(keradus/cli-executor) < 2 @@ -99,11 +101,11 @@ BuildRequires: php-symfony3-debug # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 BuildRequires: (php-composer(justinrainbow/json-schema) >= 5.0 with php-composer(justinrainbow/json-schema) < 6) -BuildRequires: (php-composer(mikey179/vfsStream) >= 1.6 with php-composer(mikey179/vfsStream) < 2) +BuildRequires: (php-composer(mikey179/vfsstream) >= 1.6 with php-composer(mikey179/vfsstream) < 2) BuildRequires: (php-composer(php-cs-fixer/accessible-object) >= 1.0 with php-composer(php-cs-fixer/accessible-object) < 2) -BuildRequires: (php-composer(php-cs-fixer/phpunit-constraint-isidenticalstring) >= 1.0 with php-composer(php-cs-fixer/phpunit-constraint-isidenticalstring) < 2) -BuildRequires: (php-composer(php-cs-fixer/phpunit-constraint-xmlmatchesxsd) >= 1.0 with php-composer(php-cs-fixer/phpunit-constraint-xmlmatchesxsd) < 2) -BuildRequires: (php-composer(phpunitgoodpractices/traits) >= 1.5.1 with php-composer(phpunitgoodpractices/traits) < 2) +BuildRequires: (php-composer(php-cs-fixer/phpunit-constraint-isidenticalstring) >= 1.1 with php-composer(php-cs-fixer/phpunit-constraint-isidenticalstring) < 2) +BuildRequires: (php-composer(php-cs-fixer/phpunit-constraint-xmlmatchesxsd) >= 1.1 with php-composer(php-cs-fixer/phpunit-constraint-xmlmatchesxsd) < 2) +BuildRequires: (php-composer(phpunitgoodpractices/traits) >= 1.8 with php-composer(phpunitgoodpractices/traits) < 2) %if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 %global phpunit %{_bindir}/phpunit7 BuildRequires: phpunit7 >= 7.1 @@ -213,6 +215,7 @@ projects. This tool does not only detect them, but also fixes them for you. %prep %setup -q -n %{gh_project}-%{gh_commit} -a1 %patch0 -p1 -b .rpm +%patch1 -p1 mv diff-%{gh_diff_commit}/src src/diff find src -name \*rpm -delete -print @@ -313,7 +316,7 @@ sed -e '//,/<\/listeners>/d' phpunit.xml.dist >phpunit.xml sed -e 's:%{php_home}:%{buildroot}%{php_home}:' -i %{name} ret=0 -for cmdarg in "php %{phpunit}" "php70 %{_bindir}/phpunit6" php71 php72 php73; do +for cmdarg in "php %{phpunit}" php71 php72 php73; do if which $cmdarg; then set $cmdarg $1 -d memory_limit=2G ${2:-%{_bindir}/phpunit7} \ @@ -337,6 +340,11 @@ exit $ret %changelog +* Mon May 6 2019 Remi Collet - 2.15.0-1 +- update to 2.15.0 +- add patch for libpcre2 10.33 from + https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4406 + * Mon Feb 18 2019 Remi Collet - 2.14.2-1 - update to 2.14.2 (no change) -- cgit