You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm less concerned with the type errors, and more about the lack of completion of the proxied object.
expect($user)-> will provide completion for methods on the Pest\Expectation object, but nothing from the $user, which makes it possible to introduce failing tests because typos, for example, will lead to an assertion on null.
We certainly get the @template annotations for the generics, etc., but to no avail.
I've tried making the change as in the linked PR (#1168), but that doesn't seem to yield the expected outcome.
I'm not sure how exactly to remedy this situation, or if it's possible. Or if this is just something in my setup, though one of my colleagues has suggested he also has no completion in PhpStorm (and seems to make it chug, at that).
What Happened
With using a mixed-in expectation object, method chaining results in IDE type errors:
pest/src/Mixins/Expectation.php
Line 60 in b33af71
Suggested fix:
Changing the PHPDoc return type to
$this
seems to be a better solution to avoid these IDE type errors.How to Reproduce
The suggested fix above solves the problem:
Sample Repository
No response
Pest Version
2.x-dev
PHP Version
8.2.15
Operation System
Linux
Notes
pestphp/pest-plugin version is v2.1.1
The text was updated successfully, but these errors were encountered: