Skip to content

[Refactor] Use short-circuit expression instead repeating check#174

Open
ghabriel25 wants to merge 1 commit intolivewire:mainfrom
ghabriel25:refactor/short-circuit-expressions
Open

[Refactor] Use short-circuit expression instead repeating check#174
ghabriel25 wants to merge 1 commit intolivewire:mainfrom
ghabriel25:refactor/short-circuit-expressions

Conversation

@ghabriel25
Copy link
Copy Markdown
Contributor

Just a small refactor on Memoizer.php

Before

if (! $node instanceof ComponentNode) {
    return $node;
}

if (! $node->selfClosing) {
    return $node;
}

if (! $this->isMemoizable($node)) {
    return $node;
}

After

if (! $node instanceof ComponentNode || ! $node->selfClosing || ! $this->isMemoizable($node)) {
    return $node;
}

Comment thread src/Memoizer/Memoizer.php
@ghabriel25 ghabriel25 requested a review from meduzen April 19, 2026 13:30
@joshhanley
Copy link
Copy Markdown
Member

I might just be getting old, but I find the 3 separate conditionals easier to read personally 😂

@ghabriel25
Copy link
Copy Markdown
Contributor Author

@joshhanley I think its just preference. You might close this one as its not affected how blaze handle the components 👌

@joshhanley
Copy link
Copy Markdown
Member

@ghabriel25 agreed! Wait to see what Caleb or Filip think 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants