xref: /php-ast/ast.stub.php (revision fec004c2)
1<?php
2
3/** @generate-function-entries */
4
5/**
6 * ========================================================================================
7 * | USE ast_stub.php INSTEAD IF YOU ARE LOOKING FOR DOCUMENTATION OR STUBS FOR YOUR IDE. |
8 * ========================================================================================
9 *
10 * This is a stub file meant only for use with https://github.com/php/php-src/blob/master/build/gen_stub.php
11 * to generate Reflection information (ReflectionParameter, ReflectionFunction, ReflectionMethod, etc.)
12 */
13
14namespace ast;
15
16// XXX: @param in doc comments will cause build/gen_stub.php to emit an error if there is already a real type in the latest php versions.
17// Use ast_stub.php instead for documentation.
18
19function parse_code(string $code, int $version, string $filename = 'string code'): \ast\Node {}
20
21function parse_file(string $filename, int $version): \ast\Node {}
22
23function get_kind_name(int $kind): string {}
24
25function kind_uses_flags(int $kind): bool {}
26
27function get_metadata(): array {}
28
29function get_supported_versions(bool $exclude_deprecated = false): array {}
30
31// In php 8.2+, ast\Node implements the attribute AllowDynamicProperties
32/**
33 * This class describes a single node in a PHP AST.
34 */
35#[\AllowDynamicProperties]
36class Node
37{
38    public function __construct(?int $kind = null, ?int $flags = null, ?array $children = null, ?int $lineno = null) {
39    }
40}
41
42