1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Move a bunch of classes to better places

This commit is contained in:
Matt Brown 2018-05-11 18:35:02 -04:00
parent ef519ade72
commit 5c0f4a999c
21 changed files with 34 additions and 29 deletions

View File

@ -26,11 +26,11 @@
<PossiblyNullOperand errorLevel="suppress" />
<MissingConstructor>
<errorLevel type="suppress">
<file name="src/Psalm/FunctionDocblockComment.php" />
<file name="src/Psalm/Scanner/FunctionDocblockComment.php" />
<file name="src/Psalm/Storage/FunctionLikeStorage.php" />
<file name="src/Psalm/Storage/MethodStorage.php" />
<file name="src/Psalm/Storage/PropertyStorage.php" />
<file name="src/Psalm/VarDocblockComment.php" />
<file name="src/Psalm/Scanner/VarDocblockComment.php" />
</errorLevel>
</MissingConstructor>
<DeprecatedProperty errorLevel="suppress" />

View File

@ -21,6 +21,7 @@ use Psalm\Issue\UnimplementedInterfaceMethod;
use Psalm\IssueBuffer;
use Psalm\StatementsSource;
use Psalm\Storage\ClassLikeStorage;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Type;
class ClassChecker extends ClassLikeChecker
@ -535,7 +536,7 @@ class ClassChecker extends ClassLikeChecker
$fake_constructor_params = array_map(
/** @return PhpParser\Node\Param */
function (\Psalm\FunctionLikeParameter $param) {
function (FunctionLikeParameter $param) {
$fake_param = (new PhpParser\Builder\Param($param->name));
if ($param->signature_type) {
$fake_param->setTypehint((string)$param->signature_type);
@ -548,7 +549,7 @@ class ClassChecker extends ClassLikeChecker
$fake_constructor_stmt_args = array_map(
/** @return PhpParser\Node\Arg */
function (\Psalm\FunctionLikeParameter $param) {
function (FunctionLikeParameter $param) {
return new PhpParser\Node\Arg(new PhpParser\Node\Expr\Variable($param->name));
},
$constructor_storage->params

View File

@ -2,14 +2,14 @@
namespace Psalm\Checker;
use Psalm\Aliases;
use Psalm\ClassLikeDocblockComment;
use Psalm\Exception\DocblockParseException;
use Psalm\Exception\IncorrectDocblockException;
use Psalm\Exception\TypeParseTreeException;
use Psalm\FileSource;
use Psalm\FunctionDocblockComment;
use Psalm\Scanner\ClassLikeDocblockComment;
use Psalm\Scanner\FunctionDocblockComment;
use Psalm\Scanner\VarDocblockComment;
use Psalm\Type;
use Psalm\VarDocblockComment;
class CommentChecker
{

View File

@ -14,7 +14,6 @@ use Psalm\Checker\Statements\ExpressionChecker;
use Psalm\Checker\TypeChecker;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\EffectsAnalyser;
use Psalm\FileManipulation\FunctionDocblockManipulator;
use Psalm\Issue\InvalidFalsableReturnType;
use Psalm\Issue\InvalidNullableReturnType;
@ -88,7 +87,7 @@ class ReturnTypeChecker
/** @var PhpParser\Node\Stmt[] */
$function_stmts = $function->getStmts();
$inferred_return_type_parts = EffectsAnalyser::getReturnTypes(
$inferred_return_type_parts = ReturnTypeCollector::getReturnTypes(
$function_stmts,
$inferred_yield_types,
$ignore_nullable_issues,

View File

@ -1,13 +1,14 @@
<?php
namespace Psalm;
namespace Psalm\Checker\FunctionLike;
use PhpParser;
use Psalm\Type;
use Psalm\Type\Atomic;
/**
* A class for analysing a given method call's effects in relation to $this/self and also looking at return types
*/
class EffectsAnalyser
class ReturnTypeCollector
{
/**
* Gets the return types from a list of statements

View File

@ -6,13 +6,12 @@ use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use Psalm\Checker\FunctionLike\ReturnTypeChecker;
use Psalm\Checker\FunctionLike\ReturnTypeCollector;
use Psalm\Checker\Statements\ExpressionChecker;
use Psalm\Codebase\CallMap;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\EffectsAnalyser;
use Psalm\FileManipulation\FunctionDocblockManipulator;
use Psalm\FunctionLikeParameter;
use Psalm\Issue\InvalidParamDefault;
use Psalm\Issue\MismatchingDocblockParamType;
use Psalm\Issue\MissingClosureParamType;
@ -21,6 +20,7 @@ use Psalm\Issue\ReservedWord;
use Psalm\Issue\UnusedParam;
use Psalm\IssueBuffer;
use Psalm\StatementsSource;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Storage\FunctionLikeStorage;
use Psalm\Storage\MethodStorage;
use Psalm\Type;
@ -488,7 +488,7 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
$closure_yield_types = [];
$closure_return_types = EffectsAnalyser::getReturnTypes(
$closure_return_types = ReturnTypeCollector::getReturnTypes(
$this->function->stmts,
$closure_yield_types,
$ignore_nullable_issues,

View File

@ -11,7 +11,6 @@ use Psalm\Checker\TypeChecker;
use Psalm\Codebase\CallMap;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\FunctionLikeParameter;
use Psalm\Issue\ImplicitToStringCast;
use Psalm\Issue\InvalidArgument;
use Psalm\Issue\InvalidPassByReference;
@ -28,6 +27,7 @@ use Psalm\Issue\TypeCoercion;
use Psalm\Issue\UndefinedFunction;
use Psalm\IssueBuffer;
use Psalm\Storage\ClassLikeStorage;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Storage\FunctionLikeStorage;
use Psalm\Type;
use Psalm\Type\Atomic\ObjectLike;

View File

@ -571,7 +571,7 @@ class Codebase
/**
* @param string $method_id
*
* @return array<int, \Psalm\FunctionLikeParameter>
* @return array<int, \Psalm\Storage\FunctionLikeParameter>
*/
public function getMethodParams($method_id)
{

View File

@ -2,7 +2,7 @@
namespace Psalm\Codebase;
use Psalm\Type;
use Psalm\FunctionLikeParameter;
use Psalm\Storage\FunctionLikeParameter;
/**
* @internal

View File

@ -127,7 +127,7 @@ class Methods
/**
* @param string $method_id
*
* @return array<int, \Psalm\FunctionLikeParameter>
* @return array<int, \Psalm\Storage\FunctionLikeParameter>
*/
public function getMethodParams($method_id)
{

View File

@ -4,8 +4,8 @@ namespace Psalm\Codebase;
use Psalm\Checker\ClassLikeChecker;
use Psalm\Checker\CommentChecker;
use Psalm\Codebase;
use Psalm\FunctionLikeParameter;
use Psalm\Provider\ClassLikeStorageProvider;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Storage\FunctionLikeStorage;
use Psalm\Storage\MethodStorage;
use Psalm\Storage\PropertyStorage;

View File

@ -29,7 +29,7 @@ class FileStorageCacheProvider
$storage_dir . 'FunctionLikeStorage.php',
$storage_dir . 'ClassLikeStorage.php',
$storage_dir . 'MethodStorage.php',
dirname(__DIR__) . DIRECTORY_SEPARATOR . 'FunctionLikeParameter.php',
$storage_dir . 'FunctionLikeParameter.php',
];
foreach ($dependent_files as $dependent_file_path) {

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm;
namespace Psalm\Scanner;
class ClassLikeDocblockComment
{

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm;
namespace Psalm\Scanner;
class FunctionDocblockComment
{

View File

@ -1,5 +1,7 @@
<?php
namespace Psalm;
namespace Psalm\Scanner;
use Psalm\Type;
class VarDocblockComment
{

View File

@ -1,5 +1,8 @@
<?php
namespace Psalm;
namespace Psalm\Storage;
use Psalm\CodeLocation;
use Psalm\Type;
class FunctionLikeParameter
{

View File

@ -2,7 +2,6 @@
namespace Psalm\Storage;
use Psalm\CodeLocation;
use Psalm\FunctionLikeParameter;
use Psalm\Type;
class FunctionLikeStorage

View File

@ -2,7 +2,7 @@
namespace Psalm;
use Psalm\Exception\TypeParseTreeException;
use Psalm\FunctionLikeParameter;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Type\Atomic;
use Psalm\Type\Atomic\ObjectLike;
use Psalm\Type\Atomic\TArray;

View File

@ -1,7 +1,7 @@
<?php
namespace Psalm\Type\Atomic;
use Psalm\FunctionLikeParameter;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Type\Atomic;
use Psalm\Type\Union;

View File

@ -1,7 +1,7 @@
<?php
namespace Psalm\Type\Atomic;
use Psalm\FunctionLikeParameter;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Type\Union;
/**

View File

@ -19,7 +19,6 @@ use Psalm\Exception\FileIncludeException;
use Psalm\Exception\IncorrectDocblockException;
use Psalm\Exception\TypeParseTreeException;
use Psalm\FileSource;
use Psalm\FunctionLikeParameter;
use Psalm\Issue\DuplicateClass;
use Psalm\Issue\DuplicateParam;
use Psalm\Issue\InvalidDocblock;
@ -29,6 +28,7 @@ use Psalm\IssueBuffer;
use Psalm\Scanner\FileScanner;
use Psalm\Storage\ClassLikeStorage;
use Psalm\Storage\FileStorage;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Storage\FunctionLikeStorage;
use Psalm\Storage\MethodStorage;
use Psalm\Storage\PropertyStorage;