ondrejmirtes · GitHub

The code in question:

assertType('React\Promise\PromiseInterface<*NEVER*>', resolve(true)->then(function (bool $value): never {
    throw new \RuntimeException();
}));

There are two "never" types in PHPStan:

  • NeverType (*NEVER*) - used basically everywhere - in cases like empty arrays
  • NonAcceptingNeverType (never) - used when the user types never literally in PHPDoc or native return type

For anonymous functions, PHPStan can infer always-throwing function even without a native never return type. In that case, *NEVER* is used. But there's probably isn't a good reason for that, so I changed it: phpstan/phpstan-src@ 3e03e9d

It will be released at the earliest convenience.

Read the original on github.com ↗