Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108232 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 50314 invoked from network); 24 Jan 2020 21:13:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jan 2020 21:13:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 046EA180565 for ; Fri, 24 Jan 2020 11:22:45 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f44.google.com (mail-yw1-f44.google.com [209.85.161.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 24 Jan 2020 11:22:44 -0800 (PST) Received: by mail-yw1-f44.google.com with SMTP id i190so1388321ywc.2 for ; Fri, 24 Jan 2020 11:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=4drGeCJTMXi3f+fsYHzVeAbYuhkQZBLEBPNG0wSWn3o=; b=HrHoqidM4xMQmEUDm8a9+wBmrq9srnHX8fqAtCYZ9KRupmxDi4MLkQljdLTiw2ktVU SIUIUpAwrYfmQ9YiCmTl413Go14pr0QufSVauCElArp4nBAL4fxvLoJLp+PbBBU92A1z toKvvouzbSjDPIzVrvUQNyMez4p2h+62oJHGXGFLzNmVcjcsuZmiit+vVzfgmWv+k14c m2jwUpLg7IzWDw31ggBoa6y9iomUdQgImFD7KJBctp5NSh7jDYxs4/kxPlWjapw1Q+wI 1bxFDGAGPg0hykhQSH8BY21enYIOzVu4X+sJVJ2R9aLo8cSHf/0tsVAqZ+XWf2m3LsOv eW5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=4drGeCJTMXi3f+fsYHzVeAbYuhkQZBLEBPNG0wSWn3o=; b=AGEclfHuRGDfyQb5VduK8SXOL1+F3Zm0WUW9m0V/W1Yo46sk17yWCIj5M8rBiHsGCx MzyP+/Mmlp9XPB+nQBCUk2QgDkxe7oXHsrxF3ifETXkIyb3aTbpwB62OFAQhXF2pGhFT 9dDsiETqGFnZ4sRYw6ZCZ1dN3sKv8eTCy1zgMClrs2NyQyT5ZOzcDS1UTV/igkCxJDXN eCtlqUUfqxus2Ryvpak7bfGwnIGnnqZIqH/0CwPauhy2jSYc9GcYBD4qMkgKElS1PJCM GcR83hZ/bC4MSOUYUFljC77YUGsAP+EwIWYUGdn9SN0td9TKHC64NpV8zxAm94kC7fV9 r1dQ== X-Gm-Message-State: APjAAAVNxRjZyjkteEgdMAGqRL7jAIAwedWHExRBfmktm6thund6Sepr uq6Bsr/JnlsaATzJu7rfp6VRkckxPSbMzQ== X-Google-Smtp-Source: APXvYqyQKBgomJLPTNZcctcucogS1/BuByWALQw5eYgYGojsD5snWKusl5MfewFK/ogr/6wRAUbO9Q== X-Received: by 2002:a0d:dcc7:: with SMTP id f190mr3475670ywe.193.1579893761879; Fri, 24 Jan 2020 11:22:41 -0800 (PST) Received: from ?IPv6:2601:c0:c680:5cc0:9c03:aa12:eab0:1f6b? ([2601:c0:c680:5cc0:9c03:aa12:eab0:1f6b]) by smtp.gmail.com with ESMTPSA id m62sm2206954ywb.107.2020.01.24.11.22.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jan 2020 11:22:40 -0800 (PST) Message-ID: <3091DC6D-E03B-4AF5-8DC6-F3B2772956BD@newclarity.net> Content-Type: multipart/alternative; boundary="Apple-Mail=_0C896680-D457-4E9B-92E0-9AC7D1AEE561" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Date: Fri, 24 Jan 2020 14:22:39 -0500 In-Reply-To: Cc: PHP internals To: Rasmus Lerdorf References: <5DC86728-1BBF-4DCA-8A6B-9B0B190DB99D@newclarity.net> X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] Typed array properties V2 From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_0C896680-D457-4E9B-92E0-9AC7D1AEE561 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Jan 23, 2020, at 3:04 AM, Rasmus Lerdorf = wrote: > You are getting into static analysis territory here with that. There = are already static analysis tools that do exactly this type of array = type checking during development. For example, there are three type = mistakes in this code: > > Running Phan on it produces: Understood. But in my experience a large number of PHP developers do = not use Phan. At least not in the WordPress realm. For my current project we tried for two days to get Phan to work but it = generated so many errors that were not actually errors we gave up. I am = sure it were possible if we had had the time and expertise to configure = it correctly we could have gotten it working, but I would not be = surprised if we are unique in that respect. IOW, if a tool is very complex to get working, its existence is not a = solution except for advanced teams and use-cases where the benefits are = so overwhelming that teams managers are willing to fund the time it = takes to implement. > Really expensive checks like this belong at the static analysis stage. = And yes, it would be amazing to have a static analyzer built into PHP, = which is basically what you are asking for here,=20 Expensive checks would not be a problem if they could be run once during = OpCode generation without affecting day-to-day code generation, right? > But at Etsy, at least, this code would never make it to production = because static analysis checks are run by all developers and also run = automatically during staging prior to a production push. To be fair, I would say Etsy is an extreme outlier.=20 Few business across the economy are fully web-based, have the revenue of = Etsy and thus the financial downside Esty experiences when there is a = problem on their website. Etsy is exactly the type of use-case I was = referring to where the benefits of using tools like Phan are so = overwhelming that management understands the need. But many other companies won't see such an overwhelming benefit and thus = managers often just don't appreciate the need to work on it. #justsaying > but that is a huge task and goes way beyond just this particular = check. Understood. =20 But my above comments are to point out that the existence of Phan is not = a panacea. -Mike= --Apple-Mail=_0C896680-D457-4E9B-92E0-9AC7D1AEE561--