Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47453 invoked from network); 5 Nov 2014 15:16:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 15:16:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=lisachenko.it@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lisachenko.it@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.43 as permitted sender) X-PHP-List-Original-Sender: lisachenko.it@gmail.com X-Host-Fingerprint: 74.125.82.43 mail-wg0-f43.google.com Received: from [74.125.82.43] ([74.125.82.43:54914] helo=mail-wg0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id ED/10-46265-23F3A545 for ; Wed, 05 Nov 2014 10:16:02 -0500 Received: by mail-wg0-f43.google.com with SMTP id y10so1180168wgg.2 for ; Wed, 05 Nov 2014 07:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=2JMPPmbH+o+dHqxSkIgbheOBYvgs0SBUAM/lYVvorzY=; b=y9YEpY8Qyc7uZ69STsSD+j/rzVMvUHcwS/iEaBjGja81srDn43CUVH1eMUlqpxXG+V 9+VkgEMSzMNHPl4WpFVhthk2P/i0FCHyivLIedD/L3XJYOnNB70mow2gfGC6LQU78hX8 ZFUgf74bZgv1RNWutl7Ae0FZ04Ajxg/yBWUEl30DbBQJhT5yv4m7MrkTfsFjk43MkAB5 Yy9EjRBHXj8KJebWU7pnMMhNJNRTf9z4dalEoItyzHBm/wG1hjN0418pZ9MB7DwV0MeF C+R/utUs8j91JKW3vWAV1Jvaa708STSqIK5rLvT1UOHjG0at8fZesKr8xYMIpplyzdCU Vb+g== MIME-Version: 1.0 X-Received: by 10.194.187.164 with SMTP id ft4mr64950813wjc.76.1415200558849; Wed, 05 Nov 2014 07:15:58 -0800 (PST) Received: by 10.194.42.137 with HTTP; Wed, 5 Nov 2014 07:15:58 -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 18:15:58 +0300 Message-ID: To: Marco Pivetta Cc: "guilhermeblanco@gmail.com" , Andrea Faulds , Stas Malyshev , Benjamin Eberlei , Pierre Joye , Levi Morrison , PHP internals , Larry Garfield Content-Type: multipart/alternative; boundary=047d7b874b2698a5c905071e0ebb Subject: Re: [PHP-DEV] Annotation PHP 7 From: lisachenko.it@gmail.com (Alexander Lisachenko) --047d7b874b2698a5c905071e0ebb Content-Type: text/plain; charset=UTF-8 2014-11-05 17:02 GMT+03:00 Marco Pivetta : > 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; > } > This looks great indeed for many reasons: 1) it's a simple array 2) it can be parsed with built-in DSL syntax for PHP, so any arbitrary evaluations with constants can be applied transparently, e.g. [Loggable::class => ['pointcut' => self::PREFIX . 'test' ]] 3) C# uses similar syntax with square brackets for annotations: public class Foo { [Display(Name="Product Number")] [Range(0, 5000)] public int ProductID { get; set; } } However, I would like to see simple markers without nested associative arrays, e.g just put single AnnotationName::class into brackets or specify multiple annotations in one section: [Entity::class, Table::class => 'foo_table'] class Foo { // ... } --047d7b874b2698a5c905071e0ebb--