Skip to content

Commit 87a39be

Browse files
authored
Adopt semantic line breaks for prose (one sentence per line) (#2753)
1 parent b095405 commit 87a39be

309 files changed

Lines changed: 3025 additions & 4523 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ai/AGENTS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ docker compose exec php vendor/bin/phpunit tests/Unit/Path/To/TestFile.php
4545

4646
### Directive System
4747

48-
Directives are the core extension mechanism. Located in `src/Schema/Directives/`.
48+
Directives are the core extension mechanism.
49+
Located in `src/Schema/Directives/`.
4950

5051
- `BaseDirective` - Abstract base class for all directives, provides common utilities
5152
- Directive interfaces in `src/Support/Contracts/` define capabilities:
@@ -124,6 +125,8 @@ $user = User::create([
124125
- Never use `final` in `src/`, always in `tests/`
125126
- Full namespace in PHPDoc (`@var \Full\Namespace\Class`), imports in code
126127
- Code elements with `@api` have stability guarantees between major versions
128+
- Use [Semantic Line Breaks](https://sembr.org) for prose in markdown and multiline comments
129+
- Default to one sentence per line and avoid comma/clause-only line breaks
127130

128131
## Pull Requests
129132

CHANGELOG.md

Lines changed: 89 additions & 167 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ Before you release a new version, make sure to familiarize yourself with:
2525
- [Previous GitHub Releases](https://github.com/nuwave/lighthouse/releases)
2626

2727
To create a new release, follow these steps:
28-
1. Consider the entries in the [`CHANGELOG unreleased section`](CHANGELOG.md#unreleased), add missing entries if needed
29-
2. Based on those entries and the previous version, define the next version number and add it to the [`CHANGELOG.md`](CHANGELOG.md)
28+
1. Consider the entries in the [`CHANGELOG unreleased section`](CHANGELOG.md#unreleased).
29+
Add missing entries if needed.
30+
2. Based on those entries and the previous version, define the next version number.
31+
Add it to [`CHANGELOG.md`](CHANGELOG.md).
3032
3. [Draft a new release](https://github.com/nuwave/lighthouse/releases/new)
3133
4. Add the version number as both tag and title
3234
5. Add the changelog entries as the description
@@ -85,15 +87,16 @@ Have a new feature?
8587
You can start off by writing some tests that detail the behavior you want to achieve and go from there.
8688

8789
Fixing a bug?
88-
The best way to ensure it is fixed for good and never comes back is to write a failing test for it and then make it pass.
90+
The best way to ensure it is fixed for good is to write a failing test.
91+
Then make it pass so it does not come back.
8992
If you cannot figure out how to fix it yourself, feel free to submit a PR with a failing test.
9093

9194
Here is how to set up Xdebug in PhpStorm: https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html.
9295

9396
> Enabling Xdebug slows down tests by an order of magnitude.
9497
> Stop listening for Debug Connection to speed it back up.
9598
96-
Set the environment variable `XDEBUG_REMOTE_HOST` to the IP of your host machine as seen from the Docker container.
99+
Set the environment variable `XDEBUG_REMOTE_HOST` to your host machine IP as seen from the Docker container.
97100
This may differ based on your setup.
98101
When running Docker for Desktop, it is usually `10.0.2.2`, when running from a VM it is something else.
99102

@@ -205,8 +208,8 @@ Prefer direct usage of Illuminate classes instead of helpers.
205208
+Arr::get($foo, 'bar');
206209
```
207210

208-
A notable exception is the `response()` helper - using DI for injecting a
209-
`ResponseFactory` does not work in Lumen, while `response()` works for both.
211+
A notable exception is the `response()` helper.
212+
Using DI for injecting a `ResponseFactory` does not work in Lumen, while `response()` works for both.
210213

211214
### Type Definitions
212215

@@ -223,9 +226,8 @@ If known, add additional type information in the PHPDoc.
223226
function foo(array $bar): string
224227
```
225228

226-
For aggregate types such as the commonly used `Collection` class, use
227-
the generic type hint style. While not officially part of PHPDoc, it is understood
228-
by PhpStorm and most other editors.
229+
For aggregate types such as the commonly used `Collection` class, use the generic type hint style.
230+
While not officially part of PHPDoc, it is understood by PhpStorm and most other editors.
229231

230232
```php
231233
/**
@@ -237,9 +239,7 @@ function foo(): Collection
237239
```
238240

239241
Use `self` to annotate that a class returns an instance of itself (or its child).
240-
Use [PHPDoc type hints](https://docs.phpdoc.org/guides/types.html#keywords) to
241-
differentiate between cases where you return the original object instance and
242-
other cases where you instantiate a new class.
242+
Use [PHPDoc type hints](https://docs.phpdoc.org/guides/types.html#keywords) to differentiate between cases where you return the original object instance and other cases where you instantiate a new class.
243243

244244
```php
245245
class Foo
@@ -276,6 +276,24 @@ class Foo
276276
}
277277
```
278278

279+
### Prose Formatting
280+
281+
Use [Semantic Line Breaks](https://sembr.org) for prose in markdown files and multiline code comments.
282+
283+
Write one sentence per line by default, instead of wrapping at a fixed column width.
284+
Do not split a sentence across lines at commas or clauses.
285+
If a sentence becomes too long, rewrite it into multiple shorter sentences.
286+
Keep rendered output unchanged.
287+
288+
Apply this style to edited prose in:
289+
- `*.md` files
290+
- multiline prose comments and PHPDoc blocks
291+
292+
Do not reflow:
293+
- code blocks and snippets
294+
- PHPDoc tags (for example `@param`, `@return`, `@throws`)
295+
- generated files
296+
279297
## Code Style
280298

281299
We format the code automatically with [php-cs-fixer](https://github.com/friendsofphp/php-cs-fixer).

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@
2121
</div>
2222

2323
Lighthouse is a GraphQL framework that integrates with your Laravel application.
24-
It takes the best ideas of both and combines them to solve common tasks with ease
25-
and offer flexibility when you need it.
24+
It combines the best ideas of both ecosystems.
25+
It solves common tasks with ease and offers flexibility when you need it.
2626

2727
## Documentation
2828

2929
The documentation lives at [lighthouse-php.com](https://lighthouse-php.com).
3030

3131
The site includes the latest docs for each major version of Lighthouse.
32-
You can find docs for specific versions by looking at the contents of [/docs/master](/docs/master)
33-
at that point in the git history: `https://github.com/nuwave/lighthouse/tree/<SPECIFIC-TAG>/docs/master`.
32+
You can find docs for specific versions by looking at the contents of [/docs/master](/docs/master) at that point in the git history: `https://github.com/nuwave/lighthouse/tree/<SPECIFIC-TAG>/docs/master`.
3433

3534
## Get Involved
3635

@@ -46,10 +45,10 @@ Lighthouse follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4645

4746
Only the current major version receives new features and bugfixes.
4847

49-
Updating between minor versions will not require changes to PHP code or the GraphQL schema
50-
and cause no breaking behavioral changes for consumers of the GraphQL API.
51-
However, only code elements marked with `@api` will remain compatible - all other code in
52-
Lighthouse is considered internal and is thus subject to change.
48+
Updating between minor versions does not require changes to PHP code or the GraphQL schema.
49+
It also causes no breaking behavioral changes for consumers of the GraphQL API.
50+
However, only code elements marked with `@api` remain compatible.
51+
All other code in Lighthouse is internal and subject to change.
5352

5453
## Changelog
5554

@@ -65,8 +64,7 @@ We welcome contributions of any kind, see how in [`CONTRIBUTING.md`](CONTRIBUTIN
6564

6665
## Security Vulnerabilities
6766

68-
If you discover a security vulnerability within Lighthouse,
69-
please email Benedikt Franke via [benedikt@franke.tech](mailto:benedikt@franke.tech).
67+
If you discover a security vulnerability within Lighthouse, email Benedikt Franke at [benedikt@franke.tech](mailto:benedikt@franke.tech).
7068

7169
## Sponsors
7270

0 commit comments

Comments
 (0)