Skip to content

Commit fb85355

Browse files
committed
Add stubs for internal status functions
1 parent a378098 commit fb85355

File tree

5 files changed

+146
-86
lines changed

5 files changed

+146
-86
lines changed

docs/DOCS.txt

+49-59
Original file line numberDiff line numberDiff line change
@@ -2186,6 +2186,55 @@ void git_stash_pop(resource $repo,int $index,?array $stash_apply_options)
21862186

21872187
string git_stash_save(resource $repo,resource $signature,string $message,int $flags)
21882188

2189+
----------------------------------------
2190+
[git_status]
2191+
----------------------------------------
2192+
2193+
array git_status_byindex(resource $statuslist,int $idx)
2194+
2195+
** The return array has the following structure: **
2196+
2197+
array(3) {
2198+
["status"]
2199+
["head_to_index"]
2200+
// git_diff_delta array
2201+
["index_to_workdir"]
2202+
// git_diff_delta array
2203+
}
2204+
2205+
Returns a git_status_entry array
2206+
2207+
?int|bool git_status_file(resource $repo,string $path)
2208+
2209+
The function returns:
2210+
2211+
- int: if the path was successfully found, the return value is an
2212+
integer bitmask containing the status flags
2213+
- null: the path was ambiguous
2214+
- false: the path was not found
2215+
2216+
void git_status_foreach(resource $repo,callable $callback,mixed $payload)
2217+
2218+
Callback signature: void callback(string $path,int $status_flag,mixed $payload)
2219+
2220+
The function should throw on error.
2221+
2222+
void git_status_foreach_ext(resource $repo,?array $status_options,callable $callback,mixed $payload)
2223+
2224+
See notes on git_status_foreach() for callback signature.
2225+
2226+
int git_status_list_entrycount(resource $statuslist)
2227+
2228+
void git_status_list_free(resource $statuslist)
2229+
2230+
array git_status_list_get_perfdata(resource $statuslist)
2231+
2232+
resource git_status_list_new(resource $repo,?array $status_options)
2233+
2234+
Returns git_status_list resource
2235+
2236+
bool git_status_should_ignore(resource $repo,string $path)
2237+
21892238
----------------------------------------
21902239
[git_tree]
21912240
[git_tree_entry]
@@ -2403,65 +2452,6 @@ git_trace_set(int)
24032452
** NOTE: this function uses the standard PHP error log to write traces. This
24042453
only works if your libgit2 was built with tracing enabled. **
24052454

2406-
----------------------------------------
2407-
[git_status]
2408-
----------------------------------------
2409-
2410-
git_status_byindex(resource,int)
2411-
2412-
** The return array has the following structure: **
2413-
2414-
array(3) {
2415-
["status"]
2416-
["head_to_index"]
2417-
// git_diff_delta array
2418-
["index_to_workdir"]
2419-
// git_diff_delta array
2420-
}
2421-
2422-
Returns array
2423-
2424-
git_status_file(resource,string)
2425-
2426-
The function returns:
2427-
2428-
- int: if the path was successfully found, the return value is an
2429-
integer bitmask containing the status flags
2430-
- null: the path was ambiguous
2431-
- false: the path was not found
2432-
2433-
Returns mixed
2434-
2435-
git_status_foreach(resource,callable,mixed)
2436-
2437-
Callback signature: void callback(string $path,int $status_flag,mixed $payload)
2438-
2439-
The function should throw on error.
2440-
2441-
git_status_foreach_ext(resource,array,callable,mixed)
2442-
2443-
See notes on git_status_foreach() for callback signature.
2444-
2445-
git_status_list_entrycount(resource)
2446-
2447-
Returns int
2448-
2449-
git_status_list_free(resource)
2450-
2451-
git_status_list_get_perfdata(resource)
2452-
2453-
Returns array
2454-
2455-
git_status_list_new(resource,array|null)
2456-
2457-
** Note: The options array is optional. **
2458-
2459-
Returns resource
2460-
2461-
git_status_should_ignore(resource,string)
2462-
2463-
Returns bool
2464-
24652455
----------------------------------------
24662456
[git_submodule]
24672457
----------------------------------------

status.h

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
#ifndef PHPGIT2_STATUS_H
88
#define PHPGIT2_STATUS_H
9+
910
#include "diff.h"
11+
#include "stubs/status_arginfo.h"
1012

1113
namespace php_git2
1214
{

stubs/status.stub.php

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/**
4+
* @param resource $statuslist
5+
*/
6+
function git_status_byindex($statuslist,int $idx) : array {}
7+
8+
/**
9+
* @param resource $repo
10+
*/
11+
function git_status_file($repo,string $path) : int|bool|null {}
12+
13+
/**
14+
* @param resource $repo
15+
*/
16+
function git_status_foreach($repo,callable $callback,mixed $payload) : void {}
17+
18+
/**
19+
* @param resource $repo
20+
*/
21+
function git_status_foreach_ext($repo,?array $status_options,callable $callback,mixed $payload) : void {}
22+
23+
/**
24+
* @param resource $statuslist
25+
*/
26+
function git_status_list_entrycount($statuslist) : int {}
27+
28+
/**
29+
* @param resource $statuslist
30+
*/
31+
function git_status_list_free($statuslist) : void {}
32+
33+
/**
34+
* @param resource $statuslist
35+
*/
36+
function git_status_list_get_perfdata($statuslist) : array {}
37+
38+
/**
39+
* @param resource $repo
40+
*
41+
* @return resource
42+
*/
43+
function git_status_list_new($repo,?array $status_options) {}
44+
45+
/**
46+
* @param resource $repo
47+
*/
48+
function git_status_should_ignore($repo,string $path) : bool {}

stubs/status_arginfo.h

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: b4368c1ca85b02de91b0b62811f361edfef99c68 */
3+
4+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_status_byindex, 0, 2, IS_ARRAY, 0)
5+
ZEND_ARG_INFO(0, statuslist)
6+
ZEND_ARG_TYPE_INFO(0, idx, IS_LONG, 0)
7+
ZEND_END_ARG_INFO()
8+
9+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_git_status_file, 0, 2, MAY_BE_LONG|MAY_BE_BOOL|MAY_BE_NULL)
10+
ZEND_ARG_INFO(0, repo)
11+
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
12+
ZEND_END_ARG_INFO()
13+
14+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_status_foreach, 0, 3, IS_VOID, 0)
15+
ZEND_ARG_INFO(0, repo)
16+
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
17+
ZEND_ARG_TYPE_INFO(0, payload, IS_MIXED, 0)
18+
ZEND_END_ARG_INFO()
19+
20+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_status_foreach_ext, 0, 4, IS_VOID, 0)
21+
ZEND_ARG_INFO(0, repo)
22+
ZEND_ARG_TYPE_INFO(0, status_options, IS_ARRAY, 1)
23+
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
24+
ZEND_ARG_TYPE_INFO(0, payload, IS_MIXED, 0)
25+
ZEND_END_ARG_INFO()
26+
27+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_status_list_entrycount, 0, 1, IS_LONG, 0)
28+
ZEND_ARG_INFO(0, statuslist)
29+
ZEND_END_ARG_INFO()
30+
31+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_status_list_free, 0, 1, IS_VOID, 0)
32+
ZEND_ARG_INFO(0, statuslist)
33+
ZEND_END_ARG_INFO()
34+
35+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_status_list_get_perfdata, 0, 1, IS_ARRAY, 0)
36+
ZEND_ARG_INFO(0, statuslist)
37+
ZEND_END_ARG_INFO()
38+
39+
ZEND_BEGIN_ARG_INFO_EX(arginfo_git_status_list_new, 0, 0, 2)
40+
ZEND_ARG_INFO(0, repo)
41+
ZEND_ARG_TYPE_INFO(0, status_options, IS_ARRAY, 1)
42+
ZEND_END_ARG_INFO()
43+
44+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_status_should_ignore, 0, 2, _IS_BOOL, 0)
45+
ZEND_ARG_INFO(0, repo)
46+
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
47+
ZEND_END_ARG_INFO()

stubs/tmp.h

-27
Original file line numberDiff line numberDiff line change
@@ -160,33 +160,6 @@ ZEND_END_ARG_INFO()
160160
ZEND_BEGIN_ARG_INFO(arginfo_git_trace_set,{})
161161
ZEND_END_ARG_INFO()
162162

163-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_byindex,{})
164-
ZEND_END_ARG_INFO()
165-
166-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_file,{})
167-
ZEND_END_ARG_INFO()
168-
169-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_foreach,{})
170-
ZEND_END_ARG_INFO()
171-
172-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_foreach_ext,{})
173-
ZEND_END_ARG_INFO()
174-
175-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_list_entrycount,{})
176-
ZEND_END_ARG_INFO()
177-
178-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_list_free,{})
179-
ZEND_END_ARG_INFO()
180-
181-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_list_get_perfdata,{})
182-
ZEND_END_ARG_INFO()
183-
184-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_list_new,{})
185-
ZEND_END_ARG_INFO()
186-
187-
ZEND_BEGIN_ARG_INFO(arginfo_git_status_should_ignore,{})
188-
ZEND_END_ARG_INFO()
189-
190163
ZEND_BEGIN_ARG_INFO(arginfo_git_submodule_add_finalize,{})
191164
ZEND_END_ARG_INFO()
192165

0 commit comments

Comments
 (0)