To get offline source inspection (phan, Php Storm, etc.) currently I have to manually type-hint the return-type of getBest() inline - for example:
$negotiator = new Negotiator();
/** @var Accept $result */
$result = $negotiator->getBest(
$request->getHeaderLine("Accept"),
["application/json", "text/html"]
);
if ($result->getValue() === "application/json") {
// ...
}
Without the @var annotation, the if-statement will fail inspection, because the return-type of getBest() was declared as AcceptHeader rather than Accept, which appears to be the actual return-type.
What's the purpose of the empty AcceptHeader interface?
To get offline source inspection (phan, Php Storm, etc.) currently I have to manually type-hint the return-type of
getBest()inline - for example:Without the
@varannotation, theif-statement will fail inspection, because the return-type ofgetBest()was declared asAcceptHeaderrather thanAccept, which appears to be the actual return-type.What's the purpose of the empty
AcceptHeaderinterface?