mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 09:37:59 +01:00
Fixup
This commit is contained in:
parent
e19caf0a16
commit
8ff340e588
@ -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 = [],
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,11 @@ final class Creator
|
||||
$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);
|
||||
|
@ -200,7 +200,7 @@ abstract class ClassLikeAnalyzer extends SourceAnalyzer
|
||||
?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();
|
||||
|
@ -9,7 +9,13 @@ namespace Psalm\Internal\Analyzer;
|
||||
*/
|
||||
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,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
@ -30,53 +27,23 @@ final class IssueData
|
||||
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) : '';
|
||||
}
|
||||
|
@ -8,9 +8,7 @@ use PhpParser;
|
||||
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;
|
||||
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Psalm\Internal\LanguageServer;
|
||||
|
||||
use JsonMapper;
|
||||
use LanguageServerProtocol\LogMessage;
|
||||
use LanguageServerProtocol\LogTrace;
|
||||
use Psalm\Internal\LanguageServer\Client\Progress\LegacyProgress;
|
||||
|
@ -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,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -13,10 +13,7 @@ use Psalm\Type\Union;
|
||||
final class NotInArray extends Assertion
|
||||
{
|
||||
public function __construct(
|
||||
/**
|
||||
* @readonly
|
||||
*/
|
||||
public Union $type,
|
||||
public readonly Union $type,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -632,7 +632,7 @@ class EnumTest extends TestCase
|
||||
$foo = FooEnum::Foo->value;
|
||||
noop($foo);
|
||||
noop(FooEnum::Foo->value);
|
||||
PHP
|
||||
PHP,
|
||||
],
|
||||
'backedEnumCaseValueFromClassConstant' => [
|
||||
'code' => <<<'PHP'
|
||||
|
Loading…
Reference in New Issue
Block a user