-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Description
Hi!
I have a problem with Psalm v5.23.1 and PHP 8.1: new errors are NOT SHOWN in the console if I use baseline file and output-format=compact (other output formats - OK). Please check and fix!
Description
- Example with option
--output-format=compact— new errors are NOT SHOWN in the console, but Psalm exit code is2:
vendor/bin/psalm --config=psalm.xml.dist --output-format=compact --use-baseline=psalm-baseline.xml src/Kernel.php
Target PHP version: 8.1 (set by config file) Enabled extensions: dom, mongodb, pdo, simplexml, soap (unsupported extensions: fileinfo, zend-opcache).
Scanning files...
Analyzing files...
░
FILE: src/Kernel.php- Example without option
--output-formatall new errors are SHOWN in the console and Psalm exit code is2:
vendor/bin/psalm --config=psalm.xml.dist --use-baseline=psalm-baseline.xml src/Kernel.php
Target PHP version: 8.1 (set by config file) Enabled extensions: dom, mongodb, pdo, simplexml, soap (unsupported extensions: fileinfo, zend-opcache).
Scanning files...
Analyzing files...
░
To whom it may concern: Psalm cannot detect unused classes, methods and properties
when analyzing individual files and folders. Run on the full project to enable
complete unused code detection.
ERROR: InvalidReturnType - src/Kernel.php:43:36 - The declared return type 'int' for App\Kernel::getCacheDir is incorrect, got 'non-falsy-string' (see https://psalm.dev/011)
public function getCacheDir(): int
ERROR: InvalidReturnStatement - src/Kernel.php:45:16 - The inferred type 'non-falsy-string' does not match the declared return type 'int' for App\Kernel::getCacheDir (see https://psalm.dev/128)
return '/tmp/cache/' . $this->environment;
------------------------------
2 errors found
------------------------------
10 other issues found.
You can display them with --show-info=true
------------------------------
Psalm can automatically fix 1 of these issues.
Run Psalm again with
--alter --issues=InvalidReturnType --dry-run
to see what it can fix.
------------------------------
Checks took 2.58 seconds and used 227.321MB of memory
Psalm was able to infer types for 90.6667% of the codebaseReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels