Skip to content

Commit fc97c5a

Browse files
committed
revert return type for union type
1 parent d1f5520 commit fc97c5a

File tree

10 files changed

+40
-18
lines changed

10 files changed

+40
-18
lines changed

ecs.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@
9090
NoSinglelineWhitespaceBeforeSemicolonsFixer::class,
9191
NoWhitespaceBeforeCommaInArrayFixer::class,
9292
WhitespaceAfterCommaInArrayFixer::class,
93-
PhpdocToReturnTypeFixer::class,
9493
FullyQualifiedStrictTypesFixer::class,
9594
DisallowYodaComparisonSniff::class,
9695
])
96+
->withConfiguredRule(PhpdocToReturnTypeFixer::class, ['union_types' => false])
9797
->withConfiguredRule(NoSuperfluousPhpdocTagsFixer::class, ['remove_inheritdoc' => false])
9898
->withConfiguredRule(
9999
ConcatSpaceFixer::class,
@@ -131,6 +131,4 @@
131131
->withConfiguredRule(
132132
ClassAttributesSeparationFixer::class,
133133
['elements' => ['property' => 'one', 'method' => 'one', 'const' => 'none']]
134-
)
135-
136-
;
134+
);

src/Doctrine/JsonHelper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ class JsonHelper
1919
* Newer SQLite, Mysql 5.7 -> [ "JSON_EXTRACT(foo, '$[0]')", 'bar' ]
2020
*
2121
* @param string|bool|null $slug
22+
*
23+
* @return string|array
2224
*/
23-
public static function wrapJsonFunction(?string $where, $slug, Connection $connection): string|array
25+
public static function wrapJsonFunction(?string $where, $slug, Connection $connection)
2426
{
2527
$version = new Version($connection);
2628

src/Entity/Field.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,10 @@ public function isNew(): bool
242242

243243
/**
244244
* like getValue() but returns single value for single value fields
245+
*
246+
* @return array|mixed|null
245247
*/
246-
public function getParsedValue(): mixed
248+
public function getParsedValue()
247249
{
248250
$value = $this->getValue();
249251
if (is_iterable($value)) {
@@ -258,7 +260,10 @@ public function getParsedValue(): mixed
258260
return $value;
259261
}
260262

261-
public function getTwigValue(): string|array|Markup|bool
263+
/**
264+
* @return string|array|Markup|bool
265+
*/
266+
public function getTwigValue()
262267
{
263268
$value = $this->getParsedValue();
264269

src/Entity/Field/CheckboxField.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public function setValue($value): Field
3838
return parent::setValue($value);
3939
}
4040

41-
public function getTwigValue(): string|array|Markup|bool
41+
/**
42+
* @return string|array|Markup|bool
43+
*/
44+
public function getTwigValue()
4245
{
4346
return current($this->getValue()) ? true : false;
4447
}

src/Entity/Field/SelectField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getValue(): ?array
5656
return array_filter((array) $value);
5757
}
5858

59-
public function getParsedValue(): mixed
59+
public function getParsedValue()
6060
{
6161
$parsedValue = parent::getParsedValue();
6262

src/Storage/ContentQueryParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,10 @@ public function getParameter(string $param): array
382382

383383
/**
384384
* Runs the query and fetches the results.
385+
*
386+
* @return Pagerfanta|Content|null
385387
*/
386-
public function fetch(): Pagerfanta|Content|null
388+
public function fetch()
387389
{
388390
$this->parse();
389391

src/Storage/Filter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function setKey($key): void
3434
}
3535

3636
/**
37-
* Getter for key.
37+
* @return string|array
3838
*/
39-
public function getKey(): string|array
39+
public function getKey()
4040
{
4141
return $this->key;
4242
}

src/Storage/Query.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,21 @@ public function getScope(string $name): ?QueryScopeInterface
4141
*
4242
* Used by the twig command {% setcontent %} but also directly.
4343
* For reference refer to @see https://docs.bolt.cm/templating/content-fetching
44+
*
45+
* @return Pagerfanta|Content|null
4446
*/
45-
public function getContent(string $textQuery, array $parameters = []): Pagerfanta|Content|null
47+
public function getContent(string $textQuery, array $parameters = [])
4648
{
4749
$this->parser->setQuery($textQuery);
4850
$this->parser->setParameters($parameters);
4951

5052
return $this->parser->fetch();
5153
}
5254

53-
public function getContentByScope(string $scopeName, string $textQuery, array $parameters = []): Pagerfanta|Content|null
55+
/**
56+
* @return Content|Pagerfanta|null
57+
*/
58+
public function getContentByScope(string $scopeName, string $textQuery, array $parameters = [])
5459
{
5560
$scope = $this->getScope($scopeName);
5661
if ($scope) {
@@ -69,8 +74,9 @@ public function getContentByScope(string $scopeName, string $textQuery, array $p
6974
*
7075
* @param string $textQuery The base part like `pages` or `pages/1`
7176
* @param array $parameters Parameters like `printquery` and `paging`, but also `where` parameters taken from `... where { foo: bar } ...`
77+
* @return Pagerfanta|Content|null
7278
*/
73-
public function getContentForTwig(string $textQuery, array $parameters = []): Pagerfanta|Content|null
79+
public function getContentForTwig(string $textQuery, array $parameters = [])
7480
{
7581
if (empty($textQuery)) {
7682
return new Pagerfanta(new ArrayAdapter([]));

src/Twig/ContentExtension.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ public function getTitleFieldsNames(Content $content): array
214214
return ContentHelper::guessTitleFields($content);
215215
}
216216

217-
public function getImage(?Content $content, bool $onlyValues = false): ImageField|array|null
217+
/**
218+
* @return ImageField|array|null
219+
*/
220+
public function getImage(?Content $content, bool $onlyValues = false)
218221
{
219222
if (! $content) {
220223
return null;

src/Twig/FieldExtension.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ public function getType(Field $field): string
124124
return $field->getType();
125125
}
126126

127-
public function getSelected(SelectField $field, $returnsingle = false, $returnarray = false): array|Content|null
127+
/**
128+
* @return array|Content|null
129+
*/
130+
public function getSelected(SelectField $field, $returnsingle = false, $returnarray = false)
128131
{
129132
$definition = $field->getDefinition();
130133

@@ -207,7 +210,7 @@ public function getListTemplates(TemplateselectField $field): Collection
207210
return new Collection($options);
208211
}
209212

210-
public function selectOptionsUrl(SelectField $field): String
213+
public function selectOptionsUrl(SelectField $field): string
211214
{
212215
return $this->router->generate('bolt_async_select_options', [
213216
'name' => $field->getDefinition()->get('name', ''),

0 commit comments

Comments
 (0)