@@ -279,7 +279,10 @@ public function __toString();
279279 */
280280class Exception implements Throwable
281281{
282- /** The error message */
282+ /**
283+ * The error message
284+ * @var string
285+ */
283286 protected $ message ;
284287
285288 /** The error code */
@@ -526,6 +529,12 @@ private function __clone(): void {}
526529 public function __wakeup (): void {}
527530}
528531
532+ /**
533+ * Is thrown when the type of an argument is correct but the value of it is incorrect. For example, passing a negative
534+ * integer when the function expects a positive one, or passing an empty string/array when the function expects it to not be empty.
535+ * @link https://www.php.net/manual/en/class.valueerror.php
536+ * @since 8.0
537+ */
529538class ValueError extends Error {}
530539
531540/**
@@ -604,7 +613,7 @@ class ErrorException extends Exception
604613 * @param int $severity [optional] The severity level of the exception.
605614 * @param string $filename [optional] The filename where the exception is thrown.
606615 * @param int $line [optional] The line number where the exception is thrown.
607- * @param Exception $previous [optional] The previous exception used for the exception chaining.
616+ * @param Throwable $previous [optional] The previous exception used for the exception chaining.
608617 */
609618 #[Pure]
610619 public function __construct (
@@ -693,6 +702,11 @@ public function call(object $newThis, mixed ...$args): mixed {}
693702 * @since 7.1
694703 */
695704 public static function fromCallable (callable $ callback ): Closure {}
705+
706+ /**
707+ * @since 8.5
708+ */
709+ public static function getCurrent (): Closure {}
696710}
697711
698712/**
@@ -875,10 +889,16 @@ final class Attribute
875889 */
876890 public const TARGET_PARAMETER = 32 ;
877891
892+ /**
893+ * Marks that attribute declaration is allowed only in constants.
894+ * @since 8.5
895+ */
896+ public const TARGET_CONSTANT = 32 ;
897+
878898 /**
879899 * Marks that attribute declaration is allowed anywhere.
880900 */
881- public const TARGET_ALL = 63 ;
901+ public const TARGET_ALL = 127 ;
882902
883903 /**
884904 * Notes that an attribute declaration in the same place is
@@ -890,7 +910,7 @@ final class Attribute
890910 * @param int $flags A value in the form of a bitmask indicating the places
891911 * where attributes can be defined.
892912 */
893- public function __construct (#[ExpectedValues(flagsFromClass: Attribute::class)] int $ flags = self ::TARGET_ALL ) {}
913+ public function __construct (#[ExpectedValues(flagsFromClass: Attribute::class)] int $ flags = Attribute ::TARGET_ALL ) {}
894914}
895915
896916/**
@@ -937,7 +957,7 @@ interface BackedEnum extends UnitEnum
937957 * case, if any. If there is no matching case defined, it will throw a
938958 * <code>ValueError</code>.
939959 * @param int|string $value
940- * @throws ValueError
960+ * @throws ValueError if there is no matching case defined
941961 * @throws TypeError
942962 * @return static
943963 * @link https://www.php.net/manual/en/backedenum.from.php
@@ -968,15 +988,23 @@ interface IntBackedEnum extends BackedEnum
968988 public readonly int $ value ;
969989
970990 /**
991+ * Translates an int into the corresponding <code>Enum</code>
992+ * case, if any. If there is no matching case defined, it will throw a
993+ * <code>ValueError</code>.
971994 * @param int $value
972995 * @return static
996+ * @throws ValueError if there is no matching case defined
997+ * @link https://www.php.net/manual/en/backedenum.from.php
973998 */
974999 #[Pure]
9751000 public static function from (int $ value ): static ;
9761001
9771002 /**
1003+ * Translates an int into the corresponding <code>Enum</code>
1004+ * case, if any. If there is no matching case defined, it will return null.
9781005 * @param int $value
9791006 * @return static|null
1007+ * @link https://www.php.net/manual/en/backedenum.tryfrom.php
9801008 */
9811009 #[Pure]
9821010 public static function tryFrom (int $ value ): ?static ;
@@ -992,9 +1020,25 @@ interface StringBackedEnum extends BackedEnum
9921020{
9931021 public readonly string $ value ;
9941022
1023+ /**
1024+ * Translates a string into the corresponding <code>Enum</code>
1025+ * case, if any. If there is no matching case defined, it will throw a
1026+ * <code>ValueError</code>.
1027+ * @param string $value
1028+ * @return static
1029+ * @throws ValueError if there is no matching case defined
1030+ * @link https://www.php.net/manual/en/backedenum.from.php
1031+ */
9951032 #[Pure]
9961033 public static function from (string $ value ): static ;
9971034
1035+ /**
1036+ * Translates a string or int into the corresponding <code>Enum</code>
1037+ * case, if any. If there is no matching case defined, it will return null.
1038+ * @param string $value
1039+ * @return static|null
1040+ * @link https://www.php.net/manual/en/backedenum.tryfrom.php
1041+ */
9981042 #[Pure]
9991043 public static function tryFrom (string $ value ): ?static ;
10001044}
@@ -1160,11 +1204,28 @@ public function __construct() {}
11601204/**
11611205 * @since 8.4
11621206 */
1163- #[Attribute(Attribute::TARGET_METHOD |Attribute::TARGET_FUNCTION |Attribute::TARGET_CLASS_CONSTANT )]
1207+ #[Attribute(Attribute::TARGET_METHOD |Attribute::TARGET_FUNCTION |Attribute::TARGET_CLASS_CONSTANT |Attribute:: TARGET_CONSTANT )]
11641208final class Deprecated
11651209{
11661210 public readonly ?string $ message ;
11671211 public readonly ?string $ since ;
11681212
11691213 public function __construct (?string $ message = null , ?string $ since = null ) {}
11701214}
1215+
1216+ /**
1217+ * @since 8.5
1218+ */
1219+ #[Attribute(Attribute::TARGET_METHOD |Attribute::TARGET_FUNCTION )]
1220+ final class NoDiscard
1221+ {
1222+ public readonly ?string $ message ;
1223+
1224+ public function __construct (?string $ message = null ) {}
1225+ }
1226+
1227+ /**
1228+ * @since 8.5
1229+ */
1230+ #[Attribute(Attribute::TARGET_ALL )]
1231+ final class DelayedTargetValidation {}
0 commit comments