Setup PHPStan#1922
Conversation
| message: '#^Variable \$version might not be defined\.$#' | ||
| identifier: variable.undefined | ||
| count: 1 | ||
| path: include/download-instructions/linux-debian-cli-community.php | ||
|
|
||
| - | ||
| message: '#^Variable \$version might not be defined\.$#' | ||
| identifier: variable.undefined | ||
| count: 1 | ||
| path: include/download-instructions/linux-debian-web-community.php |
There was a problem hiding this comment.
one way to get rid of these errors in the future would be declaring variables expected to be passed in from global scope via
<?php
/** @var string $version */
?>at the top of the files.
alternatively a more aggressive approach could be asserting the variables instead of just making the tooling aware of it using e.g.
<?php
assert(isset($version) && is_string($version));
?>| parameters: | ||
| level: 3 | ||
| paths: | ||
| - . | ||
| fileExtensions: | ||
| - php | ||
| - inc | ||
|
|
||
| excludePaths: | ||
| analyse: | ||
| - vendor/ |
There was a problem hiding this comment.
after getting more used to the project structure I think for now its best to scan all php files, but exclude only the vendor/. that way we don't miss anything.
initially I configured to only scan certain folders, but this would e.g. miss .php files in the repo root.
this may be fine tuned in future PRs of course
|
I'd be glad to have phpstan in, although FWIW as I'm rewriting pretty much everything I am aiming for level 8. |
|
having it more strict is great to have. but for a start and for all these legacy scripts we need to start somewhere :) |
adding a minimal PHPStan setup. this is the starting point so iterating on the PHPStan level can be achieved in future PRs.
as requested in #892 (comment)