{"action":"created","issue":{"url":"https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/issues/218","labels_url":"https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/issues/218/labels{/name}","comments_url":"https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/issues/218/comments","events_url":"https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/issues/218/events","html_url":"https://github.com/sebastianbergmann/phpunit-mock-objects/pull/218","id":57165553,"number":218,"title":"Relax #expects type hinting to allow shorter notation","user":{"login":"stefk","id":880921,"avatar_url":"https://avatars.githubusercontent.com/u/880921?v=3","gravatar_id":"","url":"https://api.github.com/users/stefk","html_url":"https://github.com/stefk","followers_url":"https://api.github.com/users/stefk/followers","following_url":"https://api.github.com/users/stefk/following{/other_user}","gists_url":"https://api.github.com/users/stefk/gists{/gist_id}","starred_url":"https://api.github.com/users/stefk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefk/subscriptions","organizations_url":"https://api.github.com/users/stefk/orgs","repos_url":"https://api.github.com/users/stefk/repos","events_url":"https://api.github.com/users/stefk/events{/privacy}","received_events_url":"https://api.github.com/users/stefk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-10T11:59:53Z","updated_at":"2015-08-14T15:24:39Z","closed_at":"2015-08-14T15:24:39Z","pull_request":{"url":"https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/pulls/218","html_url":"https://github.com/sebastianbergmann/phpunit-mock-objects/pull/218","diff_url":"https://github.com/sebastianbergmann/phpunit-mock-objects/pull/218.diff","patch_url":"https://github.com/sebastianbergmann/phpunit-mock-objects/pull/218.patch"},"body":"Hi,\r\n\r\nThis PR introduces a shorter notation for invocation expectations. The main ideas are:\r\n\r\n- having a default expectation which fits most cases (here I set it to \"at least once\")\r\n- allowing to pass directly an integer for exact invocation count\r\n- letting the usual, explicit behaviour untouched\r\n\r\nHere's an example:\r\n\r\n```php\r\n$mock->expects()->method('foo'); // at least one invocation of \"foo\" is expected\r\n\r\n$mock->expects(3)->method('foo'); // exactly three invocations required\r\n\r\n$mock->expects($this->any())->method('foo'); // as usual...\r\n```\r\n\r\nThis notation and the chosen default seem quite natural to me, but feel free to discuss it. I had to relax the type hinting on the `MockObject#expects` to allow this behaviour, so a bunch of test files had to be modified... I added a test case and the whole suite is green.\r\n"},"comment":{"url":"https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/issues/comments/131148078","html_url":"https://github.com/sebastianbergmann/phpunit-mock-objects/pull/218#issuecomment-131148078","issue_url":"https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/issues/218","id":131148078,"user":{"login":"sebastianbergmann","id":25218,"avatar_url":"https://avatars.githubusercontent.com/u/25218?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastianbergmann","html_url":"https://github.com/sebastianbergmann","followers_url":"https://api.github.com/users/sebastianbergmann/followers","following_url":"https://api.github.com/users/sebastianbergmann/following{/other_user}","gists_url":"https://api.github.com/users/sebastianbergmann/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastianbergmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastianbergmann/subscriptions","organizations_url":"https://api.github.com/users/sebastianbergmann/orgs","repos_url":"https://api.github.com/users/sebastianbergmann/repos","events_url":"https://api.github.com/users/sebastianbergmann/events{/privacy}","received_events_url":"https://api.github.com/users/sebastianbergmann/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T15:24:39Z","updated_at":"2015-08-14T15:24:39Z","body":"Sorry, I still think that this is too big of a change for too little gain."}}