Michael Mayer, I think your suggestion sounds like a good idea. My main 
point originally was to keep the declare() statements close to the <?php 
because they change how the language works. An example of what your 
suggestion might look like:

<?php
declare(strict_types=1);
declare(encoding='ISO-8859-1');
declare(ticks=1);

/**
 * Hello. I am a file-level DocBlock.
 * I hope you are enjoying the example.
 */

use Foo\Bar\Baz;
use InvalidArgumentException;

/**
 * Class Thing is a wonderful class,
 * the best class.
 */
class Thing extends Baz
{
    ...
}

I left the <?php and declare() statements touching because I feel that 
they're closely related, but a blank line between other blocks should still 
remain. What does everyone think?

-Michael


On Sunday, December 4, 2016 at 2:01:09 PM UTC-5, Michael Mayer wrote:
>
> But we already have today:
>
> declare(encoding='ISO-8859-1');
> declare(ticks=1);
>
> And for both holds: *the file is running a special mode of PHP, not the 
> usual one.*
> – Should I write all of them in the first line, or is strict_types such 
> special?
> – And, if so, what makes it such special?
>
> Furthermore, at least for ticks, I see valid multi-line use cases:
>
> Block declare statements are allowed and MUST be formatted as below. Note 
>> position of braces and spacing:
>> declare(ticks=1) {
>>     //some code
>> }
>>
>
> Moreover:
>
>  Each block MUST be in the order listed below, although blocks that are 
>> not relevant may be omitted.
>>    
>>    - File-level docblock.
>>
>>
>>    - One or more declare statements.
>>
>>
>>    - The namespace declaration of the file.
>>
>>
>>    - …
>>
>> Hence, I know where they are, and *I don't need to scan around doc 
> blocks and namespace declarations.*
>
> Sorry, but I cannot see at the moment, how a consistent style 
> recommendation may look like with that change.
> However, I understand that declare statements are more important than the 
> *File-level 
> docblock –* thus why
> not move them to the top of the list instead?
>
> Best regards,
> Michael Mayer
>
> Am Sonntag, 4. Dezember 2016 18:50:55 UTC+1 schrieb Jordi Boggiano:
>>
>> I'm with Rudolph on this one, as I replied in the survey that was sent a 
>> while back. IMO it should be on the first line to make sure it's visible 
>> and not missed because it is such a meaningful line. It completely 
>> changes the way the engine works, it's not php anymore, but strict php, 
>> and you better be aware of it. 
>>
>> As for the fear that more flags will be added, well of course it's 
>> possible but IMO unlikely. In any case we can revisit that topic if 
>> needed when we have more flags, I don't think we need to set the rule of 
>> today based on future unknowns. 
>>
>> Cheers 
>>
>> On 04/12/2016 14:48, Michael Mayer wrote: 
>> > I disagree too. 
>> > 
>> > What, if PHP8 will introduce a new execution directive and PHP9 as well 
>> > etc. And all of these are considered as good practice. 
>> > Where should I put them? All in the same line? 
>> > 
>> > | 
>> > <?php 
>> > 
>> declare(strict_types=1);declare(php8_directive=1);declare(php9_directive=1); 
>>
>> > 
>> > useFoo\Bar\Baz; 
>> > 
>> > classThingextendsBaz 
>> > { 
>> > } 
>> > | 
>> > 
>> > Ewww! 
>> > 
>> > Best regards, 
>> > Michael Mayer 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "PHP Framework Interoperability Group" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> > an email to [email protected] 
>> > <mailto:[email protected]>. 
>> > To post to this group, send email to [email protected] 
>> > <mailto:[email protected]>. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/php-fig/07f36815-e178-42ee-b76c-42fa446fbfd9%40googlegroups.com
>>  
>> > <
>> https://groups.google.com/d/msgid/php-fig/07f36815-e178-42ee-b76c-42fa446fbfd9%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>  
>>
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>>
>> -- 
>> Jordi Boggiano 
>> @seldaek - http://seld.be 
>>
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/6966a531-618d-4c2a-9236-2b97f5a2c78f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to