Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Oct 21, 2023
1 parent e19caf0 commit 8ff340e
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 80 deletions.
11 changes: 9 additions & 2 deletions src/Psalm/Aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ final class Aliases
* @internal
* @psalm-mutation-free
*/
public function __construct(public ?string $namespace = null, public array $uses = [], public array $functions = [], public array $constants = [], public array $uses_flipped = [], public array $functions_flipped = [], public array $constants_flipped = [])
{
public function __construct(
public ?string $namespace = null,
public array $uses = [],
public array $functions = [],
public array $constants = [],
public array $uses_flipped = [],
public array $functions_flipped = [],
public array $constants_flipped = [],
) {
}
}
6 changes: 5 additions & 1 deletion src/Psalm/Config/Creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ private static function guessPhpFileDirs(string $current_dir): array
$nodes = [];

/** @var string[] */
$php_files = [...glob($current_dir . DIRECTORY_SEPARATOR . '*.php', GLOB_NOSORT) ?: [], ...glob($current_dir . DIRECTORY_SEPARATOR . '**/*.php', GLOB_NOSORT) ?: [], ...glob($current_dir . DIRECTORY_SEPARATOR . '**/**/*.php', GLOB_NOSORT) ?: []];
$php_files = [
...glob($current_dir . DIRECTORY_SEPARATOR . '*.php', GLOB_NOSORT) ?: [],
...glob($current_dir . DIRECTORY_SEPARATOR . '**/*.php', GLOB_NOSORT) ?: [],
...glob($current_dir . DIRECTORY_SEPARATOR . '**/**/*.php', GLOB_NOSORT) ?: [],
];

foreach ($php_files as $php_file) {
$php_file = str_replace($current_dir . DIRECTORY_SEPARATOR, '', $php_file);
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public static function checkFullyQualifiedClassLikeName(
?string $calling_method_id,
array $suppressed_issues,
?ClassLikeNameOptions $options = null,
bool $check_classes = true
bool $check_classes = true,
): ?bool {
if ($options === null) {
$options = new ClassLikeNameOptions();
Expand Down
10 changes: 8 additions & 2 deletions src/Psalm/Internal/Analyzer/ClassLikeNameOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
*/
final class ClassLikeNameOptions
{
public function __construct(public bool $inferred = false, public bool $allow_trait = false, public bool $allow_interface = true, public bool $allow_enum = true, public bool $from_docblock = false, public bool $from_attribute = false)
{
public function __construct(
public bool $inferred = false,
public bool $allow_trait = false,
public bool $allow_interface = true,
public bool $allow_enum = true,
public bool $from_docblock = false,
public bool $from_attribute = false,
) {
}
}
15 changes: 13 additions & 2 deletions src/Psalm/Internal/Analyzer/DataFlowNodeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@ final class DataFlowNodeData
{
use ImmutableNonCloneableTrait;

public function __construct(public string $label, public int $line_from, public int $line_to, public string $file_name, public string $file_path, public string $snippet, public int $from, public int $to, public int $snippet_from, public int $column_from, public int $column_to)
{
public function __construct(
public string $label,
public int $line_from,
public int $line_to,
public string $file_name,
public string $file_path,
public string $snippet,
public int $from,
public int $to,
public int $snippet_from,
public int $column_from,
public int $column_to,
) {
}
}
7 changes: 5 additions & 2 deletions src/Psalm/Internal/Analyzer/FileAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ class FileAnalyzer extends SourceAnalyzer

private ?Union $return_type = null;

public function __construct(public ProjectAnalyzer $project_analyzer, protected string $file_path, protected string $file_name)
{
public function __construct(
public ProjectAnalyzer $project_analyzer,
protected string $file_path,
protected string $file_name,
) {
$this->source = $this;
$this->codebase = $project_analyzer->getCodebase();
}
Expand Down
7 changes: 5 additions & 2 deletions src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer
/**
* @param TFunction $function
*/
public function __construct(protected Closure|Function_|ClassMethod|ArrowFunction $function, SourceAnalyzer $source, protected FunctionLikeStorage $storage)
{
public function __construct(
protected Closure|Function_|ClassMethod|ArrowFunction $function,
SourceAnalyzer $source,
protected FunctionLikeStorage $storage,
) {
$this->source = $source;
$this->suppressed_issues = $source->getSuppressedIssues();
$this->codebase = $source->getCodebase();
Expand Down
55 changes: 11 additions & 44 deletions src/Psalm/Internal/Analyzer/IssueData.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ final class IssueData
public const SEVERITY_INFO = 'info';
public const SEVERITY_ERROR = 'error';

/**
* @readonly
*/
public string $link;
public readonly string $link;

/**
* @param self::SEVERITY_* $severity
Expand All @@ -30,53 +27,23 @@ public function __construct(
public string $severity,
public int $line_from,
public int $line_to,
/**
* @readonly
*/
public string $type,
/**
* @readonly
*/
public string $message,
/**
* @readonly
*/
public string $file_name,
/**
* @readonly
*/
public string $file_path,
/**
* @readonly
*/
public string $snippet,
/**
* @readonly
*/
public string $selected_text,
public readonly string $type,
public readonly string $message,
public readonly string $file_name,
public readonly string $file_path,
public readonly string $snippet,
public readonly string $selected_text,
public int $from,
public int $to,
public int $snippet_from,
public int $snippet_to,
/**
* @readonly
*/
public int $column_from,
/**
* @readonly
*/
public int $column_to,
/**
* @readonly
*/
public int $shortcode = 0,
public readonly int $column_from,
public readonly int $column_to,
public readonly int $shortcode = 0,
public int $error_level = -1,
public ?array $taint_trace = null,
public ?array $other_references = null,
/**
* @readonly
*/
public ?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
2 changes: 0 additions & 2 deletions src/Psalm/Internal/Diff/ClassStatementsDiffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
use UnexpectedValueException;

use function count;
use function get_class;
use function is_string;
use function strpos;
use function str_contains;
use function strtolower;
use function substr;
Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/LanguageServer/LanguageClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Psalm\Internal\LanguageServer;

use JsonMapper;
use LanguageServerProtocol\LogMessage;
use LanguageServerProtocol\LogTrace;
use Psalm\Internal\LanguageServer\Client\Progress\LegacyProgress;
Expand Down
10 changes: 2 additions & 8 deletions src/Psalm/Issue/CodeIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@ abstract class CodeIssue
public ?string $dupe_key = null;

public function __construct(
/**
* @readonly
*/
public string $message,
/**
* @readonly
*/
public CodeLocation $code_location,
public readonly string $message,
public readonly CodeLocation $code_location,
) {
}

Expand Down
10 changes: 2 additions & 8 deletions src/Psalm/Issue/TaintedInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ abstract class TaintedInput extends CodeIssue
public function __construct(
string $message,
CodeLocation $code_location,
/**
* @readonly
*/
public array $journey,
/**
* @readonly
*/
public string $journey_text,
public readonly array $journey,
public readonly string $journey_text,
) {
parent::__construct($message, $code_location);
}
Expand Down
5 changes: 1 addition & 4 deletions src/Psalm/Storage/Assertion/NotInArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
final class NotInArray extends Assertion
{
public function __construct(
/**
* @readonly
*/
public Union $type,
public readonly Union $type,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion tests/EnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ function noop(string $s): string
$foo = FooEnum::Foo->value;
noop($foo);
noop(FooEnum::Foo->value);
PHP
PHP,
],
'backedEnumCaseValueFromClassConstant' => [
'code' => <<<'PHP'
Expand Down

0 comments on commit 8ff340e

Please sign in to comment.