You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next to the test case, there is `/Fixture` directory. It contains many test fixture files that verified the Rector rule work correctly in all possible cases.
54
+
55
+
There are 2 fixture formats:
56
+
57
+
A. `test_fixture.php.inc` - The Code Should Change
58
+
59
+
```php
60
+
<codebefore>
61
+
-----
62
+
<codeafter>'
63
+
```
64
+
65
+
B. `skip_rule_test_fixture.php.inc` - The Code Should Be Skipped
66
+
67
+
```php
68
+
<codebefore>
69
+
```
70
+
71
+
## Rules
72
+
73
+
### Public Key Loader
74
+
75
+
This rule is for `v2` -> `v3` upgrade.
76
+
77
+
This rule helps to load unencrypted and encrypted public / private keys.
78
+
79
+
In `v2``loadKey()` returns true on success and false on failure. `v2` only supports RSA keys and `$rsa` is *not* immutable.
80
+
And in `v3``PublicKeyLoader` returns an immutable instance of either `\phpseclib3\Crypt\Common\PublicKey` or
81
+
`\phpseclib3\Crypt\Common\PrivateKey`. An exception is thrown on failure.
82
+
83
+
It replaces
84
+
```php
85
+
use phpseclib\Crypt\RSA;
86
+
87
+
$rsa = new RSA();
88
+
$rsa->loadKey('...');
89
+
```
90
+
with
91
+
92
+
```php
93
+
use phpseclib3\Crypt\PublicKeyLoader;
94
+
95
+
$rsa = PublicKeyLoader::load('...');
96
+
```
97
+
98
+
When `setPassword` is used, `$rsa->setPassword('password');` will be replaced with `$rsa = PublicKeyLoader::load('...', $password);`.
0 commit comments