Skip to content

Commit e2a34b3

Browse files
author
Dorazil
committed
change CSFixer
1 parent 4170fc4 commit e2a34b3

File tree

482 files changed

+2706
-3234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

482 files changed

+2706
-3234
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ app/config/google-credentials*
2222
adminer.php
2323
*.sh
2424
.env
25+
/.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__ . '/bin')
5+
->in(__DIR__ . '/app')
6+
->in(__DIR__ . '/docker')
7+
->in(__DIR__ . '/tests')
8+
->exclude('_temp')
9+
->exclude('_generated');
10+
11+
return (new PhpCsFixer\Config())
12+
->setRules([
13+
'@Symfony' => true,
14+
'yoda_style' => false,
15+
'phpdoc_separation' => false,
16+
'phpdoc_to_comment' => [
17+
'ignored_tags' => ['var'],
18+
],
19+
'global_namespace_import' => [
20+
'import_classes' => true,
21+
],
22+
'not_operator_with_successor_space' => true,
23+
])
24+
->setFinder($finder)
25+
->setLineEnding("\n");

app/AccountancyModule/AccountancyHelpers.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131

3232
abstract class AccountancyHelpers
3333
{
34-
private const DATE_FORMAT_FULL = 'j. n. Y';
34+
private const DATE_FORMAT_FULL = 'j. n. Y';
3535
private const DATE_FORMAT_DAY_MONTH = 'j. n.';
36-
private const DATE_FORMAT_DAY = 'j.';
36+
private const DATE_FORMAT_DAY = 'j.';
3737

3838
public static function loader(string $filter): callable
3939
{
@@ -176,14 +176,14 @@ public static function campStateLabel(string $s): string
176176
}
177177

178178
/** @filter */
179-
public static function commandState(DateTimeInterface|null $s): string
179+
public static function commandState(?DateTimeInterface $s): string
180180
{
181181
if ($s === null) {
182182
return '<span class="hidden-xs hidden-sm badge bg-warning text-dark">Rozpracovaný</span>';
183183
}
184184

185-
return '<span class="badge bg-success" title="Uzavřeno dne: ' .
186-
$s->format('j.n.Y H:i:s') . '">Uzavřený</span>';
185+
return '<span class="badge bg-success" title="Uzavřeno dne: '.
186+
$s->format('j.n.Y H:i:s').'">Uzavřený</span>';
187187
}
188188

189189
/** @filter */
@@ -209,20 +209,20 @@ public static function paymentStateLabel(State $s): Html
209209

210210
return Html::el('span')
211211
->setText(self::paymentState($s->toString(), false))
212-
->setAttribute('class', 'badge ' . ($classes[$s->toString()] ?? 'secondary'));
212+
->setAttribute('class', 'badge '.($classes[$s->toString()] ?? 'secondary'));
213213
}
214214

215215
/**
216216
* @param float|string|Money|null $price
217-
* http://prirucka.ujc.cas.cz/?id=786
217+
* http://prirucka.ujc.cas.cz/?id=786
218218
*
219219
* @filter
220220
* formátuje číslo na částku
221221
*/
222222
public static function price(float|string|Money|null $price, bool $full = true): string
223223
{
224224
if ($price === null || $price === '') {
225-
return ' '; //je tam nedělitelná mezera
225+
return ' '; // je tam nedělitelná mezera
226226
}
227227

228228
$decimals = $full ? 2 : 0;
@@ -231,7 +231,7 @@ public static function price(float|string|Money|null $price, bool $full = true):
231231
$price = (float) $price->getAmount() / 100;
232232
}
233233

234-
return number_format((float) $price, $decimals, ',', ' '); //nedělitelná mezera
234+
return number_format((float) $price, $decimals, ',', ' '); // nedělitelná mezera
235235
}
236236

237237
/**
@@ -248,7 +248,7 @@ public static function postCode(string $oldPsc): string
248248
$psc = preg_replace('/[^0-9]/', '', $oldPsc);
249249

250250
if (strlen($psc) === 5) {
251-
return substr($psc, 0, 3) . ' ' . substr($psc, -2);
251+
return substr($psc, 0, 3).' '.substr($psc, -2);
252252
}
253253

254254
return $oldPsc;
@@ -260,7 +260,7 @@ public static function postCode(string $oldPsc): string
260260
*/
261261
public static function priceToString(float $price): string
262262
{
263-
//@todo ošetření správného tvaru
263+
// @todo ošetření správného tvaru
264264

265265
$_jednotky = [
266266
0 => '',
@@ -297,7 +297,7 @@ public static function priceToString(float $price): string
297297
8 => 'osmdesát',
298298
9 => 'devadesát',
299299
];
300-
$_sta = [
300+
$_sta = [
301301
0 => '',
302302
1 => 'jednosto',
303303
2 => 'dvěstě',
@@ -309,50 +309,50 @@ public static function priceToString(float $price): string
309309
8 => 'osmset',
310310
9 => 'devětset',
311311
];
312-
$_tisice = [
312+
$_tisice = [
313313
0 => '',
314314
1 => 'jedentisíc',
315315
2 => 'dvatisíce',
316316
3 => 'třitisíce',
317317
4 => 'čtyřitisíce',
318318
];
319319

320-
$string = '';
321-
$parts = explode('.', (string) $price, 2); //0-pred 1-za desitou čárkou
320+
$string = '';
321+
$parts = explode('.', (string) $price, 2); // 0-pred 1-za desitou čárkou
322322
$numbers = array_reverse(str_split($parts[0]));
323323

324324
if (count($numbers) > 6) {
325325
return 'PŘÍLIŠ VYSOKÉ ČÍSLO';
326326
}
327327

328-
for ($i = count($numbers); $i < 6; ++$i) { //doplnění nezaplněných řádu
328+
for ($i = count($numbers); $i < 6; ++$i) { // doplnění nezaplněných řádu
329329
$numbers[$i] = 0;
330330
}
331331

332-
//tisice
333-
$nTisice = (int) ($numbers[5] . $numbers[4] . $numbers[3]);
332+
// tisice
333+
$nTisice = (int) ($numbers[5].$numbers[4].$numbers[3]);
334334
if ($nTisice <= 4) {
335335
$string .= $_tisice[$numbers[3]];
336336
} elseif ($nTisice < 20) {
337-
$string .= $_jednotky[(int) ($numbers[4] . $numbers[3])] . 'tisíc';
337+
$string .= $_jednotky[(int) ($numbers[4].$numbers[3])].'tisíc';
338338
} elseif ($nTisice < 100) {
339-
$string .= $_desitky[$numbers[4]] . $_jednotky[$numbers[3]] . 'tisíc';
339+
$string .= $_desitky[$numbers[4]].$_jednotky[$numbers[3]].'tisíc';
340340
} else {
341-
$string .= $_sta[$numbers[5]] . $_desitky[$numbers[4]] . $_jednotky[$numbers[3]] . 'tisíc';
341+
$string .= $_sta[$numbers[5]].$_desitky[$numbers[4]].$_jednotky[$numbers[3]].'tisíc';
342342
}
343343

344-
//sta
344+
// sta
345345
$string .= $_sta[$numbers[2]];
346346

347-
//desitky a jednotky
348-
$nDesitky = (int) ($numbers[1] . $numbers[0]);
347+
// desitky a jednotky
348+
$nDesitky = (int) ($numbers[1].$numbers[0]);
349349
if ($nDesitky < 20) {
350350
$string .= $_jednotky[$nDesitky];
351351
} else {
352-
$string .= $_desitky[$numbers[1]] . $_jednotky[$numbers[0]];
352+
$string .= $_desitky[$numbers[1]].$_jednotky[$numbers[0]];
353353
}
354354

355-
return mb_strtoupper(mb_substr($string, 0, 1, 'UTF-8'), 'UTF-8') . mb_substr($string, 1, null, 'UTF-8');
355+
return mb_strtoupper(mb_substr($string, 0, 1, 'UTF-8'), 'UTF-8').mb_substr($string, 1, null, 'UTF-8');
356356
}
357357

358358
/** @filter */

app/AccountancyModule/CampModule/CampListDataSource.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@
2020

2121
final class CampListDataSource extends DataSource
2222
{
23-
private int|null $year = null;
23+
private ?int $year = null;
2424

25-
private string|null $state = null;
25+
private ?string $state = null;
2626

2727
public function __construct(private QueryBus $queryBus)
2828
{
2929
}
3030

31-
public function filterByYear(int|null $year): self
31+
public function filterByYear(?int $year): self
3232
{
3333
$this->year = $year;
3434

3535
return $this;
3636
}
3737

38-
public function filterByState(string|null $state): self
38+
public function filterByState(?string $state): self
3939
{
4040
$this->state = $state;
4141

@@ -63,7 +63,7 @@ function (Camp $camp): CampListItem {
6363
);
6464
}
6565

66-
private function chitNumberPrefix(Camp $camp): string|null
66+
private function chitNumberPrefix(Camp $camp): ?string
6767
{
6868
$cashbookId = $this->queryBus->handle(new CampCashbookIdQuery($camp->getId()));
6969

app/AccountancyModule/CampModule/Components/ExportDialog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function beforeRender(): void
2727
{
2828
parent::beforeRender();
2929

30-
$this->template->setFile(__DIR__ . '/templates/ExportDialog.latte');
30+
$this->template->setFile(__DIR__.'/templates/ExportDialog.latte');
3131
}
3232

3333
protected function createComponentForm(): BaseForm

app/AccountancyModule/CampModule/Components/MissingAutocomputedCategoryControl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ public function render(): void
3838
$camp = $this->queryBus->handle(new CampQuery($this->campId));
3939
assert($camp instanceof \Model\Event\Camp);
4040

41-
$this->template->setFile(__DIR__ . '/templates/MissingAutocomputedCategoryControl.latte');
41+
$this->template->setFile(__DIR__.'/templates/MissingAutocomputedCategoryControl.latte');
4242
$this->template->setParameters([
4343
'isApproved' => in_array($camp->getState(), [CampState::APPROVED_PARENT, CampState::REAL->value]),
4444
'isEditable' => $this->authorizator->isAllowed(Camp::UPDATE_REAL, $this->campId->toInt()),
45-
'canActivate' => $this->authorizator->isAllowed(Camp::UPDATE_REAL_COST, $this->campId->toInt()),
45+
'canActivate' => $this->authorizator->isAllowed(Camp::UPDATE_REAL_COST, $this->campId->toInt()),
4646
]);
4747
$this->template->render();
4848
}

app/AccountancyModule/CampModule/presenters/BasePresenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function startup(): void
3434
}
3535

3636
$cashbookId = $this->queryBus->handle(new CampCashbookIdQuery(new SkautisCampId($this->aid)));
37-
$cashbook = $this->queryBus->handle(new CashbookQuery($cashbookId));
37+
$cashbook = $this->queryBus->handle(new CashbookQuery($cashbookId));
3838
assert($cashbook instanceof Cashbook);
3939

4040
$this->isEditable = $this->authorizator->isAllowed(CampResource::UPDATE_REAL, $this->aid);
@@ -64,7 +64,7 @@ protected function editableOnly(): void
6464
}
6565
}
6666

67-
protected function getCampId(): int|null
67+
protected function getCampId(): ?int
6868
{
6969
return $this->aid;
7070
}

app/AccountancyModule/CampModule/presenters/BudgetPresenter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public function renderDefault(int $aid): void
4444
try {
4545
$inconsistentTotals = $this->queryBus->handle(new InconsistentCampCategoryTotalsQuery($campId));
4646
$this->template->setParameters([
47-
'isConsistent' => count($inconsistentTotals) === 0,
48-
'toRepair' => $inconsistentTotals,
49-
'budgetEntries' => $this->queryBus->handle(new CampBudgetQuery($campId)),
50-
'categoriesSummary' => $this->queryBus->handle(new CategoriesSummaryQuery($this->getCashbookId($aid))),
47+
'isConsistent' => count($inconsistentTotals) === 0,
48+
'toRepair' => $inconsistentTotals,
49+
'budgetEntries' => $this->queryBus->handle(new CampBudgetQuery($campId)),
50+
'categoriesSummary' => $this->queryBus->handle(new CategoriesSummaryQuery($this->getCashbookId($aid))),
5151
'isUpdateStatementAllowed' => $this->authorizator->isAllowed(Camp::UPDATE_BUDGET, $aid),
5252
]);
5353
if (! $this->isAjax()) {
@@ -61,7 +61,7 @@ public function renderDefault(int $aid): void
6161
}
6262

6363
/**
64-
* přepočte hodnoty v jednotlivých kategorich
64+
* přepočte hodnoty v jednotlivých kategorich.
6565
*/
6666
public function handleConvert(int $aid): void
6767
{

app/AccountancyModule/CampModule/presenters/CashbookPresenter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ protected function startup(): void
4949
{
5050
parent::startup();
5151

52-
$this->isEditable = $this->isEditable || $this->authorizator->isAllowed(Camp::UPDATE_REAL_COST, $this->getCampId());
52+
$this->isEditable = $this->isEditable || $this->authorizator->isAllowed(Camp::UPDATE_REAL_COST, $this->getCampId());
5353
$this->isRealTotalCostAutoComputed = ! $this->event->isRealTotalCostAutoComputed();
5454
}
5555

5656
public function renderDefault(int $aid): void
5757
{
58-
$finalBalance = $this->queryBus->handle(new FinalCashBalanceQuery($this->getCashbookId()));
58+
$finalBalance = $this->queryBus->handle(new FinalCashBalanceQuery($this->getCashbookId()));
5959
$missingCategories = $this->isRealTotalCostAutoComputed;
6060
try {
6161
$finalRealBalance = $this->queryBus->handle(new FinalRealBalanceQuery($this->getCashbookId()));
6262
assert($finalRealBalance instanceof Money);
6363
} catch (MissingCategory) {
64-
$finalRealBalance = null;
64+
$finalRealBalance = null;
6565
$missingCategories = true;
6666
}
6767

@@ -137,10 +137,10 @@ private function formImportHpdSubmitted(BaseForm $form): void
137137
$this->redirect('default', ['aid' => $this->getCampId()]);
138138
}
139139

140-
$purpose = 'úč. příspěvky ' . ($values->isAccount === 'Y' ? '- účet' : '- hotovost');
141-
$body = new ChitBody(null, $this->event->getStartDate(), null);
140+
$purpose = 'úč. příspěvky '.($values->isAccount === 'Y' ? '- účet' : '- hotovost');
141+
$body = new ChitBody(null, $this->event->getStartDate(), null);
142142

143-
$categoryId = $this->queryBus->handle(
143+
$categoryId = $this->queryBus->handle(
144144
new CampParticipantCategoryIdQuery(new SkautisCampId($this->getCampId()), ParticipantType::get($values->cat === 'adult' ? ParticipantType::ADULT : ParticipantType::CHILD)),
145145
);
146146
$categoriesDto = $this->queryBus->handle(new CategoryListQuery($this->getCashbookId()));

app/AccountancyModule/CampModule/presenters/DefaultPresenter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class DefaultPresenter extends BasePresenter
1717
{
18-
public const DEFAULT_STATE = 'approvedParent'; //filtrovani zobrazených položek
18+
public const DEFAULT_STATE = 'approvedParent'; // filtrovani zobrazených položek
1919

2020
public function __construct(private GridFactory $gridFactory, private IExportDialogFactory $exportDialogFactory)
2121
{
@@ -29,7 +29,7 @@ protected function startup(): void
2929

3030
protected function createComponentGrid(): DataGrid
3131
{
32-
$grid = $this->gridFactory->createSimpleGrid(__DIR__ . '/../templates/@campsGrid.latte');
32+
$grid = $this->gridFactory->createSimpleGrid(__DIR__.'/../templates/@campsGrid.latte');
3333

3434
$grid->addColumnLink('name', 'Název', 'Detail:', null, ['aid' => 'id'])
3535
->setSortable();
@@ -55,7 +55,7 @@ protected function createComponentGrid(): DataGrid
5555

5656
$states = array_merge([DataGrid::OPTION_ALL => 'Nezrušené'], $this->queryBus->handle(new CampStates()));
5757
$grid->addFilterSelect('state', 'Stav', $states)
58-
->setCondition(function (CampListDataSource $dataSource, string|null $state): void {
58+
->setCondition(function (CampListDataSource $dataSource, ?string $state): void {
5959
$dataSource->filterByState($state === DataGrid::OPTION_ALL ? null : $state);
6060
});
6161

0 commit comments

Comments
 (0)