Skip to content

Commit 5e95e3c

Browse files
committed
Enhance descriptions
1 parent 38b502b commit 5e95e3c

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ This package comes with a bunch of scalars that are ready-to-use and just work o
2424

2525
### [Email](src/Email.php)
2626

27-
A RFC 5321 compliant email.
27+
A [RFC 5321](https://tools.ietf.org/html/rfc5321) compliant email.
2828

2929
### [Mixed](src/Mixed.php)
3030

31-
Loose type that allows any value. Be careful when passing in large Int or Float literals,
32-
as they may not be parsed correctly on the server side. Use String literals if you are
31+
Loose type that allows any value. Be careful when passing in large `Int` or `Float` literals,
32+
as they may not be parsed correctly on the server side. Use `String` literals if you are
3333
dealing with really large numbers to be on the safe side.
3434

3535
## Advanced Scalars
@@ -49,7 +49,7 @@ use MLL\GraphQLScalars\Regex;
4949

5050
$hexValue = Regex::make(
5151
'HexValue',
52-
'A hexadecimal color is specified with: #RRGGBB, where RR (red), GG (green) and BB (blue) are hexadecimal integers between 00 and FF specifying the intensity of the color.',
52+
'A hexadecimal color is specified with: `#RRGGBB`, where `RR` (red), `GG` (green) and `BB` (blue) are hexadecimal integers between `00` and `FF` specifying the intensity of the color.',
5353
'/^#?([a-f0-9]{6}|[a-f0-9]{3})$/'
5454
);
5555
```
@@ -70,8 +70,8 @@ class HexValue extends Regex
7070
* @var string
7171
*/
7272
public $description = <<<'DESCRIPTION'
73-
A hexadecimal color is specified with: #RRGGBB, where RR (red), GG (green) and BB (blue)
74-
are hexadecimal integers between 00 and FF specifying the intensity of the color.
73+
A hexadecimal color is specified with: `#RRGGBB`, where `RR` (red), `GG` (green) and `BB` (blue)
74+
are hexadecimal integers between `00` and `FF` specifying the intensity of the color.
7575
DESCRIPTION;
7676

7777
public static function regex() : string
@@ -86,8 +86,8 @@ DESCRIPTION;
8686
The `StringScalar` encapsulates all the boilerplate associated with creating a string-based Scalar type.
8787
It does the proper string checking for you and let's you focus on the minimal logic that is specific to your use case.
8888

89-
All you have to specify is a function that checks if the given string is valid. Use the factory method
90-
to generate an instance on the fly.
89+
All you have to specify is a function that checks if the given string is valid.
90+
Use the factory method `make` to generate an instance on the fly.
9191

9292
```php
9393
<?php

src/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Email extends StringScalar
1414
*
1515
* @var string
1616
*/
17-
public $description = 'A RFC 5321 compliant email.';
17+
public $description = 'A [RFC 5321](https://tools.ietf.org/html/rfc5321) compliant email.';
1818

1919
/**
2020
* Check if the given string is a valid email.

src/Mixed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class Mixed extends ScalarType
1616
* @var string
1717
*/
1818
public $description = <<<'DESCRIPTION'
19-
Loose type that allows any value. Be careful when passing in large Int or Float literals,
20-
as they may not be parsed correctly on the server side. Use String literals if you are
19+
Loose type that allows any value. Be careful when passing in large `Int` or `Float` literals,
20+
as they may not be parsed correctly on the server side. Use `String` literals if you are
2121
dealing with really large numbers to be on the safe side.
2222
DESCRIPTION;
2323

src/Regex.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@ public function serialize($value): string
9090
*/
9191
protected static function matchesRegex(string $value): bool
9292
{
93-
return RegexValidator::match(
94-
static::regex(),
95-
$value
96-
)->hasMatch();
93+
return RegexValidator
94+
::match(
95+
static::regex(),
96+
$value
97+
)
98+
->hasMatch();
9799
}
98100

99101
/**

0 commit comments

Comments
 (0)