Skip to content

Added deprecation notice on TranslationLoader interface and some comments #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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

## 1.0.1

### Fixed

- The `LegacyTranslationReader` should also check for`Translation\SymfonyStorage\TranslationLoader`.

### Changed

- The `Translation\SymfonyStorage\TranslationLoader` was deprecated.

## 1.0.0

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/LegacyTranslationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Translation\SymfonyStorage;

use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader as SymfonyTranslationLoader;

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

public function __construct($loader)
{
if (!$loader instanceof TranslationLoader) {
if (!($loader instanceof TranslationLoader) && !($loader instanceof SymfonyTranslationLoader)) {
throw new \LogicException(sprintf('PHP-Translation/SymfonyStorage does not support a TranslationReader of type "%s".', get_class($loader)));
}
$this->loader = $loader;
Expand Down
3 changes: 3 additions & 0 deletions src/LegacyTranslationWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
*/
final class LegacyTranslationWriter // implements Symfony\Component\Translation\Writer\TranslationWriterInterface
{
/**
* @var TranslationWriter (This is a concrete class, the interface did not exist until sf 3.4)
*/
private $writer;

public function __construct($writer)
Expand Down
2 changes: 2 additions & 0 deletions src/TranslationLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use Symfony\Component\Translation\MessageCatalogue;

/**
* @deprecated Will be removed in 2.0. Please use Symfony\Component\Translation\Reader\TranslationReaderInterface.
*
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
interface TranslationLoader
Expand Down