Skip to content

Commit 8be5502

Browse files
authored
Merge pull request #1190 from iisyos/master
Fix type declaration mismatch in scalar stub
2 parents d1be5a6 + 26393b9 commit 8be5502

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ CHANGELOG
33

44
[Next release](https://github.com/rebing/graphql-laravel/compare/9.11.0...master)
55

6+
### Fixed
7+
- Fixed type declaration mismatch in scalar type classes generated by `make:graphql:scalar` command by removing premature type hints from the stub [\#1190 / iisyos](https://github.com/rebing/graphql-laravel/pull/1190)
8+
69
2025-10-07, 9.11.0
710
------------------
811

src/Console/stubs/scalar.stub

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class DummyClass extends ScalarType implements TypeConvertible
1616
/**
1717
* @var string
1818
*/
19-
public $name = 'DummyClass';
19+
public string $name = 'DummyClass';
2020

2121
/**
22-
* @var string
22+
* @var ?string
2323
*/
24-
public $description = '';
24+
public ?string $description = '';
2525

2626
/**
2727
* Serializes an internal value to include in a response.

tests/Unit/Console/ScalarMakeCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ public static function dataForMakeCommand(): array
3737
'inputName' => 'Example',
3838
'expectedFilename' => 'GraphQL/Scalars/Example.php',
3939
'expectedClassDefinition' => 'Example extends ScalarType implements TypeConvertible',
40-
'expectedGraphqlName' => '\$name = \'Example\';',
40+
'expectedGraphqlName' => 'public string \\$name = \'Example\';',
4141
],
4242
'ExampleScalar' => [
4343
'inputName' => 'ExampleScalar',
4444
'expectedFilename' => 'GraphQL/Scalars/ExampleScalar.php',
4545
'expectedClassDefinition' => 'ExampleScalar extends ScalarType implements TypeConvertible',
46-
'expectedGraphqlName' => '\$name = \'ExampleScalar\';',
46+
'expectedGraphqlName' => 'public string \\$name = \'ExampleScalar\';',
4747
],
4848
];
4949
}

0 commit comments

Comments
 (0)