Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps-dev): update friendsofphp/php-cs-fixer requirement from 3.6.* to 3.9.* #6252

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jul 11, 2022

Updates the requirements on friendsofphp/php-cs-fixer to permit the latest version.

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update external dependencies php Pull requests that update Php code labels Jul 11, 2022
@kenjis
Copy link
Member

kenjis commented Jul 12, 2022

$ composer cs-fix
> php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.user-guide.php
PHP CS Fixer 3.9.2 Grand Awaiting by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.0.21
Loaded config CodeIgniter4 Coding Standards from ".php-cs-fixer.user-guide.php".
Using cache file "build/.php-cs-fixer.user-guide.cache".
............F......................F................................................   84 / 1430 (  6%)
....................................................................................  168 / 1430 ( 12%)
....................................................................................  252 / 1430 ( 18%)
....................................................................................  336 / 1430 ( 23%)
....................................................................................  420 / 1430 ( 29%)
....................................................................................  504 / 1430 ( 35%)
....................................................................................  588 / 1430 ( 41%)
....................................................................................  672 / 1430 ( 47%)
....................................................................................  756 / 1430 ( 53%)
....................................................................................  840 / 1430 ( 59%)
....................................................................................  924 / 1430 ( 65%)
................................F................................................... 1008 / 1430 ( 70%)
.................................................................................... 1092 / 1430 ( 76%)
.................................................................................... 1176 / 1430 ( 82%)
.................................................................................... 1260 / 1430 ( 88%)
.................................................................................... 1344 / 1430 ( 94%)
.................................................................................... 1428 / 1430 (100%)
..                                                                                   1430 / 1430 (100%)
Legend: ?-unknown, I-invalid file syntax (file ignored), S-skipped (cached or empty file), .-no changes, F-fixed, E-error
   1) /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/database/queries/017.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/database/queries/017.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/database/queries/017.php
@@ -2,7 +2,7 @@
 
 use CodeIgniter\Database\Query;
 
-$pQuery = $db->prepare(static function ($db) {
+$pQuery  = $db->prepare(static function ($db) {
     $sql = 'INSERT INTO user (name, email, country) VALUES (?, ?, ?)';
 
     return (new Query($db))->setQuery($sql);

      ----------- end diff -----------

   2) /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/database/queries/018.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/database/queries/018.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/database/queries/018.php
@@ -2,7 +2,7 @@
 
 use CodeIgniter\Database\Query;
 
-$pQuery = $db->prepare(static function ($db) {
+$pQuery  = $db->prepare(static function ($db) {
     $sql = 'INSERT INTO user (name, email, country) VALUES (?, ?, ?)';
 
     return (new Query($db))->setQuery($sql);

      ----------- end diff -----------

   3) /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/testing/fabricator/017.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/testing/fabricator/017.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/user_guide_src/source/testing/fabricator/017.php
@@ -1,5 +1,5 @@
 <?php
 
 $fabricator->setOverrides(['first' => 'Bobby'], $persist = false);
-$bobbyUser = $fabricator->make();
-$bobbyUser = $fabricator->make();
+$bobbyUser                                               = $fabricator->make();
+$bobbyUser                                               = $fabricator->make();

      ----------- end diff -----------


Fixed all files in 5.974 seconds, 18.000 MB memory used

Detected deprecations in use:
- Rule "Nexus/space_after_comment_start" is deprecated. Use "single_line_comment_spacing" instead.
> php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.no-header.php
PHP CS Fixer 3.9.2 Grand Awaiting by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.0.21
Loaded config CodeIgniter4 Coding Standards from ".php-cs-fixer.no-header.php".
Using cache file "build/.php-cs-fixer.no-header.cache".
.............................................................F......                     68 / 68 (100%)
Legend: ?-unknown, I-invalid file syntax (file ignored), S-skipped (cached or empty file), .-no changes, F-fixed, E-error
   1) /Users/kenji/work/codeigniter/CodeIgniter4/app/Views/errors/html/error_exception.php (braces, unary_operator_spaces, not_operator_with_successor_space)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/app/Views/errors/html/error_exception.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/app/Views/errors/html/error_exception.php
@@ -68,7 +68,7 @@
                                 } else {
                                     echo esc(clean_path($row['file']) . ' : ' . $row['line']);
                                 }
-                                ?>
+                    ?>
                             <?php else: ?>
                                 {PHP internal code}
                             <?php endif; ?>
@@ -83,14 +83,14 @@
                                         <table cellspacing="0">
 
                                         <?php
-                                        $params = null;
-                                        // Reflection by name is not available for closure function
-                                        if (substr($row['function'], -1) !== '}') {
-                                            $mirror = isset($row['class']) ? new \ReflectionMethod($row['class'], $row['function']) : new \ReflectionFunction($row['function']);
-                                            $params = $mirror->getParameters();
-                                        }
+                            $params = null;
+                                    // Reflection by name is not available for closure function
+                                    if (substr($row['function'], -1) !== '}') {
+                                        $mirror = isset($row['class']) ? new \ReflectionMethod($row['class'], $row['function']) : new \ReflectionFunction($row['function']);
+                                        $params = $mirror->getParameters();
+                                    }
 
-                                        foreach ($row['args'] as $key => $value) : ?>
+                                    foreach ($row['args'] as $key => $value) : ?>
                                             <tr>
                                                 <td><code><?= esc(isset($params[$key]) ? '$' . $params[$key]->name : "#{$key}") ?></code></td>
                                                 <td><pre><?= esc(print_r($value, true)) ?></pre></td>
@@ -308,8 +308,8 @@
             <!-- Response -->
             <?php
                 $response = \Config\Services::response();
-                $response->setStatusCode(http_response_code());
-            ?>
+$response->setStatusCode(http_response_code());
+?>
             <div class="content" id="response">
                 <table>
                     <tr>

      ----------- end diff -----------


Fixed all files in 1.661 seconds, 18.000 MB memory used

Detected deprecations in use:
- Rule "Nexus/space_after_comment_start" is deprecated. Use "single_line_comment_spacing" instead.
> php-cs-fixer fix --ansi --verbose --diff
PHP CS Fixer 3.9.2 Grand Awaiting by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.0.21
Loaded config CodeIgniter4 Coding Standards from "/Users/kenji/work/codeigniter/CodeIgniter4/.php-cs-fixer.dist.php".
Using cache file "build/.php-cs-fixer.cache".
......................................F........F......................................  86 / 788 ( 11%)
...................................................................................... 172 / 788 ( 22%)
............................................F.....................F................... 258 / 788 ( 33%)
...............................................................F...................... 344 / 788 ( 44%)
.........................................................F............................ 430 / 788 ( 55%)
...................................................................................... 516 / 788 ( 65%)
.............F.........F.............................................................. 602 / 788 ( 76%)
..F.....................F.........................F..............................S.... 688 / 788 ( 87%)
...............................F.F.................................................... 774 / 788 ( 98%)
......F.......                                                                         788 / 788 (100%)
Legend: ?-unknown, I-invalid file syntax (file ignored), S-skipped (cached or empty file), .-no changes, F-fixed, E-error
   1) /Users/kenji/work/codeigniter/CodeIgniter4/system/Database/OCI8/Builder.php (unary_operator_spaces, not_operator_with_successor_space, binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/system/Database/OCI8/Builder.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/system/Database/OCI8/Builder.php
@@ -99,7 +99,7 @@
     {
         $fieldNames = array_map(static fn ($columnName) => trim($columnName, '"'), $keys);
 
-        $uniqueIndexes = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames) {
+        $uniqueIndexes    = array_filter($this->db->getIndexData($table), static function ($index) use ($fieldNames) {
             $hasAllFields = count(array_intersect($index->fields, $fieldNames)) === count($index->fields);
 
             return ($index->type === 'PRIMARY') && $hasAllFields;

      ----------- end diff -----------

   2) /Users/kenji/work/codeigniter/CodeIgniter4/system/Database/SQLite3/Result.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/system/Database/SQLite3/Result.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/system/Database/SQLite3/Result.php
@@ -139,7 +139,7 @@
             return $classObj->setAttributes($row);
         }
 
-        $classSet = Closure::bind(function ($key, $value) {
+        $classSet         = Closure::bind(function ($key, $value) {
             $this->{$key} = $value;
         }, $classObj, $className);
 

      ----------- end diff -----------

   3) /Users/kenji/work/codeigniter/CodeIgniter4/system/HTTP/ContentSecurityPolicy.php (unary_operator_spaces, not_operator_with_successor_space, binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/system/HTTP/ContentSecurityPolicy.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/system/HTTP/ContentSecurityPolicy.php
@@ -675,7 +675,7 @@
         $pattern = '/(' . preg_quote($this->styleNonceTag, '/')
             . '|' . preg_quote($this->scriptNonceTag, '/') . ')/';
 
-        $body = preg_replace_callback($pattern, function ($match) {
+        $body      = preg_replace_callback($pattern, function ($match) {
             $nonce = $match[0] === $this->styleNonceTag ? $this->getStyleNonce() : $this->getScriptNonce();
 
             return "nonce=\"{$nonce}\"";

      ----------- end diff -----------

   4) /Users/kenji/work/codeigniter/CodeIgniter4/system/CodeIgniter.php (braces, unary_operator_spaces, not_operator_with_successor_space)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/system/CodeIgniter.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/system/CodeIgniter.php
@@ -939,7 +939,7 @@
             if (ob_get_level() > 0) {
                 ob_end_flush();
             }
-            // @codeCoverageIgnoreEnd
+        // @codeCoverageIgnoreEnd
         }
         // When testing, one is for phpunit, another is for test case.
         elseif (ob_get_level() > 2) {

      ----------- end diff -----------

   5) /Users/kenji/work/codeigniter/CodeIgniter4/system/Common.php (braces, unary_operator_spaces, not_operator_with_successor_space)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/system/Common.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/system/Common.php
@@ -137,7 +137,7 @@
          */
         while ($cursor < $length) {
             if (preg_match('/\s+/A', $command, $match, 0, $cursor)) {
-                // nothing to do
+            // nothing to do
             } elseif (preg_match('/' . $regexQuoted . '/A', $command, $match, 0, $cursor)) {
                 $args[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
             } elseif (preg_match('/' . $regexString . '/A', $command, $match, 0, $cursor)) {

      ----------- end diff -----------

   6) /Users/kenji/work/codeigniter/CodeIgniter4/system/Router/Router.php (unary_operator_spaces, not_operator_with_successor_space, binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/system/Router/Router.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/system/Router/Router.php
@@ -419,7 +419,7 @@
                 // Is this route supposed to redirect to another?
                 if ($this->collection->isRedirect($routeKey)) {
                     // replacing matched route groups with references: post/([0-9]+) -> post/$1
-                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function () {
+                    $redirectTo   = preg_replace_callback('/(\([^\(]+\))/', static function () {
                         static $i = 1;
 
                         return '$' . $i++;

      ----------- end diff -----------

   7) /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Database/Live/OCI8/LastInsertIDTest.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Database/Live/OCI8/LastInsertIDTest.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Database/Live/OCI8/LastInsertIDTest.php
@@ -76,7 +76,7 @@
 
     public function testGetInsertIDWithPreparedQuery()
     {
-        $query = $this->db->prepare(static function ($db) {
+        $query   = $this->db->prepare(static function ($db) {
             $sql = 'INSERT INTO "db_job" ("name", "description") VALUES (?, ?)';
 
             return (new Query($db))->setQuery($sql);

      ----------- end diff -----------

   8) /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Database/Live/PreparedQueryTest.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Database/Live/PreparedQueryTest.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Database/Live/PreparedQueryTest.php
@@ -77,7 +77,7 @@
     public function testPrepareReturnsManualPreparedQuery()
     {
         $this->query = $this->db->prepare(static function ($db) {
-            $sql = "INSERT INTO {$db->DBPrefix}user (name, email, country) VALUES (?, ?, ?)";
+            $sql     = "INSERT INTO {$db->DBPrefix}user (name, email, country) VALUES (?, ?, ?)";
 
             return (new Query($db))->setQuery($sql);
         });
@@ -115,7 +115,7 @@
     public function testExecuteRunsQueryAndReturnsManualResultObject()
     {
         $this->query = $this->db->prepare(static function ($db) {
-            $sql = "INSERT INTO {$db->protectIdentifiers($db->DBPrefix . 'user')} ("
+            $sql     = "INSERT INTO {$db->protectIdentifiers($db->DBPrefix . 'user')} ("
                   . $db->protectIdentifiers('name') . ', '
                   . $db->protectIdentifiers('email') . ', '
                   . $db->protectIdentifiers('country')

      ----------- end diff -----------

   9) /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Entity/EntityTest.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Entity/EntityTest.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Entity/EntityTest.php
@@ -596,7 +596,7 @@
         $this->expectExceptionMessage('Syntax error, malformed JSON');
 
         (Closure::bind(static function (string $value) {
-            $entity = new Entity();
+            $entity                 = new Entity();
             $entity->casts['dummy'] = 'json[array]';
 
             return $entity->castAs($value, 'dummy');
@@ -610,7 +610,7 @@
 
         $string = '{' . str_repeat('"test":{', 513) . '"test":"value"' . str_repeat('}', 513) . '}';
         (Closure::bind(static function (string $value) {
-            $entity = new Entity();
+            $entity                 = new Entity();
             $entity->casts['dummy'] = 'json[array]';
 
             return $entity->castAs($value, 'dummy');
@@ -624,7 +624,7 @@
 
         $string = "{\n\t\"property1\": \"The quick brown fox\njumps over the lazy dog\",\n\t\"property2\":\"value2\"\n}";
         (Closure::bind(static function (string $value) {
-            $entity = new Entity();
+            $entity                 = new Entity();
             $entity->casts['dummy'] = 'json[array]';
 
             return $entity->castAs($value, 'dummy');
@@ -638,7 +638,7 @@
 
         $string = '[{"name":"jack","product_id":"1234"]';
         (Closure::bind(static function (string $value) {
-            $entity = new Entity();
+            $entity                 = new Entity();
             $entity->casts['dummy'] = 'json[array]';
 
             return $entity->castAs($value, 'dummy');

      ----------- end diff -----------

  10) /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/CodeIgniterTest.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/CodeIgniterTest.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/CodeIgniterTest.php
@@ -175,7 +175,7 @@
         $routes = Services::routes();
         $routes->add('pages/(:segment)', static function ($segment) {
             $response = Services::response();
-            $string = "You want to see 'about' page.";
+            $string   = "You want to see 'about' page.";
 
             return $response->setBody($string);
         });

      ----------- end diff -----------

  11) /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/View/ParserTest.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/View/ParserTest.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/View/ParserTest.php
@@ -738,7 +738,7 @@
     public function testParserPluginParams()
     {
         $this->parser->addPlugin('growth', static function ($str, array $params) {
-            $step = $params['step'] ?? 1;
+            $step  = $params['step'] ?? 1;
             $count = $params['count'] ?? 2;
 
             $out = '';

      ----------- end diff -----------

  12) /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Events/EventsTest.php (binary_operator_spaces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Events/EventsTest.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/Events/EventsTest.php
@@ -179,7 +179,7 @@
     {
         $result = false;
 
-        $callback = static function () use (&$result) {
+        $callback   = static function () use (&$result) {
             $result = true;
         };
 
@@ -199,7 +199,7 @@
     {
         $result = false;
 
-        $callback = static function () use (&$result) {
+        $callback   = static function () use (&$result) {
             $result = true;
         };
 
@@ -220,7 +220,7 @@
     {
         $result = false;
 
-        $callback = static function () use (&$result) {
+        $callback   = static function () use (&$result) {
             $result = true;
         };
 
@@ -240,7 +240,7 @@
     {
         $result = false;
 
-        $callback = static function () use (&$result) {
+        $callback   = static function () use (&$result) {
             $result = true;
         };
 
@@ -257,7 +257,7 @@
     {
         $result = false;
 
-        $callback = static function () use (&$result) {
+        $callback   = static function () use (&$result) {
             $result = true;
         };
 

      ----------- end diff -----------

  13) /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/I18n/TimeTest.php (braces)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/I18n/TimeTest.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/tests/system/I18n/TimeTest.php
@@ -55,7 +55,7 @@
             IntlDateFormatter::SHORT,
             IntlDateFormatter::SHORT,
             'Europe/London', // Default for CodeIgniter
-                IntlDateFormatter::GREGORIAN,
+            IntlDateFormatter::GREGORIAN,
             'yyyy-MM-dd HH:mm:ss'
         );
 
@@ -71,7 +71,7 @@
             IntlDateFormatter::SHORT,
             IntlDateFormatter::SHORT,
             'Europe/London', // Default for CodeIgniter
-                IntlDateFormatter::GREGORIAN,
+            IntlDateFormatter::GREGORIAN,
             'yyyy-MM-dd HH:mm:ss'
         );
 

      ----------- end diff -----------

  14) /Users/kenji/work/codeigniter/CodeIgniter4/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php (braces, unary_operator_spaces, not_operator_with_successor_space)
      ---------- begin diff ----------
--- /Users/kenji/work/codeigniter/CodeIgniter4/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php
+++ /Users/kenji/work/codeigniter/CodeIgniter4/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php
@@ -55,7 +55,7 @@
                         }
                     }
                     CODE_SAMPLE
-,
+                ,
                 <<<'CODE_SAMPLE'
                     final class SomeClass
                     {

      ----------- end diff -----------


Fixed all files in 135.011 seconds, 32.000 MB memory used

Detected deprecations in use:
- Rule "Nexus/space_after_comment_start" is deprecated. Use "single_line_comment_spacing" instead.

@paulbalandan
Copy link
Member

Most of the binary_operator_spaces issues we had in v3.8 was fixed here, except for one (the $bobbyUser example). Now, the recent refactor of braces causes weird indentation.

@samsonasik
Copy link
Member

Ref PHP-CS-Fixer/PHP-CS-Fixer#6470

@MGatner
Copy link
Member

MGatner commented Jul 12, 2022

Ah this makes a lot more sense now! Yesterday I had to exclude the entire ** app/Views/errors/html/** in a project just to get the pipeline to pass, and I was certain I hadn't modified those files at all. DevKit is using ^ for the CS Fixer dependency so doesn't have the same conservative version approach we use in the framework.

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Jul 12, 2022

A newer version of friendsofphp/php-cs-fixer exists, but since this PR has been edited by someone other than Dependabot I haven't updated it. You'll get a PR for the updated version as normal once this PR is merged.

@paulbalandan
Copy link
Member

@dependabot recreate

@MGatner
Copy link
Member

MGatner commented Jul 13, 2022

Any reason to stick with * over ^? Projects will all be version-locked already.

@paulbalandan
Copy link
Member

For the framework itself. So that the build does not break on buggy versions.

@MGatner
Copy link
Member

MGatner commented Jul 13, 2022

I would expect more bugs in patch versions (which we will use) than in minor versions (which are currently excluded). I'm not familiar with CS Fixer's versioning but I expect that new rules count as "features" and aren't applied automatically.

@paulbalandan paulbalandan force-pushed the dependabot/composer/friendsofphp/php-cs-fixer-3.9.star branch from 8e7e1a5 to 8b693c3 Compare July 16, 2022 15:06
@paulbalandan paulbalandan force-pushed the dependabot/composer/friendsofphp/php-cs-fixer-3.9.star branch from 8b693c3 to 8d89566 Compare July 16, 2022 15:10
@kenjis
Copy link
Member

kenjis commented Aug 11, 2022

v3.9.3 breaks the view file in website.
See codeigniter4projects/website#309 (comment)

@MGatner
Copy link
Member

MGatner commented Aug 12, 2022

@kenjis I've been adding exclude('Views/errors') to all my project configs: https://github.com/duke-bluesmith/bluesmith/blob/develop/.php-cs-fixer.dist.php

@paulbalandan
Copy link
Member

The problem with exclude is that ALL rules will not be applied to the files.

@samsonasik
Copy link
Member

@dependabot recreate

@kenjis
Copy link
Member

kenjis commented Aug 12, 2022

@paulbalandan Is there any bug that is not reported to php-cs-fixer Issues?

@MGatner
Copy link
Member

MGatner commented Aug 13, 2022

The problem with exclude is that ALL rules will not be applied to the files.

I understand, but that is fine with me since in this case these files come straight from the framework and I don't want them altered. I wouldn't do this generally but for this specific problem (which happens on every project that updates) it is my preferred solution.

@paulbalandan
Copy link
Member

@paulbalandan Is there any bug that is not reported to php-cs-fixer Issues?

Upon checking, the only bug left not fixed yet in latest master is the issue with mixed PHP/HTML. The other issues here are already resolved.

@kenjis
Copy link
Member

kenjis commented Aug 18, 2022

It seems php-cs-fixer does not support mixed php/html files.
See PHP-CS-Fixer/PHP-CS-Fixer#6513 (comment)
and PHP-CS-Fixer/PHP-CS-Fixer#6513 (comment)

@kenjis
Copy link
Member

kenjis commented Aug 18, 2022

Ref PHP-CS-Fixer/PHP-CS-Fixer#6551

@paulbalandan
Copy link
Member

It seems php-cs-fixer does not support mixed php/html files. See FriendsOfPHP/PHP-CS-Fixer#6513 (comment) and FriendsOfPHP/PHP-CS-Fixer#6513 (comment)

Yes, they are discussing whether to skip those files entirely.

@paulbalandan
Copy link
Member

@MGatner given that php-cs-fixer has an ongoing discussion (and PR) to skip mixed PHP/HTML files, would you be in favor of excluding all those files in the repo, just like what you did in your repos?

I would like to close this PR and open new ones incorporating the newly released rules. The new rules and options since v3.6 has been growing and it's a waste not to use those here.

@MGatner
Copy link
Member

MGatner commented Aug 18, 2022

I'm in favor of that. I have never found CS Fixer to be helpful for "PHP in HTML". If we want to style those (once, or regularly enforced) I use Prettier.io. It is less "coding standard" and more "style format" but I find that my HTML ends up being much more fluid, especially when PHP tags start mixing in. A one-time pass would be fine, but if we plan to support something like that we would need to cross the package.json threshold 😱

@samsonasik
Copy link
Member

@dependabot rebase

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Aug 23, 2022

Looks like this PR has been edited by someone other than Dependabot. That means Dependabot can't rebase it - sorry!

If you're happy for Dependabot to recreate it from scratch, overwriting any edits, you can request @dependabot recreate.

@@ -17,7 +17,7 @@
"require-dev": {
"codeigniter/coding-standard": "^1.1",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "3.6.*",
"friendsofphp/php-cs-fixer": "~3.10.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ~3.10.0? ^3.10 seems fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tilde is the same with the *. It limits version to the patch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ git diff
diff --git a/composer.json b/composer.json
index 080fc5974..e471a6452 100644
--- a/composer.json
+++ b/composer.json
@@ -17,7 +17,7 @@
     "require-dev": {
         "codeigniter/coding-standard": "^1.1",
         "fakerphp/faker": "^1.9",
-        "friendsofphp/php-cs-fixer": "3.6.*",
+        "friendsofphp/php-cs-fixer": "~3.9.0",
         "mikey179/vfsstream": "^1.6",
         "nexusphp/cs-config": "^3.3",
         "nexusphp/tachycardia": "^1.0",
$ composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 2 updates, 1 removal
  - Removing php-cs-fixer/diff (v2.0.2)
  - Upgrading friendsofphp/php-cs-fixer (v3.6.0 => v3.9.6)
  - Upgrading nexusphp/cs-config (v3.4.0 => v3.5.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 2 updates, 1 removal
  - Removing php-cs-fixer/diff (v2.0.2)
  - Upgrading friendsofphp/php-cs-fixer (v3.6.0 => v3.9.6): Extracting archive
  - Upgrading nexusphp/cs-config (v3.4.0 => v3.5.0): Extracting archive
Generating optimized autoload files
53 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
infection/extension-installer: No extensions found
> CodeIgniter\ComposerScripts::postUpdate
> bash -c "if [ -f admin/setup.sh ]; then bash admin/setup.sh; fi"
No security vulnerability advisories found

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It prevents us from going to 3.11.x which I believe is our desired behavior.

https://getcomposer.org/doc/articles/versions.md#tilde-version-range-

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Sep 3, 2022

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

@dependabot dependabot bot deleted the dependabot/composer/friendsofphp/php-cs-fixer-3.9.star branch September 3, 2022 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update external dependencies php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants