Skip to content

Commit cb8fbea

Browse files
spawniasimPod
andauthored
Require webonyx/graphql-php:^15 (#10)
Co-authored-by: Simon Podlipsky <[email protected]>
1 parent 100022e commit cb8fbea

17 files changed

+51
-58
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
[GitHub Releases](https://github.com/mll-lab/graphql-php-scalars/releases).
8+
[See GitHub Releases](https://github.com/mll-lab/graphql-php-scalars/releases).
99

1010
## Unreleased
1111

12+
### Changed
13+
14+
- Require `webonyx/graphql-php:^15`
15+
16+
### Removed
17+
18+
- Drop support for PHP 7.4
19+
1220
## v5.4.1
1321

1422
### Changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"egulias/email-validator": "^2.1.17 || ^3",
2020
"spatie/regex": "^1.4 || ^2 || ^3",
2121
"thecodingmachine/safe": "^1.3 || ^2",
22-
"webonyx/graphql-php": "^0.13.9 || ^14"
22+
"webonyx/graphql-php": "^15"
2323
},
2424
"require-dev": {
2525
"ergebnis/composer-normalize": "^2.16",

phpunit.xml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit backupGlobals="false"
4-
backupStaticAttributes="false"
5-
bootstrap="vendor/autoload.php"
6-
colors="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
colors="true">
127
<testsuites>
138
<testsuite name="mll-lab/graphql-php-scalars Test Suite">
149
<directory>tests</directory>
1510
</testsuite>
1611
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src</directory>
20-
</whitelist>
21-
</filter>
12+
<coverage>
13+
<include>
14+
<directory suffix=".php">./src</directory>
15+
</include>
16+
</coverage>
2217
</phpunit>

src/Date.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class Date extends DateScalar
66
{
7-
public $description /** @lang Markdown */
7+
public ?string $description /** @lang Markdown */
88
= 'A date string with format `Y-m-d`, e.g. `2011-05-23`.';
99

1010
protected static function outputFormat(): string

src/DateTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class DateTime extends DateScalar
66
{
7-
public $description /** @lang Markdown */
7+
public ?string $description /** @lang Markdown */
88
= 'A datetime string with format `Y-m-d H:i:s`, e.g. `2018-05-23 13:43:32`.';
99

1010
protected static function outputFormat(): string

src/DateTimeTz.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class DateTimeTz extends DateScalar
66
{
7-
public $description /** @lang Markdown */
7+
public ?string $description /** @lang Markdown */
88
= 'A datetime string with format `Y-m-d\TH:i:s.uP`, e.g. `2020-04-20T16:20:04.000000+04:00`.';
99

1010
protected static function outputFormat(): string

src/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class Email extends StringScalar
99
{
10-
public $description /** @lang Markdown */
10+
public ?string $description /** @lang Markdown */
1111
= 'A [RFC 5321](https://tools.ietf.org/html/rfc5321) compliant email.';
1212

1313
protected function isValid(string $stringValue): bool

src/JSON.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class JSON extends ScalarType
1111
{
12-
public $description /** @lang Markdown */
12+
public ?string $description /** @lang Markdown */
1313
= 'Arbitrary data encoded in JavaScript Object Notation. See https://www.json.org.';
1414

1515
public function serialize($value): string

src/MixedScalar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
class MixedScalar extends ScalarType
99
{
10-
public $name = 'Mixed';
10+
public string $name = 'Mixed';
1111

12-
public $description = /** @lang Markdown */ <<<'DESCRIPTION'
12+
public ?string $description = /** @lang Markdown */ <<<'DESCRIPTION'
1313
Loose type that allows any value. Be careful when passing in large `Int` or `Float` literals,
1414
as they may not be parsed correctly on the server side. Use `String` literals if you are
1515
dealing with really large numbers to be on the safe side.

src/NullScalar.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
use GraphQL\Error\InvariantViolation;
77
use GraphQL\Language\AST\NullValueNode;
88
use GraphQL\Type\Definition\ScalarType;
9-
use GraphQL\Utils\Utils;
109

1110
class NullScalar extends ScalarType
1211
{
13-
public $name = 'Null';
12+
public const ONLY_NULL_IS_ALLOWED = 'Only null is allowed.';
1413

15-
public $description /** @lang Markdown */
14+
public string $name = 'Null';
15+
16+
public ?string $description /** @lang Markdown */
1617
= 'Always `null`. Strictly validates value is non-null, no coercion.';
1718

1819
public function serialize($value)
1920
{
2021
if (null !== $value) {
21-
throw new InvariantViolation(static::notNullMessage($value));
22+
throw new InvariantViolation(self::ONLY_NULL_IS_ALLOWED);
2223
}
2324

2425
return null;
@@ -27,7 +28,7 @@ public function serialize($value)
2728
public function parseValue($value)
2829
{
2930
if (null !== $value) {
30-
throw new Error(static::notNullMessage($value));
31+
throw new Error(self::ONLY_NULL_IS_ALLOWED);
3132
}
3233

3334
return null;
@@ -36,20 +37,9 @@ public function parseValue($value)
3637
public function parseLiteral($valueNode, ?array $variables = null)
3738
{
3839
if (! $valueNode instanceof NullValueNode) {
39-
// Intentionally without message, as all information is already present in the wrapped error
40-
throw new Error('');
40+
throw new Error(self::ONLY_NULL_IS_ALLOWED);
4141
}
4242

4343
return null;
4444
}
45-
46-
/**
47-
* @param mixed $value any non-null value
48-
*/
49-
public static function notNullMessage($value): string
50-
{
51-
$notNull = Utils::printSafeJson($value);
52-
53-
return "Expected null, got: {$notNull}.";
54-
}
5545
}

0 commit comments

Comments
 (0)