Skip to content

Commit a5e0a46

Browse files
committed
fix: default introducedVersion to '0.0.0' on Configuration value objects
ClassConstantToClassConstantConfiguration and MethodToMethodWithCheckConfiguration gained a required $introducedVersion constructor argument in the BC-wrapping refactor. Make it optional with default '0.0.0' so downstream consumers that instantiate these value objects directly keep working. The default falls outside the BC-wrap gate (< 10.0.0), so pre-refactor no-wrap behaviour is preserved when the argument is omitted.
1 parent d3c7e90 commit a5e0a46

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,12 @@ release-by-release.
385385
extend `AbstractDrupalCoreRector` and auto-wrap their `Expr → Expr` rewrites
386386
via `DeprecationHelper::backwardsCompatibleCall()`. Their configuration value
387387
objects (`ClassConstantToClassConstantConfiguration`,
388-
`MethodToMethodWithCheckConfiguration`) gain a required `introducedVersion`
389-
constructor argument and now implement `VersionedConfigurationInterface`.
390-
This closes three D11 → D10 runtime regressions (Comment* enums in 11.4,
388+
`MethodToMethodWithCheckConfiguration`) gain an optional `introducedVersion`
389+
constructor argument (default `'0.0.0'`) and now implement
390+
`VersionedConfigurationInterface`. The default falls outside the BC-wrap
391+
gate (`< 10.0.0`), so consumers that instantiate these value objects without
392+
passing the new argument keep pre-refactor behaviour (no wrapping). This
393+
closes three D11 → D10 runtime regressions (Comment* enums in 11.4,
391394
`RequirementSeverity` in 11.2, `AliasManager` method rename in 11.1) without
392395
moving anything to a `-breaking.php` set.
393396
- `MethodToMethodWithCheckRector` no longer attaches a "please confirm the

src/Rector/ValueObject/ClassConstantToClassConstantConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class ClassConstantToClassConstantConfiguration implements VersionedConfig
1717

1818
private string $introducedVersion;
1919

20-
public function __construct(string $deprecatedClass, string $deprecated, string $class, string $constant, string $introducedVersion)
20+
public function __construct(string $deprecatedClass, string $deprecated, string $class, string $constant, string $introducedVersion = '0.0.0')
2121
{
2222
$this->deprecatedClass = $deprecatedClass;
2323
$this->deprecated = $deprecated;

src/Rector/ValueObject/MethodToMethodWithCheckConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MethodToMethodWithCheckConfiguration implements VersionedConfigurationInte
1616

1717
protected string $introducedVersion;
1818

19-
public function __construct(string $className, string $deprecatedMethodName, string $methodName, string $introducedVersion)
19+
public function __construct(string $className, string $deprecatedMethodName, string $methodName, string $introducedVersion = '0.0.0')
2020
{
2121
$this->className = $className;
2222
$this->deprecatedMethodName = $deprecatedMethodName;

0 commit comments

Comments
 (0)