An open API service indexing awesome lists of open source software.

https://github.com/dunglas/phpdoc-to-typehint

Add scalar type hints and return types to existing PHP projects using PHPDoc annotations
https://github.com/dunglas/phpdoc-to-typehint

coding-standards cs php php-7 phpdoc

Last synced: 5 months ago
JSON representation

Add scalar type hints and return types to existing PHP projects using PHPDoc annotations

Awesome Lists containing this project

README

        

# PHPDoc to Type Hint

**Archived!** This repository is now archived. Consider using [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (and especially the
`phpdoc_to_param_type` and `phpdoc_to_return_type` rules) or [Rector](https://tomasvotruba.com/blog/2018/11/15/how-to-get-php-74-typed-properties-to-your-code-in-few-seconds/) instead.

`phpdoc-to-typehint` adds automatically scalar type hints and return types to all functions and methods of a PHP project
using existing PHPDoc annotations.

[![Build Status](https://travis-ci.org/dunglas/phpdoc-to-typehint.svg?branch=master)](https://travis-ci.org/dunglas/phpdoc-to-typehint)

**Warning**: this project is an early stage of development. It **can** damage your code.
Be sure to make a backup before running this command and to run your test suite after.

Please [report](https://github.com/dunglas/phpdoc-to-typehint/issues) any bug you find using this tool.

## Install and usage

1. [Download the latest PHAR file](https://github.com/dunglas/phpdoc-to-typehint/releases)
2. Run `php phpdoc-to-typehint.phar `

Your project should have scalar type hints and return type declarations.

Before:

```php