{"id":13505160,"url":"https://github.com/dunglas/phpdoc-to-typehint","last_synced_at":"2025-10-03T23:32:08.670Z","repository":{"id":55475611,"uuid":"45990932","full_name":"dunglas/phpdoc-to-typehint","owner":"dunglas","description":"Add scalar type hints and return types to existing PHP projects using PHPDoc annotations","archived":true,"fork":false,"pushed_at":"2020-12-28T22:25:46.000Z","size":60,"stargazers_count":226,"open_issues_count":0,"forks_count":15,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-12-17T01:12:04.526Z","etag":null,"topics":["coding-standards","cs","php","php-7","phpdoc"],"latest_commit_sha":null,"homepage":"https://dunglas.fr/2015/11/introducing-the-phpdoc-to-typehint-converter-add-scalar-type-hints-and-return-type-declarations-to-your-projects/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dunglas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-11T15:44:07.000Z","updated_at":"2024-10-05T15:25:30.000Z","dependencies_parsed_at":"2022-08-15T01:10:46.101Z","dependency_job_id":null,"html_url":"https://github.com/dunglas/phpdoc-to-typehint","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunglas%2Fphpdoc-to-typehint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunglas%2Fphpdoc-to-typehint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunglas%2Fphpdoc-to-typehint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunglas%2Fphpdoc-to-typehint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dunglas","download_url":"https://codeload.github.com/dunglas/phpdoc-to-typehint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235204448,"owners_count":18952326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coding-standards","cs","php","php-7","phpdoc"],"created_at":"2024-08-01T00:00:59.458Z","updated_at":"2025-10-03T23:32:08.351Z","avatar_url":"https://github.com/dunglas.png","language":"PHP","funding_links":[],"categories":["Standalone","PHP"],"sub_categories":["Fixers"],"readme":"# PHPDoc to Type Hint\n\n**Archived!** This repository is now archived. Consider using [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (and especially the \n`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.\n\n`phpdoc-to-typehint` adds automatically scalar type hints and return types to all functions and methods of a PHP project\nusing existing PHPDoc annotations.\n\n[![Build Status](https://travis-ci.org/dunglas/phpdoc-to-typehint.svg?branch=master)](https://travis-ci.org/dunglas/phpdoc-to-typehint)\n\n**Warning**: this project is an early stage of development. It **can** damage your code.\nBe sure to make a backup before running this command and to run your test suite after.\n\nPlease [report](https://github.com/dunglas/phpdoc-to-typehint/issues) any bug you find using this tool.\n\n## Install and usage\n\n1. [Download the latest PHAR file](https://github.com/dunglas/phpdoc-to-typehint/releases)\n2. Run `php phpdoc-to-typehint.phar \u003cyour-project-directory\u003e`\n\nYour project should have scalar type hints and return type declarations.\n\nBefore:\n\n```php\n\u003c?php\n\n/**\n * @param int|null $a\n * @param string   $b\n *\n * @return float\n */\nfunction bar($a, $b, bool $c, callable $d = null)\n{\n    return 0.0;\n}\n```\n\nAfter:\n\n```php\n\u003c?php\n\n/**\n * @param int|null $a\n * @param string   $b\n *\n * @return float\n */\nfunction bar(int $a = null, string $b, bool $c, callable $d = null) : float\n{\n    return 0.0;\n}\n```\n\n## Features\n\nSupports:\n\n* functions\n* methods of classes and traits\n* method definitions in interfaces\n* PHPDoc inheritance\n* PHP 7.1 nullable types (can be disabled with `--no-nullable-types` option)\n\n## Credits\n\nCreated by [Kévin Dunglas](https://dunglas.fr). Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdunglas%2Fphpdoc-to-typehint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdunglas%2Fphpdoc-to-typehint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdunglas%2Fphpdoc-to-typehint/lists"}