Skip to content

Commit

Permalink
Configuring Psalm to find unused code by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Feb 8, 2024
1 parent 71f3c16 commit 0a26835
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions bin/roave-infection-static-analysis-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use function var_export;
));
})();

require_once $projectPath . '/vendor/autoload.php';
require_once __DIR__ . '/../vendor/autoload.php';

if (! defined('PSALM_VERSION')) {
define('PSALM_VERSION', InstalledVersions::getVersion('vimeo/psalm'));
Expand All @@ -65,7 +65,7 @@ use function var_export;

RuntimeCaches::clearAll();

$configuration = $configuration ?? $projectPath;
$configuration ??= $projectPath;

if (is_file($configuration)) {
$config = Config::loadFromXMLFile($configuration, $projectPath);
Expand Down
12 changes: 7 additions & 5 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
name="Example Psalm config with recommended defaults"
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<directory name="bin"/>
<file name="bin/roave-infection-static-analysis-plugin"/>
<directory name="src"/>
<directory name="test/unit"/>
<ignoreFiles>
Expand Down Expand Up @@ -63,11 +65,11 @@
</errorLevel>
</PropertyNotSetInConstructor>

<!-- composer/package-versions-deprecated is in use by design -->
<DeprecatedClass>
<!-- phpunit tests are entry points - they are generally unused -->
<UnusedClass>
<errorLevel type="suppress">
<referencedClass name="PackageVersions\Versions"/>
<directory name="test"/>
</errorLevel>
</DeprecatedClass>
</UnusedClass>
</issueHandlers>
</psalm>
6 changes: 1 addition & 5 deletions src/Roave/InfectionStaticAnalysis/CliUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@
use function substr;

/** @internal */
final class CliUtility
abstract class CliUtility
{
private function __construct()
{
}

/**
* @param list<non-empty-string> $arguments
* @param non-empty-string $argument
Expand Down

0 comments on commit 0a26835

Please sign in to comment.