Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104300 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 80204 invoked from network); 8 Feb 2019 10:38:28 -0000 Received: from unknown (HELO mail-qt1-f181.google.com) (209.85.160.181) by pb1.pair.com with SMTP; 8 Feb 2019 10:38:28 -0000 Received: by mail-qt1-f181.google.com with SMTP id n32so2829436qte.11 for ; Thu, 07 Feb 2019 23:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=rHbuB7o+ZNR9As0WyTPvW8C49MxHCxJFPFJQn27SW1A=; b=Vq3mbg7CLXpHfpKYOV71Q+mSeD0PGbyO6GvrOCdGyhOarCIBr4j/bW7xjsdSO4VrKj fnp5dUFFKz6JSdsz+gWx+UtxAUPzCS1wptNWPWuIUm9rg/yNuAcD73oMHFKaIrnPWkj7 3YJNO9FbP+zZ45MdoX0z2t9q3PgY2lpz4B5Ws8ReNWSD7UH7JPYuVp7AuIwacW0O/NgS XwVVST19RQ+C9IFkTvDJAvnS3561JoKq6GkPKkAPobxYJgEuM+NoEusBAUSEGyvw0lSo 0VqwUdfq9OK7DmbdWOCcOD+U4oZNXKejTEkDCmVZ5DgX/amlBqJ4O2MH5yftCKk48K7L 3OOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=rHbuB7o+ZNR9As0WyTPvW8C49MxHCxJFPFJQn27SW1A=; b=OZzgMU3tG0f+Vg45Z6WWpJcppRG+XtrnSFBS3tLwtAtKwuA5pJfdPwoZaCtWk7O3bb XMOZsvKJakp8ZQ5ZSfT/2D5f6iQRAhcRz2BvP1evmtGcJ1Qlzun6dYRmHtcRFpOo6k2+ H2FIJvQFbD4zmf+fA7/ZS7Tgf0FMVvGBfTUnuf8zcqUEPqVx7jAMM8SSuVqVimqzrXB5 JutiHwDtRbQcQXuwjO3It5/JjsDILXWy4l/eLhyGHtQCARQyzq4tZMzAQLj/QK63C0b9 GdWQ5WWSoWZnpjO7ve9qcY2+xL7UCO1I3HBoRUOLxy/H9PgLF7XNbzx41aV+c91r83AW QpxQ== X-Gm-Message-State: AHQUAubaWgdvy28rpe7oOIb9tDsFYavrl8vysrYho9zIYRvhQPTlqBK/ n2CaGt8F135obNlm0ZHYvy2YJhRvPy+nme0SgI42KA63eU8= X-Google-Smtp-Source: AHgI3IZE3Y8VRTcCdRmgx3bOIq9hDhu0MZRcBk8lomrx6yn7Kk+TxA3jqqnzAf2zTkUsSTObJqIo8WJ2sW3LXYhcYS8= X-Received: by 2002:ad4:42d1:: with SMTP id f17mr15231148qvr.59.1549610417188; Thu, 07 Feb 2019 23:20:17 -0800 (PST) MIME-Version: 1.0 Date: Fri, 8 Feb 2019 08:20:09 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000750c0a05815ccaf0" Subject: Mixed type-hint From: rasmus@mindplay.dk (Rasmus Schultz) --000000000000750c0a05815ccaf0 Content-Type: text/plain; charset="UTF-8" Regarding the mixed type-hint RFC: https://wiki.php.net/rfc/mixed-typehint > When no native type is present, it is unclear what type is expected Regarding variance - in the examples shown in the RFC, it is still unclear whether your intention was variance, or if you just omitted the type-hint by accident. The introduction of the mixed type-hint, as I was trying to explain earlier, could have addressed that problem - by allowing mixed variance only with an explicit type-hint and disallowing implicit variance. As I pointed out when the variance RFCs were accepted, it's too late to remove this allowance now, as that would be a breaking change. However, could we at least make it an E_STRICT? So that, given the following: class A { public function foo(int $value) {} } The following would emit an E_STRICT: class B extends A { public function foo($value) {} // E_STRICT: implied variance } And the following would not: class B extends A { public function foo(mixed $value) {} // explicit variance } An E_STRICT is not a breaking change, right? At least then we can map E_STRICT to an ErrorException during development. Without this, the mixed type-hint is basically meaningless noise, is it not? About as effective is a doc-block? --000000000000750c0a05815ccaf0--