Skip to content

Commit

Permalink
convert enchant resources to objects of new classes
Browse files Browse the repository at this point in the history
- EnchantBroker
- EnchantDict
add OO interface
deprecate enchant_broker_free* (use unset instead)
deprecate ENCHANT_MYSPELL and ENCHANT_ISPELL constants
  • Loading branch information
remicollet committed May 11, 2020
1 parent f987219 commit f1d23eb
Show file tree
Hide file tree
Showing 32 changed files with 618 additions and 282 deletions.
359 changes: 217 additions & 142 deletions ext/enchant/enchant.c

Large diffs are not rendered by default.

139 changes: 87 additions & 52 deletions ext/enchant/enchant.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,94 +2,129 @@

/** @generate-function-entries */

/** @return resource|false */
function enchant_broker_init() {}
final class EnchantBroker
{
/** @alias enchant_broker_init */
public function __construct() {}

/** @param resource $broker */
function enchant_broker_free($broker): bool {}
/** @alias enchant_broker_get_error */
public function getError(): string|false {}

/** @alias enchant_broker_list_dicts */
public function listDicts(): ?array {}

/** @alias enchant_broker_request_dict */
public function requestDict(string $tag): EnchantDict|false {}

/** @alias enchant_broker_request_pwl_dict */
public function requestPWL(string $filename): EnchantDict|false {}

/** @alias enchant_broker_dict_exists */
public function isDict(string $tag): bool {}

/** @alias enchant_broker_set_ordering */
public function setOrdering(string $tag, string $ordering): bool {}

/** @alias enchant_broker_describe */
public function describe(): ?array {}
}

final class EnchantDict
{
public function __construct(EnchantBroker $broker, string $tag, ?string $pwl = null) {}

/** @alias enchant_dict_quick_check */
public function checkAndSuggest(string $word, &$suggestions = null): bool {}

/** @alias enchant_dict_check */
public function check(string $word): bool {}

/** @alias enchant_dict_suggest */
public function suggest(string $word): ?array {}

/** @alias enchant_dict_add */
public function add(string $word): void {}

/** @alias enchant_dict_add_to_session */
public function addToSession(string $word): void {}

/** @alias enchant_dict_is_added */
public function isAdded(string $word): bool {}

/** @alias enchant_dict_store_replacement */
public function storeReplacement(string $mis, string $cor): void {}

/** @alias enchant_dict_get_error */
public function getError(): string|false {}

/** @alias enchant_dict_describe */
public function describe(): array {}
}

function enchant_broker_init(): EnchantBroker|false {}

/**
* @param resource $broker
* @return string|false
* @deprecated
*/
function enchant_broker_get_error($broker) {}
function enchant_broker_free(EnchantBroker $broker): bool {}

function enchant_broker_get_error(EnchantBroker $broker): string|false {}

/**
* @param resource $broker
* @deprecated
*/
function enchant_broker_set_dict_path($broker, int $name, string $value): bool {}
function enchant_broker_set_dict_path(EnchantBroker $broker, int $name, string $value): bool {}

/**
* @param resource $broker
* @deprecated
*/
function enchant_broker_get_dict_path($broker, int $name): string|false {}
function enchant_broker_get_dict_path(EnchantBroker $broker, int $name): string|false {}

/** @param resource $broker */
function enchant_broker_list_dicts($broker): ?array {}
function enchant_broker_list_dicts(EnchantBroker $broker): ?array {}

/**
* @param resource $broker
* @return resource|false
*/
function enchant_broker_request_dict($broker, string $tag) {}
function enchant_broker_request_dict(EnchantBroker $broker, string $tag): EnchantDict|false {}

/**
* @param resource $broker
* @return resource|false
*/
function enchant_broker_request_pwl_dict($broker, string $filename) {}
function enchant_broker_request_pwl_dict(EnchantBroker $broker, string $filename): EnchantDict|false {}

/** @param resource $dict */
function enchant_broker_free_dict($dict): bool {}
/**
* @deprecated
*/
function enchant_broker_free_dict(EnchantDict $dict): bool {}

/** @param resource $broker */
function enchant_broker_dict_exists($broker, string $tag): bool {}
function enchant_broker_dict_exists(EnchantBroker $broker, string $tag): bool {}

/** @param resource $broker */
function enchant_broker_set_ordering($broker, string $tag, string $ordering): bool {}
function enchant_broker_set_ordering(EnchantBroker $broker, string $tag, string $ordering): bool {}

/** @param resource $broker */
function enchant_broker_describe($broker): ?array {}
function enchant_broker_describe(EnchantBroker $broker): ?array {}

/** @param resource $dict */
function enchant_dict_quick_check($dict, string $word, &$suggestions = null): bool {}
function enchant_dict_quick_check(EnchantDict $dict, string $word, &$suggestions = null): bool {}

/** @param resource $dict */
function enchant_dict_check($dict, string $word): bool {}
function enchant_dict_check(EnchantDict $dict, string $word): bool {}

/** @param resource $dict */
function enchant_dict_suggest($dict, string $word): ?array {}
function enchant_dict_suggest(EnchantDict $dict, string $word): ?array {}

/** @param resource $dict */
function enchant_dict_add($dict, string $word): void {}
function enchant_dict_add(EnchantDict $dict, string $word): void {}

/**
* @param resource $dict
* @alias enchant_dict_add
* @deprecated
*/
function enchant_dict_add_to_personal($dict, string $word): void {}
function enchant_dict_add_to_personal(EnchantDict $dict, string $word): void {}

/** @param resource $dict */
function enchant_dict_add_to_session($dict, string $word): void {}
function enchant_dict_add_to_session(EnchantDict $dict, string $word): void {}

/** @param resource $dict */
function enchant_dict_is_added($dict, string $word): bool {}
function enchant_dict_is_added(EnchantDict $dict, string $word): bool {}

/**
* @param resource $dict
* @alias enchant_dict_is_added
* @deprecated
*/
function enchant_dict_is_in_session($dict, string $word): bool {}
function enchant_dict_is_in_session(EnchantDict $dict, string $word): bool {}

function enchant_dict_store_replacement(EnchantDict $dict, string $mis, string $cor): void {}

/** @param resource $dict */
function enchant_dict_store_replacement($dict, string $mis, string $cor): void {}
function enchant_dict_get_error(EnchantDict $dict): string|false {}

/** @param resource $dict */
function enchant_dict_get_error($dict): string|false {}
function enchant_dict_describe(EnchantDict $dict): array {}

/** @param resource $dict */
function enchant_dict_describe($dict): array {}
Loading

0 comments on commit f1d23eb

Please sign in to comment.