{"action":"created","issue":{"url":"https://api.github.com/repos/c9s/Pux/issues/70","labels_url":"https://api.github.com/repos/c9s/Pux/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/c9s/Pux/issues/70/comments","events_url":"https://api.github.com/repos/c9s/Pux/issues/70/events","html_url":"https://github.com/c9s/Pux/issues/70","id":51346292,"number":70,"title":"Typed Function Calls","user":{"login":"apfritts","id":2000021,"avatar_url":"https://avatars.githubusercontent.com/u/2000021?v=3","gravatar_id":"","url":"https://api.github.com/users/apfritts","html_url":"https://github.com/apfritts","followers_url":"https://api.github.com/users/apfritts/followers","following_url":"https://api.github.com/users/apfritts/following{/other_user}","gists_url":"https://api.github.com/users/apfritts/gists{/gist_id}","starred_url":"https://api.github.com/users/apfritts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apfritts/subscriptions","organizations_url":"https://api.github.com/users/apfritts/orgs","repos_url":"https://api.github.com/users/apfritts/repos","events_url":"https://api.github.com/users/apfritts/events{/privacy}","received_events_url":"https://api.github.com/users/apfritts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-12-08T20:12:07Z","updated_at":"2015-03-03T01:49:54Z","closed_at":null,"body":"Hi!\r\n\r\nWe're interested in adding typed function calls to Pux and contributing them back to the project. Taking this example from the docs:\r\n\r\n```php\r\n$mux->get('/product/:id', ['ProductController','itemAction'] , [\r\n    'require' => [ 'id' => '\\d+', ],\r\n    'default' => [ 'id' => '1', ]\r\n]);\r\n```\r\n\r\nwould become:\r\n\r\n```php\r\n$mux->get('/product/:id', ['ProductController','itemAction'] , [\r\n    'require' => [ 'id' => Pux\\Mux::TYPE_INTEGER, ],\r\n    'default' => [ 'id' => '1', ]\r\n]);\r\n```\r\n\r\nThis would automatically match against \\d+ and result in a call to as ProductionController()->itemAction( (int) $id) instead of passing a string type.\r\n\r\nWhy?\r\n\r\nThis will simplify controller logic and allow invalid input to be sent to a 404 page instead of through controller logic.\r\n\r\nIt also allows folks to start converting over to Hack / HHVM for other performance gains.\r\n\r\nAny concerns over this feature? Will this have any impact on the C extension (which we don't use so I wouldn't be adding any code in)."},"comment":{"url":"https://api.github.com/repos/c9s/Pux/issues/comments/76871315","html_url":"https://github.com/c9s/Pux/issues/70#issuecomment-76871315","issue_url":"https://api.github.com/repos/c9s/Pux/issues/70","id":76871315,"user":{"login":"c9s","id":50894,"avatar_url":"https://avatars.githubusercontent.com/u/50894?v=3","gravatar_id":"","url":"https://api.github.com/users/c9s","html_url":"https://github.com/c9s","followers_url":"https://api.github.com/users/c9s/followers","following_url":"https://api.github.com/users/c9s/following{/other_user}","gists_url":"https://api.github.com/users/c9s/gists{/gist_id}","starred_url":"https://api.github.com/users/c9s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c9s/subscriptions","organizations_url":"https://api.github.com/users/c9s/orgs","repos_url":"https://api.github.com/users/c9s/repos","events_url":"https://api.github.com/users/c9s/events{/privacy}","received_events_url":"https://api.github.com/users/c9s/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T01:49:54Z","updated_at":"2015-03-03T01:49:54Z","body":"Hi @apfritts \r\n\r\nSorry I think I missed the mail. overall, I like this proposal, PRs will be welcomed. And yes, it will impact the C extension since the API is slightly different, but that's fine, we can add the C implementation later.\r\n\r\n"}}