Skip to content

Commit 488e107

Browse files
committed
Ignore functions which were removed pre-8.1
If we're only supporting php8.1+, we don't need to support functions which stopped existing in 7.X
1 parent 4922460 commit 488e107

File tree

8 files changed

+5
-141
lines changed

8 files changed

+5
-141
lines changed

generated/funchand.php

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

55
use Safe\Exceptions\FunchandException;
66

7-
/**
8-
* Creates a function dynamically from the parameters passed, and returns a unique name for it.
9-
*
10-
* @param string $args The function arguments, as a single comma-separated string.
11-
* @param string $code The function code.
12-
* @return string Returns a unique function name as a string.
13-
* Note that the name contains a non-printable character ("\0"),
14-
* so care should be taken when printing the name or incorporating it in any other
15-
* string.
16-
* @throws FunchandException
17-
*
18-
*/
19-
function create_function(string $args, string $code): string
20-
{
21-
error_clear_last();
22-
$safeResult = \create_function($args, $code);
23-
if ($safeResult === false) {
24-
throw FunchandException::createFromPhpError();
25-
}
26-
return $safeResult;
27-
}
28-
29-
307
/**
318
*
329
*

generated/functionsList.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
'com_print_typeinfo',
3535
'convert_uudecode',
3636
'copy',
37-
'create_function',
3837
'cubrid_bind',
3938
'cubrid_column_names',
4039
'cubrid_column_types',
@@ -256,7 +255,6 @@
256255
'gzencode',
257256
'gzfile',
258257
'gzgets',
259-
'gzgetss',
260258
'gzinflate',
261259
'gzopen',
262260
'gzread',
@@ -295,7 +293,6 @@
295293
'iconv_get_encoding',
296294
'iconv_set_encoding',
297295
'idate',
298-
'image2wbmp',
299296
'imageaffine',
300297
'imageaffinematrixconcat',
301298
'imageaffinematrixget',
@@ -432,7 +429,6 @@
432429
'inotify_rm_watch',
433430
'iptcembed',
434431
'iptcparse',
435-
'jpeg2wbmp',
436432
'json_decode',
437433
'json_encode',
438434
'lchgrp',
@@ -711,7 +707,6 @@
711707
'pg_trace',
712708
'pg_update',
713709
'php_sapi_name',
714-
'png2wbmp',
715710
'posix_access',
716711
'posix_eaccess',
717712
'posix_getgrgid',

generated/image.php

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -98,36 +98,6 @@ function image_type_to_extension(int $image_type, bool $include_dot = true): str
9898
}
9999

100100

101-
/**
102-
* image2wbmp outputs or save a WBMP
103-
* version of the given image.
104-
*
105-
* @param resource $image An image resource, returned by one of the image creation functions,
106-
* such as imagecreatetruecolor.
107-
* @param string|null $filename Path to the saved file. If not given, the raw image stream will be
108-
* output directly.
109-
* @param int $foreground You can set the foreground color with this parameter by setting an
110-
* identifier obtained from imagecolorallocate.
111-
* The default foreground color is black.
112-
* @throws ImageException
113-
*
114-
*/
115-
function image2wbmp($image, ?string $filename = null, ?int $foreground = null): void
116-
{
117-
error_clear_last();
118-
if ($foreground !== null) {
119-
$safeResult = \image2wbmp($image, $filename, $foreground);
120-
} elseif ($filename !== null) {
121-
$safeResult = \image2wbmp($image, $filename);
122-
} else {
123-
$safeResult = \image2wbmp($image);
124-
}
125-
if ($safeResult === false) {
126-
throw ImageException::createFromPhpError();
127-
}
128-
}
129-
130-
131101
/**
132102
*
133103
*
@@ -2904,45 +2874,3 @@ function iptcparse(string $iptc_block): array
29042874
}
29052875
return $safeResult;
29062876
}
2907-
2908-
2909-
/**
2910-
* Converts a JPEG file into a WBMP file.
2911-
*
2912-
* @param string $jpegname Path to JPEG file.
2913-
* @param string $wbmpname Path to destination WBMP file.
2914-
* @param int $dest_height Destination image height.
2915-
* @param int $dest_width Destination image width.
2916-
* @param int $threshold Threshold value, between 0 and 8 (inclusive).
2917-
* @throws ImageException
2918-
*
2919-
*/
2920-
function jpeg2wbmp(string $jpegname, string $wbmpname, int $dest_height, int $dest_width, int $threshold): void
2921-
{
2922-
error_clear_last();
2923-
$safeResult = \jpeg2wbmp($jpegname, $wbmpname, $dest_height, $dest_width, $threshold);
2924-
if ($safeResult === false) {
2925-
throw ImageException::createFromPhpError();
2926-
}
2927-
}
2928-
2929-
2930-
/**
2931-
* Converts a PNG file into a WBMP file.
2932-
*
2933-
* @param string $pngname Path to PNG file.
2934-
* @param string $wbmpname Path to destination WBMP file.
2935-
* @param int $dest_height Destination image height.
2936-
* @param int $dest_width Destination image width.
2937-
* @param int $threshold Threshold value, between 0 and 8 (inclusive).
2938-
* @throws ImageException
2939-
*
2940-
*/
2941-
function png2wbmp(string $pngname, string $wbmpname, int $dest_height, int $dest_width, int $threshold): void
2942-
{
2943-
error_clear_last();
2944-
$safeResult = \png2wbmp($pngname, $wbmpname, $dest_height, $dest_width, $threshold);
2945-
if ($safeResult === false) {
2946-
throw ImageException::createFromPhpError();
2947-
}
2948-
}

generated/zlib.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -313,35 +313,6 @@ function gzgets($stream, ?int $length = null): string
313313
}
314314

315315

316-
/**
317-
* Identical to gzgets, except that
318-
* gzgetss attempts to strip any HTML and PHP
319-
* tags from the text it reads.
320-
*
321-
* @param resource $zp The gz-file pointer. It must be valid, and must point to a file
322-
* successfully opened by gzopen.
323-
* @param int $length The length of data to get.
324-
* @param string $allowable_tags You can use this optional parameter to specify tags which should not
325-
* be stripped.
326-
* @return string The uncompressed and stripped string.
327-
* @throws ZlibException
328-
*
329-
*/
330-
function gzgetss($zp, int $length, ?string $allowable_tags = null): string
331-
{
332-
error_clear_last();
333-
if ($allowable_tags !== null) {
334-
$safeResult = \gzgetss($zp, $length, $allowable_tags);
335-
} else {
336-
$safeResult = \gzgetss($zp, $length);
337-
}
338-
if ($safeResult === false) {
339-
throw ZlibException::createFromPhpError();
340-
}
341-
return $safeResult;
342-
}
343-
344-
345316
/**
346317
* This function inflates a deflated string.
347318
*

generator/src/DocPage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ private function getIsDeprecated(string $file): bool
1919
if (preg_match('/&warn\.deprecated\.function-(\d+-\d+-\d+)\.removed-(\d+-\d+-\d+)/', $file, $matches)) {
2020
$removedVersion = $matches[2];
2121
[$major, $minor] = explode('-', $removedVersion);
22-
if ($major < 7 || ($major == 7 && $minor == 0)) {
22+
if ($major < 8 || ($major == 8 && $minor == 0)) {
2323
return true;
2424
}
2525
}
2626

2727
if (preg_match('/&warn\.removed\.function-(\d+-\d+-\d+)/', $file, $matches)) {
2828
$removedVersion = $matches[1];
2929
[$major, $minor] = explode('-', $removedVersion);
30-
if ($major < 7 || ($major == 7 && $minor == 0)) {
30+
if ($major < 8 || ($major == 8 && $minor == 0)) {
3131
return true;
3232
}
3333
}

generator/src/Method.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function getParams(): array
7272
if (preg_match('/This parameter has been removed in PHP (\d+\.\d+\.\d+)/', $notes, $matches)) {
7373
$removedVersion = $matches[1];
7474
[$major, $minor] = explode('.', $removedVersion);
75-
if ($major < 7 || ($major == 7 && $minor == 0)) {
76-
// Ignore parameter if it was removed before PHP 7.1
75+
if ($major < 8 || ($major == 8 && $minor == 0)) {
76+
// Ignore parameter if it was removed before PHP 8.1
7777
continue;
7878
}
7979
}
@@ -136,7 +136,7 @@ private function stripReturnFalseText(string $string): string
136136
$string = $this->removeString($string, ' and NULL on failure');
137137
$string = $this->removeString($string, ' or NULL on failure');
138138
break;
139-
139+
140140
case self::FALSY_TYPE:
141141
$string = $this->removeString($string, 'or FALSE on failure');
142142
$string = $this->removeString($string, ', FALSE on failure');

generator/tests/DocPageTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public function testDetectFalsyFunction(): void
1515
$getCwd = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/dir/functions/getcwd.xml');
1616
$createFromFormat = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/datetime/datetime/createfromformat.xml');
1717
$filesize = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/filesystem/functions/filesize.xml');
18-
$mcryptDecrypt = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/mcrypt/functions/mcrypt-decrypt.xml');
1918
$fsockopen = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/network/functions/fsockopen.xml');
2019
$arrayReplace = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/array/functions/array-replace.xml');
2120
$classImplement = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/spl/functions/class-implements.xml');
@@ -28,7 +27,6 @@ public function testDetectFalsyFunction(): void
2827
$this->assertTrue($getCwd->detectFalsyFunction());
2928
$this->assertTrue($createFromFormat->detectFalsyFunction());
3029
$this->assertTrue($filesize->detectFalsyFunction());
31-
$this->assertTrue($mcryptDecrypt->detectFalsyFunction());
3230
$this->assertTrue($fsockopen->detectFalsyFunction());
3331
$this->assertFalse($arrayReplace->detectFalsyFunction());
3432
$this->assertTrue($classImplement->detectFalsyFunction());

rector-migrate.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
'com_print_typeinfo' => 'Safe\com_print_typeinfo',
4242
'convert_uudecode' => 'Safe\convert_uudecode',
4343
'copy' => 'Safe\copy',
44-
'create_function' => 'Safe\create_function',
4544
'cubrid_bind' => 'Safe\cubrid_bind',
4645
'cubrid_column_names' => 'Safe\cubrid_column_names',
4746
'cubrid_column_types' => 'Safe\cubrid_column_types',
@@ -263,7 +262,6 @@
263262
'gzencode' => 'Safe\gzencode',
264263
'gzfile' => 'Safe\gzfile',
265264
'gzgets' => 'Safe\gzgets',
266-
'gzgetss' => 'Safe\gzgetss',
267265
'gzinflate' => 'Safe\gzinflate',
268266
'gzopen' => 'Safe\gzopen',
269267
'gzread' => 'Safe\gzread',
@@ -302,7 +300,6 @@
302300
'iconv_get_encoding' => 'Safe\iconv_get_encoding',
303301
'iconv_set_encoding' => 'Safe\iconv_set_encoding',
304302
'idate' => 'Safe\idate',
305-
'image2wbmp' => 'Safe\image2wbmp',
306303
'imageaffine' => 'Safe\imageaffine',
307304
'imageaffinematrixconcat' => 'Safe\imageaffinematrixconcat',
308305
'imageaffinematrixget' => 'Safe\imageaffinematrixget',
@@ -439,7 +436,6 @@
439436
'inotify_rm_watch' => 'Safe\inotify_rm_watch',
440437
'iptcembed' => 'Safe\iptcembed',
441438
'iptcparse' => 'Safe\iptcparse',
442-
'jpeg2wbmp' => 'Safe\jpeg2wbmp',
443439
'json_decode' => 'Safe\json_decode',
444440
'json_encode' => 'Safe\json_encode',
445441
'lchgrp' => 'Safe\lchgrp',
@@ -718,7 +714,6 @@
718714
'pg_trace' => 'Safe\pg_trace',
719715
'pg_update' => 'Safe\pg_update',
720716
'php_sapi_name' => 'Safe\php_sapi_name',
721-
'png2wbmp' => 'Safe\png2wbmp',
722717
'posix_access' => 'Safe\posix_access',
723718
'posix_eaccess' => 'Safe\posix_eaccess',
724719
'posix_getgrgid' => 'Safe\posix_getgrgid',

0 commit comments

Comments
 (0)