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

Commit31b668b

Browse files
minor#33255 Add return types to internal|final|private methods (nicolas-grekas)
This PR was merged into the 4.4 branch.Discussion----------Add return types to internal|final|private methods| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -Related to#33228This adds return-type declarations to internal, final and private methods.Found by using a patched DebugClassLoader + manual edits.Commits-------3211618 Add return types to internal|final|private methods
2 parentsb253f25 +3211618 commit31b668b

File tree

99 files changed

+256
-519
lines changed

Some content is hidden

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

99 files changed

+256
-519
lines changed

‎src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
useDoctrine\Common\Collections\Collection;
1515
useDoctrine\Common\Persistence\ManagerRegistry;
1616
useDoctrine\Common\Persistence\ObjectManager;
17+
useDoctrine\ORM\QueryBuilder;
1718
useSymfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
1819
useSymfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
1920
useSymfony\Bridge\Doctrine\Form\ChoiceList\IdReader;
@@ -51,12 +52,10 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
5152
*
5253
* @param object $choice The object
5354
*
54-
* @return string The string representation of the object
55-
*
5655
* @internal This method is public to be usable as callback. It should not
5756
* be used in user code.
5857
*/
59-
publicstaticfunctioncreateChoiceLabel($choice)
58+
publicstaticfunctioncreateChoiceLabel($choice):string
6059
{
6160
return (string)$choice;
6261
}
@@ -73,12 +72,10 @@ public static function createChoiceLabel($choice)
7372
* @param string $value The choice value. Corresponds to the object's
7473
* ID here.
7574
*
76-
* @return string The field name
77-
*
7875
* @internal This method is public to be usable as callback. It should not
7976
* be used in user code.
8077
*/
81-
publicstaticfunctioncreateChoiceName($choice,$key,$value)
78+
publicstaticfunctioncreateChoiceName($choice,$key,$value):string
8279
{
8380
returnstr_replace('-','_', (string)$value);
8481
}
@@ -88,17 +85,15 @@ public static function createChoiceName($choice, $key, $value)
8885
* For instance in ORM two query builders with an equal SQL string and
8986
* equal parameters are considered to be equal.
9087
*
91-
* @param object $queryBuilder
92-
*
93-
* @return array|false Array with important QueryBuilder parts or false if
94-
* they can't be determined
88+
* @return array|null Array with important QueryBuilder parts or null if
89+
* they can't be determined
9590
*
9691
* @internal This method is public to be usable as callback. It should not
9792
* be used in user code.
9893
*/
99-
publicfunctiongetQueryBuilderPartsForCachingHash($queryBuilder)
94+
publicfunctiongetQueryBuilderPartsForCachingHash(QueryBuilder$queryBuilder): ?array
10095
{
101-
returnfalse;
96+
returnnull;
10297
}
10398

10499
publicfunction__construct(ManagerRegistry$registry)
@@ -127,7 +122,7 @@ public function configureOptions(OptionsResolver $resolver)
127122
// If there is no QueryBuilder we can safely cache DoctrineChoiceLoader,
128123
// also if concrete Type can return important QueryBuilder parts to generate
129124
// hash key we go for it as well
130-
if (!$options['query_builder'] ||false !==($qbParts =$this->getQueryBuilderPartsForCachingHash($options['query_builder']))) {
125+
if (!$options['query_builder'] ||null !==$qbParts =$this->getQueryBuilderPartsForCachingHash($options['query_builder'])) {
131126
$hash = CachingFactoryDecorator::generateHash([
132127
$options['em'],
133128
$options['class'],

‎src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,10 @@ public function getBlockPrefix()
6868
* We consider two query builders with an equal SQL string and
6969
* equal parameters to be equal.
7070
*
71-
* @param QueryBuilder $queryBuilder
72-
*
73-
* @return array
74-
*
7571
* @internal This method is public to be usable as callback. It should not
7672
* be used in user code.
7773
*/
78-
publicfunctiongetQueryBuilderPartsForCachingHash($queryBuilder)
74+
publicfunctiongetQueryBuilderPartsForCachingHash(QueryBuilder$queryBuilder): ?array
7975
{
8076
return [
8177
$queryBuilder->getQuery()->getSQL(),

‎src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ public function setFluentSafe(bool $fluentSafe)
2929

3030
/**
3131
* {@inheritdoc}
32-
*
33-
* @return void
3432
*/
35-
publicfunctiongenerate(\ReflectionClass$originalClass,ClassGenerator$classGenerator)
33+
publicfunctiongenerate(\ReflectionClass$originalClass,ClassGenerator$classGenerator):void
3634
{
3735
parent::generate($originalClass,$classGenerator);
3836

‎src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ public function __construct(string $salt = '')
4040
/**
4141
* {@inheritdoc}
4242
*/
43-
publicfunctionisProxyCandidate(Definition$definition)
43+
publicfunctionisProxyCandidate(Definition$definition):bool
4444
{
4545
return ($definition->isLazy() ||$definition->hasTag('proxy')) &&$this->proxyGenerator->getProxifiedClass($definition);
4646
}
4747

4848
/**
4949
* {@inheritdoc}
5050
*/
51-
publicfunctiongetProxyFactoryCode(Definition$definition,$id,$factoryCode =null)
51+
publicfunctiongetProxyFactoryCode(Definition$definition,$id,$factoryCode =null):string
5252
{
5353
$instantiation ='return';
5454

@@ -82,7 +82,7 @@ public function getProxyFactoryCode(Definition $definition, $id, $factoryCode =
8282
/**
8383
* {@inheritdoc}
8484
*/
85-
publicfunctiongetProxyCode(Definition$definition)
85+
publicfunctiongetProxyCode(Definition$definition):string
8686
{
8787
$code =$this->classGenerator->generate($this->generateProxyClass($definition));
8888

‎src/Symfony/Bridge/Twig/Extension/RoutingExtension.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getUrl($name, $parameters = [], $schemeRelative = false)
9393
*
9494
* @final
9595
*/
96-
publicfunctionisUrlGenerationSafe(Node$argsNode)
96+
publicfunctionisUrlGenerationSafe(Node$argsNode):array
9797
{
9898
// support named arguments
9999
$paramsNode =$argsNode->hasNode('parameters') ?$argsNode->getNode('parameters') : (

‎src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ public function warmUp($cacheDir)
5757
*
5858
* @return bool always true
5959
*/
60-
publicfunctionisOptional()
60+
publicfunctionisOptional():bool
6161
{
6262
returntrue;
6363
}
6464

6565
/**
6666
* {@inheritdoc}
6767
*/
68-
publicstaticfunctiongetSubscribedServices()
68+
publicstaticfunctiongetSubscribedServices():array
6969
{
7070
return [
7171
'router' => RouterInterface::class,

‎src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,9 @@ protected function validateInput(InputInterface $input)
213213
/**
214214
* Loads the ContainerBuilder from the cache.
215215
*
216-
* @return ContainerBuilder
217-
*
218216
* @throws \LogicException
219217
*/
220-
protectedfunctiongetContainerBuilder()
218+
protectedfunctiongetContainerBuilder():ContainerBuilder
221219
{
222220
if ($this->containerBuilder) {
223221
return$this->containerBuilder;

‎src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php‎

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,12 @@ public function describe(OutputInterface $output, $object, array $options = [])
8484
}
8585
}
8686

87-
/**
88-
* Returns the output.
89-
*
90-
* @return OutputInterface The output
91-
*/
92-
protectedfunctiongetOutput()
87+
protectedfunctiongetOutput():OutputInterface
9388
{
9489
return$this->output;
9590
}
9691

97-
/**
98-
* Writes content to output.
99-
*
100-
* @param string $content
101-
* @param bool $decorated
102-
*/
103-
protectedfunctionwrite($content,$decorated =false)
92+
protectedfunctionwrite(string$content,bool$decorated =false)
10493
{
10594
$this->output->write($content,false,$decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
10695
}
@@ -182,10 +171,8 @@ abstract protected function describeCallable($callable, array $options = []);
182171
* Formats a value as string.
183172
*
184173
* @param mixed $value
185-
*
186-
* @return string
187174
*/
188-
protectedfunctionformatValue($value)
175+
protectedfunctionformatValue($value):string
189176
{
190177
if (\is_object($value)) {
191178
returnsprintf('object(%s)',\get_class($value));
@@ -202,10 +189,8 @@ protected function formatValue($value)
202189
* Formats a parameter.
203190
*
204191
* @param mixed $value
205-
*
206-
* @return string
207192
*/
208-
protectedfunctionformatParameter($value)
193+
protectedfunctionformatParameter($value):string
209194
{
210195
if (\is_bool($value) ||\is_array($value) || (null ===$value)) {
211196
$jsonString =json_encode($value);
@@ -246,10 +231,8 @@ protected function resolveServiceDefinition(ContainerBuilder $builder, $serviceI
246231

247232
/**
248233
* @param bool $showHidden
249-
*
250-
* @return array
251234
*/
252-
protectedfunctionfindDefinitionsByTag(ContainerBuilder$builder,$showHidden)
235+
protectedfunctionfindDefinitionsByTag(ContainerBuilder$builder,$showHidden):array
253236
{
254237
$definitions = [];
255238
$tags =$builder->findTags();

‎src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,7 @@ private function writeData(array $data, array $options)
198198
$this->write(json_encode($data,$flags |JSON_PRETTY_PRINT)."\n");
199199
}
200200

201-
/**
202-
* @return array
203-
*/
204-
protectedfunctiongetRouteData(Route$route)
201+
protectedfunctiongetRouteData(Route$route):array
205202
{
206203
$data = [
207204
'path' =>$route->getPath(),

‎src/Symfony/Bundle/FrameworkBundle/Routing/RedirectableCompiledUrlMatcher.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class RedirectableCompiledUrlMatcher extends CompiledUrlMatcher implements Redir
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
publicfunctionredirect($path,$route,$scheme =null)
27+
publicfunctionredirect($path,$route,$scheme =null):array
2828
{
2929
return [
3030
'_controller' =>'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp