Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutation coverage improvements #1090

Merged
merged 2 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PHP_CS_FIXER_BIN := ./vendor/bin/php-cs-fixer
PHPSTAN_BIN := ./vendor/bin/phpstan
PSALM_BIN := ./vendor/bin/psalm
PHPUNIT_BIN := ./vendor/bin/phpunit
INFECTION_BIN := ./vendor/bin/infection
INFECTION_BIN := ./vendor/bin/roave-infection-static-analysis-plugin

.PHONY: build composer-install tests tests-coverage gpg php-cs-check php-cs-fix phpstan

Expand Down Expand Up @@ -38,7 +38,7 @@ psalm:
$(PSALM_BIN)

infection: composer-install
$(INFECTION_BIN) --threads=$(shell nproc || sysctl -n hw.ncpu || 1) --test-framework-options='--testsuite=Tests' --only-covered --min-msi=80
$(INFECTION_BIN) --threads=$(shell nproc || sysctl -n hw.ncpu || 1) --test-framework-options='--testsuite=Tests' --only-covered --min-msi=85 --psalm-config=psalm.xml

gpg:
gpg --detach-sign --armor --default-key 41DDE07547459FAECFA17813B8F640134AB1782E --output deptrac.phar.asc deptrac.phar
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"phpstan/phpstan": "^1.6.8",
"phpstan/phpstan-symfony": "^1.1",
"phpunit/phpunit": "^9.5",
"roave/infection-static-analysis-plugin": "^1.28",
"vimeo/psalm": "^4.22"
}
}
188 changes: 114 additions & 74 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 20 additions & 11 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
{
"timeout": 10,
"source": {
"directories": [
"src"
]
"timeout": 10,
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "infection.log"
},
"mutators": {
"@default": true,
"FunctionCallRemoval": {
"ignoreSourceCodeByRegex": [
"trigger_deprecation.*"
]
},
"logs": {
"text": "infection.log"
},
"mutators": {
"@default": true
}
"global-ignoreSourceCodeByRegex": [
"\\$output->writeLineFormatted.*"
],
"CatchBlockRemoval": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class ClassLikeReferenceBuilder extends ReferenceBuilder
/**
* @param string[] $tokenTemplates
*/
protected function __construct(
private function __construct(
array $tokenTemplates,
string $filepath,
private readonly ClassLikeToken $classLikeToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FunctionLikeReferenceBuilder extends ReferenceBuilder
/**
* @param string[] $tokenTemplates
*/
protected function __construct(array $tokenTemplates, string $filepath, private readonly string $functionName)
private function __construct(array $tokenTemplates, string $filepath, private readonly string $functionName)
{
parent::__construct($tokenTemplates, $filepath);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Ast/Parser/TypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function resolvePHPStanDocParserType(TypeNode $type, TypeScope $typeScope
/**
* @return string[]
*/
public function resolveString(string $type, TypeScope $nameScope): array
protected function resolveString(string $type, TypeScope $nameScope): array
{
$context = new Context($nameScope->namespace, $nameScope->getUses());
try {
Expand Down
2 changes: 1 addition & 1 deletion src/Supportive/OutputFormatter/BaselineOutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function finish(
}

/**
* @return array<string,array<string>>
* @return array<string,list<string>>
*/
private function collectViolations(LegacyResult $result): array
{
Expand Down