Skip to content

Reimplement ReplaceArgumentDefaultValueRector usages as dedicated rules - #1079

Merged
TomasVotruba merged 1 commit into
mainfrom
dedicated-cookie-yaml-urlgenerator-rules
Oct 17, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
dedicated-cookie-yaml-urlgenerator-rules

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Replaces the configurable core ReplaceArgumentDefaultValueRector (likely to be deprecated) with standalone, self version-bonded Symfony rules. Each rule declares its own composer package constraint via ComposerPackageConstraintInterface and carries its own matching logic, so rector-symfony no longer depends on the core Rector\Arguments namespace for these transforms.

New rules:

  • UrlGeneratorReferenceTypeRector - symfony/routing >=2.8; UrlGeneratorInterface::generate() reference type magic values to constants
  • YamlFlagsToConstantRector - symfony/yaml >=3.1; Yaml::parse() / Yaml::dump() boolean flag args to Yaml flag constants (incl. array collapse)
  • CookieSameSiteConstantRector - symfony/http-foundation >=4.2; Cookie __construct/create/withSameSite same-site strings to SAMESITE_* constants
  • CookieConstructorDefaultsRector - symfony/http-foundation >=4.2; Cookie constructor 4.2 default changes ($secure false to null, $sameSite null to lax)

The five ruleWithConfigurationComposerVersionBound(ReplaceArgumentDefaultValueRector::class, ...) blocks in composer-based.php are removed and replaced by registering the dedicated rules.

Note: the three same-site transforms were previously spread across >=3.2, >=4.2 and >=5.1; they are consolidated into one rule bonded at >=4.2, the lowest version where all SAMESITE_* constants exist.

symfony/yaml and symfony/http-foundation added to require-dev so the bonded tests resolve deterministically.

All added rules covered by tests; ECS, PHPStan, class-leak, duplicated-code and the full suite pass locally.

Replace the configurable core ReplaceArgumentDefaultValueRector, which may
be deprecated, with standalone, self version-bonded Symfony rules:

- UrlGeneratorReferenceTypeRector (symfony/routing >=2.8)
- YamlFlagsToConstantRector (symfony/yaml >=3.1)
- CookieSameSiteConstantRector (symfony/http-foundation >=4.2)
- CookieConstructorDefaultsRector (symfony/http-foundation >=4.2)
@TomasVotruba
TomasVotruba merged commit f7aaaf7 into main Oct 17, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the dedicated-cookie-yaml-urlgenerator-rules branch October 17, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant