-
Notifications
You must be signed in to change notification settings - Fork 144
Add static type analysis with PHPStan #227
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
Conversation
2856cc0
to
a58fdcb
Compare
Marking as draft again. I think we should start with level 0 first (so that the baseline file is more manageable), and work our way up through the levels. I'd also like to add this to the CI build. |
Feel free to do this. Let the PR CI fail until all code is up to standards. |
Even better: With the baseline file, the build will pass with the code as-is, while we still prevent the introduction of new typing issues. Neat, isn't it? |
c99f706
to
e4e3c47
Compare
316a3a2
to
2b35cd4
Compare
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Class Sabberworm\\\\CSS\\\\Parsing\\\\ParserState constructor invoked with 1 parameter, 2\\-3 required\\.$#" | ||
count: 1 | ||
path: lib/Sabberworm/CSS/CSSList/CSSList.php | ||
|
||
- | ||
message: "#^Access to an undefined property Sabberworm\\\\CSS\\\\Parsing\\\\ParserState\\:\\:\\$oParserHelper\\.$#" | ||
count: 1 | ||
path: lib/Sabberworm/CSS/Parsing/ParserState.php | ||
|
||
- | ||
message: "#^Access to an undefined property Sabberworm\\\\CSS\\\\Property\\\\Charset\\:\\:\\$aComments\\.$#" | ||
count: 5 | ||
path: lib/Sabberworm/CSS/Property/Charset.php | ||
|
||
- | ||
message: "#^Class PHPUnit\\\\Framework\\\\TestCase referenced with incorrect case\\: PHPunit\\\\Framework\\\\TestCase\\.$#" | ||
count: 1 | ||
path: tests/Sabberworm/CSS/OutputFormatTest.php | ||
|
||
- | ||
message: "#^Class PHPUnit\\\\Framework\\\\TestCase referenced with incorrect case\\: PHPunit\\\\Framework\\\\TestCase\\.$#" | ||
count: 1 | ||
path: tests/Sabberworm/CSS/ParserTest.php | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I thought there’d be more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's also because we're starting at level 0. 😄 (The PHPStan levels go up to level 8 …)
phpstan.neon
Outdated
@@ -0,0 +1,16 @@ | |||
includes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we name this phpstan.neon.dist
as per https://phpstan.org/config-reference#config-file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Changed, rebased and repushed.
2b35cd4
to
81a63ad
Compare
Add Composer scripts for checking the code with PHPStan (while using a baseline) and for updating the baseline. When we fix PHPStan-reported issues (or update the PHPStan configuration), we can update the baseline bit by bit until all issues are fixed.
81a63ad
to
06044b9
Compare
Add Composer scripts for checking the code with PHPStan (while using
a baseline) and for updating the baseline.
When we fix PHPStan-reported issues (or update the PHPStan configuration),
we can update the baseline bit by bit until all issues are fixed.