Skip to content

Commit a8b8df3

Browse files
committed
Improve documentation v2
1 parent a948577 commit a8b8df3

File tree

10 files changed

+20
-19
lines changed

10 files changed

+20
-19
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ composer require bakame/http-structured-fields
3636

3737
## Documentation
3838

39-
- The documentation for [version 2.x](/docs/00-intro.md) for **the upcoming v2 release**
40-
- The documentation for [version 1.x](https://github.com/bakame-php/http-structured-fields/tree/1.x) for the current stable version.
39+
- The documentation for **the upcoming [version 2.x](https://bakame-php.github.io/http-structured-fields/) release**
4140

4241
## Contributing
4342

docs/01-basic-usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ process that the package can simplify for you once you read the documentation.
6565
The goal of the examples are to show that even without dwelling too much into the ins and out
6666
of the package you can easily and quickly parse or serialize compliant fields in PHP.
6767

68-
← [Intro](00-intro.md) | [Parsing and Serializing](02-parsing-serializing.md) →
68+
← [Intro](index) | [Parsing and Serializing](02-parsing-serializing.md) →

docs/04-containers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,4 +456,4 @@ Item::new($cache->name)
456456
->when(null !== $cache->detail, fn (Item $item) => $item->appendParameter('detail', $cache->detail));
457457
```
458458

459-
← [Accessing Field Values](03-field-values.md) | [Validation](05-validation) →
459+
← [Accessing Field Values](03-field-values.md) | [Validation](05-validation.md) →

docs/05-validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,4 +432,4 @@ class it becomes easier to reuse it to validate your data.
432432
433433
To show how this can be achieved you can check the codebase from [HTTP Cache Status](https://github.com/bakame-php/http-cache-status)
434434

435-
← [Containers](04-containers.md) | [Extending the package functionalities](07-extensions.md)
435+
← [Containers](04-containers) | [Extending the package functionalities](06-extensions)

docs/07-extensions.md renamed to docs/06-extensions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ To show how this can be achieved you can check the codebase from [HTTP Cache Sta
101101
which uses the interface. Of note by using this interface you can completely hide the presence of
102102
this package to your end users if needed.
103103

104-
← [Validation](05-validation.md) | [Upgrading to v2.0](08-migration.md)
104+
← [Validation](05-validation.md) | [Upgrading to v2.0](07-migration)

docs/08-migration.md renamed to docs/07-migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,4 @@ OuterList::fromPairs([
150150
> [!NOTE]
151151
> The v1 syntax is still supported.
152152
153-
← [Extending the package functionalities](07-extensions.md) | [Intro](00-intro.md) →
153+
← [Extending the package functionalities](06-extensions) | [Intro](index) →

docs/_config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
permalink: pretty
3+
remote_theme: pages-themes/minimal@v0.2.0
4+
plugins:
5+
- jekyll-redirect-from
6+
- jekyll-remote-theme # add this line to the plugins list if you already have one
7+
title: bakame/http-structured-fields
8+
description: is a framework-agnostic PHP library that allows you to parse, serialize, create, update and validate HTTP Structured Fields in PHP

docs/00-intro.md renamed to docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ composer require bakame/http-structured-fields:^2.0
5959
- [Accessing The Field Values](03-field-values.md)
6060
- [Working with The Containers](04-containers.md)
6161
- [Structured Field Validation](05-validation.md)
62-
- [Interacting with the PHP Ecosystem](07-extensions.md)
63-
- [Upgrading from 1.x to 2.0](08-migration.md)
62+
- [Interacting with the PHP Ecosystem](06-extensions)
63+
- [Upgrading from 1.x to 2.0](07-migration)

src/Type.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
*/
1212
enum Type: string
1313
{
14-
public const MAXIMUM_INT = 999_999_999_999_999;
15-
public const MAXIMUM_FLOAT = 999_999_999_999;
14+
private const MAXIMUM_INT = 999_999_999_999_999;
15+
private const MAXIMUM_FLOAT = 999_999_999_999;
1616

1717
case Integer = 'integer';
1818
case Decimal = 'decimal';
@@ -45,7 +45,7 @@ public function isOneOf(mixed ...$other): bool
4545
/**
4646
* @throws SyntaxError if the value can not be resolved into a supported HTTP structured field data type
4747
*/
48-
public static function fromVariable(mixed $value): self
48+
public static function fromVariable(Item|Token|DisplayString|Bytes|DateTimeInterface|int|float|bool|string $value): self
4949
{
5050
return self::tryFromVariable($value) ?? throw new SyntaxError(match (true) {
5151
$value instanceof DateTimeInterface => 'The integer representation of a date is limited to 15 digits for a HTTP structured field date type.',

tests/TypeTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212

1313
final class TypeTest extends TestCase
1414
{
15-
#[Test]
16-
public function it_will_return_null_if_the_type_is_no_supported(): void
17-
{
18-
self::assertNull(Type::tryFromVariable([]));
19-
}
20-
2115
#[Test]
2216
public function it_will_return_false_if_the_type_is_valid_but_its_value_is_invalid(): void
2317
{
@@ -35,7 +29,7 @@ public function it_can_tell_the_item_type_from_a_value_instance(): void
3529
#[DataProvider('itemTypeProvider')]
3630
public function it_can_tell_the_item_type(mixed $value, Type $expectedType): void
3731
{
38-
self::assertTrue($expectedType->equals(Type::fromVariable($value)));
32+
self::assertTrue($expectedType->equals(Type::fromVariable($value))); /* @phpstan-ignore-line */
3933
self::assertTrue($expectedType->equals(Type::tryFromVariable($value)));
4034
}
4135

0 commit comments

Comments
 (0)