Skip to content

Stop ignoring RepeatedAndNotEqualToNotInArrayRector#2720

Merged
Crabcyborg merged 1 commit into
masterfrom
stop_ignoring_RepeatedAndNotEqualToNotInArrayRector
Jan 6, 2026
Merged

Stop ignoring RepeatedAndNotEqualToNotInArrayRector#2720
Crabcyborg merged 1 commit into
masterfrom
stop_ignoring_RepeatedAndNotEqualToNotInArrayRector

Conversation

@Crabcyborg

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR refactors a boolean conditional in FrmAppHelper to use in_array() for membership checking, and updates rector.php configuration by removing an imported Rector rule while adding another to the skip list with expanded documentation comments.

Changes

Cohort / File(s) Summary
Logic Refactoring
classes/helpers/FrmAppHelper.php
Refactored conditional in is_view_builder_page() from three separate equality checks to a single in_array() call against ['post.php', 'post-new.php', 'edit.php'] with strict type checking.
Rector Configuration
rector.php
Removed import of RepeatedAndNotEqualToNotInArrayRector; added SwitchNegatedTernaryRector to skip list with rationale comment; expanded documentation comments for other skipped rules.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining the rationale for no longer ignoring this Rector rule and any related code refactoring in FrmAppHelper.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing RepeatedAndNotEqualToNotInArrayRector from the skip list in rector.php configuration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acf8f87 and 00a999e.

📒 Files selected for processing (2)
  • classes/helpers/FrmAppHelper.php
  • rector.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: PHP 7.4 tests in WP 6.9
  • GitHub Check: PHP 8 tests in WP 6.9
  • GitHub Check: Cypress
  • GitHub Check: PHP 8 tests in WP 6.9
  • GitHub Check: PHP 7.4 tests in WP 6.9
  • GitHub Check: Cypress
🔇 Additional comments (4)
rector.php (3)

158-159: LGTM! Clear documentation for readability preference.

The comment effectively explains why SwitchNegatedTernaryRector is skipped - prioritizing readability of ! empty checks over the automated refactor. This helps future maintainers understand the intentional decision.


180-183: Good documentation of technical debt.

The expanded comment clearly explains the context for why RemoveDeadReturnRector is skipped, noting specific files affected and the reason for keeping the dead return statements. This will help future maintainers make informed decisions about cleanup.


189-197: LGTM! Helpful documentation for skipped rules.

The comments clearly explain the rationale for skipping these Rector rules:

  • Line 189: Preserving valid param tags is important for documentation
  • Lines 194 & 196: Avoiding excessive verbosity from breaking up control flow statements

These help establish clear coding standards for the project.

classes/helpers/FrmAppHelper.php (1)

519-524: Excellent refactoring applying the Rector rule!

The change from multiple !== comparisons to in_array() with strict comparison is a great improvement:

Logically equivalent: The negated in_array() correctly replaces the AND chain of inequality checks
Strict comparison: The true parameter maintains type safety
More maintainable: Adding/removing page types is now simpler
Better readability: The intent is clearer - checking membership in a set of valid page types

This successfully demonstrates the value of the RepeatedAndNotEqualToNotInArrayRector rule that was previously being skipped.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Gitleaks (8.30.0)
classes/helpers/FrmAppHelper.php

panic: allocator_unix: failed to reserve memory: cannot allocate memory

goroutine 1 [running]:
github.com/wasilibs/wazero-helpers/allocator.alloc(0x1911020?, 0x100000000)
/Users/zrice/Go/pkg/mod/github.com/wasilibs/wazero-helpers@v0.0.0-20240620070341-3dff1577cd52/allocator/nonmoving_unix.go:33 +0x10e
github.com/tetratelabs/wazero/experimental.MemoryAllocatorFunc.Allocate(0xa84539?, 0xd4ac60?, 0x47d43a?)
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/experimental/memory.go:28 +0x1c
github.com/tetratelabs/wazero/internal/wasm.NewMemoryInstance(0xc000013c50, {0x7f4c69848c00?, 0xe87630?}, {0xf90c48, 0xc000035680})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/internal/wasm/memory.go:78 +0xab
github.com/tetratelabs/wazero/internal/wasm.(*ModuleInstance).buildMemory(0xc0000f8f00, 0xc0001671e0, {0x7f4c69848c00?, 0xe87630?})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/internal/wasm/module.go:653 +0x4c
github.com/tetratelabs/wazero/internal/wa

... [truncated 302 characters] ...

2a0, {0xf8a300, 0xc0001a2a80}, 0x0?, {0xe18d1d?, 0x0?}, 0x0?, {0x1932260, 0x0, 0x0})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/internal/wasm/store.go:327 +0x5a
github.com/tetratelabs/wazero.(*runtime).InstantiateModule(0xc0001a38c0, {0xf8a300, 0xc0001a2a80}, {0xf8e7e0, 0xc0001de740}, {0xf92da0, 0xc0001f61e0})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/runtime.go:337 +0x1e5
github.com/tetratelabs/wazero.(*runtime).InstantiateWithConfig(0xc0001a38c0, {0xf8a300, 0xc0001a2a80}, {0x1528cd0?, 0xd45020?, 0xe87630?}, {0xf92da0, 0xc0001f61e0})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/runtime.go:302 +0x74
github.com/wasilibs/go-re2/internal.init.0()
/Users/zrice/Go/pkg/mod/github.com/wasilibs/go-re2@v1.9.0/internal/re2_wazero.go:184 +0x39c

rector.php

panic: allocator_unix: failed to reserve memory: cannot allocate memory

goroutine 1 [running]:
github.com/wasilibs/wazero-helpers/allocator.alloc(0x1911020?, 0x100000000)
/Users/zrice/Go/pkg/mod/github.com/wasilibs/wazero-helpers@v0.0.0-20240620070341-3dff1577cd52/allocator/nonmoving_unix.go:33 +0x10e
github.com/tetratelabs/wazero/experimental.MemoryAllocatorFunc.Allocate(0xa84539?, 0xd4ac60?, 0x47d43a?)
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/experimental/memory.go:28 +0x1c
github.com/tetratelabs/wazero/internal/wasm.NewMemoryInstance(0xc000013d50, {0x7f1df6870600?, 0xe87630?}, {0xf90c48, 0xc000035580})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/internal/wasm/memory.go:78 +0xab
github.com/tetratelabs/wazero/internal/wasm.(*ModuleInstance).buildMemory(0xc0001dae00, 0xc0001cf1e0, {0x7f1df6870600?, 0xe87630?})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/internal/wasm/module.go:653 +0x4c
github.com/tetratelabs/wazero/internal/wa

... [truncated 302 characters] ...

060, {0xf8a300, 0xc0001af2f0}, 0x0?, {0xe18d1d?, 0x0?}, 0x0?, {0x1932260, 0x0, 0x0})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/internal/wasm/store.go:327 +0x5a
github.com/tetratelabs/wazero.(*runtime).InstantiateModule(0xc0002721b0, {0xf8a300, 0xc0001af2f0}, {0xf8e7e0, 0xc000274600}, {0xf92da0, 0xc0002861e0})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/runtime.go:337 +0x1e5
github.com/tetratelabs/wazero.(*runtime).InstantiateWithConfig(0xc0002721b0, {0xf8a300, 0xc0001af2f0}, {0x1528cd0?, 0xd45020?, 0xe87630?}, {0xf92da0, 0xc0002861e0})
/Users/zrice/Go/pkg/mod/github.com/tetratelabs/wazero@v1.9.0/runtime.go:302 +0x74
github.com/wasilibs/go-re2/internal.init.0()
/Users/zrice/Go/pkg/mod/github.com/wasilibs/go-re2@v1.9.0/internal/re2_wazero.go:184 +0x39c


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Crabcyborg
Crabcyborg merged commit 69b90c9 into master Jan 6, 2026
35 of 36 checks passed
@Crabcyborg
Crabcyborg deleted the stop_ignoring_RepeatedAndNotEqualToNotInArrayRector branch January 6, 2026 17:40
stephywells pushed a commit that referenced this pull request Apr 4, 2026
…EqualToNotInArrayRector

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant