Skip to content
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

phpstan internal error in console Method newEloquentBuilder() was not found #808

Closed
expondo opened this issue Mar 23, 2023 · 10 comments · Fixed by #848
Closed

phpstan internal error in console Method newEloquentBuilder() was not found #808

expondo opened this issue Mar 23, 2023 · 10 comments · Fixed by #848
Labels
enhancement An improvement or new feature help wanted Assistance or contributions needed

Comments

@expondo
Copy link

expondo commented Mar 23, 2023

Q A
Bug? no
New Feature? yes
Framework Laravel
Framework version 952.4
Package version 13.5.0
PHP version 8.1
phpstan/phpstan 1.10.6

Actual Behaviour

When i use Audit::query or SomeModel->audits()->where() then phpstan throwin exception
` Error


 Internal error: Internal error: Method newEloquentBuilder() was not found in reflection of class OwenIt\Auditing\Contracts\Audit. in file AuditService.php
 Run PHPStan with -v option and post the stack trace to:
 https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md
 Child process error (exit code 1):

`
this happen after last release with change model to contract: release diff

Expected Behaviour

Phpstan has no warning when use builder on Audit model

Steps to Reproduce

List all the steps needed to reproduce the issue you're having.

Make sure to include code (affected models, configuration, ...).

Pastebins, screenshots and/or other resources that may help us understand what's going on, will also be appreciated.

In a nutshell, help us, help you.

Possible Solutions

AuditContract should be reveiwed.

@MortenDHansen MortenDHansen added enhancement An improvement or new feature help wanted Assistance or contributions needed labels Mar 23, 2023
@expondo
Copy link
Author

expondo commented Mar 23, 2023

Thanks @parallels999 ,
I replied under #807 because I see, that there is some problem still not fixed.

@MortenDHansen
Copy link
Contributor

Well, phpstan was never a part of the workflow, so i have no idea. Im gonna need to add phpstan to our pipeline. Until then i have no idea what was fixed. Its not an issue i would ever see 🤷

@erikn69
Copy link
Contributor

erikn69 commented Mar 23, 2023

@expondo try #809

@expondo
Copy link
Author

expondo commented Mar 23, 2023

@parallels999 not yet.
@erikn69 I can check it tomorrow.

@expondo
Copy link
Author

expondo commented Mar 24, 2023

@erikn69
@MortenDHansen
in my case, this code makes phpstan happy
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<\OwenIt\Auditing\Models\Audit> */ public function audits(): MorphMany;

@fgibaux
Copy link

fgibaux commented Apr 26, 2023

in my code, I use $model->audits()->... method and I'm getting the internal error using this package v13.5.0.
when using dev-master, (so with #807), it removes the phpstan internal error but I get normal errors instead:

         Class OwenIt\Auditing\Contracts\OwenIt\Auditing\Contracts\Audit was not found while trying to analyse it - discovering symbols is probably not configured properly.  
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                                                                                  
  17     Class OwenIt\Auditing\Contracts\OwenIt\Auditing\Contracts\Audit was not found while trying to analyse it - discovering symbols is probably not configured properly.  
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                                                                                  
  17     Class OwenIt\Auditing\Contracts\OwenIt\Auditing\Contracts\Audit was not found while trying to analyse it - discovering symbols is probably not configured properly.  
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols      

I have phpstan v1.10.14, PHP 8.1, Laravel 10.9

@parallels999
Copy link

@fgibaux try dev branch

"branch-alias": {
"dev-master": "v14-dev"
},

@fgibaux
Copy link

fgibaux commented Apr 26, 2023

@parallels999 ah thank you! it works without errors when using v14-dev

@parallels999
Copy link

@fgibaux the new version will be released very soon with corrections and performance improvements

@stefro
Copy link

stefro commented Sep 6, 2023

First of all: Thanks for fixing this! 💪🔥
But it has been a while and there is still no release of these changes yet. Does anyone have an idea when this will be released?
The current release at the time of writing is 13.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement or new feature help wanted Assistance or contributions needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants