rentalhost/laravel-insight

PhpFunctionUtil.getReturnType(): advanced analysis

rentalhost opened this issue · 0 comments

Additional analysis (should check if all is applicable):

  • Compound types: array, object, callable (and iterable?);
  • Resource type: resource;
  • Callable type: callable;
  • Void type: void;
    • From return;;
    • From no return statement;
  • Make sure to ignores unreacheable return statements;
    • After the last return (eg. return; return $unreacheable;);
    • After an uncatched throw;
  • Support to complex array types:
    • Return int[] from one type array (eg. [1, 2, 3]);
    • Return mixed[] from mixed type array (eg. [1, 'a', true]);
  • Make sure that comparison returns bool (eg. return $a === $b);
  • Make sure that expressions returns int (eg. return $a + $b);
  • Make sure that concats returns string (eg. return $a . $b);