Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitceeaa68

Browse files
committed
[Security][Http] Add type-hints
1 parent8fb4741 commitceeaa68

File tree

9 files changed

+18
-31
lines changed

9 files changed

+18
-31
lines changed

‎src/Symfony/Component/Security/Http/AccessMap.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AccessMap implements AccessMapInterface
2929
* @param array $attributes An array of attributes to pass to the access decision manager (like roles)
3030
* @param string|null $channel The channel to enforce (http, https, or null)
3131
*/
32-
publicfunctionadd(RequestMatcherInterface$requestMatcher,array$attributes = [],$channel =null)
32+
publicfunctionadd(RequestMatcherInterface$requestMatcher,array$attributes = [],string$channel =null)
3333
{
3434
$this->map[] = [$requestMatcher,$attributes,$channel];
3535
}

‎src/Symfony/Component/Security/Http/Authentication/AuthenticationUtils.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ public function __construct(RequestStack $requestStack)
3131
}
3232

3333
/**
34-
* @param bool $clearSession
35-
*
3634
* @return AuthenticationException|null
3735
*/
38-
publicfunctiongetLastAuthenticationError($clearSession =true)
36+
publicfunctiongetLastAuthenticationError(bool$clearSession =true)
3937
{
4038
$request =$this->getRequest();
4139
$session =$request->getSession();

‎src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,8 @@ public function getProviderKey()
8484

8585
/**
8686
* Set the provider key.
87-
*
88-
* @param string $providerKey
8987
*/
90-
publicfunctionsetProviderKey($providerKey)
88+
publicfunctionsetProviderKey(string$providerKey)
9189
{
9290
$this->providerKey =$providerKey;
9391
}

‎src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,12 @@ public function __invoke(RequestEvent $event)
110110
/**
111111
* Attempts to switch to another user.
112112
*
113-
* @param Request $request A Request instance
114-
* @param string $username
115-
*
116113
* @return TokenInterface|null The new TokenInterface if successfully switched, null otherwise
117114
*
118115
* @throws \LogicException
119116
* @throws AccessDeniedException
120117
*/
121-
privatefunctionattemptSwitchUser(Request$request,$username): ?TokenInterface
118+
privatefunctionattemptSwitchUser(Request$request,string$username): ?TokenInterface
122119
{
123120
$token =$this->tokenStorage->getToken();
124121
$originalToken =$this->getOriginalToken($token);

‎src/Symfony/Component/Security/Http/HttpUtils.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(UrlGeneratorInterface $urlGenerator = null, $urlMatc
6060
*
6161
* @return RedirectResponse A RedirectResponse instance
6262
*/
63-
publicfunctioncreateRedirectResponse(Request$request,$path,$status =302)
63+
publicfunctioncreateRedirectResponse(Request$request,string$path,int$status =302)
6464
{
6565
if (null !==$this->secureDomainRegexp &&'https' ===$this->urlMatcher->getContext()->getScheme() &&preg_match('#^https?:[/\\\\]{2,}+[^/]++#i',$path,$host) && !preg_match(sprintf($this->secureDomainRegexp,preg_quote($request->getHttpHost())),$host[0])) {
6666
$path ='/';
@@ -80,7 +80,7 @@ public function createRedirectResponse(Request $request, $path, $status = 302)
8080
*
8181
* @return Request A Request instance
8282
*/
83-
publicfunctioncreateRequest(Request$request,$path)
83+
publicfunctioncreateRequest(Request$request,string$path)
8484
{
8585
$newRequest = Request::create($this->generateUri($request,$path),'get', [],$request->cookies->all(), [],$request->server->all());
8686

@@ -119,7 +119,7 @@ public function createRequest(Request $request, $path)
119119
*
120120
* @return bool true if the path is the same as the one from the Request, false otherwise
121121
*/
122-
publicfunctioncheckRequestPath(Request$request,$path)
122+
publicfunctioncheckRequestPath(Request$request,string$path)
123123
{
124124
if ('/' !==$path[0]) {
125125
try {
@@ -151,7 +151,7 @@ public function checkRequestPath(Request $request, $path)
151151
*
152152
* @throws \LogicException
153153
*/
154-
publicfunctiongenerateUri($request,$path)
154+
publicfunctiongenerateUri(Request$request,string$path)
155155
{
156156
if (0 ===strpos($path,'http') || !$path) {
157157
return$path;

‎src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter
6060
*
6161
* @return string The logout path
6262
*/
63-
publicfunctiongetLogoutPath($key =null)
63+
publicfunctiongetLogoutPath(string$key =null)
6464
{
6565
return$this->generateLogoutUrl($key, UrlGeneratorInterface::ABSOLUTE_PATH);
6666
}
@@ -72,16 +72,12 @@ public function getLogoutPath($key = null)
7272
*
7373
* @return string The logout URL
7474
*/
75-
publicfunctiongetLogoutUrl($key =null)
75+
publicfunctiongetLogoutUrl(string$key =null)
7676
{
7777
return$this->generateLogoutUrl($key, UrlGeneratorInterface::ABSOLUTE_URL);
7878
}
7979

80-
/**
81-
* @param string|null $key The current firewall key
82-
* @param string|null $context The current firewall context
83-
*/
84-
publicfunctionsetCurrentFirewall($key,$context =null)
80+
publicfunctionsetCurrentFirewall(string$key,string$context =null)
8581
{
8682
$this->currentFirewall = [$key,$context];
8783
}
@@ -94,7 +90,7 @@ public function setCurrentFirewall($key, $context = null)
9490
*
9591
* @return string The logout URL
9692
*/
97-
privatefunctiongenerateLogoutUrl($key,$referenceType)
93+
privatefunctiongenerateLogoutUrl(string$key,$referenceType)
9894
{
9995
list($logoutPath,$csrfTokenId,$csrfParameter,$csrfTokenManager) =$this->getListener($key);
10096

@@ -134,7 +130,7 @@ private function generateLogoutUrl($key, $referenceType)
134130
*
135131
* @throws \InvalidArgumentException if no LogoutListener is registered for the key or could not be found automatically
136132
*/
137-
privatefunctiongetListener($key)
133+
privatefunctiongetListener(string$key)
138134
{
139135
if (null !==$key) {
140136
if (isset($this->listeners[$key])) {

‎src/Symfony/Component/Security/Http/ParameterBagUtils.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class ParameterBagUtils
3636
*
3737
* @throws InvalidArgumentException when the given path is malformed
3838
*/
39-
publicstaticfunctiongetParameterBagValue(ParameterBag$parameters,$path)
39+
publicstaticfunctiongetParameterBagValue(ParameterBag$parameters,string$path)
4040
{
4141
if (false ===$pos =strpos($path,'[')) {
4242
return$parameters->get($path);
@@ -71,7 +71,7 @@ public static function getParameterBagValue(ParameterBag $parameters, $path)
7171
*
7272
* @throws InvalidArgumentException when the given path is malformed
7373
*/
74-
publicstaticfunctiongetRequestParameterValue(Request$request,$path)
74+
publicstaticfunctiongetRequestParameterValue(Request$request,string$path)
7575
{
7676
if (false ===$pos =strpos($path,'[')) {
7777
return$request->get($path);

‎src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,9 @@ final protected function getUserProvider($class)
235235
/**
236236
* Decodes the raw cookie value.
237237
*
238-
* @param string $rawCookie
239-
*
240238
* @return array
241239
*/
242-
protectedfunctiondecodeCookie($rawCookie)
240+
protectedfunctiondecodeCookie(string$rawCookie)
243241
{
244242
returnexplode(self::COOKIE_DELIMITER,base64_decode($rawCookie));
245243
}

‎src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function onLoginSuccess(Request $request, Response $response, TokenInt
9898
*
9999
* @return string
100100
*/
101-
protectedfunctiongenerateCookieValue($class,$username,$expires,$password)
101+
protectedfunctiongenerateCookieValue(string$class,string$username,int$expires,string$password)
102102
{
103103
// $username is encoded because it might contain COOKIE_DELIMITER,
104104
// we assume other values don't
@@ -120,7 +120,7 @@ protected function generateCookieValue($class, $username, $expires, $password)
120120
*
121121
* @return string
122122
*/
123-
protectedfunctiongenerateCookieHash($class,$username,$expires,$password)
123+
protectedfunctiongenerateCookieHash(string$class,string$username,int$expires,string$password)
124124
{
125125
returnhash_hmac('sha256',$class.self::COOKIE_DELIMITER.$username.self::COOKIE_DELIMITER.$expires.self::COOKIE_DELIMITER.$password,$this->getSecret());
126126
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp