Skip to content

Commit 0ab4fca

Browse files
committed
Add ext\opcache stubs
1 parent d2210dc commit 0ab4fca

File tree

3 files changed

+42
-22
lines changed

3 files changed

+42
-22
lines changed

ext/opcache/opcache.stub.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
function opcache_reset(): bool {}
4+
5+
/** @return array|false */
6+
function opcache_get_status(bool $fetch_scripts = true) {}
7+
8+
function opcache_compile_file(string $file): bool {}
9+
10+
function opcache_invalidate(string $script, bool $force = false): bool {}
11+
12+
/** @return array|false */
13+
function opcache_get_configuration() {}
14+
15+
function opcache_is_script_cached(string $script): bool {}

ext/opcache/opcache_arginfo.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_reset, 0, 0, _IS_BOOL, 0)
4+
ZEND_END_ARG_INFO()
5+
6+
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_status, 0, 0, 0)
7+
ZEND_ARG_TYPE_INFO(0, fetch_scripts, _IS_BOOL, 0)
8+
ZEND_END_ARG_INFO()
9+
10+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_compile_file, 0, 1, _IS_BOOL, 0)
11+
ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
12+
ZEND_END_ARG_INFO()
13+
14+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_invalidate, 0, 1, _IS_BOOL, 0)
15+
ZEND_ARG_TYPE_INFO(0, script, IS_STRING, 0)
16+
ZEND_ARG_TYPE_INFO(0, force, _IS_BOOL, 0)
17+
ZEND_END_ARG_INFO()
18+
19+
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_configuration, 0, 0, 0)
20+
ZEND_END_ARG_INFO()
21+
22+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_is_script_cached, 0, 1, _IS_BOOL, 0)
23+
ZEND_ARG_TYPE_INFO(0, script, IS_STRING, 0)
24+
ZEND_END_ARG_INFO()

ext/opcache/zend_accelerator_module.c

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "zend_virtual_cwd.h"
3232
#include "ext/standard/info.h"
3333
#include "ext/standard/php_filestat.h"
34+
#include "opcache_arginfo.h"
3435

3536
#if HAVE_JIT
3637
#include "jit/zend_jit.h"
@@ -45,26 +46,6 @@ static zif_handler orig_file_exists = NULL;
4546
static zif_handler orig_is_file = NULL;
4647
static zif_handler orig_is_readable = NULL;
4748

48-
ZEND_BEGIN_ARG_INFO(arginfo_opcache_none, 0)
49-
ZEND_END_ARG_INFO()
50-
51-
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_status, 0, 0, 0)
52-
ZEND_ARG_INFO(0, fetch_scripts)
53-
ZEND_END_ARG_INFO()
54-
55-
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_compile_file, 0, 0, 1)
56-
ZEND_ARG_INFO(0, file)
57-
ZEND_END_ARG_INFO()
58-
59-
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_invalidate, 0, 0, 1)
60-
ZEND_ARG_INFO(0, script)
61-
ZEND_ARG_INFO(0, force)
62-
ZEND_END_ARG_INFO()
63-
64-
ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_is_script_cached, 0, 0, 1)
65-
ZEND_ARG_INFO(0, script)
66-
ZEND_END_ARG_INFO()
67-
6849
/* User functions */
6950
static ZEND_FUNCTION(opcache_reset);
7051
static ZEND_FUNCTION(opcache_invalidate);
@@ -77,12 +58,12 @@ static ZEND_FUNCTION(opcache_get_configuration);
7758

7859
static const zend_function_entry accel_functions[] = {
7960
/* User functions */
80-
ZEND_FE(opcache_reset, arginfo_opcache_none)
61+
ZEND_FE(opcache_reset, arginfo_opcache_reset)
8162
ZEND_FE(opcache_invalidate, arginfo_opcache_invalidate)
8263
ZEND_FE(opcache_compile_file, arginfo_opcache_compile_file)
8364
ZEND_FE(opcache_is_script_cached, arginfo_opcache_is_script_cached)
8465
/* Private functions */
85-
ZEND_FE(opcache_get_configuration, arginfo_opcache_none)
66+
ZEND_FE(opcache_get_configuration, arginfo_opcache_get_configuration)
8667
ZEND_FE(opcache_get_status, arginfo_opcache_get_status)
8768
ZEND_FE_END
8869
};

0 commit comments

Comments
 (0)