File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed
DependencyInjection/CompilerPass Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the PHP Translation package.
5+ *
6+ * (c) PHP Translation team <tobias.nyholm@gmail.com>
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace Translation \Bundle \DependencyInjection \CompilerPass ;
13+
14+ use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
15+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
16+ use Symfony \Component \HttpKernel \Kernel ;
17+
18+ /**
19+ * The FileDumper::setBackup is deprecated since Symfony 4.1.
20+ * This compiler pass assures our service definition remains unchanged for older symfony versions (3 or lower)
21+ * while keeping the latest version clean of deprecation notices.
22+ */
23+ class FileDumperBackupPass implements CompilerPassInterface
24+ {
25+ public function process (ContainerBuilder $ container )
26+ {
27+ if (Kernel::MAJOR_VERSION >= 4 ) {
28+ return ;
29+ }
30+
31+ $ definition = $ container ->getDefinition ('php_translation.storage.xlf_dumper ' );
32+ $ definition ->addMethodCall ('setBackup ' , [false ]);
33+ }
34+ }
Original file line number Diff line number Diff line change @@ -53,8 +53,6 @@ services:
5353 class : Translation\SymfonyStorage\Dumper\XliffDumper
5454 tags :
5555 - { name: translation.dumper, alias: xlf, legacy-alias: xliff }
56- calls :
57- - [setBackup, [false]]
5856
5957 php_translation.catalogue_counter :
6058 public : true
Original file line number Diff line number Diff line change 1616use Translation \Bundle \DependencyInjection \CompilerPass \EditInPlacePass ;
1717use Translation \Bundle \DependencyInjection \CompilerPass \ExternalTranslatorPass ;
1818use Translation \Bundle \DependencyInjection \CompilerPass \ExtractorPass ;
19+ use Translation \Bundle \DependencyInjection \CompilerPass \FileDumperBackupPass ;
1920use Translation \Bundle \DependencyInjection \CompilerPass \LoaderOrReaderPass ;
2021use Translation \Bundle \DependencyInjection \CompilerPass \StoragePass ;
2122use Translation \Bundle \DependencyInjection \CompilerPass \SymfonyProfilerPass ;
@@ -35,5 +36,6 @@ public function build(ContainerBuilder $container)
3536 $ container ->addCompilerPass (new StoragePass ());
3637 $ container ->addCompilerPass (new EditInPlacePass ());
3738 $ container ->addCompilerPass (new LoaderOrReaderPass ());
39+ $ container ->addCompilerPass (new FileDumperBackupPass ());
3840 }
3941}
You can’t perform that action at this time.
0 commit comments