Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107506 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 2043 invoked from network); 11 Oct 2019 16:11:39 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 11 Oct 2019 16:11:39 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 626DB2C600F for ; Fri, 11 Oct 2019 06:54:49 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Fri, 11 Oct 2019 06:54:48 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id b20so9928378ljj.5 for ; Fri, 11 Oct 2019 06:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=90u6T2Iz8RuWHkt12ViWEvTOnYjHdwHBnJQxYa7+8Z4=; b=Jp3WyjSMlL7BVp24BqmReozEp4KI+jw7ThVLsuzaBU/19bmptdh+xMgyGx+TwTty1y VsUJ1zHbAHY5E0+udOJHVSXEJgfe4hRBTuHjpjHul8ChmWnQf3zSCDXf/LSSGDQ2A29m XA0VzgtKYIXCe64QyD+4NMQPvJd1QK29tddhKuU15z75Fo3wxZxo/T5gvx/tBOCxF3FC 3psAX2sLvO7+pI+HzurZHR85RMdD4SlylQvmOnIUITRkmz7wx6XUpkxEnFDHyq7nEp7q wXAjMlrYbSAMXsq7HBDFpEefYz/JwILDQQZNcCgR00UyH6F6byZeJUe2Sz/C+jfcy3O+ zwTw== 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=90u6T2Iz8RuWHkt12ViWEvTOnYjHdwHBnJQxYa7+8Z4=; b=HkVJHNIukc2S0CQsgk3j9fJCecIQm4Wb8idf1+OVl9LdEqZUcQ3BksN+Z/mUrxXZB4 j4cWpKHMPvUMbivYOULzKuRcXxZI3wRa7A4Z+OVxAKhjXhh/DpL1iqVQOxBcSR4tyzrf 58lCNrmKA2T8XojP0RmPJvUK81Gba4AjIHomh4dmOh6PWVAJE+tEzieC2ZJ/+1+BmU/I BkNkfTRwrFzSLU9X/Osxd7Xm1ylJzE/9ULNRpKjLW52xLJg+ErenDmDyL6FQLRrb4nUs 8vDtYpuX0GUTHKn5TYpcuq22ee90E03EG5BaHouzlhxgUpkV8xw1SRwOP+LvE+OLf1yN 3Piw== X-Gm-Message-State: APjAAAX5MeqC7Dr2hoQbjt0BPJvglGNMC92T1o2QevoDcK0UsCvtRDly hxD1hIPMKrfmQnJdtoNEHQwXNhu18BVlCffc7RlzQxASiJngDw== X-Google-Smtp-Source: APXvYqzVF3Cd6j20Cx9JVhah1L5e8BRMfkaA/sP7xjwOoklrqzZsTHBN39DZHQnqwgcMFrsWDxEt9p72mj7poITvwiI= X-Received: by 2002:a2e:3014:: with SMTP id w20mr9741450ljw.115.1570802087197; Fri, 11 Oct 2019 06:54:47 -0700 (PDT) MIME-Version: 1.0 Date: Fri, 11 Oct 2019 15:54:31 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000006b7f890594a2dc1f" X-Envelope-From: Subject: Warning for "confusable" types From: nikita.ppv@gmail.com (Nikita Popov) --0000000000006b7f890594a2dc1f Content-Type: text/plain; charset="UTF-8" Hi internals, Something I've seen play out a couple of times: Newbies try to use something like "integer" or "resource" as a type, and then get a confusing error message along the lines of "must be an instance of resource, resource given". I would like to throw a compiler warning in this case, that looks as one of the following: > Warning: "integer" will be interpreted as a class type. Did you mean "int"? Use qualified name or "use" to suppress this warning > Warning: "resource" is not a supported builtin type and will be interpreted as a class type. Use qualified name or "use" to suppress this warning This warning only triggers if the type is lowercase (integer but not Integer), is unqualified (integer but not \integer) and is not imported (there is no "use integer"). This provides multiple ways to avoid the warning for code that does legitimately want to use lowercase "integer" as a class type. Implementation: https://github.com/php/php-src/pull/4815 Thoughts? Nikita --0000000000006b7f890594a2dc1f--