New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Added CreatesApplication strict typing #1626
fix: Added CreatesApplication strict typing #1626
Conversation
Thanks, but E2E isn't failing because of this (which actually I'm not sure what it is TBH). It's failing because I don't have time yet to adapt it to the vue 3 rewrite. |
Hi, thank you for your reply. Maybe we misunderstood each other - E2E tests of larastan are failing and it has nothing to do with vue 3 rewrite: https://github.com/nunomaduro/larastan/actions/runs/3684486433/jobs/6234278865 My change in this MR fixes this error:
This error is introduced with change in larastan - dynamic extension which makes phpstan understand return type of It is clear that the code in private Kernel $artisan;
$this->artisan = $app->make(Artisan::class); Adding assertion there, makes 100% sure (and phpstan understands) that $artisan = $app->make(Artisan::class);
assert($artisan instanceof Kernel);
$this->artisan = $artisan; I tested everything locally and it works very well. Can we please reopen and re-consider this MR? Thank you. |
Other possible solution (and maybe more readable) would be to do this: - $this->artisan = $app->make(Artisan::class);
+ $this->artisan = $app->make(Kernel::class); But honestly i did not know what (and if any) was intention of getting |
In such a case, wouldn't it be simpler to use type-hinting instead? /** @var Kernel $artisan */
$artisan = $app->make(Artisan::class); |
👍 This is alternative, as well possible way |
…which I'd prefer, because it doesn't cost anything :) Would you mind revising the PR accordingly? |
Codecov Report
@@ Coverage Diff @@
## master #1626 +/- ##
=========================================
Coverage 81.50% 81.50%
Complexity 654 654
=========================================
Files 151 151
Lines 1757 1757
=========================================
Hits 1432 1432
Misses 325 325 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Updated. Thank you for being open for this kind of improvements. |
All good, thanks a lot! |
See larastan/larastan#1451 (comment)