Doc #79484 [NEW]: Declared full covariance and contravariance support should be refined

From: Date: Fri, 17 Apr 2020 08:21:16 +0000
Subject: Doc #79484 [NEW]: Declared full covariance and contravariance support should be refined
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17490@lists.php.net to get a copy of this message
From: vlad dot turchinskiy at yandex dot ru Operating system: any PHP version: 7.4.5 Package: PHP Language Specification Bug Type: Documentation Problem Bug description:Declared full covariance and contravariance support should be refined Description: ------------ On the doc page https://www.php.net/manual/en/language.oop5.variance.php declared that "As of PHP 7.4.0, full covariance and contravariance support was added". As mentioned by derick@php.net at #79482 (https://bugs.php.net/bug.php?id=79482): "Function arguments are contra-variant, not co-variant, meaning that an overloaded/inherited method can chose to accept a broader type. If it would allow for a more specific/narrow type, then an already existing bit of code could no longer call the overloaded with the same method arguments as the original parent class." This should be refined in docs. In the current state, docs goes against POLA (https://en.wikipedia.org/wiki/Principle_of_least_astonishment). Provided test script to demonstrate. Test script: --------------- https://3v4l.org/vC0WM Expected result: ---------------- The fact that "Function arguments are contra-variant, not co-variant" should be mentioned at https://www.php.net/manual/en/language.oop5.variance.php Better, if it had an example. Actual result: -------------- Declared full covariance and contravariance support -- Edit bug report at https://bugs.php.net/bug.php?id=79484&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79484&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79484&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79484&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79484&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79484&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79484&r=support Expected behavior: https://bugs.php.net/fix.php?id=79484&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79484&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79484&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79484&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79484&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79484&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79484&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79484&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79484&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79484&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79484&r=mysqlcfg

« previous php.doc.bugs (#17490) next »