-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Showing
1 changed file
with
38 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Vibes: | ||
====== | ||
Generally-useful extensions are great, custom extensions and themes just for one specific DIY site | ||
are welcome too. I (Shish) will probably only actively maintain and add features to the extensions | ||
which I personally use, but if you submit some code of your own I will try to keep it updated and | ||
compatible with any API changes that come along. If your code comes with unit tests, this type of | ||
maintenance is much more likely to be successful :) | ||
|
||
Testing: | ||
======== | ||
Github Actions will be running three sets of automated tests, all of which you can run for yourself: | ||
|
||
- `./vendor/bin/php-cs-fixer fix` - keeping a single style for the whole project | ||
- `./vendor/bin/phpunit --config tests/phpunit.xml` - unit testing | ||
- `./vendor/bin/phpstan analyse --memory-limit 1G -c tests/phpstan.neon` - type checking | ||
|
||
The `main` branch is locked down so it can't accept pull requests that don't pass these | ||
|
||
Testing FAQs: | ||
============= | ||
|
||
## What the heck is "Method XX::YY() return type has no value type specified in iterable type array."? | ||
|
||
PHP arrays are very loosely defined - they can be lists or maps, with integer or string | ||
(or non-continuous integer) keys, with any type of object (or multiple types of object). | ||
This isn't great for type safety, so PHPStan is a bit stricter, and requires you to | ||
specify what type of array it is and what it contains. You can do this with PHPdoc comments, | ||
like: | ||
|
||
```php | ||
/** | ||
* @param array<string, Cake> $cakes -- a mapping like ["sponge" => new Cake()] | ||
* @return array<Ingredient> -- a list like [new Ingredient("flour"), new Ingredient("egg")] | ||
*/ | ||
function get_ingredients(array $cakes, string $cake_name): array { | ||
return $cakes[$cake_name]->ingredients; | ||
} | ||
``` |