for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Genkgo\Mail\Protocol;
/**
* @codeCoverageIgnore
*/
final class SecureConnectionOptions
{
* @var float
private $timeout = 10;
* @var int
private $method;
* @var array
private $contextOptions = [];
* @param int $method
* @param int $timeout
* @param array $contextOptions
public function __construct(int $method, int $timeout = 10, array $contextOptions = [])
$this->method = $method;
$this->timeout = $timeout;
$timeout
double
integer
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.
$answer = 42; $correct = false; $correct = (bool) $answer;
$this->contextOptions = $contextOptions;
}
* @param float $connectionTimeout
* @return SecureConnectionOptions
public function withTimeout(float $connectionTimeout): self
$clone = clone $this;
$clone->timeout = $connectionTimeout;
return $clone;
public function withMethod(int $method): self
$clone->method = $method;
public function withContextOptions(array $contextOptions): self
$clone->contextOptions = $contextOptions;
* @return float
public function getTimeout(): float
return $this->timeout;
* @return int
public function getMethod(): int
return $this->method;
* @return array
public function getContextOptions(): array
return $this->contextOptions;
* @return resource
public function createContext()
return \stream_context_create([
'ssl' => \array_merge(
$this->contextOptions,
['crypto_method' => $this->method]
)
]);
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.