Skip to content

Commit 64bb866

Browse files
authored
Merge pull request #162 from Kharhamel/filter_has_var
Filter has var
2 parents 22f63e2 + b632c54 commit 64bb866

File tree

8 files changed

+57
-98
lines changed

8 files changed

+57
-98
lines changed

generated/filesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ function fwrite($handle, string $string, int $length = null): int
953953
*
954954
*
955955
*
956-
* * - Matches zero of more characters.
956+
* * - Matches zero or more characters.
957957
*
958958
*
959959
*

generated/filter.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,6 @@
44

55
use Safe\Exceptions\FilterException;
66

7-
/**
8-
*
9-
*
10-
* @param int $type One of INPUT_GET, INPUT_POST,
11-
* INPUT_COOKIE, INPUT_SERVER, or
12-
* INPUT_ENV.
13-
* @param string $variable_name Name of a variable to check.
14-
* @throws FilterException
15-
*
16-
*/
17-
function filter_has_var(int $type, string $variable_name): void
18-
{
19-
error_clear_last();
20-
$result = \filter_has_var($type, $variable_name);
21-
if ($result === false) {
22-
throw FilterException::createFromPhpError();
23-
}
24-
}
25-
26-
277
/**
288
* This function is useful for retrieving many values without
299
* repetitively calling filter_input.

generated/functionsList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@
173173
'tmpfile',
174174
'touch',
175175
'unlink',
176-
'filter_has_var',
177176
'filter_input_array',
178177
'filter_var_array',
179178
'fastcgi_finish_request',
@@ -370,7 +369,6 @@
370369
'imap_undelete',
371370
'imap_unsubscribe',
372371
'imap_utf8_to_mutf7',
373-
'assert_options',
374372
'cli_set_process_title',
375373
'dl',
376374
'getlastmod',
@@ -486,6 +484,7 @@
486484
'mb_parse_str',
487485
'mb_regex_encoding',
488486
'mb_send_mail',
487+
'mb_split',
489488
'define',
490489
'highlight_file',
491490
'highlight_string',
@@ -1017,6 +1016,7 @@
10171016
'md5_file',
10181017
'metaphone',
10191018
'sha1_file',
1019+
'soundex',
10201020
'sprintf',
10211021
'substr',
10221022
'vsprintf',

generated/info.php

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,6 @@
44

55
use Safe\Exceptions\InfoException;
66

7-
/**
8-
* Set the various assert control options or just query
9-
* their current settings.
10-
*
11-
* @param int $what
12-
* Assert Options
13-
*
14-
*
15-
*
16-
* Option
17-
* INI Setting
18-
* Default value
19-
* Description
20-
*
21-
*
22-
*
23-
*
24-
* ASSERT_ACTIVE
25-
* assert.active
26-
* 1
27-
* enable assert evaluation
28-
*
29-
*
30-
* ASSERT_WARNING
31-
* assert.warning
32-
* 1
33-
* issue a PHP warning for each failed assertion
34-
*
35-
*
36-
* ASSERT_BAIL
37-
* assert.bail
38-
* 0
39-
* terminate execution on failed assertions
40-
*
41-
*
42-
* ASSERT_QUIET_EVAL
43-
* assert.quiet_eval
44-
* 0
45-
*
46-
* disable error_reporting during assertion expression
47-
* evaluation
48-
*
49-
*
50-
*
51-
* ASSERT_CALLBACK
52-
* assert.callback
53-
* (NULL)
54-
* Callback to call on failed assertions
55-
*
56-
*
57-
*
58-
*
59-
* @param mixed $value An optional new value for the option.
60-
* @return mixed Returns the original setting of any options.
61-
* @throws InfoException
62-
*
63-
*/
64-
function assert_options(int $what, $value = null)
65-
{
66-
error_clear_last();
67-
if ($value !== null) {
68-
$result = \assert_options($what, $value);
69-
} else {
70-
$result = \assert_options($what);
71-
}
72-
if ($result === false) {
73-
throw InfoException::createFromPhpError();
74-
}
75-
return $result;
76-
}
77-
78-
797
/**
808
* Sets the process title visible in tools such as top and
819
* ps. This function is available only in

generated/mbstring.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,3 +472,24 @@ function mb_send_mail(string $to, string $subject, string $message, string $addi
472472
throw MbstringException::createFromPhpError();
473473
}
474474
}
475+
476+
477+
/**
478+
*
479+
*
480+
* @param string $pattern The regular expression pattern.
481+
* @param string $string The string being split.
482+
* @param int $limit
483+
* @return array The result as an array.
484+
* @throws MbstringException
485+
*
486+
*/
487+
function mb_split(string $pattern, string $string, int $limit = -1): array
488+
{
489+
error_clear_last();
490+
$result = \mb_split($pattern, $string, $limit);
491+
if ($result === false) {
492+
throw MbstringException::createFromPhpError();
493+
}
494+
return $result;
495+
}

generated/strings.php

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,35 @@ function sha1_file(string $filename, bool $raw_output = false): string
144144
}
145145

146146

147+
/**
148+
* Calculates the soundex key of str.
149+
*
150+
* Soundex keys have the property that words pronounced similarly
151+
* produce the same soundex key, and can thus be used to simplify
152+
* searches in databases where you know the pronunciation but not
153+
* the spelling. This soundex function returns a string 4 characters
154+
* long, starting with a letter.
155+
*
156+
* This particular soundex function is one described by Donald Knuth
157+
* in "The Art Of Computer Programming, vol. 3: Sorting And
158+
* Searching", Addison-Wesley (1973), pp. 391-392.
159+
*
160+
* @param string $str The input string.
161+
* @return string Returns the soundex key as a string.
162+
* @throws StringsException
163+
*
164+
*/
165+
function soundex(string $str): string
166+
{
167+
error_clear_last();
168+
$result = \soundex($str);
169+
if ($result === false) {
170+
throw StringsException::createFromPhpError();
171+
}
172+
return $result;
173+
}
174+
175+
147176
/**
148177
* Returns a string produced according to the formatting string
149178
* format.
@@ -451,7 +480,7 @@ function sprintf(string $format, ...$params): string
451480
* Returns the portion of string specified by the
452481
* start and length parameters.
453482
*
454-
* @param string $string The input string. Must be one character or longer.
483+
* @param string $string The input string.
455484
* @param int $start If start is non-negative, the returned string
456485
* will start at the start'th position in
457486
* string, counting from zero. For instance,

generator/config/ignoredFunctions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
'forward_static_call_array',
1717
'readdir', //the documentation is false: the function return false at the end of the iteration
1818
'apcu_delete', //apcu_delete returns false when the $key does not exist in the cache store
19+
'filter_has_var', //this function is meant to return true or false
1920
];

rector-migrate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ services:
175175
tmpfile: 'Safe\tmpfile'
176176
touch: 'Safe\touch'
177177
unlink: 'Safe\unlink'
178-
filter_has_var: 'Safe\filter_has_var'
179178
filter_input_array: 'Safe\filter_input_array'
180179
filter_var_array: 'Safe\filter_var_array'
181180
fastcgi_finish_request: 'Safe\fastcgi_finish_request'
@@ -372,7 +371,6 @@ services:
372371
imap_undelete: 'Safe\imap_undelete'
373372
imap_unsubscribe: 'Safe\imap_unsubscribe'
374373
imap_utf8_to_mutf7: 'Safe\imap_utf8_to_mutf7'
375-
assert_options: 'Safe\assert_options'
376374
cli_set_process_title: 'Safe\cli_set_process_title'
377375
dl: 'Safe\dl'
378376
getlastmod: 'Safe\getlastmod'
@@ -488,6 +486,7 @@ services:
488486
mb_parse_str: 'Safe\mb_parse_str'
489487
mb_regex_encoding: 'Safe\mb_regex_encoding'
490488
mb_send_mail: 'Safe\mb_send_mail'
489+
mb_split: 'Safe\mb_split'
491490
define: 'Safe\define'
492491
highlight_file: 'Safe\highlight_file'
493492
highlight_string: 'Safe\highlight_string'
@@ -1019,6 +1018,7 @@ services:
10191018
md5_file: 'Safe\md5_file'
10201019
metaphone: 'Safe\metaphone'
10211020
sha1_file: 'Safe\sha1_file'
1021+
soundex: 'Safe\soundex'
10221022
sprintf: 'Safe\sprintf'
10231023
substr: 'Safe\substr'
10241024
vsprintf: 'Safe\vsprintf'

0 commit comments

Comments
 (0)