/hphp/runtime/ext/icu/ext_icu_uchar.php

https://gitlab.com/Blueprint-Marketing/hhvm · PHP · 619 lines · 142 code · 59 blank · 418 comment · 0 complexity · 40df0404344181698206a63f0ad9e95f MD5 · raw file

  1. <?hh
  2. class IntlChar {
  3. /**
  4. * Similar to \chr(), returns a UTF-8 encoded codepoint
  5. * When passed a single UTF-8 codepoint as a string,
  6. * acts as an identity validator function
  7. *
  8. * @param (int|string) $cp - Codepoint as an integer or UTF-8 string
  9. * @return string - UTF-8 encoded codepoint
  10. */
  11. <<__Native,__IsFoldable>> static
  12. public function chr(mixed $cp): mixed;
  13. /**
  14. * Similar to \ord(), returns an integer character value
  15. * When passed an integer, acts as an identity validator
  16. *
  17. * @param (int|string) $cp - Codepoint as an integer or UTf-8 string
  18. * @return int - Unicode character number
  19. */
  20. <<__Native,__IsFoldable>> static
  21. public function ord(mixed $cp): mixed;
  22. /**
  23. * Whether or not the specified codepoint has the noted boolean property.
  24. *
  25. * @param (int|string) $cp - Codepoint as an integer or UTf-8 string
  26. * @param int $prop - One of IntlChar::PROPERTY_* constants
  27. * @return bool - Whether or not the codepoint has the property
  28. */
  29. <<__Native,__IsFoldable>> static
  30. public function hasBinaryProperty(mixed $cp, int $prop): mixed;
  31. /**
  32. * The codepoint specific integer property value.
  33. *
  34. * @param (int|string) $cp - Codepoint as an integer or UTf-8 string
  35. * @param int $prop - One of IntlChar::PROPERTY_* constants
  36. * @return int - Value of the property for this codepoint
  37. */
  38. <<__Native,__IsFoldable>> static
  39. public function getIntPropertyValue(mixed $cp, int $prop): mixed;
  40. /**
  41. * The maximum value a given property can have for any character
  42. *
  43. * @param int $prop - One of IntlChar::PROPERTY_* constants
  44. * @return int - Maximum value for the property specified
  45. */
  46. <<__Native,__IsFoldable>> static
  47. public function getIntPropertyMaxValue(int $prop): int;
  48. /**
  49. * The minimum value a given property can have for any character
  50. *
  51. * @param int $prop - One of IntlChar::PROPERTY_* constants
  52. * @return int - Minimum value for the property specified
  53. */
  54. <<__Native,__IsFoldable>> static
  55. public function getIntPropertyMinValue(int $prop): int;
  56. /**
  57. * Get the numeric value for a Unicode codepoint.
  58. *
  59. * @param (int|string) $cp - The codepoint to get a numeric value for
  60. * @return float - The numeric value or IntlChar::NO_NUMERIC_VALUE
  61. */
  62. <<__Native,__IsFoldable>> static
  63. public function getNumericValue(mixed $cp): mixed;
  64. /**
  65. * Iteratively call a handler function with blocks of contiguous
  66. * character types.
  67. *
  68. * @param callback $cb
  69. * function (
  70. * int $start, // First codepoint in this block
  71. * int $limit, // One past the last codepoint of this block
  72. * int $type, // The type of codepoints in this block
  73. * // One of IntlChar::CHAR_CATEGORY_* constants
  74. * )
  75. */
  76. <<__Native>> static
  77. public function enumCharTypes((function(int,int,int):void) $cb): void;
  78. /**
  79. * Get the block which this codepoint belongs to
  80. *
  81. * @param (int|string) $cp - The codepoint to check
  82. * @return int - The Unicode block (See IntlChar::BLOCK_CODE_*)
  83. */
  84. <<__Native,__IsFoldable>> static
  85. public function getBlockCode(mixed $cp): mixed;
  86. /**
  87. * Get the formal name for a given codepoint
  88. *
  89. * @param (int|string) $cp - The codepoint to check
  90. * @param int $choice - The name type (e.g. extended, alias, etc...)
  91. * @return string - The name of the unicode point
  92. */
  93. <<__Native,__IsFoldable>> static
  94. public function charName(
  95. mixed $cp,
  96. int $choice = IntlChar::UNICODE_CHAR_NAME,
  97. ): mixed;
  98. /**
  99. * Translate a formal character name to a codepoint value
  100. *
  101. * @param string $name - Name of a codepoint (i.e. "LATIN SMALL LETTER S")
  102. * @param int $choice - The name type (e.g. extended, alias, etc...)
  103. * @return int - The unicode codepoint for the named character
  104. */
  105. <<__Native,__IsFoldable>> static
  106. public function charFromName(
  107. string $name,
  108. int $choice = IntlChar::UNICODE_CHAR_NAME,
  109. ): mixed;
  110. /**
  111. * Enumerate all named characters
  112. *
  113. * @param (int|string) $start - The first codepoint to being iterating from
  114. * @param (int|string) $limit - The codepoint after the last codepoint
  115. * @param callable $cb
  116. * function (
  117. * int $cp, // A codepoint
  118. * int $choice, // The name type (e.g. extended, alias, etc...)
  119. * string $name, // The name of the character
  120. * )
  121. * @param int $choice - The name type (e.g. extended, alias, etc...)
  122. */
  123. <<__Native>> static
  124. public function enumCharNames(
  125. mixed $start,
  126. mixed $limit,
  127. (function(int,int,string):void) $cb,
  128. int $choice = IntlChar::UNICODE_CHAR_NAME,
  129. ): void;
  130. /**
  131. * Return the Unicode name for a given property.
  132. *
  133. * @param int $prop - IntlChar::PROPERTY_*
  134. * @param int $choice - Name choice
  135. * @return string - The property name
  136. */
  137. <<__Native,__IsFoldable>> static
  138. public function getPropertyName(
  139. int $prop,
  140. int $choice = IntlChar::LONG_PROPERTY_NAME,
  141. ): mixed;
  142. /**
  143. * Return the Unicode name for a given property value.
  144. *
  145. * @param int $prop - IntlChar::PROPERTY_*
  146. * @param int $value - Property specific value
  147. * @param int $choice - Name choice
  148. * @return string - The Property Value name
  149. */
  150. <<__Native,__IsFoldable>> static
  151. public function getPropertyValueName(
  152. int $prop,
  153. int $value,
  154. int $choice = IntlChar::LONG_PROPERTY_NAME,
  155. ): mixed;
  156. /**
  157. * Look up the property enum value associated with a property name
  158. *
  159. * @param string $alias - Name of a character property
  160. * @return int - Property enum value
  161. */
  162. <<__Native,__IsFoldable>> static
  163. public function getPropertyEnum(string $alias): int;
  164. /**
  165. * Look up the property value enum associated with a
  166. * specific value associated with a known property
  167. *
  168. * @param int $prop - The property, one of IntlCHar::PROPERTY_*
  169. * @param string $name - The name of the property value
  170. * @return int - The enum for that property/value combination
  171. */
  172. <<__Native,__IsFoldable>> static
  173. public function getPropertyValueEnum(int $prop, string $name): int;
  174. /**
  175. * Fold the case for the given codepoint
  176. *
  177. * @param (int|string) $cp - Codepoint to fold
  178. * @param int $options - How to fold it
  179. * @return (int|string) - The folded codepoint
  180. */
  181. <<__Native,__IsFoldable>> static
  182. public function foldCase(
  183. mixed $cp,
  184. int $options = IntlChar::FOLD_CASE_DEFAULT,
  185. ): mixed;
  186. /**
  187. * Map a unicode codepoint to a numeric digit value
  188. * i.e. 0x31 => int(1)
  189. *
  190. * @param (int|string) $cp - The codepoint to get the numeric value of
  191. * @param int $radix - Base to translate the value in
  192. * @return int - Numeric value for the digit character
  193. */
  194. <<__Native,__IsFoldable>> static
  195. public function digit(mixed $cp, int $radix = 10): mixed;
  196. /**
  197. * Map a numeric digit to a unicode codepoint
  198. * i.e. int(1) => 0x31
  199. *
  200. * @param int $digit - Numeric value
  201. * @param int $radix - Base to translate the value in
  202. * @return int - Codepoint representing $digit in $radix
  203. */
  204. <<__Native,__IsFoldable>> static
  205. public function forDigit(int $digit, int $radix = 10): int;
  206. /**
  207. * Get the "age" of the code point.
  208. *
  209. * @param (int|string) $cp - Codepoint to introspect
  210. * @return array<int,int> - 4 octet version ID
  211. */
  212. <<__Native,__IsFoldable>> static
  213. public function charAge(mixed $cp): mixed;
  214. /**
  215. * Gets the Unicode version information.
  216. *
  217. * @return array - Current Unicode database version
  218. */
  219. <<__Native,__IsFoldable>> static
  220. public function getUnicodeVersion(): array;
  221. /**
  222. * Get the FC_NFKC_Closure property string for a character.
  223. *
  224. * @param (int|string) $cp - Codepoint to get property for
  225. * @return string - FC_NFKC_Closure property for given $cp
  226. */
  227. <<__Native,__IsFoldable>> static
  228. public function getFC_NFKC_Closure(mixed $cp): mixed;
  229. /**
  230. * Check if a code point has the Alphabetic Unicode property.
  231. *
  232. * @param (int|string) $cp - The codepoint to introspect
  233. * @return bool - Whether or not the codepoint has this property
  234. */
  235. <<__Native,__IsFoldable>> static
  236. public function isUAlphabetic(mixed $cp): mixed;
  237. /**
  238. * Check if a code point has the Lowercase Unicode property.
  239. *
  240. * @param (int|string) $cp - The codepoint to introspect
  241. * @return bool - Whether or not the codepoint has this property
  242. */
  243. <<__Native,__IsFoldable>> static
  244. public function isULowercase(mixed $cp): mixed;
  245. /**
  246. * Check if a code point has the Uppercase Unicode property.
  247. *
  248. * @param (int|string) $cp - The codepoint to introspect
  249. * @return bool - Whether or not the codepoint has this property
  250. */
  251. <<__Native,__IsFoldable>> static
  252. public function isUUppercase(mixed $cp): mixed;
  253. /**
  254. *Check if a code point has the White_Space Unicode property.
  255. *
  256. * @param (int|string) $cp - The codepoint to introspect
  257. * @return bool - Whether or not the codepoint has this property
  258. */
  259. <<__Native,__IsFoldable>> static
  260. public function isUWhiteSpace(mixed $cp): mixed;
  261. /**
  262. * Determines whether the specified code point has the
  263. * general category "Ll" (lowercase letter).
  264. *
  265. * @param (int|string) $cp - The codepoint to introspect
  266. * @return bool - Whether or not the codepoint has this property
  267. */
  268. <<__Native,__IsFoldable>> static
  269. public function islower(mixed $cp): mixed;
  270. /**
  271. * Determines whether the specified code point has the
  272. * general category "Lu" (uppercase letter).
  273. *
  274. * @param (int|string) $cp - The codepoint to introspect
  275. * @return bool - Whether or not the codepoint has this property
  276. */
  277. <<__Native,__IsFoldable>> static
  278. public function isupper(mixed $cp): mixed;
  279. /**
  280. * Determines whether the specified code point is a titlecase letter.
  281. *
  282. * @param (int|string) $cp - The codepoint to introspect
  283. * @return bool - Whether or not the codepoint has this property
  284. */
  285. <<__Native,__IsFoldable>> static
  286. public function istitle(mixed $cp): mixed;
  287. /**
  288. * Determines whether the specified code point is a
  289. * digit character according to Java.
  290. *
  291. * @param (int|string) $cp - The codepoint to introspect
  292. * @return bool - Whether or not the codepoint has this property
  293. */
  294. <<__Native,__IsFoldable>> static
  295. public function isdigit(mixed $cp): mixed;
  296. /**
  297. * Determines whether the specified code point is a letter character.
  298. *
  299. * @param (int|string) $cp - The codepoint to introspect
  300. * @return bool - Whether or not the codepoint has this property
  301. */
  302. <<__Native,__IsFoldable>> static
  303. public function isalpha(mixed $cp): mixed;
  304. /**
  305. * Determines whether the specified code point is an alphanumeric
  306. * character (letter or digit) according to Java.
  307. *
  308. * @param (int|string) $cp - The codepoint to introspect
  309. * @return bool - Whether or not the codepoint has this property
  310. */
  311. <<__Native,__IsFoldable>> static
  312. public function isalnum(mixed $cp): mixed;
  313. /**
  314. * Determines whether the specified code point is a hexadecimal digit.
  315. *
  316. * @param (int|string) $cp - The codepoint to introspect
  317. * @return bool - Whether or not the codepoint has this property
  318. */
  319. <<__Native,__IsFoldable>> static
  320. public function isxdigit(mixed $cp): mixed;
  321. /**
  322. * Determines whether the specified code point is a punctuation character.
  323. *
  324. * @param (int|string) $cp - The codepoint to introspect
  325. * @return bool - Whether or not the codepoint has this property
  326. */
  327. <<__Native,__IsFoldable>> static
  328. public function ispunct(mixed $cp): mixed;
  329. /**
  330. * Determines whether the specified code point is a "graphic" character
  331. * (printable, excluding spaces).
  332. *
  333. * @param (int|string) $cp - The codepoint to introspect
  334. * @return bool - Whether or not the codepoint has this property
  335. */
  336. <<__Native,__IsFoldable>> static
  337. public function isgraph(mixed $cp): mixed;
  338. /**
  339. * Determines whether the specified code point is a "blank" or
  340. * "horizontal space", a character that visibly separates words on a line.
  341. *
  342. * @param (int|string) $cp - The codepoint to introspect
  343. * @return bool - Whether or not the codepoint has this property
  344. */
  345. <<__Native,__IsFoldable>> static
  346. public function isblank(mixed $cp): mixed;
  347. /**
  348. * Determines whether the specified code point is "defined",
  349. * which usually means that it is assigned a character.
  350. *
  351. * @param (int|string) $cp - The codepoint to introspect
  352. * @return bool - Whether or not the codepoint has this property
  353. */
  354. <<__Native,__IsFoldable>> static
  355. public function isdefined(mixed $cp): mixed;
  356. /**
  357. * Determines if the specified character is a space character or not.
  358. *
  359. * @param (int|string) $cp - The codepoint to introspect
  360. * @return bool - Whether or not the codepoint has this property
  361. */
  362. <<__Native,__IsFoldable>> static
  363. public function isspace(mixed $cp): mixed;
  364. /**
  365. * Determine if the specified code point is a space character
  366. * according to Java.
  367. *
  368. * @param (int|string) $cp - The codepoint to introspect
  369. * @return bool - Whether or not the codepoint has this property
  370. */
  371. <<__Native,__IsFoldable>> static
  372. public function isJavaSpaceChar(mixed $cp): mixed;
  373. /**
  374. * Determines if the specified code point is a whitespace character
  375. * according to Java/ICU.
  376. *
  377. * @param (int|string) $cp - The codepoint to introspect
  378. * @return bool - Whether or not the codepoint has this property
  379. */
  380. <<__Native,__IsFoldable>> static
  381. public function isWhitespace(mixed $cp): mixed;
  382. /**
  383. * Determines whether the specified code point is a control character
  384. * (as defined by this function).
  385. *
  386. * @param (int|string) $cp - The codepoint to introspect
  387. * @return bool - Whether or not the codepoint has this property
  388. */
  389. <<__Native,__IsFoldable>> static
  390. public function iscntrl(mixed $cp): mixed;
  391. /**
  392. * Determines whether the specified code point is an ISO control code.
  393. *
  394. * @param (int|string) $cp - The codepoint to introspect
  395. * @return bool - Whether or not the codepoint has this property
  396. */
  397. <<__Native,__IsFoldable>> static
  398. public function isISOControl(mixed $cp): mixed;
  399. /**
  400. * Determines whether the specified code point is a printable character.
  401. *
  402. * @param (int|string) $cp - The codepoint to introspect
  403. * @return bool - Whether or not the codepoint has this property
  404. */
  405. <<__Native,__IsFoldable>> static
  406. public function isprint(mixed $cp): mixed;
  407. /**
  408. * Determines whether the specified code point is a base character.
  409. *
  410. * @param (int|string) $cp - The codepoint to introspect
  411. * @return bool - Whether or not the codepoint has this property
  412. */
  413. <<__Native,__IsFoldable>> static
  414. public function isbase(mixed $cp): mixed;
  415. /**
  416. * Determines whether the code point has the Bidi_Mirrored property.
  417. *
  418. * @param (int|string) $cp - The codepoint to introspect
  419. * @return bool - Whether or not the codepoint has this property
  420. */
  421. <<__Native,__IsFoldable>> static
  422. public function isMirrored(mixed $cp): mixed;
  423. /**
  424. * Determines if the specified character is permissible as the
  425. * first character in an identifier according to Unicode
  426. * (The Unicode Standard, Version 3.0, chapter 5.16 Identifiers).
  427. *
  428. * @param (int|string) $cp - The codepoint to introspect
  429. * @return bool - Whether or not the codepoint has this property
  430. */
  431. <<__Native,__IsFoldable>> static
  432. public function isIDStart(mixed $cp): mixed;
  433. /**
  434. * Determines if the specified character is permissible
  435. * in an identifier according to Java.
  436. *
  437. * @param (int|string) $cp - The codepoint to introspect
  438. * @return bool - Whether or not the codepoint has this property
  439. */
  440. <<__Native,__IsFoldable>> static
  441. public function isIDPart(mixed $cp): mixed;
  442. /**
  443. * Determines if the specified character should be regarded as an
  444. * ignorable character in an identifier, according to Java.
  445. *
  446. * @param (int|string) $cp - The codepoint to introspect
  447. * @return bool - Whether or not the codepoint has this property
  448. */
  449. <<__Native,__IsFoldable>> static
  450. public function isIDIgnorable(mixed $cp): mixed;
  451. /**
  452. * Determines if the specified character is permissible as the
  453. * first character in a Java identifier.
  454. *
  455. * @param (int|string) $cp - The codepoint to introspect
  456. * @return bool - Whether or not the codepoint has this property
  457. */
  458. <<__Native,__IsFoldable>> static
  459. public function isJavaIDStart(mixed $cp): mixed;
  460. /**
  461. * Determines if the specified character is permissible in a Java identifier.
  462. *
  463. * @param (int|string) $cp - The codepoint to introspect
  464. * @return bool - Whether or not the codepoint has this property
  465. */
  466. <<__Native,__IsFoldable>> static
  467. public function isJavaIDPart(mixed $cp): mixed;
  468. /**
  469. * Returns the bidirectional category value for the code point,
  470. * which is used in the Unicode bidirectional algorithm
  471. * (UAX #9 http://www.unicode.org/reports/tr9/).
  472. *
  473. * @param (int|string) $cp - The codepoint to introspect
  474. * @return int - Character directionality, i.e. IntlChar::LEFT_TO_RIGHT
  475. */
  476. <<__Native,__IsFoldable>> static
  477. public function charDirection(mixed $cp): mixed;
  478. /**
  479. * Returns the general category value for the code point.
  480. *
  481. * @param (int|string) $cp - The codepoint to introspect
  482. * @return int - The general category value for the code point.
  483. */
  484. <<__Native,__IsFoldable>> static
  485. public function charType(mixed $cp): mixed;
  486. /**
  487. * Returns the combining class of the code point.
  488. *
  489. * @param (int|string) $cp - The codepoint to introspect
  490. * @return int - The combining class
  491. */
  492. <<__Native,__IsFoldable>> static
  493. public function getCombiningClass(mixed $cp): mixed;
  494. /**
  495. * Returns the decimal digit value of a decimal digit character
  496. *
  497. * @param (int|string) $cp - The codepoint to introspect
  498. * @return int - Character's digit value
  499. */
  500. <<__Native,__IsFoldable>> static
  501. public function charDigitValue(mixed $cp): mixed;
  502. /**
  503. * Maps the specified character to its paired bracket character.
  504. *
  505. * @param (int|string) $cp - The codepoint to introspect
  506. * @return (int|string) - Paired bracket character
  507. * As a UTF-8 sequence if a UTF-8 sequence was provided,
  508. * as an integer otherwise.
  509. *
  510. * @require ICU >= 52
  511. */
  512. <<__Native,__IsFoldable>> static
  513. public function getBidiPairedBracket(mixed $cp): mixed;
  514. /**
  515. * Maps the specified character to a "mirror-image" character.
  516. *
  517. * @param (int|string) $cp - The codepoint to introspect
  518. * @return (int|string) - The resulting codepoint
  519. * As a UTF-8 sequence if a UTF-8 sequence was provided,
  520. * as an integer otherwise.
  521. */
  522. <<__Native,__IsFoldable>> static
  523. public function charMirror(mixed $cp): mixed;
  524. /**
  525. * The given character is mapped to its lowercase equivalent
  526. * according to UnicodeData.txt; if the character has
  527. * no lowercase equivalent, the character itself is returned.
  528. *
  529. * @param (int|string) $cp - The codepoint to introspect
  530. * @return (int|string) - The resulting codepoint
  531. * As a UTF-8 sequence if a UTF-8 sequence was provided,
  532. * as an integer otherwise.
  533. */
  534. <<__Native,__IsFoldable>> static
  535. public function tolower(mixed $cp): mixed;
  536. /**
  537. * The given character is mapped to its uppercase equivalent
  538. * according to UnicodeData.txt; if the character has
  539. * no uppercase equivalent, the character itself is returned.
  540. *
  541. * @param (int|string) $cp - The codepoint to introspect
  542. * @return (int|string) - The resulting codepoint
  543. * As a UTF-8 sequence if a UTF-8 sequence was provided,
  544. * as an integer otherwise.
  545. */
  546. <<__Native,__IsFoldable>> static
  547. public function toupper(mixed $cp): mixed;
  548. /**
  549. * The given character is mapped to its titlecase equivalent
  550. * according to UnicodeData.txt; if none is defined,
  551. * the character itself is returned.
  552. *
  553. * @param (int|string) $cp - The codepoint to introspect
  554. * @return (int|string) - The resulting codepoint
  555. * As a UTF-8 sequence if a UTF-8 sequence was provided,
  556. * as an integer otherwise.
  557. */
  558. <<__Native,__IsFoldable>> static
  559. public function totitle(mixed $cp): mixed;
  560. }