Skip to content

Commit dbc636b

Browse files
authored
Fix the pipeline (#100)
1 parent 6964ba5 commit dbc636b

27 files changed

Lines changed: 107 additions & 101 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ Tests/Application/*.local
2626
# php-cs-fixer
2727
.php_cs.cache
2828
php-cs-fixer
29+
/.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,32 @@
1414
->in(__DIR__);
1515

1616
$config = new PhpCsFixer\Config();
17-
$config
17+
$config->setRiskyAllowed(true)
1818
->setRules([
1919
'@Symfony' => true,
2020
'array_syntax' => ['syntax' => 'short'],
2121
'class_definition' => false,
2222
'concat_space' => ['spacing' => 'one'],
2323
'function_declaration' => ['closure_function_spacing' => 'none'],
2424
'header_comment' => ['header' => $header],
25+
'native_constant_invocation' => true,
26+
'native_function_casing' => true,
27+
'native_function_invocation' => ['include' => ['@internal']],
28+
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
29+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true],
2530
'ordered_imports' => true,
2631
'phpdoc_align' => ['align' => 'left'],
2732
'phpdoc_types_order' => false,
33+
'single_line_throw' => false,
34+
'single_line_comment_spacing' => false,
35+
'phpdoc_to_comment' => [
36+
'ignored_tags' => ['todo', 'var', 'see'],
37+
],
38+
'get_class_to_class_keyword' => false, // should be enabled as soon as support for php < 8 is dropped
39+
'nullable_type_declaration_for_default_null_value' => true,
40+
'no_null_property_initialization' => false,
41+
'fully_qualified_strict_types' => false,
42+
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match']],
2843
])
2944
->setFinder($finder);
3045

Command/ImportCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
5151
$progressBar = new ProgressBar($output);
5252
$progressBar->setFormat(' %current% [%bar%] %elapsed:6s% %memory:6s%');
5353

54-
$output->writeln(sprintf('Import of file "%s" will be started:', basename($input->getArgument('fileName'))));
54+
$output->writeln(\sprintf('Import of file "%s" will be started:', \basename($input->getArgument('fileName'))));
5555

5656
$errors = [];
5757
foreach ($this->import->import($input->getArgument('fileName')) as $item) {
@@ -64,7 +64,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
6464

6565
$progressBar->finish();
6666

67-
if (0 === count($errors)) {
67+
if (0 === \count($errors)) {
6868
return 0;
6969
}
7070

@@ -76,7 +76,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
7676
$exception = $error->getException();
7777

7878
$output->writeln(
79-
sprintf(
79+
\sprintf(
8080
' * Line %s: "%s"',
8181
$error->getLineNumber(),
8282
$exception ? $exception->getMessage() : ''

Controller/RedirectRouteController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function cdeleteAction(Request $request)
248248
$repository = $this->redirectRouteRepository;
249249
$manager = $this->redirectRouteManager;
250250

251-
$ids = array_filter(explode(',', (string) $request->query->get('ids', '')));
251+
$ids = \array_filter(\explode(',', (string) $request->query->get('ids', '')));
252252
foreach ($ids as $id) {
253253
/** @var RedirectRouteInterface|null $redirectRoute */
254254
$redirectRoute = $repository->find($id);

Controller/WebsiteRedirectController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ public function redirect(Request $request, RedirectRouteInterface $redirectRoute
3232
throw new HttpException(410);
3333
}
3434

35-
$queryString = http_build_query($request->query->all());
35+
$queryString = \http_build_query($request->query->all());
3636

3737
$requestFormat = $request->getRequestFormat(null);
3838
$formatSuffix = $requestFormat ? ('.' . $requestFormat) : '';
3939

4040
$url = [
4141
$redirectRoute->getTarget(),
4242
$formatSuffix,
43-
false === strpos($redirectRoute->getTarget(), '?') ? '?' : '&',
43+
false === \strpos($redirectRoute->getTarget(), '?') ? '?' : '&',
4444
$queryString,
4545
];
4646

47-
$url = trim(implode($url), '&? ');
47+
$url = \trim(\implode($url), '&? ');
4848

4949
return new RedirectResponse($url, $redirectRoute->getStatusCode());
5050
}

Entity/RedirectRoute.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getSource()
9595

9696
public function setSource($source)
9797
{
98-
$this->source = mb_strtolower('/' . ltrim($source, '/'));
98+
$this->source = \mb_strtolower('/' . \ltrim($source, '/'));
9999

100100
return $this;
101101
}
@@ -107,7 +107,7 @@ public function getSourceHost()
107107

108108
public function setSourceHost($sourceHost)
109109
{
110-
$this->sourceHost = empty($sourceHost) ? null : mb_strtolower($sourceHost);
110+
$this->sourceHost = empty($sourceHost) ? null : \mb_strtolower($sourceHost);
111111

112112
return $this;
113113
}

Entity/RedirectRouteRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private function createFindBySourceQueryBuilder($source, $sourceHost = null)
6464
{
6565
$queryBuilder = $this->createQueryBuilder('redirect_route')
6666
->andWhere('redirect_route.source = :source')
67-
->setParameter('source', mb_strtolower('/' . ltrim($source, '/')))
67+
->setParameter('source', \mb_strtolower('/' . \ltrim($source, '/')))
6868
->orderBy('redirect_route.sourceHost', 'DESC')
6969
->setMaxResults(1);
7070

@@ -77,7 +77,7 @@ private function createFindBySourceQueryBuilder($source, $sourceHost = null)
7777
)
7878
);
7979

80-
$queryBuilder->setParameter('sourceHost', mb_strtolower($sourceHost));
80+
$queryBuilder->setParameter('sourceHost', \mb_strtolower($sourceHost));
8181
}
8282

8383
return $queryBuilder;

Exception/RedirectRouteNotUniqueException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class RedirectRouteNotUniqueException extends \Exception implements TranslationE
3434
*/
3535
public function __construct($source, $sourceHost = null)
3636
{
37-
parent::__construct(sprintf('The source "%s" with sourceHost "%s" is already in use.', $source, $sourceHost));
37+
parent::__construct(\sprintf('The source "%s" with sourceHost "%s" is already in use.', $source, $sourceHost));
3838

3939
$this->source = $source;
4040
}

GoneSubscriber/GoneDocumentSubscriber.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ protected function getUrls(BasePageDocument $document)
129129
$localizedUrls = $this->documentInspector->getLocalizedUrlsForPage($document);
130130

131131
foreach ($webspace->getAllLocalizations() as $localization) {
132-
if (!array_key_exists($localization->getLocale(), $localizedUrls)) {
132+
if (!\array_key_exists($localization->getLocale(), $localizedUrls)) {
133133
continue;
134134
}
135135

136-
$urls = array_merge(
136+
$urls = \array_merge(
137137
$this->webspaceManager->findUrlsByResourceLocator(
138138
$localizedUrls[$localization->getLocale()],
139139
$this->environment,
@@ -142,7 +142,7 @@ protected function getUrls(BasePageDocument $document)
142142
$urls
143143
);
144144

145-
$urls = array_merge(
145+
$urls = \array_merge(
146146
$this->getHistoryUrls(
147147
$resourceLocatorStrategy,
148148
$document->getUuid(),
@@ -154,10 +154,10 @@ protected function getUrls(BasePageDocument $document)
154154
}
155155

156156
foreach ($urls as &$url) {
157-
$url = parse_url($url, PHP_URL_PATH);
157+
$url = \parse_url($url, \PHP_URL_PATH);
158158
}
159159

160-
return array_unique($urls);
160+
return \array_unique($urls);
161161
}
162162

163163
/**
@@ -175,7 +175,7 @@ protected function getHistoryUrls(
175175
) {
176176
$historyUrls = [];
177177
foreach ($resourceLocatorStrategy->loadHistoryByContentUuid($uuid, $webspaceKey, $locale) as $history) {
178-
$historyUrls = array_merge(
178+
$historyUrls = \array_merge(
179179
$this->webspaceManager->findUrlsByResourceLocator(
180180
$history->getResourceLocator(),
181181
$this->environment,

Import/Converter/Converter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function convert(array $item)
5555
}
5656

5757
foreach ([self::SOURCE, self::TARGET, self::STATUS_CODE, self::ENABLED, self::SOURCE_HOST] as $field) {
58-
if (!array_key_exists($field, $item) || null === $item[$field]) {
58+
if (!\array_key_exists($field, $item) || null === $item[$field]) {
5959
continue;
6060
}
6161

@@ -67,8 +67,8 @@ public function convert(array $item)
6767

6868
public function supports(array $item)
6969
{
70-
$keys = array_keys($item);
71-
if (!in_array(self::SOURCE, $keys) || !in_array(self::TARGET, $keys)) {
70+
$keys = \array_keys($item);
71+
if (!\in_array(self::SOURCE, $keys) || !\in_array(self::TARGET, $keys)) {
7272
return false;
7373
}
7474

0 commit comments

Comments
 (0)