Skip to content
Merged
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
13 changes: 11 additions & 2 deletions bin/graphql-client
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ use Symfony\Component\Console\Application;

$application = new Application();

$application->add(new GenerateConfig());
$application->add(new GetIntrospection());
if (method_exists($application, 'add')) {
// Symfony Console ^6
$application->add(new GenerateConfig());
$application->add(new GetIntrospection());
}

if (method_exists($application, 'addCommand')) {
// Symfony Console ^7 and above
$application->addCommand(new GenerateConfig());
$application->addCommand(new GetIntrospection());
}

$application->run();
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"softonic/guzzle-oauth2-middleware": "^2.1",
"ext-json": "*",
"symfony/console": "^6.0 || ^7.0"
"symfony/console": "^6.0 || ^7.0 || ^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.9",
Expand Down
2 changes: 1 addition & 1 deletion src/Config/MutationTypeConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MutationTypeConfig
*/
public $children = [];

public function __get(string $propertyName)
public function __get(string $propertyName): mixed
{
if (property_exists(static::class, $propertyName)) {
return $this->{$propertyName};
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Mutation/GenerateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GenerateConfig extends Command
*/
private $fromSameMutation;

protected function configure()
protected function configure(): void
{
$this->setDescription('Creates a mutation config.')
->setHelp(
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Mutation/GetIntrospection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class GetIntrospection extends Command
{
protected static $defaultName = 'mutation:introspection';

protected function configure()
protected function configure(): void
{
$this->setDescription('Returns a instrospection query.')
->setHelp('Returns the introspection query needed to execute in your GraphQL server in order ' .
Expand Down
4 changes: 2 additions & 2 deletions src/DataObjects/AbstractItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public function has(string $key): bool
return $this->arguments[$firstKey]->has($nextKey);
}

public function __get(string $key)
public function __get(string $key): mixed
{
return $this->arguments[$key] ?? null;
}

public function __set(string $key, $value): void
public function __set(string $key, mixed $value): void
{
$this->arguments[$key] = $value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/DataObjects/Mutation/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function add(array $itemData): MutationObject
return $item;
}

public function __unset($key): void
public function __unset(string $key): void
{
foreach ($this->arguments as $argument) {
unset($argument->{$key});
Expand Down
4 changes: 2 additions & 2 deletions src/DataObjects/Mutation/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(array $arguments = [], protected array $config = [],
$this->hasChanged = $hasChanged;
}

public function __get(string $key)
public function __get(string $key): mixed
{
if ((!array_key_exists($key, $this->arguments) || ($this->arguments[$key] === null))
&& array_key_exists($key, $this->config)
Expand All @@ -34,7 +34,7 @@ public function __get(string $key)
return parent::__get($key);
}

public function __set(string $key, $value): void
public function __set(string $key, mixed $value): void
{
if (!array_key_exists($key, $this->arguments) || $this->arguments[$key] !== $value) {
$this->hasChanged = true;
Expand Down