├── .gitignore ├── README.md ├── composer.json └── ruleset.xml /.gitignore: -------------------------------------------------------------------------------- 1 | /composer.lock 2 | /vendor 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP Type hints convertor 2 | 3 | Converts `@param` and `@return` annotations to PHP7+ native type hints. 4 | 5 | ## Usage 6 | 7 | 1. [Download](https://github.com/kukulich/php-type-hints-convertor/archive/master.zip) or clone 8 | 9 | 2. Install dependencies 10 | 11 | ``` 12 | composer install 13 | ``` 14 | 15 | 3. Edit [ruleset.xml](https://github.com/kukulich/php-type-hints-convertor/blob/master/ruleset.xml) 16 | 17 | 4. Run convertor 18 | 19 | ``` 20 | vendor/bin/phpcbf --encoding=utf-8 --extensions=php --tab-width=4 --no-patch --standard=ruleset.xml directory_with_your_project 21 | ``` 22 | 23 | 5. Run checker and add type hints that cannot be added automatically 24 | 25 | ``` 26 | vendor/bin/phpcs --encoding=utf-8 --extensions=php --tab-width=4 --standard=ruleset.xml directory_with_your_project 27 | ``` 28 | 29 | 6. Run your tests and check if everything is ok 30 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kukulich/typehints-fixer", 3 | "homepage": "http://github.com/kukulich/typehints-fixer", 4 | "minimum-stability": "dev", 5 | "prefer-stable": true, 6 | "require": { 7 | "slevomat/coding-standard": "dev-2.0-dev#1e3adf8" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ruleset.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | --------------------------------------------------------------------------------