PHP silently casts array keys — strings containing valid decimal integers become ints, bools become 0/1, and null becomes an empty string. This breaks type safety in ways static analysis tools like PHPStan historically couldn't catch: a function typed to accept `array<string, mixed>` can still receive integer keys at runtime, causing TypeErrors with strict_types, unexpected re-indexing by array_merge, and failed strict key lookups. PHPStan 2.2 will introduce a new `non-decimal-int-string` type that guarantees a string key will never be silently cast to int, making `array<non-decimal-int-string, mixed>` genuinely type-safe. Existing `array<string, mixed>` annotations will optionally be interpreted using this stricter type.
Sort: