4

常に例外をスローしたり、終了したりする関数をマークする属性はありますか?

/** @noreturn */
function customDie() {
    die();
}

function bar() {
    switch( .. ) {
        case 1: customDie();  // <-- should not warn because there is no break
        case 2: xxx();
}

/** @return int */
function goo() {
    ...
    customDie();  // <-- should not warn that the method is not returning an integer
}
4

1 に答える 1

0

現在のバージョンの PhpStorm には、そのような「属性」/機能はありません。詳細については、このチケットに従ってください: http://youtrack.jetbrains.com/issue/WI-10673

die();私が提案できる唯一のオプションは、そのような関数を呼び出した後に actual を追加することです。はい -- 1 行追加されましたが、実際には実行されない 1 行だけです。

于 2013-03-07T19:17:22.253 に答える