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

Error with new rule checkUnusedViews on Windows #1487

Closed
rcerljenko opened this issue Dec 23, 2022 · 5 comments · Fixed by #1488
Closed

Error with new rule checkUnusedViews on Windows #1487

rcerljenko opened this issue Dec 23, 2022 · 5 comments · Fixed by #1488

Comments

@rcerljenko
Copy link
Contributor

  • Larastan Version: 2.3.0
  • --level used: 6

Description

After updating to v2.3 and enabling rule checkUnusedViews this happens:

In ViewFileHelper.php line 70:

Undefined array key 1

Laravel code where the issue was found

This is from your code that's reported above:

if (str_contains($view->getPathname(), 'views/vendor')) {
       continue;
 }

$viewName = explode($viewDirectory.'/', $view->getPathname());

yield str_replace(['/', '.blade.php'], ['.', ''], $viewName[1]); // THIS IS LINE 70
@rcerljenko
Copy link
Contributor Author

rcerljenko commented Dec 23, 2022

mybe it has something to do with windows - different directory separator => DIRECTORY_SEPARATOR constant

@rcerljenko
Copy link
Contributor Author

yep.. just tried it with that constant and it worked... should i provide a PR for that?

@canvural
Copy link
Collaborator

yep.. just tried it with that constant and it worked... should i provide a PR for that?

Yes please.

@rcerljenko
Copy link
Contributor Author

here it is @canvural #1488

canvural pushed a commit that referenced this issue Dec 23, 2022
@szepeviktor szepeviktor changed the title Error with new rule checkUnusedViews Error with new rule checkUnusedViews on Windows Dec 23, 2022
@canvural
Copy link
Collaborator

Released in https://github.com/nunomaduro/larastan/releases/tag/2.3.1 Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants