Skip to content

Releases: ecsphp/ecs

Released ECS 13.2.15

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 18:56

What's new

🐛 Explicit Symfony attribute allowlist in StandaloneLineSymfonyAttributeParamFixer

Replaces the str_contains($name, 'Symfony') heuristic with an explicit allowlist of 17 Symfony attribute classes (SYMFONY_ATTRIBUTE_CLASSES). Third-party attributes whose FQCN merely contains Symfony (e.g. App\Symfony\...) are no longer reformatted.

-#[\Symfony\Component\Console\Attribute\AsCommand(name: 'app:some', description: 'Some description')]
+#[\Symfony\Component\Console\Attribute\AsCommand(
+    name: 'app:some',
+    description: 'Some description'
+)]

🧹 Drop pull_request trigger from version_command workflow

The job smoke-tests the published Packagist artifact, so on PRs it installed the already-published package, never the PR code — pure slow noise. push (main + tags) and weekly schedule already cover it.

Released ECS 13.2.14

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

✨ New StandaloneLineSymfonyAttributeParamFixer + standaloneLine set

Breaks each argument of a Symfony attribute onto its own line. New opt-in standaloneLine set groups the standalone-line rules.

-#[\Symfony\Component\Console\Attribute\AsCommand(name: 'mautic:entity:import', description: 'Import entity data from a ZIP file.')]
+#[\Symfony\Component\Console\Attribute\AsCommand(
+    name: 'mautic:entity:import',
+    description: 'Import entity data from a ZIP file.'
+)]
$ecsConfig->withPreparedSets(standaloneLine: true);
// or
$ecsConfig->withSets([SetList::STANDALONE_LINE]);

🐛 Recognize imported short-name Symfony attributes

Now resolves short names against use imports, not just fully-qualified names.

 use Symfony\Component\Console\Attribute\AsCommand;

-#[AsCommand(name: 'app:some', description: 'Some description')]
+#[AsCommand(
+    name: 'app:some',
+    description: 'Some description'
+)]

Released ECS 13.2.13

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

🐛 Drop 3rd-person verb s in method-name duplicate description

-/**
- * Contacts a user.
  *
  * @return object
  */
 public function contactUser()

🐛 Fix scoper.php for FinalInternalClassFixer (#24)

Prefixed build no longer mangles the exclude entity names:

-'exclude' => ['final', 'Entity', 'ECSPrefix202607\ORM\Entity', ...]
+'exclude' => ['final', 'Entity', 'ORM\Entity', ...]

✅ Regression fixture: readonly promoted properties

Locks StandaloneLinePromotedPropertyFixer splitting private readonly promoted props.

Released ECS 13.2.12

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

🐛 StandaloneLinePlainConstructorParamFixer skips ≤3 params

Only splits constructors with 4+ params. Short lists stay on one line. Default-value tokens ([1, 2], new Foo(1)) don't inflate the count.

Released ECS 13.2.11

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

✨ New StandaloneLinePlainConstructorParamFixer (spaces set)

Covers the gap: constructors with plain params and no promoted properties.

-public function __construct(CorePermissions $security, Translator $translator, RouterInterface $router, FormFactoryInterface $formFactory)
+public function __construct(
+    CorePermissions $security,
+    Translator $translator,
+    RouterInterface $router,
+    FormFactoryInterface $formFactory
+)

Released ECS 13.2.10

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

✅ Regression fixture: single promoted property among plain params

Locks StandaloneLinePromotedPropertyFixer splitting all params even when only one is promoted.

 public function __construct(
-    CorePermissions $security, Translator $translator, RouterInterface $router,
+    CorePermissions $security,
+    Translator $translator,
+    RouterInterface $router,
     private LeadModel $leadModel,
 ) {
 }

Released ECS 13.2.9

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

✨ New StandaloneLineRequiredParamFixer (spaces set)

Public methods marked #[Required] / @required are DI points; one param per line keeps diffs to the single changed dependency.

 #[Required]
-public function autowireDependencies(FormModel $formModel, SubmissionModel $submissionModel): void
+public function autowireDependencies(
+    FormModel $formModel,
+    SubmissionModel $submissionModel
+): void

Released ECS 13.2.8

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

🐛 Fix autoloading of nested paths

🐛 Match method-name docblock descriptions containing articles

-/**
- * Get the API helper.
- *
+/**
  * @return object
  */
 public function getApiHelper()

Drops a/an/the (word-boundary) before comparing description to method name.

📖 Document passing paths as CLI arguments in README

vendor/bin/ecs src tests

Released ECS 13.2.7

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

🐛 Fix --config option placed before the command name

# before
$ ecs --config=ecs.php
Run failed: Unknown option: "--config=ecs.php"

# after
$ ecs --config=ecs.php   # loads ecs.php and checks normally

Regression from the symfony/consoleentropy migration. Default check command is now injected when the first arg is an option.

🐛 Skip AddMissingVarNameFixer for property assignments

-/** @var int $this */
+/** @var int */
 $this->value = 1000;

Skipped when the variable is followed by ->.

Released ECS 13.2.6

Choose a tag to compare

@TomasVotruba TomasVotruba released this 22 Jul 15:49

What's new

✨ New TypeToVarTagFixer

Flips @type doc tag into @var, upgrading single-asterisk inline comments to real doc blocks.

-/* @type \Mautic\ReportBundle\Model\ReportModel $model */
+/** @var \Mautic\ReportBundle\Model\ReportModel $model */
 $model = ...;

✨ New MergeDocBlockStartFixer

Fixes docblocks opened with /* instead of /** and strips empty *-only lines.

-/*
- *
- * @return $this
- */
+/**
+ * @return $this
+ */

✨ New RemoveEventSubscriberDescriptionFixer

Removes redundant subscriber-method docblocks that just repeat the method name + "event".

-/**
- * Delete lead event
- */
 public function onLeadDelete(LeadEvent $event): bool

🐛 Remove getter/setter verb-mismatch docblock description

RemoveMethodNameDuplicateDescriptionFixer now drops * Get results. above setResults() (get/set mix-up carries no info).

✅ Cover RemoveDeadParamFixer for anonymous functions

-/**
- * @param $mappedFields
- * @param $fieldType
- */
 $cleanup = function (array &$mappedFields, string $fieldType) {
 };

🐛 Fix PHPStan env-dependent token constant error

Scope PHPStan ignores for T_OPEN_CURLY_BRACKET (PHP_CodeSniffer constant) across environments.