Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d2b8d38

Browse filesBrowse files
author
Robin Chalas
committed
Add scalar typehints/return types on final/internal/private code
1 parent d203ee3 commit d2b8d38
Copy full SHA for d2b8d38

File tree

72 files changed

+251
-624
lines changed
Filter options

Some content is hidden

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

72 files changed

+251
-624
lines changed

‎src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __construct(ObjectManager $om, ClassMetadata $classMetadata)
8282
* @return bool Returns `true` if the class has a single-column ID and
8383
* `false` otherwise.
8484
*/
85-
public function isSingleId()
85+
public function isSingleId(): bool
8686
{
8787
return $this->singleId;
8888
}
@@ -93,7 +93,7 @@ public function isSingleId()
9393
* @return bool Returns `true` if the class has a single-column integer ID
9494
* and `false` otherwise.
9595
*/
96-
public function isIntId()
96+
public function isIntId(): bool
9797
{
9898
return $this->intId;
9999
}
@@ -138,7 +138,7 @@ public function getIdValue($object)
138138
*
139139
* @return string The name of the ID field
140140
*/
141-
public function getIdField()
141+
public function getIdField(): string
142142
{
143143
return $this->idField;
144144
}

‎src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ public function __call($method, $arguments)
5656
return call_user_func_array(array($this->listener, $method), $arguments);
5757
}
5858

59-
public function getWrappedListener()
59+
public function getWrappedListener(): ListenerInterface
6060
{
6161
return $this->listener;
6262
}
6363

64-
public function getInfo()
64+
public function getInfo(): array
6565
{
6666
if (null === $this->stub) {
6767
$this->stub = self::$hasVarDumper ? new ClassStub(get_class($this->listener)) : get_class($this->listener);

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php
+14-52Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,7 @@ final class FirewallConfig
2929
private $listeners;
3030
private $switchUser;
3131

32-
/**
33-
* @param string $name
34-
* @param string $userChecker
35-
* @param string|null $requestMatcher
36-
* @param bool $securityEnabled
37-
* @param bool $stateless
38-
* @param string|null $provider
39-
* @param string|null $context
40-
* @param string|null $entryPoint
41-
* @param string|null $accessDeniedHandler
42-
* @param string|null $accessDeniedUrl
43-
* @param string[] $listeners
44-
* @param array|null $switchUser
45-
*/
46-
public function __construct($name, $userChecker, $requestMatcher = null, $securityEnabled = true, $stateless = false, $provider = null, $context = null, $entryPoint = null, $accessDeniedHandler = null, $accessDeniedUrl = null, $listeners = array(), $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)
4733
{
4834
$this->name = $name;
4935
$this->userChecker = $userChecker;
@@ -59,7 +45,7 @@ public function __construct($name, $userChecker, $requestMatcher = null, $securi
5945
$this->switchUser = $switchUser;
6046
}
6147

62-
public function getName()
48+
public function getName(): string
6349
{
6450
return $this->name;
6551
}
@@ -68,86 +54,62 @@ public function getName()
6854
* @return string|null The request matcher service id or null if neither the request matcher, pattern or host
6955
* options were provided
7056
*/
71-
public function getRequestMatcher()
57+
public function getRequestMatcher(): ?string
7258
{
7359
return $this->requestMatcher;
7460
}
7561

76-
public function isSecurityEnabled()
62+
public function isSecurityEnabled(): bool
7763
{
7864
return $this->securityEnabled;
7965
}
8066

81-
public function allowsAnonymous()
67+
public function allowsAnonymous(): bool
8268
{
8369
return in_array('anonymous', $this->listeners, true);
8470
}
8571

86-
public function isStateless()
72+
public function isStateless(): bool
8773
{
8874
return $this->stateless;
8975
}
9076

91-
/**
92-
* @return string|null The provider service id
93-
*/
94-
public function getProvider()
77+
public function getProvider(): ?string
9578
{
9679
return $this->provider;
9780
}
9881

99-
/**
100-
* @return string|null The context key (will be null if the firewall is stateless)
101-
*/
102-
public function getContext()
82+
public function getContext(): ?string
10383
{
10484
return $this->context;
10585
}
10686

107-
/**
108-
* @return string|null The entry_point service id if configured, null otherwise
109-
*/
110-
public function getEntryPoint()
87+
public function getEntryPoint(): ?string
11188
{
11289
return $this->entryPoint;
11390
}
11491

115-
/**
116-
* @return string The user_checker service id
117-
*/
118-
public function getUserChecker()
92+
public function getUserChecker(): string
11993
{
12094
return $this->userChecker;
12195
}
12296

123-
/**
124-
* @return string|null The access_denied_handler service id if configured, null otherwise
125-
*/
126-
public function getAccessDeniedHandler()
97+
public function getAccessDeniedHandler(): ?string
12798
{
12899
return $this->accessDeniedHandler;
129100
}
130101

131-
/**
132-
* @return string|null The access_denied_handler URL if configured, null otherwise
133-
*/
134-
public function getAccessDeniedUrl()
102+
public function getAccessDeniedUrl(): ?string
135103
{
136104
return $this->accessDeniedUrl;
137105
}
138106

139-
/**
140-
* @return string[] An array of listener keys
141-
*/
142-
public function getListeners()
107+
public function getListeners(): array
143108
{
144109
return $this->listeners;
145110
}
146111

147-
/**
148-
* @return array|null The switch_user parameters if configured, null otherwise
149-
*/
150-
public function getSwitchUser()
112+
public function getSwitchUser(): ?array
151113
{
152114
return $this->switchUser;
153115
}

‎src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallMapTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Security/FirewallMapTest.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Component\DependencyInjection\Container;
1919
use Symfony\Component\HttpFoundation\Request;
2020
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
21-
use Symfony\Component\Security\Core\User\UserCheckerInterface;
2221
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
2322
use Symfony\Component\Security\Http\Firewall\ListenerInterface;
2423

@@ -63,7 +62,7 @@ public function testGetListeners()
6362

6463
$firewallContext = $this->getMockBuilder(FirewallContext::class)->disableOriginalConstructor()->getMock();
6564

66-
$firewallConfig = new FirewallConfig('main', $this->getMockBuilder(UserCheckerInterface::class)->getMock());
65+
$firewallConfig = new FirewallConfig('main', 'user_checker');
6766
$firewallContext->expects($this->once())->method('getConfig')->willReturn($firewallConfig);
6867

6968
$listener = $this->getMockBuilder(ListenerInterface::class)->getMock();

‎src/Symfony/Component/Console/Event/ConsoleErrorEvent.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Event/ConsoleErrorEvent.php
+7-32Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Console\Event;
1313

1414
use Symfony\Component\Console\Command\Command;
15-
use Symfony\Component\Console\Exception\InvalidArgumentException;
1615
use Symfony\Component\Console\Input\InputInterface;
1716
use Symfony\Component\Console\Output\OutputInterface;
1817

@@ -26,57 +25,33 @@ final class ConsoleErrorEvent extends ConsoleEvent
2625
private $error;
2726
private $exitCode;
2827

29-
public function __construct(InputInterface $input, OutputInterface $output, $error, Command $command = null)
28+
public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
3029
{
3130
parent::__construct($command, $input, $output);
3231

33-
$this->setError($error);
32+
$this->error = $error;
3433
}
3534

36-
/**
37-
* Returns the thrown error/exception.
38-
*
39-
* @return \Throwable
40-
*/
41-
public function getError()
35+
public function getError(): \Throwable
4236
{
4337
return $this->error;
4438
}
4539

46-
/**
47-
* Replaces the thrown error/exception.
48-
*
49-
* @param \Throwable $error
50-
*/
51-
public function setError($error)
40+
public function setError(\Throwable $error)
5241
{
53-
if (!$error instanceof \Throwable && !$error instanceof \Exception) {
54-
throw new InvalidArgumentException(sprintf('The error passed to ConsoleErrorEvent must be an instance of \Throwable or \Exception, "%s" was passed instead.', is_object($error) ? get_class($error) : gettype($error)));
55-
}
56-
5742
$this->error = $error;
5843
}
5944

60-
/**
61-
* Sets the exit code.
62-
*
63-
* @param int $exitCode The command exit code
64-
*/
65-
public function setExitCode($exitCode)
45+
public function setExitCode(int $exitCode)
6646
{
67-
$this->exitCode = (int) $exitCode;
47+
$this->exitCode = $exitCode;
6848

6949
$r = new \ReflectionProperty($this->error, 'code');
7050
$r->setAccessible(true);
7151
$r->setValue($this->error, $this->exitCode);
7252
}
7353

74-
/**
75-
* Gets the exit code.
76-
*
77-
* @return int The command exit code
78-
*/
79-
public function getExitCode()
54+
public function getExitCode(): int
8055
{
8156
return null !== $this->exitCode ? $this->exitCode : ($this->error->getCode() ?: 1);
8257
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.