ffi.stub.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /** @generate-class-entries */
  3. namespace {
  4. /** @not-serializable */
  5. final class FFI
  6. {
  7. public static function cdef(string $code = "", ?string $lib = null): FFI {}
  8. public static function load(string $filename): ?FFI {}
  9. public static function scope(string $name): FFI {}
  10. public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): ?FFI\CData {}
  11. /** @prefer-ref $ptr */
  12. public static function free(FFI\CData $ptr): void {}
  13. /**
  14. * @param FFI\CData|int|float|bool|null $ptr
  15. * @prefer-ref $ptr
  16. */
  17. public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {}
  18. public static function type(string $type): ?FFI\CType {}
  19. /** @prefer-ref $ptr */
  20. public static function typeof(FFI\CData $ptr): FFI\CType {}
  21. public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
  22. /** @prefer-ref $ptr */
  23. public static function addr(FFI\CData $ptr): FFI\CData {}
  24. /** @prefer-ref $ptr */
  25. public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
  26. /** @prefer-ref $ptr */
  27. public static function alignof(FFI\CData|FFI\CType $ptr): int {}
  28. /**
  29. * @param FFI\CData|string $from
  30. * @prefer-ref $to
  31. * @prefer-ref $from
  32. */
  33. public static function memcpy(FFI\CData $to, $from, int $size): void {}
  34. /**
  35. * @prefer-ref $ptr1
  36. * @param string|FFI\CData $ptr1
  37. * @prefer-ref $ptr2
  38. * @param string|FFI\CData $ptr2
  39. */
  40. public static function memcmp($ptr1, $ptr2, int $size): int {}
  41. /** @prefer-ref $ptr */
  42. public static function memset(FFI\CData $ptr, int $value, int $size): void {}
  43. /** @prefer-ref $ptr */
  44. public static function string(FFI\CData $ptr, ?int $size = null): string {}
  45. /** @prefer-ref $ptr */
  46. public static function isNull(FFI\CData $ptr): bool {}
  47. }
  48. }
  49. namespace FFI {
  50. /** @not-serializable */
  51. final class CData {
  52. }
  53. /** @not-serializable */
  54. final class CType {
  55. public function getName(): string {}
  56. public function getKind(): int {}
  57. public function getSize(): int {}
  58. public function getAlignment(): int {}
  59. public function getAttributes(): int {}
  60. public function getEnumKind(): int {}
  61. public function getArrayElementType(): CType {}
  62. public function getArrayLength(): int {}
  63. public function getPointerType(): CType {}
  64. public function getStructFieldNames(): array {}
  65. public function getStructFieldOffset(string $name): int {}
  66. public function getStructFieldType(string $name): CType {}
  67. public function getFuncABI(): int {}
  68. public function getFuncReturnType(): CType {}
  69. public function getFuncParameterCount(): int {}
  70. public function getFuncParameterType(int $index): CType {}
  71. }
  72. class Exception extends \Error {
  73. }
  74. final class ParserException extends Exception {
  75. }
  76. }