Hi!

> Of course it's a win. Or do you like to write docblocks for every
> single class property or method (even when the member is obvious) just

Yes. What is obvious to you today may not be at all obvious to your
coworker two years later.

> to have a "@var" so your IDE can work?

No, not "just" my IDE can work. IDE is just the side effect. Proper
documentation does much more than that.

> Not to mention you won't get any runtime/compile time check or
> optimization from docblock tags, that's the main point of having typed
> properties.

I don't see how "compile time check" is even possible, given that PHP
has no "compile time". As for runtime check, it'd be mostly useless for
me - I very rarely have seen bugs that would be caught by such checks.

> If you are using the term "proper documentation" to justify docblocks
> everywhere even if they contain just a "/** @var string */", it's a
> sign we've been using comments against us all this time (even if we
> called it "doc comments").

I'm not sure what "using comments against us" even means. I also do not
share a superstition that comments are somehow evil or that making
comments machine-readable and benefiting from it is somehow wrong.

> But thankfully we are moving PHP to another direction. Do you remember

If you refer to inserting static typing into random places in service of
a cargo cult notion that "more type definitions is always better,
because types fix bugs" - no, I do not think it is a correct direction.

> https://wiki.php.net/rfc/return_types#vote. That's because "function()
> : type" is self documented and much more maintainable than than a
> possibly sloppy "/** @return type */" on top of every method on a
> codebase.

It's not more maintainable and it is much less flexible or useful. PHP
has very nice and flexible capabilities that allow write very nice code
which can return different values in different circumstances. By trying
to shove it into a single type you are ignoring these capabilities -
again because of a superstition that somehow there are myriads of bugs
caused by accidentally returning values of wrong types that are being
fixed by that.

> But with the benefits already cited above. Docblocks should not be a
> place for type information anymore, this was a workaround and we've

Why? There's no reason why they can't be except for a unsupported
statement "it is bad because it is bad".
-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to