Skip to content

Commit e4a30a1

Browse files
authored
code fixes (#4)
* code fixes * Using cast to string
1 parent f6fc914 commit e4a30a1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/FileStorage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ final class FileStorage implements Storage
3030
private $writer;
3131

3232
/**
33-
* @var TranslationLoader
33+
* @var TranslationLoader|SymfonyTranslationLoader
3434
*/
3535
private $loader;
3636

3737
/**
38-
* @var string directory path
38+
* @var array directory path
3939
*/
4040
private $dir;
4141

@@ -121,7 +121,7 @@ private function writeCatalogue(MessageCatalogue $catalogue, $locale, $domain)
121121
{
122122
$resources = $catalogue->getResources();
123123
foreach ($resources as $resource) {
124-
$path = $resource->getResource();
124+
$path = (string) $resource;
125125
if (preg_match('|/'.$domain.'\.'.$locale.'\.([a-z]+)$|', $path, $matches)) {
126126
$this->writer->writeTranslations($catalogue, $matches[1], ['path' => str_replace($matches[0], '', $path)]);
127127
}

tests/FileStorageTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ class FileStorageTest extends \PHPUnit_Framework_TestCase
1919
{
2020
public function testConstructor()
2121
{
22-
$storage = new FileStorage(new TranslationWriter(), new TranslationLoader(), ['foo']);
22+
new FileStorage(new TranslationWriter(), new TranslationLoader(), ['foo']);
2323
}
2424

2525
/**
2626
* @expectedException \LogicException
2727
*/
2828
public function testConstructorInvalidLoader()
2929
{
30-
$storage = new FileStorage(new TranslationWriter(), new TranslationWriter(), ['foo']);
30+
new FileStorage(new TranslationWriter(), new TranslationWriter(), ['foo']);
3131
}
3232

3333
/**
3434
* @expectedException \LogicException
3535
*/
3636
public function testConstructorEmptyArray()
3737
{
38-
$storage = new FileStorage(new TranslationWriter(), new TranslationLoader(), []);
38+
new FileStorage(new TranslationWriter(), new TranslationLoader(), []);
3939
}
4040
}

0 commit comments

Comments
 (0)