Skip to content
This repository was archived by the owner on Dec 29, 2020. It is now read-only.

Commit 20c1402

Browse files
committed
first commit
0 parents  commit 20c1402

16 files changed

+1334
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

.travis.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: php
2+
3+
cache:
4+
directories:
5+
- $HOME/.composer/cache
6+
7+
php:
8+
- 7
9+
10+
before_script:
11+
- composer self-update
12+
13+
install:
14+
- composer install
15+
16+
script:
17+
- tests/test.php

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2015 Kévin Dunglas
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# PHPDoc to Type Hint
2+
3+
Add automatically scalar type hint and return types to all functions and methods of a PHP project using existing
4+
PHPDoc annotations.
5+
6+
**Warning**: this project is an early stage and is experimental. It **can** damage your code.
7+
Be sure to make a backup before running this command and to run all your test suites after.
8+
9+
## Credits
10+
11+
Created by [Kévin Dunglas](https://dunglas.fr). Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).

bin/phpdoc-to-typehint

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
function includeIfExists($file)
5+
{
6+
if (file_exists($file)) {
7+
return include $file;
8+
}
9+
}
10+
11+
if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
12+
fwrite(STDERR,
13+
'You must set up the project dependencies, run the following commands:'.PHP_EOL.
14+
'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
15+
'php composer.phar install'.PHP_EOL
16+
);
17+
exit(1);
18+
}
19+
20+
$application = new \Dunglas\PhpDocToTypeHint\Application();
21+
$application->run();

composer.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "dunglas/phpdoc-to-typehint",
3+
"license": "MIT",
4+
"type": "project",
5+
"description": "Generate scalar type hints from PHPDoc annotations",
6+
"autoload": {
7+
"psr-4": { "Dunglas\\PhpDocToTypeHint\\": "src/" }
8+
},
9+
"autoload-dev": {
10+
"psr-4": { "Dunglas\\PhpDocToTypeHint\\Tests\\": "tests/" }
11+
},
12+
"require": {
13+
"php": ">=7.0.0",
14+
"ext-tokenizer": "*",
15+
"symfony/console": "^2.7.0",
16+
"symfony/finder": "^2.7.0",
17+
"phpdocumentor/reflection": "^2.0@dev",
18+
"phpdocumentor/reflection-common": "^1.0@dev",
19+
"phpdocumentor/reflection-docblock": "^3.0@dev"
20+
}
21+
}

0 commit comments

Comments
 (0)