Plugin-php: Breaking change: removes braces inside double quotes

Created on 13 Mar 2018  路  7Comments  路  Source: prettier/plugin-php

Input:

<?php
class test {
    public function test_method() {
        $customer = (object) [ 'name' => 'Bob' ];
        $job = (object) [ 'customer' => $customer ];

        return "The customer for that job, {$job->customer->name}.";
    }
}

Output

<?php
class test
{
    public function test_method()
    {
        $customer = (object) ['name' => 'Bob'];
        $job = (object) ['customer' => $customer];

        return "The customer for that job, $job->customer->name.";
    }
}

Expected output:

<?php
class test
{
    public function test_method()
    {
        $customer = (object) ['name' => 'Bob'];
        $job = (object) ['customer' => $customer];

        return "The customer for that job, {$job->customer->name}.";
    }
}
bug high-pri

All 7 comments

Just checked this against the latest code base (I didn't realize I was behind) and it is still an issue.

Related: #6

Semi related but on the pretty we add the high-pri label for anything that would either cause a syntax error or worse, a different behavior. I would recommend doing something similar, this way it's easy to look at the issues (open and closed) and find out all the things that are/were breaking.

Good idea - i created and added the high-pri label!

@cmancone can you check this again against the most recent version of master? I believe it should have been fixed with #251

@mgrip I should be able to later today or tomorrow

@mgrip I can confirm that with the latest updates this is now working

Was this page helpful?
0 / 5 - 0 ratings

Related issues

czosel picture czosel  路  4Comments

alexander-akait picture alexander-akait  路  5Comments

czosel picture czosel  路  6Comments

hawkrives picture hawkrives  路  3Comments

czosel picture czosel  路  5Comments