|
| 1 | +<a href="https://github.com/php-type-language" target="_blank"> |
| 2 | + <img align="center" src="https://github.com/php-type-language/.github/blob/master/assets/dark.png?raw=true"> |
| 3 | +</a> |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +**TypeLang** is a declarative type language inspired by static analyzers like |
| 8 | +[PHPStan](https://phpstan.org/) and [Psalm](https://psalm.dev/docs/). It |
| 9 | +describes the type syntax found in PHPDoc comments (`int[]`, `array<string, T>`, |
| 10 | +`Foo::CONST_*`, `T is U ? A : B`, ...) and provides a set of components to work |
| 11 | +with it. |
| 12 | + |
| 13 | +This is the **development monorepo** for all TypeLang components. Each package |
| 14 | +listed below is also published as a standalone, read-only repository via |
| 15 | +[git subtree split](https://www.atlassian.com/git/tutorials/git-subtree). |
| 16 | + |
| 17 | +- Full documentation is available at [typelang.dev](https://typelang.dev). |
| 18 | +- PHP Type Language specification is [available here](https://typelang.dev/static/spec.html). |
| 19 | + |
| 20 | +## Packages |
| 21 | + |
| 22 | +| Package | Description | Tests | |
| 23 | +|--------------------------------------------------------------------------|--------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 24 | +| [`type-lang/types`](https://packagist.org/packages/type-lang/types) | AST node classes (`TypeLang\Type\*`) — the shared vocabulary of the ecosystem. | [](https://github.com/php-type-language/types/actions) | |
| 25 | +| [`type-lang/parser`](https://packagist.org/packages/type-lang/parser) | Parses TypeLang syntax into an AST, validating the grammar. | [](https://github.com/php-type-language/parser/actions/workflows/tests.yml) | |
| 26 | +| [`type-lang/printer`](https://packagist.org/packages/type-lang/printer) | Renders AST nodes back into their string representation. | [](https://github.com/php-type-language/printer/actions) | |
| 27 | +| [`type-lang/reader`](https://packagist.org/packages/type-lang/reader) | Builds AST nodes from types exposed by PHP Reflection objects. | [](https://github.com/php-type-language/reader/actions) | |
| 28 | +| [`type-lang/phpdoc`](https://packagist.org/packages/type-lang/phpdoc)) | Parses `/** ... */` DocBlock comments into a graph of description and tags. | [](https://github.com/php-type-language/phpdoc/actions/workflows/tests.yml) | |
| 29 | + |
| 30 | +## Development |
| 31 | + |
| 32 | +This repository contains all components together. Changes are contributed here |
| 33 | +and then split into the individual read-only package repositories. |
| 34 | + |
| 35 | +```sh |
| 36 | +git clone https://github.com/php-type-language/dev.git |
| 37 | +cd dev |
| 38 | +composer install |
| 39 | +``` |
| 40 | + |
| 41 | +Common tasks: |
| 42 | + |
| 43 | +```sh |
| 44 | +composer test:unit # run the PHPUnit test suite |
| 45 | +composer linter:check # run PHPStan static analysis |
| 46 | +composer phpcs:check # check the code style (php-cs-fixer, dry-run) |
| 47 | +composer phpcs:fix # apply the code style fixes |
| 48 | +``` |
| 49 | + |
| 50 | +## License |
| 51 | + |
| 52 | +TypeLang is licensed under the [MIT License](LICENSE). |
0 commit comments