Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78721 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39652 invoked from network); 5 Nov 2014 14:03:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 14:03:16 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.54 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.192.54 mail-qg0-f54.google.com Received: from [209.85.192.54] ([209.85.192.54:40716] helo=mail-qg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/00-39230-32E2A545 for ; Wed, 05 Nov 2014 09:03:16 -0500 Received: by mail-qg0-f54.google.com with SMTP id q108so12369805qgd.27 for ; Wed, 05 Nov 2014 06:03:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=viHsNVXCM7pL1Cv+QFkyW7jQ8GWgmE1TKmxd4Mnge/c=; b=avmjl9ip4aAGqQRE8N9r+hm4EplIkOFbrB+SqRaAdhrRQg1fe88a+vwvK2BaQD1ByH UM7LNB9noy23wlxPBmyx4+nY9vU0JEj4wo8owQ3kXVxn4pttkTVz0QqShWpLukfQNcZg KjrY+6Zqy0NwS3hY8j3WWGNkt3kjitiDbprapIitdXFugSdQ5VOYmTW9ovooGRWBVGlp ZrC/3YlLqzU66mgq028uYKPzqprNNWVWjyZIgcxKqG1gWvrLZHCNM4py41MdN2dyuTFw GJt1833jBTj3A6UGHXd7dd/kIMWHGQuRylflMmiEtITKq2jsYHjX6J68U1XYLnZjrkXG zidQ== X-Received: by 10.229.111.201 with SMTP id t9mr28591548qcp.9.1415196191439; Wed, 05 Nov 2014 06:03:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.18.208 with HTTP; Wed, 5 Nov 2014 06:02:51 -0800 (PST) In-Reply-To: References: <5457AF2F.90808@php.net> <5457BDB7.8070701@garfieldtech.com> <54589A8D.3020607@sugarcrm.com> <1C3F4FA3-ABD5-4F6F-A898-F63AC1C723D5@ajf.me> <54591A76.8070302@sugarcrm.com> <967E30E5-71CB-40F8-9AE2-733D327DE197@ajf.me> <545945A5.2090204@sugarcrm.com> Date: Wed, 5 Nov 2014 15:02:51 +0100 Message-ID: To: "guilhermeblanco@gmail.com" Cc: Andrea Faulds , Stas Malyshev , Benjamin Eberlei , Pierre Joye , Levi Morrison , PHP internals , Larry Garfield Content-Type: multipart/alternative; boundary=001a11330fb447463505071d0a4d Subject: Re: [PHP-DEV] Annotation PHP 7 From: ocramius@gmail.com (Marco Pivetta) --001a11330fb447463505071d0a4d Content-Type: text/plain; charset=UTF-8 Hi Guilherme, On 4 November 2014 23:47, guilhermeblanco@gmail.com < guilhermeblanco@gmail.com> wrote: > Sorry, I forgot to add references to how we fixed emails handling. It got > split in 2 places: > > - Initial root level annotation > > https://github.com/doctrine/annotations/blob/master/lib/Doctrine/Common/Annotations/DocParser.php#L350 > > - Subsequent root level annotations > > https://github.com/doctrine/annotations/blob/master/lib/Doctrine/Common/Annotations/DocParser.php#L631 > I'm not sure if we need that sort of syntax and opinionated approach: I like Benjamin's approach better, and it is also simpler and still very easy to use even in our context (doctrine). For example, this alternative approach perfectly fits the current doctrine/annotations use-case: use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\Table; use Doctrine\ORM\Mapping\Id; use Doctrine\ORM\Mapping\GeneratedValue; use Doctrine\ORM\Mapping\Column; [Entity::class => []] [Table::class => ['name' => 'foo_table']] class Foo { [Id::class => []] [GeneratedValue::class => [GeneratedValue::UUID]] [Column::class => ['name' => 'bar_column', 'type' => 'string']] private $bar; } I did nothing special here, just using plain old associative arrays and built-in `::class` pseudo-constants: this leaves space for libraries that do want to use annotations, but not the way doctrine/annotations does it (calling the constructor of an annotation), and the annotations themselves can still decide what to do with nested values. No autoloading is going on, no code execution, nothing: plain and simple arrays which may as well be used for phpdocumentor as well, if needed. Greets, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --001a11330fb447463505071d0a4d--