Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
php-version:
- "7.2"
- "7.3"
- "7.4"

dependencies:
- "highest"
Expand Down Expand Up @@ -96,6 +97,11 @@ jobs:
- name: "Check if refactoring can be done with rector/rector:~0.6.0"
run: "composer install && composer rector && composer test"
working-directory: "generator/tests/rector/0.6"
if: matrix.php-version != '7.4'

- name: "Check if refactoring can be done with rector/rector:~0.7.0"
run: "composer install && composer rector && composer test"
working-directory: "generator/tests/rector/0.7"

- name: "Archive code coverage results"
uses: "actions/upload-artifact@v1"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
vendor/
/generator/tests/rector/0.5/composer.lock
/generator/tests/rector/0.6/composer.lock
/generator/tests/rector/0.7/composer.lock
.phpunit.result.cache
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,22 @@ find these functions but changing the namespace of the functions one function at
Fortunately, Safe comes bundled with a "Rector" configuration file. [Rector](https://github.com/rectorphp/rector) is a command-line
tool that performs instant refactoring of your application.

First, you need to install Rector:
Run

```bash
$ composer require --dev rector/rector ^0.6
$ composer require --dev rector/rector:^0.7
```

Now, you simply need to run Rector with this command:
to install `rector/rector`.

Run

```bash
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate-0.6.yml
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate-0.7.yml
```

to run `rector/rector`.

*Note:* do not forget to replace "src/" with the path to your source directory.

**Important:** the refactoring only performs a "dumb" replacement of functions. It will not modify the way
Expand Down
66 changes: 63 additions & 3 deletions generated/curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,14 @@ function curl_multi_init()
* CURL_SSLVERSION_TLSv1_0 (4),
* CURL_SSLVERSION_TLSv1_1 (5) or
* CURL_SSLVERSION_TLSv1_2 (6).
* The maximum TLS version can be set by using one of the CURL_SSLVERSION_MAX_*
* constants. It is also possible to OR one of the CURL_SSLVERSION_*
* constants with one of the CURL_SSLVERSION_MAX_* constants.
* CURL_SSLVERSION_MAX_DEFAULT (the maximum version supported by the library),
* CURL_SSLVERSION_MAX_TLSv1_0,
* CURL_SSLVERSION_MAX_TLSv1_1,
* CURL_SSLVERSION_MAX_TLSv1_2, or
* CURL_SSLVERSION_MAX_TLSv1_3.
*
*
* Your best bet is to not set this and let it use the default.
Expand Down Expand Up @@ -1715,7 +1723,7 @@ function curl_multi_init()
* CURL_SSLVERSION_TLSv1_3,
* CURL_SSLVERSION_MAX_DEFAULT,
* CURL_SSLVERSION_MAX_TLSv1_0,
* CURL_SSLVERSION_MAX_TLSv1_2,
* CURL_SSLVERSION_MAX_TLSv1_1,
* CURL_SSLVERSION_MAX_TLSv1_2,
* CURL_SSLVERSION_MAX_TLSv1_3 or
* CURL_SSLVERSION_SSLv3.
Expand All @@ -1740,6 +1748,42 @@ function curl_multi_init()
*
*
*
* CURLOPT_TCP_KEEPALIVE
*
* If set to 1, TCP keepalive probes will be sent. The delay and
* frequency of these probes can be controlled by the CURLOPT_TCP_KEEPIDLE
* and CURLOPT_TCP_KEEPINTVL options, provided the operating system
* supports them. If set to 0 (default) keepalive probes are disabled.
*
*
* Added in cURL 7.25.0. Available since PHP 5.5.0.
*
*
*
* CURLOPT_TCP_KEEPIDLE
*
* Sets the delay, in seconds, that the operating system will wait while the connection is
* idle before sending keepalive probes, if CURLOPT_TCP_KEEPALIVE is
* enabled. Not all operating systems support this option.
* The default is 60.
*
*
* Added in cURL 7.25.0. Available since PHP 5.5.0.
*
*
*
* CURLOPT_TCP_KEEPINTVL
*
* Sets the interval, in seconds, that the operating system will wait between sending
* keepalive probes, if CURLOPT_TCP_KEEPALIVE is enabled.
* Not all operating systems support this option.
* The default is 60.
*
*
* Added in cURL 7.25.0. Available since PHP 5.5.0.
*
*
*
* CURLOPT_TIMECONDITION
*
* How CURLOPT_TIMEVALUE is treated.
Expand Down Expand Up @@ -2016,6 +2060,20 @@ function curl_multi_init()
*
*
*
* CURLOPT_COOKIELIST
*
* A cookie string (i.e. a single line in Netscape/Mozilla format, or a regular
* HTTP-style Set-Cookie header) adds that single cookie to the internal cookie store.
* "ALL" erases all cookies held in memory.
* "SESS" erases all session cookies held in memory.
* "FLUSH" writes all known cookies to the file specified by CURLOPT_COOKIEJAR.
* "RELOAD" loads all cookies from the files specified by CURLOPT_COOKIEFILE.
*
*
* Available since PHP 5.5.0 and cURL 7.14.1.
*
*
*
* CURLOPT_CUSTOMREQUEST
*
* A custom request method to use instead of
Expand Down Expand Up @@ -2541,6 +2599,8 @@ function curl_multi_init()
* The format of the certificate. Supported formats are
* "PEM" (default), "DER",
* and "ENG".
* As of OpenSSL 0.9.3, "P12" (for PKCS#12-encoded files)
* is also supported.
*
*
* Added in cURL 7.9.3.
Expand Down Expand Up @@ -3024,7 +3084,7 @@ function curl_share_errno($sh): int
*
*
*
* @param string $value
* @param mixed $value
*
*
*
Expand Down Expand Up @@ -3061,7 +3121,7 @@ function curl_share_errno($sh): int
* @throws CurlException
*
*/
function curl_share_setopt($sh, int $option, string $value): void
function curl_share_setopt($sh, int $option, $value): void
{
error_clear_last();
$result = \curl_share_setopt($sh, $option, $value);
Expand Down
4 changes: 2 additions & 2 deletions generated/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,7 @@ function imagewebp($image, $to = null, int $quality = 80): void
*
* @param resource $image An image resource, returned by one of the image creation functions,
* such as imagecreatetruecolor.
* @param string|null $filename The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.
* @param string|resource|null $filename The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.
*
* The filename (without the .xbm extension) is also
* used for the C identifiers of the XBM, whereby non
Expand All @@ -2695,7 +2695,7 @@ function imagewebp($image, $to = null, int $quality = 80): void
* @throws ImageException
*
*/
function imagexbm($image, ?string $filename = null, int $foreground = null): void
function imagexbm($image, $filename = null, int $foreground = null): void
{
error_clear_last();
if ($foreground !== null) {
Expand Down
4 changes: 2 additions & 2 deletions generated/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ function ini_get(string $varname): string
* @param string $varname Not all the available options can be changed using
* ini_set. There is a list of all available options
* in the appendix.
* @param string|int|float|bool $newvalue The new value for the option.
* @param string $newvalue The new value for the option.
* @return string Returns the old value on success, FALSE on failure.
* @throws InfoException
*
*/
function ini_set(string $varname, $newvalue): string
function ini_set(string $varname, string $newvalue): string
{
error_clear_last();
$result = \ini_set($varname, $newvalue);
Expand Down
2 changes: 1 addition & 1 deletion generated/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function mysql_create_db(string $database_name, $link_identifier = null): void
* row_number should be a value in the range from 0 to
* mysql_num_rows - 1. However if the result set
* is empty (mysql_num_rows == 0), a seek to 0 will
* fail with a E_WARNING and
* fail with an E_WARNING and
* mysql_data_seek will return FALSE.
*
* @param resource $result The result resource that
Expand Down
6 changes: 3 additions & 3 deletions generated/openssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function openssl_csr_export($csr, ?string &$out, bool $notext = true): void
* array - if shortnames is TRUE (the default) then
* fields will be indexed with the short name form, otherwise, the long name
* form will be used - e.g.: CN is the shortname form of commonName.
* @return array Returns TRUE on success.
* @return array Returns an associative array with subject description.
* @throws OpensslException
*
*/
Expand Down Expand Up @@ -942,7 +942,7 @@ function openssl_random_pseudo_bytes(int $length, ?bool &$crypto_strong = null):
*
* @param string $data The data to seal.
* @param string|null $sealed_data The sealed data.
* @param array $env_keys Array of encrypted keys.
* @param array|null $env_keys Array of encrypted keys.
* @param array $pub_key_ids Array of public key resource identifiers.
* @param string $method The cipher method.
* @param string $iv The initialization vector.
Expand All @@ -953,7 +953,7 @@ function openssl_random_pseudo_bytes(int $length, ?bool &$crypto_strong = null):
* @throws OpensslException
*
*/
function openssl_seal(string $data, ?string &$sealed_data, array &$env_keys, array $pub_key_ids, string $method = "RC4", string &$iv = null): int
function openssl_seal(string $data, ?string &$sealed_data, ?array &$env_keys, array $pub_key_ids, string $method = "RC4", string &$iv = null): int
{
error_clear_last();
$result = \openssl_seal($data, $sealed_data, $env_keys, $pub_key_ids, $method, $iv);
Expand Down
3 changes: 3 additions & 0 deletions generated/sem.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ function sem_acquire($sem_identifier, bool $nowait = false): void
* will return a different semaphore identifier, but both
* identifiers access the same underlying semaphore.
*
* If key is 0, a new private semaphore
* is created for each call to sem_get.
*
* @param int $key
* @param int $max_acquire The number of processes that can acquire the semaphore simultaneously
* is set to max_acquire.
Expand Down
2 changes: 1 addition & 1 deletion generator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"require": {
"php": "^7.2",
"ext-simplexml": "*",
"ext-json": "^1.5",
"ext-json": "*",
"symfony/console": "^4.1.4",
"symfony/process": "^4.1",
"symfony/finder": "^4.1"
Expand Down
Loading