Skip to content

Commit

Permalink
Run rector with base configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredup committed Nov 6, 2023
1 parent 37b7509 commit 4d873ba
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Bridge/Laminas/Storage/TableGatewayStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public function __construct($tableGateway, $modelClass, $idField = 'id')
if ($tableGateway instanceof LaminasTableGateway) {
$this->tableGateway = $tableGateway;
} else if ($tableGateway instanceof ZendTableGateway) {
@trigger_error(sprintf('Passing an instance of %s as the first argument to %s is deprecated and won\'t be supported in 2.0. Please using Laminas instead.', ZendTableGateway::class, __CLASS__));
@trigger_error(sprintf('Passing an instance of %s as the first argument to %s is deprecated and won\'t be supported in 2.0. Please using Laminas instead.', ZendTableGateway::class, self::class));
$this->tableGateway = $tableGateway;
} else {
throw new \InvalidArgumentException(sprintf('Argument $tableGateway of %s must be an instance of %s or %s, %s given.', __CLASS__, LaminasTableGateway::class, ZendTableGateway::class, (is_object($tableGateway) ? get_class($tableGateway) : gettype($tableGateway))));
throw new \InvalidArgumentException(sprintf('Argument $tableGateway of %s must be an instance of %s or %s, %s given.', self::class, LaminasTableGateway::class, ZendTableGateway::class, (is_object($tableGateway) ? get_class($tableGateway) : gettype($tableGateway))));
}

$this->idField = $idField;
Expand Down
8 changes: 4 additions & 4 deletions Bridge/PlainPhp/Action/GetHttpRequestAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public function execute($request)
{
RequestNotSupportedException::assertSupports($this, $request);

$request->method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
$request->method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$request->query = $_GET;
$request->request = $_REQUEST;
$request->clientIp = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$request->uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$request->userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$request->clientIp = $_SERVER['REMOTE_ADDR'] ?? '';
$request->uri = $_SERVER['REQUEST_URI'] ?? '';
$request->userAgent = $_SERVER['HTTP_USER_AGENT'] ?? '';
$request->content = file_get_contents('php://input');
}

Expand Down
6 changes: 3 additions & 3 deletions Bridge/Spl/ArrayObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct($input = array(), $flags = 0, $iterator_class = "Arr
*/
public function get($key, $default = null)
{
return isset($this[$key]) ? $this[$key] : $default;
return $this[$key] ?? $default;
}

/**
Expand All @@ -58,7 +58,7 @@ public function getArray($key, $default = [])
*/
public function replace($input)
{
if (false == (is_array($input) || $input instanceof \Traversable)) {
if (false == (is_iterable($input))) {
throw new InvalidArgumentException('Invalid input given. Should be an array or instance of \Traversable');
}

Expand All @@ -76,7 +76,7 @@ public function replace($input)
*/
public function defaults($input)
{
if (false == (is_array($input) || $input instanceof \Traversable)) {
if (false == (is_iterable($input))) {
throw new InvalidArgumentException('Invalid input given. Should be an array or instance of \Traversable');
}

Expand Down
2 changes: 1 addition & 1 deletion Bridge/Symfony/Validator/Constraints/CreditCardDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct($options = null)
parent::__construct($options);

if (null === $this->min) {
throw new MissingOptionsException('Either option "min" must be given for constraint ' . __CLASS__, array('min'));
throw new MissingOptionsException('Either option "min" must be given for constraint ' . self::class, array('min'));
}

if (null !== $this->min) {
Expand Down
4 changes: 2 additions & 2 deletions Model/Identity.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function serialize()
*/
public function unserialize($serialized)
{
list($this->id, $this->class) = unserialize($serialized);
[$this->id, $this->class] = unserialize($serialized);
}

public function __serialize(): array
Expand All @@ -64,7 +64,7 @@ public function __serialize(): array

public function __unserialize(array $data)
{
list($this->id, $this->class) = $data;
[$this->id, $this->class] = $data;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions PayumBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function addGateway($name, $gateway)
if ($gateway instanceof GatewayInterface) {
$this->gateways[$name] = $gateway;
} elseif (is_array($gateway)) {
$currentConfig = isset($this->gatewayConfigs[$name]) ? $this->gatewayConfigs[$name] : [];
$currentConfig = $this->gatewayConfigs[$name] ?? [];
$currentConfig = array_replace_recursive($currentConfig, $gateway);
if (empty($currentConfig['factory'])) {
throw new InvalidArgumentException('Gateway config must have factory set in it and it must not be empty.');
Expand Down Expand Up @@ -202,7 +202,7 @@ public function addGatewayFactory($name, $gatewayFactory)
*/
public function addGatewayFactoryConfig($name, array $config)
{
$currentConfig = isset($this->gatewayFactoryConfigs[$name]) ? $this->gatewayFactoryConfigs[$name] : [];
$currentConfig = $this->gatewayFactoryConfigs[$name] ?? [];
$this->gatewayFactoryConfigs[$name] = array_replace_recursive($currentConfig, $config);

return $this;
Expand Down Expand Up @@ -569,7 +569,7 @@ protected function buildGatewayFactories(GatewayFactoryInterface $coreGatewayFac
foreach ($map as $name => $factoryClass) {
if (class_exists($factoryClass)) {
$gatewayFactories[$name] = new $factoryClass(
isset($this->gatewayFactoryConfigs[$name]) ? $this->gatewayFactoryConfigs[$name] : [],
$this->gatewayFactoryConfigs[$name] ?? [],
$coreGatewayFactory
);
}
Expand All @@ -588,7 +588,7 @@ protected function buildAddedGatewayFactories(GatewayFactoryInterface $coreGatew
$gatewayFactories = [];
foreach ($this->gatewayFactories as $name => $factory) {
if (is_callable($factory)) {
$config = isset($this->gatewayFactoryConfigs[$name]) ? $this->gatewayFactoryConfigs[$name] : [];
$config = $this->gatewayFactoryConfigs[$name] ?? [];

$factory = call_user_func($factory, $config, $coreGatewayFactory);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Debug/HumanifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function shouldReturnObjectShortClassOnValueIfObjectPassedAndShortClassFl
*/
public function shouldReturnObjectClassOnValueIfObjectPassedAndShortClassFlagSetFalse()
{
$this->assertEquals(__CLASS__, Humanify::value($this, false));
$this->assertEquals(self::class, Humanify::value($this, false));
}

/**
Expand Down

0 comments on commit 4d873ba

Please sign in to comment.