From 0254322beda6cc21e3c903a9c09076665c27d399 Mon Sep 17 00:00:00 2001 From: Brown Date: Mon, 12 Nov 2018 10:46:55 -0500 Subject: [PATCH] Migrate Codebase-namespaced and FileManipulation-namespaced classes to internals --- examples/plugins/ClassUnqualifier.php | 2 +- examples/plugins/StringChecker.php | 2 +- .../echo-checker/EchoChecker.php | 2 +- psalm.xml.dist | 2 +- src/Psalm/Codebase.php | 32 +++++++++---------- .../FileManipulation.php | 2 +- .../Internal/Analyzer/ClassLikeAnalyzer.php | 2 +- src/Psalm/Internal/Analyzer/FileAnalyzer.php | 2 +- .../Internal/Analyzer/FunctionAnalyzer.php | 2 +- .../FunctionLike/ReturnTypeAnalyzer.php | 2 +- .../Analyzer/FunctionLikeAnalyzer.php | 4 +-- .../Expression/Call/FunctionCallAnalyzer.php | 4 +-- .../Expression/Call/MethodCallAnalyzer.php | 4 +-- .../Expression/Call/StaticCallAnalyzer.php | 2 +- .../Statements/Expression/CallAnalyzer.php | 2 +- .../Statements/ExpressionAnalyzer.php | 2 +- .../Internal/Analyzer/StatementsAnalyzer.php | 4 +-- .../{ => Internal}/Codebase/Analyzer.php | 8 ++--- src/Psalm/{ => Internal}/Codebase/CallMap.php | 4 +-- .../{ => Internal}/Codebase/ClassLikes.php | 2 +- .../{ => Internal}/Codebase/Functions.php | 2 +- src/Psalm/{ => Internal}/Codebase/Methods.php | 2 +- .../{ => Internal}/Codebase/Populator.php | 2 +- .../{ => Internal}/Codebase/Properties.php | 2 +- .../{ => Internal}/Codebase/PropertyMap.php | 4 +-- .../{ => Internal}/Codebase/Reflection.php | 2 +- src/Psalm/{ => Internal}/Codebase/Scanner.php | 2 +- .../FileManipulationBuffer.php | 4 ++- .../FunctionDocblockManipulator.php | 4 ++- .../Visitor/DependencyFinderVisitor.php | 4 +-- .../AfterClassLikeExistenceCheckInterface.php | 2 +- .../Hook/AfterClassLikeVisitInterface.php | 2 +- .../Hook/AfterExpressionAnalysisInterface.php | 2 +- .../AfterFunctionCallAnalysisInterface.php | 2 +- .../Hook/AfterMethodCallAnalysisInterface.php | 2 +- .../Hook/AfterStatementAnalysisInterface.php | 2 +- tests/ConfigTest.php | 1 - tests/DocumentationTest.php | 2 +- tests/FileManipulationTest.php | 2 +- tests/FileReferenceTest.php | 2 +- tests/TypeParseTest.php | 2 +- 41 files changed, 69 insertions(+), 66 deletions(-) rename src/Psalm/{FileManipulation => }/FileManipulation.php (92%) rename src/Psalm/{ => Internal}/Codebase/Analyzer.php (99%) rename src/Psalm/{ => Internal}/Codebase/CallMap.php (97%) rename src/Psalm/{ => Internal}/Codebase/ClassLikes.php (99%) rename src/Psalm/{ => Internal}/Codebase/Functions.php (99%) rename src/Psalm/{ => Internal}/Codebase/Methods.php (99%) rename src/Psalm/{ => Internal}/Codebase/Populator.php (99%) rename src/Psalm/{ => Internal}/Codebase/Properties.php (99%) rename src/Psalm/{ => Internal}/Codebase/PropertyMap.php (90%) rename src/Psalm/{ => Internal}/Codebase/Reflection.php (99%) rename src/Psalm/{ => Internal}/Codebase/Scanner.php (99%) rename src/Psalm/{ => Internal}/FileManipulation/FileManipulationBuffer.php (93%) rename src/Psalm/{ => Internal}/FileManipulation/FunctionDocblockManipulator.php (99%) diff --git a/examples/plugins/ClassUnqualifier.php b/examples/plugins/ClassUnqualifier.php index f94b1cfe7..5fac4dcd8 100644 --- a/examples/plugins/ClassUnqualifier.php +++ b/examples/plugins/ClassUnqualifier.php @@ -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; diff --git a/examples/plugins/StringChecker.php b/examples/plugins/StringChecker.php index dd3f96f3e..604abb2b6 100644 --- a/examples/plugins/StringChecker.php +++ b/examples/plugins/StringChecker.php @@ -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; diff --git a/examples/plugins/composer-based/echo-checker/EchoChecker.php b/examples/plugins/composer-based/echo-checker/EchoChecker.php index a90be136b..4d739e8c5 100644 --- a/examples/plugins/composer-based/echo-checker/EchoChecker.php +++ b/examples/plugins/composer-based/echo-checker/EchoChecker.php @@ -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; diff --git a/psalm.xml.dist b/psalm.xml.dist index 90c2272a9..662702fc6 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -71,7 +71,7 @@ - + diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index 491dc7073..69114751b 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -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, diff --git a/src/Psalm/FileManipulation/FileManipulation.php b/src/Psalm/FileManipulation.php similarity index 92% rename from src/Psalm/FileManipulation/FileManipulation.php rename to src/Psalm/FileManipulation.php index 74c07609f..e4725d110 100644 --- a/src/Psalm/FileManipulation/FileManipulation.php +++ b/src/Psalm/FileManipulation.php @@ -1,5 +1,5 @@ > */ - $call_map = require_once(__DIR__ . '/../Internal/CallMap.php'); + $call_map = require_once(__DIR__ . '/../CallMap.php'); self::$call_map = []; diff --git a/src/Psalm/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php similarity index 99% rename from src/Psalm/Codebase/ClassLikes.php rename to src/Psalm/Internal/Codebase/ClassLikes.php index 8705a50e1..8f455076c 100644 --- a/src/Psalm/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -1,5 +1,5 @@ > */ - $property_map = require_once(__DIR__ . '/../Internal/PropertyMap.php'); + $property_map = require_once(__DIR__ . '/../PropertyMap.php'); self::$property_map = []; diff --git a/src/Psalm/Codebase/Reflection.php b/src/Psalm/Internal/Codebase/Reflection.php similarity index 99% rename from src/Psalm/Codebase/Reflection.php rename to src/Psalm/Internal/Codebase/Reflection.php index c9a790de8..a21d5488c 100644 --- a/src/Psalm/Codebase/Reflection.php +++ b/src/Psalm/Internal/Codebase/Reflection.php @@ -1,5 +1,5 @@ - diff --git a/tests/DocumentationTest.php b/tests/DocumentationTest.php index 2c51d328f..722c5b5d7 100644 --- a/tests/DocumentationTest.php +++ b/tests/DocumentationTest.php @@ -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(); diff --git a/tests/FileManipulationTest.php b/tests/FileManipulationTest.php index d8f9e3c9d..23dbd1ad7 100644 --- a/tests/FileManipulationTest.php +++ b/tests/FileManipulationTest.php @@ -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(); } diff --git a/tests/FileReferenceTest.php b/tests/FileReferenceTest.php index 810b70f0e..9db3ff966 100644 --- a/tests/FileReferenceTest.php +++ b/tests/FileReferenceTest.php @@ -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(); diff --git a/tests/TypeParseTest.php b/tests/TypeParseTest.php index 62df13ae7..ac0fa193b 100644 --- a/tests/TypeParseTest.php +++ b/tests/TypeParseTest.php @@ -731,6 +731,6 @@ class TypeParseTest extends TestCase */ public function providerTestValidCallMapType() { - return \Psalm\Codebase\CallMap::getCallMap(); + return \Psalm\Internal\Codebase\CallMap::getCallMap(); } }