forked from kitetail/zttp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9280503
commit 06dac83
Showing
1 changed file
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,68 @@ | ||
# Contributing | ||
|
||
We accept contributions via Pull Requests on [GitHub](https://github.com/kitetail/zttp). | ||
Most important: | ||
|
||
**This library does not use type-hints, follow PSR-2, or apply most other "best practices."** | ||
|
||
This is intentional, and mostly just to make life a little more fun. Life's too short to take everything so seriously. | ||
|
||
The library is still high quality and has an awesome test suite; it's just written more like Ruby than like Java :) | ||
|
||
## Code Style | ||
|
||
This library borrows most structural choices from PSR-2 in terms of tabs vs. spaces, where there should/shouldn't be whitespace, and where to put braces. | ||
|
||
It deviates significantly from PSR-1 and PSR-2 in the following ways: | ||
|
||
- Instance properties **must not be declared** (unfortunately PHP won't let you omit static properties), instead assign them dynamically in `__construct` | ||
- Visibility keywords (public, protected, private) **must not be used** | ||
|
||
For example: | ||
|
||
```php | ||
// Bad! 😒 | ||
class Foo | ||
{ | ||
private $bar; | ||
private $baz = 'hello world'; | ||
|
||
public function __construct() | ||
{ | ||
$this->bar = new Collection; | ||
} | ||
|
||
private function qux() | ||
{ | ||
// ... | ||
} | ||
} | ||
|
||
// Fantastic! 😍 | ||
class Foo | ||
{ | ||
function __construct() | ||
{ | ||
$this->bar = new Collection; | ||
$this->baz = 'hello world'; | ||
} | ||
|
||
function qux() | ||
{ | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
Additionally, code must also follow these constraints: | ||
|
||
- Type-hints **must not be used** | ||
- Temporary variables **must not be used** | ||
- Each method **must return immediately**; methods cannot have more than one expression | ||
|
||
## Pull Requests | ||
|
||
We accept contributions via Pull Requests on [GitHub](https://github.com/kitetail/zttp). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. |