WyriHaximus /
reactphp-child-process-messenger
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace WyriHaximus\React\ChildProcess\Messenger\ChildProcess; |
||
| 6 | |||
| 7 | use function base64_encode; |
||
| 8 | use function Safe\base64_decode; |
||
| 9 | use function Safe\json_decode; |
||
| 10 | use function Safe\json_encode; |
||
| 11 | |||
| 12 | final class ArgvEncoder |
||
| 13 | { |
||
| 14 | public static function encode(Options $options): string |
||
| 15 | { |
||
| 16 | return base64_encode(json_encode($options->toArray())); |
||
| 17 | } |
||
| 18 | |||
| 19 | public static function decode(string $argv): Options |
||
| 20 | { |
||
| 21 | return new Options(...json_decode(base64_decode($argv, true))); |
||
|
0 ignored issues
–
show
|
|||
| 22 | } |
||
| 23 | } |
||
| 24 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.