-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpstan-bootstrap.php
50 lines (44 loc) · 2.1 KB
/
phpstan-bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
// Simulate WP_User class
if (!class_exists('WP_User')) {
class WP_User {
public int $ID = 1;
}
}
// Basic WordPress function mocks for static analysis with PHPStan.
function add_action(...$args) {}
function add_menu_page(...$args) {}
function current_user_can(...$args) { return true; }
function get_users(...$args) { return []; }
function get_user_meta(...$args) { return ''; }
function get_user_by(...$args) { return false; }
function update_user_meta(...$args) {}
function delete_user_meta(...$args) {}
function wp_get_current_user() { return new WP_User(); }
function wp_delete_user(...$args) {}
function check_admin_referer(...$args) {}
function wp_nonce_field(...$args) {}
function is_plugin_active(...$args) { return false; }
function current_time(...$args) { return time(); }
function get_plugin_data(...$args) { return []; }
function plugin_dir_path(...$args) { return __DIR__; }
function plugin_dir_url(...$args) { return 'http://example.com/'; }
function plugins_url(...$args) { return 'http://example.com/'; }
function admin_url(...$args) { return 'http://example.com/wp-admin/'; }
function esc_html($string) { return $string; }
function esc_html__($string, $domain = 'default') { return $string; }
function esc_html_e($string, $domain = 'default') { echo $string; }
function esc_attr($string) { return $string; }
function esc_attr_e($string, $domain = 'default') { echo $string; }
function esc_url($string) { return $string; }
function esc_url_raw($string) { return $string; }
function wp_kses($string, $allowed_html = [], $allowed_protocols = []) { return $string; }
function wp_kses_post($string) { return $string; }
function wp_die($message = '', $title = '') { die($message); }
function __($string, $domain = 'default') { return $string; }
function _e($string, $domain = 'default') { echo $string; }
function sanitize_email($email) { return $email; }
function sanitize_text_field($text) { return $text; }
function sanitize_textarea_field($text) { return $text; }
function sanitize_user($username) { return $username; }
function is_email($email) { return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); }