Skip to content

Commit 657cb45

Browse files
committed
Declare tentative return types for ext/fileinfo
Relates to GH-6985
1 parent 737af24 commit 657cb45

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

ext/fileinfo/fileinfo.stub.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@ public function __construct(int $flags = FILEINFO_NONE, ?string $magic_database
99

1010
/**
1111
* @param resource|null $context
12-
* @return string|false
12+
* @tentative-return-type
1313
* @alias finfo_file
1414
*/
15-
public function file(string $filename, int $flags = FILEINFO_NONE, $context = null) {}
15+
public function file(string $filename, int $flags = FILEINFO_NONE, $context = null): string|false {}
1616

1717
/**
1818
* @param resource|null $context
19-
* @return string|false
19+
* @tentative-return-type
2020
* @alias finfo_buffer
2121
*/
22-
public function buffer(string $string, int $flags = FILEINFO_NONE, $context = null) {}
22+
public function buffer(string $string, int $flags = FILEINFO_NONE, $context = null): string|false {}
2323

2424
/**
2525
* @return bool
2626
* @alias finfo_set_flags
2727
*/
28-
public function set_flags(int $flags) {}
28+
public function set_flags(int $flags) {} // TODO make return type void
2929
}
3030

3131
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null): finfo|false {}
3232

3333
function finfo_close(finfo $finfo): bool {}
3434

35-
function finfo_set_flags(finfo $finfo, int $flags): bool {}
35+
function finfo_set_flags(finfo $finfo, int $flags): bool {} // TODO make return type void
3636

3737
/**
3838
* @param resource|null $context

ext/fileinfo/fileinfo_arginfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 2cd166d444d7324a9fe70170db434c05ccfbf386 */
2+
* Stub hash: 933465e008723d0991761b5779a80e5c72248a9c */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_finfo_open, 0, 0, finfo, MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
@@ -38,13 +38,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo___construct, 0, 0, 0)
3838
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, magic_database, IS_STRING, 1, "null")
3939
ZEND_END_ARG_INFO()
4040

41-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_file, 0, 0, 1)
41+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_finfo_file, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
4242
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
4343
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
4444
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
4545
ZEND_END_ARG_INFO()
4646

47-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_buffer, 0, 0, 1)
47+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_finfo_buffer, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
4848
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
4949
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "FILEINFO_NONE")
5050
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")

0 commit comments

Comments
 (0)