{"action":"opened","issue":{"url":"https://api.github.com/repos/fzaninotto/Faker/issues/1225","repository_url":"https://api.github.com/repos/fzaninotto/Faker","labels_url":"https://api.github.com/repos/fzaninotto/Faker/issues/1225/labels{/name}","comments_url":"https://api.github.com/repos/fzaninotto/Faker/issues/1225/comments","events_url":"https://api.github.com/repos/fzaninotto/Faker/issues/1225/events","html_url":"https://github.com/fzaninotto/Faker/issues/1225","id":232914832,"number":1225,"title":"valid() and unique() don't mix","user":{"login":"srgraham","id":1577527,"avatar_url":"https://avatars0.githubusercontent.com/u/1577527?v=3","gravatar_id":"","url":"https://api.github.com/users/srgraham","html_url":"https://github.com/srgraham","followers_url":"https://api.github.com/users/srgraham/followers","following_url":"https://api.github.com/users/srgraham/following{/other_user}","gists_url":"https://api.github.com/users/srgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/srgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srgraham/subscriptions","organizations_url":"https://api.github.com/users/srgraham/orgs","repos_url":"https://api.github.com/users/srgraham/repos","events_url":"https://api.github.com/users/srgraham/events{/privacy}","received_events_url":"https://api.github.com/users/srgraham/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-01T15:17:29Z","updated_at":"2017-06-01T15:17:29Z","closed_at":null,"body":"\r\n\r\n```php\r\n// example validation function to pass to valid()\r\nfunction maxLength($len) {\r\n    $func = function ($value) use ($len) {\r\n        return strlen($value) <= $len;\r\n    };\r\n    return $func;\r\n}\r\n\r\n\r\n// successfully filters out usernames > 10 characters\r\n$faker->valid(maxLength(10))->userName();\r\n\r\n// errors, sending an object to valid() instead of a chosen string\r\n$faker->valid(maxLength(10))->unique()->userName();\r\n\r\n// Exception: Serialization of 'Closure' is not allowed \r\n$faker->unique()->valid(maxLength(10))->userName();\r\n```"}}
{"actor":{"display_login":"srgraham"}}