Skip to content

Commit 8be40b3

Browse files
authored
Merge pull request #209 from localheinz/fix/rector
Fix: Drop support for unsupported versions of rector/rector
2 parents 353974c + 34aca07 commit 8be40b3

File tree

18 files changed

+80
-1212
lines changed

18 files changed

+80
-1212
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,10 @@ jobs:
8989
echo "Generated files are different from commited files. Please run './safe.php generate' command and commit the results."
9090
exit 1;
9191
fi
92-
- name: "Check if refactoring can be done with rector/rector:~0.5.0"
93-
run: "composer install && composer rector && composer test"
94-
working-directory: "generator/tests/rector/0.5"
9592
96-
- name: "Check if refactoring can be done with rector/rector:~0.6.0"
93+
- name: "Check if refactoring can be done with rector/rector:~0.7.0"
9794
run: "composer install && composer rector && composer test"
98-
working-directory: "generator/tests/rector/0.6"
95+
working-directory: "generator/tests/rector/0.7"
9996

10097
- name: "Archive code coverage results"
10198
uses: "actions/upload-artifact@v1"

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
/generator/doc/entities/generated.ent
55
/composer.lock
66
vendor/
7-
/generator/tests/rector/0.5/composer.lock
8-
/generator/tests/rector/0.6/composer.lock
7+
/generator/tests/rector/0.7/composer.lock
98
.phpunit.result.cache

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,22 @@ find these functions but changing the namespace of the functions one function at
112112
Fortunately, Safe comes bundled with a "Rector" configuration file. [Rector](https://github.com/rectorphp/rector) is a command-line
113113
tool that performs instant refactoring of your application.
114114
115-
First, you need to install Rector:
115+
Run
116116
117117
```bash
118-
$ composer require --dev rector/rector ^0.6
118+
$ composer require --dev rector/rector:^0.7
119119
```
120120

121-
Now, you simply need to run Rector with this command:
121+
to install `rector/rector`.
122+
123+
Run
122124

123125
```bash
124-
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate-0.6.yml
126+
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate-0.7.yml
125127
```
126128

129+
to run `rector/rector`.
130+
127131
*Note:* do not forget to replace "src/" with the path to your source directory.
128132

129133
**Important:** the refactoring only performs a "dumb" replacement of functions. It will not modify the way

generated/curl.php

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,14 @@ function curl_multi_init()
16561656
* CURL_SSLVERSION_TLSv1_0 (4),
16571657
* CURL_SSLVERSION_TLSv1_1 (5) or
16581658
* CURL_SSLVERSION_TLSv1_2 (6).
1659+
* The maximum TLS version can be set by using one of the CURL_SSLVERSION_MAX_*
1660+
* constants. It is also possible to OR one of the CURL_SSLVERSION_*
1661+
* constants with one of the CURL_SSLVERSION_MAX_* constants.
1662+
* CURL_SSLVERSION_MAX_DEFAULT (the maximum version supported by the library),
1663+
* CURL_SSLVERSION_MAX_TLSv1_0,
1664+
* CURL_SSLVERSION_MAX_TLSv1_1,
1665+
* CURL_SSLVERSION_MAX_TLSv1_2, or
1666+
* CURL_SSLVERSION_MAX_TLSv1_3.
16591667
*
16601668
*
16611669
* Your best bet is to not set this and let it use the default.
@@ -1715,7 +1723,7 @@ function curl_multi_init()
17151723
* CURL_SSLVERSION_TLSv1_3,
17161724
* CURL_SSLVERSION_MAX_DEFAULT,
17171725
* CURL_SSLVERSION_MAX_TLSv1_0,
1718-
* CURL_SSLVERSION_MAX_TLSv1_2,
1726+
* CURL_SSLVERSION_MAX_TLSv1_1,
17191727
* CURL_SSLVERSION_MAX_TLSv1_2,
17201728
* CURL_SSLVERSION_MAX_TLSv1_3 or
17211729
* CURL_SSLVERSION_SSLv3.
@@ -1740,6 +1748,42 @@ function curl_multi_init()
17401748
*
17411749
*
17421750
*
1751+
* CURLOPT_TCP_KEEPALIVE
1752+
*
1753+
* If set to 1, TCP keepalive probes will be sent. The delay and
1754+
* frequency of these probes can be controlled by the CURLOPT_TCP_KEEPIDLE
1755+
* and CURLOPT_TCP_KEEPINTVL options, provided the operating system
1756+
* supports them. If set to 0 (default) keepalive probes are disabled.
1757+
*
1758+
*
1759+
* Added in cURL 7.25.0. Available since PHP 5.5.0.
1760+
*
1761+
*
1762+
*
1763+
* CURLOPT_TCP_KEEPIDLE
1764+
*
1765+
* Sets the delay, in seconds, that the operating system will wait while the connection is
1766+
* idle before sending keepalive probes, if CURLOPT_TCP_KEEPALIVE is
1767+
* enabled. Not all operating systems support this option.
1768+
* The default is 60.
1769+
*
1770+
*
1771+
* Added in cURL 7.25.0. Available since PHP 5.5.0.
1772+
*
1773+
*
1774+
*
1775+
* CURLOPT_TCP_KEEPINTVL
1776+
*
1777+
* Sets the interval, in seconds, that the operating system will wait between sending
1778+
* keepalive probes, if CURLOPT_TCP_KEEPALIVE is enabled.
1779+
* Not all operating systems support this option.
1780+
* The default is 60.
1781+
*
1782+
*
1783+
* Added in cURL 7.25.0. Available since PHP 5.5.0.
1784+
*
1785+
*
1786+
*
17431787
* CURLOPT_TIMECONDITION
17441788
*
17451789
* How CURLOPT_TIMEVALUE is treated.
@@ -2016,6 +2060,20 @@ function curl_multi_init()
20162060
*
20172061
*
20182062
*
2063+
* CURLOPT_COOKIELIST
2064+
*
2065+
* A cookie string (i.e. a single line in Netscape/Mozilla format, or a regular
2066+
* HTTP-style Set-Cookie header) adds that single cookie to the internal cookie store.
2067+
* "ALL" erases all cookies held in memory.
2068+
* "SESS" erases all session cookies held in memory.
2069+
* "FLUSH" writes all known cookies to the file specified by CURLOPT_COOKIEJAR.
2070+
* "RELOAD" loads all cookies from the files specified by CURLOPT_COOKIEFILE.
2071+
*
2072+
*
2073+
* Available since PHP 5.5.0 and cURL 7.14.1.
2074+
*
2075+
*
2076+
*
20192077
* CURLOPT_CUSTOMREQUEST
20202078
*
20212079
* A custom request method to use instead of
@@ -2541,6 +2599,8 @@ function curl_multi_init()
25412599
* The format of the certificate. Supported formats are
25422600
* "PEM" (default), "DER",
25432601
* and "ENG".
2602+
* As of OpenSSL 0.9.3, "P12" (for PKCS#12-encoded files)
2603+
* is also supported.
25442604
*
25452605
*
25462606
* Added in cURL 7.9.3.

generated/mysql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function mysql_create_db(string $database_name, $link_identifier = null): void
132132
* row_number should be a value in the range from 0 to
133133
* mysql_num_rows - 1. However if the result set
134134
* is empty (mysql_num_rows == 0), a seek to 0 will
135-
* fail with a E_WARNING and
135+
* fail with an E_WARNING and
136136
* mysql_data_seek will return FALSE.
137137
*
138138
* @param resource $result The result resource that

generated/openssl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function openssl_csr_export($csr, ?string &$out, bool $notext = true): void
8484
* array - if shortnames is TRUE (the default) then
8585
* fields will be indexed with the short name form, otherwise, the long name
8686
* form will be used - e.g.: CN is the shortname form of commonName.
87-
* @return array Returns TRUE on success.
87+
* @return array Returns an associative array with subject description.
8888
* @throws OpensslException
8989
*
9090
*/

generator/src/FileCreator.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,40 +81,13 @@ public function generateFunctionsList(array $functions, string $path): void
8181
fclose($stream);
8282
}
8383

84-
/**
85-
* @deprecated Official support for rector/rector:~0.5 is not advertised anymore.
86-
*
87-
* This function generate a rector yml file containing a replacer for all functions
88-
*
89-
* @param Method[] $functions
90-
* @param string $path
91-
*/
92-
public function generateRectorFile(array $functions, string $path): void
93-
{
94-
$functionNames = $this->getFunctionsNameList($functions);
95-
$stream = fopen($path, 'w');
96-
if ($stream === false) {
97-
throw new \RuntimeException('Unable to write to '.$path);
98-
}
99-
fwrite($stream, "# This rector file is replacing all core PHP functions with the equivalent \"safe\" functions
100-
# It is targetting Rector 0.5.x versions.
101-
# If you are using Rector 0.4, please upgrade your Rector version
102-
services:
103-
Rector\Renaming\Rector\Function_\RenameFunctionRector:
104-
");
105-
foreach ($functionNames as $functionName) {
106-
fwrite($stream, ' '.$functionName.": 'Safe\\".$functionName."'\n");
107-
}
108-
fclose($stream);
109-
}
110-
11184
/**
11285
* Generates a configuration file for replacing all functions when using rector/rector:~0.6.
11386
*
11487
* @param Method[] $functions
11588
* @param string $path
11689
*/
117-
public function generateRectorFileForZeroPointSix(array $functions, string $path): void
90+
public function generateRectorFileForZeroPointSeven(array $functions, string $path): void
11891
{
11992
$functionNames = $this->getFunctionsNameList($functions);
12093

@@ -125,7 +98,7 @@ public function generateRectorFileForZeroPointSix(array $functions, string $path
12598
}
12699

127100
$header = <<<'TXT'
128-
# This file configures rector/rector:~0.6.0 to replace all PHP functions with their equivalent "safe" functions
101+
# This file configures rector/rector:~0.7.0 to replace all PHP functions with their equivalent "safe" functions
129102
130103
services:
131104
Rector\Renaming\Rector\Function_\RenameFunctionRector:

generator/src/GenerateCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
3737
$fileCreator = new FileCreator();
3838
$fileCreator->generatePhpFile($functions, __DIR__ . '/../../generated/');
3939
$fileCreator->generateFunctionsList($functions, __DIR__ . '/../../generated/functionsList.php');
40-
$fileCreator->generateRectorFile($functions, __DIR__ . '/../../rector-migrate.yml');
41-
$fileCreator->generateRectorFileForZeroPointSix($functions, __DIR__ . '/../../rector-migrate-0.6.yml');
40+
$fileCreator->generateRectorFileForZeroPointSeven($functions, __DIR__ . '/../../rector-migrate-0.7.yml');
4241

4342

4443
$modules = [];

generator/tests/rector/0.5/composer.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

generator/tests/rector/0.5/phpunit.xml.dist

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)