Skip to content

Commit 2efe3d6

Browse files
committed
Modernize Http Status Codes
1 parent 3ddba4c commit 2efe3d6

File tree

1 file changed

+51
-45
lines changed

1 file changed

+51
-45
lines changed

src/Status.php

+51-45
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,68 @@
44

55
abstract class Status {
66

7-
public const StatusContinue = 100; // RFC 7231, 6.2.1
8-
public const SwitchingProtocols = 101; // RFC 7231, 6.2.2
7+
public const StatusContinue = 100; // RFC 9110, 15.2.1
8+
public const SwitchingProtocols = 101; // RFC 9110, 15.2.2
99
public const Processing = 102; // RFC 2518, 10.1
10+
public const EarlyHints = 103; // RFC 8297
1011

11-
public const OK = 200; // RFC 7231, 6.3.1
12-
public const Created = 201; // RFC 7231, 6.3.2
13-
public const Accepted = 202; // RFC 7231, 6.3.3
14-
public const NonAuthoritativeInfo = 203; // RFC 7231, 6.3.4
15-
public const NoContent = 204; // RFC 7231, 6.3.5
16-
public const ResetContent = 205; // RFC 7231, 6.3.6
17-
public const PartialContent = 206; // RFC 7233, 4.1
12+
public const OK = 200; // RFC 9110, 15.3.1
13+
public const Created = 201; // RFC 9110, 15.3.2
14+
public const Accepted = 202; // RFC 9110, 15.3.3
15+
public const NonAuthoritativeInfo = 203; // RFC 9110, 15.3.4
16+
public const NoContent = 204; // RFC 9110, 15.3.5
17+
public const ResetContent = 205; // RFC 9110, 15.3.6
18+
public const PartialContent = 206; // RFC 9110, 15.3.7
1819
public const MultiStatus = 207; // RFC 4918, 11.1
1920
public const AlreadyReported = 208; // RFC 5842, 7.1
2021
public const IMUsed = 226; // RFC 3229, 10.4.1
2122

22-
public const MultipleChoices = 300; // RFC 7231, 6.4.1
23-
public const MovedPermanently = 301; // RFC 7231, 6.4.2
24-
public const Found = 302; // RFC 7231, 6.4.3
25-
public const SeeOther = 303; // RFC 7231, 6.4.4
26-
public const NotModified = 304; // RFC 7232, 4.1
27-
public const UseProxy = 305; // RFC 7231, 6.4.5
28-
// = 306; // RFC 7231, 6.4.6 (Unused)
29-
public const TemporaryRedirect = 307; // RFC 7231, 6.4.7
30-
public const PermanentRedirect = 308; // RFC 7538, 3
23+
public const MultipleChoices = 300; // RFC 9110, 15.4.1
24+
public const MovedPermanently = 301; // RFC 9110, 15.4.2
25+
public const Found = 302; // RFC 9110, 15.4.3
26+
public const SeeOther = 303; // RFC 9110, 15.4.4
27+
public const NotModified = 304; // RFC 9110, 15.4.5
28+
public const UseProxy = 305; // RFC 9110, 15.4.6
29+
// = 306; // RFC 9110, 15.4.7 (Unused)
30+
public const TemporaryRedirect = 307; // RFC 9110, 15.4.8
31+
public const PermanentRedirect = 308; // RFC 9110, 15.4.9
3132

32-
public const BadRequest = 400; // RFC 7231, 6.5.1
33-
public const Unauthorized = 401; // RFC 7235, 3.1
34-
public const PaymentRequired = 402; // RFC 7231, 6.5.2
35-
public const Forbidden = 403; // RFC 7231, 6.5.3
36-
public const NotFound = 404; // RFC 7231, 6.5.4
37-
public const MethodNotAllowed = 405; // RFC 7231, 6.5.5
38-
public const NotAcceptable = 406; // RFC 7231, 6.5.6
39-
public const ProxyAuthRequired = 407; // RFC 7235, 3.2
40-
public const RequestTimeout = 408; // RFC 7231, 6.5.7
41-
public const Conflict = 409; // RFC 7231, 6.5.8
42-
public const Gone = 410; // RFC 7231, 6.5.9
43-
public const LengthRequired = 411; // RFC 7231, 6.5.10
44-
public const PreconditionFailed = 412; // RFC 7232, 4.2
45-
public const RequestEntityTooLarge = 413; // RFC 7231, 6.5.11
46-
public const RequestURITooLong = 414; // RFC 7231, 6.5.12
47-
public const UnsupportedMediaType = 415; // RFC 7231, 6.5.13
48-
public const RequestedRangeNotSatisfiable = 416; // RFC 7233, 4.4
49-
public const ExpectationFailed = 417; // RFC 7231, 6.5.14
50-
public const Teapot = 418; // RFC 7168, 2.3.3
51-
public const UnprocessableEntity = 422; // RFC 4918, 11.2
33+
public const BadRequest = 400; // RFC 9110, 15.5.1
34+
public const Unauthorized = 401; // RFC 9110, 15.5.2
35+
public const PaymentRequired = 402; // RFC 9110, 15.5.3
36+
public const Forbidden = 403; // RFC 9110, 15.5.4
37+
public const NotFound = 404; // RFC 9110, 15.5.5
38+
public const MethodNotAllowed = 405; // RFC 9110, 15.5.6
39+
public const NotAcceptable = 406; // RFC 9110, 15.5.7
40+
public const ProxyAuthRequired = 407; // RFC 9110, 15.5.8
41+
public const RequestTimeout = 408; // RFC 9110, 15.5.9
42+
public const Conflict = 409; // RFC 9110, 15.5.10
43+
public const Gone = 410; // RFC 9110, 15.5.11
44+
public const LengthRequired = 411; // RFC 9110, 15.5.12
45+
public const PreconditionFailed = 412; // RFC 9110, 15.5.13
46+
public const RequestEntityTooLarge = 413; // RFC 9110, 15.5.14
47+
public const RequestURITooLong = 414; // RFC 9110, 15.5.15
48+
public const UnsupportedMediaType = 415; // RFC 9110, 15.5.16
49+
public const RequestedRangeNotSatisfiable = 416; // RFC 9110, 15.5.17
50+
public const ExpectationFailed = 417; // RFC 9110, 15.5.18
51+
public const Teapot = 418; // RFC 9110, 15.5.19 (Unused)
52+
public const MisdirectedRequest = 421; // RFC 9110, 15.5.20
53+
public const UnprocessableEntity = 422; // RFC 9110, 15.5.21
5254
public const Locked = 423; // RFC 4918, 11.3
5355
public const FailedDependency = 424; // RFC 4918, 11.4
54-
public const UpgradeRequired = 426; // RFC 7231, 6.5.15
56+
public const TooEarly = 425; // RFC 8470, 5.2.
57+
public const UpgradeRequired = 426; // RFC 9110, 15.5.22
5558
public const PreconditionRequired = 428; // RFC 6585, 3
5659
public const TooManyRequests = 429; // RFC 6585, 4
5760
public const RequestHeaderFieldsTooLarge = 431; // RFC 6585, 5
5861
public const UnavailableForLegalReasons = 451; // RFC 7725, 3
5962

60-
public const InternalServerError = 500; // RFC 7231, 6.6.1
61-
public const NotImplemented = 501; // RFC 7231, 6.6.2
62-
public const BadGateway = 502; // RFC 7231, 6.6.3
63-
public const ServiceUnavailable = 503; // RFC 7231, 6.6.4
64-
public const GatewayTimeout = 504; // RFC 7231, 6.6.5
65-
public const HTTPVersionNotSupported = 505; // RFC 7231, 6.6.6
63+
public const InternalServerError = 500; // RFC 9110, 15.6.1
64+
public const NotImplemented = 501; // RFC 9110, 15.6.2
65+
public const BadGateway = 502; // RFC 9110, 15.6.3
66+
public const ServiceUnavailable = 503; // RFC 9110, 15.6.4
67+
public const GatewayTimeout = 504; // RFC 9110, 15.6.5
68+
public const HTTPVersionNotSupported = 505; // RFC 9110, 15.6.6
6669
public const VariantAlsoNegotiates = 506; // RFC 2295, 8.1
6770
public const InsufficientStorage = 507; // RFC 4918, 11.5
6871
public const LoopDetected = 508; // RFC 5842, 7.2
@@ -73,6 +76,7 @@ abstract class Status {
7376
self::StatusContinue => 'Continue',
7477
self::SwitchingProtocols => 'Switching Protocols',
7578
self::Processing => 'Processing',
79+
self::EarlyHints => 'Early Hints',
7680

7781
self::OK => 'OK',
7882
self::Created => 'Created',
@@ -113,9 +117,11 @@ abstract class Status {
113117
self::RequestedRangeNotSatisfiable => 'Requested Range Not Satisfiable',
114118
self::ExpectationFailed => 'Expectation Failed',
115119
self::Teapot => 'I\'m a teapot',
120+
self::MisdirectedRequest => 'Misdirected Request',
116121
self::UnprocessableEntity => 'Unprocessable Entity',
117122
self::Locked => 'Locked',
118123
self::FailedDependency => 'Failed Dependency',
124+
self::TooEarly => 'Too Early',
119125
self::UpgradeRequired => 'Upgrade Required',
120126
self::PreconditionRequired => 'Precondition Required',
121127
self::TooManyRequests => 'Too Many Requests',

0 commit comments

Comments
 (0)