Skip to content

Add alias for PHPStan #789

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

Closed
wants to merge 3 commits into from
Closed

Add alias for PHPStan #789

wants to merge 3 commits into from

Conversation

felipesantos2
Copy link

Add alias for PHPStan.

Add alias for PHPStan to facilitate its execution inside the container

@taylorotwell
Copy link
Member

Why these particular command line options?

@taylorotwell taylorotwell marked this pull request as draft April 23, 2025 13:02
@felipesantos2
Copy link
Author

It seems to me that most people use this type of tool at some level and adding it would be a great help

@rojtjo
Copy link
Contributor

rojtjo commented Apr 23, 2025

By using the --generate-baseline flag you're basically ignoring all errors PHPStan finds so using it by default doesn't seem like a good choice.

Also, since analyse is the default command it can be omitted most of the times so you could just run PHPStan using the bin command: sail bin phpstan

@felipesantos2
Copy link
Author

felipesantos2 commented Apr 23, 2025

Is also a good option. in this case I added --baseline because the log file is generated unchanged with all the information for an eventual correction.

The idea is to generate the '--baseline' in a very simplified way

@rojtjo
Copy link
Contributor

rojtjo commented Apr 23, 2025

Yeah, but you typically only generate a baseline when you set up your PHPStan integration, not on every run.

Default run without the --generate-baseline flag shows us all the errors we need to fix:
image

With the --generate-baseline flag writes all errors to the baseline file and ignores them on the next run without the flag:
image

@felipesantos2
Copy link
Author

felipesantos2 commented Apr 23, 2025

Nice! So there's no need to generate the --baseline, we can let people define the directory to be analyzed directly in the cli.

It could look like this:

  1. sail phpstan dir/
  2. sail phpstan dir/ --level=max

@felipesantos2 felipesantos2 marked this pull request as ready for review April 23, 2025 22:18
@taylorotwell
Copy link
Member

Do we even need to assume the analyse command? Can we just let people pass the command they want?

@felipesantos2
Copy link
Author

I don't think we'll have any problems with the analyze. If what is passed after it really exists, it will work.

  1. image
  2. image

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 this pull request may close these issues.

3 participants