/acc:find-type-issuesfrom acc
Detects type safety issues in PHP code including implicit coercion, loose comparisons, unsafe casting, and return type mismatches.
Ships in acc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Analyze PHP code for type safety issues.
// BUG: String to int coercion
$count = '10abc'; // PHP converts to 10
$total = $count + 5; // 15, not error
// BUG: Array comparison
$a = [1, 2, 3];
$b = '1,2,3';
if ($a == $b) { } // Unexpected comparison
// BUG: Boolean context
if ($string) { } // '0' is falsy, but non-empty
// BUG: == instead of ===
if ($status == 0) { } // null, '', '0' and false all pass;
// 'active' == 0 is FALSE since PHP 8
// BUG: in_array without strict
if (in_array($value, $array)) { } // Type coercion
// FIXED: in_array($value, $array, true)
// BUG: array_search
$key = array_search($value, $array); // Returns false or key
if ($key) { } // Key 0 is falsy!
// BUG: Casting truncates
$float = 10.9;
$int = (int) $float; // 10, not 11
// BUG: String to array casting
$array = (array) $object; // May include private properties
// BUG: Object casting
$stdClass = (object) $array; // Loses type information
// BUG: Function accepts anything
function process($data) { // No type hint
return $data['key']; // Assumes array
}
// BUG: Union type issues
function handle(string|int $id): void {
echo strlen($id); // Fails if int
}
// BUG: Inconsistent return types
function getValue(): int {
if ($condition) {
return '42'; // String, not int
}
return 0;
}
// BUG: Nullable inconsistency
function find(): User { // Not nullable
if (!$found) {
return null; // Type error
}
}
// BUG: Assuming array structure
/** @param array $data */
function process(array $data): void {
foreach ($data['items'] as $item) { // 'items' may not exist
echo $item['name']; // 'name' may not exist
}
}
// BUG: Mixed array types
$mixed = [1, 'two', new User()]; // Hard to type
// NOT a bug: two numeric strings are compared NUMERICALLY
$a = '10';
$b = '9';
if ($a > $b) { } // true — '10' and '9' are numeric strings, so 10 > 9
// REAL BUG: one side is not a numeric string → string comparison
$version = '10';
if ($version > 'v9') { } // false — falls back to byte-wise comparison
// REAL BUG: version-like strings never compare numerically
if ('1.10' > '1.9') { } // false — '1.10' as a number is 1.1
// FIXED: compare with an explicit, intended semantics
if ((int) $a > (int) $b) { } // numeric intent
if (version_compare('1.10', '1.9', '>')) { } // version intent
// BUG: Assuming JSON structure
$data = json_decode($json, true);
$name = $data['user']['name']; // May not exist
// BUG: JSON encoding failures
$result = json_encode($data); // May return false
// BUG: String date comparison
if ($date > '2024-01-01') { } // String comparison
// BUG: DateTime vs DateTimeImmutable
function setDate(DateTime $date): void { }
$immutable = new DateTimeImmutable();
$this->setDate($immutable); // Type error
# Loose comparison with 0
Grep: "==\s*0[^.]|0\s*==" --glob "**/*.php"
# in_array without strict
Grep: "in_array\([^,]+,[^,]+\)" --glob "**/*.php"
# Casting with (int) or (string)
Grep: "\(int\)\s*\$|\(string\)\s*\$|\(array\)\s*\$" --glob "**/*.php"
# Mixed parameter types
Grep: "function\s+\w+\(\$\w+[,)]" --glob "**/*.php"
| Pattern | Severity |
|---|---|
| Loose comparison with sensitive data | 🔴 Critical |
| Return type mismatch | 🟠 Major |
| Missing strict in_array | 🟠 Major |
| Untyped parameters | 🟡 Minor |
| Implicit coercion | 🟡 Minor |
declare(strict_types=1);
if ($status === 0) { }
if (in_array($value, $array, true)) { }
function process(array $items): int
{
return count($items);
}
if ($object instanceof User) {
$object->getName();
}
### Type Issue: [Description]
**Severity:** 🔴/🟠/🟡
**Location:** `file.php:line`
**Type:** [Coercion|Loose Comparison|Unsafe Cast|...]
**Issue:**
[Description of the type safety problem]
**Code:**
```php
// Problematic code
Fix:
// Type-safe version
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin acc283 skills in this plugin
/access-control-knowledgeAccess Control knowledge base. Provides ACL, RBAC, ABAC, ReBAC models, multi-tenancy patterns, and PHP implementations (Symfony Voters, Laravel Gates) for security audits and generation./adr-knowledgeAction-Domain-Responder pattern knowledge base. Provides patterns, antipatterns, and PHP-specific guidelines for ADR (web-specific MVC alternative) audits./adr-templateGenerates Architecture Decision Records (ADR) for PHP projects. Creates structured decision documentation with context, decision, and consequences.Other plugins' skills for the same job