aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2017-11-16 14:55:17 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2017-11-16 14:55:17 +0100
commit6eaacafc0f99567c50df21783a1528dab3966db9 (patch)
treeb82aa56422ada09e72bf34f2cdc408bfac56daf0
parent166b019122537df0861ed15b77d993e17f27cded (diff)
downloadLocale-6eaacafc0f99567c50df21783a1528dab3966db9.zip
Locale-6eaacafc0f99567c50df21783a1528dab3966db9.tar.gz
Locale-6eaacafc0f99567c50df21783a1528dab3966db9.tar.bz2
chore(php) Update to PHP 7.
-rw-r--r--Source/Localizer/Coerce.php2
-rw-r--r--Test/Documentation0
-rw-r--r--Test/Unit/Locale.php41
-rw-r--r--Test/Unit/Localizer/Coerce.php5
-rw-r--r--Test/Unit/Localizer/Http.php9
-rw-r--r--Test/Unit/Localizer/System.php9
6 files changed, 35 insertions, 31 deletions
diff --git a/Source/Localizer/Coerce.php b/Source/Localizer/Coerce.php
index 7258ec7..f49b843 100644
--- a/Source/Localizer/Coerce.php
+++ b/Source/Localizer/Coerce.php
@@ -55,7 +55,7 @@ class Coerce implements Localizer
/**
* Force a locale.
*/
- public function __construct(string $locale)
+ public function __construct(?string $locale)
{
$this->_locale = $locale;
diff --git a/Test/Documentation b/Test/Documentation
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Test/Documentation
diff --git a/Test/Unit/Locale.php b/Test/Unit/Locale.php
index d5ae509..3310053 100644
--- a/Test/Unit/Locale.php
+++ b/Test/Unit/Locale.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,21 +46,20 @@ use Hoa\Test;
*
* Test suite of the locale main object.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Locale extends Test\Unit\Suite
{
- public function case_no_default_no_locale()
+ public function case_no_default_no_locale(): void
{
$this
- ->exception(function () {
+ ->exception(function (): void {
new LUT();
})
- ->isInstanceOf('Hoa\Locale\Exception');
+ ->isInstanceOf(LUT\Exception::class);
}
- public function case_no_locale()
+ public function case_no_locale(): void
{
$this
->given(
@@ -72,7 +73,7 @@ class Locale extends Test\Unit\Suite
)
->then
->object($localizer)
- ->isInstanceOf('Hoa\Locale\Localizer\Coerce')
+ ->isInstanceOf(LUT\Localizer\Coerce::class)
->variable($localizer->getLocale())
->isNull()
->string($language)
@@ -81,26 +82,26 @@ class Locale extends Test\Unit\Suite
->isEqualTo('FR');
}
- public function case_locale_autoBoxing()
+ public function case_locale_autoBoxing(): void
{
$this
->given($locale = new LUT('fr-FR'))
->when($localizer = $locale->getLocalizer())
->then
->object($localizer)
- ->isInstanceOf('Hoa\Locale\Localizer\Coerce');
+ ->isInstanceOf(LUT\Localizer\Coerce::class);
}
- public function case_invalid_locale()
+ public function case_invalid_locale(): void
{
$this
- ->exception(function () {
+ ->exception(function (): void {
new LUT('fr_FR');
})
- ->isInstanceOf('Hoa\Locale\Exception');
+ ->isInstanceOf(LUT\Exception::class);
}
- public function case_type_privateUse()
+ public function case_type_privateUse(): void
{
$this
->given(
@@ -108,7 +109,7 @@ class Locale extends Test\Unit\Suite
'/x\-[a-z0-9]{1,8}/'
)
)
- ->when(function () use ($regex) {
+ ->when(function () use ($regex): void {
foreach ($this->sampleMany($regex, 1000) as $datum) {
$this
->given($locale = new LUT($datum))
@@ -125,7 +126,7 @@ class Locale extends Test\Unit\Suite
});
}
- public function case_type_grandfathered()
+ public function case_type_grandfathered(): void
{
$this
->given(
@@ -135,7 +136,7 @@ class Locale extends Test\Unit\Suite
'/[a-wyz](\-[a-z0-9]{2,8}){1,2}/'
)
)
- ->when(function () use ($regex) {
+ ->when(function () use ($regex): void {
foreach ($this->sampleMany($regex, 1000) as $datum) {
$this
->given($locale = new LUT($datum))
@@ -152,7 +153,7 @@ class Locale extends Test\Unit\Suite
});
}
- public function case_type_langtag()
+ public function case_type_langtag(): void
{
$this
->given(
@@ -167,7 +168,7 @@ class Locale extends Test\Unit\Suite
'/'
)
)
- ->when(function () use ($regex) {
+ ->when(function () use ($regex): void {
foreach ($this->sampleMany($regex, 1000) as $datum) {
$this
->given($locale = new LUT($datum))
@@ -179,7 +180,7 @@ class Locale extends Test\Unit\Suite
});
}
- public function case_langtag_exploded()
+ public function case_langtag_exploded(): void
{
$this
->given($locale = 'zh-Hant-TW-xy-ab-123-f-oo-4-42-x-qux')
@@ -199,7 +200,7 @@ class Locale extends Test\Unit\Suite
->isEqualTo('qux');
}
- public function case_langtag_default()
+ public function case_langtag_default(): void
{
$this
->given($locale = 'fr')
@@ -219,7 +220,7 @@ class Locale extends Test\Unit\Suite
->isNull();
}
- public function case_reset()
+ public function case_reset(): void
{
$this
->given(
diff --git a/Test/Unit/Localizer/Coerce.php b/Test/Unit/Localizer/Coerce.php
index 61b6c5d..33e5b07 100644
--- a/Test/Unit/Localizer/Coerce.php
+++ b/Test/Unit/Localizer/Coerce.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the coerce localizer.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Coerce extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given($localizer = new CUT('foo'))
diff --git a/Test/Unit/Localizer/Http.php b/Test/Unit/Localizer/Http.php
index f89d06f..2aed4d0 100644
--- a/Test/Unit/Localizer/Http.php
+++ b/Test/Unit/Localizer/Http.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the HTTP localizer.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class Http extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given($localizer = new CUT('fr-fr,en-uk;q=0.7,en;q=0.3'))
@@ -59,7 +60,7 @@ class Http extends Test\Unit\Suite
->isEqualTo('fr-fr');
}
- public function case_cfws()
+ public function case_cfws(): void
{
$this
->given($localizer = new CUT('fr-fr , en-uk ; q = 0.7'))
@@ -69,7 +70,7 @@ class Http extends Test\Unit\Suite
->isEqualTo('fr-fr');
}
- public function case_q_on_first()
+ public function case_q_on_first(): void
{
$this
->given($localizer = new CUT('fr-fr;q=0.9,en-uk;q=0.7'))
diff --git a/Test/Unit/Localizer/System.php b/Test/Unit/Localizer/System.php
index 6c7ee1b..6ecf63e 100644
--- a/Test/Unit/Localizer/System.php
+++ b/Test/Unit/Localizer/System.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* Hoa
*
@@ -44,12 +46,11 @@ use Hoa\Test;
*
* Test suite of the system localizer.
*
- * @copyright Copyright © 2007-2017 Hoa community
* @license New BSD License
*/
class System extends Test\Unit\Suite
{
- public function case_classic()
+ public function case_classic(): void
{
$this
->given(
@@ -62,7 +63,7 @@ class System extends Test\Unit\Suite
->isEqualTo('fr-FR');
}
- public function case_null()
+ public function case_null(): void
{
$this
->given(
@@ -75,7 +76,7 @@ class System extends Test\Unit\Suite
->isNull();
}
- public function case_not_encoding()
+ public function case_not_encoding(): void
{
$this
->given(