<?php declare(strict_types=1);
use Foo\Bar\Baz;
class Thing extends Baz
{
}
--
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 php-fig+unsubscribe@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/6a81f1f0-f2b7-4429-9cf7-4cfe4db7768d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
So I'm for a single version in all cases: <?php and declare() on the same line.
<?php declare(strict_types=1); declare(php8_directive=1); declare(php9_directive=1);
use Foo\Bar\Baz;
class Thing extends Baz
{
}
declare(encoding='ISO-8859-1');
declare(ticks=1);
Block declare statements are allowed and MUST be formatted as below. Note position of braces and spacing:
declare(ticks=1) {
//some code
}
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.
- …
<?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
{
...
}
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/6966a531-618d-4c2a-9236-2b97f5a2c78f%40googlegroups.com.
I'd say the opposite: My brain is already trained to ignore the <?php line as noise, so anything added to that line WOULD be missed.
--
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 php-fig+unsubscribe@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAGOJM6%2B_i-VXu1jtu_kj8pO2TonyKKdGmddXCA-U8-n-7FG75g%40mail.gmail.com.
Well for having worked on a few projects with strict types everywhere, I am not sure. Yes in those projects I tend to ignore it, but that's mostly because I know it's there anyway. The bottom line is it doesn't matter a whole lot visually speaking I suppose. If you open a file and don't know if it has strict types or not, the two following things are probably equally obvious.vsSame same, except we lose two lines for (I'd argue) nothing.. And IMO it belongs with <?php as it really should be <?php-strict or something, given how it changes the language.Anyway I guess it's too late and I won't change the outcome of this, but for the record I have to say it: the day I open a class file and I can't even see the `class` token, I shall weep.CheersJordi
On 5 December 2016 at 20:54, Woody Gilk <woody...@gmail.com> wrote:
--On Mon, Dec 5, 2016 at 12:30 PM, Larry Garfield <la...@garfieldtech.com> wrote:I'd say the opposite: My brain is already trained to ignore the <?php line as noise, so anything added to that line WOULD be missed.
Exactly this.
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 php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAGOJM6%2B_i-VXu1jtu_kj8pO2TonyKKdGmddXCA-U8-n-7FG75g%40mail.gmail.com.
[...] And when the day comes that we get another widely-used declare(), we can still revisit the topic. For the moment, a simple "the strict_types declaration goes in the first line, we don't specify what to do with the others"
--
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 php-fig+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/5ce9a569-7521-4b4d-ae2c-78c71bf73f7b%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAAqcDMi6hnQX_e_7n54jXg_GtOQ8OkC4xZELnmtiNY-QzYO-9Q%40mail.gmail.com.