Skip to content

Commit 9520223

Browse files
authored
Merge pull request #10597 from weirdan/update-master
2 parents 275dfd8 + 917c5f8 commit 9520223

File tree

14 files changed

+93
-225
lines changed

14 files changed

+93
-225
lines changed

.github/workflows/bcc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
composer update --no-install
3131
3232
- name: Cache composer cache
33-
uses: actions/cache@v3
33+
uses: actions/cache@v4
3434
with:
3535
path: |
3636
${{ steps.composer-cache.outputs.files_cache }}

.github/workflows/build-phar.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
composer update --no-install
6060
6161
- name: Cache composer cache
62-
uses: actions/cache@v3
62+
uses: actions/cache@v4
6363
with:
6464
path: |
6565
${{ steps.composer-cache.outputs.files_cache }}

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
COMPOSER_ROOT_VERSION: dev-master
3434

3535
- name: Cache composer cache
36-
uses: actions/cache@v3
36+
uses: actions/cache@v4
3737
with:
3838
path: |
3939
${{ steps.composer-cache.outputs.files_cache }}
@@ -77,7 +77,7 @@ jobs:
7777
COMPOSER_ROOT_VERSION: dev-master
7878

7979
- name: Cache composer cache
80-
uses: actions/cache@v3
80+
uses: actions/cache@v4
8181
with:
8282
path: |
8383
${{ steps.composer-cache.outputs.files_cache }}
@@ -164,7 +164,7 @@ jobs:
164164
COMPOSER_ROOT_VERSION: dev-master
165165

166166
- name: Cache composer cache
167-
uses: actions/cache@v3
167+
uses: actions/cache@v4
168168
with:
169169
path: |
170170
${{ steps.composer-cache.outputs.files_cache }}

.github/workflows/windows-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
COMPOSER_ROOT_VERSION: dev-master
8686

8787
- name: Cache composer cache
88-
uses: actions/cache@v3
88+
uses: actions/cache@v4
8989
with:
9090
path: |
9191
${{ steps.composer-cache.outputs.files_cache }}

psalm-baseline.xml

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<files psalm-version="dev-master@950293c6e74c6e9db842f537c5722755b1594313">
3+
<file src="vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php">
4+
<PossiblyUndefinedStringArrayOffset>
5+
<code><![CDATA[$subNodes['expr']]]></code>
6+
</PossiblyUndefinedStringArrayOffset>
7+
</file>
38
<file src="examples/TemplateChecker.php">
49
<PossiblyUndefinedIntArrayOffset>
510
<code><![CDATA[$comment_block->tags['variablesfrom'][0]]]></code>

src/Psalm/Codebase.php

+2
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,8 @@ public function getCompletionItemsForClassishThing(
17351735
/**
17361736
* @param list<CompletionItem> $items
17371737
* @return list<CompletionItem>
1738+
* @deprecated to be removed in Psalm 6
1739+
* @api fix deprecation problem "PossiblyUnusedMethod: Cannot find any calls to method"
17381740
*/
17391741
public function filterCompletionItemsByBeginLiteralPart(array $items, string $literal_part): array
17401742
{

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

+6-8
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ public static function analyze(
4848
return false;
4949
}
5050

51-
$part_type = $statements_analyzer->node_data->getType($part);
52-
53-
if ($part_type !== null) {
51+
if ($part instanceof EncapsedStringPart) {
52+
if ($literal_string !== null) {
53+
$literal_string .= $part->value;
54+
}
55+
$non_empty = $non_empty || $part->value !== "";
56+
} elseif ($part_type = $statements_analyzer->node_data->getType($part)) {
5457
$casted_part_type = CastAnalyzer::castStringAttempt(
5558
$statements_analyzer,
5659
$context,
@@ -112,11 +115,6 @@ public static function analyze(
112115
}
113116
}
114117
}
115-
} elseif ($part instanceof EncapsedStringPart) {
116-
if ($literal_string !== null) {
117-
$literal_string .= $part->value;
118-
}
119-
$non_empty = $non_empty || $part->value !== "";
120118
} else {
121119
$all_literals = false;
122120
$literal_string = null;

src/Psalm/Internal/LanguageServer/Server/TextDocument.php

-3
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ public function completion(TextDocumentIdentifier $textDocument, Position $posit
281281

282282
try {
283283
$completion_data = $this->codebase->getCompletionDataAtPosition($file_path, $position);
284-
$literal_part = $this->codebase->getBeginedLiteralPart($file_path, $position);
285284
if ($completion_data) {
286285
[$recent_type, $gap, $offset] = $completion_data;
287286

@@ -290,8 +289,6 @@ public function completion(TextDocumentIdentifier $textDocument, Position $posit
290289
->textDocument->completion->completionItem->snippetSupport ?? false;
291290
$completion_items =
292291
$this->codebase->getCompletionItemsForClassishThing($recent_type, $gap, $snippetSupport);
293-
$completion_items =
294-
$this->codebase->filterCompletionItemsByBeginLiteralPart($completion_items, $literal_part);
295292
} elseif ($gap === '[') {
296293
$completion_items = $this->codebase->getCompletionItemsForArrayKeys($recent_type);
297294
} else {

src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php

-2
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,6 @@ public static function getMappedGenericTypeParams(
12441244
Atomic $container_type_part,
12451245
?array &$container_type_params_covariant = null,
12461246
): array {
1247-
$_ = null;
12481247
if ($input_type_part instanceof TGenericObject || $input_type_part instanceof TIterable) {
12491248
$input_type_params = $input_type_part->type_params;
12501249
} elseif ($codebase->classlike_storage_provider->has($input_type_part->value)) {
@@ -1280,7 +1279,6 @@ public static function getMappedGenericTypeParams(
12801279
$replacement_templates = [];
12811280

12821281
if ($input_template_types
1283-
&& (!$input_type_part instanceof TGenericObject || !$input_type_part->remapped_params)
12841282
&& (!$container_type_part instanceof TGenericObject || !$container_type_part->remapped_params)
12851283
) {
12861284
foreach ($input_template_types as $template_name => $_) {

tests/ClassTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,9 @@ class T extends \PHPUnit\Framework\TestCase {
464464
],
465465
'classAliasNoException' => [
466466
'code' => '<?php
467-
class_alias("Bar\F1", "Bar\F2");
467+
namespace {
468+
class_alias("Bar\F1", "Bar\F2");
469+
}
468470
469471
namespace Bar {
470472
class F1 {

tests/FileUpdates/TemporaryUpdateTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ public function foo() : void {
605605
606606
class A {
607607
public function foo() : void {
608-
throw new Error("bad", 5);
608+
throw new Error("bad", []);
609609
}
610610
}',
611611
],
@@ -615,7 +615,7 @@ public function foo() : void {
615615
616616
class A {
617617
public function foo() : void {
618-
throw new Error("bad", 5);
618+
throw new Error("bad", []);
619619
}
620620
}',
621621
],
@@ -659,7 +659,7 @@ public function foo() : void {
659659
660660
class A {
661661
public function foo() : void {
662-
throw new E("bad", 5);
662+
throw new E("bad", []);
663663
}
664664
}',
665665
],
@@ -669,7 +669,7 @@ public function foo() : void {
669669
670670
class A {
671671
public function foo() : void {
672-
throw new E("bad", 5);
672+
throw new E("bad", []);
673673
}
674674
}',
675675
],
@@ -709,7 +709,7 @@ public function foo() : void {
709709
710710
class A {
711711
public function foo() : void {
712-
throw new Error("bad", 5);
712+
throw new Error("bad", []);
713713
}
714714
}',
715715
],
@@ -719,7 +719,7 @@ public function foo() : void {
719719
720720
class A {
721721
public function foo() : void {
722-
throw new Error("bad", 5);
722+
throw new Error("bad", []);
723723
}
724724
}',
725725
],
@@ -757,7 +757,7 @@ public function foo() : void {
757757
758758
class A {
759759
public function foo() : void {
760-
throw new E("bad", 5);
760+
throw new E("bad", []);
761761
}
762762
}',
763763
],
@@ -767,7 +767,7 @@ public function foo() : void {
767767
768768
class A {
769769
public function foo() : void {
770-
throw new E("bad", 5);
770+
throw new E("bad", []);
771771
}
772772
}',
773773
],

0 commit comments

Comments
 (0)