Skip to content

ECS collapses file formatting on PHP 8.4/8.5 (same code passes on PHP 8.3). #3

@terabytesoftw

Description

@terabytesoftw

Hi team,

I’m seeing a regression in ECS when running on the latest PHP 8.4 and 8.5 patch releases.

Problem

Running ECS on unchanged code produces large “collapsed” diffs (many lines merged into one line), e.g. around declare(strict_types=1);, namespace, and use blocks. The same commit passes on PHP 8.3.

Command

vendor/bin/ecs check --ansi

Behavior

  • PHP 8.3: ✅ passes
  • Latest PHP 8.4: ❌ fails with many fixable errors and collapsed diffs
  • Latest PHP 8.5: ❌ fails with many fixable errors and collapsed diffs
    ---------- begin diff ----------
@@ -1,18 +1,5 @@
 <?php
-
-declare(strict_types=1);
-
-namespace yii\jquery\grid;
-
-use yii\base\BaseObject;
-use yii\grid\CheckboxColumn;
-use yii\helpers\Json;
-use yii\web\client\ClientScriptInterface;
-use yii\web\View;
-
-use function is_string;
-
-/**
+declare(strict_types=1);namespace yii\jquery\grid;use yii\base\BaseObject;use yii\grid\CheckboxColumn;use yii\helpers\Json;use yii\web\client\ClientScriptInterface;use yii\web\View;use function is_string;/**
  * jQuery client-side script for [[CheckboxColumn]].
  *
  * Registers the `yiiGridView('setSelectionColumn', ...)` jQuery plugin call.
@@ -21,29 +8,4 @@
  *
  * @author Wilmer Arambula <terabytesoftw@gmail.com>
  * @since 0.1
- */
-class CheckboxColumnJqueryClientScript extends BaseObject implements ClientScriptInterface
-{
-    public function getClientOptions(BaseObject $widget, array $params = []): array
-    {
-        return [];
-    }
-
-    public function register(BaseObject $widget, View $view, array $params = []): void
-    {
-        $id = $widget->grid->options['id'];
-
-        $options = Json::encode(
-            [
-                'name' => $widget->name,
-                'class' => $widget->cssClass,
-                'multiple' => $widget->multiple,
-                'checkAll' => $widget->grid->showHeader ? $params['headerCheckBoxName'] ?? null : null,
-            ],
-        );
-
-        if (is_string($id) && $id !== '') {
-            $view->registerJs("jQuery('#$id').yiiGridView('setSelectionColumn', $options);");
-        }
-    }
-}
+ */class CheckboxColumnJqueryClientScript extends BaseObject implements ClientScriptInterface{public function getClientOptions(BaseObject $widget, array $params = []): array{return [];}public function register(BaseObject $widget, View $view, array $params = []): void{$id = $widget->grid->options['id'];$options = Json::encode(['name' => $widget->name,'class' => $widget->cssClass,'multiple' => $widget->multiple,'checkAll' => $widget->grid->showHeader ? $params['headerCheckBoxName'] ?? null : null,],);if (is_string($id) && $id !== '') {$view->registerJs("jQuery('#$id').yiiGridView('setSelectionColumn', $options);");}}}
\ No newline at end of file
    ----------- end diff -----------

CI failed: https://github.com/yii2-framework/jquery/actions/runs/23686185982/job/69005953727
CI passed: https://github.com/yii2-framework/jquery/actions/runs/23686288162/job/69006220180

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions