diff --git a/lib/ACommandBase.php b/lib/ACommandBase.php deleted file mode 100644 index bf152a3f..00000000 --- a/lib/ACommandBase.php +++ /dev/null @@ -1,21 +0,0 @@ -setName('fulltextsearch:check') - ->addOption('json', 'j', InputOption::VALUE_NONE, 'return result as JSON') - ->setDescription('Check the installation'); - } - - /** - * @param InputInterface $input - * @param OutputInterface $output - * - * @return int * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - if ($input->getOption('json') === true) { - $output->writeln(json_encode($this->displayAsJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + public function __invoke(IOutput $output, OutputFormat $outputFormat): ExitCode { + if ($outputFormat !== OutputFormat::Plain) { + $output->writeArrayInOutputFormat($this->displayAsJson()); - return 0; + return ExitCode::Success; } $output->writeln('Full text search ' . $this->appConfig->getAppValueString('installed_version')); @@ -63,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->displayPlatform($output); $this->displayProviders($output); - return 0; + return ExitCode::Success; } @@ -118,11 +106,9 @@ private function displayAsJson(): array { /** - * @param OutputInterface $output - * * @throws Exception */ - private function displayPlatform(OutputInterface $output) { + private function displayPlatform(IOutput $output): void { $platforms = $this->platformService->getPlatforms(); if (empty($platforms)) { @@ -151,11 +137,9 @@ private function displayPlatform(OutputInterface $output) { /** - * @param OutputInterface $output - * * @throws Exception */ - private function displayProviders(OutputInterface $output) { + private function displayProviders(IOutput $output): void { $providers = $this->providerService->getProviders(); if (sizeof($providers) === 0) { diff --git a/lib/Command/CollectionDelete.php b/lib/Command/CollectionDelete.php index 98107a3e..78362692 100644 --- a/lib/Command/CollectionDelete.php +++ b/lib/Command/CollectionDelete.php @@ -9,14 +9,17 @@ namespace OCA\FullTextSearch\Command; -use OC\Core\Command\Base; use OCA\FullTextSearch\Exceptions\CollectionArgumentException; use OCA\FullTextSearch\Service\CollectionService; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\ExitCode; -class CollectionDelete extends Base { +#[AsCommand( + name: 'fulltextsearch:collection:delete', + description: 'Delete collection', +)] +class CollectionDelete { /** @var CollectionService */ @@ -27,37 +30,23 @@ class CollectionDelete extends Base { * @param CollectionService $collectionService */ public function __construct(CollectionService $collectionService) { - parent::__construct(); - $this->collectionService = $collectionService; } /** - * - */ - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:collection:delete') - ->setDescription('Delete collection') - ->addArgument('name', InputArgument::REQUIRED, 'name of the collection to delete'); - } - - - /** - * @param InputInterface $input - * @param OutputInterface $output - * - * @return int + * @throws CollectionArgumentException */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $collection = $input->getArgument('name'); - if (!$this->collectionService->hasCollection($collection)) { + public function __invoke( + #[Argument(description: 'name of the collection to delete')] + string $name, + ): ExitCode { + if (!$this->collectionService->hasCollection($name)) { throw new CollectionArgumentException('unknown collection'); } - $this->collectionService->deleteCollection($collection); + $this->collectionService->deleteCollection($name); - return 0; + return ExitCode::Success; } } diff --git a/lib/Command/CollectionInit.php b/lib/Command/CollectionInit.php index 82b86e5b..b61d1a75 100644 --- a/lib/Command/CollectionInit.php +++ b/lib/Command/CollectionInit.php @@ -10,20 +10,24 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\Base; use OCA\FullTextSearch\Model\IndexOptions; use OCA\FullTextSearch\Model\Runner; use OCA\FullTextSearch\Service\CliService; use OCA\FullTextSearch\Service\CollectionService; use OCA\FullTextSearch\Service\ProviderService; use OCA\FullTextSearch\Service\RunningService; +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\ExitCode; use OCP\FullTextSearch\IFullTextSearchProvider; use OCP\IUserManager; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class CollectionInit extends Base { +#[AsCommand( + name: 'fulltextsearch:collection:init', + description: 'Initiate a collection', +)] +class CollectionInit { /** @var ProviderService */ @@ -56,8 +60,6 @@ public function __construct( RunningService $runningService, CliService $cliService, ) { - parent::__construct(); - $this->userManager = $userManager; $this->collectionService = $collectionService; $this->providerService = $providerService; @@ -66,29 +68,23 @@ public function __construct( } - protected function configure(): void { - parent::configure(); - $this->setName('fulltextsearch:collection:init') - ->setDescription('Initiate a collection') - ->addArgument('name', InputArgument::REQUIRED, 'name of the collection'); - } - - /** * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $collection = $input->getArgument('name'); - $this->collectionService->confirmCollectionString($collection); + public function __invoke( + OutputInterface $output, + #[Argument(description: 'name of the collection')] + string $name, + ): ExitCode { + $this->collectionService->confirmCollectionString($name); $runner = new Runner($this->runningService, 'commandIndex', ['nextStep' => 'n']); - // $runner->sourceIsCommandLine($this, $output); $this->collectionService->setRunner($runner); $this->cliService->setRunner($runner); $this->cliService->createPanel( 'collection', [ - '┌─ Collection ' . $collection . ' ────', + '┌─ Collection ' . $name . ' ────', '│ ProviderId, UserId: %providerId% / %userId%', '│ Chunk: %chunkCurr:3s%/%chunkTotal%', '│ Document: %documentCurr:6s%/%documentChunk%', @@ -116,11 +112,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int $providers = $this->providerService->getProviders(); foreach ($providers as $providerWrapper) { - $this->indexProvider($runner, $collection, $providerWrapper->getProvider()); + $this->indexProvider($runner, $name, $providerWrapper->getProvider()); } - return 0; + return ExitCode::Success; } diff --git a/lib/Command/CollectionLink.php b/lib/Command/CollectionLink.php index fe6ddb90..82508740 100644 --- a/lib/Command/CollectionLink.php +++ b/lib/Command/CollectionLink.php @@ -9,64 +9,61 @@ namespace OCA\FullTextSearch\Command; -use OC\Core\Command\Base; use OCA\FullTextSearch\Exceptions\CollectionArgumentException; use OCA\FullTextSearch\Service\CollectionService; -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 OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\Attribute\Option; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; -class CollectionLink extends Base { +#[AsCommand( + name: 'fulltextsearch:collection:link', + description: 'Link collection to a user', +)] +class CollectionLink { public function __construct( private CollectionService $collectionService, ) { - parent::__construct(); - } - - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:collection:link') - ->setDescription('Link collection to a user') - ->addArgument('collection', InputArgument::OPTIONAL, 'collection', '') - ->addArgument('userId', InputArgument::OPTIONAL, 'user to link a collection to', '') - ->addOption('unlink', '', InputOption::VALUE_NONE, 'unlink collection'); } /** - * @param InputInterface $input - * @param OutputInterface $output - * - * @return int * @throws CollectionArgumentException */ - protected function execute(InputInterface $input, OutputInterface $output): int { + public function __invoke( + IOutput $output, + #[Argument(description: 'collection')] + string $collection = '', + #[Argument(description: 'user to link a collection to')] + string $userId = '', + #[Option(description: 'unlink collection')] + bool $unlink = false, + ): ExitCode { $links = $this->collectionService->getLinks(); - $collection = $input->getArgument('collection'); if ($collection === '') { if (empty($links)) { $output->writeln('no collection linked to any user'); } - foreach ($links as $name => $userId) { - $output->writeln('- Collection ' . $name . ' linked to user ' . $userId . ''); + foreach ($links as $name => $linkedUserId) { + $output->writeln('- Collection ' . $name . ' linked to user ' . $linkedUserId . ''); } - return 0; + return ExitCode::Success; } if (!$this->collectionService->hasCollection($collection)) { throw new CollectionArgumentException('unknown collection'); } - if ($input->getOption('unlink')) { + if ($unlink) { $this->collectionService->removeLink($collection); $output->writeln('unlinked collection'); - return 0; + + return ExitCode::Success; } - $userId = $input->getArgument('userId'); if ($userId === '') { throw new CollectionArgumentException('missing userId'); } @@ -74,6 +71,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->collectionService->addLink($collection, $userId); $output->writeln('linked collection'); - return 0; + return ExitCode::Success; } } diff --git a/lib/Command/CollectionList.php b/lib/Command/CollectionList.php index d6908517..76d08f21 100644 --- a/lib/Command/CollectionList.php +++ b/lib/Command/CollectionList.php @@ -9,45 +9,31 @@ namespace OCA\FullTextSearch\Command; -use OC\Core\Command\Base; use OCA\FullTextSearch\Service\CollectionService; use OCA\FullTextSearch\Service\ConfigService; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -class CollectionList extends Base { +use OCP\Console\Attribute\AsCommand; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; + +#[AsCommand( + name: 'fulltextsearch:collection:list', + description: 'List collections', +)] +class CollectionList { public function __construct( private CollectionService $collectionService, private ConfigService $configService, ) { - parent::__construct(); } - - /** - * - */ - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:collection:list') - ->setDescription('List collections'); - } - - - /** - * @param InputInterface $input - * @param OutputInterface $output - * - * @return int - */ - protected function execute(InputInterface $input, OutputInterface $output): int { + public function __invoke(IOutput $output): ExitCode { $collections = $this->collectionService->getCollections(); $output->writeln('found ' . sizeof($collections) . ' collection(s)'); - foreach ($this->collectionService->getCollections() as $collection) { + foreach ($collections as $collection) { $output->writeln('- ' . (($collection === $this->configService->getInternalCollection()) ? '*' : '') . $collection); } - return 0; + return ExitCode::Success; } } diff --git a/lib/Command/Configure.php b/lib/Command/Configure.php index 654e5b24..f00f20ca 100644 --- a/lib/Command/Configure.php +++ b/lib/Command/Configure.php @@ -9,32 +9,33 @@ namespace OCA\FullTextSearch\Command; -use OC\Core\Command\Base; use OCA\FullTextSearch\Service\ConfigService; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -class Configure extends Base { +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; + +#[AsCommand( + name: 'fulltextsearch:configure', + description: 'Configure the installation', +)] +class Configure { public function __construct( private ConfigService $configService, ) { - parent::__construct(); - } - - protected function configure(): void { - parent::configure(); - $this->setName('fulltextsearch:configure') - ->addArgument('json', InputArgument::OPTIONAL, 'set config') - ->setDescription('Configure the installation'); } - protected function execute(InputInterface $input, OutputInterface $output): int { - if ($input->getArgument('json')) { - $this->configService->setConfig(json_decode($input->getArgument('json'), true) ?? []); + public function __invoke( + IOutput $output, + #[Argument(description: 'set config')] + string $json = '', + ): ExitCode { + if ($json !== '') { + $this->configService->setConfig(json_decode($json, true) ?? []); } $output->writeln(json_encode($this->configService->getConfig(), JSON_PRETTY_PRINT)); - return self::SUCCESS; + + return ExitCode::Success; } } diff --git a/lib/Command/DocumentIndex.php b/lib/Command/DocumentIndex.php index 431ba437..cc99b813 100644 --- a/lib/Command/DocumentIndex.php +++ b/lib/Command/DocumentIndex.php @@ -10,47 +10,35 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\Base; use OCA\FullTextSearch\Model\Index; use OCA\FullTextSearch\Service\PlatformService; use OCA\FullTextSearch\Service\ProviderService; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -class DocumentIndex extends Base { +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\ExitCode; + +#[AsCommand( + name: 'fulltextsearch:document:index', + description: 'index one specific document', +)] +class DocumentIndex { public function __construct( private ProviderService $providerService, private PlatformService $platformService, ) { - parent::__construct(); } - /** - * - */ - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:document:index') - ->setDescription('index one specific document') - ->addArgument('userId', InputArgument::REQUIRED, 'userId') - ->addArgument('providerId', InputArgument::REQUIRED, 'providerId') - ->addArgument('documentId', InputArgument::REQUIRED, 'documentId'); - } - - /** - * @param InputInterface $input - * @param OutputInterface $output - * - * @return int * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $providerId = $input->getArgument('providerId'); - $documentId = $input->getArgument('documentId'); - $userId = $input->getArgument('userId'); - + public function __invoke( + #[Argument(description: 'userId')] + string $userId, + #[Argument(description: 'providerId')] + string $providerId, + #[Argument(description: 'documentId')] + string $documentId, + ): ExitCode { $providerWrapper = $this->providerService->getProvider($providerId); $provider = $providerWrapper->getProvider(); @@ -74,7 +62,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ->setStatus(Index::INDEX_FULL); $platform->indexDocument($indexDocument); - return 0; + return ExitCode::Success; } diff --git a/lib/Command/DocumentPlatform.php b/lib/Command/DocumentPlatform.php index 6d89c780..11ef1b0e 100644 --- a/lib/Command/DocumentPlatform.php +++ b/lib/Command/DocumentPlatform.php @@ -10,44 +10,36 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\Base; use OCA\FullTextSearch\Service\PlatformService; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -class DocumentPlatform extends Base { +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\Attribute\Option; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; + +#[AsCommand( + name: 'fulltextsearch:document:platform', + description: 'Get document from index', +)] +class DocumentPlatform { public function __construct( private PlatformService $platformService, ) { - parent::__construct(); } /** - * - */ - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:document:platform') - ->setDescription('Get document from index') - ->addArgument('providerId', InputArgument::REQUIRED, 'providerId') - ->addArgument('documentId', InputArgument::REQUIRED, 'documentId') - ->addOption('content', 'c', InputOption::VALUE_NONE, 'return some content'); - } - - - /** - * @param InputInterface $input - * @param OutputInterface $output - * * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $providerId = $input->getArgument('providerId'); - $documentId = $input->getArgument('documentId'); - + public function __invoke( + IOutput $output, + #[Argument(description: 'providerId')] + string $providerId, + #[Argument(description: 'documentId')] + string $documentId, + #[Option(description: 'return some content', shortcut: 'c')] + bool $content = false, + ): ExitCode { $wrapper = $this->platformService->getPlatform(); $platform = $wrapper->getPlatform(); @@ -55,13 +47,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $result = [ 'document' => $indexDocument ]; - if ($input->getOption('content') === true) { + if ($content === true) { $result['content'] = substr($indexDocument->getContent(), 0, 200); } $output->writeln(json_encode($result, JSON_PRETTY_PRINT)); - return 0; + return ExitCode::Success; } diff --git a/lib/Command/DocumentProvider.php b/lib/Command/DocumentProvider.php index 5f2f631e..41869a1a 100644 --- a/lib/Command/DocumentProvider.php +++ b/lib/Command/DocumentProvider.php @@ -10,48 +10,40 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\Base; use OCA\FullTextSearch\Model\Index; use OCA\FullTextSearch\Service\ProviderService; +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\Attribute\Option; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; use OCP\FullTextSearch\Model\IIndexDocument; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -class DocumentProvider extends Base { +#[AsCommand( + name: 'fulltextsearch:document:provider', + description: 'Get document from index', +)] +class DocumentProvider { public function __construct( private ProviderService $providerService, ) { - parent::__construct(); } /** - * - */ - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:document:provider') - ->setDescription('Get document from index') - ->addArgument('userId', InputArgument::REQUIRED, 'userId') - ->addArgument('providerId', InputArgument::REQUIRED, 'providerId') - ->addArgument('documentId', InputArgument::REQUIRED, 'documentId') - ->addOption('content', 'c', InputOption::VALUE_NONE, 'return some content'); - } - - - /** - * @param InputInterface $input - * @param OutputInterface $output - * * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $providerId = $input->getArgument('providerId'); - $documentId = $input->getArgument('documentId'); - $userId = $input->getArgument('userId'); - + public function __invoke( + IOutput $output, + #[Argument(description: 'userId')] + string $userId, + #[Argument(description: 'providerId')] + string $providerId, + #[Argument(description: 'documentId')] + string $documentId, + #[Option(description: 'return some content', shortcut: 'c')] + bool $content = false, + ): ExitCode { $providerWrapper = $this->providerService->getProvider($providerId); $provider = $providerWrapper->getProvider(); @@ -74,17 +66,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('Document: '); $output->writeln(json_encode($indexDocument, JSON_PRETTY_PRINT)); - if ($input->getOption('content') !== true) { - return 0; + if ($content !== true) { + return ExitCode::Success; } $output->writeln('Content: '); - $content = $indexDocument->getContent(); + $documentContent = $indexDocument->getContent(); if ($indexDocument->isContentEncoded() === IIndexDocument::ENCODED_BASE64) { - $content = base64_decode($content, true); + $documentContent = base64_decode($documentContent, true); } - $output->writeln(substr($content, 0, 80)); + $output->writeln(substr($documentContent, 0, 80)); $parts = $indexDocument->getParts(); $output->writeln(sizeof($parts) . ' Part(s)'); @@ -96,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); } - return 0; + return ExitCode::Success; } diff --git a/lib/Command/DocumentStatus.php b/lib/Command/DocumentStatus.php index 10b2bba5..e14c9fbc 100644 --- a/lib/Command/DocumentStatus.php +++ b/lib/Command/DocumentStatus.php @@ -10,16 +10,22 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\Base; use OCA\FullTextSearch\Exceptions\IndexDoesNotExistException; use OCA\FullTextSearch\Service\IndexService; +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\Attribute\Option; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; +use OCP\Console\OutputFormat; use OCP\FullTextSearch\Model\IIndex; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -class DocumentStatus extends Base { +#[AsCommand( + name: 'fulltextsearch:document:status', + description: 'change the status on one specific document', + supportsOutputFormat: true, +)] +class DocumentStatus { private array $statusAvailable = [ 'IGNORE' => 'document will never be indexed', 'INDEX' => 'document will be indexed', @@ -31,68 +37,54 @@ class DocumentStatus extends Base { public function __construct( private IndexService $indexService, ) { - parent::__construct(); } /** - * - */ - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:document:status') - ->setDescription('change the status on one specific document') - ->addArgument('provider', InputArgument::REQUIRED, 'Id of the provider') - ->addArgument('document', InputArgument::REQUIRED, 'If of the document') - ->addOption('value', '', InputOption::VALUE_REQUIRED, 'new status', '') - ->addOption('user', 'u', InputOption::VALUE_REQUIRED, 'specify the owner of the document', '') - ->addOption('json', 'j', InputOption::VALUE_NONE, 'return status in JSON'); - } - - - /** - * @param InputInterface $input - * @param OutputInterface $output - * * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $providerId = $input->getArgument('provider'); - $documentId = $input->getArgument('document'); - $value = $input->getOption('value'); - $userId = $input->getOption('user'); - $json = $input->getOption('json'); - + public function __invoke( + IOutput $output, + OutputFormat $outputFormat, + #[Argument(description: 'Id of the provider')] + string $provider, + #[Argument(description: 'If of the document')] + string $document, + #[Option(description: 'new status')] + string $value = '', + #[Option(description: 'specify the owner of the document', shortcut: 'u')] + string $user = '', + ): ExitCode { try { - $index = $this->indexService->getIndex($providerId, $documentId); + $index = $this->indexService->getIndex($provider, $document); if ($value !== '') { $status = $this->statusConvertFromString($value); $index->setStatus($status, true); $this->indexService->updateIndex($index); } } catch (IndexDoesNotExistException $e) { - if ($userId === '') { + if ($user === '') { throw new Exception( "Index is not known.\nIf you want to generate the entry, please specify the owner of the document using --user " ); } $status = $this->statusConvertFromString($value); - $index = $this->indexService->createIndex($providerId, $documentId, $userId, $status); + $index = $this->indexService->createIndex($provider, $document, $user, $status); } - if ($json) { - echo json_encode($index, JSON_PRETTY_PRINT) . "\n"; + if ($outputFormat !== OutputFormat::Plain) { + $output->writeArrayInOutputFormat(json_decode(json_encode($index), true)); - return 0; + return ExitCode::Success; } $status = $this->statusConvertToString($index->getStatus()); $desc = $this->statusAvailable[$status]; $output->writeln('current status: ' . $status . ' (' . $desc . ')'); - return 0; + return ExitCode::Success; } diff --git a/lib/Command/Index.php b/lib/Command/Index.php index e1065232..a34791d5 100644 --- a/lib/Command/Index.php +++ b/lib/Command/Index.php @@ -10,8 +10,6 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\InterruptedException; -use OCA\FullTextSearch\ACommandBase; use OCA\FullTextSearch\Exceptions\PlatformTemporaryException; use OCA\FullTextSearch\Exceptions\TickDoesNotExistException; use OCA\FullTextSearch\Model\Index as ModelIndex; @@ -23,17 +21,23 @@ use OCA\FullTextSearch\Service\ProviderService; use OCA\FullTextSearch\Service\RunningService; use OCA\FullTextSearch\Tools\Traits\TArrayTools; +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\Attribute\Option; +use OCP\Console\ExitCode; +use OCP\Console\ISignalHandler; use OCP\FullTextSearch\IFullTextSearchProvider; use OCP\IUserManager; use OutOfBoundsException; -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\Terminal; use Throwable; -class Index extends ACommandBase { +#[AsCommand( + name: 'fulltextsearch:index', + description: 'Index files', +)] +class Index { use TArrayTools; public const INDEX_OPTION_NO_READLINE = '_no-readline'; @@ -112,26 +116,21 @@ public function __construct( private PlatformService $platformService, private ProviderService $providerService, ) { - parent::__construct(); - } - - protected function configure(): void { - parent::configure(); - $this->setName('fulltextsearch:index') - ->setDescription('Index files') - ->addArgument('options', InputArgument::OPTIONAL, 'options') - ->addOption( - 'no-readline', 'r', InputOption::VALUE_NONE, - 'disable readline - non interactive mode' - ); } /** * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $options = $this->generateIndexOptions($input); + public function __invoke( + OutputInterface $output, + ISignalHandler $signalHandler, + #[Argument(name: 'options', description: 'options')] + string $optionsJson = '', + #[Option(name: 'no-readline', description: 'disable readline - non interactive mode', shortcut: 'r')] + bool $noReadline = false, + ): ExitCode { + $options = $this->generateIndexOptions($optionsJson, $noReadline); if ($options->getOptionBool(self::INDEX_OPTION_NO_READLINE, false) === false) { /** do not get stuck while waiting interactive input */ @@ -166,7 +165,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->runner->setInfo('options', json_encode($options)); try { - $this->runner->sourceIsCommandLine($this, $output); + $this->runner->sourceIsCommandLine($signalHandler, $output); $this->runner->start(); if ($options->getOption('errors') === 'reset') { @@ -200,7 +199,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->runner->setInfo('documentCurrent', 'all'); $this->runner->stop(); - return self::SUCCESS; + return ExitCode::Success; } @@ -323,15 +322,14 @@ private function indexProvider(IFullTextSearchProvider $provider, IndexOptions $ /** - * @param InputInterface $input + * @param string $jsonOptions + * @param bool $noReadline * * @return IndexOptions */ - private function generateIndexOptions(InputInterface $input): IndexOptions { - $jsonOptions = $input->getArgument('options'); - + private function generateIndexOptions(string $jsonOptions, bool $noReadline): IndexOptions { $options = []; - if (is_string($jsonOptions)) { + if ($jsonOptions !== '') { $options = json_decode($jsonOptions, true); } @@ -339,7 +337,7 @@ private function generateIndexOptions(InputInterface $input): IndexOptions { $options = []; } - if ($input->getOption('no-readline')) { + if ($noReadline) { $options['_no-readline'] = true; } @@ -767,17 +765,4 @@ private function deleteError() { $this->displayError(); } - - - /** - * @throws TickDoesNotExistException - */ - public function abort(): void { - try { - $this->abortIfInterrupted(); - } catch (InterruptedException $e) { - $this->runner->stop(); - exit(); - } - } } diff --git a/lib/Command/Live.php b/lib/Command/Live.php index 2049629e..031d52da 100644 --- a/lib/Command/Live.php +++ b/lib/Command/Live.php @@ -10,8 +10,6 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\InterruptedException; -use OCA\FullTextSearch\ACommandBase; use OCA\FullTextSearch\Exceptions\PlatformTemporaryException; use OCA\FullTextSearch\Exceptions\TickDoesNotExistException; use OCA\FullTextSearch\Model\Index as ModelIndex; @@ -22,16 +20,22 @@ use OCA\FullTextSearch\Service\ProviderService; use OCA\FullTextSearch\Service\RunningService; use OCA\FullTextSearch\Tools\Traits\TArrayTools; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\Attribute\Option; +use OCP\Console\ExitCode; +use OCP\Console\ISignalHandler; use OutOfBoundsException; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Formatter\OutputFormatterStyle; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Terminal; use Throwable; -class Live extends ACommandBase { +#[AsCommand( + name: 'fulltextsearch:live', + description: 'Index files', +)] +class Live { use TArrayTools; @@ -106,33 +110,21 @@ public function __construct( private ProviderService $providerService, private LoggerInterface $logger, ) { - parent::__construct(); $this->runner = new Runner($runningService, 'commandLive'); } - protected function configure(): void { - parent::configure(); - $this->setName('fulltextsearch:live') - ->setDescription('Index files') - ->addOption( - 'no-readline', 'r', InputOption::VALUE_NONE, - 'disable readline - non interactive mode' - ) - ->addOption( - 'service', 's', InputOption::VALUE_NONE, - 'disable interface' - ); - } - - /** - * @param InputInterface $input - * @param OutputInterface $output - * * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - if (!$input->getOption('service') && !$input->getOption('no-readline')) { + public function __invoke( + OutputInterface $output, + ISignalHandler $signalHandler, + #[Option(name: 'no-readline', description: 'disable readline - non interactive mode', shortcut: 'r')] + bool $noReadline = false, + #[Option(name: 'service', description: 'disable interface', shortcut: 's')] + bool $service = false, + ): ExitCode { + if (!$service && !$noReadline) { try { /** do not get stuck while waiting interactive input */ readline_callback_handler_install( @@ -153,13 +145,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->runner = new Runner($this->runningService, 'commandIndex', ['nextStep' => 'n']); - if (!$input->getOption('service')) { + if (!$service) { $this->runner->onKeyPress([$this, 'onKeyPressed']); $this->runner->onNewIndexError([$this, 'onNewIndexError']); $this->runner->onNewIndexResult([$this, 'onNewIndexResult']); - $this->runner->sourceIsCommandLine($this, $output); + $this->runner->sourceIsCommandLine($signalHandler, $output); - $this->generatePanels(!$input->getOption('no-readline')); + $this->generatePanels(!$noReadline); } $this->indexService->setRunner($this->runner); @@ -169,7 +161,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int try { $this->runner->start(); - if (!$input->getOption('service')) { + if (!$service) { $this->cliService->runDisplay($output); $this->generateIndexErrors(); $this->displayError(); @@ -180,12 +172,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int } catch (Exception $e) { $this->logger->warning('Exception while live index', ['exception' => $e]); - if (!$input->getOption('service')) { + if (!$service) { throw $e; } } - if (!$input->getOption('service')) { + if (!$service) { break; } @@ -194,7 +186,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->runner->stop(); - return 0; + return ExitCode::Success; } @@ -693,17 +685,4 @@ private function deleteError() { } - /** - * @throws TickDoesNotExistException - */ - public function abort() { - try { - $this->abortIfInterrupted(); - } catch (InterruptedException $e) { - $this->runner->stop(); - exit(); - } - } - - } diff --git a/lib/Command/Reset.php b/lib/Command/Reset.php index 152af137..949cc004 100644 --- a/lib/Command/Reset.php +++ b/lib/Command/Reset.php @@ -10,24 +10,26 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\InterruptedException; -use OCA\FullTextSearch\ACommandBase; -use OCA\FullTextSearch\Exceptions\TickDoesNotExistException; use OCA\FullTextSearch\Model\Runner; use OCA\FullTextSearch\Service\IndexService; use OCA\FullTextSearch\Service\RunningService; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\ConfirmationQuestion; -use Symfony\Component\Console\Question\Question; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\Attribute\Option; +use OCP\Console\ExitCode; +use OCP\Console\IInput; +use OCP\Console\IOutput; +use OCP\Console\ISignalHandler; /** * Class Reset * * @package OCA\FullTextSearch\Command */ -class Reset extends ACommandBase { +#[AsCommand( + name: 'fulltextsearch:reset', + description: 'Reset index', +)] +class Reset { private Runner $runner; @@ -35,46 +37,32 @@ public function __construct( RunningService $runningService, private IndexService $indexService, ) { - parent::__construct(); - $this->runner = new Runner($runningService, 'commandReset'); } - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:reset') - ->setDescription('Reset index') - ->addOption('provider', '', InputOption::VALUE_REQUIRED, 'provider id', '') - ->addOption('collection', '', InputOption::VALUE_REQUIRED, 'name of the collection', ''); - } - /** - * @param InputInterface $input - * @param OutputInterface $output - * * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $provider = $input->getOption('provider'); - $collection = $input->getOption('collection'); - $helper = $this->getHelper('question'); - + public function __invoke( + IOutput $output, + IInput $input, + ISignalHandler $signalHandler, + #[Option(description: 'provider id')] + string $provider = '', + #[Option(description: 'name of the collection')] + string $collection = '', + ): ExitCode { $output->writeln('WARNING! You are about to reset your indexed documents:'); $output->writeln('- provider: ' . (($provider === '') ? 'ALL' : $provider) . ''); $output->writeln('- collection: ' . (($collection === '') ? 'ALL' : $collection) . ''); $output->writeln(''); - $question = new ConfirmationQuestion( - 'Do you really want to reset your indexed documents ? (y/N) ', false, - '/^(y|Y)/i' - ); - - if (!$helper->ask($input, $output, $question)) { + if (!$input->confirm('Do you really want to reset your indexed documents?', false)) { $output->writeln(''); $output->writeln('aborted.'); - return 0; + return ExitCode::Success; } $output->writeln(''); @@ -82,19 +70,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int $action = 'reset ' . (($provider === '') ? 'ALL' : $provider) . ' ' . (($collection === '') ? 'ALL' : $collection); - $question = new Question('Please confirm this destructive operation by typing \'' . $action . '\': ', ''); - - $helper = $this->getHelper('question'); - $confirmation = $helper->ask($input, $output, $question); + $confirmation = (string)$input->ask('Please confirm this destructive operation by typing \'' . $action . '\'', ''); if (strtolower($confirmation) !== strtolower($action)) { $output->writeln(''); $output->writeln('aborted.'); - return 0; + return ExitCode::Success; } try { - $this->runner->sourceIsCommandLine($this, $output); + $this->runner->sourceIsCommandLine($signalHandler, $output); $this->runner->start(); } catch (Exception $e) { $this->runner->exception($e->getMessage(), true); @@ -113,19 +98,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->runner->stop(); } - return 0; - } - - - /** - * @throws TickDoesNotExistException - */ - public function abort() { - try { - $this->abortIfInterrupted(); - } catch (InterruptedException $e) { - $this->runner->stop(); - exit(); - } + return ExitCode::Success; } } diff --git a/lib/Command/Search.php b/lib/Command/Search.php index 0f522b5a..e3781878 100644 --- a/lib/Command/Search.php +++ b/lib/Command/Search.php @@ -10,52 +10,44 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\Base; use OCA\FullTextSearch\Model\SearchRequest; use OCA\FullTextSearch\Service\SearchService; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; +use OCP\Console\Attribute\Argument; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; -class Search extends Base { +#[AsCommand( + name: 'fulltextsearch:search', + description: 'Search something', + supportsOutputFormat: true, +)] +class Search { public function __construct( private SearchService $searchService, ) { - parent::__construct(); } /** - * - */ - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:search') - ->setDescription('Search something') - ->addArgument('user', InputArgument::OPTIONAL, 'user') - ->addArgument('string', InputArgument::OPTIONAL, 'needle'); - - } - - - /** - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return int * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { + public function __invoke( + IOutput $output, + #[Argument(description: 'user')] + string $user = '', + #[Argument(description: 'needle')] + string $string = '', + ): ExitCode { $searchRequest = new SearchRequest(); $searchRequest->importFromArray( [ 'providers' => 'all', - 'search' => $input->getArgument('string') + 'search' => $string ] ); - $searchResult = $this->searchService->search($input->getArgument('user'), $searchRequest); + $searchResult = $this->searchService->search($user, $searchRequest); $results = []; foreach ($searchResult as $entry) { @@ -67,7 +59,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $results[$entry->getProvider()->getId()] = array_values($list); } - $this->writeArrayInOutputFormat($input, $output, $results, ' * '); - return 0; + $output->writeArrayInOutputFormat($results, ' * '); + + return ExitCode::Success; } } diff --git a/lib/Command/Stop.php b/lib/Command/Stop.php index 5899d42d..fcf664b4 100644 --- a/lib/Command/Stop.php +++ b/lib/Command/Stop.php @@ -9,41 +9,27 @@ namespace OCA\FullTextSearch\Command; -use OC\Core\Command\Base; use OCA\FullTextSearch\Service\RunningService; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -class Stop extends Base { +use OCP\Console\Attribute\AsCommand; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; + +#[AsCommand( + name: 'fulltextsearch:stop', + description: 'Stop all indexing', +)] +class Stop { public function __construct( private RunningService $runningService, ) { - parent::__construct(); } - - /** - * - */ - protected function configure() { - parent::configure(); - $this->setName('fulltextsearch:stop') - ->setDescription('Stop all indexing'); - } - - - /** - * @param InputInterface $input - * @param OutputInterface $output - * - * @return int - */ - protected function execute(InputInterface $input, OutputInterface $output): int { + public function __invoke(IOutput $output): ExitCode { $output->writeln('stopping all running indexes'); $this->runningService->forceStop(); - return 0; + return ExitCode::Success; } diff --git a/lib/Command/Test.php b/lib/Command/Test.php index 544efb26..a5d8880e 100644 --- a/lib/Command/Test.php +++ b/lib/Command/Test.php @@ -10,9 +10,7 @@ namespace OCA\FullTextSearch\Command; use Exception; -use OC\Core\Command\InterruptedException; use OC\FullTextSearch\Model\DocumentAccess; -use OCA\FullTextSearch\ACommandBase; use OCA\FullTextSearch\Exceptions\InterruptException; use OCA\FullTextSearch\Exceptions\ProviderDoesNotExistException; use OCA\FullTextSearch\Exceptions\ProviderIsNotCompatibleException; @@ -29,15 +27,21 @@ use OCA\FullTextSearch\Service\ProviderService; use OCA\FullTextSearch\Service\RunningService; use OCA\FullTextSearch\Service\TestService; +use OCP\Console\Attribute\AsCommand; +use OCP\Console\Attribute\Option; +use OCP\Console\ExitCode; +use OCP\Console\IOutput; +use OCP\Console\ISignalHandler; use OCP\FullTextSearch\IFullTextSearchPlatform; use OCP\FullTextSearch\IFullTextSearchProvider; use OCP\FullTextSearch\Model\IDocumentAccess; use Psr\Container\ContainerExceptionInterface; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -class Test extends ACommandBase { +#[AsCommand( + name: 'fulltextsearch:test', + description: 'Testing the platform setup', +)] +class Test { public const DELAY_STABILIZE_PLATFORM = 3; @@ -50,36 +54,25 @@ public function __construct( private IndexService $indexService, private TestService $testService, ) { - parent::__construct(); - } - - protected function configure(): void { - parent::configure(); - $this->setName('fulltextsearch:test') - ->setDescription('Testing the platform setup') - ->addOption('json', 'j', InputOption::VALUE_NONE, 'return result as JSON') - ->addOption( - 'platform_delay', 'd', InputOption::VALUE_REQUIRED, - 'change DELAY_STABILIZE_PLATFORM' - ); } /** * @throws Exception */ - protected function execute(InputInterface $input, OutputInterface $output): int { - $platformDelay = ($input->getOption('platform_delay') > 0) ? (int)$input->getOption( - 'platform_delay' - ) : self::DELAY_STABILIZE_PLATFORM; - + public function __invoke( + IOutput $output, + ISignalHandler $signalHandler, + #[Option(description: 'change DELAY_STABILIZE_PLATFORM')] + int $platformDelay = self::DELAY_STABILIZE_PLATFORM, + ): ExitCode { $this->output($output, '.Testing your current setup:'); try { $testProvider = $this->testCreatingProvider($output); $this->testMockedProvider($output, $testProvider); $testPlatform = $this->testLoadingPlatform($output); - $this->testLockingProcess($output, $testPlatform, $testProvider); + $this->testLockingProcess($output, $signalHandler, $testPlatform, $testProvider); } catch (Exception $e) { $this->outputResult($output, false); throw $e; @@ -111,7 +104,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->output($output, '', true); - return 0; + return ExitCode::Success; } @@ -133,11 +126,11 @@ private function generateMockProvider(): IFullTextSearchProvider { /** - * @param OutputInterface $output + * @param IOutput $output * @param string $line * @param bool $isNewLine */ - private function output(OutputInterface $output, string $line, bool $isNewLine = true) { + private function output(IOutput $output, string $line, bool $isNewLine = true) { if ($isNewLine) { $output->write(' ', true); } @@ -147,10 +140,10 @@ private function output(OutputInterface $output, string $line, bool $isNewLine = /** - * @param OutputInterface $output + * @param IOutput $output * @param bool $result */ - private function outputResult(OutputInterface $output, bool $result) { + private function outputResult(IOutput $output, bool $result) { $isNewLine = false; $line = $this->convertBoolToLine($result, $isNewLine); @@ -175,7 +168,7 @@ private function convertBoolToLine(bool $result, bool &$isNewLine): string { /** - * @param OutputInterface $output + * @param IOutput $output * * @return IFullTextSearchProvider * @throws ProviderDoesNotExistException @@ -183,7 +176,7 @@ private function convertBoolToLine(bool $result, bool &$isNewLine): string { * @throws ProviderIsNotUniqueException * @throws ContainerExceptionInterface */ - private function testCreatingProvider(OutputInterface $output): IFullTextSearchProvider { + private function testCreatingProvider(IOutput $output): IFullTextSearchProvider { $this->output($output, 'Creating mocked content provider.'); $testProvider = $this->generateMockProvider(); $this->outputResult($output, true); @@ -193,11 +186,11 @@ private function testCreatingProvider(OutputInterface $output): IFullTextSearchP /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchProvider $testProvider */ private function testMockedProvider( - OutputInterface $output, IFullTextSearchProvider $testProvider, + IOutput $output, IFullTextSearchProvider $testProvider, ) { $this->output($output, 'Testing mocked provider: get indexable documents.'); $testProvider->setIndexOptions(new IndexOptions()); @@ -209,12 +202,12 @@ private function testMockedProvider( /** - * @param OutputInterface $output + * @param IOutput $output * * @return IFullTextSearchPlatform * @throws Exception */ - private function testLoadingPlatform(OutputInterface $output): IFullTextSearchPlatform { + private function testLoadingPlatform(IOutput $output): IFullTextSearchPlatform { $this->output($output, 'Loading search platform.'); $wrapper = $this->platformService->getPlatform(); $testPlatform = $wrapper->getPlatform(); @@ -233,19 +226,20 @@ private function testLoadingPlatform(OutputInterface $output): IFullTextSearchPl /** - * @param OutputInterface $output + * @param IOutput $output + * @param ISignalHandler $signalHandler * @param IFullTextSearchPlatform $testPlatform * @param IFullTextSearchProvider $testProvider * * @throws RunnerAlreadyUpException */ private function testLockingProcess( - OutputInterface $output, IFullTextSearchPlatform $testPlatform, + IOutput $output, ISignalHandler $signalHandler, IFullTextSearchPlatform $testPlatform, IFullTextSearchProvider $testProvider, ) { $this->output($output, 'Locking process'); $this->runner = new Runner($this->runningService, 'test'); - $this->runner->sourceIsCommandLine($this, $output); + $this->runner->sourceIsCommandLine($signalHandler, $output); $this->runner->start(); $this->indexService->setRunner($this->runner); $testPlatform->setRunner($this->runner); @@ -255,12 +249,12 @@ private function testLockingProcess( /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchProvider $testProvider * * @throws Exception */ - private function testResetTest(OutputInterface $output, IFullTextSearchProvider $testProvider, + private function testResetTest(IOutput $output, IFullTextSearchProvider $testProvider, ) { $this->output($output, 'Removing test.'); $this->indexService->resetIndex($testProvider->getId()); @@ -269,10 +263,10 @@ private function testResetTest(OutputInterface $output, IFullTextSearchProvider /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $testPlatform */ - private function testInitIndexing(OutputInterface $output, IFullTextSearchPlatform $testPlatform, + private function testInitIndexing(IOutput $output, IFullTextSearchPlatform $testPlatform, ) { $this->output($output, 'Initializing index mapping.'); $testPlatform->initializeIndex(); @@ -281,14 +275,14 @@ private function testInitIndexing(OutputInterface $output, IFullTextSearchPlatfo /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $testPlatform * @param IFullTextSearchProvider $testProvider * * @throws Exception */ private function testIndexingDocuments( - OutputInterface $output, IFullTextSearchPlatform $testPlatform, + IOutput $output, IFullTextSearchPlatform $testPlatform, IFullTextSearchProvider $testProvider, ) { $this->output($output, 'Indexing generated documents.'); @@ -305,13 +299,13 @@ private function testIndexingDocuments( /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $testPlatform * * @throws Exception */ private function testContentLicense( - OutputInterface $output, IFullTextSearchPlatform $testPlatform, + IOutput $output, IFullTextSearchPlatform $testPlatform, ) { try { @@ -341,14 +335,14 @@ private function testContentLicense( /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $testPlatform * @param IFullTextSearchProvider $testProvider * * @throws Exception */ private function testSearchSimple( - OutputInterface $output, IFullTextSearchPlatform $testPlatform, + IOutput $output, IFullTextSearchPlatform $testPlatform, IFullTextSearchProvider $testProvider, ) { @@ -410,14 +404,14 @@ private function testSearchSimple( /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $testPlatform * @param IFullTextSearchProvider $testProvider * * @throws Exception */ private function testUpdatingDocumentsAccess( - OutputInterface $output, IFullTextSearchPlatform $testPlatform, + IOutput $output, IFullTextSearchPlatform $testPlatform, IFullTextSearchProvider $testProvider, ) { $this->output($output, 'Updating documents access.'); @@ -436,14 +430,14 @@ private function testUpdatingDocumentsAccess( /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $platform * @param IFullTextSearchProvider $provider * * @throws Exception */ private function testSearchAccess( - OutputInterface $output, IFullTextSearchPlatform $platform, + IOutput $output, IFullTextSearchPlatform $platform, IFullTextSearchProvider $provider, ) { $this->output($output, 'Searching with group access rights:'); @@ -468,14 +462,14 @@ private function testSearchAccess( /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $platform * @param IFullTextSearchProvider $provider * * @throws Exception */ private function testSearchShare( - OutputInterface $output, IFullTextSearchPlatform $platform, + IOutput $output, IFullTextSearchPlatform $platform, IFullTextSearchProvider $provider, ) { @@ -489,11 +483,11 @@ private function testSearchShare( /** - * @param OutputInterface $output + * @param IOutput $output * * @throws TickDoesNotExistException */ - private function testUnlockingProcess(OutputInterface $output) { + private function testUnlockingProcess(IOutput $output) { $this->output($output, 'Unlocking process'); $this->runner->stop(); $this->outputResult($output, true); @@ -501,7 +495,7 @@ private function testUnlockingProcess(OutputInterface $output) { /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $testPlatform * @param IFullTextSearchProvider $testProvider * @param IDocumentAccess $access @@ -512,7 +506,7 @@ private function testUnlockingProcess(OutputInterface $output) { * @throws Exception */ private function search( - OutputInterface $output, IFullTextSearchPlatform $testPlatform, + IOutput $output, IFullTextSearchPlatform $testPlatform, IFullTextSearchProvider $testProvider, IDocumentAccess $access, string $search, array $expected, string $moreOutput = '', ) { @@ -541,7 +535,7 @@ private function search( /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $testPlatform * @param IFullTextSearchProvider $testProvider * @param array $groups @@ -550,7 +544,7 @@ private function search( * @throws Exception */ private function searchGroups( - OutputInterface $output, IFullTextSearchPlatform $testPlatform, + IOutput $output, IFullTextSearchPlatform $testPlatform, IFullTextSearchProvider $testProvider, array $groups, array $expected, ) { @@ -566,7 +560,7 @@ private function searchGroups( /** - * @param OutputInterface $output + * @param IOutput $output * @param IFullTextSearchPlatform $testPlatform * @param IFullTextSearchProvider $testProvider * @param string $user @@ -575,7 +569,7 @@ private function searchGroups( * @throws Exception */ private function searchUsers( - OutputInterface $output, IFullTextSearchPlatform $testPlatform, + IOutput $output, IFullTextSearchPlatform $testPlatform, IFullTextSearchProvider $testProvider, string $user, array $expected, ) { $access = new DocumentAccess(); @@ -608,12 +602,12 @@ private function compareSearchResult(SearchResult $searchResult, array $entries) /** - * @param OutputInterface $output + * @param IOutput $output * @param int $s * * @throws InterruptException */ - private function pause(OutputInterface $output, int $s) { + private function pause(IOutput $output, int $s) { $this->output($output, 'Pausing ' . $s . ' seconds'); for ($i = 1; $i <= $s; $i++) { @@ -627,17 +621,4 @@ private function pause(OutputInterface $output, int $s) { $this->outputResult($output, true); } - - /** - * @throws TickDoesNotExistException - */ - public function abort() { - try { - $this->abortIfInterrupted(); - } catch (InterruptedException $e) { - $this->runner->stop(); - exit(); - } - } - } diff --git a/lib/Migration/Version23001Date20220408140253.php b/lib/Migration/Version23001Date20220408140253.php index 0df72c94..d0cc59fe 100644 --- a/lib/Migration/Version23001Date20220408140253.php +++ b/lib/Migration/Version23001Date20220408140253.php @@ -12,6 +12,7 @@ use Closure; use Doctrine\DBAL\Types\Type; use OCP\DB\ISchemaWrapper; +use OCP\DB\Schema\ColumnType; use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -35,11 +36,11 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table = $schema->getTable('fulltextsearch_indexes'); $column = $table->getColumn('message'); - if ($column->getType()->getName() === Types::TEXT) { + if ($column->getType() === ColumnType::Text) { return null; } - $column->setType(Type::getType(Types::TEXT)); + $column->setType(ColumnType::Text); return $schema; } diff --git a/lib/Migration/Version23001Date20220505144434.php b/lib/Migration/Version23001Date20220505144434.php index e33927a2..2cc6a349 100644 --- a/lib/Migration/Version23001Date20220505144434.php +++ b/lib/Migration/Version23001Date20220505144434.php @@ -12,18 +12,13 @@ use Closure; use Doctrine\DBAL\Types\Type; use OCP\DB\ISchemaWrapper; +use OCP\DB\Schema\ColumnType; use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version23001Date20220505144434 extends SimpleMigrationStep { - /** - * @param IOutput $output - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * - * @return null|ISchemaWrapper - */ + #[\Override] public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); @@ -35,11 +30,11 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table = $schema->getTable('fulltextsearch_ticks'); $column = $table->getColumn('data'); - if ($column->getType()->getName() === Types::TEXT) { + if ($column->getType() === ColumnType::Text) { return null; } - $column->setType(Type::getType(Types::TEXT)); + $column->setType(ColumnType::Text); return $schema; } diff --git a/lib/Model/Runner.php b/lib/Model/Runner.php index 1374508c..07c85e5a 100644 --- a/lib/Model/Runner.php +++ b/lib/Model/Runner.php @@ -10,12 +10,14 @@ namespace OCA\FullTextSearch\Model; use Exception; -use OCA\FullTextSearch\ACommandBase; use OCA\FullTextSearch\Exceptions\RunnerAlreadyUpException; use OCA\FullTextSearch\Exceptions\TickDoesNotExistException; use OCA\FullTextSearch\Exceptions\TickIsNotAliveException; use OCA\FullTextSearch\Service\RunningService; use OCA\FullTextSearch\Tools\Traits\TArrayTools; +use OCP\Console\Exception\InterruptedException; +use OCP\Console\IOutput; +use OCP\Console\ISignalHandler; use OCP\FullTextSearch\Model\IIndex; use OCP\FullTextSearch\Model\IRunner; use Symfony\Component\Console\Output\OutputInterface; @@ -44,10 +46,10 @@ class Runner implements IRunner { /** @var int */ private $tickId = 0; - /** @var ACommandBase */ - private $base = null; + /** @var ISignalHandler */ + private $signalHandler = null; - /** @var OutputInterface */ + /** @var OutputInterface|IOutput */ private $outputInterface = null; /** @var array */ @@ -121,9 +123,7 @@ public function start() { */ public function updateAction(string $action = '', bool $force = false): string { - if ($this->base !== null) { - $this->base->abort(); - } + $this->abortIfInterrupted(); $n = ''; if (sizeof($this->methodOnKeyPress) > 0) { @@ -152,9 +152,7 @@ public function updateAction(string $action = '', bool $force = false): string { } usleep(300000); - if ($this->base !== null) { - $this->base->abort(); - } + $this->abortIfInterrupted(); } $this->pauseRunning(false); @@ -422,15 +420,32 @@ public function stop() { /** - * @param ACommandBase $base - * @param OutputInterface $output + * @param ISignalHandler $signalHandler + * @param OutputInterface|IOutput $output */ - public function sourceIsCommandLine(ACommandBase $base, OutputInterface $output) { - $this->base = $base; + public function sourceIsCommandLine(ISignalHandler $signalHandler, OutputInterface|IOutput $output) { + $this->signalHandler = $signalHandler; $this->outputInterface = $output; } + /** + * Stops the runner and exits the process when the user interrupted the command (Ctrl-C/SIGTERM). + */ + private function abortIfInterrupted(): void { + if ($this->signalHandler === null) { + return; + } + + try { + $this->signalHandler->abortIfInterrupted(); + } catch (InterruptedException $e) { + $this->stop(); + exit(); + } + } + + /** * @param bool $pause */ diff --git a/phpstan.neon b/phpstan.neon index 4f743245..130fca6e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -28,26 +28,8 @@ parameters: - tests/stubs/oc_db_connectionadapter.php - tests/stubs/oca_circles_circlesmanager.php - tests/stubs/oca_circles_model_circle.php - - tests/stubs/doctrine_dbal_types_type.php - - tests/stubs/doctrine_dbal_arrayparametertype.php - - tests/stubs/doctrine_dbal_schema_abstractasset.php - - tests/stubs/doctrine_dbal_schema_column.php - - tests/stubs/doctrine_dbal_schema_schema.php - - tests/stubs/doctrine_dbal_schema_table.php - - tests/stubs/doctrine_dbal_connection.php - - tests/stubs/stecman_component_symfony_console_bashcompletion_completion_completionawareinterface.php - - tests/stubs/symfony_component_console_command_command.php - - tests/stubs/symfony_component_console_exception_invalidargumentexception.php - - tests/stubs/symfony_component_console_helper_questionhelper.php - - tests/stubs/symfony_component_console_helper_table.php - - tests/stubs/symfony_component_console_input_inputargument.php - - tests/stubs/symfony_component_console_input_inputinterface.php - - tests/stubs/symfony_component_console_input_inputoption.php - tests/stubs/symfony_component_console_output_outputinterface.php - - tests/stubs/symfony_component_console_question_confirmationquestion.php - - tests/stubs/symfony_component_console_question_question.php - tests/stubs/symfony_component_console_helper_progressbar.php - - tests/stubs/symfony_component_console_helper_helperinterface.php - tests/stubs/symfony_component_console_terminal.php - tests/stubs/symfony_component_console_formatter_outputformatterstyle_interface.php - tests/stubs/symfony_component_console_formatter_outputformatterstyle.php diff --git a/tests/stubs/doctrine_dbal_arrayparametertype.php b/tests/stubs/doctrine_dbal_arrayparametertype.php deleted file mode 100644 index 8aabe399..00000000 --- a/tests/stubs/doctrine_dbal_arrayparametertype.php +++ /dev/null @@ -1,37 +0,0 @@ - $params The connection parameters. - * @param Driver $driver The driver to use. - * @param Configuration|null $config The configuration, optional. - * @param EventManager|null $eventManager The event manager, optional. - * @phpstan-param Params $params - * - * @throws Exception - */ - public function __construct( - #[\SensitiveParameter] - array $params, - \Doctrine\DBAL\Driver $driver, - ?\Doctrine\DBAL\Configuration $config = null, - ?\Doctrine\Common\EventManager $eventManager = null - ) - { - } - /** - * Gets the parameters used during instantiation. - * - * @internal - * - * @return array - * @phpstan-return Params - */ - public function getParams() - { - } - /** - * Gets the name of the currently selected database. - * - * @return string|null The name of the database or NULL if a database is not selected. - * The platforms which don't support the concept of a database (e.g. embedded databases) - * must always return a string as an indicator of an implicitly selected database. - * - * @throws Exception - */ - public function getDatabase() - { - } - /** - * Gets the DBAL driver instance. - * - * @return Driver - */ - public function getDriver() - { - } - /** - * Gets the Configuration used by the Connection. - * - * @return Configuration - */ - public function getConfiguration() - { - } - /** - * Gets the EventManager used by the Connection. - * - * @deprecated - * - * @return EventManager - */ - public function getEventManager() - { - } - /** - * Gets the DatabasePlatform for the connection. - * - * @return AbstractPlatform - * - * @throws Exception - */ - public function getDatabasePlatform() - { - } - /** - * Creates an expression builder for the connection. - */ - public function createExpressionBuilder(): \Doctrine\DBAL\Query\Expression\ExpressionBuilder - { - } - /** - * Gets the ExpressionBuilder for the connection. - * - * @deprecated Use {@see createExpressionBuilder()} instead. - * - * @return ExpressionBuilder - */ - public function getExpressionBuilder() - { - } - /** - * Establishes the connection with the database. - * - * @internal This method will be made protected in DBAL 4.0. - * - * @return bool TRUE if the connection was successfully established, FALSE if - * the connection is already open. - * - * @throws Exception - * - * @phpstan-assert !null $this->_conn - */ - public function connect() - { - } - /** - * Returns the current auto-commit mode for this connection. - * - * @see setAutoCommit - * - * @return bool True if auto-commit mode is currently enabled for this connection, false otherwise. - */ - public function isAutoCommit() - { - } - /** - * Sets auto-commit mode for this connection. - * - * If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual - * transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either - * the method commit or the method rollback. By default, new connections are in auto-commit mode. - * - * NOTE: If this method is called during a transaction and the auto-commit mode is changed, the transaction is - * committed. If this method is called and the auto-commit mode is not changed, the call is a no-op. - * - * @see isAutoCommit - * - * @param bool $autoCommit True to enable auto-commit mode; false to disable it. - * - * @return void - */ - public function setAutoCommit($autoCommit) - { - } - /** - * Prepares and executes an SQL query and returns the first row of the result - * as an associative array. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return array|false False is returned if no rows are found. - * - * @throws Exception - */ - public function fetchAssociative(string $query, array $params = [], array $types = []) - { - } - /** - * Prepares and executes an SQL query and returns the first row of the result - * as a numerically indexed array. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return list|false False is returned if no rows are found. - * - * @throws Exception - */ - public function fetchNumeric(string $query, array $params = [], array $types = []) - { - } - /** - * Prepares and executes an SQL query and returns the value of a single column - * of the first row of the result. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return mixed|false False is returned if no rows are found. - * - * @throws Exception - */ - public function fetchOne(string $query, array $params = [], array $types = []) - { - } - /** - * Whether an actual connection to the database is established. - * - * @return bool - */ - public function isConnected() - { - } - /** - * Checks whether a transaction is currently active. - * - * @return bool TRUE if a transaction is currently active, FALSE otherwise. - */ - public function isTransactionActive() - { - } - /** - * Executes an SQL DELETE statement on a table. - * - * Table expression and columns are not escaped and are not safe for user-input. - * - * @param string $table Table name - * @param array $criteria Deletion criteria - * @param array|array $types Parameter types - * - * @return int|string The number of affected rows. - * - * @throws Exception - */ - public function delete($table, array $criteria, array $types = []) - { - } - /** - * Closes the connection. - * - * @return void - */ - public function close() - { - } - /** - * Sets the transaction isolation level. - * - * @param TransactionIsolationLevel::* $level The level to set. - * - * @return int|string - * - * @throws Exception - */ - public function setTransactionIsolation($level) - { - } - /** - * Gets the currently active transaction isolation level. - * - * @return TransactionIsolationLevel::* The current transaction isolation level. - * - * @throws Exception - */ - public function getTransactionIsolation() - { - } - /** - * Executes an SQL UPDATE statement on a table. - * - * Table expression and columns are not escaped and are not safe for user-input. - * - * @param string $table Table name - * @param array $data Column-value pairs - * @param array $criteria Update criteria - * @param array|array $types Parameter types - * - * @return int|string The number of affected rows. - * - * @throws Exception - */ - public function update($table, array $data, array $criteria, array $types = []) - { - } - /** - * Inserts a table row with specified data. - * - * Table expression and columns are not escaped and are not safe for user-input. - * - * @param string $table Table name - * @param array $data Column-value pairs - * @param array|array $types Parameter types - * - * @return int|string The number of affected rows. - * - * @throws Exception - */ - public function insert($table, array $data, array $types = []) - { - } - /** - * Quotes a string so it can be safely used as a table or column name, even if - * it is a reserved name. - * - * Delimiting style depends on the underlying database platform that is being used. - * - * NOTE: Just because you CAN use quoted identifiers does not mean - * you SHOULD use them. In general, they end up causing way more - * problems than they solve. - * - * @param string $str The name to be quoted. - * - * @return string The quoted name. - */ - public function quoteIdentifier($str) - { - } - /** - * The usage of this method is discouraged. Use prepared statements - * or {@see AbstractPlatform::quoteStringLiteral()} instead. - * - * @param mixed $value - * @param int|string|Type|null $type - * - * @return mixed - */ - public function quote($value, $type = \Doctrine\DBAL\ParameterType::STRING) - { - } - /** - * Prepares and executes an SQL query and returns the result as an array of numeric arrays. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return list> - * - * @throws Exception - */ - public function fetchAllNumeric(string $query, array $params = [], array $types = []): array - { - } - /** - * Prepares and executes an SQL query and returns the result as an array of associative arrays. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return list> - * - * @throws Exception - */ - public function fetchAllAssociative(string $query, array $params = [], array $types = []): array - { - } - /** - * Prepares and executes an SQL query and returns the result as an associative array with the keys - * mapped to the first column and the values mapped to the second column. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return array - * - * @throws Exception - */ - public function fetchAllKeyValue(string $query, array $params = [], array $types = []): array - { - } - /** - * Prepares and executes an SQL query and returns the result as an associative array with the keys mapped - * to the first column and the values being an associative array representing the rest of the columns - * and their values. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return array> - * - * @throws Exception - */ - public function fetchAllAssociativeIndexed(string $query, array $params = [], array $types = []): array - { - } - /** - * Prepares and executes an SQL query and returns the result as an array of the first column values. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return list - * - * @throws Exception - */ - public function fetchFirstColumn(string $query, array $params = [], array $types = []): array - { - } - /** - * Prepares and executes an SQL query and returns the result as an iterator over rows represented as numeric arrays. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return Traversable> - * - * @throws Exception - */ - public function iterateNumeric(string $query, array $params = [], array $types = []): \Traversable - { - } - /** - * Prepares and executes an SQL query and returns the result as an iterator over rows represented - * as associative arrays. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return Traversable> - * - * @throws Exception - */ - public function iterateAssociative(string $query, array $params = [], array $types = []): \Traversable - { - } - /** - * Prepares and executes an SQL query and returns the result as an iterator with the keys - * mapped to the first column and the values mapped to the second column. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return Traversable - * - * @throws Exception - */ - public function iterateKeyValue(string $query, array $params = [], array $types = []): \Traversable - { - } - /** - * Prepares and executes an SQL query and returns the result as an iterator with the keys mapped - * to the first column and the values being an associative array representing the rest of the columns - * and their values. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return Traversable> - * - * @throws Exception - */ - public function iterateAssociativeIndexed(string $query, array $params = [], array $types = []): \Traversable - { - } - /** - * Prepares and executes an SQL query and returns the result as an iterator over the first column values. - * - * @param string $query SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @return Traversable - * - * @throws Exception - */ - public function iterateColumn(string $query, array $params = [], array $types = []): \Traversable - { - } - /** - * Prepares an SQL statement. - * - * @param string $sql The SQL statement to prepare. - * - * @throws Exception - */ - public function prepare(string $sql): \Doctrine\DBAL\Statement - { - } - /** - * Executes an, optionally parameterized, SQL query. - * - * If the query is parametrized, a prepared statement is used. - * If an SQLLogger is configured, the execution is logged. - * - * @param string $sql SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @throws Exception - */ - public function executeQuery(string $sql, array $params = [], $types = [], ?\Doctrine\DBAL\Cache\QueryCacheProfile $qcp = null): \Doctrine\DBAL\Result - { - } - /** - * Executes a caching query. - * - * @param string $sql SQL query - * @param list|array $params Query parameters - * @param array|array $types Parameter types - * - * @throws CacheException - * @throws Exception - */ - public function executeCacheQuery($sql, $params, $types, \Doctrine\DBAL\Cache\QueryCacheProfile $qcp): \Doctrine\DBAL\Result - { - } - /** - * Executes an SQL statement with the given parameters and returns the number of affected rows. - * - * Could be used for: - * - DML statements: INSERT, UPDATE, DELETE, etc. - * - DDL statements: CREATE, DROP, ALTER, etc. - * - DCL statements: GRANT, REVOKE, etc. - * - Session control statements: ALTER SESSION, SET, DECLARE, etc. - * - Other statements that don't yield a row set. - * - * This method supports PDO binding types as well as DBAL mapping types. - * - * @param string $sql SQL statement - * @param list|array $params Statement parameters - * @param array|array $types Parameter types - * - * @return int|string The number of affected rows. - * - * @throws Exception - */ - public function executeStatement($sql, array $params = [], array $types = []) - { - } - /** - * Returns the current transaction nesting level. - * - * @return int The nesting level. A value of 0 means there's no active transaction. - */ - public function getTransactionNestingLevel() - { - } - /** - * Returns the ID of the last inserted row, or the last value from a sequence object, - * depending on the underlying driver. - * - * Note: This method may not return a meaningful or consistent result across different drivers, - * because the underlying database may not even support the notion of AUTO_INCREMENT/IDENTITY - * columns or sequences. - * - * @param string|null $name Name of the sequence object from which the ID should be returned. - * - * @return string|int|false A string representation of the last inserted ID. - * - * @throws Exception - */ - public function lastInsertId($name = null) - { - } - /** - * Executes a function in a transaction. - * - * The function gets passed this Connection instance as an (optional) parameter. - * - * If an exception occurs during execution of the function or transaction commit, - * the transaction is rolled back and the exception re-thrown. - * - * @param Closure(self):T $func The function to execute transactionally. - * - * @return T The value returned by $func - * - * @throws Throwable - * - * @template T - */ - public function transactional(\Closure $func) - { - } - /** - * Sets if nested transactions should use savepoints. - * - * @param bool $nestTransactionsWithSavepoints - * - * @return void - * - * @throws Exception - */ - public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoints) - { - } - /** - * Gets if nested transactions should use savepoints. - * - * @return bool - */ - public function getNestTransactionsWithSavepoints() - { - } - /** - * Returns the savepoint name to use for nested transactions. - * - * @return string - */ - protected function _getNestedTransactionSavePointName() - { - } - /** - * @return bool - * - * @throws Exception - */ - public function beginTransaction() - { - } - /** - * @return bool - * - * @throws Exception - */ - public function commit() - { - } - /** - * Cancels any database changes done during the current transaction. - * - * @return bool - * - * @throws Exception - */ - public function rollBack() - { - } - /** - * Creates a new savepoint. - * - * @param string $savepoint The name of the savepoint to create. - * - * @return void - * - * @throws Exception - */ - public function createSavepoint($savepoint) - { - } - /** - * Releases the given savepoint. - * - * @param string $savepoint The name of the savepoint to release. - * - * @return void - * - * @throws Exception - */ - public function releaseSavepoint($savepoint) - { - } - /** - * Rolls back to the given savepoint. - * - * @param string $savepoint The name of the savepoint to rollback to. - * - * @return void - * - * @throws Exception - */ - public function rollbackSavepoint($savepoint) - { - } - /** - * Gets the wrapped driver connection. - * - * @deprecated Use {@link getNativeConnection()} to access the native connection. - * - * @return DriverConnection - * - * @throws Exception - */ - public function getWrappedConnection() - { - } - /** @return resource|object */ - public function getNativeConnection() - { - } - /** - * Creates a SchemaManager that can be used to inspect or change the - * database schema through the connection. - * - * @throws Exception - */ - public function createSchemaManager(): \Doctrine\DBAL\Schema\AbstractSchemaManager - { - } - /** - * Gets the SchemaManager that can be used to inspect or change the - * database schema through the connection. - * - * @deprecated Use {@see createSchemaManager()} instead. - * - * @return AbstractSchemaManager - * - * @throws Exception - */ - public function getSchemaManager() - { - } - /** - * Marks the current transaction so that the only possible - * outcome for the transaction to be rolled back. - * - * @return void - * - * @throws ConnectionException If no transaction is active. - */ - public function setRollbackOnly() - { - } - /** - * Checks whether the current transaction is marked for rollback only. - * - * @return bool - * - * @throws ConnectionException If no transaction is active. - */ - public function isRollbackOnly() - { - } - /** - * Converts a given value to its database representation according to the conversion - * rules of a specific DBAL mapping type. - * - * @param mixed $value The value to convert. - * @param string $type The name of the DBAL mapping type. - * - * @return mixed The converted value. - * - * @throws Exception - */ - public function convertToDatabaseValue($value, $type) - { - } - /** - * Converts a given value to its PHP representation according to the conversion - * rules of a specific DBAL mapping type. - * - * @param mixed $value The value to convert. - * @param string $type The name of the DBAL mapping type. - * - * @return mixed The converted type. - * - * @throws Exception - */ - public function convertToPHPValue($value, $type) - { - } - /** - * Creates a new instance of a SQL query builder. - * - * @return QueryBuilder - */ - public function createQueryBuilder() - { - } - /** - * @internal - * - * @param list|array $params - * @param array|array $types - */ - final public function convertExceptionDuringQuery(\Doctrine\DBAL\Driver\Exception $e, string $sql, array $params = [], array $types = []): \Doctrine\DBAL\Exception\DriverException - { - } - /** @internal */ - final public function convertException(\Doctrine\DBAL\Driver\Exception $e): \Doctrine\DBAL\Exception\DriverException - { - } - /** - * BC layer for a wide-spread use-case of old DBAL APIs - * - * @deprecated Use {@see executeStatement()} instead - * - * @param array $params The query parameters - * @param array $types The parameter types - */ - public function executeUpdate(string $sql, array $params = [], array $types = []): int - { - } - /** - * BC layer for a wide-spread use-case of old DBAL APIs - * - * @deprecated Use {@see executeQuery()} instead - */ - public function query(string $sql): \Doctrine\DBAL\Result - { - } - /** - * BC layer for a wide-spread use-case of old DBAL APIs - * - * @deprecated please use {@see executeStatement()} instead - */ - public function exec(string $sql): int - { - } -} \ No newline at end of file diff --git a/tests/stubs/doctrine_dbal_schema_abstractasset.php b/tests/stubs/doctrine_dbal_schema_abstractasset.php deleted file mode 100644 index 36e8fdb9..00000000 --- a/tests/stubs/doctrine_dbal_schema_abstractasset.php +++ /dev/null @@ -1,171 +0,0 @@ - Table($tableName)); if you want to rename the table, you have to make sure this does not get - * recreated during schema migration. - */ -abstract class AbstractAsset -{ - /** @var string */ - protected $_name = ''; - - /** - * Namespace of the asset. If none isset the default namespace is assumed. - * - * @var string|null - */ - protected $_namespace; - - /** @var bool */ - protected $_quoted = false; - - /** - * Sets the name of this asset. - * - * @param string $name - * - * @return void - */ - protected function _setName($name) - { - } - - /** - * Is this asset in the default namespace? - * - * @param string $defaultNamespaceName - * - * @return bool - */ - public function isInDefaultNamespace($defaultNamespaceName) - { - } - - /** - * Gets the namespace name of this asset. - * - * If NULL is returned this means the default namespace is used. - * - * @return string|null - */ - public function getNamespaceName() - { - } - - /** - * The shortest name is stripped of the default namespace. All other - * namespaced elements are returned as full-qualified names. - * - * @param string|null $defaultNamespaceName - * - * @return string - */ - public function getShortestName($defaultNamespaceName) - { - } - - /** - * The normalized name is full-qualified and lower-cased. Lower-casing is - * actually wrong, but we have to do it to keep our sanity. If you are - * using database objects that only differentiate in the casing (FOO vs - * Foo) then you will NOT be able to use Doctrine Schema abstraction. - * - * Every non-namespaced element is prefixed with the default namespace - * name which is passed as argument to this method. - * - * @deprecated Use {@see getNamespaceName()} and {@see getName()} instead. - * - * @param string $defaultNamespaceName - * - * @return string - */ - public function getFullQualifiedName($defaultNamespaceName) - { - } - - /** - * Checks if this asset's name is quoted. - * - * @return bool - */ - public function isQuoted() - { - } - - /** - * Checks if this identifier is quoted. - * - * @param string $identifier - * - * @return bool - */ - protected function isIdentifierQuoted($identifier) - { - } - - /** - * Trim quotes from the identifier. - * - * @param string $identifier - * - * @return string - */ - protected function trimQuotes($identifier) - { - } - - /** - * Returns the name of this schema asset. - * - * @return string - */ - public function getName() - { - } - - /** - * Gets the quoted representation of this asset but only if it was defined with one. Otherwise - * return the plain unquoted value as inserted. - * - * @return string - */ - public function getQuotedName(AbstractPlatform $platform) - { - } - - /** - * Generates an identifier from a list of column names obeying a certain string length. - * - * This is especially important for Oracle, since it does not allow identifiers larger than 30 chars, - * however building idents automatically for foreign keys, composite keys or such can easily create - * very long names. - * - * @param string[] $columnNames - * @param string $prefix - * @param int $maxSize - * - * @return string - */ - protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30) - { - } -} diff --git a/tests/stubs/doctrine_dbal_schema_column.php b/tests/stubs/doctrine_dbal_schema_column.php deleted file mode 100644 index 425c8345..00000000 --- a/tests/stubs/doctrine_dbal_schema_column.php +++ /dev/null @@ -1,334 +0,0 @@ - - * - * @throws Exception - */ - public function toSql(AbstractPlatform $platform) - { - } - - /** - * Return an array of necessary SQL queries to drop the schema on the given platform. - * - * @return list - * - * @throws Exception - */ - public function toDropSql(AbstractPlatform $platform) - { - } - - /** - * @deprecated - * - * @return string[] - * - * @throws SchemaException - */ - public function getMigrateToSql(Schema $toSchema, AbstractPlatform $platform) - { - } - - /** - * @deprecated - * - * @return string[] - * - * @throws SchemaException - */ - public function getMigrateFromSql(Schema $fromSchema, AbstractPlatform $platform) - { - } - - /** - * @deprecated - * - * @return void - */ - public function visit(Visitor $visitor) - { - } - - /** - * Cloning a Schema triggers a deep clone of all related assets. - * - * @return void - */ - public function __clone() - { - } -} diff --git a/tests/stubs/doctrine_dbal_schema_table.php b/tests/stubs/doctrine_dbal_schema_table.php deleted file mode 100644 index 794175a4..00000000 --- a/tests/stubs/doctrine_dbal_schema_table.php +++ /dev/null @@ -1,522 +0,0 @@ - [], - ]; - - /** @var SchemaConfig|null */ - protected $_schemaConfig; - - /** - * @param Column[] $columns - * @param Index[] $indexes - * @param UniqueConstraint[] $uniqueConstraints - * @param ForeignKeyConstraint[] $fkConstraints - * @param mixed[] $options - * - * @throws SchemaException - * @throws Exception - */ - public function __construct(string $name, array $columns = [], array $indexes = [], array $uniqueConstraints = [], array $fkConstraints = [], array $options = []) - { - } - - /** @return void */ - public function setSchemaConfig(SchemaConfig $schemaConfig) - { - } - - /** @return int */ - protected function _getMaxIdentifierLength() - { - } - - /** - * Sets the Primary Key. - * - * @param string[] $columnNames - * @param string|false $indexName - * - * @return self - * - * @throws SchemaException - */ - public function setPrimaryKey(array $columnNames, $indexName = false) - { - } - - /** - * @param string[] $columnNames - * @param string[] $flags - * @param mixed[] $options - * - * @return self - * - * @throws SchemaException - */ - public function addIndex(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []) - { - } - - /** - * @param string[] $columnNames - * @param string[] $flags - * @param mixed[] $options - * - * @return self - */ - public function addUniqueConstraint(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []): Table - { - } - - /** - * Drops the primary key from this table. - * - * @return void - * - * @throws SchemaException - */ - public function dropPrimaryKey() - { - } - - /** - * Drops an index from this table. - * - * @param string $name The index name. - * - * @return void - * - * @throws SchemaException If the index does not exist. - */ - public function dropIndex($name) - { - } - - /** - * @param string[] $columnNames - * @param string|null $indexName - * @param mixed[] $options - * - * @return self - * - * @throws SchemaException - */ - public function addUniqueIndex(array $columnNames, $indexName = null, array $options = []) - { - } - - /** - * Renames an index. - * - * @param string $oldName The name of the index to rename from. - * @param string|null $newName The name of the index to rename to. - * If null is given, the index name will be auto-generated. - * - * @return self This table instance. - * - * @throws SchemaException If no index exists for the given current name - * or if an index with the given new name already exists on this table. - */ - public function renameIndex($oldName, $newName = null) - { - } - - /** - * Checks if an index begins in the order of the given columns. - * - * @param string[] $columnNames - * - * @return bool - */ - public function columnsAreIndexed(array $columnNames) - { - } - - /** - * @param string $name - * @param string $typeName - * @param mixed[] $options - * - * @return Column - * - * @throws SchemaException - */ - public function addColumn($name, $typeName, array $options = []) - { - } - - /** - * Change Column Details. - * - * @deprecated Use {@link modifyColumn()} instead. - * - * @param string $name - * @param mixed[] $options - * - * @return self - * - * @throws SchemaException - */ - public function changeColumn($name, array $options) - { - } - - /** - * @param string $name - * @param mixed[] $options - * - * @return self - * - * @throws SchemaException - */ - public function modifyColumn($name, array $options) - { - } - - /** - * Drops a Column from the Table. - * - * @param string $name - * - * @return self - */ - public function dropColumn($name) - { - } - - /** - * Adds a foreign key constraint. - * - * Name is inferred from the local columns. - * - * @param Table|string $foreignTable Table schema instance or table name - * @param string[] $localColumnNames - * @param string[] $foreignColumnNames - * @param mixed[] $options - * @param string|null $name - * - * @return self - * - * @throws SchemaException - */ - public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], $name = null) - { - } - - /** - * @param string $name - * @param mixed $value - * - * @return self - */ - public function addOption($name, $value) - { - } - - /** - * @return void - * - * @throws SchemaException - */ - protected function _addColumn(Column $column) - { - } - - /** - * Adds an index to the table. - * - * @return self - * - * @throws SchemaException - */ - protected function _addIndex(Index $indexCandidate) - { - } - - /** @return self */ - protected function _addUniqueConstraint(UniqueConstraint $constraint): Table - { - } - - /** @return self */ - protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) - { - } - - /** - * Returns whether this table has a foreign key constraint with the given name. - * - * @param string $name - * - * @return bool - */ - public function hasForeignKey($name) - { - } - - /** - * Returns the foreign key constraint with the given name. - * - * @param string $name The constraint name. - * - * @return ForeignKeyConstraint - * - * @throws SchemaException If the foreign key does not exist. - */ - public function getForeignKey($name) - { - } - - /** - * Removes the foreign key constraint with the given name. - * - * @param string $name The constraint name. - * - * @return void - * - * @throws SchemaException - */ - public function removeForeignKey($name) - { - } - - /** - * Returns whether this table has a unique constraint with the given name. - */ - public function hasUniqueConstraint(string $name): bool - { - } - - /** - * Returns the unique constraint with the given name. - * - * @throws SchemaException If the unique constraint does not exist. - */ - public function getUniqueConstraint(string $name): UniqueConstraint - { - } - - /** - * Removes the unique constraint with the given name. - * - * @throws SchemaException If the unique constraint does not exist. - */ - public function removeUniqueConstraint(string $name): void - { - } - - /** - * Returns ordered list of columns (primary keys are first, then foreign keys, then the rest) - * - * @return Column[] - */ - public function getColumns() - { - } - - /** - * Returns the foreign key columns - * - * @deprecated Use {@see getForeignKey()} and {@see ForeignKeyConstraint::getLocalColumns()} instead. - * - * @return Column[] - */ - public function getForeignKeyColumns() - { - } - - /** - * Returns whether this table has a Column with the given name. - * - * @param string $name The column name. - * - * @return bool - */ - public function hasColumn($name) - { - } - - /** - * Returns the Column with the given name. - * - * @param string $name The column name. - * - * @return Column - * - * @throws SchemaException If the column does not exist. - */ - public function getColumn($name) - { - } - - /** - * Returns the primary key. - * - * @return Index|null The primary key, or null if this Table has no primary key. - */ - public function getPrimaryKey() - { - } - - /** - * Returns the primary key columns. - * - * @deprecated Use {@see getPrimaryKey()} and {@see Index::getColumns()} instead. - * - * @return Column[] - * - * @throws Exception - */ - public function getPrimaryKeyColumns() - { - } - - /** - * Returns whether this table has a primary key. - * - * @deprecated Use {@see getPrimaryKey()} instead. - * - * @return bool - */ - public function hasPrimaryKey() - { - } - - /** - * Returns whether this table has an Index with the given name. - * - * @param string $name The index name. - * - * @return bool - */ - public function hasIndex($name) - { - } - - /** - * Returns the Index with the given name. - * - * @param string $name The index name. - * - * @return Index - * - * @throws SchemaException If the index does not exist. - */ - public function getIndex($name) - { - } - - /** @return Index[] */ - public function getIndexes() - { - } - - /** - * Returns the unique constraints. - * - * @return UniqueConstraint[] - */ - public function getUniqueConstraints(): array - { - } - - /** - * Returns the foreign key constraints. - * - * @return ForeignKeyConstraint[] - */ - public function getForeignKeys() - { - } - - /** - * @param string $name - * - * @return bool - */ - public function hasOption($name) - { - } - - /** - * @param string $name - * - * @return mixed - */ - public function getOption($name) - { - } - - /** @return mixed[] */ - public function getOptions() - { - } - - /** - * @deprecated - * - * @return void - * - * @throws SchemaException - */ - public function visit(Visitor $visitor) - { - } - - /** - * Clone of a Table triggers a deep clone of all affected assets. - * - * @return void - */ - public function __clone() - { - } - - public function setComment(?string $comment): self - { - } - - public function getComment(): ?string - { - } -} diff --git a/tests/stubs/doctrine_dbal_types_type.php b/tests/stubs/doctrine_dbal_types_type.php deleted file mode 100644 index 20ce6e1d..00000000 --- a/tests/stubs/doctrine_dbal_types_type.php +++ /dev/null @@ -1,200 +0,0 @@ - $className The class name of the custom type. - * - * @return void - * - * @throws Exception - */ - public static function addType($name, $className) - { - } - /** - * Checks if exists support for a type. - * - * @param string $name The name of the type. - * - * @return bool TRUE if type is supported; FALSE otherwise. - */ - public static function hasType($name) - { - } - /** - * Overrides an already defined type to use a different implementation. - * - * @param string $name - * @param class-string $className - * - * @return void - * - * @throws Exception - */ - public static function overrideType($name, $className) - { - } - /** - * Gets the (preferred) binding type for values of this type that - * can be used when binding parameters to prepared statements. - * - * This method should return one of the {@see ParameterType} constants. - * - * @return int - */ - public function getBindingType() - { - } - /** - * Gets the types array map which holds all registered types and the corresponding - * type class - * - * @return array - */ - public static function getTypesMap() - { - } - /** - * Does working with this column require SQL conversion functions? - * - * This is a metadata function that is required for example in the ORM. - * Usage of {@see convertToDatabaseValueSQL} and - * {@see convertToPHPValueSQL} works for any type and mostly - * does nothing. This method can additionally be used for optimization purposes. - * - * @deprecated Consumers should call {@see convertToDatabaseValueSQL} and {@see convertToPHPValueSQL} - * regardless of the type. - * - * @return bool - */ - public function canRequireSQLConversion() - { - } - /** - * Modifies the SQL expression (identifier, parameter) to convert to a database value. - * - * @param string $sqlExpr - * - * @return string - */ - public function convertToDatabaseValueSQL($sqlExpr, \Doctrine\DBAL\Platforms\AbstractPlatform $platform) - { - } - /** - * Modifies the SQL expression (identifier, parameter) to convert to a PHP value. - * - * @param string $sqlExpr - * @param AbstractPlatform $platform - * - * @return string - */ - public function convertToPHPValueSQL($sqlExpr, $platform) - { - } - /** - * Gets an array of database types that map to this Doctrine type. - * - * @return string[] - */ - public function getMappedDatabaseTypes(\Doctrine\DBAL\Platforms\AbstractPlatform $platform) - { - } - /** - * If this Doctrine Type maps to an already mapped database type, - * reverse schema engineering can't tell them apart. You need to mark - * one of those types as commented, which will have Doctrine use an SQL - * comment to typehint the actual Doctrine Type. - * - * @deprecated - * - * @return bool - */ - public function requiresSQLCommentHint(\Doctrine\DBAL\Platforms\AbstractPlatform $platform) - { - } -} diff --git a/tests/stubs/symfony_component_console_command_command.php b/tests/stubs/symfony_component_console_command_command.php deleted file mode 100644 index 59094f71..00000000 --- a/tests/stubs/symfony_component_console_command_command.php +++ /dev/null @@ -1,442 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Command; - -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Completion\Suggestion; -use Symfony\Component\Console\Exception\ExceptionInterface; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; -use Symfony\Component\Console\Helper\HelperInterface; -use Symfony\Component\Console\Helper\HelperSet; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Base class for all commands. - * - * @author Fabien Potencier - */ -class Command -{ - // see https://tldp.org/LDP/abs/html/exitcodes.html - public const SUCCESS = 0; - public const FAILURE = 1; - public const INVALID = 2; - - /** - * @var string|null The default command name - * - * @deprecated since Symfony 6.1, use the AsCommand attribute instead - */ - protected static $defaultName; - - /** - * @var string|null The default command description - * - * @deprecated since Symfony 6.1, use the AsCommand attribute instead - */ - protected static $defaultDescription; - - public static function getDefaultName(): ?string - { - } - - public static function getDefaultDescription(): ?string - { - } - - /** - * @param string|null $name The name of the command; passing null means it must be set in configure() - * - * @throws LogicException When the command name is empty - */ - public function __construct(?string $name = null) - { - } - - /** - * Ignores validation errors. - * - * This is mainly useful for the help command. - * - * @return void - */ - public function ignoreValidationErrors() - { - } - - /** - * @return void - */ - public function setApplication(?Application $application = null) - { - } - - /** - * @return void - */ - public function setHelperSet(HelperSet $helperSet) - { - } - - /** - * Gets the helper set. - */ - public function getHelperSet(): ?HelperSet - { - } - - /** - * Gets the application instance for this command. - */ - public function getApplication(): ?Application - { - } - - /** - * Checks whether the command is enabled or not in the current environment. - * - * Override this to check for x or y and return false if the command cannot - * run properly under the current conditions. - * - * @return bool - */ - public function isEnabled() - { - } - - /** - * Configures the current command. - * - * @return void - */ - protected function configure() - { - } - - /** - * Executes the current command. - * - * This method is not abstract because you can use this class - * as a concrete class. In this case, instead of defining the - * execute() method, you set the code to execute by passing - * a Closure to the setCode() method. - * - * @return int 0 if everything went fine, or an exit code - * - * @throws LogicException When this abstract method is not implemented - * - * @see setCode() - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - } - - /** - * Interacts with the user. - * - * This method is executed before the InputDefinition is validated. - * This means that this is the only place where the command can - * interactively ask for values of missing required arguments. - * - * @return void - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - } - - /** - * Initializes the command after the input has been bound and before the input - * is validated. - * - * This is mainly useful when a lot of commands extends one main command - * where some things need to be initialized based on the input arguments and options. - * - * @see InputInterface::bind() - * @see InputInterface::validate() - * - * @return void - */ - protected function initialize(InputInterface $input, OutputInterface $output) - { - } - - /** - * Runs the command. - * - * The code to execute is either defined directly with the - * setCode() method or by overriding the execute() method - * in a sub-class. - * - * @return int The command exit code - * - * @throws ExceptionInterface When input binding fails. Bypass this by calling {@link ignoreValidationErrors()}. - * - * @see setCode() - * @see execute() - */ - public function run(InputInterface $input, OutputInterface $output): int - { - } - - /** - * Adds suggestions to $suggestions for the current completion input (e.g. option or argument). - */ - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - } - - /** - * Sets the code to execute when running this command. - * - * If this method is used, it overrides the code defined - * in the execute() method. - * - * @param callable $code A callable(InputInterface $input, OutputInterface $output) - * - * @return $this - * - * @throws InvalidArgumentException - * - * @see execute() - */ - public function setCode(callable $code): static - { - } - - /** - * Merges the application definition with the command definition. - * - * This method is not part of public API and should not be used directly. - * - * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments - * - * @internal - */ - public function mergeApplicationDefinition(bool $mergeArgs = true): void - { - } - - /** - * Sets an array of argument and option instances. - * - * @return $this - */ - public function setDefinition(array|InputDefinition $definition): static - { - } - - /** - * Gets the InputDefinition attached to this Command. - */ - public function getDefinition(): InputDefinition - { - } - - /** - * Gets the InputDefinition to be used to create representations of this Command. - * - * Can be overridden to provide the original command representation when it would otherwise - * be changed by merging with the application InputDefinition. - * - * This method is not part of public API and should not be used directly. - */ - public function getNativeDefinition(): InputDefinition - { - } - - /** - * Adds an argument. - * - * @param $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param $default The default value (for InputArgument::OPTIONAL mode only) - * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion - * - * @return $this - * - * @throws InvalidArgumentException When argument mode is not valid - */ - public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null): static - { - } - - /** - * Adds an option. - * - * @param $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param $mode The option mode: One of the InputOption::VALUE_* constants - * @param $default The default value (must be null for InputOption::VALUE_NONE) - * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion - * - * @return $this - * - * @throws InvalidArgumentException If option mode is invalid or incompatible - */ - public function addOption(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null): static - { - } - - /** - * Sets the name of the command. - * - * This method can set both the namespace and the name if - * you separate them by a colon (:) - * - * $command->setName('foo:bar'); - * - * @return $this - * - * @throws InvalidArgumentException When the name is invalid - */ - public function setName(string $name): static - { - } - - /** - * Sets the process title of the command. - * - * This feature should be used only when creating a long process command, - * like a daemon. - * - * @return $this - */ - public function setProcessTitle(string $title): static - { - } - - /** - * Returns the command name. - */ - public function getName(): ?string - { - } - - /** - * @param bool $hidden Whether or not the command should be hidden from the list of commands - * - * @return $this - */ - public function setHidden(bool $hidden = true): static - { - } - - /** - * @return bool whether the command should be publicly shown or not - */ - public function isHidden(): bool - { - } - - /** - * Sets the description for the command. - * - * @return $this - */ - public function setDescription(string $description): static - { - } - - /** - * Returns the description for the command. - */ - public function getDescription(): string - { - } - - /** - * Sets the help for the command. - * - * @return $this - */ - public function setHelp(string $help): static - { - } - - /** - * Returns the help for the command. - */ - public function getHelp(): string - { - } - - /** - * Returns the processed help for the command replacing the %command.name% and - * %command.full_name% patterns with the real values dynamically. - */ - public function getProcessedHelp(): string - { - } - - /** - * Sets the aliases for the command. - * - * @param string[] $aliases An array of aliases for the command - * - * @return $this - * - * @throws InvalidArgumentException When an alias is invalid - */ - public function setAliases(iterable $aliases): static - { - } - - /** - * Returns the aliases for the command. - */ - public function getAliases(): array - { - } - - /** - * Returns the synopsis for the command. - * - * @param bool $short Whether to show the short version of the synopsis (with options folded) or not - */ - public function getSynopsis(bool $short = false): string - { - } - - /** - * Add a command usage example, it'll be prefixed with the command name. - * - * @return $this - */ - public function addUsage(string $usage): static - { - } - - /** - * Returns alternative usages of the command. - */ - public function getUsages(): array - { - } - - /** - * Gets a helper instance by name. - * - * @return HelperInterface - * - * @throws LogicException if no HelperSet is defined - * @throws InvalidArgumentException if the helper is not defined - */ - public function getHelper(string $name): mixed - { - } -} diff --git a/tests/stubs/symfony_component_console_exception_invalidargumentexception.php b/tests/stubs/symfony_component_console_exception_invalidargumentexception.php deleted file mode 100644 index 07cc0b61..00000000 --- a/tests/stubs/symfony_component_console_exception_invalidargumentexception.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Exception; - -/** - * @author Jérôme Tamarelle - */ -class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/tests/stubs/symfony_component_console_helper_helperinterface.php b/tests/stubs/symfony_component_console_helper_helperinterface.php deleted file mode 100644 index 08c374d1..00000000 --- a/tests/stubs/symfony_component_console_helper_helperinterface.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\Question; - -/** - * HelperInterface is the interface all helpers must implement. - * - * @author Fabien Potencier - */ -interface HelperInterface -{ - /** - * Sets the helper set associated with this helper. - * - * @return void - */ - public function setHelperSet(?HelperSet $helperSet); - - /** - * Gets the helper set associated with this helper. - */ - public function getHelperSet(): ?HelperSet; - - /** - * Returns the canonical name of this helper. - * - * @return string - */ - public function getName(); - - public function ask(InputInterface $input, OutputInterface $output, Question $question): mixed; -} diff --git a/tests/stubs/symfony_component_console_helper_questionhelper.php b/tests/stubs/symfony_component_console_helper_questionhelper.php deleted file mode 100644 index 8dd76875..00000000 --- a/tests/stubs/symfony_component_console_helper_questionhelper.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Cursor; -use Symfony\Component\Console\Exception\MissingInputException; -use Symfony\Component\Console\Exception\RuntimeException; -use Symfony\Component\Console\Formatter\OutputFormatter; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\StreamableInputInterface; -use Symfony\Component\Console\Output\ConsoleOutputInterface; -use Symfony\Component\Console\Output\ConsoleSectionOutput; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\ChoiceQuestion; -use Symfony\Component\Console\Question\Question; -use Symfony\Component\Console\Terminal; - -use function Symfony\Component\String\s; - -/** - * The QuestionHelper class provides helpers to interact with the user. - * - * @author Fabien Potencier - */ -class QuestionHelper extends Helper -{ - /** - * Asks a question to the user. - * - * @return mixed The user answer - * - * @throws RuntimeException If there is no data to read in the input stream - */ - public function ask(InputInterface $input, OutputInterface $output, Question $question): mixed - { - } - - public function getName(): string - { - } - - /** - * Prevents usage of stty. - * - * @return void - */ - public static function disableStty() - { - } - - /** - * Outputs the question prompt. - * - * @return void - */ - protected function writePrompt(OutputInterface $output, Question $question) - { - } - - /** - * @return string[] - */ - protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag): array - { - } - - /** - * Outputs an error message. - * - * @return void - */ - protected function writeError(OutputInterface $output, \Exception $error) - { - } -} diff --git a/tests/stubs/symfony_component_console_helper_table.php b/tests/stubs/symfony_component_console_helper_table.php deleted file mode 100644 index 373b3fff..00000000 --- a/tests/stubs/symfony_component_console_helper_table.php +++ /dev/null @@ -1,218 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\RuntimeException; -use Symfony\Component\Console\Formatter\OutputFormatter; -use Symfony\Component\Console\Formatter\WrappableOutputFormatterInterface; -use Symfony\Component\Console\Output\ConsoleSectionOutput; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Provides helpers to display a table. - * - * @author Fabien Potencier - * @author Саша Стаменковић - * @author Abdellatif Ait boudad - * @author Max Grigorian - * @author Dany Maillard - */ -class Table -{ - private const SEPARATOR_TOP = 0; - private const SEPARATOR_TOP_BOTTOM = 1; - private const SEPARATOR_MID = 2; - private const SEPARATOR_BOTTOM = 3; - private const BORDER_OUTSIDE = 0; - private const BORDER_INSIDE = 1; - private const DISPLAY_ORIENTATION_DEFAULT = 'default'; - private const DISPLAY_ORIENTATION_HORIZONTAL = 'horizontal'; - private const DISPLAY_ORIENTATION_VERTICAL = 'vertical'; - - public function __construct(OutputInterface $output) - { - } - - /** - * Sets a style definition. - * - * @return void - */ - public static function setStyleDefinition(string $name, TableStyle $style) - { - } - - /** - * Gets a style definition by name. - */ - public static function getStyleDefinition(string $name): TableStyle - { - } - - /** - * Sets table style. - * - * @return $this - */ - public function setStyle(TableStyle|string $name): static - { - } - - /** - * Gets the current table style. - */ - public function getStyle(): TableStyle - { - } - - /** - * Sets table column style. - * - * @param TableStyle|string $name The style name or a TableStyle instance - * - * @return $this - */ - public function setColumnStyle(int $columnIndex, TableStyle|string $name): static - { - } - - /** - * Gets the current style for a column. - * - * If style was not set, it returns the global table style. - */ - public function getColumnStyle(int $columnIndex): TableStyle - { - } - - /** - * Sets the minimum width of a column. - * - * @return $this - */ - public function setColumnWidth(int $columnIndex, int $width): static - { - } - - /** - * Sets the minimum width of all columns. - * - * @return $this - */ - public function setColumnWidths(array $widths): static - { - } - - /** - * Sets the maximum width of a column. - * - * Any cell within this column which contents exceeds the specified width will be wrapped into multiple lines, while - * formatted strings are preserved. - * - * @return $this - */ - public function setColumnMaxWidth(int $columnIndex, int $width): static - { - } - - /** - * @return $this - */ - public function setHeaders(array $headers): static - { - } - - /** - * @return $this - */ - public function setRows(array $rows) - { - } - - /** - * @return $this - */ - public function addRows(array $rows): static - { - } - - /** - * @return $this - */ - public function addRow(TableSeparator|array $row): static - { - } - - /** - * Adds a row to the table, and re-renders the table. - * - * @return $this - */ - public function appendRow(TableSeparator|array $row): static - { - } - - /** - * @return $this - */ - public function setRow(int|string $column, array $row): static - { - } - - /** - * @return $this - */ - public function setHeaderTitle(?string $title): static - { - } - - /** - * @return $this - */ - public function setFooterTitle(?string $title): static - { - } - - /** - * @return $this - */ - public function setHorizontal(bool $horizontal = true): static - { - } - - /** - * @return $this - */ - public function setVertical(bool $vertical = true): static - { - } - - /** - * Renders table to output. - * - * Example: - * - * +---------------+-----------------------+------------------+ - * | ISBN | Title | Author | - * +---------------+-----------------------+------------------+ - * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | - * +---------------+-----------------------+------------------+ - * - * @return void - */ - public function render() - { - } -} diff --git a/tests/stubs/symfony_component_console_input_inputargument.php b/tests/stubs/symfony_component_console_input_inputargument.php deleted file mode 100644 index 8a106813..00000000 --- a/tests/stubs/symfony_component_console_input_inputargument.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Completion\Suggestion; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; - -/** - * Represents a command line argument. - * - * @author Fabien Potencier - */ -class InputArgument -{ - public const REQUIRED = 1; - public const OPTIONAL = 2; - public const IS_ARRAY = 4; - - /** - * @param string $name The argument name - * @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY - * @param string $description A description text - * @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only) - * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion - * - * @throws InvalidArgumentException When argument mode is not valid - */ - public function __construct(string $name, ?int $mode = null, string $description = '', string|bool|int|float|array|null $default = null, \Closure|array $suggestedValues = []) - { - } - - /** - * Returns the argument name. - */ - public function getName(): string - { - } - - /** - * Returns true if the argument is required. - * - * @return bool true if parameter mode is self::REQUIRED, false otherwise - */ - public function isRequired(): bool - { - } - - /** - * Returns true if the argument can take multiple values. - * - * @return bool true if mode is self::IS_ARRAY, false otherwise - */ - public function isArray(): bool - { - } - - /** - * Sets the default value. - * - * @return void - * - * @throws LogicException When incorrect default value is given - */ - public function setDefault(string|bool|int|float|array|null $default = null) - { - } - - /** - * Returns the default value. - */ - public function getDefault(): string|bool|int|float|array|null - { - } - - public function hasCompletion(): bool - { - } - - /** - * Adds suggestions to $suggestions for the current completion input. - * - * @see Command::complete() - */ - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - } - - /** - * Returns the description text. - */ - public function getDescription(): string - { - } -} diff --git a/tests/stubs/symfony_component_console_input_inputinterface.php b/tests/stubs/symfony_component_console_input_inputinterface.php deleted file mode 100644 index 352937c6..00000000 --- a/tests/stubs/symfony_component_console_input_inputinterface.php +++ /dev/null @@ -1,180 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\RuntimeException; - -/** - * InputInterface is the interface implemented by all input classes. - * - * @author Fabien Potencier - * - * @method string __toString() Returns a stringified representation of the args passed to the command. - * InputArguments MUST be escaped as well as the InputOption values passed to the command. - */ -interface InputInterface -{ - /** - * Returns the first argument from the raw parameters (not parsed). - */ - public function getFirstArgument(): ?string - { - } - - /** - * Returns true if the raw parameters (not parsed) contain a value. - * - * This method is to be used to introspect the input parameters - * before they have been validated. It must be used carefully. - * Does not necessarily return the correct result for short options - * when multiple flags are combined in the same option. - * - * @param string|array $values The values to look for in the raw parameters (can be an array) - * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal - */ - public function hasParameterOption(string|array $values, bool $onlyParams = false): bool - { - } - - /** - * Returns the value of a raw option (not parsed). - * - * This method is to be used to introspect the input parameters - * before they have been validated. It must be used carefully. - * Does not necessarily return the correct result for short options - * when multiple flags are combined in the same option. - * - * @param string|array $values The value(s) to look for in the raw parameters (can be an array) - * @param string|bool|int|float|array|null $default The default value to return if no result is found - * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal - * - * @return mixed - */ - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false) - { - } - - /** - * Binds the current Input instance with the given arguments and options. - * - * @return void - * - * @throws RuntimeException - */ - public function bind(InputDefinition $definition) - { - } - - /** - * Validates the input. - * - * @return void - * - * @throws RuntimeException When not enough arguments are given - */ - public function validate() - { - } - - /** - * Returns all the given arguments merged with the default values. - * - * @return array - */ - public function getArguments(): array - { - } - - /** - * Returns the argument value for a given argument name. - * - * @return mixed - * - * @throws InvalidArgumentException When argument given doesn't exist - */ - public function getArgument(string $name) - { - } - - /** - * Sets an argument value by name. - * - * @return void - * - * @throws InvalidArgumentException When argument given doesn't exist - */ - public function setArgument(string $name, mixed $value) - { - } - - /** - * Returns true if an InputArgument object exists by name or position. - */ - public function hasArgument(string $name): bool - { - } - - /** - * Returns all the given options merged with the default values. - * - * @return array - */ - public function getOptions(): array - { - } - - /** - * Returns the option value for a given option name. - * - * @return mixed - * - * @throws InvalidArgumentException When option given doesn't exist - */ - public function getOption(string $name) - { - } - - /** - * Sets an option value by name. - * - * @return void - * - * @throws InvalidArgumentException When option given doesn't exist - */ - public function setOption(string $name, mixed $value) - { - } - - /** - * Returns true if an InputOption object exists by name. - */ - public function hasOption(string $name): bool - { - } - - /** - * Is this input means interactive? - */ - public function isInteractive(): bool - { - } - - /** - * Sets the input interactivity. - * - * @return void - */ - public function setInteractive(bool $interactive) - { - } -} diff --git a/tests/stubs/symfony_component_console_input_inputoption.php b/tests/stubs/symfony_component_console_input_inputoption.php deleted file mode 100644 index ab5680e5..00000000 --- a/tests/stubs/symfony_component_console_input_inputoption.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Completion\Suggestion; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; - -/** - * Represents a command line option. - * - * @author Fabien Potencier - */ -class InputOption -{ - /** - * Do not accept input for the option (e.g. --yell). This is the default behavior of options. - */ - public const VALUE_NONE = 1; - - /** - * A value must be passed when the option is used (e.g. --iterations=5 or -i5). - */ - public const VALUE_REQUIRED = 2; - - /** - * The option may or may not have a value (e.g. --yell or --yell=loud). - */ - public const VALUE_OPTIONAL = 4; - - /** - * The option accepts multiple values (e.g. --dir=/foo --dir=/bar). - */ - public const VALUE_IS_ARRAY = 8; - - /** - * The option may have either positive or negative value (e.g. --ansi or --no-ansi). - */ - public const VALUE_NEGATABLE = 16; - - /** - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the VALUE_* constants - * @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE) - * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion - * - * @throws InvalidArgumentException If option mode is invalid or incompatible - */ - public function __construct(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', string|bool|int|float|array|null $default = null, array|\Closure $suggestedValues = []) - { - } - - /** - * Returns the option shortcut. - */ - public function getShortcut(): ?string - { - } - - /** - * Returns the option name. - */ - public function getName(): string - { - } - - /** - * Returns true if the option accepts a value. - * - * @return bool true if value mode is not self::VALUE_NONE, false otherwise - */ - public function acceptValue(): bool - { - } - - /** - * Returns true if the option requires a value. - * - * @return bool true if value mode is self::VALUE_REQUIRED, false otherwise - */ - public function isValueRequired(): bool - { - } - - /** - * Returns true if the option takes an optional value. - * - * @return bool true if value mode is self::VALUE_OPTIONAL, false otherwise - */ - public function isValueOptional(): bool - { - } - - /** - * Returns true if the option can take multiple values. - * - * @return bool true if mode is self::VALUE_IS_ARRAY, false otherwise - */ - public function isArray(): bool - { - } - - public function isNegatable(): bool - { - } - - /** - * @return void - */ - public function setDefault(string|bool|int|float|array|null $default = null) - { - } - - /** - * Returns the default value. - */ - public function getDefault(): string|bool|int|float|array|null - { - } - - /** - * Returns the description text. - */ - public function getDescription(): string - { - } - - public function hasCompletion(): bool - { - } - - /** - * Adds suggestions to $suggestions for the current completion input. - * - * @see Command::complete() - */ - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - } - - /** - * Checks whether the given option equals this one. - */ - public function equals(self $option): bool - { - } -} diff --git a/tests/stubs/symfony_component_console_question_confirmationquestion.php b/tests/stubs/symfony_component_console_question_confirmationquestion.php deleted file mode 100644 index 0db6fe2f..00000000 --- a/tests/stubs/symfony_component_console_question_confirmationquestion.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Question; - -/** - * Represents a yes/no question. - * - * @author Fabien Potencier - */ -class ConfirmationQuestion extends Question -{ - /** - * @param string $question The question to ask to the user - * @param bool $default The default answer to return, true or false - * @param string $trueAnswerRegex A regex to match the "yes" answer - */ - public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i') - { - } -} diff --git a/tests/stubs/symfony_component_console_question_question.php b/tests/stubs/symfony_component_console_question_question.php deleted file mode 100644 index c04b412b..00000000 --- a/tests/stubs/symfony_component_console_question_question.php +++ /dev/null @@ -1,207 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Question; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; - -/** - * Represents a Question. - * - * @author Fabien Potencier - */ -class Question -{ - /** - * @param string $question The question to ask to the user - * @param string|bool|int|float|null $default The default answer to return if the user enters nothing - */ - public function __construct(string $question, string|bool|int|float|null $default = null) - { - } - - /** - * Returns the question. - */ - public function getQuestion(): string - { - } - - /** - * Returns the default answer. - */ - public function getDefault(): string|bool|int|float|null - { - } - - /** - * Returns whether the user response accepts newline characters. - */ - public function isMultiline(): bool - { - } - - /** - * Sets whether the user response should accept newline characters. - * - * @return $this - */ - public function setMultiline(bool $multiline): static - { - } - - /** - * Returns whether the user response must be hidden. - */ - public function isHidden(): bool - { - } - - /** - * Sets whether the user response must be hidden or not. - * - * @return $this - * - * @throws LogicException In case the autocompleter is also used - */ - public function setHidden(bool $hidden): static - { - } - - /** - * In case the response cannot be hidden, whether to fallback on non-hidden question or not. - */ - public function isHiddenFallback(): bool - { - } - - /** - * Sets whether to fallback on non-hidden question if the response cannot be hidden. - * - * @return $this - */ - public function setHiddenFallback(bool $fallback): static - { - } - - /** - * Gets values for the autocompleter. - */ - public function getAutocompleterValues(): ?iterable - { - } - - /** - * Sets values for the autocompleter. - * - * @return $this - * - * @throws LogicException - */ - public function setAutocompleterValues(?iterable $values): static - { - } - - /** - * Gets the callback function used for the autocompleter. - */ - public function getAutocompleterCallback(): ?callable - { - } - - /** - * Sets the callback function used for the autocompleter. - * - * The callback is passed the user input as argument and should return an iterable of corresponding suggestions. - * - * @return $this - */ - public function setAutocompleterCallback(?callable $callback = null): static - { - } - - /** - * Sets a validator for the question. - * - * @return $this - */ - public function setValidator(?callable $validator = null): static - { - } - - /** - * Gets the validator for the question. - */ - public function getValidator(): ?callable - { - } - - /** - * Sets the maximum number of attempts. - * - * Null means an unlimited number of attempts. - * - * @return $this - * - * @throws InvalidArgumentException in case the number of attempts is invalid - */ - public function setMaxAttempts(?int $attempts): static - { - } - - /** - * Gets the maximum number of attempts. - * - * Null means an unlimited number of attempts. - */ - public function getMaxAttempts(): ?int - { - } - - /** - * Sets a normalizer for the response. - * - * The normalizer can be a callable (a string), a closure or a class implementing __invoke. - * - * @return $this - */ - public function setNormalizer(callable $normalizer): static - { - } - - /** - * Gets the normalizer for the response. - * - * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. - */ - public function getNormalizer(): ?callable - { - } - - /** - * @return bool - */ - protected function isAssoc(array $array) - { - } - - public function isTrimmable(): bool - { - } - - /** - * @return $this - */ - public function setTrimmable(bool $trimmable): static - { - } -} diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index 739b00ad..87aa87b0 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -1,6 +1,6 @@ { "require-dev": { "phpstan/phpstan": "^2.1", - "nextcloud/ocp": "dev-stable32" + "nextcloud/ocp": "dev-master" } } diff --git a/vendor-bin/phpstan/composer.lock b/vendor-bin/phpstan/composer.lock index 1b5f9cc3..8811cb79 100644 --- a/vendor-bin/phpstan/composer.lock +++ b/vendor-bin/phpstan/composer.lock @@ -4,34 +4,39 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bf7041f4d29101be1cd2bdc7ea13ea35", + "content-hash": "2ba0d232f191b7861ad309451f96651d", "packages": [], "packages-dev": [ { "name": "nextcloud/ocp", - "version": "dev-stable32", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/nextcloud-deps/ocp.git", - "reference": "78e3e2d8dece0cf49a760cee2d2d0fc239c95ebc" + "reference": "07bd97eb2a841142cf8f9f097a8d394e24c13899" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/78e3e2d8dece0cf49a760cee2d2d0fc239c95ebc", - "reference": "78e3e2d8dece0cf49a760cee2d2d0fc239c95ebc", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/07bd97eb2a841142cf8f9f097a8d394e24c13899", + "reference": "07bd97eb2a841142cf8f9f097a8d394e24c13899", "shasum": "" }, "require": { - "php": "~8.1 || ~8.2 || ~8.3 || ~8.4", + "php": "~8.3 || ~8.4 || ~8.5", "psr/clock": "^1.0", "psr/container": "^2.0.2", "psr/event-dispatcher": "^1.0", - "psr/log": "^3.0.2" + "psr/http-client": "^1.0.3", + "psr/log": "^3.0.2", + "symfony/polyfill-intl-normalizer": "^1.38", + "symfony/polyfill-php84": "^1.38", + "symfony/polyfill-php85": "^1.41" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-stable32": "32.0.0-dev" + "dev-master": "35.0.0-dev" } }, "notification-url": "https://packagist.org/downloads/", @@ -51,9 +56,9 @@ "description": "Composer package containing Nextcloud's public OCP API and the unstable NCU API", "support": { "issues": "https://github.com/nextcloud-deps/ocp/issues", - "source": "https://github.com/nextcloud-deps/ocp/tree/stable32" + "source": "https://github.com/nextcloud-deps/ocp/tree/master" }, - "time": "2026-04-28T01:53:22+00:00" + "time": "2026-08-12T10:46:49+00:00" }, { "name": "phpstan/phpstan", @@ -259,6 +264,111 @@ }, "time": "2019-01-08T18:20:26+00:00" }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, { "name": "psr/log", "version": "3.0.2", @@ -308,6 +418,251 @@ "source": "https://github.com/php-fig/log/tree/3.0.2" }, "time": "2024-09-11T13:17:53+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.38.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b", + "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-25T13:48:31+00:00" + }, + { + "name": "symfony/polyfill-php84", + "version": "v1.38.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa", + "reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.38.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-26T12:51:13+00:00" + }, + { + "name": "symfony/polyfill-php85", + "version": "v1.41.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php85.git", + "reference": "255fab485aaa1006ed411040c42aecd7b5302d7a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/255fab485aaa1006ed411040c42aecd7b5302d7a", + "reference": "255fab485aaa1006ed411040c42aecd7b5302d7a", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php85\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php85/tree/v1.41.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-07-01T12:47:55+00:00" } ], "aliases": [],