diff --git a/CHANGELOG.md b/CHANGELOG.md index 2518249a..b8055ea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ * Add a way to merge an application `box.json` config file used by `castor:repack`command * Deprecate `Context::withPath()` in favor of `Context::withWorkingDirectory()` * Deprecate `path` argument in `capture()`, `exit_code()`, `run()`, `with()` in favor of `workingDirectory` +* Deprecate `Castor\TaskDescriptorCollection` in favor of + `Castor\Descriptor\TaskDescriptorCollection` ## 0.14.0 (2024-03-08) diff --git a/bin/generate-tests.php b/bin/generate-tests.php index db6c9065..581b58cb 100755 --- a/bin/generate-tests.php +++ b/bin/generate-tests.php @@ -4,7 +4,7 @@ require __DIR__ . '/../vendor/autoload.php'; use Castor\Console\ApplicationFactory; -use Castor\PlatformUtil; +use Castor\PlatformHelper; use Castor\Tests\Helper\OutputCleaner; use Castor\Tests\Helper\WebServerHelper; use Symfony\Component\Console\Input\ArrayInput; @@ -19,7 +19,7 @@ WebServerHelper::start(); $fs = new Filesystem(); -$fs->remove(PlatformUtil::getCacheDirectory()); +$fs->remove(PlatformHelper::getCacheDirectory()); $fs->remove(__DIR__ . '/../tests/Examples/Generated'); $fs->mkdir(__DIR__ . '/../tests/Examples/Generated'); diff --git a/src/Console/Application.php b/src/Console/Application.php index 4aad94d5..10a6a810 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -4,23 +4,23 @@ use Castor\Console\Command\SymfonyTaskCommand; use Castor\Console\Command\TaskCommand; +use Castor\Console\Output\SectionOutput; +use Castor\Console\Output\VerbosityLevel; use Castor\Context; -use Castor\ContextDescriptor; -use Castor\ContextGeneratorDescriptor; use Castor\ContextRegistry; +use Castor\Descriptor\ContextDescriptor; +use Castor\Descriptor\ContextGeneratorDescriptor; +use Castor\Descriptor\ListenerDescriptor; +use Castor\Descriptor\SymfonyTaskDescriptor; +use Castor\Descriptor\TaskDescriptor; +use Castor\Descriptor\TaskDescriptorCollection; use Castor\Event\AfterApplicationInitializationEvent; use Castor\EventDispatcher; use Castor\ExpressionLanguage; use Castor\Fingerprint\FingerprintHelper; use Castor\FunctionFinder; use Castor\GlobalHelper; -use Castor\ListenerDescriptor; -use Castor\PlatformUtil; -use Castor\SectionOutput; -use Castor\SymfonyTaskDescriptor; -use Castor\TaskDescriptor; -use Castor\TaskDescriptorCollection; -use Castor\VerbosityLevel; +use Castor\PlatformHelper; use Castor\WaitForHelper; use Monolog\Logger; use Psr\Cache\CacheItemPoolInterface; @@ -203,7 +203,7 @@ private function initializeApplication(InputInterface $input): TaskDescriptorCol $contextNames = $this->contextRegistry->getNames(); if ($contextNames) { - $defaultContext = PlatformUtil::getEnv('CASTOR_CONTEXT') ?: $this->contextRegistry->getDefaultName(); + $defaultContext = PlatformHelper::getEnv('CASTOR_CONTEXT') ?: $this->contextRegistry->getDefaultName(); $this->getDefinition()->addOption(new InputOption( 'context', diff --git a/src/Console/ApplicationFactory.php b/src/Console/ApplicationFactory.php index 98303351..6a4e5e29 100644 --- a/src/Console/ApplicationFactory.php +++ b/src/Console/ApplicationFactory.php @@ -14,7 +14,7 @@ use Castor\Listener\UpdateCastorListener; use Castor\Monolog\Processor\ProcessProcessor; use Castor\PathHelper; -use Castor\PlatformUtil; +use Castor\PlatformHelper; use Castor\Stub\StubsGenerator; use Castor\WaitForHelper; use Monolog\Logger; @@ -45,7 +45,7 @@ public static function create(): SymfonyApplication 'User-Agent' => 'Castor/' . Application::VERSION, ], ]); - $cacheDir = PlatformUtil::getCacheDirectory(); + $cacheDir = PlatformHelper::getCacheDirectory(); $cache = new FilesystemAdapter(directory: $cacheDir); $logger = new Logger('castor', [], [new ProcessProcessor()]); $fs = new Filesystem(); diff --git a/src/Console/Command/CompileCommand.php b/src/Console/Command/CompileCommand.php index 56ec06ff..c0f60689 100644 --- a/src/Console/Command/CompileCommand.php +++ b/src/Console/Command/CompileCommand.php @@ -3,7 +3,7 @@ namespace Castor\Console\Command; use Castor\PathHelper; -use Castor\PlatformUtil; +use Castor\PlatformHelper; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -55,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $phpBuildCacheKey = $this->generatePHPBuildCacheKey($input); - $spcBinaryPath = PlatformUtil::getCacheDirectory() . '/castor-php-static-compiler/' . $phpBuildCacheKey . '/spc'; + $spcBinaryPath = PlatformHelper::getCacheDirectory() . '/castor-php-static-compiler/' . $phpBuildCacheKey . '/spc'; $spcBinaryDir = \dirname($spcBinaryPath); $this->setupSPC( diff --git a/src/SectionOutput.php b/src/Console/Output/SectionOutput.php similarity index 99% rename from src/SectionOutput.php rename to src/Console/Output/SectionOutput.php index 3a37a6a0..407fe639 100644 --- a/src/SectionOutput.php +++ b/src/Console/Output/SectionOutput.php @@ -1,6 +1,6 @@ in(PlatformUtil::getCacheDirectory()) + ->in(PlatformHelper::getCacheDirectory()) ->contains('.fingerprint') ->files() as $file ) { @@ -32,7 +32,7 @@ private static function clearFingerprintsCache(): void foreach ( (new Finder()) - ->in(PlatformUtil::getCacheDirectory()) + ->in(PlatformHelper::getCacheDirectory()) ->notContains('.fingerprint') ->directories() as $directory ) { diff --git a/tests/Examples/Generated/ContextGeneratorArg2Test.php.err.txt b/tests/Examples/Generated/ContextGeneratorArg2Test.php.err.txt index 648c0e88..afa7afb4 100644 --- a/tests/Examples/Generated/ContextGeneratorArg2Test.php.err.txt +++ b/tests/Examples/Generated/ContextGeneratorArg2Test.php.err.txt @@ -1,5 +1,5 @@ -In FunctionFinder.php line 218: +In FunctionFinder.php line 223: Function "gen()" is not properly configured: The context generator "foo" must not have arguments. diff --git a/tests/Examples/Generated/ContextGeneratorArgTest.php.err.txt b/tests/Examples/Generated/ContextGeneratorArgTest.php.err.txt index 84f73c03..afa333da 100644 --- a/tests/Examples/Generated/ContextGeneratorArgTest.php.err.txt +++ b/tests/Examples/Generated/ContextGeneratorArgTest.php.err.txt @@ -1,5 +1,5 @@ -In FunctionFinder.php line 209: +In FunctionFinder.php line 214: Function "gen()" is not properly configured: The contexts generator must not have arguments. diff --git a/tests/Examples/Generated/ContextGeneratorNotCallableTest.php.err.txt b/tests/Examples/Generated/ContextGeneratorNotCallableTest.php.err.txt index 30497925..f07726cc 100644 --- a/tests/Examples/Generated/ContextGeneratorNotCallableTest.php.err.txt +++ b/tests/Examples/Generated/ContextGeneratorNotCallableTest.php.err.txt @@ -1,5 +1,5 @@ -In FunctionFinder.php line 214: +In FunctionFinder.php line 219: Function "gen()" is not properly configured: The context generator "foo" is not callable. diff --git a/tests/bin/compile-get-cache-key b/tests/bin/compile-get-cache-key index 551f85f7..84909ea4 100755 --- a/tests/bin/compile-get-cache-key +++ b/tests/bin/compile-get-cache-key @@ -4,7 +4,7 @@ require __DIR__ . '/../../vendor/autoload.php'; use Castor\Console\Command\CompileCommand; -use Castor\PlatformUtil; +use Castor\PlatformHelper; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; @@ -14,7 +14,7 @@ $command = (new class() extends CompileCommand { }} ) ->setCode(Closure::bind( - fn($input) => (print PlatformUtil::getCacheDirectory() . '/castor-php-static-compiler/' . $this->generatePHPBuildCacheKey($input)) && 0, + fn($input) => (print PlatformHelper::getCacheDirectory() . '/castor-php-static-compiler/' . $this->generatePHPBuildCacheKey($input)) && 0, null, CompileCommand::class ))