Skip to content

Commit

Permalink
Lax default restriction level as recommended in ICU documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MatTheCat committed Feb 13, 2023
1 parent 3553b50 commit 25bb90d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class NoSuspiciousCharacters extends Constraint

/**
* Check that a string satisfies the requirements for the specified restriction level.
* It defaults to {@see self::RESTRICTION_LEVEL_HIGH} when using ICU >= 58,
* It defaults to {@see self::RESTRICTION_LEVEL_MODERATE} when using ICU >= 58,
* and is locked to {@see self::RESTRICTION_LEVEL_SINGLE_SCRIPT} on older versions.
*/
public const CHECK_RESTRICTION_LEVEL = 16;
Expand Down Expand Up @@ -126,7 +126,7 @@ public function __construct(
$this->locales ??= $locales;

if (method_exists(\Spoofchecker::class, 'setRestrictionLevel')) {
$this->restrictionLevel ??= self::RESTRICTION_LEVEL_HIGH;
$this->restrictionLevel ??= self::RESTRICTION_LEVEL_MODERATE;
} elseif ($this->restrictionLevel && self::RESTRICTION_LEVEL_SINGLE_SCRIPT !== $this->restrictionLevel) {
throw new LogicException('ICU <= 58 only supports single-script restriction level.');
} else {
Expand Down

0 comments on commit 25bb90d

Please sign in to comment.