| 1 | <?php |
||
| 9 | final class SecureConnectionOptions |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var float |
||
| 13 | */ |
||
| 14 | private $timeout = 10; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | private $method; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var array |
||
| 23 | */ |
||
| 24 | private $contextOptions = []; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param int $method |
||
| 28 | * @param int $timeout |
||
| 29 | * @param array $contextOptions |
||
| 30 | */ |
||
| 31 | public function __construct(int $method, int $timeout = 10, array $contextOptions = []) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param float $connectionTimeout |
||
| 40 | * @return SecureConnectionOptions |
||
| 41 | */ |
||
| 42 | public function withTimeout(float $connectionTimeout): self |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param int $method |
||
| 51 | * @return SecureConnectionOptions |
||
| 52 | */ |
||
| 53 | public function withMethod(int $method): self |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param array $contextOptions |
||
| 62 | * @return SecureConnectionOptions |
||
| 63 | */ |
||
| 64 | public function withContextOptions(array $contextOptions): self |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return float |
||
| 73 | */ |
||
| 74 | public function getTimeout(): float |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @return int |
||
| 81 | */ |
||
| 82 | public function getMethod(): int |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @return array |
||
| 89 | */ |
||
| 90 | public function getContextOptions(): array |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @return resource |
||
| 97 | */ |
||
| 98 | public function createContext() |
||
| 107 | } |
||
| 108 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.