Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 883766e

Browse files
Merge branch '5.3' into 5.4
* 5.3: Backport type fixes fix annot Backport type fixes Fix CS Avoid triggering the autoloader in Deprecation::isLegacy() fix markdown markup Backport type fixes uzb translation [DependencyInjection] Fix doc blocks [DependencyInjection] Turn $defaultDeprecationTemplate into a constant [GHA] restore phpunit-bridge job rethrow caught exception [Form] better form doc types to support static analysis
2 parents b28b63c + 6b3e305 commit 883766e

File tree

202 files changed

+398
-711
lines changed

Some content is hidden

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

202 files changed

+398
-711
lines changed

.github/workflows/phpunit-bridge.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: PhpUnitBridge
2+
3+
on:
4+
push:
5+
paths:
6+
- 'src/Symfony/Bridge/PhpUnit/**'
7+
pull_request:
8+
paths:
9+
- 'src/Symfony/Bridge/PhpUnit/**'
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
lint:
17+
name: Lint
18+
runs-on: Ubuntu-20.04
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
coverage: "none"
28+
php-version: "7.1"
29+
30+
- name: Lint
31+
run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {}

UPGRADE-5.2.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ Form
2222

2323
* Deprecated `PropertyPathMapper` in favor of `DataMapper` and `PropertyPathAccessor`.
2424

25-
Before:
25+
Before:
2626

27-
```php
28-
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
27+
```php
28+
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
2929

30-
$builder->setDataMapper(new PropertyPathMapper());
31-
```
30+
$builder->setDataMapper(new PropertyPathMapper());
31+
```
3232

33-
After:
33+
After:
3434

35-
```php
36-
use Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor;
37-
use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper;
35+
```php
36+
use Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor;
37+
use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper;
3838

39-
$builder->setDataMapper(new DataMapper(new PropertyPathAccessor()));
40-
```
39+
$builder->setDataMapper(new DataMapper(new PropertyPathAccessor()));
40+
```
4141

4242
HttpFoundation
4343
--------------

src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function configureOptions(OptionsResolver $resolver)
5050
*
5151
* @return ORMQueryBuilderLoader
5252
*/
53-
public function getLoader(ObjectManager $manager, $queryBuilder, string $class)
53+
public function getLoader(ObjectManager $manager, object $queryBuilder, string $class)
5454
{
5555
if (!$queryBuilder instanceof QueryBuilder) {
5656
throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, get_debug_type($queryBuilder)));
@@ -76,7 +76,7 @@ public function getBlockPrefix()
7676
* @internal This method is public to be usable as callback. It should not
7777
* be used in user code.
7878
*/
79-
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
79+
public function getQueryBuilderPartsForCachingHash(object $queryBuilder): ?array
8080
{
8181
if (!$queryBuilder instanceof QueryBuilder) {
8282
throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, get_debug_type($queryBuilder)));

src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public function updateExistingToken(PersistentTokenInterface $token, string $tok
200200
$this->conn->commit();
201201
} catch (\Exception $e) {
202202
$this->conn->rollBack();
203+
throw $e;
203204
}
204205
}
205206

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
use PHPUnit\Framework\TestCase;
1515
use PHPUnit\Framework\TestSuite;
1616
use PHPUnit\Metadata\Api\Groups;
17-
use PHPUnit\Util\Error\Handler;
1817
use PHPUnit\Util\Test;
1918
use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor;
2019
use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader;
2120
use Symfony\Component\ErrorHandler\DebugClassLoader;
2221

22+
class_exists(Groups::class);
23+
2324
/**
2425
* @internal
2526
*/
@@ -203,7 +204,7 @@ public function isLegacy()
203204
}
204205

205206
$method = $this->originatingMethod();
206-
$groups = class_exists(Groups::class) ? [new Groups(), 'groups'] : [Test::class, 'getGroups'];
207+
$groups = class_exists(Groups::class, false) ? [new Groups(), 'groups'] : [Test::class, 'getGroups'];
207208

208209
return 0 === strpos($method, 'testLegacy')
209210
|| 0 === strpos($method, 'provideLegacy')

src/Symfony/Bridge/Twig/Node/DumpNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class DumpNode extends Node
2121
{
2222
private $varPrefix;
2323

24-
public function __construct($varPrefix, ?Node $values, int $lineno, string $tag = null)
24+
public function __construct(string $varPrefix, ?Node $values, int $lineno, string $tag = null)
2525
{
2626
$nodes = [];
2727
if (null !== $values) {

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(Psr6CacheClearer $poolClearer, array $pools = [])
3939
*
4040
* @return string[]
4141
*/
42-
public function warmUp($cacheDirectory): array
42+
public function warmUp(string $cacheDirectory): array
4343
{
4444
foreach ($this->pools as $pool) {
4545
if ($this->poolClearer->hasPool($pool)) {

src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
120120
return 0;
121121
}
122122

123-
private function searchForEvent(EventDispatcherInterface $dispatcher, $needle): array
123+
private function searchForEvent(EventDispatcherInterface $dispatcher, string $needle): array
124124
{
125125
$output = [];
126126
$lcNeedle = strtolower($needle);

src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
109109
/**
110110
* {@inheritdoc}
111111
*/
112-
public function find($name)
112+
public function find(string $name)
113113
{
114114
$this->registerCommands();
115115

@@ -119,7 +119,7 @@ public function find($name)
119119
/**
120120
* {@inheritdoc}
121121
*/
122-
public function get($name)
122+
public function get(string $name)
123123
{
124124
$this->registerCommands();
125125

@@ -135,7 +135,7 @@ public function get($name)
135135
/**
136136
* {@inheritdoc}
137137
*/
138-
public function all($namespace = null)
138+
public function all(string $namespace = null)
139139
{
140140
$this->registerCommands();
141141

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ abstract protected function describeContainerTags(ContainerBuilder $builder, arr
113113
*
114114
* @param Definition|Alias|object $service
115115
*/
116-
abstract protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null);
116+
abstract protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null);
117117

118118
/**
119119
* Describes container services.

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
6767
$this->writeData($data, $options);
6868
}
6969

70-
protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null)
70+
protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
7171
{
7272
if (!isset($options['id'])) {
7373
throw new \InvalidArgumentException('An "id" option must be provided.');

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
8888
}
8989
}
9090

91-
protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null)
91+
protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
9292
{
9393
if (!isset($options['id'])) {
9494
throw new \InvalidArgumentException('An "id" option must be provided.');

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
141141
}
142142
}
143143

144-
protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null)
144+
protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
145145
{
146146
if (!isset($options['id'])) {
147147
throw new \InvalidArgumentException('An "id" option must be provided.');

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
5353
$this->writeDocument($this->getContainerTagsDocument($builder, isset($options['show_hidden']) && $options['show_hidden']));
5454
}
5555

56-
protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null)
56+
protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
5757
{
5858
if (!isset($options['id'])) {
5959
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -255,7 +255,7 @@ private function getContainerTagsDocument(ContainerBuilder $builder, bool $showH
255255
return $dom;
256256
}
257257

258-
private function getContainerServiceDocument($service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
258+
private function getContainerServiceDocument(object $service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
259259
{
260260
$dom = new \DOMDocument('1.0', 'UTF-8');
261261

src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ protected function isCsrfTokenValid(string $id, ?string $token): bool
428428
*
429429
* @param object|Envelope $message The message or the message pre-wrapped in an envelope
430430
*/
431-
protected function dispatchMessage($message, array $stamps = []): Envelope
431+
protected function dispatchMessage(object $message, array $stamps = []): Envelope
432432
{
433433
if (!$this->container->has('messenger.default_bus')) {
434434
$message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".';

src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@ class ControllerResolver extends ContainerControllerResolver
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
protected function instantiateController($class): object
27+
protected function instantiateController(string $class): object
2828
{
29-
return $this->configureController(parent::instantiateController($class), $class);
30-
}
29+
$controller = parent::instantiateController($class);
3130

32-
private function configureController($controller, string $class): object
33-
{
3431
if ($controller instanceof ContainerAwareInterface) {
3532
$controller->setContainer($this->container);
3633
}

src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
use Symfony\Component\HttpKernel\DataCollector\RouterDataCollector as BaseRouterDataCollector;
1717

1818
/**
19-
* RouterDataCollector.
20-
*
2119
* @author Fabien Potencier <[email protected]>
2220
*
2321
* @final

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ private function addAnnotationsSection(ArrayNodeDefinition $rootNode, callable $
960960
;
961961
}
962962

963-
private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone, $willBeAvailable)
963+
private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone, callable $willBeAvailable)
964964
{
965965
$rootNode
966966
->children()

src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function enableReboot()
112112
/**
113113
* @param UserInterface $user
114114
*/
115-
public function loginUser($user, string $firewallContext = 'main'): self
115+
public function loginUser(object $user, string $firewallContext = 'main'): self
116116
{
117117
if (!interface_exists(UserInterface::class)) {
118118
throw new \LogicException(sprintf('"%s" requires symfony/security-core to be installed.', __METHOD__));

src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ class AnnotatedRouteControllerLoader extends AnnotationClassLoader
2424
{
2525
/**
2626
* Configures the _controller default parameter of a given Route instance.
27-
*
28-
* @param mixed $annot The annotation class instance
2927
*/
30-
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
28+
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot)
3129
{
3230
if ('__invoke' === $method->getName()) {
3331
$route->setDefault('_controller', $class->getName());

src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static function assertRequestAttributeValueSame(string $name, string $exp
117117
self::assertThat(self::getRequest(), new ResponseConstraint\RequestAttributeValueSame($name, $expectedValue), $message);
118118
}
119119

120-
public static function assertRouteSame($expectedRoute, array $parameters = [], string $message = ''): void
120+
public static function assertRouteSame(string $expectedRoute, array $parameters = [], string $message = ''): void
121121
{
122122
$constraint = new ResponseConstraint\RequestAttributeValueSame('_route', $expectedRoute);
123123
$constraints = [];

src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
use Symfony\Component\Translation\Translator as BaseTranslator;
2121

2222
/**
23-
* Translator.
24-
*
2523
* @author Fabien Potencier <[email protected]>
2624
*/
2725
class Translator extends BaseTranslator implements WarmableInterface

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function getListenerId()
7575
/**
7676
* {@inheritdoc}
7777
*/
78-
protected function isRememberMeAware($config)
78+
protected function isRememberMeAware(array $config)
7979
{
8080
return false;
8181
}

src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class FirewallConfig
2929
private $listeners;
3030
private $switchUser;
3131

32-
public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $listeners = [], $switchUser = null)
32+
public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $listeners = [], array $switchUser = null)
3333
{
3434
$this->name = $name;
3535
$this->userChecker = $userChecker;

src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ private function hasHashOrNonce(array $directives): bool
235235
return false;
236236
}
237237

238-
private function getDirectiveFallback(array $directiveSet, $type)
238+
private function getDirectiveFallback(array $directiveSet, string $type)
239239
{
240240
if (\in_array($type, ['script-src-elem', 'style-src-elem'], true) || !isset($directiveSet['default-src'])) {
241241
// Let the browser fallback on it's own

src/Symfony/Component/BrowserKit/Tests/TestClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function setNextResponse(Response $response)
2424
$this->nextResponse = $response;
2525
}
2626

27-
public function setNextScript($script)
27+
public function setNextScript(string $script)
2828
{
2929
$this->nextScript = $script;
3030
}
3131

32-
protected function doRequest($request): Response
32+
protected function doRequest(object $request): Response
3333
{
3434
if (null === $this->nextResponse) {
3535
return new Response();
@@ -41,7 +41,7 @@ protected function doRequest($request): Response
4141
return $response;
4242
}
4343

44-
protected function getScript($request)
44+
protected function getScript(object $request)
4545
{
4646
$r = new \ReflectionClass(Response::class);
4747
$path = $r->getFileName();

src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public function setNextResponse(Response $response)
4747
$this->nextResponse = $response;
4848
}
4949

50-
public function setNextScript($script)
50+
public function setNextScript(string $script)
5151
{
5252
$this->nextScript = $script;
5353
}
5454

55-
protected function doRequest($request): Response
55+
protected function doRequest(object $request): Response
5656
{
5757
if (null === $this->nextResponse) {
5858
return parent::doRequest($request);
@@ -64,7 +64,7 @@ protected function doRequest($request): Response
6464
return $response;
6565
}
6666

67-
protected function getScript($request)
67+
protected function getScript(object $request)
6868
{
6969
$r = new \ReflectionClass(Response::class);
7070
$path = $r->getFileName();

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
3232
protected $removeExtraKeys = true;
3333
protected $normalizeKeys = true;
3434

35-
public function setNormalizeKeys($normalizeKeys)
35+
public function setNormalizeKeys(bool $normalizeKeys)
3636
{
37-
$this->normalizeKeys = (bool) $normalizeKeys;
37+
$this->normalizeKeys = $normalizeKeys;
3838
}
3939

4040
/**

0 commit comments

Comments
 (0)