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

Migrate Codebase-namespaced and FileManipulation-namespaced classes to internals

This commit is contained in:
Brown 2018-11-12 10:46:55 -05:00 committed by Matthew Brown
parent a338e76ef6
commit 0254322bed
41 changed files with 69 additions and 66 deletions

View File

@ -3,7 +3,7 @@ namespace Psalm\Example\Plugin;
use Psalm\Codebase;
use Psalm\CodeLocation;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\FileSource;
use Psalm\Plugin\Hook\AfterClassLikeExistenceCheckInterface;
use Psalm\StatementsSource;

View File

@ -7,7 +7,7 @@ use Psalm\Checker\StatementsChecker;
use Psalm\Codebase;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\IssueBuffer;
use Psalm\Issue\TypeCoercion;
use Psalm\Plugin\Hook\AfterExpressionAnalysisInterface;

View File

@ -5,7 +5,7 @@ use PhpParser;
use Psalm\Codebase;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\IssueBuffer;
use Psalm\Issue\TypeCoercion;
use Psalm\Plugin\Hook\AfterStatementAnalysisInterface;

View File

@ -71,7 +71,7 @@
<UnusedProperty>
<errorLevel type="info">
<file name="src/Psalm/FileManipulation/FunctionDocblockManipulator.php" />
<file name="src/Psalm/Internal/FileManipulation/FunctionDocblockManipulator.php" />
</errorLevel>
</UnusedProperty>

View File

@ -98,42 +98,42 @@ class Codebase
public $find_unused_code = false;
/**
* @var Codebase\Reflection
* @var Internal\Codebase\Reflection
*/
private $reflection;
/**
* @var Codebase\Scanner
* @var Internal\Codebase\Scanner
*/
public $scanner;
/**
* @var Codebase\Analyzer
* @var Internal\Codebase\Analyzer
*/
public $analyzer;
/**
* @var Codebase\Functions
* @var Internal\Codebase\Functions
*/
public $functions;
/**
* @var Codebase\ClassLikes
* @var Internal\Codebase\ClassLikes
*/
public $classlikes;
/**
* @var Codebase\Methods
* @var Internal\Codebase\Methods
*/
public $methods;
/**
* @var Codebase\Properties
* @var Internal\Codebase\Properties
*/
public $properties;
/**
* @var Codebase\Populator
* @var Internal\Codebase\Populator
*/
public $populator;
@ -179,9 +179,9 @@ class Codebase
self::$stubbed_constants = [];
$this->reflection = new Codebase\Reflection($providers->classlike_storage_provider, $this);
$this->reflection = new Internal\Codebase\Reflection($providers->classlike_storage_provider, $this);
$this->scanner = new Codebase\Scanner(
$this->scanner = new Internal\Codebase\Scanner(
$this,
$config,
$providers->file_storage_provider,
@ -193,24 +193,24 @@ class Codebase
$this->loadAnalyzer();
$this->functions = new Codebase\Functions($providers->file_storage_provider, $this->reflection);
$this->methods = new Codebase\Methods(
$this->functions = new Internal\Codebase\Functions($providers->file_storage_provider, $this->reflection);
$this->methods = new Internal\Codebase\Methods(
$config,
$providers->classlike_storage_provider,
$providers->file_reference_provider
);
$this->properties = new Codebase\Properties(
$this->properties = new Internal\Codebase\Properties(
$providers->classlike_storage_provider,
$providers->file_reference_provider
);
$this->classlikes = new Codebase\ClassLikes(
$this->classlikes = new Internal\Codebase\ClassLikes(
$this->config,
$providers->classlike_storage_provider,
$this->scanner,
$this->methods
);
$this->populator = new Codebase\Populator(
$this->populator = new Internal\Codebase\Populator(
$config,
$providers->classlike_storage_provider,
$providers->file_storage_provider,
@ -227,7 +227,7 @@ class Codebase
*/
private function loadAnalyzer()
{
$this->analyzer = new Codebase\Analyzer(
$this->analyzer = new Internal\Codebase\Analyzer(
$this->config,
$this->file_provider,
$this->file_storage_provider,

View File

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

View File

@ -7,7 +7,7 @@ use Psalm\Codebase;
use Psalm\CodeLocation;
use Psalm\Config;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulationBuffer;
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
use Psalm\Issue\DuplicateClass;
use Psalm\Issue\InaccessibleProperty;
use Psalm\Issue\InvalidClass;

View File

@ -5,7 +5,7 @@ use PhpParser;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\Exception\UnpreparedAnalysisException;
use Psalm\FileManipulation\FileManipulationBuffer;
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
use Psalm\IssueBuffer;
use Psalm\StatementsSource;
use Psalm\Type;

View File

@ -3,7 +3,7 @@ namespace Psalm\Internal\Analyzer;
use PhpParser;
use Psalm\Internal\Analyzer\Statements\Expression\AssertionFinder;
use Psalm\Codebase\CallMap;
use Psalm\Internal\Codebase\CallMap;
use Psalm\Context;
use Psalm\CodeLocation;
use Psalm\Issue\InvalidArgument;

View File

@ -16,7 +16,7 @@ use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Analyzer\TypeAnalyzer;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\FileManipulation\FunctionDocblockManipulator;
use Psalm\Internal\FileManipulation\FunctionDocblockManipulator;
use Psalm\Issue\InvalidFalsableReturnType;
use Psalm\Issue\InvalidNullableReturnType;
use Psalm\Issue\InvalidReturnType;

View File

@ -9,10 +9,10 @@ use Psalm\Codebase;
use Psalm\Internal\Analyzer\FunctionLike\ReturnTypeAnalyzer;
use Psalm\Internal\Analyzer\FunctionLike\ReturnTypeCollector;
use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer;
use Psalm\Codebase\CallMap;
use Psalm\Internal\Codebase\CallMap;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\FileManipulation\FunctionDocblockManipulator;
use Psalm\Internal\FileManipulation\FunctionDocblockManipulator;
use Psalm\Issue\InvalidParamDefault;
use Psalm\Issue\MismatchingDocblockParamType;
use Psalm\Issue\MissingClosureParamType;

View File

@ -7,10 +7,10 @@ use Psalm\Internal\Analyzer\FunctionLikeAnalyzer;
use Psalm\Internal\Analyzer\ProjectAnalyzer;
use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Codebase\CallMap;
use Psalm\Internal\Codebase\CallMap;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulationBuffer;
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
use Psalm\Issue\ForbiddenCode;
use Psalm\Issue\InvalidFunctionCall;
use Psalm\Issue\NullFunctionCall;

View File

@ -8,11 +8,11 @@ use Psalm\Internal\Analyzer\MethodAnalyzer;
use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Analyzer\TypeAnalyzer;
use Psalm\Codebase\CallMap;
use Psalm\Internal\Codebase\CallMap;
use Psalm\CodeLocation;
use Psalm\Config;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulationBuffer;
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
use Psalm\Issue\InvalidMethodCall;
use Psalm\Issue\InvalidPropertyAssignmentValue;
use Psalm\Issue\InvalidScope;

View File

@ -10,7 +10,7 @@ use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\CodeLocation;
use Psalm\Config;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulationBuffer;
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
use Psalm\Issue\DeprecatedClass;
use Psalm\Issue\InvalidStringClass;
use Psalm\Issue\ParentNotFound;

View File

@ -8,7 +8,7 @@ use Psalm\Internal\Analyzer\MethodAnalyzer;
use Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Analyzer\TypeAnalyzer;
use Psalm\Codebase\CallMap;
use Psalm\Internal\Codebase\CallMap;
use Psalm\CodeLocation;
use Psalm\Context;
use Psalm\Issue\ImplicitToStringCast;

View File

@ -28,7 +28,7 @@ use Psalm\CodeLocation;
use Psalm\Config;
use Psalm\Context;
use Psalm\Exception\DocblockParseException;
use Psalm\FileManipulation\FileManipulationBuffer;
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
use Psalm\FileSource;
use Psalm\Issue\ForbiddenCode;
use Psalm\Issue\InvalidCast;

View File

@ -23,8 +23,8 @@ use Psalm\Config;
use Psalm\Context;
use Psalm\DocComment;
use Psalm\Exception\DocblockParseException;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation\FileManipulationBuffer;
use Psalm\FileManipulation;
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
use Psalm\Issue\ContinueOutsideLoop;
use Psalm\Issue\ForbiddenCode;
use Psalm\Issue\ForbiddenEcho;

View File

@ -1,13 +1,13 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use PhpParser;
use Psalm\Internal\Analyzer\FileAnalyzer;
use Psalm\Internal\Analyzer\ProjectAnalyzer;
use Psalm\Config;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation\FileManipulationBuffer;
use Psalm\FileManipulation\FunctionDocblockManipulator;
use Psalm\FileManipulation;
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
use Psalm\Internal\FileManipulation\FunctionDocblockManipulator;
use Psalm\IssueBuffer;
use Psalm\Internal\Provider\ClassLikeStorageProvider;
use Psalm\Internal\Provider\FileProvider;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use Psalm\Type;
use Psalm\Storage\FunctionLikeParameter;
@ -136,7 +136,7 @@ class CallMap
}
/** @var array<string, array<int|string, string>> */
$call_map = require_once(__DIR__ . '/../Internal/CallMap.php');
$call_map = require_once(__DIR__ . '/../CallMap.php');
self::$call_map = [];

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use PhpParser;
use Psalm\Aliases;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use Psalm\Codebase;
use Psalm\Internal\Analyzer\ProjectAnalyzer;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use PhpParser;
use Psalm\Internal\Analyzer\MethodAnalyzer;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use Psalm\Internal\Analyzer\ClassLikeAnalyzer;
use Psalm\Config;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use Psalm\CodeLocation;
use Psalm\Internal\Provider\ClassLikeStorageProvider;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
class PropertyMap
{
@ -22,7 +22,7 @@ class PropertyMap
}
/** @var array<string, array<string, string>> */
$property_map = require_once(__DIR__ . '/../Internal/PropertyMap.php');
$property_map = require_once(__DIR__ . '/../PropertyMap.php');
self::$property_map = [];

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use Psalm\Internal\Analyzer\ClassLikeAnalyzer;
use Psalm\Internal\Analyzer\CommentAnalyzer;

View File

@ -1,5 +1,5 @@
<?php
namespace Psalm\Codebase;
namespace Psalm\Internal\Codebase;
use Psalm\Codebase;
use Psalm\Config;

View File

@ -1,5 +1,7 @@
<?php
namespace Psalm\FileManipulation;
namespace Psalm\Internal\FileManipulation;
use Psalm\FileManipulation;
class FileManipulationBuffer
{

View File

@ -1,5 +1,7 @@
<?php
namespace Psalm\FileManipulation;
namespace Psalm\Internal\FileManipulation;
use Psalm\FileManipulation;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\FunctionLike;

View File

@ -10,8 +10,8 @@ use Psalm\Internal\Analyzer\Statements\Expression\CallAnalyzer;
use Psalm\Internal\Analyzer\Statements\Expression\IncludeAnalyzer;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Codebase;
use Psalm\Codebase\CallMap;
use Psalm\Codebase\PropertyMap;
use Psalm\Internal\Codebase\CallMap;
use Psalm\Internal\Codebase\PropertyMap;
use Psalm\CodeLocation;
use Psalm\Config;
use Psalm\DocComment;

View File

@ -3,7 +3,7 @@ namespace Psalm\Plugin\Hook;
use Psalm\CodeLocation;
use Psalm\Codebase;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\StatementsSource;
interface AfterClassLikeExistenceCheckInterface

View File

@ -3,7 +3,7 @@ namespace Psalm\Plugin\Hook;
use PhpParser\Node\Stmt\ClassLike;
use Psalm\Codebase;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\StatementsSource;
use Psalm\Storage\ClassLikeStorage;

View File

@ -4,7 +4,7 @@ namespace Psalm\Plugin\Hook;
use PhpParser\Node\Expr;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\StatementsSource;
interface AfterExpressionAnalysisInterface

View File

@ -4,7 +4,7 @@ namespace Psalm\Plugin\Hook;
use PhpParser\Node\Expr\FuncCall;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\StatementsSource;
use Psalm\Type\Union;

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\StatementsSource;
use Psalm\Type\Union;

View File

@ -4,7 +4,7 @@ namespace Psalm\Plugin\Hook;
use PhpParser\Node\Stmt;
use Psalm\Codebase;
use Psalm\Context;
use Psalm\FileManipulation\FileManipulation;
use Psalm\FileManipulation;
use Psalm\StatementsSource;
interface AfterStatementAnalysisInterface

View File

@ -238,7 +238,6 @@ class ConfigTest extends TestCase
<directory name="src" />
<directory name="examples" />
<ignoreFiles>
<file name="**/**/**/*Analyzer.php" />
<file name="**/**/**/**/*Analyzer.php" />
<file name="**/**/**/**/**/*Analyzer.php" />
</ignoreFiles>

View File

@ -64,7 +64,7 @@ class DocumentationTest extends TestCase
public function setUp()
{
FileAnalyzer::clearCache();
\Psalm\FileManipulation\FunctionDocblockManipulator::clearCache();
\Psalm\Internal\FileManipulation\FunctionDocblockManipulator::clearCache();
$this->file_provider = new Provider\FakeFileProvider();

View File

@ -15,7 +15,7 @@ class FileManipulationTest extends TestCase
public function setUp()
{
FileAnalyzer::clearCache();
\Psalm\FileManipulation\FunctionDocblockManipulator::clearCache();
\Psalm\Internal\FileManipulation\FunctionDocblockManipulator::clearCache();
$this->file_provider = new Provider\FakeFileProvider();
}

View File

@ -15,7 +15,7 @@ class FileReferenceTest extends TestCase
public function setUp()
{
FileAnalyzer::clearCache();
\Psalm\FileManipulation\FunctionDocblockManipulator::clearCache();
\Psalm\Internal\FileManipulation\FunctionDocblockManipulator::clearCache();
$this->file_provider = new Provider\FakeFileProvider();

View File

@ -731,6 +731,6 @@ class TypeParseTest extends TestCase
*/
public function providerTestValidCallMapType()
{
return \Psalm\Codebase\CallMap::getCallMap();
return \Psalm\Internal\Codebase\CallMap::getCallMap();
}
}