Skip to content

Commit 77a53e4

Browse files
committed
minor #12867 Update typehints (atailouloute)
This PR was submitted for the 5.0 branch but it was merged into the 5.1 branch instead. Discussion ---------- Update typehints Commits ------- 09a9aa0 Update typehints
2 parents 48c34db + 09a9aa0 commit 77a53e4

File tree

12 files changed

+27
-27
lines changed

12 files changed

+27
-27
lines changed

components/asset.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ every day::
200200
$this->version = date('Ymd');
201201
}
202202

203-
public function getVersion($path)
203+
public function getVersion(string $path)
204204
{
205205
return $this->version;
206206
}
207207

208-
public function applyVersion($path)
208+
public function applyVersion(string $path)
209209
{
210210
return sprintf('%s?v=%s', $path, $this->getVersion($path));
211211
}

configuration/env_var_processors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ create a class that implements
631631

632632
class LowercasingEnvVarProcessor implements EnvVarProcessorInterface
633633
{
634-
public function getEnv($prefix, $name, \Closure $getEnv)
634+
public function getEnv(string $prefix, string $name, \Closure $getEnv)
635635
{
636636
$env = $getEnv($name);
637637

form/data_mappers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ in your form type::
9898
/**
9999
* @param Color|null $viewData
100100
*/
101-
public function mapDataToForms($viewData, $forms)
101+
public function mapDataToForms($viewData, iterable $forms)
102102
{
103103
// there is no data yet, so nothing to prepopulate
104104
if (null === $viewData) {
@@ -119,7 +119,7 @@ in your form type::
119119
$forms['blue']->setData($viewData->getBlue());
120120
}
121121

122-
public function mapFormsToData($forms, &$viewData)
122+
public function mapFormsToData(iterable $forms, &$viewData)
123123
{
124124
/** @var FormInterface[] $forms */
125125
$forms = iterator_to_array($forms);

form/type_guesser.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ Start by creating the class and these methods. Next, you'll learn how to fill ea
4343

4444
class PHPDocTypeGuesser implements FormTypeGuesserInterface
4545
{
46-
public function guessType($class, $property)
46+
public function guessType(string $class, string $property)
4747
{
4848
}
4949

50-
public function guessRequired($class, $property)
50+
public function guessRequired(string $class, string $property)
5151
{
5252
}
5353

54-
public function guessMaxLength($class, $property)
54+
public function guessMaxLength(string $class, string $property)
5555
{
5656
}
5757

58-
public function guessPattern($class, $property)
58+
public function guessPattern(string $class, string $property)
5959
{
6060
}
6161
}
@@ -94,7 +94,7 @@ With this knowledge, you can implement the ``guessType()`` method of the
9494

9595
class PHPDocTypeGuesser implements FormTypeGuesserInterface
9696
{
97-
public function guessType($class, $property)
97+
public function guessType(string $class, string $property)
9898
{
9999
$annotations = $this->readPhpDocAnnotations($class, $property);
100100

@@ -129,7 +129,7 @@ With this knowledge, you can implement the ``guessType()`` method of the
129129
}
130130
}
131131

132-
protected function readPhpDocAnnotations($class, $property)
132+
protected function readPhpDocAnnotations(string $class, string $property)
133133
{
134134
$reflectionProperty = new \ReflectionProperty($class, $property);
135135
$phpdoc = $reflectionProperty->getDocComment();

forms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ Set the ``label`` option on fields to define their labels explicitly::
672672

673673
->add('dueDate', DateType::class, [
674674
// set it to FALSE to not display the label for this field
675-
'label' => 'To Be Completed Before',
675+
'label' => 'To Be Completed Before',
676676
])
677677

678678
.. tip::

frontend/custom_version_strategy.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ version string::
7171
* @param string $manifestPath
7272
* @param string|null $format
7373
*/
74-
public function __construct($manifestPath, $format = null)
74+
public function __construct(string $manifestPath, string $format = null)
7575
{
7676
$this->manifestPath = $manifestPath;
7777
$this->format = $format ?: '%s?%s';
7878
}
7979

80-
public function getVersion($path)
80+
public function getVersion(string $path)
8181
{
8282
if (!is_array($this->hashes)) {
8383
$this->hashes = $this->loadManifest();
@@ -86,7 +86,7 @@ version string::
8686
return isset($this->hashes[$path]) ? $this->hashes[$path] : '';
8787
}
8888

89-
public function applyVersion($path)
89+
public function applyVersion(string $path)
9090
{
9191
$version = $this->getVersion($path);
9292

reference/dic_tags.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ service class::
410410

411411
class MyClearer implements CacheClearerInterface
412412
{
413-
public function clear($cacheDirectory)
413+
public function clear(string $cacheDirectory)
414414
{
415415
// clear your cache
416416
}
@@ -1062,7 +1062,7 @@ required option: ``alias``, which defines the name of the extractor::
10621062
/**
10631063
* Sets the prefix that should be used for new found messages.
10641064
*/
1065-
public function setPrefix($prefix)
1065+
public function setPrefix(string $prefix)
10661066
{
10671067
$this->prefix = $prefix;
10681068
}

security/access_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Take the following ``access_control`` entries as an example:
9292
'path' => '^/admin',
9393
'roles' => 'ROLE_USER_METHOD',
9494
'methods' => 'POST, PUT',
95-
]
95+
],
9696
],
9797
]);
9898

security/custom_authentication_provider.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ to service ids that may not exist yet: ``App\Security\Authentication\Provider\Ws
410410
411411
<services>
412412
<service id="App\Security\Authentication\Provider\WsseProvider">
413-
<argument key="$cachePool" type="service" id="cache.app"></argument>
413+
<argument key="$cachePool" type="service" id="cache.app"/>
414414
</service>
415415
416416
<service id="App\Security\Firewall\WsseListener">

security/user_provider.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ interface only requires one method: ``loadUserByUsername($username)``::
135135
{
136136
// ...
137137

138-
public function loadUserByUsername($usernameOrEmail)
138+
public function loadUserByUsername(string $usernameOrEmail)
139139
{
140140
$entityManager = $this->getEntityManager();
141141
@@ -376,7 +376,7 @@ command will generate a nice skeleton to get you started::
376376
*
377377
* @throws UsernameNotFoundException if the user is not found
378378
*/
379-
public function loadUserByUsername($username)
379+
public function loadUserByUsername(string $username)
380380
{
381381
// Load a User object from your data source or throw UsernameNotFoundException.
382382
// The $username argument may not actually be a username:
@@ -412,7 +412,7 @@ command will generate a nice skeleton to get you started::
412412
/**
413413
* Tells Symfony to use this provider for this User class.
414414
*/
415-
public function supportsClass($class)
415+
public function supportsClass(string $class)
416416
{
417417
return User::class === $class || is_subclass_of($class, User::class);
418418
}

serializer/custom_encoders.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,22 @@ create your own encoder that uses the
2727

2828
class YamlEncoder implements EncoderInterface, DecoderInterface
2929
{
30-
public function encode($data, $format, array $context = [])
30+
public function encode($data, string $format, array $context = [])
3131
{
3232
return Yaml::dump($data);
3333
}
3434

35-
public function supportsEncoding($format)
35+
public function supportsEncoding(string $format)
3636
{
3737
return 'yaml' === $format;
3838
}
3939

40-
public function decode($data, $format, array $context = [])
40+
public function decode(string $data, string $format, array $context = [])
4141
{
4242
return Yaml::parse($data);
4343
}
4444

45-
public function supportsDecoding($format)
45+
public function supportsDecoding(string $format)
4646
{
4747
return 'yaml' === $format;
4848
}

session/locale_sticky_session.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ correct locale however you want::
2828
{
2929
private $defaultLocale;
3030

31-
public function __construct($defaultLocale = 'en')
31+
public function __construct(string $defaultLocale = 'en')
3232
{
3333
$this->defaultLocale = $defaultLocale;
3434
}

0 commit comments

Comments
 (0)