Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99707 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41250 invoked from network); 3 Jul 2017 15:30:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2017 15:30:12 -0000 X-Host-Fingerprint: 62.180.109.77 unknown Received: from [62.180.109.77] ([62.180.109.77:23429] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/82-15131-3036A595 for ; Mon, 03 Jul 2017 11:30:12 -0400 Message-ID: To: internals@lists.php.net References: Date: Mon, 3 Jul 2017 17:30:07 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 62.180.109.77 Subject: Re: [RFC] [Discussion] Class Naming From: gmblar@gmail.com (Andreas Treichel) With any exception from PascalCase you cannot e.g. generate class names from strings without a explicit mapping table: documentElement->tagName; $className = ucfirst($tagName) . 'Parser'; if (!class_exists($className)) { throw new RuntimeException('Parser not found for '.$tagName); } return new $className(); } $document = new DomDocument(); $document->loadXml($xml); $parser = findParserByRootNode($document); $parser->parse($document); acronyms in PascalCase looks strange, but consistent strange.