Skip to content

InverseTrigInvalidRealDomain ​

warning native on by default

Group: Probable bugs

Keep the inverse trigonometric argument within minus one and one.

Example ​

php
<?php
$n = asin(1.25);

Reported:

  • line 2: Keep the inverse trigonometric argument within minus one and one.

Detection ​

  • asin or acos receives a proven real numeric argument less than -1 or greater than 1. Exclude unknown/non-numeric inputs.
  • Resolve builtin functions, extension classes, constants and method receivers, including aliases and supported named arguments. Inspect reachable operations in one lexical scope with bounded local flow.
  • Emit one finding per violating operation. Never infer policy from names or comments. When the proof is inconclusive, nothing is reported.

Exceptions (no report) ​

  • Exclude shadowed or unresolved symbols, incomplete code, unknown required constants, ambiguous receiver identity and unsupported versions. Reassignment, escaping aliases, and unknown calls invalidate dependent flow facts.
  • A variable argument is not proven when the same variable is stepped with ++ or -- or captured by reference in a closure, or when extract() is called, anywhere before the call in its function or file scope. Code inside a nested function does not count, apart from that by-reference capture. Inside a loop, a step or capture placed after the call counts too, because it precedes the call on the next iteration. A step after a call outside any loop does not weaken the proof.
  • Both @custos-ignore InverseTrigInvalidRealDomain and @noinspection InverseTrigInvalidRealDomain suppress this native rule.

Fix ​

None. A safe repair requires choosing values, error handling, or application behavior.

PHP versions ​

Apply throughout PHP 5.3–8.5 only where the extension API and syntax exist. Do not flag API unavailability through this rule.

Options ​

None. Use normal rule configuration to enable or disable the inspection.

Configure ​

In custos.json:

json
{
  "rules": {
    "InverseTrigInvalidRealDomain": {
      "enabled": false
    }
  }
}

Suppress ​

Before the statement or declaration (or the first statement of the file):

php
// @custos-ignore InverseTrigInvalidRealDomain

Released under the MIT License. Native rules and rules modeled on Php Inspections (EA Extended); independent clean-room implementation.