Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Set more options for php-cs-fixer's trailing comma in multiline rule #235

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
'single_line_comment_style' => ['comment_types' => ['hash']],
// @todo: Can be dropped once we enable @PER-CS2.0
'single_line_empty_body' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']],
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],

Expand Down
10 changes: 5 additions & 5 deletions Classes/Command/CreateWizardCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ protected function configure(): void
->addArgument(
'wizardName',
InputArgument::OPTIONAL,
'The wizard\'s name'
'The wizard\'s name',
)
->addOption(
'brute-force',
'b',
InputOption::VALUE_NONE,
'Allow the "Wizard of Oz". You can use --brute-force or -b when running command'
'Allow the "Wizard of Oz". You can use --brute-force or -b when running command',
);
}

protected function execute(
InputInterface $input,
OutputInterface $output
OutputInterface $output,
): int {
$io = new SymfonyStyle($input, $output);
$wizardName = $input->getArgument('wizardName');
Expand All @@ -62,13 +62,13 @@ protected function execute(
private function doMagic(
SymfonyStyle $io,
mixed $wizardName,
bool $bruteForce
bool $bruteForce,
) {
$io->comment('Trying to create wizard ' . $wizardName . '...');
if ($wizardName === null) {
$wizardName = (string)$io->ask(
'Enter the wizard\'s name (e.g. "Gandalf the Grey")',
'Lord Voldermort'
'Lord Voldermort',
);
}
if (!$bruteForce && $wizardName === 'Oz') {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Command/MeowInformationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function configure()

protected function execute(
InputInterface $input,
OutputInterface $output
OutputInterface $output,
): int {
$io = new SymfonyStyle($input, $output);
$io->title($this->getDescription());
Expand Down
22 changes: 11 additions & 11 deletions Classes/Controller/AdminModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
$allowedOptions = [
'function' => [
'debug' => htmlspecialchars(
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:debug')
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:debug'),
),
'password' => htmlspecialchars(
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:password')
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:password'),
),
'index' => htmlspecialchars(
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:index')
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:index'),
),
],
];
Expand All @@ -66,27 +66,27 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
case 'debug':
$moduleTemplate->setTitle(
$title,
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.debug')
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.debug'),
);
return $this->debugAction($request, $moduleTemplate);
case 'password':
$moduleTemplate->setTitle(
$title,
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.password')
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.password'),
);
return $this->passwordAction($request, $moduleTemplate);
default:
$moduleTemplate->setTitle(
$title,
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.log')
$languageService->sL('EXT:examples/Resources/Private/Language/AdminModule/locallang.xlf:module.menu.log'),
);
return $this->indexAction($request, $moduleTemplate);
}
}

private function setUpDocHeader(
ServerRequestInterface $request,
ModuleTemplate $view
ModuleTemplate $view,
) {
$buttonBar = $view->getDocHeaderComponent()->getButtonBar();
$list = $buttonBar->makeLinkButton()
Expand All @@ -99,15 +99,15 @@ private function setUpDocHeader(

public function indexAction(
ServerRequestInterface $request,
ModuleTemplate $view
ModuleTemplate $view,
): ResponseInterface {
$view->assign('aVariable', 'aValue');
return $view->renderResponse('AdminModule/Index');
}

protected function debugAction(
ServerRequestInterface $request,
ModuleTemplate $view
ModuleTemplate $view,
): ResponseInterface {
$cmd = $request->getParsedBody()['tx_examples_admin_examples']['cmd'] ?? 'cookies';
switch ($cmd) {
Expand All @@ -122,14 +122,14 @@ protected function debugAction(
[
'cookies' => $request->getCookieParams(),
'lastcommand' => $cmd,
]
],
);
return $view->renderResponse('AdminModule/Debug');
}

protected function passwordAction(
ServerRequestInterface $request,
ModuleTemplate $view
ModuleTemplate $view,
): ResponseInterface {
// TODO: Do something
return $view->renderResponse('AdminModule/Password');
Expand Down
4 changes: 2 additions & 2 deletions Classes/Controller/FalExampleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function listFilesAction(): ResponseInterface
[
'folder' => $folder,
'files' => $files,
]
],
);
}
return $this->htmlResponse();
Expand All @@ -70,7 +70,7 @@ public function collectionAction(): ResponseInterface
[
'collection' => $collection,
'files' => $collection->getItems(),
]
],
);
}
return $this->htmlResponse();
Expand Down
6 changes: 3 additions & 3 deletions Classes/Controller/Haiku/DetailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ private function notFoundAction(string $reason): never
null,
404,
[],
$reason
)
$reason,
),
);
}

Expand All @@ -105,7 +105,7 @@ private function loadFlexFormSettings(): void
{
$this->conf['settings'] = $this->flexFormSettingsService->combineSettings(
$this->conf['settings'] ?? [],
$this->cObj->data['pi_flexform'] ?? ''
$this->cObj->data['pi_flexform'] ?? '',
);
}
}
2 changes: 1 addition & 1 deletion Classes/Controller/Haiku/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private function loadFlexFormSettings(): void
{
$this->conf['settings'] = $this->flexFormSettingsService->combineSettings(
$this->conf['settings'] ?? [],
$this->cObj->data['pi_flexform'] ?? ''
$this->cObj->data['pi_flexform'] ?? '',
);
}
}
8 changes: 4 additions & 4 deletions Classes/Controller/HtmlParserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public function indexAction(): ResponseInterface
// Splitting HTML into blocks defined by <div> and <table> block tags
$this->view->assign(
'result1',
$this->htmlParser->splitIntoBlock('div,table', $testHTML)
$this->htmlParser->splitIntoBlock('div,table', $testHTML),
);

// Splitting HTML into blocks defined by <img> and <br> single tags
$this->view->assign(
'result2',
$this->htmlParser->splitTags('img,br', $testHTML)
$this->htmlParser->splitTags('img,br', $testHTML),
);

// Cleaning HTML
Expand Down Expand Up @@ -97,8 +97,8 @@ public function indexAction(): ResponseInterface
$tagCfg,
false,
false,
['xhtml' => 1]
)
['xhtml' => 1],
),
);
return $this->htmlResponse();
}
Expand Down
Loading
Loading