-
-
Notifications
You must be signed in to change notification settings - Fork 151
PHP7 scalar and return type hints support #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Maybe the param and return annotations should be removed as they're pretty much duplicate. |
|
I agree with you. I've prepared this principally to discuss how the PHP7 pull requests should look. |
What do you mean? PHP 7 changes are backward incompatible and there is no way to make it cross-compatible with PHP 5.x. The only way seems to be some sort of converter like we had with 5.2 vs. 5.3. This would be PITA.
They are not always, because PHP 7 still does not support nullable types. Also Nette heavily uses mixed, sadly. |
Exactly. So there has to be some discussion if PHP 7 features will be in new branch, in master branch but in comments or there will be some sort of converter. There should probably be special branch for PHP 7 because of composer. Version 2.4 can be PHP 5.4 compatible, version 3.0 for PHP 7+. |
|
👎 Pointless, premature. Author does not give any arguments why should this PR be of any value. Discussion should be done on forum not on random Nette repository in PR. |
|
The complicated part is that now you have to rebase this PR until Nette goes to PHP 7. |
|
Btw, interesting thing is that return |
tests/Utils/Image.send.phpt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter should be integer, string jpg throws TypeError. However I can add another test for the TypeError exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I understand
Yes. However I think there are plenty of projects that would use PHP 7 Nette (eg. Slevomat, Rohlik, DameJidlo) so there should be enough people to do the rebase. |
|
I will prepare another pull request with changes that could be merged to master so the rebase would be easier then. |
|
The rebasing has to be fully or at least partially automated. Doing it manually would by boring and error-prone. @kukulich Do you have time to work on such tool? |
|
There's already tool doing the opposite: https://github.com/ondrejbouda/php7backport So if we move master to PHP 7, we can rebase another branch to be PHP 5.4 compatible. It would be much easier. I think we can prepare automatic tool during our hackathons in Slevomat. |
Not going to happen any time soon. Also the tool is currently missing a lot of conversions and the conversions that are present are often not implemented properly. |
|
To move Nette to PHP 7 means
|
|
PHP 7 is not released so it's time to improve the tool :) I think it doesn't matter if master is in PHP 7 or not. It just depends how the release process works. |
6c03b1f to
a4bddc8
Compare
d6db352 to
02ddff7
Compare
d283776 to
d8eadeb
Compare
d116328 to
3054b70
Compare
|
@kukulich Do you have any tool to generate typehints? And could you send PR to other packages too? |
|
@dg It should be possible with this: https://github.com/slevomat/coding-standard/blob/2.0-dev/SlevomatCodingStandard/Sniffs/TypeHints/TypeHintDeclarationSniff.php There's no documentation but I can prepare a manual for you how to use it next week. |
|
Great! |
|
@dg https://github.com/kukulich/php-type-hints-convertor I hope it helps. |
|
Thanks :-) |
No description provided.