2022-09-19 21:18 GMT+02:00, Tim Düsterhus <t...@bastelstu.be>:
> Hi
>
> On 9/19/22 21:04, Olle Härstedt wrote:
>> That looks good in isolation, but consider the following short snippet:
>>
>> class Foo
>> {
>>      public function bar()
>>      {
>>          $query = <<<MySQL
>>          SELECT * FROM baz
>> MySQL;
>>      }
>> }
>>
>> As you can see, the heredoc breaks the reading flow completely. For
>
> The closing marker of the heredoc may be indented as of PHP 7.3, so the
> appropriate comparison would be this:
>
> <?php
>
> class Foo
> {
>      public function __construct(
>          private \PDO $dbConnection
>      ) {}
>
>      public function bar()
>      {
>          $query = <<<MySQL
>              SELECT  *
>              FROM    baz
>              MySQL;
>          $statement = $this->dbConnection->prepare($query);
>          $statement->execute();
>      }
> }

Pff, that's the second time today 3v4l gives me complete faulty
results in its syntax checker. Guess it's out of date. Thanks for
correcting me here.

Olle

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to