Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ext/intl/spoofchecker/spoofchecker.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Spoofchecker
public const int INVISIBLE = UNKNOWN;
/** @cvalue USPOOF_CHAR_LIMIT */
public const int CHAR_LIMIT = UNKNOWN;
#if U_ICU_VERSION_MAJOR_NUM >= 53
Comment thread
LamentXU123 marked this conversation as resolved.
/** @cvalue USPOOF_ASCII */
public const int ASCII = UNKNOWN;
/** @cvalue USPOOF_HIGHLY_RESTRICTIVE */
Expand All @@ -33,6 +34,7 @@ class Spoofchecker
public const int SINGLE_SCRIPT_RESTRICTIVE = UNKNOWN;
/** @cvalue USPOOF_MIXED_NUMBERS */
public const int MIXED_NUMBERS = UNKNOWN;
#endif
#if U_ICU_VERSION_MAJOR_NUM >= 62
/** @cvalue USPOOF_HIDDEN_OVERLAY */
public const int HIDDEN_OVERLAY = UNKNOWN;
Expand Down Expand Up @@ -69,7 +71,9 @@ public function setAllowedLocales(string $locales): void {}
/** @tentative-return-type */
public function setChecks(int $checks): void {}

#if U_ICU_VERSION_MAJOR_NUM >= 53
/** @tentative-return-type */
public function setRestrictionLevel(int $level): void {}
#endif
public function setAllowedChars(string $pattern, int $patternOptions = 0): void {}
}
22 changes: 21 additions & 1 deletion ext/intl/spoofchecker/spoofchecker_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ext/intl/spoofchecker/spoofchecker_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ PHP_METHOD(Spoofchecker, setChecks)
}
/* }}} */

#if U_ICU_VERSION_MAJOR_NUM >= 53
/* TODO Document this method on PHP.net */
/* {{{ Set the loosest restriction level allowed for strings. */
PHP_METHOD(Spoofchecker, setRestrictionLevel)
Expand Down Expand Up @@ -163,6 +164,7 @@ PHP_METHOD(Spoofchecker, setRestrictionLevel)
uspoof_setRestrictionLevel(co->uspoof, (URestrictionLevel)level);
}
/* }}} */
#endif

PHP_METHOD(Spoofchecker, setAllowedChars)
{
Expand Down
6 changes: 6 additions & 0 deletions ext/intl/tests/spoofchecker_007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ spoofchecker with restriction level
intl
--SKIPIF--
<?php if(!class_exists("Spoofchecker")) print 'skip'; ?>
<?php
$r = new ReflectionClass("SpoofChecker");
if (false === $r->getConstant("SINGLE_SCRIPT_RESTRICTIVE")) {
die("skip Incompatible ICU version");
Comment thread
GrahamCampbell marked this conversation as resolved.
Outdated
}
?>
--FILE--
<?php

Expand Down
6 changes: 6 additions & 0 deletions ext/intl/tests/spoofchecker_supported_icu57_apis.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Spoofchecker exposes restriction-level APIs on all supported ICU versions
intl
--SKIPIF--
<?php if (!class_exists("Spoofchecker")) print 'skip'; ?>
<?php
$r = new ReflectionClass("Spoofchecker");
if (false === $r->getConstant("SINGLE_SCRIPT_RESTRICTIVE")) {
die("skip Incompatible ICU version");
Comment thread
GrahamCampbell marked this conversation as resolved.
Outdated
}
?>
--FILE--
<?php
$r = new ReflectionClass("Spoofchecker");
Expand Down
2 changes: 2 additions & 0 deletions ext/intl/tests/spoofchecker_unknown_restriction_level.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ intl
--SKIPIF--
<?php
if (!class_exists("Spoofchecker")) print 'skip';

if (!method_exists(new Spoofchecker(), 'setRestrictionLevel')) print 'skip ICU version < 53';
Comment thread
GrahamCampbell marked this conversation as resolved.
Outdated
?>
--FILE--
<?php
Expand Down
Loading