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

Commit457b322

Browse files
committed
[Routing] Add type-hints to all public interfaces.
1 parent06899a1 commit457b322

12 files changed

+20
-29
lines changed

‎src/Symfony/Component/Routing/Generator/CompiledUrlGenerator.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(array $compiledRoutes, RequestContext $context, Logg
3131
$this->defaultLocale =$defaultLocale;
3232
}
3333

34-
publicfunctiongenerate($name,$parameters = [],$referenceType =self::ABSOLUTE_PATH)
34+
publicfunctiongenerate(string$name,array$parameters = [],int$referenceType =self::ABSOLUTE_PATH)
3535
{
3636
$locale =$parameters['_locale']
3737
??$this->context->getParameter('_locale')

‎src/Symfony/Component/Routing/Generator/ConfigurableRequirementsInterface.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ interface ConfigurableRequirementsInterface
4040
/**
4141
* Enables or disables the exception on incorrect parameters.
4242
* Passing null will deactivate the requirements check completely.
43-
*
44-
* @param bool|null $enabled
4543
*/
46-
publicfunctionsetStrictRequirements($enabled);
44+
publicfunctionsetStrictRequirements(?bool$enabled);
4745

4846
/**
4947
* Returns whether to throw an exception on incorrect parameters.

‎src/Symfony/Component/Routing/Generator/UrlGenerator.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ public function getContext()
108108
/**
109109
* {@inheritdoc}
110110
*/
111-
publicfunctionsetStrictRequirements($enabled)
111+
publicfunctionsetStrictRequirements(?bool$enabled)
112112
{
113-
$this->strictRequirements =null ===$enabled ?null : (bool)$enabled;
113+
$this->strictRequirements =$enabled;
114114
}
115115

116116
/**
@@ -124,7 +124,7 @@ public function isStrictRequirements()
124124
/**
125125
* {@inheritdoc}
126126
*/
127-
publicfunctiongenerate($name,$parameters = [],$referenceType =self::ABSOLUTE_PATH)
127+
publicfunctiongenerate(string$name,array$parameters = [],int$referenceType =self::ABSOLUTE_PATH)
128128
{
129129
$route =null;
130130
$locale =$parameters['_locale']
@@ -155,7 +155,7 @@ public function generate($name, $parameters = [], $referenceType = self::ABSOLUT
155155
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
156156
* it does not match the requirement
157157
*/
158-
protectedfunctiondoGenerate($variables,$defaults,$requirements,$tokens,$parameters,$name,$referenceType,$hostTokens,array$requiredSchemes = [])
158+
protectedfunctiondoGenerate(array$variables,array$defaults,array$requirements,array$tokens,array$parameters,string$name,int$referenceType,array$hostTokens,array$requiredSchemes = [])
159159
{
160160
$variables =array_flip($variables);
161161
$mergedParams =array_replace($defaults,$this->context->getParameters(),$parameters);
@@ -321,7 +321,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
321321
*
322322
* @return string The relative target path
323323
*/
324-
publicstaticfunctiongetRelativePath($basePath,$targetPath)
324+
publicstaticfunctiongetRelativePath(string$basePath,string$targetPath)
325325
{
326326
if ($basePath ===$targetPath) {
327327
return'';

‎src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,12 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface
7171
*
7272
* The special parameter _fragment will be used as the document fragment suffixed to the final URL.
7373
*
74-
* @param string $name The name of the route
75-
* @param mixed $parameters An array of parameters
76-
* @param int $referenceType The type of reference to be generated (one of the constants)
77-
*
7874
* @return string The generated URL
7975
*
8076
* @throws RouteNotFoundException If the named route doesn't exist
8177
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
8278
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
8379
* it does not match the requirement
8480
*/
85-
publicfunctiongenerate($name,$parameters = [],$referenceType =self::ABSOLUTE_PATH);
81+
publicfunctiongenerate(string$name,array$parameters = [],int$referenceType =self::ABSOLUTE_PATH);
8682
}

‎src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
publicfunctionmatch($pathinfo)
25+
publicfunctionmatch(string$pathinfo)
2626
{
2727
try {
2828
returnparent::match($pathinfo);

‎src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ interface RedirectableUrlMatcherInterface
2727
*
2828
* @return array An array of parameters
2929
*/
30-
publicfunctionredirect($path,$route,$scheme =null);
30+
publicfunctionredirect(string$path,string$route,string$scheme =null);
3131
}

‎src/Symfony/Component/Routing/Matcher/UrlMatcher.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getContext()
8181
/**
8282
* {@inheritdoc}
8383
*/
84-
publicfunctionmatch($pathinfo)
84+
publicfunctionmatch(string$pathinfo)
8585
{
8686
$this->allow =$this->allowSchemes = [];
8787

‎src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ interface UrlMatcherInterface extends RequestContextAwareInterface
3737
* @throws ResourceNotFoundException If the resource could not be found
3838
* @throws MethodNotAllowedException If the resource was found but the request method is not allowed
3939
*/
40-
publicfunctionmatch($pathinfo);
40+
publicfunctionmatch(string$pathinfo);
4141
}

‎src/Symfony/Component/Routing/Router.php‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,11 @@ public function setOptions(array $options)
159159
/**
160160
* Sets an option.
161161
*
162-
* @param string $key The key
163-
* @param mixed $value The value
162+
* @param mixed $value The value
164163
*
165164
* @throws \InvalidArgumentException
166165
*/
167-
publicfunctionsetOption($key,$value)
166+
publicfunctionsetOption(string$key,$value)
168167
{
169168
if (!\array_key_exists($key,$this->options)) {
170169
thrownew \InvalidArgumentException(sprintf('The Router does not support the "%s" option.',$key));
@@ -176,13 +175,11 @@ public function setOption($key, $value)
176175
/**
177176
* Gets an option value.
178177
*
179-
* @param string $key The key
180-
*
181178
* @return mixed The value
182179
*
183180
* @throws \InvalidArgumentException
184181
*/
185-
publicfunctiongetOption($key)
182+
publicfunctiongetOption(string$key)
186183
{
187184
if (!\array_key_exists($key,$this->options)) {
188185
thrownew \InvalidArgumentException(sprintf('The Router does not support the "%s" option.',$key));
@@ -237,15 +234,15 @@ public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFa
237234
/**
238235
* {@inheritdoc}
239236
*/
240-
publicfunctiongenerate($name,$parameters = [],$referenceType =self::ABSOLUTE_PATH)
237+
publicfunctiongenerate(string$name,array$parameters = [],int$referenceType =self::ABSOLUTE_PATH)
241238
{
242239
return$this->getGenerator()->generate($name,$parameters,$referenceType);
243240
}
244241

245242
/**
246243
* {@inheritdoc}
247244
*/
248-
publicfunctionmatch($pathinfo)
245+
publicfunctionmatch(string$pathinfo)
249246
{
250247
return$this->getMatcher()->match($pathinfo);
251248
}

‎src/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
class RedirectableUrlMatcherextends UrlMatcherimplements RedirectableUrlMatcherInterface
2121
{
22-
publicfunctionredirect($path,$route,$scheme =null)
22+
publicfunctionredirect(string$path,string$route,string$scheme =null)
2323
{
2424
return [
2525
'_controller' =>'Some controller reference...',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp