Skip to content

Commit e3396aa

Browse files
committed
Fixes
1 parent 97e5a07 commit e3396aa

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public function __construct(
4141
private readonly Namespace_ $namespace,
4242
/**
4343
* @var FileAnalyzer
44-
* @psalm-suppress NonInvariantDocblockPropertyType
4544
*/
4645
protected SourceAnalyzer $source,
4746
) {

src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ private static function hasGetClassCheck(
14651465
&& strtolower($conditional->right->name->name) === 'class';
14661466

14671467
$right_variable_class_const = $conditional->right instanceof PhpParser\Node\Expr\ClassConstFetch
1468-
&& $conditional->right->class instanceof PhpParser\Node\Expr\Variable
1468+
&& !$conditional->right->class instanceof PhpParser\Node\Name
14691469
&& $conditional->right->name instanceof PhpParser\Node\Identifier
14701470
&& strtolower($conditional->right->name->name) === 'class';
14711471

@@ -1474,15 +1474,22 @@ private static function hasGetClassCheck(
14741474
&& $conditional->left->name instanceof PhpParser\Node\Identifier
14751475
&& strtolower($conditional->left->name->name) === 'class';
14761476

1477-
$left_type = $source->node_data->getType($conditional->left);
1477+
$left_variable_class_const = $conditional->left instanceof PhpParser\Node\Expr\ClassConstFetch
1478+
&& !$conditional->left->class instanceof PhpParser\Node\Name
1479+
&& $conditional->left->name instanceof PhpParser\Node\Identifier
1480+
&& strtolower($conditional->left->name->name) === 'class';
14781481

14791482
$left_class_string_t = false;
14801483

1481-
if ($left_type && $left_type->isSingle()) {
1482-
foreach ($left_type->getAtomicTypes() as $type_part) {
1483-
if ($type_part instanceof TClassString) {
1484-
$left_class_string_t = true;
1485-
break;
1484+
if (!$left_variable_class_const) {
1485+
$left_type = $source->node_data->getType($conditional->left);
1486+
1487+
if ($left_type && $left_type->isSingle()) {
1488+
foreach ($left_type->getAtomicTypes() as $type_part) {
1489+
if ($type_part instanceof TClassString) {
1490+
$left_class_string_t = true;
1491+
break;
1492+
}
14861493
}
14871494
}
14881495
}
@@ -1503,29 +1510,26 @@ private static function hasGetClassCheck(
15031510
&& $conditional->left->name instanceof PhpParser\Node\Identifier
15041511
&& strtolower($conditional->left->name->name) === 'class';
15051512

1506-
$left_variable_class_const = $conditional->left instanceof PhpParser\Node\Expr\ClassConstFetch
1507-
&& $conditional->left->class instanceof PhpParser\Node\Expr\Variable
1508-
&& $conditional->left->name instanceof PhpParser\Node\Identifier
1509-
&& strtolower($conditional->left->name->name) === 'class';
1510-
15111513
$right_class_string = $conditional->right instanceof PhpParser\Node\Expr\ClassConstFetch
15121514
&& $conditional->right->class instanceof PhpParser\Node\Name
15131515
&& $conditional->right->name instanceof PhpParser\Node\Identifier
15141516
&& strtolower($conditional->right->name->name) === 'class';
15151517

1516-
$right_type = $source->node_data->getType($conditional->right);
1517-
15181518
$right_class_string_t = false;
15191519

1520-
if ($right_type && $right_type->isSingle()) {
1521-
foreach ($right_type->getAtomicTypes() as $type_part) {
1522-
if ($type_part instanceof TClassString) {
1523-
$right_class_string_t = true;
1524-
break;
1520+
if (!$right_variable_class_const) {
1521+
$right_type = $source->node_data->getType($conditional->right);
1522+
1523+
if ($right_type && $right_type->isSingle()) {
1524+
foreach ($right_type->getAtomicTypes() as $type_part) {
1525+
if ($type_part instanceof TClassString) {
1526+
$right_class_string_t = true;
1527+
break;
1528+
}
15251529
}
15261530
}
15271531
}
1528-
1532+
15291533
if (($left_get_class || $left_static_class || $left_variable_class_const)
15301534
&& ($right_class_string || $right_class_string_t)
15311535
) {

src/Psalm/Internal/Fork/PsalmRestarter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function requiresRestart($default): bool
9090
} elseif ($ini_name === 'enable_cli') {
9191
$value = in_array($value, ['1', 'true', true, 1]) ? 1 : 0;
9292
} elseif (is_int($required_value)) {
93-
$required_value = (int) $required_value;
93+
$value = (int) $value;
9494
}
9595
if ($value !== $required_value) {
9696
return true;

src/Psalm/Internal/LanguageServer/Client/Workspace.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Psalm\Internal\LanguageServer\Client;
66

7-
use JsonMapper;
87
use Psalm\Internal\LanguageServer\ClientHandler;
98
use Psalm\Internal\LanguageServer\LanguageServer;
109

@@ -17,10 +16,6 @@ final class Workspace
1716
{
1817
public function __construct(
1918
private readonly ClientHandler $handler,
20-
/**
21-
* @psalm-suppress UnusedProperty
22-
*/
23-
private readonly JsonMapper $mapper,
2419
private readonly LanguageServer $server,
2520
) {
2621
}

src/Psalm/Internal/Scanner/FileScanner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @internal
1919
* @psalm-consistent-constructor
2020
*/
21-
final class FileScanner implements FileSource
21+
class FileScanner implements FileSource
2222
{
2323
public function __construct(public string $file_path, public string $file_name, public bool $will_analyze)
2424
{

0 commit comments

Comments
 (0)