Skip to content

Commit

Permalink
psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
sokil committed Dec 20, 2020
1 parent 2c72944 commit e4ea1ce
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/AbstractDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public function __construct(

/**
* ISO Standard Number
*
* @psalm-pure
*/
abstract public static function getISONumber(): string;

Expand Down
5 changes: 5 additions & 0 deletions src/Database/Countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
class Countries extends AbstractNotPartitionedDatabase
{
/**
* ISO Standard Number
*
* @psalm-pure
*/
public static function getISONumber(): string
{
return '3166-1';
Expand Down
2 changes: 2 additions & 0 deletions src/Database/Countries/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Country

/**
* @var string|null
*
* @psalm-allow-private-mutation
*/
private $localName;

Expand Down
5 changes: 5 additions & 0 deletions src/Database/Currencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
class Currencies extends AbstractNotPartitionedDatabase
{
/**
* ISO Standard Number
*
* @psalm-pure
*/
public static function getISONumber(): string
{
return '4217';
Expand Down
2 changes: 2 additions & 0 deletions src/Database/Currencies/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Currency

/**
* @var string|null
*
* @psalm-allow-private-mutation
*/
private $localName;

Expand Down
5 changes: 5 additions & 0 deletions src/Database/HistoricCountries.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
class HistoricCountries extends AbstractNotPartitionedDatabase
{
/**
* ISO Standard Number
*
* @psalm-pure
*/
public static function getISONumber(): string
{
return '3166-3';
Expand Down
2 changes: 2 additions & 0 deletions src/Database/HistoricCountries/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Country

/**
* @var string|null
*
* @psalm-allow-private-mutation
*/
private $localName;

Expand Down
5 changes: 5 additions & 0 deletions src/Database/Languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
class Languages extends AbstractNotPartitionedDatabase implements LanguagesInterface
{
/**
* ISO Standard Number
*
* @psalm-pure
*/
public static function getISONumber(): string
{
return '639-3';
Expand Down
2 changes: 2 additions & 0 deletions src/Database/Languages/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class Language

/**
* @var string|null
*
* @psalm-allow-private-mutation
*/
private $localName;

Expand Down
5 changes: 5 additions & 0 deletions src/Database/LanguagesPartitioned.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

class LanguagesPartitioned extends AbstractPartitionedDatabase implements LanguagesInterface
{
/**
* ISO Standard Number
*
* @psalm-pure
*/
public static function getISONumber(): string
{
return '639-3';
Expand Down
5 changes: 5 additions & 0 deletions src/Database/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
class Scripts extends AbstractNotPartitionedDatabase
{
/**
* ISO Standard Number
*
* @psalm-pure
*/
public static function getISONumber(): string
{
return '15924';
Expand Down
2 changes: 2 additions & 0 deletions src/Database/Scripts/Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Script

/**
* @var string|null
*
* @psalm-allow-private-mutation
*/
private $localName;

Expand Down
5 changes: 5 additions & 0 deletions src/Database/Subdivisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
*/
class Subdivisions extends AbstractNotPartitionedDatabase implements SubdivisionsInterface
{
/**
* ISO Standard Number
*
* @psalm-pure
*/
public static function getISONumber(): string
{
return '3166-2';
Expand Down
2 changes: 2 additions & 0 deletions src/Database/Subdivisions/Subdivision.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Subdivision

/**
* @var string|null
*
* @psalm-allow-private-mutation
*/
private $localName;

Expand Down
5 changes: 5 additions & 0 deletions src/Database/SubdivisionsPartitioned.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

class SubdivisionsPartitioned extends AbstractPartitionedDatabase implements SubdivisionsInterface
{
/**
* ISO Standard Number
*
* @psalm-pure
*/
public static function getISONumber(): string
{
return '3166-2';
Expand Down
6 changes: 6 additions & 0 deletions src/TranslationDriver/DummyDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public function setLocale(string $locale): void
// do nothing
}

/**
* @param string $isoNumber
* @param string $message
*
* @return string
*/
public function translate(string $isoNumber, string $message): string
{
return $message;
Expand Down
6 changes: 6 additions & 0 deletions src/TranslationDriver/GettextExtensionDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public function setLocale(string $locale): void
}
}

/**
* @param string $isoNumber
* @param string $message
*
* @return string
*/
public function translate(string $isoNumber, string $message): string
{
return \dgettext($isoNumber, $message);
Expand Down
6 changes: 6 additions & 0 deletions src/TranslationDriver/SymfonyTranslationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public function setLocale(string $locale): void
$this->translator->setLocale($locale);
}

/**
* @param string $isoNumber
* @param string $message
*
* @return string
*/
public function translate(string $isoNumber, string $message): string
{
return $this->translator->trans($message, [], $isoNumber);
Expand Down
6 changes: 6 additions & 0 deletions src/TranslationDriver/TranslatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@

interface TranslatorInterface
{
/**
* @param string $isoNumber
* @param string $message
*
* @return string
*/
public function translate(string $isoNumber, string $message): string;
}

0 comments on commit e4ea1ce

Please sign in to comment.