Completed
Push — master ( 8f81c9...db13bb )
by Olivier
03:10 queued 13s
created

src/LegacyTranslationWriter.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
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\SymfonyStorage;
13
14
use Symfony\Component\Translation\MessageCatalogue;
15
use Symfony\Component\Translation\Writer\TranslationWriter;
16
17
/**
18
 * This writer is just a wrapper for Symfony TranslationWriter
19
 * and provide a BC layer for Symfony 2.7 to 3.3.
20
 *
21
 * @author Victor Bocharsky <[email protected]>
22
 */
23
final class LegacyTranslationWriter // implements Symfony\Component\Translation\Writer\TranslationWriterInterface
24
{
25
    /**
26
     * @var TranslationWriter (This is a concrete class, the interface did not exist until sf 3.4)
27
     */
28
    private $writer;
29
30
    public function __construct($writer)
31
    {
32
        // If not Translation writer from sf 2.7 to 3.3
33
        if (!$writer instanceof TranslationWriter) {
34
            throw new \LogicException(sprintf('PHP-Translation/SymfonyStorage does not support a TranslationWriter of type "%s".', get_class($writer)));
35
        }
36
37
        $this->writer = $writer;
38
    }
39
40
    public function write(MessageCatalogue $catalogue, $format, $options = [])
41
    {
42
        $this->writer->writeTranslations($catalogue, $format, $options);
0 ignored issues
show
The method writeTranslations() does not seem to exist on object<Symfony\Component...iter\TranslationWriter>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
    }
44
}
45