Skip to content

Commit

Permalink
Merge pull request #45 from DivanteLtd/php8
Browse files Browse the repository at this point in the history
Php8 compatibility
  • Loading branch information
punk-raider authored Sep 6, 2022
2 parents 38eae0d + 4f6d5b9 commit 13b6e5b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 14 deletions.
4 changes: 3 additions & 1 deletion src/Command/BricksUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected function configure()
* @param OutputInterface $output
* @return int|void|null
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$inputOutput = new SymfonyStyle($input, $output);
$bundleName = $input->getArgument('bundle');
Expand All @@ -74,5 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->installerService->createObjectBrickDefinition($brickName, $brickFile);
$inputOutput->success(sprintf('Brick %s was successfully installed!', $brickName));
}

return Command::SUCCESS;
}
}
4 changes: 3 additions & 1 deletion src/Command/ClassesUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function configure()
* @param OutputInterface $output
* @return int|void|null
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$inputOutput = new SymfonyStyle($input, $output);
$bundleName = $input->getArgument('bundle');
Expand All @@ -74,5 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->installerService->createClassDefinition($className, $classFile);
$inputOutput->success(sprintf('Class %s was successfully installed!', $className));
}

return Command::SUCCESS;
}
}
11 changes: 7 additions & 4 deletions src/Command/DeleteByIdCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace PimcoreDevkitBundle\Command;

use Pimcore\Console\AbstractCommand;
use Symfony\Component\Console\Command\Command;
use Pimcore\Model\Asset;
use Pimcore\Model\Document;
use Pimcore\Model\DataObject\AbstractObject;
Expand Down Expand Up @@ -46,18 +47,18 @@ protected function configure(): void
* @param OutputInterface $output
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$type = $input->getOption("type");
if (!$type) {
$output->writeln("Missing -t option.");
return;
return Command::FAILURE;
}

$id = $input->getOption("id");
if (!$id) {
$output->writeln("Missing -id option.");
return;
return Command::FAILURE;
}

try {
Expand All @@ -73,13 +74,15 @@ protected function execute(InputInterface $input, OutputInterface $output): void
break;
default:
$output->writeln("Incorrect tree type, allowed types: object, document, asset.");
return;
return Command::FAILURE;
}

$output->writeln("Element " . $id . " has been deleted.");
} catch (\Exception $e) {
$output->writeln($e->getMessage());
}

return Command::SUCCESS;
}

/**
Expand Down
11 changes: 7 additions & 4 deletions src/Command/DeleteFolderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace PimcoreDevkitBundle\Command;

use Pimcore\Console\AbstractCommand;
use Symfony\Component\Console\Command\Command;
use Pimcore\Model\DataObject\Folder;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -44,18 +45,18 @@ protected function configure(): void
* @param OutputInterface $output
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$type = $input->getOption("type");
if (!$type) {
$output->writeln("Missing -t option.");
return;
return Command::FAILURE;
}

$path = $input->getOption("folder");
if (!$path) {
$output->writeln("Missing -f option.");
return;
return Command::FAILURE;
}

try {
Expand All @@ -71,13 +72,15 @@ protected function execute(InputInterface $input, OutputInterface $output): void
break;
default:
$output->writeln("Incorrect tree type, allowed types: object, document, asset.");
return;
return Command::FAILURE;
}

$output->writeln("Folder " . $path . " has been deleted.");
} catch (\Exception $e) {
$output->writeln($e->getMessage());
}

return Command::SUCCESS;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Command/FieldcollectionsUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function configure()
* @param OutputInterface $output
* @return int|void|null
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$inputOutput = new SymfonyStyle($input, $output);
$bundleName = $input->getArgument('bundle');
Expand All @@ -65,5 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->installerService->createFieldcollectionDefinition($fieldcollectionName, $fieldcollectionFile);
$inputOutput->success(sprintf('Fieldcollection %s was successfully installed!', $fieldcollectionName));
}

return Command::SUCCESS;
}
}
5 changes: 4 additions & 1 deletion src/Command/RemoveAllObjectsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use PimcoreDevkitBundle\Service\DataObjectService;
use Pimcore\Console\AbstractCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -43,7 +44,7 @@ protected function configure()
* @return void
* @throws \Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$classesList = $input->getOption('classes');

Expand All @@ -60,5 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$output->writeln("TOTAL REMOVED: $cnt");
}

return Command::SUCCESS;
}
}
8 changes: 6 additions & 2 deletions src/FileLocator/PimcoreBundlesFilesLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ private function getPimcoreFiles(string $bundleCatalog): array
{
$finder = $this->getFinder();
try {
$finder->in(sprintf('src/%s/' . static::SUBCATALOG, $bundleCatalog));
$finder->in(sprintf('src/%s/%s', $bundleCatalog, static::SUBCATALOG));
} catch (DirectoryNotFoundException $exception) {
return [];
}
try {
$finder->in(sprintf('app/%s', static::SUBCATALOG));
} catch (DirectoryNotFoundException $exception) {
}

if (!$finder->hasResults()) {
return [];
}
Expand Down

0 comments on commit 13b6e5b

Please sign in to comment.