Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Oct 19, 2023
1 parent 4d4b6ca commit 0b25592
Show file tree
Hide file tree
Showing 69 changed files with 366 additions and 138 deletions.
7 changes: 5 additions & 2 deletions src/Psalm/FileBasedPluginAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ final class FileBasedPluginAdapter implements PluginEntryPointInterface
{
private readonly string $path;

public function __construct(string $path, private readonly Config $config, private Codebase $codebase)
{
public function __construct(
string $path,
private readonly Config $config,
private Codebase $codebase,
) {
if (!$path) {
throw new UnexpectedValueException('$path cannot be empty');
}
Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ final class Cache
{
public bool $use_igbinary;

public function __construct(private readonly Config $config)
{
public function __construct(
private readonly Config $config,
) {
$this->use_igbinary = $config->use_igbinary;
}

Expand Down
8 changes: 6 additions & 2 deletions src/Psalm/Internal/Codebase/Analyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,12 @@ final class Analyzer
*/
public array $mutable_classes = [];

public function __construct(private readonly Config $config, private readonly FileProvider $file_provider, private readonly FileStorageProvider $file_storage_provider, private readonly Progress $progress)
{
public function __construct(
private readonly Config $config,
private readonly FileProvider $file_provider,
private readonly FileStorageProvider $file_storage_provider,
private readonly Progress $progress,
) {
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
*/
final class AssertionsFromInheritanceResolver
{
public function __construct(private readonly Codebase $codebase)
{
public function __construct(
private readonly Codebase $codebase,
) {
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ final class ClassConstantByWildcardResolver
{
private readonly StorageByPatternResolver $resolver;

public function __construct(private readonly Codebase $codebase)
{
public function __construct(
private readonly Codebase $codebase,
) {
$this->resolver = new StorageByPatternResolver();
}

Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/Codebase/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ final class Functions

public DynamicFunctionStorageProvider $dynamic_storage_provider;

public function __construct(private readonly FileStorageProvider $file_storage_provider, private readonly Reflection $reflection)
{
public function __construct(
private readonly FileStorageProvider $file_storage_provider,
private readonly Reflection $reflection,
) {
$this->return_type_provider = new FunctionReturnTypeProvider();
$this->existence_provider = new FunctionExistenceProvider();
$this->params_provider = new FunctionParamsProvider();
Expand Down
9 changes: 7 additions & 2 deletions src/Psalm/Internal/Codebase/Populator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ final class Populator
*/
private array $invalid_class_storages = [];

public function __construct(private ClassLikeStorageProvider $classlike_storage_provider, private readonly FileStorageProvider $file_storage_provider, private readonly ClassLikes $classlikes, private readonly FileReferenceProvider $file_reference_provider, private readonly Progress $progress)
{
public function __construct(
private ClassLikeStorageProvider $classlike_storage_provider,
private readonly FileStorageProvider $file_storage_provider,
private readonly ClassLikes $classlikes,
private readonly FileReferenceProvider $file_reference_provider,
private readonly Progress $progress,
) {
}

public function populateCodebase(): void
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/Codebase/Reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ final class Reflection
*/
private static array $builtin_functions = [];

public function __construct(private readonly ClassLikeStorageProvider $storage_provider, private readonly Codebase $codebase)
{
public function __construct(
private readonly ClassLikeStorageProvider $storage_provider,
private readonly Codebase $codebase,
) {
self::$builtin_functions = [];
}

Expand Down
11 changes: 9 additions & 2 deletions src/Psalm/Internal/Codebase/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@ final class Scanner

private bool $is_forked = false;

public function __construct(private readonly Codebase $codebase, private readonly Config $config, private readonly FileStorageProvider $file_storage_provider, private readonly FileProvider $file_provider, private readonly Reflection $reflection, private readonly FileReferenceProvider $file_reference_provider, private readonly Progress $progress)
{
public function __construct(
private readonly Codebase $codebase,
private readonly Config $config,
private readonly FileStorageProvider $file_storage_provider,
private readonly FileProvider $file_provider,
private readonly Reflection $reflection,
private readonly FileReferenceProvider $file_reference_provider,
private readonly Progress $progress,
) {
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ public static function getForFunction(
return $manipulator;
}

private function __construct(string $file_path, private readonly Closure|Function_|ClassMethod|ArrowFunction $stmt, ProjectAnalyzer $project_analyzer)
{
private function __construct(
string $file_path,
private readonly Closure|Function_|ClassMethod|ArrowFunction $stmt,
ProjectAnalyzer $project_analyzer,
) {
$docblock = $stmt->getDocComment();
$this->docblock_start = $docblock ? $docblock->getStartFilePos() : (int)$stmt->getAttribute('startFilePos');
$this->docblock_end = $function_start = (int)$stmt->getAttribute('startFilePos');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ final class LegacyProgress implements ProgressInterface
private string $status = self::STATUS_INACTIVE;
private ?string $title = null;

public function __construct(private readonly ClientHandler $handler)
{
public function __construct(
private readonly ClientHandler $handler,
) {
}

public function begin(string $title, ?string $message = null, ?int $percentage = null): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ final class Progress implements ProgressInterface
private string $status = self::STATUS_INACTIVE;
private bool $withPercentage = false;

public function __construct(private readonly ClientHandler $handler, private readonly string $token)
{
public function __construct(
private readonly ClientHandler $handler,
private readonly string $token,
) {
}

public function begin(
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/LanguageServer/Client/TextDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
*/
final class TextDocument
{
public function __construct(private readonly ClientHandler $handler, private readonly LanguageServer $server)
{
public function __construct(
private readonly ClientHandler $handler,
private readonly LanguageServer $server,
) {
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/PhpVisitor/ConditionCloningVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
*/
final class ConditionCloningVisitor extends NodeVisitorAbstract
{
public function __construct(private readonly NodeDataProvider $type_provider)
{
public function __construct(
private readonly NodeDataProvider $type_provider,
) {
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/PhpVisitor/NodeCleanerVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
*/
final class NodeCleanerVisitor extends PhpParser\NodeVisitorAbstract
{
public function __construct(private readonly NodeDataProvider $type_provider)
{
public function __construct(
private readonly NodeDataProvider $type_provider,
) {
}

public function enterNode(PhpParser\Node $node): ?int
Expand Down
7 changes: 5 additions & 2 deletions src/Psalm/Internal/PhpVisitor/OffsetShifterVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ final class OffsetShifterVisitor extends PhpParser\NodeVisitorAbstract
/**
* @param array<int, int> $extra_offsets
*/
public function __construct(private readonly int $file_offset, private readonly int $line_offset, private array $extra_offsets)
{
public function __construct(
private readonly int $file_offset,
private readonly int $line_offset,
private array $extra_offsets,
) {
}

public function enterNode(PhpParser\Node $node): ?int
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/PhpVisitor/ParamReplacementVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ final class ParamReplacementVisitor extends PhpParser\NodeVisitorAbstract

private bool $new_new_name_used = false;

public function __construct(private readonly string $old_name, private readonly string $new_name)
{
public function __construct(
private readonly string $old_name,
private readonly string $new_name,
) {
}

public function enterNode(PhpParser\Node $node): ?int
Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/PhpVisitor/TraitFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ final class TraitFinder extends PhpParser\NodeVisitorAbstract
/** @var list<PhpParser\Node\Stmt\Trait_> */
private array $matching_trait_nodes = [];

public function __construct(private readonly string $fq_trait_name)
{
public function __construct(
private readonly string $fq_trait_name,
) {
}

public function enterNode(PhpParser\Node $node, bool &$traverseChildren = true): ?int
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/PhpVisitor/TypeMappingVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
*/
final class TypeMappingVisitor extends NodeVisitorAbstract
{
public function __construct(private readonly NodeDataProvider $fake_type_provider, private readonly NodeDataProvider $real_type_provider)
{
public function __construct(
private readonly NodeDataProvider $fake_type_provider,
private readonly NodeDataProvider $real_type_provider,
) {
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/PhpVisitor/YieldTypeCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ final class YieldTypeCollector extends NodeVisitorAbstract
/** @var list<Union> */
private array $yield_types = [];

public function __construct(private readonly NodeDataProvider $nodes)
{
public function __construct(
private readonly NodeDataProvider $nodes,
) {
}

public function enterNode(Node $node): ?int
Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/PluginManager/Command/DisableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
*/
final class DisableCommand extends Command
{
public function __construct(private readonly PluginListFactory $plugin_list_factory)
{
public function __construct(
private readonly PluginListFactory $plugin_list_factory,
) {
parent::__construct();
}

Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/PluginManager/Command/EnableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
*/
final class EnableCommand extends Command
{
public function __construct(private readonly PluginListFactory $plugin_list_factory)
{
public function __construct(
private readonly PluginListFactory $plugin_list_factory,
) {
parent::__construct();
}

Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/PluginManager/Command/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
*/
final class ShowCommand extends Command
{
public function __construct(private readonly PluginListFactory $plugin_list_factory)
{
public function __construct(
private readonly PluginListFactory $plugin_list_factory,
) {
parent::__construct();
}

Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/PluginManager/ComposerLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
final class ComposerLock
{
/** @param string[] $file_names */
public function __construct(private readonly array $file_names)
{
public function __construct(
private readonly array $file_names,
) {
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/PluginManager/ConfigFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ final class ConfigFile

private ?int $psalm_tag_end_pos = null;

public function __construct(private readonly string $current_dir, ?string $explicit_path)
{
public function __construct(
private readonly string $current_dir,
?string $explicit_path,
) {
if ($explicit_path) {
$this->path = $explicit_path;
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/PluginManager/PluginList.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ final class PluginList
/** @var ?array<string,?string> [pluginClass => ?packageName] */
private ?array $enabled_plugins = null;

public function __construct(private readonly ?ConfigFile $config_file, private readonly ComposerLock $composer_lock)
{
public function __construct(
private readonly ?ConfigFile $config_file,
private readonly ComposerLock $composer_lock,
) {
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/PluginManager/PluginListFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
*/
final class PluginListFactory
{
public function __construct(private readonly string $project_root, private readonly string $psalm_root)
{
public function __construct(
private readonly string $project_root,
private readonly string $psalm_root,
) {
}

public function __invoke(string $current_dir, ?string $config_file_path = null): PluginList
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/Provider/FileReferenceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ final class FileReferenceProvider
*/
private static array $method_param_uses = [];

public function __construct(private readonly FileProvider $file_provider, public ?FileReferenceCacheProvider $cache = null)
{
public function __construct(
private readonly FileProvider $file_provider,
public ?FileReferenceCacheProvider $cache = null,
) {
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Psalm/Internal/Provider/ParserCacheProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ final class ParserCacheProvider
*/
private array $new_file_content_hashes = [];

public function __construct(Config $config, private readonly bool $use_file_cache = true)
{
public function __construct(
Config $config,
private readonly bool $use_file_cache = true,
) {
$this->cache = new Cache($config);
}

Expand Down
5 changes: 3 additions & 2 deletions src/Psalm/Internal/Provider/ProjectCacheProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ final class ProjectCacheProvider

private ?string $composer_lock_hash = null;

public function __construct(private readonly string $composer_lock_location)
{
public function __construct(
private readonly string $composer_lock_location,
) {
}

public function canDiffFiles(): bool
Expand Down
Loading

0 comments on commit 0b25592

Please sign in to comment.