Skip to content

Commit 6e91dbe

Browse files
committed
Return null if no locale was detected
1 parent 98decc6 commit 6e91dbe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Middleware/LocaleHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public function __construct($locales, $detectors, $stores = [], $trustedDetector
5353
/**
5454
* Detect any supported locale and return the first match.
5555
*
56-
* @return string|false
56+
* @return string|null
5757
*/
58-
public function detect()
58+
public function detect(): ?string
5959
{
6060
foreach ($this->detectors as $detector) {
6161
$locales = (array) $this->getInstance($detector)->detect();
@@ -67,7 +67,7 @@ public function detect()
6767
}
6868
}
6969

70-
return false;
70+
return null;
7171
}
7272

7373
/**

tests/Unit/Middleware/LocaleHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function it_returns_false_if_no_supported_locale_could_be_detected()
110110

111111
$localeHandler = new LocaleHandler($supportedLocales, $detectors);
112112

113-
$this->assertFalse($localeHandler->detect());
113+
$this->assertNull($localeHandler->detect());
114114
}
115115

116116
/** @test */

0 commit comments

Comments
 (0)