Skip to content

Commit d32b12e

Browse files
[CI] Ensure that all possible @return are turned into native types
1 parent b3287bd commit d32b12e

File tree

6 files changed

+845
-7
lines changed

6 files changed

+845
-7
lines changed

.github/expected-missing-return-types.diff

Lines changed: 829 additions & 0 deletions
Large diffs are not rendered by default.

.github/patch-types.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadFileName.php'):
2121
case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php'):
2222
case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/ParseError.php'):
23+
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php'):
2324
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php'):
2425
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php'):
2526
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/intersectiontype_classes.php'):

.github/workflows/unit-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ jobs:
137137
- name: Patch return types
138138
if: "${{ matrix.php == '8.0' && ! matrix.mode }}"
139139
run: |
140-
sed -i 's/"\*\*\/Tests\/"//' composer.json
140+
patch -sp1 < .github/expected-missing-return-types.diff
141141
git add .
142142
composer install -q --optimize-autoloader
143-
SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 php .github/patch-types.php
144-
SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 php .github/patch-types.php # ensure the script is idempotent
145-
git diff --exit-code
143+
SYMFONY_PATCH_TYPE_DECLARATIONS=force=2 php .github/patch-types.php
144+
SYMFONY_PATCH_TYPE_DECLARATIONS=force=2 php .github/patch-types.php # ensure the script is idempotent
145+
git diff --exit-code && git checkout .
146146
147147
- name: Run tests
148148
run: |

src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ protected function inExpression(bool $reset = true): bool
6666

6767
/**
6868
* Processes a value found in a definition tree.
69+
*
70+
* @return mixed
6971
*/
7072
protected function processValue(mixed $value, bool $isRoot = false)
7173
{

src/Symfony/Component/Ldap/Adapter/QueryInterface.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Ldap\Adapter;
1313

14-
use Symfony\Component\Ldap\Entry;
1514
use Symfony\Component\Ldap\Exception\LdapException;
1615
use Symfony\Component\Ldap\Exception\NotBoundException;
1716

@@ -33,8 +32,6 @@ interface QueryInterface
3332
/**
3433
* Executes a query and returns the list of Ldap entries.
3534
*
36-
* @return CollectionInterface|Entry[]
37-
*
3835
* @throws NotBoundException
3936
* @throws LdapException
4037
*/

src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,17 @@ public function getAuthenticationExceptionProvider()
7474
];
7575
}
7676

77+
/**
78+
* This test should be removed in Symfony 7.0 when adding native return types to AuthenticationEntryPointInterface::start().
79+
*
80+
* @group legacy
81+
*/
7782
public function testExceptionWhenEntryPointReturnsBadValue()
7883
{
84+
if ((new \ReflectionMethod(AuthenticationEntryPointInterface::class, 'start'))->hasReturnType()) {
85+
$this->markTestSkipped('Native return type found');
86+
}
87+
7988
$event = $this->createEvent(new AuthenticationException());
8089

8190
$entryPoint = $this->createMock(AuthenticationEntryPointInterface::class);

0 commit comments

Comments
 (0)