Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110906 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95893 invoked from network); 9 Jul 2020 19:42:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jul 2020 19:42:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ECC6A18053A for ; Thu, 9 Jul 2020 11:34:09 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (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 ; Thu, 9 Jul 2020 11:34:09 -0700 (PDT) Received: by mail-lf1-f66.google.com with SMTP id y13so1741515lfe.9 for ; Thu, 09 Jul 2020 11:34:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=b/suKBp4x0SaHefeZWutcNFsBnPToy+GY7YfWJQUxt4=; b=CShcYtid7DJ07wQ6Bo21pxe3h/GMQ/oRPzIVnaP81W6rOg/0+j++4iCouOcYiiQurs MEYlIqv2O2e2nJ6HdOXdPNr++BHSdLKAw/3vfgoskxJvBxfiKnaVEjhueDehRjL+gDiA 18L7H8Q/no2mfvf0/u4I+LmQXy/zt0AVu6VmzQpKq0rUTGYaR430s93hKvXrPaVY6FER VjTtWHsW582+mzVVmdoTbMjR3BA/4Cg9+nd7yXkDnDzzvGLjELdn0dnDgmFg9ftlVpt0 Ss4OTd7KAQpdgDQ51vi58fH4e6ky2HjELz+Q2pNRiPRSUOUOkqTzKOHjDrZ4W7Rwb6AC Zrew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=b/suKBp4x0SaHefeZWutcNFsBnPToy+GY7YfWJQUxt4=; b=sEzIvbqK6dOsInCmVGCP0M8YkYoKhVXEUX39qBHz0IfGAV4Z20ribTQn+2SUaDR0Ek N+Q+nRkjS+twa5ACJ3m5r5uTgk/Ej9DZsGCP79xRFCdLOI5b72SAkiILMrIqQhSYKULc 82sFkkUr9pyhAqprbU4+1MBEUQCSfND9N/zOCJgQZE60A2+hWvtH5MUKvt3VEVW5+OnF 8fnyGjWIxRwpzvj8pdrEWSEe+Vm6yog8/pjHN8961qpZ95kKbOzQhI6d4CROV765OXAC kNtWAQ+fWIElPM99u9mz6lJgBKE/bPpHKumsaFWmPObo02O/PqK5C/JZke2yKMl6iwB2 muRQ== X-Gm-Message-State: AOAM533mf/IeZ5L5uQTO9B57+BL3nH9EXLgHsQloalgqPv4z7+dR3LDI Jt+iKGQR0hpaHV7bRTNvINOM63RVzYQpRWcKb/b/pfZ9 X-Google-Smtp-Source: ABdhPJxKwByFDoq8wvUOOaiaLaCz6Lm4i1rW1l/SgkV/dmdP+7Q1DZF7QDUoHfw/PbLuSBy99Zg4bydpWzWo6TRtaLE= X-Received: by 2002:a19:ca48:: with SMTP id h8mr40862802lfj.161.1594319647018; Thu, 09 Jul 2020 11:34:07 -0700 (PDT) MIME-Version: 1.0 References: <65EE4215-3F80-435C-B271-DBE30D26E2CB@joshbruce.dev> In-Reply-To: Date: Thu, 9 Jul 2020 15:33:55 -0300 Message-ID: To: Marco Pivetta Cc: Josh Bruce , PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [CONCEPT][DISCUSSION] Instance as boolean From: marcio.web2@gmail.com (Marcio Almada) Hi, > > Hey Marcio, > >> >> Hi >> >> > >> > Re casting - In the previous thread the following concern was presente= d and I don=E2=80=99t know enough about that area to respond effectively: "= I'd endorse avoiding object-to- casts via cast operations: they are= a good source of bugs. My rationale for the discouragement of magic cast m= ethods is explained with some code examples at https://github.com/ShittySof= t/symfony-live-berlin-2018-doctrine-tutorial/pull/3#issuecomment-460441229= =E2=80=9D >> > >> >> Frankly this is something subject to personal opinions and will change >> over time according to community shifts. >> > > Not sure what's "subject to personal opinions" in the objective bug expos= ed in the snippet above? > So there is a bug in a contrived code snippet therefore casting is a universal bad practice? It's at least a huge stretch. Some might say your bad practice was actually using `null` ;) > Greets, > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/