session.stub.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. /** @generate-class-entries */
  3. /** @refcount 1 */
  4. function session_name(?string $name = null): string|false {}
  5. /** @refcount 1 */
  6. function session_module_name(?string $module = null): string|false {}
  7. /** @refcount 1 */
  8. function session_save_path(?string $path = null): string|false {}
  9. function session_id(?string $id = null): string|false {}
  10. /** @refcount 1 */
  11. function session_create_id(string $prefix = ""): string|false {}
  12. function session_regenerate_id(bool $delete_old_session = false): bool {}
  13. function session_decode(string $data): bool {}
  14. /** @refcount 1 */
  15. function session_encode(): string|false {}
  16. function session_destroy(): bool {}
  17. function session_unset(): bool {}
  18. function session_gc(): int|false {}
  19. /**
  20. * @return array<string, mixed>
  21. * @refcount 1
  22. */
  23. function session_get_cookie_params(): array {}
  24. function session_write_close(): bool {}
  25. function session_abort(): bool {}
  26. function session_reset(): bool {}
  27. function session_status(): int {}
  28. function session_register_shutdown(): void {}
  29. /** @alias session_write_close */
  30. function session_commit(): bool {}
  31. /**
  32. * @param callable|object $open
  33. * @param callable|bool $close
  34. */
  35. function session_set_save_handler(
  36. $open,
  37. $close = UNKNOWN,
  38. callable $read = UNKNOWN,
  39. callable $write = UNKNOWN,
  40. callable $destroy = UNKNOWN,
  41. callable $gc = UNKNOWN,
  42. callable $create_sid = UNKNOWN,
  43. callable $validate_sid = UNKNOWN,
  44. callable $update_timestamp = UNKNOWN
  45. ): bool {}
  46. /** @refcount 1 */
  47. function session_cache_limiter(?string $value = null): string|false {}
  48. function session_cache_expire(?int $value = null): int|false {}
  49. function session_set_cookie_params(array|int $lifetime_or_options, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httponly = null): bool {}
  50. function session_start(array $options = []): bool {}
  51. interface SessionHandlerInterface
  52. {
  53. /** @tentative-return-type */
  54. public function open(string $path, string $name): bool;
  55. /** @tentative-return-type */
  56. public function close(): bool;
  57. /** @tentative-return-type */
  58. public function read(string $id): string|false;
  59. /** @tentative-return-type */
  60. public function write(string $id, string $data): bool;
  61. /** @tentative-return-type */
  62. public function destroy(string $id): bool;
  63. /** @tentative-return-type */
  64. public function gc(int $max_lifetime): int|false;
  65. }
  66. interface SessionIdInterface
  67. {
  68. /** @tentative-return-type */
  69. public function create_sid(): string;
  70. }
  71. interface SessionUpdateTimestampHandlerInterface
  72. {
  73. /** @tentative-return-type */
  74. public function validateId(string $id): bool;
  75. /** @tentative-return-type */
  76. public function updateTimestamp(string $id, string $data): bool;
  77. }
  78. class SessionHandler implements SessionHandlerInterface, SessionIdInterface
  79. {
  80. /** @tentative-return-type */
  81. public function open(string $path, string $name): bool {}
  82. /** @tentative-return-type */
  83. public function close(): bool {}
  84. /** @tentative-return-type */
  85. public function read(string $id): string|false {}
  86. /** @tentative-return-type */
  87. public function write(string $id, string $data): bool {}
  88. /** @tentative-return-type */
  89. public function destroy(string $id): bool {}
  90. /** @tentative-return-type */
  91. public function gc(int $max_lifetime): int|false {}
  92. /** @tentative-return-type */
  93. public function create_sid(): string {}
  94. }