Skip to content

Commit

Permalink
skip property promotion when property is different
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Feb 20, 2025
1 parent de6fed3 commit cadbf1b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 12 deletions.
10 changes: 8 additions & 2 deletions src/fields/data/ColorData.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
*/
class ColorData extends BaseObject implements Serializable, \Stringable
{
/**
* @var string The color’s hex value
*/
private string $_hex;

/**
* @var array
* @see _hsl()
Expand All @@ -37,11 +42,12 @@ class ColorData extends BaseObject implements Serializable, \Stringable
/**
* Constructor.
*
* @param string $_hex hex color value, beginning with `#`. (Shorthand is not supported, e.g. `#f00`.)
* @param string $hex hex color value, beginning with `#`. (Shorthand is not supported, e.g. `#f00`.)
* @param array $config name-value pairs that will be used to initialize the object properties
*/
public function __construct(private string $_hex, array $config = [])
public function __construct(string $hex, array $config = [])
{
$this->_hex = $hex;
parent::__construct($config);
}

Expand Down
18 changes: 15 additions & 3 deletions src/gql/base/MutationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,27 @@
*/
abstract class MutationResolver extends Component
{
/**
* @var array Data that might be useful during mutation resolution.
*/
private array $_resolutionData;

/**
* @var callable[] Value normalizers stored by argument name
*/
private array $_valueNormalizers = [];

/**
* Construct a mutation resolver and store the resolution data as well as normalizers, if any provided.
*
* @param array $_resolutionData Resolver data
* @param array $_valueNormalizers Data normalizers
* @param array $data Resolver data
* @param array $valueNormalizers Data normalizers
* @param array $config
*/
public function __construct(private array $_resolutionData = [], private array $_valueNormalizers = [], array $config = [])
public function __construct(array $data = [], array $valueNormalizers = [], array $config = [])
{
$this->_resolutionData = $data;
$this->_valueNormalizers = $valueNormalizers;
parent::__construct($config);
}

Expand Down
10 changes: 8 additions & 2 deletions src/search/SearchQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
*/
class SearchQuery
{
/**
* @var string
*/
private string $_query;

/**
* @var array
* @phpstan-var array{subLeft:bool,subRight:bool,exclude:bool,exact:bool}
Expand All @@ -31,12 +36,13 @@ class SearchQuery
/**
* Constructor
*
* @param string $_query
* @param string $query
* @param array $defaultTermOptions
* @phpstan-param array{subLeft?:bool,subRight?:bool,exclude?:bool,exact?:bool} $defaultTermOptions
*/
public function __construct(private string $_query, array $defaultTermOptions = [])
public function __construct(string $query, array $defaultTermOptions = [])
{
$this->_query = $query;
$this->_defaultTermOptions = $defaultTermOptions + [
'subLeft' => false,
'subRight' => true,
Expand Down
18 changes: 15 additions & 3 deletions src/test/console/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ class CommandTest
public const SELECT = 'select';
public const OUTPUT_COMMAND = 'outputCommand';

/**
* @var ConsoleTest
*/
protected ConsoleTest $test;

/**
* @var bool
*/
protected bool $ignoreStdout = false;

/**
* @var int
*/
Expand Down Expand Up @@ -72,14 +82,16 @@ class CommandTest
/**
* CommandTest constructor.
*
* @param ConsoleTest $test
* @param ConsoleTest $consoleTest
* @param string $command
* @param array $parameters
* @param bool $ignoreStdout
* @param bool $ignoreStdOut
* @throws InvalidConfigException
*/
public function __construct(protected ConsoleTest $test, protected string $command, protected array $parameters = [], protected bool $ignoreStdout = false)
public function __construct(ConsoleTest $consoleTest, protected string $command, protected array $parameters = [], bool $ignoreStdOut = false)
{
$this->ignoreStdout = $ignoreStdOut;
$this->test = $consoleTest;
$this->setupController();
}

Expand Down
10 changes: 8 additions & 2 deletions src/test/mockclasses/ToString.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@
*/
class ToString implements \Stringable
{
/**
* @var string
*/
private string $_string;

/**
* ToString constructor.
*
* @param string $_string
* @param string $string
*/
public function __construct(private string $_string)
public function __construct(string $string)
{
$this->_string = $string;
}

/**
Expand Down

0 comments on commit cadbf1b

Please sign in to comment.