Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stronk7/doc_block_type_contradiction_phpunit
To show some strange (for me) behaviour of PSalm and some simple PHPUnit assertions
https://github.com/stronk7/doc_block_type_contradiction_phpunit
Last synced: 3 days ago
JSON representation
To show some strange (for me) behaviour of PSalm and some simple PHPUnit assertions
- Host: GitHub
- URL: https://github.com/stronk7/doc_block_type_contradiction_phpunit
- Owner: stronk7
- Created: 2024-03-09T15:43:25.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-09T15:51:04.000Z (8 months ago)
- Last Synced: 2024-10-11T03:21:56.650Z (26 days ago)
- Language: PHP
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# doc_block_type_contradiction_phpunit
To show some strange (for me) behaviour of PSalm and some simple PHPUnit assertionsTo reproduce:
```
composer install
vendor/bin/phpunit test.php # Passes.
vendor/bin/psalm # Fails (various)
```Complete output of `vendor/bin/psalm`:
```
Target PHP version: 8.3 (inferred from current PHP version).
Scanning files...
Analyzing files...ERROR: DocblockTypeContradiction - test.php:17:16 - Docblock-defined type 0 for $progressBar->getprogress() is never =int(1) (see https://psalm.dev/155)
$this->assertSame(1, $progressBar->getProgress());ERROR: DocblockTypeContradiction - test.php:20:16 - Docblock-defined type never for $progressBar->getprogress() is never =int(2) (see https://psalm.dev/155)
$this->assertSame(2, $progressBar->getProgress());ERROR: UnevaluatedCode - test.php:22:9 - Expressions after return/throw/continue (see https://psalm.dev/084)
$progressBar->finish();ERROR: UnevaluatedCode - test.php:23:9 - Expressions after return/throw/continue (see https://psalm.dev/084)
$this->assertSame(5, $progressBar->getProgress());------------------------------
4 errors found
------------------------------Checks took 0.02 seconds and used 2.231MB of memory
No files analyzed
Psalm was able to infer types for 100% of the codebase