Skip to content

Commit 8d7b1ea

Browse files
authored
Added deprecation notice on TranslationLoader interface and some comments (#31)
* Added deprecation notice on TranslationLoader interface and some comments * Use the interface as it was intended * Added changelog
1 parent fbe350b commit 8d7b1ea

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

Changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
44

5+
## 1.0.1
6+
7+
### Fixed
8+
9+
- The `LegacyTranslationReader` should also check for`Translation\SymfonyStorage\TranslationLoader`.
10+
11+
### Changed
12+
13+
- The `Translation\SymfonyStorage\TranslationLoader` was deprecated.
14+
515
## 1.0.0
616

717
### Added

src/LegacyTranslationReader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Translation\SymfonyStorage;
1313

1414
use Symfony\Component\Translation\MessageCatalogue;
15-
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
15+
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader as SymfonyTranslationLoader;
1616

1717
/**
1818
* This loader is just a wrapper for Symfony TranslationLoader
@@ -29,7 +29,7 @@ final class LegacyTranslationReader // implements Symfony\Component\Translation\
2929

3030
public function __construct($loader)
3131
{
32-
if (!$loader instanceof TranslationLoader) {
32+
if (!($loader instanceof TranslationLoader) && !($loader instanceof SymfonyTranslationLoader)) {
3333
throw new \LogicException(sprintf('PHP-Translation/SymfonyStorage does not support a TranslationReader of type "%s".', get_class($loader)));
3434
}
3535
$this->loader = $loader;

src/LegacyTranslationWriter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
*/
2323
final class LegacyTranslationWriter // implements Symfony\Component\Translation\Writer\TranslationWriterInterface
2424
{
25+
/**
26+
* @var TranslationWriter (This is a concrete class, the interface did not exist until sf 3.4)
27+
*/
2528
private $writer;
2629

2730
public function __construct($writer)

src/TranslationLoader.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Symfony\Component\Translation\MessageCatalogue;
1515

1616
/**
17+
* @deprecated Will be removed in 2.0. Please use Symfony\Component\Translation\Reader\TranslationReaderInterface.
18+
*
1719
* @author Tobias Nyholm <[email protected]>
1820
*/
1921
interface TranslationLoader

0 commit comments

Comments
 (0)