intelephense

1.14.41.16.1
lib/stub/date/date_c.php
lib/stub/date/date_c.php
+57−13
Index: package/lib/stub/date/date_c.php
===================================================================
--- package/lib/stub/date/date_c.php
+++ package/lib/stub/date/date_c.php
@@ -113,8 +113,9 @@
      * @return string
      * Returns the formatted date string on success or <b>FALSE</b> on failure.
      * Since PHP8, it always returns <b>STRING</b>.
      */
+    #[Pure(true)]
     #[TentativeType]
     public function format(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format): string;
 
     /**
@@ -167,13 +168,8 @@
     /**
      * @since 8.4
      */
     public function getMicrosecond(): int;
-
-    /**
-     * @since 8.4
-     */
-    public function setMicrosecond();
 }
 
 /**
  * @since 5.5
@@ -232,8 +228,9 @@
      * @return static
      * @link https://secure.php.net/manual/en/datetimeimmutable.add.php
      */
     #[TentativeType]
+    #[\NoDiscard(message: "as DateTimeImmutable::add() does not modify the object itself")]
     public function add(DateInterval $interval): DateTimeImmutable {}
 
     /**
      * (PHP 5 &gt;=5.5.0)<br/>
@@ -244,15 +241,34 @@
      * @param null|DateTimeZone $timezone [optional]
      * @return DateTimeImmutable|false
      */
     #[TentativeType]
+    #[StubsElementAvailable(from: '5.5', to: '7.4')]
     public static function createFromFormat(
         #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format,
         #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $datetime,
         #[LanguageLevelTypeAware(['8.0' => 'DateTimeZone|null'], default: 'DateTimeZone')] $timezone = null
     ): DateTimeImmutable|false {}
 
     /**
+     * (PHP 5 &gt;=5.5.0)<br/>
+     * Returns new DateTimeImmutable object formatted according to the specified format
+     * @link https://secure.php.net/manual/en/datetimeimmutable.createfromformat.php
+     * @param string $format
+     * @param string $datetime
+     * @param null|DateTimeZone $timezone [optional]
+     * @return DateTimeImmutable|false
+     * @throws ValueError when the datetime contains NULL-bytes.
+     */
+    #[TentativeType]
+    #[StubsElementAvailable(from: '8.0')]
+    public static function createFromFormat(
+        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format,
+        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $datetime,
+        #[LanguageLevelTypeAware(['8.0' => 'DateTimeZone|null'], default: 'DateTimeZone')] $timezone = null
+    ): DateTimeImmutable|false {}
+
+    /**
      * (PHP 5 &gt;=5.6.0)<br/>
      * Returns new DateTimeImmutable object encapsulating the given DateTime object
      * @link https://secure.php.net/manual/en/datetimeimmutable.createfrommutable.php
      * @param DateTime $object The mutable DateTime object that you want to convert to an immutable version. This object is not modified, but instead a new DateTimeImmutable object is created containing the same date time and timezone information.
@@ -283,9 +299,10 @@
      */
     #[StubsElementAvailable(from:'5.5', to: '8.2')]
     #[Pure]
     #[TentativeType]
-    #[LanguageLevelTypeAware(['8.4' => 'DateTimeImmutable'], default: 'DateTimeImmutable|false')]
+    #[LanguageLevelTypeAware(['8.4' => 'DateTimeImmutable'], default: 'static|false')]
+    #[\NoDiscard(message: "as DateTimeImmutable::modify() does not modify the object itself")]
     public function modify(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $modifier) {}
 
     /**
      * (PHP 8 &gt;=8.3.0)<br/>
@@ -323,8 +340,9 @@
      * @return static|false
      * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or <b>FALSE</b> on failure.
      */
     #[TentativeType]
+    #[\NoDiscard(message: "as DateTimeImmutable::setDate() does not modify the object itself")]
     public function setDate(
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $year,
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $month,
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $day
@@ -340,8 +358,9 @@
      * @return static|false
      * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or <b>FALSE</b> on failure.
      */
     #[TentativeType]
+    #[\NoDiscard(message: "as DateTimeImmutable::setISODate() does not modify the object itself")]
     public function setISODate(
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $year,
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $week,
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $dayOfWeek = 1
@@ -358,8 +377,9 @@
      * @return static|false
      * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or <b>FALSE</b> on failure.
      */
     #[TentativeType]
+    #[\NoDiscard(message: "as DateTimeImmutable::setTime() does not modify the object itself")]
     public function setTime(
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $hour,
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $minute,
         #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $second = 0,
@@ -374,8 +394,9 @@
      * @return static
      * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or <b>FALSE</b> on failure.
      */
     #[TentativeType]
+    #[\NoDiscard(message: "as DateTimeImmutable::setTimestamp() does not modify the object itself")]
     public function setTimestamp(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $timestamp): DateTimeImmutable {}
 
     /**
      * (PHP 5 &gt;=5.5.0)<br/>
@@ -388,8 +409,9 @@
      * @return static
      * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or <b>FALSE</b> on failure.
      */
     #[TentativeType]
+    #[\NoDiscard(message: "as DateTimeImmutable::setTimezone() does not modify the object itself")]
     public function setTimezone(DateTimeZone $timezone): DateTimeImmutable {}
 
     /**
      * (PHP 5 &gt;=5.5.0)<br/>
@@ -402,19 +424,20 @@
      * @throws DateInvalidOperationException
      * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or <b>FALSE</b> on failure.
      */
     #[TentativeType]
+    #[\NoDiscard(message: "as DateTimeImmutable::sub() does not modify the object itself")]
     public function sub(DateInterval $interval): DateTimeImmutable {}
 
     /**
      * (PHP 5 &gt;=5.5.0)<br/>
      * Returns the difference between two DateTime objects
      * @link https://secure.php.net/manual/en/datetime.diff.php
      * @param DateTimeInterface $targetObject <p>The date to compare to.</p>
      * @param bool $absolute [optional] <p>Should the interval be forced to be positive?</p>
-     * @return DateInterval|false
+     * @return DateInterval
      * The {@link https://secure.php.net/manual/en/class.dateinterval.php DateInterval} object representing the
-     * difference between the two dates or <b>FALSE</b> on failure.
+     * difference between the two dates.
      */
     #[TentativeType]
     public function diff(
         #[LanguageLevelTypeAware(['8.0' => 'DateTimeInterface'], default: '')] $targetObject,
@@ -430,8 +453,9 @@
      * </p>
      * @return string
      * Returns the formatted date string on success or <b>FALSE</b> on failure.
      */
+    #[Pure(true)]
     #[TentativeType]
     public function format(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format): string {}
 
     /**
@@ -474,9 +498,9 @@
     public function __wakeup(): void {}
 
     /**
      * @param DateTimeInterface $object
-     * @return DateTimeImmutable
+     * @return static
      * @since 8.0
      */
     public static function createFromInterface(DateTimeInterface $object): DateTimeImmutable {}
 
@@ -499,8 +523,9 @@
 
     /**
      * @since 8.4
      */
+    #[\NoDiscard(message: "as DateTimeImmutable::setMicrosecond() does not modify the object itself")]
     public function setMicrosecond(int $microsecond): static {}
 }
 
 /**
@@ -654,8 +679,9 @@
      * @param string $format
      * @return string
      * @link https://php.net/manual/en/datetime.format.php
      */
+    #[Pure(true)]
     #[TentativeType]
     public function format(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format): string {}
 
     /**
@@ -666,9 +692,9 @@
      * @link https://php.net/manual/en/datetime.modify.php
      */
     #[StubsElementAvailable(from: '5.3', to: '8.2')]
     #[TentativeType]
-    #[LanguageLevelTypeAware(['8.4' => 'DateTime'], default: 'DateTime|false')]
+    #[LanguageLevelTypeAware(['8.4' => 'DateTime'], default: 'static|false')]
     public function modify(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $modifier) {}
 
     /**
      * Alter the timestamp of a DateTime object by incrementing or decrementing
@@ -679,9 +705,9 @@
      * @link https://php.net/manual/en/datetime.modify.php
      */
     #[StubsElementAvailable(from: '8.3')]
     #[TentativeType]
-    #[LanguageLevelTypeAware(['8.4' => 'DateTime'], default: 'DateTime|false')]
+    #[LanguageLevelTypeAware(['8.4' => 'DateTime'], default: 'static|false')]
     public function modify(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $modifier) {}
 
     /**
      * Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object
@@ -803,9 +829,9 @@
     /**
      * Returns the difference between two DateTime objects represented as a DateInterval.
      * @param DateTimeInterface $targetObject The date to compare to.
      * @param bool $absolute [optional] Whether to return absolute difference.
-     * @return DateInterval|false The DateInterval object representing the difference between the two dates.
+     * @return DateInterval The DateInterval object representing the difference between the two dates.
      * @link https://php.net/manual/en/datetime.diff.php
      */
     #[TentativeType]
     public function diff(
@@ -821,15 +847,33 @@
      * @return DateTime|false
      * @link https://php.net/manual/en/datetime.createfromformat.php
      */
     #[TentativeType]
+    #[StubsElementAvailable(from: '5.3', to: '7.4')]
     public static function createFromFormat(
         #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format,
         #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $datetime,
         #[LanguageLevelTypeAware(['8.0' => 'DateTimeZone|null'], default: 'DateTimeZone')] $timezone = null
     ): DateTime|false {}
 
     /**
+     * Parse a string into a new DateTime object according to the specified format
+     * @param string $format Format accepted by date().
+     * @param string $datetime String representing the time.
+     * @param null|DateTimeZone $timezone A DateTimeZone object representing the desired time zone.
+     * @return DateTime|false
+     * @link https://php.net/manual/en/datetime.createfromformat.php
+     * @throws ValueError when the datetime contains NULL-bytes.
+     */
+    #[TentativeType]
+    #[StubsElementAvailable(from: '8.0')]
+    public static function createFromFormat(
+        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format,
+        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $datetime,
+        #[LanguageLevelTypeAware(['8.0' => 'DateTimeZone|null'], default: 'DateTimeZone')] $timezone = null
+    ): DateTime|false {}
+
+    /**
      * Returns an array of warnings and errors found while parsing a date/time string
      * @return array{warning_count:int, warnings:string[], error_count:int, errors:string[]}|false
      * @link https://php.net/manual/en/datetime.getlasterrors.php
      */
@@ -846,9 +890,9 @@
     public static function __set_state($array) {}
 
     /**
      * @param DateTimeInterface $object
-     * @return DateTime
+     * @return static
      * @since 8.0
      */
     public static function createFromInterface(DateTimeInterface $object): DateTime {}