Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make typed parameters explicitly nullable (PHP 8.4 compatibility) #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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