Skip to content

[DowngradePhp81] Skip PHP_VERSION_ID guarded hash() calls in DowngradeHashAlgorithmXxHashRector - #394

Merged
TomasVotruba merged 2 commits into
mainfrom
fix-php-version-id-guard-xxhash
Aug 30, 2026
Merged

[DowngradePhp81] Skip PHP_VERSION_ID guarded hash() calls in DowngradeHashAlgorithmXxHashRector#394
TomasVotruba merged 2 commits into
mainfrom
fix-php-version-id-guard-xxhash

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

skip_check_phpversion_ternary fixture regressed: hash('xxh128') inside a PHP_VERSION_ID >= 80100 ? guard was rewritten to md5 instead of being skipped.

Two skip paths both stopped catching PHP_VERSION_ID guards:

  • PHP_VERSION_CONDITIONED attribute is only set upstream for version_compare() conditions, not PHP_VERSION_ID binary ops.
  • The scope-based check expected an IntegerRangeType with min 80100, but the scope now resolves to a concrete ConstantIntegerType, so that branch never triggers.

This subscribes the rule to Ternary/If_, and when their condition is a PHP_VERSION_ID comparison, marks the inner hash() calls with PHP_VERSION_CONDITIONED so they are skipped the same way version_compare() guarded calls already are. The dead scope-based check is removed.

…eHashAlgorithmXxHashRector
Mark hash() calls inside a PHP_VERSION_ID guarded ternary/if as version conditioned,
so they are skipped like version_compare() guarded calls. Drops the dead scope-based
check, which no longer resolves to an IntegerRangeType.
Claude-Session: https://claude.ai/code/session_01UCwZigZyZFXK9SNVFLQsRi
@TomasVotruba
TomasVotrubaforce-pushed the fix-php-version-id-guard-xxhash branch from f7c53af to 198e0e3CompareAugust 30, 2026 22:30
@TomasVotruba
TomasVotruba enabled auto-merge (squash) August 30, 2026 22:30
@TomasVotruba
TomasVotruba merged commit 70b30bb into mainAug 30, 2026
9 checks passed
@TomasVotruba
TomasVotruba deleted the fix-php-version-id-guard-xxhash branch August 30, 2026 22:31
Sign up for freeto 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.

2 participants

@TomasVotruba@actions-user