From 0027766a774154789544155db3dd36095179ee61 Mon Sep 17 00:00:00 2001 From: Lukas Rosenstock Date: Fri, 19 Jun 2026 13:42:25 +0000 Subject: [PATCH] Fixed command interfaces --- classes/Commands/ClassCreateCommand.php | 3 ++- classes/Commands/ClassDeployCommand.php | 4 +++- classes/Commands/ClassTestEnvCommand.php | 4 +++- classes/Commands/ClassTestEnvRPCCommand.php | 4 +++- classes/Commands/ClassValidateCommand.php | 4 +++- classes/Commands/DependenciesAddAttachmentCommand.php | 4 +++- classes/Commands/DependenciesAddClassCommand.php | 4 +++- classes/Commands/DependenciesAddStaticTextCommand.php | 4 +++- classes/Commands/DependenciesAddTemplateCommand.php | 4 +++- classes/Commands/DependenciesAddWebAPICommand.php | 4 +++- classes/Commands/InterfaceCreateCommand.php | 3 ++- classes/Commands/InterfaceDeployCommand.php | 4 +++- classes/Commands/InterfaceValidateCommand.php | 4 +++- classes/Commands/TestEnvironmentStartCommand.php | 3 ++- 14 files changed, 39 insertions(+), 14 deletions(-) diff --git a/classes/Commands/ClassCreateCommand.php b/classes/Commands/ClassCreateCommand.php index d8a5c13..d7ffc96 100644 --- a/classes/Commands/ClassCreateCommand.php +++ b/classes/Commands/ClassCreateCommand.php @@ -110,7 +110,7 @@ class ClassCreateCommand extends Command { ]; } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { if (!CredentialManager::isConfigured()) throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized."); @@ -238,6 +238,7 @@ class ClassCreateCommand extends Command { $output->writeln("Calling cloudobjects ..."); passthru("cloudobjects configuration-job:create ".$fullName.".xml"); } + return Command::SUCCESS; } } diff --git a/classes/Commands/ClassDeployCommand.php b/classes/Commands/ClassDeployCommand.php index 4e38ec0..ed20c7f 100644 --- a/classes/Commands/ClassDeployCommand.php +++ b/classes/Commands/ClassDeployCommand.php @@ -9,6 +9,7 @@ namespace CloudObjects\PhpMAE\Commands; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\SDK\COIDParser; use CloudObjects\PhpMAE\ClassValidator; @@ -20,7 +21,7 @@ class ClassDeployCommand extends AbstractObjectCommand { ->addArgument('coid', InputArgument::REQUIRED, 'The COID of the object.'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->requireCloudObjectsCLI(); $this->parse($input->getArgument('coid')); @@ -67,6 +68,7 @@ class ClassDeployCommand extends AbstractObjectCommand { break; } $output->writeln(""); + return Command::SUCCESS; } } diff --git a/classes/Commands/ClassTestEnvCommand.php b/classes/Commands/ClassTestEnvCommand.php index f956349..43708d7 100644 --- a/classes/Commands/ClassTestEnvCommand.php +++ b/classes/Commands/ClassTestEnvCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use ML\IRI\IRI; use Guzzle\Http\Exception\BadResponseException; use CloudObjects\SDK\COIDParser; @@ -55,7 +56,7 @@ class ClassTestEnvCommand extends AbstractObjectCommand { } } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->requireCloudObjectsCLI(); $container = $this->getContainer(); @@ -93,6 +94,7 @@ class ClassTestEnvCommand extends AbstractObjectCommand { $cmd->upload($output); }); } + return Command::SUCCESS; } } diff --git a/classes/Commands/ClassTestEnvRPCCommand.php b/classes/Commands/ClassTestEnvRPCCommand.php index a2ba5d7..923109b 100644 --- a/classes/Commands/ClassTestEnvRPCCommand.php +++ b/classes/Commands/ClassTestEnvRPCCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use JsonRpc\Client; use CloudObjects\PhpMAE\TestEnvironmentManager; @@ -33,7 +34,7 @@ class ClassTestEnvRPCCommand extends AbstractObjectCommand { ->addArgument('parameters', InputArgument::IS_ARRAY, 'The parameters for the method.'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->requireCloudObjectsCLI(); $container = $this->getContainer(); @@ -68,6 +69,7 @@ class ClassTestEnvRPCCommand extends AbstractObjectCommand { : json_encode($client->result, JSON_PRETTY_PRINT)); else $output->writeln("RPC has failed!"); + return Command::SUCCESS; } } diff --git a/classes/Commands/ClassValidateCommand.php b/classes/Commands/ClassValidateCommand.php index 400aa14..3003d3e 100644 --- a/classes/Commands/ClassValidateCommand.php +++ b/classes/Commands/ClassValidateCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\PhpMAE\ClassValidator; class ClassValidateCommand extends AbstractObjectCommand { @@ -22,7 +23,7 @@ class ClassValidateCommand extends AbstractObjectCommand { ->addOption('watch', null, InputOption::VALUE_NONE, 'Keep watching for changes of the file and revalidate automatically.'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->parse($input->getArgument('coid')); $this->assertRDF(); if (!in_array('coid://phpmae.dev/Class', $this->rdfTypes) @@ -52,6 +53,7 @@ class ClassValidateCommand extends AbstractObjectCommand { } }); } + return Command::SUCCESS; } } diff --git a/classes/Commands/DependenciesAddAttachmentCommand.php b/classes/Commands/DependenciesAddAttachmentCommand.php index 0a8cd2f..e4bbc73 100644 --- a/classes/Commands/DependenciesAddAttachmentCommand.php +++ b/classes/Commands/DependenciesAddAttachmentCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\SDK\COIDParser; class DependenciesAddAttachmentCommand extends AbstractObjectCommand { @@ -22,7 +23,7 @@ class DependenciesAddAttachmentCommand extends AbstractObjectCommand { ->addOption('upload', null, InputOption::VALUE_NONE, 'Calls "cloudobjects" to actually upload the file to CloudObjects.'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->requireCloudObjectsCLI(); $this->parse($input->getArgument('coid-target')); @@ -58,6 +59,7 @@ class DependenciesAddAttachmentCommand extends AbstractObjectCommand { $output->writeln("Calling cloudobjects ..."); passthru("cloudobjects attachment:put ".(string)$this->coid." ".$filename); } + return Command::SUCCESS; } } diff --git a/classes/Commands/DependenciesAddClassCommand.php b/classes/Commands/DependenciesAddClassCommand.php index 9b43230..e63a9b1 100644 --- a/classes/Commands/DependenciesAddClassCommand.php +++ b/classes/Commands/DependenciesAddClassCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\SDK\COIDParser; class DependenciesAddClassCommand extends AbstractAddDependenciesCommand { @@ -24,7 +25,7 @@ class DependenciesAddClassCommand extends AbstractAddDependenciesCommand { parent::configure(); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->requireCloudObjectsCLI(); $this->parse($input->getArgument('coid-target')); @@ -73,6 +74,7 @@ class DependenciesAddClassCommand extends AbstractAddDependenciesCommand { $output->writeln("You can find the documentation for the available class methods on this page:"); $output->writeln("➡️ https://cloudobjects.io/".$coidClass->getHost().$coidClass->getPath()); $output->writeln(""); + return Command::SUCCESS; } } diff --git a/classes/Commands/DependenciesAddStaticTextCommand.php b/classes/Commands/DependenciesAddStaticTextCommand.php index 02b9a94..8605df2 100644 --- a/classes/Commands/DependenciesAddStaticTextCommand.php +++ b/classes/Commands/DependenciesAddStaticTextCommand.php @@ -9,6 +9,7 @@ namespace CloudObjects\PhpMAE\Commands; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\SDK\COIDParser; class DependenciesAddStaticTextCommand extends AbstractAddDependenciesCommand { @@ -23,7 +24,7 @@ class DependenciesAddStaticTextCommand extends AbstractAddDependenciesCommand { parent::configure(); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->requireCloudObjectsCLI(); $this->parse($input->getArgument('coid-target')); @@ -58,6 +59,7 @@ class DependenciesAddStaticTextCommand extends AbstractAddDependenciesCommand { $output->writeln(""); $output->writeln("3) Use \$this->".$key." wherever required."); $output->writeln(""); + return Command::SUCCESS; } } diff --git a/classes/Commands/DependenciesAddTemplateCommand.php b/classes/Commands/DependenciesAddTemplateCommand.php index d979d4d..43c3a59 100644 --- a/classes/Commands/DependenciesAddTemplateCommand.php +++ b/classes/Commands/DependenciesAddTemplateCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\SDK\COIDParser; class DependenciesAddTemplateCommand extends AbstractAddDependenciesCommand { @@ -25,7 +26,7 @@ class DependenciesAddTemplateCommand extends AbstractAddDependenciesCommand { parent::configure(); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->requireCloudObjectsCLI(); $this->parse($input->getArgument('coid-target')); @@ -70,6 +71,7 @@ class DependenciesAddTemplateCommand extends AbstractAddDependenciesCommand { $output->writeln(""); $output->writeln("3) Render your template by calling \$this->".$key."Template->render(\$context)."); $output->writeln(""); + return Command::SUCCESS; } } diff --git a/classes/Commands/DependenciesAddWebAPICommand.php b/classes/Commands/DependenciesAddWebAPICommand.php index df8003c..b124af9 100644 --- a/classes/Commands/DependenciesAddWebAPICommand.php +++ b/classes/Commands/DependenciesAddWebAPICommand.php @@ -9,6 +9,7 @@ namespace CloudObjects\PhpMAE\Commands; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\SDK\COIDParser; class DependenciesAddWebAPICommand extends AbstractAddDependenciesCommand { @@ -23,7 +24,7 @@ class DependenciesAddWebAPICommand extends AbstractAddDependenciesCommand { parent::configure(); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->requireCloudObjectsCLI(); $this->parse($input->getArgument('coid-target')); @@ -67,6 +68,7 @@ class DependenciesAddWebAPICommand extends AbstractAddDependenciesCommand { $output->writeln(""); $output->writeln("3) Make API requests in your class by calling methods on \$this->".$key."Api."); $output->writeln(""); + return Command::SUCCESS; } } diff --git a/classes/Commands/InterfaceCreateCommand.php b/classes/Commands/InterfaceCreateCommand.php index 7ba2e00..2778664 100644 --- a/classes/Commands/InterfaceCreateCommand.php +++ b/classes/Commands/InterfaceCreateCommand.php @@ -25,7 +25,7 @@ class InterfaceCreateCommand extends Command { ->addOption('confjob', null, InputOption::VALUE_OPTIONAL, 'Calls "cloudobjects" to create a configuration job for the new interface.', false); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { if (!CredentialManager::isConfigured()) throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized."); @@ -79,6 +79,7 @@ class InterfaceCreateCommand extends Command { $output->writeln("Calling cloudobjects ..."); passthru("cloudobjects configuration-job:create ".$fullName.".xml"); } + return Command::SUCCESS; } } diff --git a/classes/Commands/InterfaceDeployCommand.php b/classes/Commands/InterfaceDeployCommand.php index 4ae4ba4..d912d40 100644 --- a/classes/Commands/InterfaceDeployCommand.php +++ b/classes/Commands/InterfaceDeployCommand.php @@ -9,6 +9,7 @@ namespace CloudObjects\PhpMAE\Commands; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\SDK\COIDParser; use CloudObjects\PhpMAE\ClassValidator; @@ -20,7 +21,7 @@ class InterfaceDeployCommand extends AbstractObjectCommand { ->addArgument('coid', InputArgument::REQUIRED, 'The COID of the object.'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->parse($input->getArgument('coid')); $this->assertRDF(); if (!in_array('coid://phpmae.dev/Interface', $this->rdfTypes)) @@ -45,6 +46,7 @@ class InterfaceDeployCommand extends AbstractObjectCommand { ? $object['coid://cloudobjects.io/isVisibleTo'][0]['value'] : 'coid://cloudobjects.io/Vendor'; $path = $this->coid->getHost().$this->coid->getPath(); + return Command::SUCCESS; } } diff --git a/classes/Commands/InterfaceValidateCommand.php b/classes/Commands/InterfaceValidateCommand.php index 2ca61ee..cbaf6f0 100644 --- a/classes/Commands/InterfaceValidateCommand.php +++ b/classes/Commands/InterfaceValidateCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Command\Command; use CloudObjects\PhpMAE\ClassValidator; class InterfaceValidateCommand extends AbstractObjectCommand { @@ -21,7 +22,7 @@ class InterfaceValidateCommand extends AbstractObjectCommand { ->addOption('watch', null, InputOption::VALUE_OPTIONAL, 'Keep watching for changes of the file and revalidate automatically.', null); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->parse($input->getArgument('coid')); $this->assertRDF(); if (!in_array('coid://phpmae.dev/Interface', $this->rdfTypes)) @@ -47,6 +48,7 @@ class InterfaceValidateCommand extends AbstractObjectCommand { $output->writeln(''.get_class($e).' '.$e->getMessage()); } }); + return Command::SUCCESS; } } diff --git a/classes/Commands/TestEnvironmentStartCommand.php b/classes/Commands/TestEnvironmentStartCommand.php index e34293e..2d83276 100644 --- a/classes/Commands/TestEnvironmentStartCommand.php +++ b/classes/Commands/TestEnvironmentStartCommand.php @@ -22,7 +22,7 @@ class TestEnvironmentStartCommand extends Command { ->addOption('host', null, InputOption::VALUE_OPTIONAL, 'Bind test environment to this host.', '127.0.0.1'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { if (!CredentialManager::isConfigured()) throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized."); @@ -49,6 +49,7 @@ class TestEnvironmentStartCommand extends Command { die("THRU!"); } } + return Command::SUCCESS; } }