Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86383 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36621 invoked from network); 25 May 2015 17:56:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2015 17:56:32 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.172 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.213.172 mail-ig0-f172.google.com Received: from [209.85.213.172] ([209.85.213.172:38670] helo=mail-ig0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/00-36604-E4263655 for ; Mon, 25 May 2015 13:56:30 -0400 Received: by igcau1 with SMTP id au1so37416912igc.1 for ; Mon, 25 May 2015 10:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=KRIGEy8GSz+4uVHvKTAFHlULLvqVarU4DIslXZEgxEM=; b=oVQ7d1CeKLs0BQxe4O+aUaUfw5PlkPjiohmJRRYyboI9HGEOQPO2jcPg2irCLg/7+r evb2O1Gd/Intp9/5OBaPN3fZbMHo2vJN4ZdVpKrUmyFflOsJKW/qPNdVzw4EB3w/fis+ 0Lft8AfxPKoF8u6fZuJHuf2Is8QbXwv8D7Lgb0bO3OV6cyhwO7LRt79zCWHt8eVgaF/7 dQ/Z8g7ibBp1fKyge8jdIH7boaF26VUl7PIiaTv4KT8OI8OZSC9J9Rc8eAyygXtoWfVx 1Yn2llvPGXeP1Fn0gKlMfZVhHKWQC8HXWbvOiR8xxIKIgtLXSyvLbW88qeGVRnU8L5Vl ti9g== MIME-Version: 1.0 X-Received: by 10.42.132.6 with SMTP id b6mr21035736ict.8.1432576587850; Mon, 25 May 2015 10:56:27 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.79.98.67 with HTTP; Mon, 25 May 2015 10:56:27 -0700 (PDT) In-Reply-To: <55636034.6010003@mabe.berlin> References: <55636034.6010003@mabe.berlin> Date: Mon, 25 May 2015 11:56:27 -0600 X-Google-Sender-Auth: GkytP4WLjfV-41Hr8NWtA3oRPRM Message-ID: To: Marc Bennewitz Cc: PHP internals list Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] ::class wrong case From: levim@php.net (Levi Morrison) On Mon, May 25, 2015 at 11:47 AM, Marc Bennewitz wrote: > Hi, > > I have noted that detecting a class name using "::class" it will return the > called case instead of the original case. > see http://3v4l.org/97K36 > > That's annoying as I like to check the right class case on autoload to > detect mistakes. > > Sure, class names in PHP are case-insensitive but filesystems aren't and > most autoloader using the FS to find the right file. To catch such kind of > mistakes I would like to implement a fast check in my autoloader to get > noted on development instead on production. It's currently only possible > with ReflectionClass but this will be much slower as with ::class. > > Are there any reasons to get the called case of the class instead or the > original one? The way this is implemented means that the class doesn't even have to exist. It's purely compile-time expansion. The identifier doesn't even have to be a class at all[1]: This was not explained in the RFC at all, and had I known this I would have voted against it personally. [1] It doesn't work when you import a function name with `use function` because it's only intended to work with classes and class-like entities.