[Bug]: Typings for Arch tests seems to be off
What Happened
Preset doesn't seem to be available, Phpstan doesn't like that either:
The tests work correctly though.
How to Reproduce
- Add a testfile named Arch.php
- Add the following contents:
<?php
/**
* PHP Preset
*/
arch()
->preset()
->php();
- Notice the errors above in Phpstorm
Sample Repository
No response
Pest Version
3.0.6
PHP Version
8.3.x
Operation System
macOS
Notes
Using the latest Phpstorm
It's certainly nullable, Check here => https://github.com/pestphp/pest-plugin-arch/blob/0a27e55a270cfe73d8cb70551b91002ee2cb64b0/src/Autoload.php#L18
Also in my PhpStorm:
You probably need to composer update, or restart PhpStorm.
It's always a good idea to check the code in the repo before placing a bug report. You can click that little pencil icon and it will jump to the source code for you to look at.
@CamKem Ah, my bad. Switched branches but didn't ran composer install again. The other issue still persists though.
@CamKem Ah, my bad. Switched branches but didn't ran
composer installagain. The other issue still persists though.
You are correct, the TestCall needs to be updated to @mixin the place the preset method is stored or reference a @method for preset. I'm going to do a PR tomorrow for it.
This was closed by commit 7cd42aafd805a02526424428e4f1ad248d2ef327.
I still have this issue even with this mentioned commit...
Seems like this has been fixed, I am also not able to reproduce it.
If it is still an issue, don't hesitate to write and I'll re-open.
@olivermybroe This still seems to be an issue for me. It looks like phpstan does not parse union types separated by pipe |. It looks like it works correctly if they are split into a separate @mixin tag each:
src/PendingCalls/TestCall.php:
/**
* @internal
*
* @mixin HigherOrderCallables
* @mixin TestCase
* @mixin Testable
*/
PHP
8.3.26
Pest
4.1.0
PHPStan
2.1.31
Operating System
Ubuntu
Test case
Same as above
@biinari could you open a new issue about that? This issue was specifically about typings showing up wrongly in PHPStorm not about PHPStan, thanks!
Ah my mistake, I skimmed straight past this being about PHPStorm originally. I'll open a new issue.
Side note: it's a shame neither PHPStorm nor PHPStan seems to document what they support for multiple mixins on the same class.
Yeah, the problem is phpdocs doesn't really have a proper standard to them. So it's kinda what the tools wanna do themselves.