{"action":"created","issue":{"url":"https://api.github.com/repos/lukasoppermann/http-status/issues/12","labels_url":"https://api.github.com/repos/lukasoppermann/http-status/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/lukasoppermann/http-status/issues/12/comments","events_url":"https://api.github.com/repos/lukasoppermann/http-status/issues/12/events","html_url":"https://github.com/lukasoppermann/http-status/issues/12","id":100307122,"number":12,"title":"Do we really need the HTTP_* constants","user":{"login":"nyamsprod","id":51073,"avatar_url":"https://avatars.githubusercontent.com/u/51073?v=3","gravatar_id":"","url":"https://api.github.com/users/nyamsprod","html_url":"https://github.com/nyamsprod","followers_url":"https://api.github.com/users/nyamsprod/followers","following_url":"https://api.github.com/users/nyamsprod/following{/other_user}","gists_url":"https://api.github.com/users/nyamsprod/gists{/gist_id}","starred_url":"https://api.github.com/users/nyamsprod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyamsprod/subscriptions","organizations_url":"https://api.github.com/users/nyamsprod/orgs","repos_url":"https://api.github.com/users/nyamsprod/repos","events_url":"https://api.github.com/users/nyamsprod/events{/privacy}","received_events_url":"https://api.github.com/users/nyamsprod/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-08-11T13:08:28Z","updated_at":"2015-08-14T05:58:29Z","closed_at":null,"body":"Going back to the point I made during the PR from @colinodell I'm still not convinced about the usefulness of all the `HTTP_*` constants. Again a class constant should have a meaning only in the class context which uses it.\r\n\r\nThe `HttpStatus::HTTP_*` constants are designed to be used **outside** of the `Httpstatus` class since the class in itself does not rely on their values or presences to do anything meaningful. I would say that in the context of your class the methods already exposed are just about enough. \r\n\r\nA simple example below to illustrate what I'm saying. \r\n```php\r\n$response = new HttpResponse();\r\n$response->withStatusCode(Httpstatus::HTTP_NOT_FOUND);\r\n```\r\nIf I were to use your class like this, It would mean that I have created a **hard dependency** to `Httpstatus` and that I am relying on a constant value on which I have no control over. If `Httpstatus::HTTP_NOT_FOUND` value were to change I would have to go back in all my codes to update them. \r\n\r\nConversely I have no problem with the following code:\r\n\r\n```php\r\n$response = new HttpResponse();\r\n$response->withStatusCode(HttpResponse::HTTP_NOT_FOUND);\r\n```\r\nIn this last example, the constant used belong to the class, the developer was smart enough to add them to ease creating his/her response message. The class knows about the constant and changing its value won't affect my code as long as the developer is consistent with himself in that class. I think this is what Symfony did.\r\n\r\nWhat if the developer forgot about the 404 error response, The constants are then handy. Well no, because you do provide a solid documentation page that's point to the right RFC. This is a educational problem not a code one.\r\n\r\nBottom line, with the current public API I can already do a bunch of things without having to rely on the `HTTP_*` constants, removing them would make for a cleaner, more compact class without any subtantial tradeoff.\r\n"},"comment":{"url":"https://api.github.com/repos/lukasoppermann/http-status/issues/comments/130982409","html_url":"https://github.com/lukasoppermann/http-status/issues/12#issuecomment-130982409","issue_url":"https://api.github.com/repos/lukasoppermann/http-status/issues/12","id":130982409,"user":{"login":"lukasoppermann","id":813754,"avatar_url":"https://avatars.githubusercontent.com/u/813754?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasoppermann","html_url":"https://github.com/lukasoppermann","followers_url":"https://api.github.com/users/lukasoppermann/followers","following_url":"https://api.github.com/users/lukasoppermann/following{/other_user}","gists_url":"https://api.github.com/users/lukasoppermann/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasoppermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasoppermann/subscriptions","organizations_url":"https://api.github.com/users/lukasoppermann/orgs","repos_url":"https://api.github.com/users/lukasoppermann/repos","events_url":"https://api.github.com/users/lukasoppermann/events{/privacy}","received_events_url":"https://api.github.com/users/lukasoppermann/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T05:58:29Z","updated_at":"2015-08-14T05:58:29Z","body":"Okay, I will implement something using an interface as I feel it is more clean a solution."}}