Skip to content

Commit e9886e4

Browse files
minor #33332 [3.4] Fix return types declarations (nicolas-grekas, derrabus)
This PR was merged into the 3.4 branch. Discussion ---------- [3.4] Fix return types declarations | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This is the subset of #33236 that applies to branch 3.4. This PR ensures return types are correctly declared, and adjust some implementations that return incorrect types. Commits ------- 2ceb453 [SecurityBundle] fix return type declarations c1d7a88 [BrowserKit] fix return type declarations 07405e2 [PropertyInfo] fix return type declarations 5f3b4b6 [Bridge/Doctrine] fix return type declarations 8706f18 [Form] fix return type declarations a32a713 [Console] fix return type declarations 523e9b9 [Intl] fix return type declarations 73f504c [Templating] fix return type declarations 2b8ef1d [DomCrawler] fix return type declarations 2ea98bb [Validator] fix return type declarations 6af0c80 [Process] fix return type declarations 28646c7 [Workflow] fix return type declarations 5f9aaa7 [Cache] fix return type declarations 5072cfc [Serializer] fix return type declarations 70feaa4 [Translation] fix return type declarations ca1fad4 [DI] fix return type declarations 9c63be4 [Config] fix return type declarations 05fe553 [HttpKernel] Fix return type declarations e0d79f7 [Security] Fix return type declarations c1b7118 [Routing] Fix return type declarations ef5ead0 [HttpFoundation] fix return type declarations
2 parents 1f72501 + 2ceb453 commit e9886e4

File tree

102 files changed

+382
-357
lines changed

Some content is hidden

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

102 files changed

+382
-357
lines changed

src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ public function getEntitiesByIds($identifier, array $values)
8989
return $qb->andWhere($where)
9090
->getQuery()
9191
->setParameter($parameter, $values, $parameterType)
92-
->getResult();
92+
->getResult() ?: [];
9393
}
9494
}

src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ protected function doLeaveNode(Node $node, Environment $env)
107107

108108
/**
109109
* {@inheritdoc}
110+
*
111+
* @return int
110112
*/
111113
public function getPriority()
112114
{

src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ protected function doLeaveNode(Node $node, Environment $env)
9797

9898
/**
9999
* {@inheritdoc}
100+
*
101+
* @return int
100102
*/
101103
public function getPriority()
102104
{

src/Symfony/Bridge/Twig/Translation/TwigExtractor.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ protected function canBeExtracted($file)
106106
}
107107

108108
/**
109-
* @param string|array $directory
110-
*
111-
* @return array
109+
* {@inheritdoc}
112110
*/
113111
protected function extractFromDirectory($directory)
114112
{

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,9 +1743,7 @@ private function getKernelRootHash(ContainerBuilder $container)
17431743
}
17441744

17451745
/**
1746-
* Returns the base path for the XSD files.
1747-
*
1748-
* @return string The XSD base path
1746+
* {@inheritdoc}
17491747
*/
17501748
public function getXsdValidationBasePath()
17511749
{

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ public function testProfilerIsDisabled($insulate)
2424
}
2525

2626
$client->request('GET', '/profiler');
27-
$this->assertFalse($client->getProfile());
27+
$this->assertNull($client->getProfile());
2828

2929
// enable the profiler for the next request
3030
$client->enableProfiler();
31-
$this->assertFalse($client->getProfile());
31+
$this->assertNull($client->getProfile());
3232
$client->request('GET', '/profiler');
3333
$this->assertIsObject($client->getProfile());
3434

3535
$client->request('GET', '/profiler');
36-
$this->assertFalse($client->getProfile());
36+
$this->assertNull($client->getProfile());
3737
}
3838

3939
public function getConfigs()

src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function getUser()
231231
/**
232232
* Gets the roles of the user.
233233
*
234-
* @return array The roles
234+
* @return array|Data
235235
*/
236236
public function getRoles()
237237
{
@@ -241,7 +241,7 @@ public function getRoles()
241241
/**
242242
* Gets the inherited roles of the user.
243243
*
244-
* @return array The inherited roles
244+
* @return array|Data
245245
*/
246246
public function getInheritedRoles()
247247
{
@@ -269,16 +269,25 @@ public function isAuthenticated()
269269
return $this->data['authenticated'];
270270
}
271271

272+
/**
273+
* @return bool
274+
*/
272275
public function isImpersonated()
273276
{
274277
return $this->data['impersonated'];
275278
}
276279

280+
/**
281+
* @return string|null
282+
*/
277283
public function getImpersonatorUser()
278284
{
279285
return $this->data['impersonator_user'];
280286
}
281287

288+
/**
289+
* @return string|null
290+
*/
282291
public function getImpersonationExitPath()
283292
{
284293
return $this->data['impersonation_exit_path'];
@@ -287,7 +296,7 @@ public function getImpersonationExitPath()
287296
/**
288297
* Get the class name of the security token.
289298
*
290-
* @return string The token
299+
* @return string|Data|null The token
291300
*/
292301
public function getTokenClass()
293302
{
@@ -297,7 +306,7 @@ public function getTokenClass()
297306
/**
298307
* Get the full security token class as Data object.
299308
*
300-
* @return Data
309+
* @return Data|null
301310
*/
302311
public function getToken()
303312
{
@@ -307,7 +316,7 @@ public function getToken()
307316
/**
308317
* Get the logout URL.
309318
*
310-
* @return string The logout URL
319+
* @return string|null The logout URL
311320
*/
312321
public function getLogoutUrl()
313322
{
@@ -317,7 +326,7 @@ public function getLogoutUrl()
317326
/**
318327
* Returns the FQCN of the security voters enabled in the application.
319328
*
320-
* @return string[]
329+
* @return string[]|Data
321330
*/
322331
public function getVoters()
323332
{
@@ -337,7 +346,7 @@ public function getVoterStrategy()
337346
/**
338347
* Returns the log of the security decisions made by the access decision manager.
339348
*
340-
* @return array
349+
* @return array|Data
341350
*/
342351
public function getAccessDecisionLog()
343352
{
@@ -347,13 +356,16 @@ public function getAccessDecisionLog()
347356
/**
348357
* Returns the configuration of the current firewall context.
349358
*
350-
* @return array
359+
* @return array|Data
351360
*/
352361
public function getFirewall()
353362
{
354363
return $this->data['firewall'];
355364
}
356365

366+
/**
367+
* @return array|Data
368+
*/
357369
public function getListeners()
358370
{
359371
return $this->data['listeners'];

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ abstract protected function getListenerId();
130130
* @param ContainerBuilder $container
131131
* @param string $id
132132
* @param array $config
133-
* @param string $defaultEntryPointId
133+
* @param string|null $defaultEntryPointId
134134
*
135-
* @return string the entry point id
135+
* @return string|null the entry point id
136136
*/
137137
protected function createEntryPoint($container, $id, $config, $defaultEntryPointId)
138138
{

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ interface SecurityFactoryInterface
2424
/**
2525
* Configures the container services required to use the authentication listener.
2626
*
27-
* @param string $id The unique id of the firewall
28-
* @param array $config The options array for the listener
29-
* @param string $userProvider The service id of the user provider
30-
* @param string $defaultEntryPoint
27+
* @param string $id The unique id of the firewall
28+
* @param array $config The options array for the listener
29+
* @param string $userProvider The service id of the user provider
30+
* @param string|null $defaultEntryPoint
3131
*
3232
* @return array containing three values:
3333
* - the provider id

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,9 +798,7 @@ public function addUserProviderFactory(UserProviderFactoryInterface $factory)
798798
}
799799

800800
/**
801-
* Returns the base path for the XSD files.
802-
*
803-
* @return string The XSD base path
801+
* {@inheritdoc}
804802
*/
805803
public function getXsdValidationBasePath()
806804
{

0 commit comments

Comments
 (0)