Yep, I understand. But as long as php don't have annotations like in Java, 
our "annotations" is just comments.
Don't get me wrong, I'm not against annotations, but this just looks ugly. 
Either way, they are handy, because they are right near to code they 
related to, but we don't have annotation mechanism like Java have and we 
shouldn't use it like Java forces Java-ers to use it just because it's not 
Java (or C#).

On Monday, October 22, 2012 11:01:15 PM UTC+4, Marco Pivetta wrote:
>
> While PHPDoc is metadata that is useful and does not have effect on how 
> code behaves, annotations are a quite different concept coming from the 
> java world (where they're actually a construct recognized by the language).
> Don't confuse them, they should not be mixed up. One provides some sort of 
> functionality, the other is just descriptive.
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>
>
>
> On 22 October 2012 09:15, Nikita Nefedov <inef...@gmail.com 
> <javascript:>>wrote:
>
>> Hi,
>>
>> I just though, why we are using so complicated style for declaring 
>> dependencies in annotations?
>> Look: if I want to create some service, that are depends on request, 
>> entity_manager, etc. I need to write that (sorry, don't know how to format 
>> code here):
>>
>> use JMS\DiExtraBundle\Annotation\Service,
>>       JMS\DiExtraBundle\Annotation\Inject,
>>       JMS\DiExtraBundle\Annotation\InjectParams;
>>
>> /**
>>  * @Service
>>   */
>> class Service
>> {
>>
>>     /**
>>      * @InjectParams({
>>      *   "request" = @Inject("request"),
>>      *   "em"       = @Inject("doctrine.orm.entity_manager"),
>>      *   ...
>>      * })
>>      */
>>     public function __construct($request, $em, ...) {}
>> ....
>> }
>>
>> But can't we just use default @param annotation for that purposes?
>> For our example it would be:
>>
>> use JMS\DiExtraBundle\Annotation\Service,
>>       Symfony\Component\HttpFoundation\Request,
>>       Doctrine\ORM\EntityManager;
>>
>> /**
>>  * @Service
>>  */
>> class Service
>> {
>>
>>     /**
>>      * @param Request $request "request"
>>      * @param EntityManager $em "doctrine.orm.entity_manager"
>>      */
>>     public function __construct($request, $em, ...) {}
>> ....
>> }
>>
>>
>> The thing is: we are already at that point, where all this annotations 
>> became ridiculously big (I mean, they are taking more space than code 
>> itself) and from other side - we always write phpdocs, just for documenting 
>> our code. So, why not use phpdocs, that are already can give us a lot of 
>> information, instead of creating a lot of classes for annotations?
>>  -- 
>> If you want to report a vulnerability issue on symfony, please send it to 
>> security at symfony-project.com
>>  
>> You received this message because you are subscribed to the Google
>> Groups "symfony developers" group.
>> To post to this group, send email to symfon...@googlegroups.com<javascript:>
>> To unsubscribe from this group, send email to
>> symfony-devs...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-devs?hl=en
>>
>
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to