Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107568 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73274 invoked from network); 17 Oct 2019 23:10:11 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 17 Oct 2019 23:10:11 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 8892A2D1FC3 for ; Thu, 17 Oct 2019 13:54:54 -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=0.0 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (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 ; Thu, 17 Oct 2019 13:54:53 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id h202so1134293ybg.13 for ; Thu, 17 Oct 2019 13:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:mime-version:subject:message-id:date:to; bh=xCXxhn2ij2Nlvbp+oK+Kb3yplgS3F5Rq2tK37NBhTIo=; b=VUTdHvEVW7SThwswal2LunkiIJxuSCFjw6JuSsM8Covl+zAYi4WQUqZjkbyFC9f8nM FTudaf74BmdXb8hZvikkfaGbBh1jNxGhjC39ZSVaG5JYnz8gqEm2k+JD7VJUgm7oDtiD uSyoOMQ7enEAZtqhD3oEaoQg9ji2h8bZij6qV/Bq7iou6/EHN73ttbed6TxwpKhqauF4 DzJh+YzKXgnCC1Y9301cCpoaiaqiTWrFPnVw1XMtY/pGBWLR2UWpCxYNAXniat+YIMkP FB5+wupxsPZjmc0BbrQfl2xmSNaFZbzMvgcjNiDS0Y4N8J0knGU78jtIah1sk/xugVah 0pYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=xCXxhn2ij2Nlvbp+oK+Kb3yplgS3F5Rq2tK37NBhTIo=; b=YLAivDm/UHCh1Uhc1DE1cH9AlZAdCWBrZEKj3Se02K70FsZ+bDOPjo+tcX4LTa/sFW t4dJlLNZ1cKkDp73TR2hIVL6oiQmf4ku5231KMrauVKixeWk32bPz7lFe66x5KuYxtL9 zrw83DcAO+8eB1clsUMhPIDuB8hzQNbsPPKGROf/vQK+JMnoRVybG9Fzs18aQrsyMak2 YZFqLzh/7nl0zs+p9DBGy7myyDhLBYPYXi8UwryLJTQMdpAXpyJQsfDGC3FBVaa2cCoy YW7DGIQz/wt9y47jzkAvnvyZhMXmjBn4taHfu9OoBTN4OwPBplDCQIzJ6UtIC32YpV37 boyA== X-Gm-Message-State: APjAAAVuxYFW2JukUoduIyq9E7BwCGB3bPBstFhpqNQJCTbqKvmSzaRy fYeV4lE+OKWJNVXFv+iROzbbB8PMgepR8Q== X-Google-Smtp-Source: APXvYqwuVxvm2UWMOo3rFY36ILW2vbq9Hlcg1e6hgIZvsuipdciYsZNuaYiAHBOUEVqwJCYKofOibw== X-Received: by 2002:a25:38d6:: with SMTP id f205mr3822802yba.218.1571345692953; Thu, 17 Oct 2019 13:54:52 -0700 (PDT) Received: from ?IPv6:2601:c0:c67f:e34e:84d9:e259:ce20:1fe5? ([2601:c0:c67f:e34e:84d9:e259:ce20:1fe5]) by smtp.gmail.com with ESMTPSA id h19sm764935ywi.33.2019.10.17.13.54.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Oct 2019 13:54:52 -0700 (PDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_8EF53E35-D94C-452E-828F-DEA2EFE8C5D7" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Message-ID: <929062F1-E83F-4D81-B2C6-3916B744E101@newclarity.net> Date: Thu, 17 Oct 2019 16:54:51 -0400 To: PHP Internals X-Mailer: Apple Mail (2.3445.104.11) X-Envelope-From: Subject: Adding explicit intent for SWITCH/CASE fall through? From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_8EF53E35-D94C-452E-828F-DEA2EFE8C5D7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi All, Before creating an RFC I wanted to get reactions to the idea of adding = FALLTHROUGH option to SWITCH/CASE for when the developer explicitly want = logic to fall through to the next case and does not want to use a BREAK. My simples motivation for this feature is that my IDE (PhpStorm) always = flags CASE statements w/o BREAKs because it cannot know when I intend = for the logic to fallthrough and not break. If there was an optional = FALLTHROUGH then my IDE could flag any CASE statements that do not have = a FALLTHROUGH or BREAK =E2=80=94 which would indicate an error of my = intent =E2=80=94 and avoid flagging all the situations where I = intentionally want it to fall through. Beyond that, this might also be useful for other static analysis tools = such as PhpStan. Ust=20 Additionally it could be added in 8.0 and then in 8.1 flagged with a = warning when a CASE does not have one for the two, but only if people = don't object to this. While I know some on this list feel strongly that = warnings must come with to future plans to generate errors I would = personally be 100% okay if it indefinitely generated only a warning. In summary I want a mechanism to be allow me to explicitly indicate my = intent with respect to SELECT/CASE statements. What do you think? Is = this worthy of an RFC, or is there some reason a majority would object = to such an addition? Thanks in advance. -Mike --Apple-Mail=_8EF53E35-D94C-452E-828F-DEA2EFE8C5D7--