Skip to content

Commit 14b0076

Browse files
trsteel88dbu
authored andcommitted
Add return types for sf6
1 parent b074db6 commit 14b0076

File tree

10 files changed

+33
-33
lines changed

10 files changed

+33
-33
lines changed

.github/workflows/test-application.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
include:
24-
- php-version: '7.4'
24+
- php-version: '8.0'
2525
dependencies: 'lowest'
26-
- php-version: '7.4'
27-
symfony-version: '^4.4'
28-
- php-version: '7.4'
29-
symfony-version: '^5.4'
3026
- php-version: '8.0'
27+
symfony-version: '6.0.*'
28+
- php-version: '8.1'
29+
symfony-version: '6.0.*'
3130

3231
steps:
3332
- name: Checkout project

composer.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.4 || ^8.0",
19-
"symfony-cmf/routing": "^2.3.2",
20-
"symfony/framework-bundle": "^4.4 || ^5.0"
18+
"php": "^8.0",
19+
"symfony-cmf/routing": "dev-master as 3.0.0",
20+
"symfony/framework-bundle": "^6.0"
2121
},
2222
"require-dev": {
2323
"jackalope/jackalope-doctrine-dbal": "^1.3",
2424
"doctrine/phpcr-odm": "^1.4|^2.0",
25-
"symfony/phpunit-bridge": "^5.0",
25+
"symfony/phpunit-bridge": "^6.0",
2626
"matthiasnoback/symfony-dependency-injection-test": "^4.1.0",
2727
"matthiasnoback/symfony-config-test": "^4.1.0",
2828
"doctrine/orm": "^2.5",
29-
"symfony-cmf/testing": "^4.0",
29+
"symfony-cmf/testing": "dev-master as 4.2.0",
3030
"doctrine/data-fixtures": "^1.0.0",
31-
"symfony/form": "^4.4 || ^5.0",
32-
"symfony/translation": "^4.4 || ^5.0",
33-
"symfony/validator": "^4.4 || ^5.0",
34-
"symfony/security-bundle": "^4.4 || ^5.0",
31+
"symfony/form": "^6.0",
32+
"symfony/translation": "^6.0",
33+
"symfony/validator": "^6.0",
34+
"symfony/security-bundle": "^6.0",
3535
"doctrine/doctrine-bundle": "^2.0",
36-
"symfony/twig-bundle": "^4.4 || ^5.0",
36+
"symfony/twig-bundle": "^6.0",
3737
"symfony/monolog-bundle": "^3.5",
3838
"doctrine/phpcr-bundle": "^2.3",
39-
"symfony/serializer": "^4.4 || ^5.0",
39+
"symfony/serializer": "^6.0",
4040
"twig/twig": "^2.4.4 || ^3.0"
4141
},
4242
"suggest": {
@@ -62,7 +62,7 @@
6262
},
6363
"extra": {
6464
"branch-alias": {
65-
"dev-master": "2.x-dev"
65+
"dev-master": "3.x-dev"
6666
}
6767
}
6868
}

src/Doctrine/Orm/ContentRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function findById($id)
5656
public function getContentId($content)
5757
{
5858
if (!\is_object($content)) {
59-
return;
59+
return null;
6060
}
6161

6262
try {
@@ -69,7 +69,7 @@ public function getContentId($content)
6969

7070
return implode(':', [$class, reset($ids)]);
7171
} catch (\Exception $e) {
72-
return;
72+
return null;
7373
}
7474
}
7575
}

src/Doctrine/Orm/RedirectRoute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function getParameters()
7878
/**
7979
* {@inheritdoc}
8080
*/
81-
public function getPath()
81+
public function getPath(): string
8282
{
8383
$pattern = parent::getPath();
8484
if ($this->getOption('add_trailing_slash') && '/' !== $pattern[\strlen($pattern) - 1]) {

src/Doctrine/Phpcr/ContentRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ public function findById($id)
3939
public function getContentId($content)
4040
{
4141
if (!\is_object($content)) {
42-
return;
42+
return null;
4343
}
4444

4545
try {
4646
return $this->getObjectManager()->getUnitOfWork()->getDocumentId($content);
4747
} catch (\Exception $e) {
48-
return;
48+
return null;
4949
}
5050
}
5151
}

src/Doctrine/Phpcr/RedirectRoute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function generateStaticPrefix($id, $idPrefix)
231231
/**
232232
* {@inheritdoc}
233233
*/
234-
public function getPath()
234+
public function getPath(): string
235235
{
236236
$pattern = parent::getPath();
237237
if ($this->getOption('add_trailing_slash') && '/' !== $pattern[\strlen($pattern) - 1]) {

src/Doctrine/Phpcr/Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function generateStaticPrefix($id, $idPrefix)
252252
*
253253
* Handle the trailing slash option.
254254
*/
255-
public function getPath()
255+
public function getPath(): string
256256
{
257257
$pattern = parent::getPath();
258258
if ($this->getOption('add_trailing_slash') && '/' !== $pattern[\strlen($pattern) - 1]) {

src/Model/Route.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Cmf\Bundle\RoutingBundle\Model;
1313

1414
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
15+
use Symfony\Component\Routing\CompiledRoute;
1516
use Symfony\Component\Routing\Route as SymfonyRoute;
1617
use Symfony\Component\Routing\RouteCompiler;
1718

@@ -147,7 +148,7 @@ public function getContent()
147148
*
148149
* Prevent setting the default 'compiler_class' so that we do not persist it
149150
*/
150-
public function setOptions(array $options)
151+
public function setOptions(array $options): static
151152
{
152153
return $this->addOptions($options);
153154
}
@@ -159,7 +160,7 @@ public function setOptions(array $options)
159160
*
160161
* @see setOptions
161162
*/
162-
public function getOption($name)
163+
public function getOption(string $name): mixed
163164
{
164165
$option = parent::getOption($name);
165166
if (null === $option && 'compiler_class' === $name) {
@@ -179,7 +180,7 @@ public function getOption($name)
179180
*
180181
* @see setOptions
181182
*/
182-
public function getOptions()
183+
public function getOptions(): array
183184
{
184185
$options = parent::getOptions();
185186
if (!\array_key_exists('compiler_class', $options)) {
@@ -209,7 +210,7 @@ protected function isBooleanOption($name)
209210
/**
210211
* {@inheritdoc}
211212
*/
212-
public function getPath()
213+
public function getPath(): string
213214
{
214215
$pattern = '';
215216
if ($this->getOption('add_locale_pattern')) {
@@ -234,7 +235,7 @@ public function getPath()
234235
* When using PHPCR-ODM, make sure to persist the route before calling this
235236
* to have the id field initialized.
236237
*/
237-
public function setPath($pattern)
238+
public function setPath(string $pattern): static
238239
{
239240
if (0 !== strpos($pattern, $this->getStaticPrefix())) {
240241
throw new \InvalidArgumentException(sprintf(
@@ -273,7 +274,7 @@ public function setVariablePattern($variablePattern)
273274
*
274275
* Overwritten to make sure the route is recompiled if the pattern was changed
275276
*/
276-
public function compile()
277+
public function compile(): CompiledRoute
277278
{
278279
if ($this->needRecompile) {
279280
// calling parent::setPath just to let it set compiled=null. the parent $path field is never used

src/Routing/DynamicRouter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ class DynamicRouter extends BaseDynamicRouter
6060
* is registered as a service. In both cases, the action to call on that
6161
* controller is appended, separated with two colons.
6262
*/
63-
public function match($url)
63+
public function match($url): array
6464
{
6565
$defaults = parent::match($url);
6666

6767
return $this->cleanDefaults($defaults);
6868
}
6969

70-
public function matchRequest(Request $request)
70+
public function matchRequest(Request $request): array
7171
{
7272
$defaults = parent::matchRequest($request);
7373

src/Routing/RedirectableRequestMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(RequestMatcherInterface $decorated, RequestContext $
4040
* If the matcher can not find a match,
4141
* it will try to add or remove a trailing slash to the path and match again.
4242
*/
43-
public function matchRequest(Request $request)
43+
public function matchRequest(Request $request): array
4444
{
4545
try {
4646
return $this->decorated->matchRequest($request);

0 commit comments

Comments
 (0)