php-the-right-way icon indicating copy to clipboard operation
php-the-right-way copied to clipboard

[suggestion] Type hints/return types

Open rieschl opened this issue 6 years ago • 2 comments

I really like this PHP reference, it's nice to send it to beginners and people who've been away for a while and want to get up to date.

But what's missing is any explanation of method/function type hints and return types, also in conjunction with declare(strict_types=1);.

Personally I think type safety is a very important concept and when using it from the beginning it makes code cleaner and also easier to understand.

PHP 7.4 will also have typed properties, so maybe this topic is worth to be added? :-)

rieschl avatar Feb 25 '19 20:02 rieschl

I agree. I came here to make the same suggestion and then saw this. Definitely very important. It looks like they accept pull requests so maybe someone could write it up? I'll try to if I can scrape together the time.

derekyle avatar Aug 16 '19 21:08 derekyle

Yes we do accept pull requests :) Feel free to use this thread as a discussion for your WIP. I and others will be happy to provide feedback along the way. Thanks!

codeguy avatar Aug 17 '19 14:08 codeguy