Skip to content

Commit 1ac1dc9

Browse files
ondrejmirtesisfedorov
authored andcommitted
Add NoDiscard attributes to DateTimeImmutable methods
1 parent d6add9a commit 1ac1dc9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

date/date_c.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public static function getLastErrors(): array|false {}
299299
#[Pure]
300300
#[TentativeType]
301301
#[LanguageLevelTypeAware(['8.4' => 'DateTimeImmutable'], default: 'static|false')]
302+
#[\NoDiscard(message: "as DateTimeImmutable::modify() does not modify the object itself")]
302303
public function modify(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $modifier) {}
303304

304305
/**
@@ -706,6 +707,7 @@ public function modify(#[LanguageLevelTypeAware(['8.0' => 'string'], default: ''
706707
* @link https://php.net/manual/en/datetime.add.php
707708
*/
708709
#[TentativeType]
710+
#[\NoDiscard(message: "as DateTimeImmutable::add() does not modify the object itself")]
709711
public function add(DateInterval $interval): DateTime {}
710712

711713
/**
@@ -725,6 +727,7 @@ public static function createFromImmutable(DateTimeImmutable $object) {}
725727
* @throws DateInvalidOperationException
726728
*/
727729
#[TentativeType]
730+
#[\NoDiscard(message: "as DateTimeImmutable::sub() does not modify the object itself")]
728731
public function sub(DateInterval $interval): DateTime {}
729732

730733
/**
@@ -742,6 +745,7 @@ public function getTimezone(): DateTimeZone|false {}
742745
* @link https://php.net/manual/en/datetime.settimezone.php
743746
*/
744747
#[TentativeType]
748+
#[\NoDiscard(message: "as DateTimeImmutable::setTimezone() does not modify the object itself")]
745749
public function setTimezone(#[LanguageLevelTypeAware(['8.0' => 'DateTimeZone'], default: '')] $timezone): DateTime {}
746750

747751
/**
@@ -762,6 +766,7 @@ public function getOffset(): int {}
762766
* @link https://php.net/manual/en/datetime.settime.php
763767
*/
764768
#[TentativeType]
769+
#[\NoDiscard(message: "as DateTimeImmutable::setTime() does not modify the object itself")]
765770
public function setTime(
766771
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $hour,
767772
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $minute,
@@ -778,6 +783,7 @@ public function setTime(
778783
* @link https://php.net/manual/en/datetime.setdate.php
779784
*/
780785
#[TentativeType]
786+
#[\NoDiscard(message: "as DateTimeImmutable::setDate() does not modify the object itself")]
781787
public function setDate(
782788
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $year,
783789
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $month,
@@ -793,6 +799,7 @@ public function setDate(
793799
* @link https://php.net/manual/en/datetime.setisodate.php
794800
*/
795801
#[TentativeType]
802+
#[\NoDiscard(message: "as DateTimeImmutable::setISODate() does not modify the object itself")]
796803
public function setISODate(
797804
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $year,
798805
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $week,
@@ -806,6 +813,7 @@ public function setISODate(
806813
* @link https://php.net/manual/en/datetime.settimestamp.php
807814
*/
808815
#[TentativeType]
816+
#[\NoDiscard(message: "as DateTimeImmutable::setTimestamp() does not modify the object itself")]
809817
public function setTimestamp(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $timestamp): DateTime {}
810818

811819
/**
@@ -906,6 +914,7 @@ public function getMicrosecond(): int {}
906914
/**
907915
* @since 8.4
908916
*/
917+
#[\NoDiscard(message: "as DateTimeImmutable::setMicrosecond() does not modify the object itself")]
909918
public function setMicrosecond(int $microsecond): static {}
910919
}
911920

0 commit comments

Comments
 (0)