@@ -5,6 +5,7 @@ A collection of custom scalar types for usage with https://github.com/webonyx/gr
5
5
[ ![ Continuous Integration] ( https://github.com/mll-lab/graphql-php-scalars/workflows/Continuous%20Integration/badge.svg )] ( https://github.com/mll-lab/graphql-php-scalars/actions )
6
6
[ ![ codecov] ( https://codecov.io/gh/mll-lab/graphql-php-scalars/branch/master/graph/badge.svg )] ( https://codecov.io/gh/mll-lab/graphql-php-scalars )
7
7
[ ![ StyleCI] ( https://github.styleci.io/repos/150426104/shield?branch=master )] ( https://github.styleci.io/repos/150426104 )
8
+
8
9
[ ![ GitHub license] ( https://img.shields.io/github/license/mll-lab/graphql-php-scalars.svg )] ( https://github.com/mll-lab/graphql-php-scalars/blob/master/LICENSE )
9
10
[ ![ Packagist] ( https://img.shields.io/packagist/v/mll-lab/graphql-php-scalars.svg )] ( https://packagist.org/packages/mll-lab/graphql-php-scalars )
10
11
[ ![ Packagist] ( https://img.shields.io/packagist/dt/mll-lab/graphql-php-scalars.svg )] ( https://packagist.org/packages/mll-lab/graphql-php-scalars )
@@ -47,8 +48,6 @@ The quickest way to define a custom scalar is the `make` factory method. Just pr
47
48
a name and a regular expression and you will receive a ready-to-use custom regex scalar.
48
49
49
50
``` php
50
- <?php
51
-
52
51
use MLL\GraphQLScalars\Regex;
53
52
54
53
$hexValue = Regex::make(
@@ -61,8 +60,6 @@ $hexValue = Regex::make(
61
60
You may also define your regex scalar as a class.
62
61
63
62
``` php
64
- <?php
65
-
66
63
use MLL\GraphQLScalars\Regex;
67
64
68
65
// The name is implicitly set through the class name here
@@ -78,7 +75,7 @@ A hexadecimal color is specified with: `#RRGGBB`, where `RR` (red), `GG` (green)
78
75
are hexadecimal integers between `00` and `FF` specifying the intensity of the color.
79
76
DESCRIPTION;
80
77
81
- public static function regex() : string
78
+ public static function regex(): string
82
79
{
83
80
return '/^#?([a-f0-9]{6}|[a-f0-9]{3})$/';
84
81
}
@@ -94,14 +91,12 @@ All you have to specify is a function that checks if the given string is valid.
94
91
Use the factory method ` make ` to generate an instance on the fly.
95
92
96
93
``` php
97
- <?php
98
-
99
94
use MLL\GraphQLScalars\StringScalar;
100
95
101
96
$coolName = StringScalar::make(
102
97
'CoolName',
103
98
'A name that is most definitely cool.',
104
- function(string $name): bool {
99
+ static function (string $name): bool {
105
100
return in_array($name, [
106
101
'Vladar',
107
102
'Benedikt',
0 commit comments