mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
ff19ec2df3
Userland classes that implement Traversable must do so either through Iterator or IteratorAggregate. The same requirement does not exist for internal classes: They can implement the internal get_iterator mechanism, without exposing either the Iterator or IteratorAggregate APIs. This makes them usable in get_iterator(), but incompatible with any Iterator based APIs. A lot of internal classes do this, because exposing the userland APIs is simply a lot of work. This patch alleviates this issue by providing a generic InternalIterator class, which acts as an adapater between get_iterator and Iterator, and can be easily used by many internal classes. At the same time, we extend the requirement that Traversable implies Iterator or IteratorAggregate to internal classes as well. Closes GH-5216.
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
/** @generate-function-entries */
|
|
|
|
class ResourceBundle implements IteratorAggregate, Countable
|
|
{
|
|
public function __construct(?string $locale, ?string $bundlename, bool $fallback = true) {}
|
|
|
|
/**
|
|
* @return ResourceBundle|null
|
|
* @alias resourcebundle_create
|
|
*/
|
|
public static function create(?string $locale, ?string $bundlename, bool $fallback = true) {}
|
|
|
|
/**
|
|
* @param string|int $index
|
|
* @return mixed
|
|
* @alias resourcebundle_get
|
|
*/
|
|
public function get($index, bool $fallback = true) {}
|
|
|
|
/**
|
|
* @return int
|
|
* @alias resourcebundle_count
|
|
*/
|
|
public function count() {}
|
|
|
|
/**
|
|
* @return array|false
|
|
* @alias resourcebundle_locales
|
|
*/
|
|
public static function getLocales(string $bundlename) {}
|
|
|
|
/**
|
|
* @return int
|
|
* @alias resourcebundle_get_error_code
|
|
*/
|
|
public function getErrorCode() {}
|
|
|
|
/**
|
|
* @return string
|
|
* @alias resourcebundle_get_error_message
|
|
*/
|
|
public function getErrorMessage() {}
|
|
|
|
public function getIterator(): Iterator {}
|
|
}
|