Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 413 Bytes

MismatchingDocblockReturnType.md

File metadata and controls

31 lines (25 loc) · 413 Bytes

MismatchingDocblockReturnType

Emitted when an @return entry in a function’s docblock does not match the function return typehint

<?php

class A {}
class B {}
/**
 * @return B // emitted here
 */
function foo() : A {
    return new A();
}

This, however, is fine:

<?php

class A {}
class B extends A {}
/**
 * @return B // emitted here
 */
function foo() : A {
    return new B();
}