mirror of
https://github.com/danog/psalm-plugin-symfony.git
synced 2024-12-02 09:27:46 +01:00
[psalm] detect dead code & unused suppresses (#51)
This commit is contained in:
parent
b9f4745e28
commit
ec7545a086
2
.github/workflows/integrate.yaml
vendored
2
.github/workflows/integrate.yaml
vendored
@ -55,7 +55,7 @@ jobs:
|
|||||||
restore-keys: php-${{ matrix.php-version }}-psalm-
|
restore-keys: php-${{ matrix.php-version }}-psalm-
|
||||||
|
|
||||||
- name: "Run vimeo/psalm"
|
- name: "Run vimeo/psalm"
|
||||||
run: vendor/bin/psalm --config=psalm.xml --diff --diff-methods --shepherd --show-info=false --stats --output-format=github
|
run: vendor/bin/psalm --find-dead-code --find-unused-psalm-suppress --diff --diff-methods --shepherd --show-info=false --stats --output-format=github
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
name: "Tests"
|
name: "Tests"
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
"@phpunit",
|
"@phpunit",
|
||||||
"@codeception"
|
"@codeception"
|
||||||
],
|
],
|
||||||
"analyze": "psalm",
|
"analyze": "psalm --find-dead-code --find-unused-psalm-suppress --long-progress",
|
||||||
"phpunit": "phpunit --testdox",
|
"phpunit": "phpunit --testdox",
|
||||||
"codeception": [
|
"codeception": [
|
||||||
"codecept build",
|
"codecept build",
|
||||||
|
@ -51,7 +51,6 @@ class ConsoleHandler implements AfterMethodCallAnalysisInterface
|
|||||||
) {
|
) {
|
||||||
switch ($declaring_method_id) {
|
switch ($declaring_method_id) {
|
||||||
case 'Symfony\Component\Console\Command\Command::addargument':
|
case 'Symfony\Component\Console\Command\Command::addargument':
|
||||||
/** @psalm-suppress PossiblyInvalidArgument */
|
|
||||||
self::analyseArgument($expr->args, $statements_source);
|
self::analyseArgument($expr->args, $statements_source);
|
||||||
break;
|
break;
|
||||||
case 'Symfony\Component\Console\Input\InputInterface::getargument':
|
case 'Symfony\Component\Console\Input\InputInterface::getargument':
|
||||||
@ -65,7 +64,6 @@ class ConsoleHandler implements AfterMethodCallAnalysisInterface
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Symfony\Component\Console\Command\Command::addoption':
|
case 'Symfony\Component\Console\Command\Command::addoption':
|
||||||
/** @psalm-suppress PossiblyInvalidArgument */
|
|
||||||
self::analyseOption($expr->args, $statements_source);
|
self::analyseOption($expr->args, $statements_source);
|
||||||
break;
|
break;
|
||||||
case 'Symfony\Component\Console\Input\InputInterface::getoption':
|
case 'Symfony\Component\Console\Input\InputInterface::getoption':
|
||||||
|
@ -90,7 +90,6 @@ class ContainerHandler implements AfterMethodCallAnalysisInterface, AfterClassLi
|
|||||||
if ($service->isPublic()) {
|
if ($service->isPublic()) {
|
||||||
$class = $service->getClassName();
|
$class = $service->getClassName();
|
||||||
if ($class) {
|
if ($class) {
|
||||||
/** @psalm-suppress InternalMethod */
|
|
||||||
$codebase->classlikes->addFullyQualifiedClassName($class);
|
$codebase->classlikes->addFullyQualifiedClassName($class);
|
||||||
$return_type_candidate = new Union([new TNamedObject($class)]);
|
$return_type_candidate = new Union([new TNamedObject($class)]);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@ use Psalm\SymfonyPsalmPlugin\Handler\HeaderBagHandler;
|
|||||||
use Psalm\SymfonyPsalmPlugin\Symfony\ContainerMeta;
|
use Psalm\SymfonyPsalmPlugin\Symfony\ContainerMeta;
|
||||||
use SimpleXMLElement;
|
use SimpleXMLElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @psalm-suppress UnusedClass
|
||||||
|
*/
|
||||||
class Plugin implements PluginEntryPointInterface
|
class Plugin implements PluginEntryPointInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user