PHPackages                             dunglas/phpdoc-to-typehint - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dunglas/phpdoc-to-typehint

AbandonedArchivedProject[Utility &amp; Helpers](/categories/utility)

dunglas/phpdoc-to-typehint
==========================

Generate scalar type hints from PHPDoc annotations

v0.1.0(10y ago)2257215MITPHPPHP &gt;=7.0.0

Since Nov 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/dunglas/phpdoc-to-typehint)[ Packagist](https://packagist.org/packages/dunglas/phpdoc-to-typehint)[ RSS](/packages/dunglas-phpdoc-to-typehint/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

PHPDoc to Type Hint
===================

[](#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://camo.githubusercontent.com/2d6fdbb4a65c0ccb7680dac89d961a13d29486c116b4d4e6f0b812e2016a27d5/68747470733a2f2f7472617669732d63692e6f72672f64756e676c61732f706870646f632d746f2d7479706568696e742e7376673f6272616e63683d6d6173746572)](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
-----------------

[](#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:

```
