Skip to content

Commit c20b601

Browse files
Add property types and return types in a few places
1 parent b5ac484 commit c20b601

Some content is hidden

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

52 files changed

+272
-271
lines changed

bundles/best_practices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ The end user can provide values in any configuration file:
436436
// config/services.php
437437
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
438438
439-
return static function (ContainerConfigurator $container) {
439+
return static function (ContainerConfigurator $container): void {
440440
$container->parameters()
441441
->set('acme_blog.author.email', '[email protected]')
442442
;

bundles/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ as integration of other related components:
4242
// config/packages/framework.php
4343
use Symfony\Config\FrameworkConfig;
4444
45-
return static function (FrameworkConfig $framework) {
45+
return static function (FrameworkConfig $framework): void {
4646
$framework->form()->enabled(true);
4747
};
4848

bundles/prepend_extension.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ registered and the ``entity_manager_name`` setting for ``acme_hello`` is set to
139139
// config/packages/acme_something.php
140140
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
141141
142-
return static function (ContainerConfigurator $container) {
142+
return static function (ContainerConfigurator $container): void {
143143
$container->extension('acme_something', [
144144
// ...
145145
'use_acme_goodbye' => false,

cache.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ adapter (template) they use by using the ``app`` and ``system`` key like:
8585
// config/packages/cache.php
8686
use Symfony\Config\FrameworkConfig;
8787
88-
return static function (FrameworkConfig $framework) {
88+
return static function (FrameworkConfig $framework): void {
8989
$framework->cache()
9090
->app('cache.adapter.filesystem')
9191
->system('cache.adapter.system')
@@ -163,7 +163,7 @@ will create pools with service IDs that follow the pattern ``cache.[type]``.
163163
// config/packages/cache.php
164164
use Symfony\Config\FrameworkConfig;
165165
166-
return static function (FrameworkConfig $framework) {
166+
return static function (FrameworkConfig $framework): void {
167167
$framework->cache()
168168
// Only used with cache.adapter.filesystem
169169
->directory('%kernel.cache_dir%/pools')
@@ -264,7 +264,7 @@ You can also create more customized pools:
264264
// config/packages/cache.php
265265
use Symfony\Config\FrameworkConfig;
266266
267-
return static function (FrameworkConfig $framework) {
267+
return static function (FrameworkConfig $framework): void {
268268
$cache = $framework->cache();
269269
$cache->defaultMemcachedProvider('memcached://localhost');
270270
@@ -444,7 +444,7 @@ and use that when configuring the pool.
444444
use Symfony\Component\DependencyInjection\ContainerBuilder;
445445
use Symfony\Config\FrameworkConfig;
446446
447-
return static function (ContainerBuilder $container, FrameworkConfig $framework) {
447+
return static function (ContainerBuilder $container, FrameworkConfig $framework): void {
448448
$framework->cache()
449449
->pool('cache.my_redis')
450450
->adapters(['cache.adapter.redis'])
@@ -524,7 +524,7 @@ Symfony stores the item automatically in all the missing pools.
524524
// config/packages/cache.php
525525
use Symfony\Config\FrameworkConfig;
526526
527-
return static function (FrameworkConfig $framework) {
527+
return static function (FrameworkConfig $framework): void {
528528
$framework->cache()
529529
->pool('my_cache_pool')
530530
->defaultLifetime(31536000) // One year
@@ -616,7 +616,7 @@ to enable this feature. This could be added by using the following configuration
616616
// config/packages/cache.php
617617
use Symfony\Config\FrameworkConfig;
618618
619-
return static function (FrameworkConfig $framework) {
619+
return static function (FrameworkConfig $framework): void {
620620
$framework->cache()
621621
->pool('my_cache_pool')
622622
->tags(true)
@@ -670,7 +670,7 @@ achieved by specifying the adapter.
670670
// config/packages/cache.php
671671
use Symfony\Config\FrameworkConfig;
672672
673-
return static function (FrameworkConfig $framework) {
673+
return static function (FrameworkConfig $framework): void {
674674
$framework->cache()
675675
->pool('my_cache_pool')
676676
->tags('tag_pool')

components/dependency_injection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ config files:
313313
314314
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
315315
316-
return static function (ContainerConfigurator $container) {
316+
return static function (ContainerConfigurator $container): void {
317317
$container->parameters()
318318
// ...
319319
->set('mailer.transport', 'sendmail')

components/dependency_injection/_imports-parameters-note.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
// config/services.php
3232
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
3333

34-
return static function (ContainerConfigurator $container) {
34+
return static function (ContainerConfigurator $container): void {
3535
$container->import('%kernel.project_dir%/somefile.yaml');
3636
};

components/serializer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ faster alternative to the
925925
926926
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
927927
928-
return static function (ContainerConfigurator $container) {
928+
return static function (ContainerConfigurator $container): void {
929929
$container->services()
930930
// ...
931931
->set('get_set_method_normalizer', GetSetMethodNormalizer::class)

components/var_dumper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ the :ref:`dump_destination option <configuration-debug-dump_destination>` of the
144144
// config/packages/debug.php
145145
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
146146
147-
return static function (ContainerConfigurator $container) {
147+
return static function (ContainerConfigurator $container): void {
148148
$container->extension('debug', [
149149
'dump_destination' => 'tcp://%env(VAR_DUMPER_SERVER)%',
150150
]);

configuration.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ configuration files, even if they use a different format:
136136
// config/services.php
137137
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
138138
139-
return static function (ContainerConfigurator $container) {
139+
return static function (ContainerConfigurator $container): void {
140140
$container->import('legacy_config.php');
141141
142142
// glob expressions are also supported to load multiple files
@@ -242,7 +242,7 @@ reusable configuration value. By convention, parameters are defined under the
242242
use App\Entity\BlogPost;
243243
use App\Enum\PostState;
244244
245-
return static function (ContainerConfigurator $container) {
245+
return static function (ContainerConfigurator $container): void {
246246
$container->parameters()
247247
// the parameter name is an arbitrary string (the 'app.' prefix is recommended
248248
// to better differentiate your parameters from Symfony parameters).
@@ -321,7 +321,7 @@ configuration file using a special syntax: wrap the parameter name in two ``%``
321321
// config/packages/some_package.php
322322
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
323323
324-
return static function (ContainerConfigurator $container) {
324+
return static function (ContainerConfigurator $container): void {
325325
$container->extension('some_package', [
326326
// any string surrounded by two % is replaced by that parameter value
327327
'email_address' => '%app.admin_email%',
@@ -358,7 +358,7 @@ configuration file using a special syntax: wrap the parameter name in two ``%``
358358
// config/services.php
359359
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
360360
361-
return static function (ContainerConfigurator $container) {
361+
return static function (ContainerConfigurator $container): void {
362362
$container->parameters()
363363
->set('url_pattern', 'http://symfony.com/?foo=%%s&amp;bar=%%d');
364364
};
@@ -620,7 +620,7 @@ This example shows how you could configure the application secret using an env v
620620
// config/packages/framework.php
621621
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
622622
623-
return static function (ContainerConfigurator $container) {
623+
return static function (ContainerConfigurator $container): void {
624624
$container->extension('framework', [
625625
// by convention the env var names are always uppercase
626626
'secret' => '%env(APP_SECRET)%',
@@ -973,7 +973,7 @@ doesn't work for parameters:
973973
974974
use App\Service\MessageGenerator;
975975
976-
return static function (ContainerConfigurator $container) {
976+
return static function (ContainerConfigurator $container): void {
977977
$container->parameters()
978978
->set('app.contents_dir', '...');
979979
@@ -1030,7 +1030,7 @@ whenever a service/controller defines a ``$projectDir`` argument, use this:
10301030
10311031
use App\Controller\LuckyController;
10321032
1033-
return static function (ContainerConfigurator $container) {
1033+
return static function (ContainerConfigurator $container): void {
10341034
$container->services()
10351035
->defaults()
10361036
// pass this value to any $projectDir argument for any service

configuration/env_var_processors.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ processor to turn the value of the ``HTTP_PORT`` env var into an integer:
4545
4646
use Symfony\Config\FrameworkConfig;
4747
48-
return static function (FrameworkConfig $framework) {
48+
return static function (FrameworkConfig $framework): void {
4949
$framework->router()
5050
->httpPort('%env(int:HTTP_PORT)%')
5151
// or
@@ -98,7 +98,7 @@ Symfony provides the following env var processors:
9898
use Symfony\Component\DependencyInjection\ContainerBuilder;
9999
use Symfony\Config\FrameworkConfig;
100100
101-
return static function (ContainerBuilder $container, FrameworkConfig $framework) {
101+
return static function (ContainerBuilder $container, FrameworkConfig $framework): void {
102102
$container->setParameter('env(SECRET)', 'some_secret');
103103
$framework->secret(env('SECRET')->string());
104104
};
@@ -144,7 +144,7 @@ Symfony provides the following env var processors:
144144
use Symfony\Component\DependencyInjection\ContainerBuilder;
145145
use Symfony\Config\FrameworkConfig;
146146
147-
return static function (ContainerBuilder $container, FrameworkConfig $framework) {
147+
return static function (ContainerBuilder $container, FrameworkConfig $framework): void {
148148
$container->setParameter('env(HTTP_METHOD_OVERRIDE)', 'true');
149149
$framework->httpMethodOverride(env('HTTP_METHOD_OVERRIDE')->bool());
150150
};
@@ -231,7 +231,7 @@ Symfony provides the following env var processors:
231231
use Symfony\Component\DependencyInjection\ContainerBuilder;
232232
use Symfony\Config\SecurityConfig;
233233
234-
return static function (ContainerBuilder $container, SecurityConfig $security) {
234+
return static function (ContainerBuilder $container, SecurityConfig $security): void {
235235
$container->setParameter('env(HEALTH_CHECK_METHOD)', 'Symfony\Component\HttpFoundation\Request::METHOD_HEAD');
236236
$security->accessControl()
237237
->path('^/health-check$')
@@ -280,7 +280,7 @@ Symfony provides the following env var processors:
280280
use Symfony\Component\DependencyInjection\ContainerBuilder;
281281
use Symfony\Config\FrameworkConfig;
282282
283-
return static function (ContainerBuilder $container) {
283+
return static function (ContainerBuilder $container): void {
284284
$container->setParameter('env(ALLOWED_LANGUAGES)', '["en","de","es"]');
285285
$container->setParameter('app_allowed_languages', '%env(json:ALLOWED_LANGUAGES)%');
286286
};
@@ -364,7 +364,7 @@ Symfony provides the following env var processors:
364364
use Symfony\Component\DependencyInjection\ContainerBuilder;
365365
use Symfony\Config\FrameworkConfig;
366366
367-
return static function (ContainerBuilder $container) {
367+
return static function (ContainerBuilder $container): void {
368368
$container->setParameter('env(ALLOWED_LANGUAGES)', 'en,de,es');
369369
$container->setParameter('app_allowed_languages', '%env(csv:ALLOWED_LANGUAGES)%');
370370
};

configuration/micro_kernel_trait.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ because the configuration started to get bigger:
369369
// config/framework.php
370370
use Symfony\Config\FrameworkConfig;
371371
372-
return static function (FrameworkConfig $framework) {
372+
return static function (FrameworkConfig $framework): void {
373373
$framework
374374
->secret('SOME_SECRET')
375375
->profiler()

configuration/override_dir_structure.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Console script::
6767
Web front-controller::
6868

6969
// public/index.php
70-
70+
7171
// ...
7272
$_SERVER['APP_RUNTIME_OPTIONS']['dotenv_path'] = 'another/custom/path/to/.env';
7373

@@ -236,7 +236,7 @@ configuration option to define your own translations directory (use :ref:`framew
236236
// config/packages/translation.php
237237
use Symfony\Config\FrameworkConfig;
238238
239-
return static function (FrameworkConfig $framework) {
239+
return static function (FrameworkConfig $framework): void {
240240
$framework->translator()
241241
->defaultPath('%kernel.project_dir%/i18n')
242242
;

configuration/secrets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ The secrets system is enabled by default and some of its behavior can be configu
309309
// config/packages/framework.php
310310
use Symfony\Config\FrameworkConfig;
311311
312-
return static function (FrameworkConfig $framework) {
312+
return static function (FrameworkConfig $framework): void {
313313
$framework->secrets()
314314
// ->vaultDirectory('%kernel.project_dir%/config/secrets/%kernel.environment%')
315315
// ->localDotenvFile('%kernel.project_dir%/.env.%kernel.environment%.local')

controller/error_pages.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ configuration option to point to it:
277277
// config/packages/framework.php
278278
use Symfony\Config\FrameworkConfig;
279279
280-
return static function (FrameworkConfig $framework) {
280+
return static function (FrameworkConfig $framework): void {
281281
// ...
282282
$framework->errorController('App\Controller\ErrorController::show');
283283
};

controller/upload_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ Then, define a service for this class:
312312
313313
use App\Service\FileUploader;
314314
315-
return static function (ContainerConfigurator $container) {
315+
return static function (ContainerConfigurator $container): void {
316316
$services = $container->services();
317317
318318
$services->set(FileUploader::class)

controller/value_resolver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ and adding a priority:
320320
321321
use App\ValueResolver\BookingIdValueResolver;
322322
323-
return static function (ContainerConfigurator $containerConfigurator) {
323+
return static function (ContainerConfigurator $containerConfigurator): void {
324324
$services = $containerConfigurator->services();
325325
326326
$services->set(BookingIdValueResolver::class)

deployment/proxies.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ and what headers your reverse proxy uses to send information:
7171
// config/packages/framework.php
7272
use Symfony\Config\FrameworkConfig;
7373
74-
return static function (FrameworkConfig $framework) {
74+
return static function (FrameworkConfig $framework): void {
7575
$framework
7676
// the IP address (or range) of your proxy
7777
->trustedProxies('192.0.0.1,10.0.0.0/8')

doctrine.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ methods:
282282
// ...
283283
284284
+ #[ORM\Column(type: Types::TEXT)]
285-
+ private $description;
285+
+ private string $description;
286286
287287
// getDescription() & setDescription() were also added
288288
}

doctrine/events.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ listener in the Symfony application by creating a new service for it and
234234
235235
use App\EventListener\SearchIndexer;
236236
237-
return static function (ContainerConfigurator $container) {
237+
return static function (ContainerConfigurator $container): void {
238238
$services = $container->services();
239239
240240
// listeners are applied by default to all Doctrine connections
@@ -385,7 +385,7 @@ with the ``doctrine.orm.entity_listener`` tag as follows:
385385
use App\Entity\User;
386386
use App\EventListener\UserChangedNotifier;
387387
388-
return static function (ContainerConfigurator $container) {
388+
return static function (ContainerConfigurator $container): void {
389389
$services = $container->services();
390390
391391
$services->set(UserChangedNotifier::class)
@@ -531,7 +531,7 @@ Doctrine connection to use) you must do that in the manual service configuration
531531
532532
use App\EventListener\DatabaseActivitySubscriber;
533533
534-
return static function (ContainerConfigurator $container) {
534+
return static function (ContainerConfigurator $container): void {
535535
$services = $container->services();
536536
537537
$services->set(DatabaseActivitySubscriber::class)

0 commit comments

Comments
 (0)