TysonAndre / phan

Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.
Other
0 stars 0 forks source link

Experimental: WIP: Add a strict mode for checking parameter types #154

Closed TysonAndre closed 6 years ago

TysonAndre commented 6 years ago

This doesn't have tests. I didn't add a config yet.

This is hardcoded as true for now.

Workarounds for high error rates planned:

  1. Make ConditionVisitor guess an array shape in preg_match
  2. Reduce false positives for self-analysis, e.g. str_replace (array->array, string->string, and only those)
  3. File-level suppressions for strict issues?
  4. Array access looks like it always includes |null right now for the inferred type (Except for array shapes?)
  5. Create narrower issue types for PossiblyFalse, PossiblyNull, and PossiblyInvalid when at least one type is accepted. If the only rejected type is false, emit PossiblyFalse, etc.

For https://github.com/phan/phan/issues/879