{"action":"created","comment":{"url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/comments/274559752","pull_request_review_id":225699250,"id":274559752,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3NDU1OTc1Mg==","diff_hunk":"@@ -0,0 +1,78 @@\n+Feature: MockReturn\n+  \n+  Background:\n+    Given I have the following config\n+      \"\"\"\n+      <?xml version=\"1.0\"?>\n+      <psalm totallyTyped=\"true\">\n+        <projectFiles>\n+          <directory name=\".\"/>\n+          <ignoreFiles> <directory name=\"../../vendor\"/> </ignoreFiles>\n+        </projectFiles>\n+        <plugins>\n+          <pluginClass class=\"Psalm\\MockeryPlugin\\Plugin\"/>\n+        </plugins>\n+      </psalm>\n+      \"\"\"\n+    And I have the following code preamble\n+      \"\"\"\n+      <?php\n+      namespace NS;\n+      use Mockery;\n+      \n+      \"\"\"\n+    \n+  Scenario: Defined method mocking sets proper intersection return type (Psalm 3.0.9 and higher)\n+    Given I have the following code\n+      \"\"\"\n+      class User\n+      {\n+          /**\n+           * @return void\n+           */\n+          public function someMethod()\n+          {\n+          \n+          }\n+      }\n+      \n+      $user = Mockery::mock('NS\\User[someMethod]', []);\n+      \n+      if (is_array($user)) {\n+      \n+      }\n+      \"\"\"\n+    And I have Psalm newer than \"3.0.8\" (because of \"error messages changing in 3.0.9\")\n+    When I run Psalm\n+    Then I see these errors\n+      | Type            | Message                                                                                                                                 |\n+      | DocblockTypeContradiction | Cannot resolve types for $user - docblock-defined type Mockery\\MockInterface&NS\\User does not contain array<array-key, mixed> |\n+    And I see no other errors\n+    \n+  Scenario: Defined method mocking sets proper intersection return type (Psalm 3.0.8 and lower)","path":"tests/acceptance/MockReturn.feature","position":52,"original_position":52,"commit_id":"19ed07083487b2dfa8a460df88b8c7b00548dc0d","original_commit_id":"e26e8482a5eeea4f8c8e5d71cdafc084cde916ed","user":{"login":"weirdan","id":57403,"node_id":"MDQ6VXNlcjU3NDAz","avatar_url":"https://avatars3.githubusercontent.com/u/57403?v=4","gravatar_id":"","url":"https://api.github.com/users/weirdan","html_url":"https://github.com/weirdan","followers_url":"https://api.github.com/users/weirdan/followers","following_url":"https://api.github.com/users/weirdan/following{/other_user}","gists_url":"https://api.github.com/users/weirdan/gists{/gist_id}","starred_url":"https://api.github.com/users/weirdan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weirdan/subscriptions","organizations_url":"https://api.github.com/users/weirdan/orgs","repos_url":"https://api.github.com/users/weirdan/repos","events_url":"https://api.github.com/users/weirdan/events{/privacy}","received_events_url":"https://api.github.com/users/weirdan/received_events","type":"User","site_admin":false},"body":"There's rudimentary support for match-anything substrings: `Some error % text` is interpreted like the following PCRE regexp: `/Some error .* text/`","created_at":"2019-04-11T18:01:34Z","updated_at":"2019-04-11T18:01:34Z","html_url":"https://github.com/psalm/mockery-psalm-plugin/pull/2#discussion_r274559752","pull_request_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/2","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/comments/274559752"},"html":{"href":"https://github.com/psalm/mockery-psalm-plugin/pull/2#discussion_r274559752"},"pull_request":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/2"}},"in_reply_to_id":274536543},"pull_request":{"url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/2","id":269658005,"node_id":"MDExOlB1bGxSZXF1ZXN0MjY5NjU4MDA1","html_url":"https://github.com/psalm/mockery-psalm-plugin/pull/2","diff_url":"https://github.com/psalm/mockery-psalm-plugin/pull/2.diff","patch_url":"https://github.com/psalm/mockery-psalm-plugin/pull/2.patch","issue_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/issues/2","number":2,"state":"open","locked":false,"title":"Adding tests and other code quality checks, fixing a couple of issues","user":{"login":"jaydiablo","id":136907,"node_id":"MDQ6VXNlcjEzNjkwNw==","avatar_url":"https://avatars0.githubusercontent.com/u/136907?v=4","gravatar_id":"","url":"https://api.github.com/users/jaydiablo","html_url":"https://github.com/jaydiablo","followers_url":"https://api.github.com/users/jaydiablo/followers","following_url":"https://api.github.com/users/jaydiablo/following{/other_user}","gists_url":"https://api.github.com/users/jaydiablo/gists{/gist_id}","starred_url":"https://api.github.com/users/jaydiablo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaydiablo/subscriptions","organizations_url":"https://api.github.com/users/jaydiablo/orgs","repos_url":"https://api.github.com/users/jaydiablo/repos","events_url":"https://api.github.com/users/jaydiablo/events{/privacy}","received_events_url":"https://api.github.com/users/jaydiablo/received_events","type":"User","site_admin":false},"body":"This PR adds tests and other code quality checks to this plugin (seems like the foundation was there for this but not everything was in place, like config files for psalm/phpcs).  I \"stole\" most of this skeleton from the psalm phpunit plugin (https://github.com/psalm/phpunit-psalm-plugin thanks @weirdan for your work on that).\r\n\r\nI think this repo will have to be enabled in Travis in order to have the tests run against this PR. I did confirm that all checks are green on my branch (except for PHP 7.4 and Nightly, which are having build issues generally right now due to a missing library file). Here's the last build for my branch: https://travis-ci.org/jaydiablo/mockery-psalm-plugin/builds/518856454\r\n\r\nI tried to add tests that covered the cases that I've run into recently when testing this plugin:\r\n\r\n* #1 - I've added an additional modification to the return type when the first parameter to `Mockery::mock` is a string (and it may or may not be in the format of `ClassName[methodName1,methodName2]`). The test I added for this intentionally triggers a psalm error in order to verify that the expected type is an intersection type (`ClassName&\\Mockery\\MockInterface`).  I had difficulty getting that test to fail otherwise.\r\n* https://github.com/vimeo/psalm/issues/1537 - I've added a couple of different stubs that are loaded based on the detected PHPUnit version (using basically the same logic that Mockery is using to determine which class to use as the alias). I was able to confirm that the test I added would fail just as my installation of Psalm does without these stubs present (a Fatal Error is thrown during the analyze phase).\r\n\r\nI've also pointed my project to this branch of my fork and confirmed that the issues I was seeing are no longer present with these changes (Mockery 1.x and PHPUnit 6.x).\r\n\r\nI'll add some inline comments to point out the reasoning for some specific changes.","created_at":"2019-04-11T16:58:33Z","updated_at":"2019-04-11T18:01:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3376d197ea046e72b58f3d214533859eae7cfb51","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/2/commits","review_comments_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/2/comments","review_comment_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/issues/2/comments","statuses_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/statuses/19ed07083487b2dfa8a460df88b8c7b00548dc0d","head":{"label":"jaydiablo:add-tests-and-fixes","ref":"add-tests-and-fixes","sha":"19ed07083487b2dfa8a460df88b8c7b00548dc0d","user":{"login":"jaydiablo","id":136907,"node_id":"MDQ6VXNlcjEzNjkwNw==","avatar_url":"https://avatars0.githubusercontent.com/u/136907?v=4","gravatar_id":"","url":"https://api.github.com/users/jaydiablo","html_url":"https://github.com/jaydiablo","followers_url":"https://api.github.com/users/jaydiablo/followers","following_url":"https://api.github.com/users/jaydiablo/following{/other_user}","gists_url":"https://api.github.com/users/jaydiablo/gists{/gist_id}","starred_url":"https://api.github.com/users/jaydiablo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaydiablo/subscriptions","organizations_url":"https://api.github.com/users/jaydiablo/orgs","repos_url":"https://api.github.com/users/jaydiablo/repos","events_url":"https://api.github.com/users/jaydiablo/events{/privacy}","received_events_url":"https://api.github.com/users/jaydiablo/received_events","type":"User","site_admin":false},"repo":{"id":180669433,"node_id":"MDEwOlJlcG9zaXRvcnkxODA2Njk0MzM=","name":"mockery-psalm-plugin","full_name":"jaydiablo/mockery-psalm-plugin","private":false,"owner":{"login":"jaydiablo","id":136907,"node_id":"MDQ6VXNlcjEzNjkwNw==","avatar_url":"https://avatars0.githubusercontent.com/u/136907?v=4","gravatar_id":"","url":"https://api.github.com/users/jaydiablo","html_url":"https://github.com/jaydiablo","followers_url":"https://api.github.com/users/jaydiablo/followers","following_url":"https://api.github.com/users/jaydiablo/following{/other_user}","gists_url":"https://api.github.com/users/jaydiablo/gists{/gist_id}","starred_url":"https://api.github.com/users/jaydiablo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaydiablo/subscriptions","organizations_url":"https://api.github.com/users/jaydiablo/orgs","repos_url":"https://api.github.com/users/jaydiablo/repos","events_url":"https://api.github.com/users/jaydiablo/events{/privacy}","received_events_url":"https://api.github.com/users/jaydiablo/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jaydiablo/mockery-psalm-plugin","description":"A Mockery plugin for Psalm","fork":true,"url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin","forks_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/forks","keys_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/teams","hooks_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/hooks","issue_events_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/events","assignees_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/tags","blobs_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/languages","stargazers_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/stargazers","contributors_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/contributors","subscribers_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/subscribers","subscription_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/subscription","commits_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/merges","archive_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/downloads","issues_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jaydiablo/mockery-psalm-plugin/deployments","created_at":"2019-04-10T21:54:39Z","updated_at":"2019-04-10T21:54:42Z","pushed_at":"2019-04-11T17:24:27Z","git_url":"git://github.com/jaydiablo/mockery-psalm-plugin.git","ssh_url":"git@github.com:jaydiablo/mockery-psalm-plugin.git","clone_url":"https://github.com/jaydiablo/mockery-psalm-plugin.git","svn_url":"https://github.com/jaydiablo/mockery-psalm-plugin","homepage":null,"size":12,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"psalm:master","ref":"master","sha":"c20dd25846fb01c3a8b83c3d4343a5aef1947109","user":{"login":"psalm","id":40830242,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwODMwMjQy","avatar_url":"https://avatars1.githubusercontent.com/u/40830242?v=4","gravatar_id":"","url":"https://api.github.com/users/psalm","html_url":"https://github.com/psalm","followers_url":"https://api.github.com/users/psalm/followers","following_url":"https://api.github.com/users/psalm/following{/other_user}","gists_url":"https://api.github.com/users/psalm/gists{/gist_id}","starred_url":"https://api.github.com/users/psalm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psalm/subscriptions","organizations_url":"https://api.github.com/users/psalm/orgs","repos_url":"https://api.github.com/users/psalm/repos","events_url":"https://api.github.com/users/psalm/events{/privacy}","received_events_url":"https://api.github.com/users/psalm/received_events","type":"Organization","site_admin":false},"repo":{"id":158980956,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg5ODA5NTY=","name":"mockery-psalm-plugin","full_name":"psalm/mockery-psalm-plugin","private":false,"owner":{"login":"psalm","id":40830242,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwODMwMjQy","avatar_url":"https://avatars1.githubusercontent.com/u/40830242?v=4","gravatar_id":"","url":"https://api.github.com/users/psalm","html_url":"https://github.com/psalm","followers_url":"https://api.github.com/users/psalm/followers","following_url":"https://api.github.com/users/psalm/following{/other_user}","gists_url":"https://api.github.com/users/psalm/gists{/gist_id}","starred_url":"https://api.github.com/users/psalm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psalm/subscriptions","organizations_url":"https://api.github.com/users/psalm/orgs","repos_url":"https://api.github.com/users/psalm/repos","events_url":"https://api.github.com/users/psalm/events{/privacy}","received_events_url":"https://api.github.com/users/psalm/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/psalm/mockery-psalm-plugin","description":"A Mockery plugin for Psalm","fork":false,"url":"https://api.github.com/repos/psalm/mockery-psalm-plugin","forks_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/forks","keys_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/teams","hooks_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/hooks","issue_events_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/events","assignees_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/tags","blobs_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/languages","stargazers_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/stargazers","contributors_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/contributors","subscribers_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/subscribers","subscription_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/subscription","commits_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/merges","archive_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/downloads","issues_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/labels{/name}","releases_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/psalm/mockery-psalm-plugin/deployments","created_at":"2018-11-24T23:07:50Z","updated_at":"2019-02-06T10:40:10Z","pushed_at":"2019-04-11T17:24:29Z","git_url":"git://github.com/psalm/mockery-psalm-plugin.git","ssh_url":"git@github.com:psalm/mockery-psalm-plugin.git","clone_url":"https://github.com/psalm/mockery-psalm-plugin.git","svn_url":"https://github.com/psalm/mockery-psalm-plugin","homepage":null,"size":5,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/2"},"html":{"href":"https://github.com/psalm/mockery-psalm-plugin/pull/2"},"issue":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/issues/2"},"comments":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/psalm/mockery-psalm-plugin/statuses/19ed07083487b2dfa8a460df88b8c7b00548dc0d"}},"author_association":"NONE"}}
{"actor":{"display_login":"weirdan"}}