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

Commit08c2ee3

Browse files
[*Bundle] Add autowiring aliases for common services
1 parenta96a997 commit08c2ee3

File tree

54 files changed

+54
-63
lines changed

Some content is hidden

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

54 files changed

+54
-63
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
useSymfony\Component\HttpFoundation\RedirectResponse;
2424
useSymfony\Component\HttpFoundation\ResponseHeaderBag;
2525
useSymfony\Component\HttpFoundation\Session\Session;
26+
useSymfony\Component\HttpFoundation\Session\SessionInterface;
2627
useSymfony\Component\HttpFoundation\StreamedResponse;
2728
useSymfony\Component\HttpKernel\Exception\NotFoundHttpException;
2829
useSymfony\Component\HttpKernel\HttpKernelInterface;
@@ -76,12 +77,9 @@ protected function getSerializer(): SerializerInterface
7677
}
7778

7879
/**
79-
* An instance of the Session implementation (and not the interface) is returned because getFlashBag is not part of
80-
* the interface.
81-
*
8280
* @required
8381
*/
84-
protectedfunctiongetSession():Session
82+
protectedfunctiongetSession():SessionInterface
8583
{
8684
}
8785

@@ -235,7 +233,11 @@ protected function file($file, string $fileName = null, string $disposition = Re
235233
*/
236234
protectedfunctionaddFlash(string$type,string$message)
237235
{
238-
$this->getSession()->getFlashBag()->add($type,$message);
236+
$session =$this->getSession();
237+
if (!$sessioninstanceof Session) {
238+
thrownew \LogicException(sprintf('You can not use the addFlash method: "%s" is not an instance of "%s".',get_class($session), Session::class));
239+
}
240+
$session->getFlashBag()->add($type,$message);
239241
}
240242

241243
/**
@@ -245,8 +247,6 @@ protected function addFlash(string $type, string $message)
245247
* @param mixed $object The object
246248
*
247249
* @return bool
248-
*
249-
* @throws \LogicException
250250
*/
251251
protectedfunctionisGranted($attributes,$object =null):bool
252252
{
@@ -396,8 +396,6 @@ protected function createFormBuilder($data = null, array $options = array()): Fo
396396
*
397397
* @return mixed
398398
*
399-
* @throws \LogicException If SecurityBundle is not available
400-
*
401399
* @see TokenInterface::getUser()
402400
*/
403401
protectedfunctiongetUser()

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/assets.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<argumenttype="service"id="assets.empty_package" /><!-- default package-->
1111
<argumenttype="collection" /><!-- named packages-->
1212
</service>
13+
<serviceid="Symfony\Component\Asset\Packages"alias="assets.packages"public="false" />
1314

1415
<serviceid="assets.empty_package"class="Symfony\Component\Asset\Package"public="false">
1516
<argumenttype="service"id="assets.empty_version_strategy" />

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
<serviceid="debug.file_link_formatter"class="Symfony\Component\HttpKernel\Debug\FileLinkFormatter"public="false">
2727
<argument>%debug.file_link_format%</argument>
2828
</service>
29+
<serviceid="Symfony\Component\HttpKernel\Debug\FileLinkFormatter"alias="debug.file_link_formatter"public="false" />
2930
</services>
3031
</container>

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<services>
88
<!-- ResolvedFormTypeFactory-->
99
<serviceid="form.resolved_type_factory"class="Symfony\Component\Form\ResolvedFormTypeFactory" />
10+
<serviceid="Symfony\Component\Form\ResolvedFormTypeFactoryInterface"alias="form.resolved_type_factory"public="false" />
1011

1112
<!-- FormRegistry-->
1213
<serviceid="form.registry"class="Symfony\Component\Form\FormRegistry">
@@ -21,12 +22,14 @@
2122
</argument>
2223
<argumenttype="service"id="form.resolved_type_factory" />
2324
</service>
25+
<serviceid="Symfony\Component\Form\FormRegistryInterface"alias="form.registry"public="false" />
2426

2527
<!-- FormFactory-->
2628
<serviceid="form.factory"class="Symfony\Component\Form\FormFactory">
2729
<argumenttype="service"id="form.registry" />
2830
<argumenttype="service"id="form.resolved_type_factory" />
2931
</service>
32+
<serviceid="Symfony\Component\Form\FormFactoryInterface"alias="form.factory"public="false" />
3033

3134
<!-- DependencyInjectionExtension-->
3235
<serviceid="form.extension"class="Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension"public="false">

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<serviceid="translator"class="Symfony\Component\Translation\IdentityTranslator">
88
<argumenttype="service"id="translator.selector" />
99
</service>
10+
<serviceid="Symfony\Component\Translation\TranslatorInterface"alias="translator"public="false" />
1011

1112
<serviceid="translator.selector"class="Symfony\Component\Translation\MessageSelector"public="false" />
1213
</services>

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
<argument /><!-- throwExceptionOnInvalidIndex, set by the extension-->
1111
<argumenttype="service"id="cache.property_access"on-invalid="ignore" />
1212
</service>
13+
<serviceid="Symfony\Component\PropertyAccess\PropertyAccessorInterface"alias="property_accessor"public="false" />
1314
</services>
1415
</container>

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<argumenttype="collection" />
1212
<argumenttype="collection" />
1313
</service>
14+
<serviceid="Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface"alias="property_info"public="false" />
1415

1516
<!-- Extractor-->
1617
<serviceid="property_info.reflection_extractor"class="Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor"public="false">

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
</service>
8181

8282
<serviceid="router"alias="router.default" />
83+
<serviceid="Symfony\Component\Routing\RouterInterface"alias="router"public="false" />
84+
<serviceid="Symfony\Component\Routing\Generator\UrlGeneratorInterface"alias="router"public="false" />
85+
<serviceid="Symfony\Component\Routing\Matcher\UrlMatcherInterface"alias="router"public="false" />
8386

8487
<serviceid="router.request_context"class="Symfony\Component\Routing\RequestContext"public="false">
8588
<argument>%router.request_context.base_url%</argument>
@@ -89,6 +92,7 @@
8992
<argument>%request_listener.http_port%</argument>
9093
<argument>%request_listener.https_port%</argument>
9194
</service>
95+
<serviceid="Symfony\Component\Routing\RequestContext"alias="router.request_context"public="false" />
9296

9397
<serviceid="router.cache_warmer"class="Symfony\Bundle\FrameworkBundle\CacheWarmer\RouterCacheWarmer"public="false">
9498
<tagname="kernel.cache_warmer" />

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/security_csrf.xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66

77
<services>
88
<serviceid="security.csrf.token_generator"class="Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator"public="false" />
9+
<serviceid="Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface"alias="security.csrf.token_generator"public="false" />
910

1011
<serviceid="security.csrf.token_storage"class="Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage"public="false">
1112
<argumenttype="service"id="session" />
1213
</service>
14+
<serviceid="Symfony\Component\Security\Csrf\TokenStorage\TokenStorageInterface"alias="security.csrf.token_storage"public="false" />
1315

1416
<serviceid="security.csrf.token_manager"class="Symfony\Component\Security\Csrf\CsrfTokenManager">
1517
<argumenttype="service"id="security.csrf.token_generator" />
1618
<argumenttype="service"id="security.csrf.token_storage" />
1719
</service>
20+
<serviceid="Symfony\Component\Security\Csrf\CsrfTokenManagerInterface"alias="security.csrf.token_manager"public="false" />
1821
</services>
1922
</container>

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
<argumenttype="collection" />
1515
<argumenttype="collection" />
1616
</service>
17+
<serviceid="Symfony\Component\Serializer\SerializerInterface"alias="serializer"public="false" />
18+
<serviceid="Symfony\Component\Serializer\NormalizerInterface"alias="serializer"public="false" />
19+
<serviceid="Symfony\Component\Serializer\DenormalizerInterface"alias="serializer"public="false" />
20+
<serviceid="Symfony\Component\Serializer\EncoderInterface"alias="serializer"public="false" />
21+
<serviceid="Symfony\Component\Serializer\DecoderInterface"alias="serializer"public="false" />
1722

1823
<serviceid="serializer.property_accessor"alias="property_accessor"public="false" />
1924

@@ -27,6 +32,7 @@
2732
<!-- Run after all custom normalizers-->
2833
<tagname="serializer.normalizer"priority="-1000" />
2934
</service>
35+
<serviceid="Symfony\Component\Serializer\Normalizer\ObjectNormalizer"alias="serializer.normalizer.object"public="false" />
3036

3137
<serviceid="serializer.denormalizer.array"class="Symfony\Component\Serializer\Normalizer\ArrayDenormalizer"public="false">
3238
<!-- Run before the object normalizer-->

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp