Skip to content

Commit

Permalink
build: check exceptions with phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
n-peugnet committed Jul 25, 2024
1 parent c3aa041 commit fced5a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ check: analyse test
composer validate

analyse: vendor
vendor/bin/phpstan analyse src --level 9 $(PHPSTANFLAGS)
vendor/bin/phpstan analyse src --level 9 --configuration src/phpstan.neon $(PHPSTANFLAGS)
vendor/bin/phpstan analyse tests --level 5 $(PHPSTANFLAGS)

test: vendor tests/data
Expand Down
2 changes: 2 additions & 0 deletions src/SphinxInventoryParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public function parseHeader(): SphinxInventoryHeader {
}

/**
* @throws UnexpectedValueException
* @ignore
*/
protected function parseHeaderV2(SphinxInventoryHeader $header): SphinxInventoryHeader {
Expand Down Expand Up @@ -211,6 +212,7 @@ public function parseObjects(SphinxInventoryHeader $header, string $baseURI = ''

/**
* @return Generator&iterable<int,SphinxObject>
* @throws UnexpectedValueException
* @ignore
*/
protected function parseObjectsV2(string $baseURI): Generator {
Expand Down
7 changes: 7 additions & 0 deletions src/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
exceptions:
check:
missingCheckedExceptionInThrows: true
tooWideThrowType: true
uncheckedExceptionClasses:
- 'LogicException'

0 comments on commit fced5a9

Please sign in to comment.