You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 is 2:
Example without option --output-format all new errors are SHOWN in the console and Psalm exit code is 2:
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 enablecomplete unused code detection.
ERROR: InvalidReturnType - src/Kernel.php:43:36 - The declared returntype'int'for App\Kernel::getCacheDir is incorrect, got 'non-falsy-string' (see https://psalm.dev/011)
public functiongetCacheDir(): int
ERROR: InvalidReturnStatement - src/Kernel.php:45:16 - The inferred type'non-falsy-string' does not match the declared returntype'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 codebase
The text was updated successfully, but these errors were encountered:
Hey @andrey-tech, can you reproduce the issue on https://psalm.dev? These will be used as phpunit tests when implementing the feature or fixing this bug.
76// If we're at the end of the issue sets, then wrap up the last table and render it out.77if ($i === count($this->issues_data) - 1) {
78$table->render();
79$output[] = $buffer->fetch();
80 }
The condition inside this if will never be true if array $this->issues_data has non-sequential integer keys, so $table->render() will not be executed.
For example, if baseline file is used, then $this->issues_data is:
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
--output-format=compact
— new errors are NOT SHOWN in the console, but Psalm exit code is2
:--output-format
all new errors are SHOWN in the console and Psalm exit code is2
:The text was updated successfully, but these errors were encountered: