Warning: The return value of method DateTimeImmutable::modify() should either be used or intentionally ignored by casting it as (void), as DateTimeImmutable::modify() does not modify the object itself 「戻り値を使うか、 (void) を付けてわざと無視だとしてる宣言をしよう」 と警告をしてくる。 これは PHP 8.5 で新しく搭載された #[\NoDiscard] 属性にあたる。 RFC: marking̲return̲value̲as̲important((void) キャストも同 RFC で追加) #[\NoDiscard("as DateTimeImmutable::modify() does not modify the object itself")] public function modify(string $modifier): DateTimeImmutable {} ※ 標準の 関数にも採用済みだし、もちろん自作の関数・メソッドにも付けられる 斉田真也 / X: @saita̲shinya / GitHub: shinya 7