Comments (10)
@TomasVotruba do you think we can deprecate this package in favor of Rector?
from phpdoc-to-typehint.
Ok, let me know when you think that there is a feature parity and that the project is stable enough. I'll then archive this repo and redirect to Rector.
from phpdoc-to-typehint.
You're very welcome, I've not the time to actively work on this project anymore, and Rector looks very promising.
from phpdoc-to-typehint.
This error is very common among other tags as well, due to https://github.com/phpDocumentor/ReflectionDocBlock
You'd have to create own tags with fixes: https://github.com/Symplify/Symplify/blob/f80fada524b7a198782a07836ce20ee13b457900/packages/BetterReflectionDocBlock/src/CleanDocBlockFactory.php#L28
or use more advanced phpdoc-parser: https://github.com/phpstan/phpdoc-parser, that is used also by PHPStan
I tried them both and I must say the later wins 🍾
from phpdoc-to-typehint.
Few months in the future... :) there is PR in Rector that supports and a solves that:
rectorphp/rector#795
from phpdoc-to-typehint.
I think so 👍 I've already ported tests from here, from nikic/TypeUtil and from php-cs-fixer today
I plan to add few more tests, than try it on Symfony code and see what happens :) that should be "battle-tested"
from phpdoc-to-typehint.
Will do, thanks for being open to this 👍
from phpdoc-to-typehint.
I've tested it on Symfony and released after many bugfixes in Rector v0.3.22.
Apart classic docblock → typehint it includes:
- skip for override of
vendor
method without typehint - propagation of added typehint on all children - classes and interfaces
- propagation of added typehint on class that implements interface and that required a method, that is used from a trait
- PHP 7.1 and nullables by default
- PHP 7.2 and
object
typehint enabled by parameter
Install
composer require rector/rector --dev
Setup
# rector.yml
services:
Rector\Php\Rector\FunctionLike\ParamScalarTypehintRector: ~
Rector\Php\Rector\FunctionLike\ReturnScalarTypehintRector: ~
Run
vendor/bin/rector process src --dry-run
vendor/bin/rector process src
from phpdoc-to-typehint.
from phpdoc-to-typehint.
Ok, let me know when you think that there is a feature parity and that the project is stable enough. I'll then archive this repo and redirect to Rector.
Btw, this si done since my last comment. Already tagged and used by people, so you you can archive and recommend Rector 🙇♂️
from phpdoc-to-typehint.
Related Issues (15)
- Add a dry run mode
- InvalidArgumentException at @see HOT 1
- Aliased classes in return statements are not mantained when ported to PHP7 HOT 2
- Support PHP7.1 HOT 4
- Example in readme is invalid HOT 2
- By reference is applied in correctly HOT 2
- Error doesn't point to file and line that is at fault
- Possible to run on single file
- First paramert is ofthen not hinted HOT 6
- php 7.1: requirements could not be resolved to an installable set of packages
- Cannot ue 'Void' as class name HOT 7
- Constant visibility is not supported HOT 1
- Nullable type hints in existing code break the parser HOT 1
- RFC: Do not change method signature when this would break inheritance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpdoc-to-typehint.