Skip to content

Commit 65021a7

Browse files
committed
Accept ArgumentCountError in StringFormat::fromString()
1 parent 7f9b520 commit 65021a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Translatable/StringFormat.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace CommunityTranslation\Translatable;
66

7+
use ArgumentCountError;
78
use CommunityTranslation\Entity\Translatable;
89
use RuntimeException;
910
use Throwable;
@@ -25,10 +26,12 @@ public static function fromString(string $string): self
2526
sprintf($string, ... $samples);
2627
} catch (ValueError $_) {
2728
return self::Raw;
29+
} catch (ArgumentCountError $_) {
30+
// Good
2831
} catch (Throwable $x) {
2932
$xClass = get_class($x);
3033

31-
throw new RuntimeException("Error checking the following string: {$string}\nThrowable class: {$xClass}\nMessaeg: {$x->getMessage()}");
34+
throw new RuntimeException("Error checking the following string: {$string}\nThrowable class: {$xClass}\nMessage: {$x->getMessage()}");
3235
}
3336

3437
return self::PHP;

0 commit comments

Comments
 (0)