Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105151 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 74277 invoked from network); 8 Apr 2019 19:20:42 -0000 Received: from unknown (HELO mail-ed1-f50.google.com) (209.85.208.50) by pb1.pair.com with SMTP; 8 Apr 2019 19:20:42 -0000 Received: by mail-ed1-f50.google.com with SMTP id x61so12203578edc.9 for ; Mon, 08 Apr 2019 09:17:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=/1LOXtXvEuGeMxRyShYviFGD4Gzgzb6k9nRVUc7kwbg=; b=WycuM3z28XFGEvABdTkZiDQq8F+U/tufynudatwuMcXYuWy/flm0d89v+cTLqNB2Mp H43c5LwchKR+QP0t54bSlddDbtz/1qWZBCKM1na/7EzcfaReiaTdEVUnCmRL2lCSitNP ZnPlFLcMhnw10sGlszJ+O9AYRO0AcN/JBQCNgzsH35pf0d7PvMIF7pazdQNVqIWC6GKI Rxig7za/OhwNQoPw3nu5hgQNk1LqPeCLI4lTLV4PAwLmkPgeJqflDu8JrVwe4+Q6U5pj 1vcrUDVaZ/Doj/dRxdD987/qHBjeaK4cOlo9ComBSCaUBbgBb8sWPYgzWTPi3qQ3yBNN sxHg== 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=/1LOXtXvEuGeMxRyShYviFGD4Gzgzb6k9nRVUc7kwbg=; b=ONRqkyPOG+r7gSiyLz4fJI8m0q1zKCKfbtYGFjYIg5jwsjsfIoyyLCsI57Et/p257I PwV+we6Bgu81BESxlaPTcRVp0vd8UghtE//DxHKtSV+KJKEJoRb330LfzQ5Amsybev/i id5vkhIMETNeK6hwwiXCMo7TfLxagrG4ni1TKnqJ/fT3FZZ309vxLDeZcgyszFjFka49 9QkgywycAD+OZ65E6WhnbLW2J+Toz4GAeK0A+ZZ97DMfs1vBiMygIzW9NA7c5r3wT9so nvYD0zuJPz42XTDoh1GdPshNA1UDUDbVfliNjILNUJDC8WXURSeQ94rXttfgyHAEcxv0 1ZEQ== X-Gm-Message-State: APjAAAVE8M6w0DcJFSHm8kpyp/18htRHDoDfDd/St3q14YON8HSW8kpt R9aMhl6tSe4Qrru6YNQDdQY= X-Google-Smtp-Source: APXvYqzXBquyD06dS40XXMREhtA80VCnxlkL8U+56JOp5DE7f4NfekH/Xp++HlrcvbFw/0GQI6yPwA== X-Received: by 2002:aa7:d819:: with SMTP id v25mr17409383edq.70.1554740242039; Mon, 08 Apr 2019 09:17:22 -0700 (PDT) Received: from [192.168.0.63] (84-75-30-51.dclient.hispeed.ch. [84.75.30.51]) by smtp.gmail.com with ESMTPSA id s44sm5349156edd.49.2019.04.08.09.17.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Apr 2019 09:17:20 -0700 (PDT) Message-ID: <560F6C05-C7F0-4D62-8086-D9A6E2DC2C48@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_0BFDD784-ACD1-4593-99CC-4F53C9BE8BA7" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Date: Mon, 8 Apr 2019 18:17:19 +0200 In-Reply-To: Cc: Dan Ackroyd , Guilliam Xavier , PHP internals To: David Rodrigues References: X-Mailer: Apple Mail (2.3445.104.8) Subject: Re: [PHP-DEV] [RFC] Nullable Casting From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_0BFDD784-ACD1-4593-99CC-4F53C9BE8BA7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 8 avr. 2019 =C3=A0 07:05, David Rodrigues = a =C3=A9crit : >=20 > And about "settype($variable, "?int")" it was requested on original = mailing > by Claude Pache. PHP has several ways to perform casting: 1. (int) $foo 2. settype($foo, 'int'); 3. intval($foo) They are occasions where the programmer will prefer one method to the = other. For example: 1. foo((int) $bar) 2. settype($someNonTrivial[$expr]['ession'], 'int'); 3. array_map('intval', $foo) The `intval($foo)` family of functions might be replaced by `function = ($foo) { return (int) $foo; }` (or maybe soon by `fn($foo) =3D> (int) = $foo`), so that it might not be a necessity to double them with = `intvalIfNotNull($foo)`, etc. functions (also, finding a good name is = not evident). But as for `settype()`, it cannot be replaced by casting = syntax in case the target type is not written literally in source code; = so that we should continue to fully support it. (And see = https://externals.io/message/103779#103805 = for real world usages.) =E2=80=94Claude --Apple-Mail=_0BFDD784-ACD1-4593-99CC-4F53C9BE8BA7--