Skip to content

[CodeQuality] Skip same local method call chain in InlineIfToExplicitIfRector - #8418

Merged
TomasVotruba merged 1 commit into
mainfrom
skip-same-local-method-call-chain-inline-if
Aug 30, 2026
Merged

[CodeQuality] Skip same local method call chain in InlineIfToExplicitIfRector#8418
TomasVotruba merged 1 commit into
mainfrom
skip-same-local-method-call-chain-inline-if

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Follow-up to #8417. Skip conversion when a flattened &&/|| chain has every operand as a $this->foo(...) method call of the same name.

$this->validateExtensionAndMimeType($asset->getExtension(), $asset->loadFile())
    && $this->validateExtensionAndMimeType($this->parseExtension($asset->getTempName()), $asset->loadFile(true))
    && $this->validateExtensionAndMimeType($this->parseExtension($asset->getOriginalFileName()), null);

Reads better as a single expression than split into an explicit if.

…IfRector

Extend the skip to flattened `&&`/`||` chains where every operand is a
`$this->foo(...)` call of the same name, e.g.

    $this->validateExtensionAndMimeType($asset->getExtension(), $asset->loadFile())
        && $this->validateExtensionAndMimeType($this->parseExtension($asset->getTempName()), $asset->loadFile(true))
        && $this->validateExtensionAndMimeType($this->parseExtension($asset->getOriginalFileName()), null);

Claude-Session: https://claude.ai/code/session_01D93PXDaqua1utm7H8KyJAN
@TomasVotruba
TomasVotruba merged commit 85e562c into main Aug 30, 2026
44 checks passed
@TomasVotruba
TomasVotruba deleted the skip-same-local-method-call-chain-inline-if branch August 30, 2026 16:57
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