Skip to content

Commit

Permalink
Make typed parameters explicitly nullable (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
arokettu authored Jan 13, 2025
1 parent 2eca382 commit 66e429e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Common/AbstractGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ abstract class AbstractGateway implements GatewayInterface
* @param ClientInterface $httpClient A HTTP client to make API calls with
* @param HttpRequest $httpRequest A Symfony HTTP request object
*/
public function __construct(ClientInterface $httpClient = null, HttpRequest $httpRequest = null)
public function __construct(?ClientInterface $httpClient = null, ?HttpRequest $httpRequest = null)
{
$this->httpClient = $httpClient ?: $this->getDefaultHttpClient();
$this->httpRequest = $httpRequest ?: $this->getDefaultHttpRequest();
Expand Down
2 changes: 1 addition & 1 deletion src/Common/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function addSupportedBrand($name, $expression)
* @param array $parameters An associative array of parameters
* @return $this
*/
public function initialize(array $parameters = null)
public function initialize(?array $parameters = null)
{
$this->parameters = new ParameterBag;

Expand Down
2 changes: 1 addition & 1 deletion src/Common/GatewayFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function register($className)
* @throws RuntimeException If no such gateway is found
* @return GatewayInterface An object of class $class is created and returned
*/
public function create($class, ClientInterface $httpClient = null, HttpRequest $httpRequest = null)
public function create($class, ?ClientInterface $httpClient = null, ?HttpRequest $httpRequest = null)
{
$class = Helper::getGatewayClassName($class);

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Client implements ClientInterface
*/
private $requestFactory;

public function __construct($httpClient = null, RequestFactory $requestFactory = null)
public function __construct($httpClient = null, ?RequestFactory $requestFactory = null)
{
$this->httpClient = $httpClient ?: HttpClientDiscovery::find();
$this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find();
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Item implements ItemInterface
*
* @param array|null $parameters An array of parameters to set on the new object
*/
public function __construct(array $parameters = null)
public function __construct(?array $parameters = null)
{
$this->initialize($parameters);
}
Expand All @@ -33,7 +33,7 @@ public function __construct(array $parameters = null)
* @param array|null $parameters An array of parameters to set on this object
* @return $this Item
*/
public function initialize(array $parameters = null)
public function initialize(?array $parameters = null)
{
$this->parameters = new ParameterBag;

Expand Down
2 changes: 1 addition & 1 deletion src/Omnipay.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function getFactory()
*
* @param GatewayFactory $factory A GatewayFactory instance
*/
public static function setFactory(GatewayFactory $factory = null)
public static function setFactory(?GatewayFactory $factory = null)
{
self::$factory = $factory;
}
Expand Down

0 comments on commit 66e429e

Please sign in to comment.