Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update master from 5.x #10597

Merged
merged 15 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
composer update --no-install

- name: Cache composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ steps.composer-cache.outputs.files_cache }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
composer update --no-install

- name: Cache composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ steps.composer-cache.outputs.files_cache }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
COMPOSER_ROOT_VERSION: dev-master

- name: Cache composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ steps.composer-cache.outputs.files_cache }}
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
COMPOSER_ROOT_VERSION: dev-master

- name: Cache composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ steps.composer-cache.outputs.files_cache }}
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
COMPOSER_ROOT_VERSION: dev-master

- name: Cache composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ steps.composer-cache.outputs.files_cache }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
COMPOSER_ROOT_VERSION: dev-master

- name: Cache composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ steps.composer-cache.outputs.files_cache }}
Expand Down
5 changes: 5 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@950293c6e74c6e9db842f537c5722755b1594313">
<file src="vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php">
<PossiblyUndefinedStringArrayOffset>
<code><![CDATA[$subNodes['expr']]]></code>
</PossiblyUndefinedStringArrayOffset>
</file>
<file src="examples/TemplateChecker.php">
<PossiblyUndefinedIntArrayOffset>
<code><![CDATA[$comment_block->tags['variablesfrom'][0]]]></code>
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Codebase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,8 @@ public function getCompletionItemsForClassishThing(
/**
* @param list<CompletionItem> $items
* @return list<CompletionItem>
* @deprecated to be removed in Psalm 6
* @api fix deprecation problem "PossiblyUnusedMethod: Cannot find any calls to method"
*/
public function filterCompletionItemsByBeginLiteralPart(array $items, string $literal_part): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ public static function analyze(
return false;
}

$part_type = $statements_analyzer->node_data->getType($part);

if ($part_type !== null) {
if ($part instanceof EncapsedStringPart) {
if ($literal_string !== null) {
$literal_string .= $part->value;
}
$non_empty = $non_empty || $part->value !== "";
} elseif ($part_type = $statements_analyzer->node_data->getType($part)) {
$casted_part_type = CastAnalyzer::castStringAttempt(
$statements_analyzer,
$context,
Expand Down Expand Up @@ -112,11 +115,6 @@ public static function analyze(
}
}
}
} elseif ($part instanceof EncapsedStringPart) {
if ($literal_string !== null) {
$literal_string .= $part->value;
}
$non_empty = $non_empty || $part->value !== "";
} else {
$all_literals = false;
$literal_string = null;
Expand Down
3 changes: 0 additions & 3 deletions src/Psalm/Internal/LanguageServer/Server/TextDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ public function completion(TextDocumentIdentifier $textDocument, Position $posit

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

Expand All @@ -290,8 +289,6 @@ public function completion(TextDocumentIdentifier $textDocument, Position $posit
->textDocument->completion->completionItem->snippetSupport ?? false;
$completion_items =
$this->codebase->getCompletionItemsForClassishThing($recent_type, $gap, $snippetSupport);
$completion_items =
$this->codebase->filterCompletionItemsByBeginLiteralPart($completion_items, $literal_part);
} elseif ($gap === '[') {
$completion_items = $this->codebase->getCompletionItemsForArrayKeys($recent_type);
} else {
Expand Down
2 changes: 0 additions & 2 deletions src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,6 @@ public static function getMappedGenericTypeParams(
Atomic $container_type_part,
?array &$container_type_params_covariant = null,
): array {
$_ = null;
if ($input_type_part instanceof TGenericObject || $input_type_part instanceof TIterable) {
$input_type_params = $input_type_part->type_params;
} elseif ($codebase->classlike_storage_provider->has($input_type_part->value)) {
Expand Down Expand Up @@ -1280,7 +1279,6 @@ public static function getMappedGenericTypeParams(
$replacement_templates = [];

if ($input_template_types
&& (!$input_type_part instanceof TGenericObject || !$input_type_part->remapped_params)
&& (!$container_type_part instanceof TGenericObject || !$container_type_part->remapped_params)
) {
foreach ($input_template_types as $template_name => $_) {
Expand Down
4 changes: 3 additions & 1 deletion tests/ClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,9 @@ class T extends \PHPUnit\Framework\TestCase {
],
'classAliasNoException' => [
'code' => '<?php
class_alias("Bar\F1", "Bar\F2");
namespace {
class_alias("Bar\F1", "Bar\F2");
}

namespace Bar {
class F1 {
Expand Down
16 changes: 8 additions & 8 deletions tests/FileUpdates/TemporaryUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ public function foo() : void {

class A {
public function foo() : void {
throw new Error("bad", 5);
throw new Error("bad", []);
}
}',
],
Expand All @@ -615,7 +615,7 @@ public function foo() : void {

class A {
public function foo() : void {
throw new Error("bad", 5);
throw new Error("bad", []);
}
}',
],
Expand Down Expand Up @@ -659,7 +659,7 @@ public function foo() : void {

class A {
public function foo() : void {
throw new E("bad", 5);
throw new E("bad", []);
}
}',
],
Expand All @@ -669,7 +669,7 @@ public function foo() : void {

class A {
public function foo() : void {
throw new E("bad", 5);
throw new E("bad", []);
}
}',
],
Expand Down Expand Up @@ -709,7 +709,7 @@ public function foo() : void {

class A {
public function foo() : void {
throw new Error("bad", 5);
throw new Error("bad", []);
}
}',
],
Expand All @@ -719,7 +719,7 @@ public function foo() : void {

class A {
public function foo() : void {
throw new Error("bad", 5);
throw new Error("bad", []);
}
}',
],
Expand Down Expand Up @@ -757,7 +757,7 @@ public function foo() : void {

class A {
public function foo() : void {
throw new E("bad", 5);
throw new E("bad", []);
}
}',
],
Expand All @@ -767,7 +767,7 @@ public function foo() : void {

class A {
public function foo() : void {
throw new E("bad", 5);
throw new E("bad", []);
}
}',
],
Expand Down
Loading
Loading