diff --git a/CHANGELOG.md b/CHANGELOG.md index 2baf1d2f34..36c989036f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ You can find and compare releases at the [GitHub release page](https://github.co ## Unreleased +## v6.17.0 + +### Added + +- Improve stubs for PHP 8.2 and above https://github.com/nuwave/lighthouse/pull/2441 + ## v6.16.2 ### Fixed diff --git a/src/Console/FieldGeneratorCommand.php b/src/Console/FieldGeneratorCommand.php index b1c1b76ba7..99823c6e17 100644 --- a/src/Console/FieldGeneratorCommand.php +++ b/src/Console/FieldGeneratorCommand.php @@ -13,11 +13,15 @@ abstract class FieldGeneratorCommand extends LighthouseGeneratorCommand protected function getStub(): string { - $stub = $this->option('full') - ? 'field_full' - : 'field_simple'; + if (version_compare(PHP_VERSION, '8.2.0', '>=')) { + return $this->option('full') + ? __DIR__ . '/stubs/field_full.php82.stub' + : __DIR__ . '/stubs/field_simple.php82.stub'; + } - return __DIR__ . "/stubs/{$stub}.stub"; + return $this->option('full') + ? __DIR__ . '/stubs/field_full.stub' + : __DIR__ . '/stubs/field_simple.stub'; } /** @return array> */ diff --git a/src/Console/stubs/directive.stub b/src/Console/stubs/directive.stub index 41138cc18c..ac06a74d01 100644 --- a/src/Console/stubs/directive.stub +++ b/src/Console/stubs/directive.stub @@ -1,4 +1,4 @@ -