Skip to content

Commit

Permalink
cs-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Nov 23, 2024
1 parent 95631f5 commit 4573dbf
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/Psalm/Codebase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ public function isTypeContainedByType(
bool $ignore_null = false,
bool $ignore_false = false,
bool $allow_interface_equality = false,
bool $allow_float_int_equality = true
bool $allow_float_int_equality = true,
): bool {
return UnionTypeComparator::isContainedBy(
$this,
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,7 @@ public function examineParamTypes(
StatementsAnalyzer $statements_analyzer,
Context $context,
Codebase $codebase,
?PhpParser\Node $stmt = null
?PhpParser\Node $stmt = null,
): void {
$storage = $this->getFunctionLikeStorage($statements_analyzer);

Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Analyzer/IssueData.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
public int $error_level = -1,
public ?array $taint_trace = null,
public ?array $other_references = null,
public readonly ?string $dupe_key = null
public readonly ?string $dupe_key = null,
) {
$this->link = $shortcode ? 'https://psalm.dev/' . str_pad((string) $shortcode, 3, "0", STR_PAD_LEFT) : '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,11 @@ public static function analyze(
}

/**
* @param string|int $literal_array_key
* @return false|int
* @psalm-assert-if-false !numeric $literal_array_key
*/
public static function getLiteralArrayKeyInt(
$literal_array_key
) {
string|int $literal_array_key,
): false|int {
if (is_int($literal_array_key)) {
return $literal_array_key;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
use function implode;
use function in_array;
use function is_string;
use function preg_match;
use function str_contains;
use function strlen;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ private static function analyzeOperands(
bool &$has_valid_left_operand,
bool &$has_valid_right_operand,
bool &$has_string_increment,
?Union &$result_type = null
Btw ): ?Union {
?Union &$result_type = null,
): ?Union {
if (($left_type_part instanceof TLiteralInt || $left_type_part instanceof TLiteralFloat)
&& ($right_type_part instanceof TLiteralInt || $right_type_part instanceof TLiteralFloat)
&& (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function analyze(
PhpParser\Node\Expr $left,
PhpParser\Node\Expr $right,
Context $context,
?Union &$result_type = null
?Union &$result_type = null,
): void {
$codebase = $statements_analyzer->getCodebase();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ private static function verifyCallableInContext(
CodeLocation $arg_location,
Context $context,
Codebase $codebase,
StatementsAnalyzer $statements_analyzer
StatementsAnalyzer $statements_analyzer,
): ?bool {
$method_identifier = $cased_method_id !== null ? ' of ' . $cased_method_id : '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function analyze(
StatementsAnalyzer $statements_analyzer,
PhpParser\Node\Expr\New_ $stmt,
Context $context,
?TemplateResult $template_result = null
?TemplateResult $template_result = null,
): bool {
$fq_class_name = null;

Expand Down Expand Up @@ -312,7 +312,7 @@ private static function analyzeNamedConstructor(
string $fq_class_name,
bool $from_static,
bool $can_extend,
?TemplateResult $template_result = null
?TemplateResult $template_result = null,
): void {
$storage = $codebase->classlike_storage_provider->get($fq_class_name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
use function array_merge;
use function array_pop;
use function array_values;
use function get_class;
use function range;
use function strtolower;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public static function getArrayAccessTypeGivenOffset(
?string $extended_var_id,
Context $context,
?PhpParser\Node\Expr $assign_value = null,
?Union $replacement_type = null
?Union $replacement_type = null,
): Union {
$offset_type = $offset_type_original->getBuilder();

Expand Down
1 change: 1 addition & 0 deletions src/Psalm/Internal/Cli/Psalm.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
use function str_repeat;
use function str_starts_with;
use function strlen;
use function strpos;
use function substr;
use function wordwrap;

Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Codebase/Analyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ public function addNodeType(
string $file_path,
PhpParser\Node $node,
string $node_type,
?PhpParser\Node $parent_node = null
?PhpParser\Node $parent_node = null,
): void {
if ($node_type === '') {
throw new UnexpectedValueException('non-empty node_type expected');
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Codebase/ConstantTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function resolve(
ClassLikes $classlikes,
UnresolvedConstantComponent $c,
?StatementsAnalyzer $statements_analyzer = null,
array $visited_constant_ids = []
array $visited_constant_ids = [],
): Atomic {
$c_id = spl_object_id($c);

Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Codebase/Methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ public function getMethodReturnsByRef(MethodIdentifier $method_id): bool

public function getMethodReturnTypeLocation(
MethodIdentifier $method_id,
?CodeLocation &$defined_location = null
?CodeLocation &$defined_location = null,
): ?CodeLocation {
$method_id = $this->getDeclaringMethodId($method_id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Psalm\Type\Atomic;
use Psalm\Type\Atomic\TArray;
use Psalm\Type\Atomic\TCallable;
use Psalm\Type\Atomic\TCallableArray;
use Psalm\Type\Atomic\TCallableInterface;
use Psalm\Type\Atomic\TClassString;
use Psalm\Type\Atomic\TClosure;
Expand All @@ -43,12 +42,11 @@
final class CallableTypeComparator
{
/**
* @param TClosure|TCallableInterface $input_type_part
* @param TCallable|TClosure $container_type_part
*/
public static function isContainedBy(
Codebase $codebase,
$input_type_part,
TClosure|TCallableInterface $input_type_part,
Atomic $container_type_part,
?TypeComparisonResult $atomic_comparison_result,
): bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use Psalm\Type\Atomic\TTraitString;
use Psalm\Type\Atomic\TTrue;

use function get_class;
use function is_numeric;
use function strtolower;

Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Type/ParseTree/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(
public int $offset_start,
public int $offset_end,
?string $text,
?ParseTree $parent = null
?ParseTree $parent = null,
) {
$this->parent = $parent;
$this->text = $text === $value ? null : $text;
Expand Down
2 changes: 0 additions & 2 deletions src/Psalm/Internal/Type/TypeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@
use function defined;
use function end;
use function explode;
use function filter_var;
use function get_class;
use function in_array;
use function is_int;
use function is_numeric;
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Type/Atomic/TCallableInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Psalm\Type\Atomic;

interface TCallableInterface
Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Type/Reconciler.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
use function preg_quote;
use function str_contains;
use function str_ends_with;
use function str_replace;
use function str_split;
use function strlen;
use function strpos;
Expand Down
2 changes: 2 additions & 0 deletions tests/Internal/JsonTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Psalm\Tests\Internal;

use Psalm\Internal\Json\Json;
Expand Down

0 comments on commit 4573dbf

Please sign in to comment.