Skip to content

Commit 33fae96

Browse files
committed
Improve code samples in README.md
1 parent f25e1ff commit 33fae96

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ A collection of custom scalar types for usage with https://github.com/webonyx/gr
55
[![Continuous Integration](https://github.com/mll-lab/graphql-php-scalars/workflows/Continuous%20Integration/badge.svg)](https://github.com/mll-lab/graphql-php-scalars/actions)
66
[![codecov](https://codecov.io/gh/mll-lab/graphql-php-scalars/branch/master/graph/badge.svg)](https://codecov.io/gh/mll-lab/graphql-php-scalars)
77
[![StyleCI](https://github.styleci.io/repos/150426104/shield?branch=master)](https://github.styleci.io/repos/150426104)
8+
89
[![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)
910
[![Packagist](https://img.shields.io/packagist/v/mll-lab/graphql-php-scalars.svg)](https://packagist.org/packages/mll-lab/graphql-php-scalars)
1011
[![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
4748
a name and a regular expression and you will receive a ready-to-use custom regex scalar.
4849

4950
```php
50-
<?php
51-
5251
use MLL\GraphQLScalars\Regex;
5352

5453
$hexValue = Regex::make(
@@ -61,8 +60,6 @@ $hexValue = Regex::make(
6160
You may also define your regex scalar as a class.
6261

6362
```php
64-
<?php
65-
6663
use MLL\GraphQLScalars\Regex;
6764

6865
// 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)
7875
are hexadecimal integers between `00` and `FF` specifying the intensity of the color.
7976
DESCRIPTION;
8077

81-
public static function regex() : string
78+
public static function regex(): string
8279
{
8380
return '/^#?([a-f0-9]{6}|[a-f0-9]{3})$/';
8481
}
@@ -94,14 +91,12 @@ All you have to specify is a function that checks if the given string is valid.
9491
Use the factory method `make` to generate an instance on the fly.
9592

9693
```php
97-
<?php
98-
9994
use MLL\GraphQLScalars\StringScalar;
10095

10196
$coolName = StringScalar::make(
10297
'CoolName',
10398
'A name that is most definitely cool.',
104-
function(string $name): bool {
99+
static function (string $name): bool {
105100
return in_array($name, [
106101
'Vladar',
107102
'Benedikt',

0 commit comments

Comments
 (0)