diff --git a/composer.json b/composer.json index 35e0803..8310897 100644 --- a/composer.json +++ b/composer.json @@ -11,16 +11,16 @@ ], "require": { "php": "^8.0", - "illuminate/contracts": "^8.82 || ^9.0", - "illuminate/filesystem": "^8.82 || ^9.0", - "illuminate/view": "^8.82 || ^9", - "phpstan/phpstan": "^1.7", - "reveal/template-phpstan-compiler": "^0.2" + "illuminate/contracts": "^8.82 || ^9.0 || ^10.0", + "illuminate/filesystem": "^8.82 || ^9.0 || ^10.0", + "illuminate/view": "^8.82 || ^9.9 || ^10.0", + "phpstan/phpstan": "^1.8.9", + "symplify/template-phpstan-compiler": "^10.0.20" }, "require-dev": { "doctrine/coding-standard": "^9.0", "ergebnis/composer-normalize": "^2.24", - "orchestra/testbench": "^6.24 || ^7.0", + "orchestra/testbench": "^6.24 || ^7.0 || ^8.0", "phpunit/phpunit": "^9.5", "roave/security-advisories": "dev-latest", "symplify/easy-testing": "^10.0" diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 69b2c73..9a6934c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -11,7 +11,7 @@ parameters: path: src/PHPParser/NodeVisitor/ViewFunctionArgumentsNodeVisitor.php - - message: "#^Creating new PHPStan\\\\Rules\\\\Registry is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#" + message: "#^Creating new PHPStan\\\\Rules\\\\DirectRegistry is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#" count: 1 path: src/Rules/BladeRule.php diff --git a/src/Compiler/BladeToPHPCompiler.php b/src/Compiler/BladeToPHPCompiler.php index 39ab6ed..7c4f877 100644 --- a/src/Compiler/BladeToPHPCompiler.php +++ b/src/Compiler/BladeToPHPCompiler.php @@ -20,8 +20,8 @@ use PhpParser\ParserFactory; use PhpParser\PrettyPrinter\Standard; use PHPStan\ShouldNotHappenException; -use Reveal\TemplatePHPStanCompiler\NodeFactory\VarDocNodeFactory; -use Reveal\TemplatePHPStanCompiler\ValueObject\VariableAndType; +use Symplify\TemplatePHPStanCompiler\NodeFactory\VarDocNodeFactory; +use Symplify\TemplatePHPStanCompiler\ValueObject\VariableAndType; use Throwable; use Vural\PHPStanBladeRule\Blade\PhpLineToTemplateLineResolver; use Vural\PHPStanBladeRule\PHPParser\ConvertArrayStringToArray; diff --git a/src/ErrorReporting/Blade/TemplateErrorsFactory.php b/src/ErrorReporting/Blade/TemplateErrorsFactory.php index c440c22..ef3317b 100644 --- a/src/ErrorReporting/Blade/TemplateErrorsFactory.php +++ b/src/ErrorReporting/Blade/TemplateErrorsFactory.php @@ -13,7 +13,7 @@ use function array_key_first; use function current; -/** @see \Reveal\TemplatePHPStanCompiler\Reporting\TemplateErrorsFactory */ +/** @see \Symplify\TemplatePHPStanCompiler\Reporting\TemplateErrorsFactory */ final class TemplateErrorsFactory { /** diff --git a/src/NodeAnalyzer/BladeViewMethodsMatcher.php b/src/NodeAnalyzer/BladeViewMethodsMatcher.php index 8637274..c22e309 100644 --- a/src/NodeAnalyzer/BladeViewMethodsMatcher.php +++ b/src/NodeAnalyzer/BladeViewMethodsMatcher.php @@ -10,7 +10,7 @@ use PHPStan\Analyser\Scope; use PHPStan\Type\ObjectType; use PHPStan\Type\ThisType; -use Reveal\TemplatePHPStanCompiler\ValueObject\RenderTemplateWithParameters; +use Symplify\TemplatePHPStanCompiler\ValueObject\RenderTemplateWithParameters; use function count; use function in_array; diff --git a/src/NodeAnalyzer/LaravelViewFunctionMatcher.php b/src/NodeAnalyzer/LaravelViewFunctionMatcher.php index 73c309a..1fa828b 100644 --- a/src/NodeAnalyzer/LaravelViewFunctionMatcher.php +++ b/src/NodeAnalyzer/LaravelViewFunctionMatcher.php @@ -6,7 +6,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; -use Reveal\TemplatePHPStanCompiler\ValueObject\RenderTemplateWithParameters; +use Symplify\TemplatePHPStanCompiler\ValueObject\RenderTemplateWithParameters; use function count; diff --git a/src/NodeAnalyzer/TemplateFilePathResolver.php b/src/NodeAnalyzer/TemplateFilePathResolver.php index 2244481..cc0b516 100644 --- a/src/NodeAnalyzer/TemplateFilePathResolver.php +++ b/src/NodeAnalyzer/TemplateFilePathResolver.php @@ -16,7 +16,7 @@ use function str_contains; use function str_replace; -/** @see \Reveal\TemplatePHPStanCompiler\NodeAnalyzer\TemplateFilePathResolver */ +/** @see \Symplify\TemplatePHPStanCompiler\NodeAnalyzer\TemplateFilePathResolver */ final class TemplateFilePathResolver { public function __construct( diff --git a/src/Rules/BladeRule.php b/src/Rules/BladeRule.php index 957cd14..da0b287 100644 --- a/src/Rules/BladeRule.php +++ b/src/Rules/BladeRule.php @@ -6,7 +6,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; -use PHPStan\Rules\Registry; +use PHPStan\Rules\DirectRegistry; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleError; use Vural\PHPStanBladeRule\NodeAnalyzer\BladeViewMethodsMatcher; @@ -25,7 +25,7 @@ public function __construct( private LaravelViewFunctionMatcher $laravelViewFunctionMatcher, private ViewRuleHelper $ruleHelper ) { - $this->ruleHelper->setRegistry(new Registry($rules)); + $this->ruleHelper->setRegistry(new DirectRegistry($rules)); } public function getNodeType(): string diff --git a/src/Rules/ViewRuleHelper.php b/src/Rules/ViewRuleHelper.php index d70973a..71cd3cc 100644 --- a/src/Rules/ViewRuleHelper.php +++ b/src/Rules/ViewRuleHelper.php @@ -8,11 +8,12 @@ use PHPStan\Analyser\Scope; use PHPStan\Rules\Registry; use PHPStan\Rules\RuleError; +use PHPStan\Collectors\Registry as CollectorRegistry; use PHPStan\ShouldNotHappenException; -use Reveal\TemplatePHPStanCompiler\PHPStan\FileAnalyserProvider; -use Reveal\TemplatePHPStanCompiler\TypeAnalyzer\TemplateVariableTypesResolver; -use Reveal\TemplatePHPStanCompiler\ValueObject\RenderTemplateWithParameters; -use Reveal\TemplatePHPStanCompiler\ValueObject\VariableAndType; +use Symplify\TemplatePHPStanCompiler\PHPStan\FileAnalyserProvider; +use Symplify\TemplatePHPStanCompiler\TypeAnalyzer\TemplateVariableTypesResolver; +use Symplify\TemplatePHPStanCompiler\ValueObject\RenderTemplateWithParameters; +use Symplify\TemplatePHPStanCompiler\ValueObject\VariableAndType; use Vural\PHPStanBladeRule\Compiler\BladeToPHPCompiler; use Vural\PHPStanBladeRule\ErrorReporting\Blade\TemplateErrorsFactory; @@ -38,6 +39,7 @@ public function __construct( private FileAnalyserProvider $fileAnalyserProvider, private TemplateErrorsFactory $templateErrorsFactory, private BladeToPHPCompiler $bladeToPhpCompiler, + private CollectorRegistry $collectorRegistry ) { } @@ -98,7 +100,7 @@ private function processTemplateFilePath( $fileAnalyser = $this->fileAnalyserProvider->provide(); - $fileAnalyserResult = $fileAnalyser->analyseFile($tmpFilePath, [], $this->registry, null); + $fileAnalyserResult = $fileAnalyser->analyseFile($tmpFilePath, [], $this->registry, $this->collectorRegistry, null); $ruleErrors = $fileAnalyserResult->getErrors(); diff --git a/src/ValueObject/PhpFileContentsWithLineMap.php b/src/ValueObject/PhpFileContentsWithLineMap.php index d5e0b1d..1de3c39 100644 --- a/src/ValueObject/PhpFileContentsWithLineMap.php +++ b/src/ValueObject/PhpFileContentsWithLineMap.php @@ -4,7 +4,7 @@ namespace Vural\PHPStanBladeRule\ValueObject; -/** @see \Reveal\TemplatePHPStanCompiler\ValueObject\PhpFileContentsWithLineMap */ +/** @see \Symplify\TemplatePHPStanCompiler\ValueObject\PhpFileContentsWithLineMap */ final class PhpFileContentsWithLineMap { /** diff --git a/tests/Compiler/BladeToPHPCompilerTest.php b/tests/Compiler/BladeToPHPCompilerTest.php index 1eccde1..f30c1f3 100644 --- a/tests/Compiler/BladeToPHPCompilerTest.php +++ b/tests/Compiler/BladeToPHPCompilerTest.php @@ -11,12 +11,12 @@ use PhpParser\ConstExprEvaluator; use PhpParser\PrettyPrinter\Standard; use PHPUnit\Framework\TestCase; -use Reveal\TemplatePHPStanCompiler\NodeFactory\VarDocNodeFactory; -use Reveal\TemplatePHPStanCompiler\ValueObject\VariableAndType; use Symplify\EasyTesting\DataProvider\StaticFixtureFinder; use Symplify\EasyTesting\DataProvider\StaticFixtureUpdater; use Symplify\EasyTesting\StaticFixtureSplitter; use Symplify\SmartFileSystem\SmartFileInfo; +use Symplify\TemplatePHPStanCompiler\NodeFactory\VarDocNodeFactory; +use Symplify\TemplatePHPStanCompiler\ValueObject\VariableAndType; use Vural\PHPStanBladeRule\Blade\PhpLineToTemplateLineResolver; use Vural\PHPStanBladeRule\Compiler\BladeToPHPCompiler; use Vural\PHPStanBladeRule\Compiler\FileNameAndLineNumberAddingPreCompiler; diff --git a/tests/Compiler/Fixture/PhpContentExtractor/echo_variable_with_comments.blade.php b/tests/Compiler/Fixture/PhpContentExtractor/echo_variable_with_comments.blade.php index 074a814..b365de7 100644 --- a/tests/Compiler/Fixture/PhpContentExtractor/echo_variable_with_comments.blade.php +++ b/tests/Compiler/Fixture/PhpContentExtractor/echo_variable_with_comments.blade.php @@ -4,6 +4,6 @@ }} ----- getByType(InvalidBinaryOperationRule::class)], self::getContainer()->getByType(BladeViewMethodsMatcher::class), self::getContainer()->getByType(LaravelViewFunctionMatcher::class), - new ViewRuleHelper( - self::getContainer()->getByType(TemplateVariableTypesResolver::class), - self::getContainer()->getByType(FileAnalyserProvider::class), - self::getContainer()->getByType(TemplateErrorsFactory::class), - self::getContainer()->getByType(BladeToPHPCompiler::class), - ) + self::getContainer()->getByType(ViewRuleHelper::class), ); } diff --git a/tests/Rules/LaravelViewFunctionRuleTest.php b/tests/Rules/LaravelViewFunctionRuleTest.php index 2ba1204..b3affe7 100644 --- a/tests/Rules/LaravelViewFunctionRuleTest.php +++ b/tests/Rules/LaravelViewFunctionRuleTest.php @@ -9,8 +9,8 @@ use PHPStan\Rules\Rule; use PHPStan\Rules\Variables\DefinedVariableRule; use PHPStan\Testing\RuleTestCase; -use Reveal\TemplatePHPStanCompiler\PHPStan\FileAnalyserProvider; -use Reveal\TemplatePHPStanCompiler\TypeAnalyzer\TemplateVariableTypesResolver; +use Symplify\TemplatePHPStanCompiler\PHPStan\FileAnalyserProvider; +use Symplify\TemplatePHPStanCompiler\TypeAnalyzer\TemplateVariableTypesResolver; use Vural\PHPStanBladeRule\Compiler\BladeToPHPCompiler; use Vural\PHPStanBladeRule\ErrorReporting\Blade\TemplateErrorsFactory; use Vural\PHPStanBladeRule\NodeAnalyzer\BladeViewMethodsMatcher; @@ -35,12 +35,7 @@ protected function getRule(): Rule ], self::getContainer()->getByType(BladeViewMethodsMatcher::class), self::getContainer()->getByType(LaravelViewFunctionMatcher::class), - new ViewRuleHelper( - self::getContainer()->getByType(TemplateVariableTypesResolver::class), - self::getContainer()->getByType(FileAnalyserProvider::class), - self::getContainer()->getByType(TemplateErrorsFactory::class), - self::getContainer()->getByType(BladeToPHPCompiler::class), - ) + self::getContainer()->getByType(ViewRuleHelper::class), ); } diff --git a/tests/tests.neon b/tests/tests.neon index 3b8fa8d..3489b81 100644 --- a/tests/tests.neon +++ b/tests/tests.neon @@ -1,6 +1,6 @@ includes: - ../config/extension.neon - - ../vendor/reveal/template-phpstan-compiler/config/services.neon + - ../vendor/symplify/template-phpstan-compiler/config/services.neon - ../vendor/symplify/astral/config/services.neon parameters: checkExplicitMixed: true \ No newline at end of file