Skip to content

Commit a378098

Browse files
committed
Add stubs for stash internal functions
1 parent 5211eeb commit a378098

File tree

5 files changed

+95
-47
lines changed

5 files changed

+95
-47
lines changed

docs/DOCS.txt

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,6 +2148,44 @@ array git2_signature_convert(resource $signature)
21482148
- when.time
21492149
- when.offset
21502150

2151+
----------------------------------------
2152+
[git_stash]
2153+
----------------------------------------
2154+
2155+
Stash apply options callback signature:
2156+
2157+
void callback(int $progress,mixed $payload)
2158+
2159+
The callback should return false to abort the stash.
2160+
2161+
The callback should throw on error.
2162+
2163+
void git_stash_apply(resource $repo,int $index,?array $stash_apply_options)
2164+
2165+
Parameter $stash_apply_options is an associative array corresponding to
2166+
git_stash_apply_options. Options are defaulted using
2167+
git_stash_apply_options_init().
2168+
2169+
void git_stash_drop(resource $repo,int $index)
2170+
2171+
void git_stash_foreach(resource $repo,callable $callback,mixed $payload)
2172+
2173+
Callback signature:
2174+
2175+
void callback(int $index,string $message,string $stash_id,mixed $payload)
2176+
2177+
The callback should return false to stop iteration.
2178+
2179+
The callback should throw on error.
2180+
2181+
void git_stash_pop(resource $repo,int $index,?array $stash_apply_options)
2182+
2183+
Parameter $stash_apply_options is an associative array corresponding to
2184+
git_stash_apply_options. Options are defaulted using
2185+
git_stash_apply_options_init().
2186+
2187+
string git_stash_save(resource $repo,resource $signature,string $message,int $flags)
2188+
21512189
----------------------------------------
21522190
[git_tree]
21532191
[git_tree_entry]
@@ -2424,38 +2462,6 @@ git_status_should_ignore(resource,string)
24242462

24252463
Returns bool
24262464

2427-
----------------------------------------
2428-
[git_stash]
2429-
----------------------------------------
2430-
2431-
Stash apply options callback signature:
2432-
2433-
void callback(int $progress,mixed $payload)
2434-
2435-
The callback should return false to abort the stash.
2436-
2437-
The callback should throw on error.
2438-
2439-
git_stash_apply(resource,int,array|null)
2440-
2441-
git_stash_drop(resource,int)
2442-
2443-
git_stash_foreach(resource,callable,mixed)
2444-
2445-
Callback signature:
2446-
2447-
void callback(int $index,string $message,string $stash_id,mixed $payload)
2448-
2449-
The callback should return false to stop iteration.
2450-
2451-
The callback should throw on error.
2452-
2453-
git_stash_pop(resource,int,array|null)
2454-
2455-
git_stash_save(resource,resource,string,int)
2456-
2457-
Returns int
2458-
24592465
----------------------------------------
24602466
[git_submodule]
24612467
----------------------------------------

stash.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
#ifndef PHPGIT2_STASH_H
88
#define PHPGIT2_STASH_H
9+
910
#include "checkout.h"
11+
#include "stubs/stash_arginfo.h"
1012

1113
namespace php_git2
1214
{

stubs/stash.stub.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/**
4+
* @param resource $repo
5+
*/
6+
function git_stash_apply($repo,int $index,?array $stash_apply_options) : void {}
7+
8+
/**
9+
* @param resource $repo
10+
*/
11+
function git_stash_drop($repo,int $index) : void {}
12+
13+
/**
14+
* @param resource $repo
15+
*/
16+
function git_stash_foreach($repo,callable $callback,mixed $payload) : void {}
17+
18+
/**
19+
* @param resource $repo
20+
*/
21+
function git_stash_pop($repo,int $index,?array $stash_apply_options) : void {}
22+
23+
/**
24+
* @param resource $repo
25+
* @param resource $signature
26+
*/
27+
function git_stash_save($repo,$signature,string $message,int $flags) : string {}

stubs/stash_arginfo.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* This is a generated file, edit the .stub.php file instead.
2+
* Stub hash: 98fe1134ec5fe34e45d88c6bd270a427ecf82d98 */
3+
4+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_stash_apply, 0, 3, IS_VOID, 0)
5+
ZEND_ARG_INFO(0, repo)
6+
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
7+
ZEND_ARG_TYPE_INFO(0, stash_apply_options, IS_ARRAY, 1)
8+
ZEND_END_ARG_INFO()
9+
10+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_stash_drop, 0, 2, IS_VOID, 0)
11+
ZEND_ARG_INFO(0, repo)
12+
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
13+
ZEND_END_ARG_INFO()
14+
15+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_stash_foreach, 0, 3, IS_VOID, 0)
16+
ZEND_ARG_INFO(0, repo)
17+
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
18+
ZEND_ARG_TYPE_INFO(0, payload, IS_MIXED, 0)
19+
ZEND_END_ARG_INFO()
20+
21+
#define arginfo_git_stash_pop arginfo_git_stash_apply
22+
23+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_git_stash_save, 0, 4, IS_STRING, 0)
24+
ZEND_ARG_INFO(0, repo)
25+
ZEND_ARG_INFO(0, signature)
26+
ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
27+
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
28+
ZEND_END_ARG_INFO()

stubs/tmp.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -187,21 +187,6 @@ ZEND_END_ARG_INFO()
187187
ZEND_BEGIN_ARG_INFO(arginfo_git_status_should_ignore,{})
188188
ZEND_END_ARG_INFO()
189189

190-
ZEND_BEGIN_ARG_INFO(arginfo_git_stash_apply,{})
191-
ZEND_END_ARG_INFO()
192-
193-
ZEND_BEGIN_ARG_INFO(arginfo_git_stash_drop,{})
194-
ZEND_END_ARG_INFO()
195-
196-
ZEND_BEGIN_ARG_INFO(arginfo_git_stash_foreach,{})
197-
ZEND_END_ARG_INFO()
198-
199-
ZEND_BEGIN_ARG_INFO(arginfo_git_stash_pop,{})
200-
ZEND_END_ARG_INFO()
201-
202-
ZEND_BEGIN_ARG_INFO(arginfo_git_stash_save,{})
203-
ZEND_END_ARG_INFO()
204-
205190
ZEND_BEGIN_ARG_INFO(arginfo_git_submodule_add_finalize,{})
206191
ZEND_END_ARG_INFO()
207192

0 commit comments

Comments
 (0)