Skip to content

Commit

Permalink
Merge pull request #8883 from weirdan/unused-messages-duplicates
Browse files Browse the repository at this point in the history
Fixes #8874
  • Loading branch information
weirdan committed Dec 11, 2022
2 parents 114552f + 32eaf12 commit ca0b2a1
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Psalm/Internal/Codebase/ClassLikes.php
Expand Up @@ -2144,7 +2144,8 @@ private function checkPropertyReferences(ClassLikeStorage $classlike_storage): v
'Cannot find ' . ($has_variable_calls ? 'explicit' : 'any')
. ' references to property ' . $property_id
. ($has_variable_calls ? ' (but did find some potential references)' : ''),
$property_storage->location
$property_storage->location,
$property_id
);

if ($codebase->alter_code) {
Expand Down Expand Up @@ -2173,7 +2174,8 @@ private function checkPropertyReferences(ClassLikeStorage $classlike_storage): v
'Cannot find ' . ($has_variable_calls ? 'explicit' : 'any')
. ' references to private property ' . $property_id
. ($has_variable_calls ? ' (but did find some potential references)' : ''),
$property_storage->location
$property_storage->location,
$property_id
);

if ($codebase->alter_code) {
Expand Down
13 changes: 13 additions & 0 deletions src/Psalm/Issue/PossiblyUnusedMethod.php
Expand Up @@ -2,8 +2,21 @@

namespace Psalm\Issue;

use Psalm\CodeLocation;

use function strtolower;

final class PossiblyUnusedMethod extends MethodIssue
{
public const ERROR_LEVEL = -2;
public const SHORTCODE = 87;

public function __construct(
string $message,
CodeLocation $code_location,
string $method_id
) {
parent::__construct($message, $code_location, $method_id);
$this->dupe_key = strtolower($method_id);
}
}
13 changes: 12 additions & 1 deletion src/Psalm/Issue/PossiblyUnusedProperty.php
Expand Up @@ -2,8 +2,19 @@

namespace Psalm\Issue;

final class PossiblyUnusedProperty extends CodeIssue
use Psalm\CodeLocation;

final class PossiblyUnusedProperty extends PropertyIssue
{
public const ERROR_LEVEL = -2;
public const SHORTCODE = 149;

public function __construct(
string $message,
CodeLocation $code_location,
string $property_id
) {
parent::__construct($message, $code_location, $property_id);
$this->dupe_key = $property_id;
}
}
13 changes: 13 additions & 0 deletions src/Psalm/Issue/UnusedMethod.php
Expand Up @@ -2,8 +2,21 @@

namespace Psalm\Issue;

use Psalm\CodeLocation;

use function strtolower;

final class UnusedMethod extends MethodIssue
{
public const ERROR_LEVEL = -2;
public const SHORTCODE = 76;

public function __construct(
string $message,
CodeLocation $code_location,
string $method_id
) {
parent::__construct($message, $code_location, $method_id);
$this->dupe_key = strtolower($method_id);
}
}
13 changes: 12 additions & 1 deletion src/Psalm/Issue/UnusedProperty.php
Expand Up @@ -2,8 +2,19 @@

namespace Psalm\Issue;

final class UnusedProperty extends CodeIssue
use Psalm\CodeLocation;

final class UnusedProperty extends PropertyIssue
{
public const ERROR_LEVEL = -2;
public const SHORTCODE = 150;

public function __construct(
string $message,
CodeLocation $code_location,
string $property_id
) {
parent::__construct($message, $code_location, $property_id);
$this->dupe_key = $property_id;
}
}

0 comments on commit ca0b2a1

Please sign in to comment.