Detects logic errors in PHP code. Finds incorrect conditions, wrong operators, missing switch cases, inverted logic, short-circuit evaluation issues.
From accnpx claudepluginhub dykyi-roman/awesome-claude-code --plugin accThis skill uses the workspace's default tool permissions.
Analyze PHP code for logic errors that cause incorrect behavior.
// BUG: Assignment instead of comparison
if ($status = 'active') { } // Should be ===
// BUG: Wrong comparison type
if ($count == '0') { } // '0' is truthy in string comparison
// BUG: Yoda condition error
if ('active' = $status) { } // Assignment error
// BUG: Double negation confusion
if (!$user->isNotActive()) { } // Hard to reason about
// BUG: Wrong negation placement
if (!$a && $b) { } // vs if (!($a && $b))
// BUG: DeMorgan's law violation
if (!$a || !$b) { } // When meaning !($a && $b)
// BUG: Missing enum case
match ($status) {
Status::Active => 'active',
Status::Inactive => 'inactive',
// Missing: Status::Pending, Status::Deleted
};
// BUG: Missing default
switch ($type) {
case 'A': return 1;
case 'B': return 2;
// No default - undefined behavior for other values
}
// BUG: Side effect in short-circuit
if ($valid && $this->save()) { } // save() not called if !$valid
// BUG: Order matters
if ($obj->method() && $obj !== null) { } // Null check too late
// BUG: Fence post error
if ($index < count($array)) { } // vs <=
// BUG: Wrong boundary
for ($i = 0; $i <= $length; $i++) { } // Off by one
// BUG: Always true/false
if ($age > 0 || $age <= 0) { } // Always true
// BUG: Unreachable condition
if ($x > 10 && $x < 5) { } // Always false
// BUG: Redundant condition
if ($status === 'active' && $status !== 'inactive') { } // Second part redundant
// BUG: Ignoring important return
array_push($items, $new); // Returns count, not array
$string->trim(); // String is immutable, returns new string
# Assignment in condition
Grep: "if\s*\([^=]*[^!=<>]=[^=][^)]*\)" --glob "**/*.php"
# Double negation
Grep: "!\$\w+->isNot|!!\$" --glob "**/*.php"
# Empty switch without default
Grep: "switch\s*\([^)]+\)\s*\{[^}]*\}" --glob "**/*.php"
### Logic Error: [Description]
**Severity:** 🔴/🟠/🟡
**Location:** `file.php:line`
**Type:** [Incorrect Operator|Inverted Logic|Missing Case|...]
**Issue:**
[Description]
**Code:**
```php
// Current code
Fix:
// Corrected code
Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.