Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101668 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68584 invoked from network); 25 Jan 2018 16:31:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jan 2018 16:31:08 -0000 Authentication-Results: pb1.pair.com header.from=derokorian@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=derokorian@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.177 as permitted sender) X-PHP-List-Original-Sender: derokorian@gmail.com X-Host-Fingerprint: 209.85.216.177 mail-qt0-f177.google.com Received: from [209.85.216.177] ([209.85.216.177:45117] helo=mail-qt0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/71-61119-7460A6A5 for ; Thu, 25 Jan 2018 11:31:05 -0500 Received: by mail-qt0-f177.google.com with SMTP id x27so20613498qtm.12 for ; Thu, 25 Jan 2018 08:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BJBZhD3QsWlRe3TXMrDR7zcYf86MAKqhOsDkSmTFgjI=; b=P2TkBV0jTbZu93oJvpwpq74IOOXML1g/Ka1TCxYa9XuJrWfgj3KdHMmh/KnF3ONRUK KJ0D6jKm7axaPrnw10msrb3TcWqs0vSMhVImBZto4JZKuR0kIeFbatJGf/y9IYlUaZGi 3jhYKLetP4zSJeyJV0jc1UefcuaiVilvwuKL70GKlbLG6OD9f2MgMzy/JD65znGlaqbz 7xIzTRQOgC5r2n4an7AcRgK+s7LS9Y96svQRtoaDebGhxzJzMb0L3W23IFrpVF82PJ16 MHoNG4hB1vd1v2J8fz9t46pjgVM4gziFE+ciQjYL+y4aKYAJUNmbh00aKOGslrmCeRwp jfwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BJBZhD3QsWlRe3TXMrDR7zcYf86MAKqhOsDkSmTFgjI=; b=D2dVeycEggR93rYT70UROLI4gK5OnD8fiHAqk5e9pHEFCnQfp20Kf+5xIbgFTGt4V+ VekZNFsRrx/mg/k7qUMvPOsCzjNVP3fxiMKlPmoM7APupv2/1QKIU8tdU0qW8fjytNs5 6TQr0NpYJO8ADq0S1y8qXz2ecriteebx8LwuVoGH07uuM4/rCfHb8zbHv25KODSGPAhE bMToUfnxw8za3k/W1PtBLhv5dVn9Rx+Rt5VvC9Ny2hwnaLm4ZPD0UDgeCy/0ZqSk4r4h mJwSGlJh6t7d87dzWCqdabbDJaytCJ/zongLUh+MNfoDlRJuTkhMfmEsd0o7VNkErZ96 Du7Q== X-Gm-Message-State: AKwxytfSBp6SgXEY7Bv0YqfRbUdqa8cWjxiXoSPdglg6FWs6b9dbr+Jg vKbhWHomIkIR+NPbCEWKGrif2u29GvPymPJd+A== X-Google-Smtp-Source: AH8x226YfKjG6MaAstrKj8VpDFfUZjf40KitihxqvSAk4YJh+eSBxdXS0E73yHqqCxyAqhcZQ1FMkLlgUehBiacmlyc= X-Received: by 10.237.34.131 with SMTP id p3mr16875838qtc.70.1516897861139; Thu, 25 Jan 2018 08:31:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.37.119 with HTTP; Thu, 25 Jan 2018 08:31:00 -0800 (PST) In-Reply-To: References: Date: Thu, 25 Jan 2018 09:31:00 -0700 Message-ID: To: Derick Rethans Cc: Michael Morris , PHP internals Content-Type: multipart/alternative; boundary="001a1137b5c42c826705639c4e51" Subject: Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection From: derokorian@gmail.com (Ryan Pallas) --001a1137b5c42c826705639c4e51 Content-Type: text/plain; charset="UTF-8" On Thu, Jan 25, 2018 at 9:21 AM, Derick Rethans wrote: > On Thu, 25 Jan 2018, Ryan Pallas wrote: > > > On Thu, Jan 25, 2018 at 7:52 AM, Derick Rethans wrote: > > > > > On Wed, 24 Jan 2018, Michael Morris wrote: > > > > > > > Ok, here's another idea I've been mulling over. This I know is > possible > > > > because I've done it using user land code, specifically Drupal 8's > > > > Assertion\Inspector class. > > > > > > > > https://api.drupal.org/api/drupal/core%21lib%21Drupal% > > > 21Component%21Assertion%21Inspector.php/class/Inspector/8.5.x > > > > > > > > These methods provide a means to inspect collections - arrays > usually but > > > > also Traversables. They fill a hole in the PHP library - the ability > to > > > > check collection integrity. > > > > > > IMO, it makes a lot more sense to check integrity when creating the > > > "array" structure. Instead, I would suggest to add a native Collection > > > type, that takes a "type" as argument. They aren't quite full generics, > > > but it does 1. fix something; 2. isn't really complicated. > > > > > > What I am suggesting is to add a new syntax "Collection<$type>", > > > mimicking a class, but having a type as "argument": > > > > > > > > Just like to point out if it's considered a class, or takes the same > space > > there is likely collisions. While most collection classes on github look > to > > be in a namespace, there are lots that aren't. Of course github only > gives > > us a view of open source projects that happen to be on github. > > PHP owns the top-level namespace. It has always done that. It's even > documented: http://docs.php.net/manual/en/userlandnaming.rules.php And yet, it's a point of contention that every proposal adding to the root namespace has faced. > > > cheers, > Derick > > -- > https://derickrethans.nl | https://xdebug.org | https://dram.io > Like Xdebug? Consider a donation: https://xdebug.org/donate.php, > or become my Patron: https://www.patreon.com/derickr > twitter: @derickr and @xdebug > --001a1137b5c42c826705639c4e51--