owebia / magento2-module-advanced-shipping

Other
90 stars 28 forks source link

Unsupported expression PhpParser\Node\Stmt\Nop #65

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hi,

We've the latest version of this library using Magento 2.2.6 and we're getting the following error: Unsupported expression PhpParser\Node\Stmt\Nop

Our config is:

if ($request->dest_country_id == 'GB') {
    addMethod('uk_mainland_1', ['title' => "DPD Next Day", 'price' => 5.95]);
    addMethod('uk_mainland_2', ['title' => "DPD Before 12", 'price' => 7]);
    addMethod('uk_mainland_3', ['title' => "DPD Before 10:30", 'price' => 9]);
    addMethod('uk_mainland_4', ['title' => "DPD Saturday", 'price' => 12.5]);
    addMethod('uk_mainland_5', ['title' => "Royal Mail 2nd Class", 'price' => 4.5]);
    addMethod('uk_mainland_6', ['title' => "Royal Mail 1st Class", 'price' => 6]);
    //    Countries: Guernsey, Isle Of Man, Jersey
} elseif ($request->dest_country_id == 'GG') {
    addMethod('uk_offshore_3', ['title' => "DPD Two Day", 'price' => 16]);
    addMethod('uk_offshore_4', ['title' => "Royal Mail 2nd Class", 'price' => 6.5]);
}

This is the result:

dest_country_id
$request
$request->dest_country_id
$request->dest_country_id == 'GB'
"DPD Next Day"
['title' => "DPD Next Day", 'price' => 5.95]
addMethod('uk_mainland_1', ['title' => "DPD Next Day", 'price' => 5.95])
addMethod('uk_mainland_1', ['title' => "DPD Next Day", 'price' => 5.95])
"DPD Before 12"
['title' => "DPD Before 12", 'price' => 7]
addMethod('uk_mainland_2', ['title' => "DPD Before 12", 'price' => 7])
addMethod('uk_mainland_2', ['title' => "DPD Before 12", 'price' => 7])
"DPD Before 10:30"
['title' => "DPD Before 10:30", 'price' => 9]
addMethod('uk_mainland_3', ['title' => "DPD Before 10:30", 'price' => 9])
addMethod('uk_mainland_3', ['title' => "DPD Before 10:30", 'price' => 9])
"DPD Saturday"
['title' => "DPD Saturday", 'price' => 12.5]
addMethod('uk_mainland_4', ['title' => "DPD Saturday", 'price' => 12.5])
addMethod('uk_mainland_4', ['title' => "DPD Saturday", 'price' => 12.5])
"Royal Mail 2nd Class"
['title' => "Royal Mail 2nd Class", 'price' => 4.5]
addMethod('uk_mainland_5', ['title' => "Royal Mail 2nd Class", 'price' => 4.5])
addMethod('uk_mainland_5', ['title' => "Royal Mail 2nd Class", 'price' => 4.5])
"Royal Mail 1st Class"
['title' => "Royal Mail 1st Class", 'price' => 6]
addMethod('uk_mainland_6', ['title' => "Royal Mail 1st Class", 'price' => 6])
addMethod('uk_mainland_6', ['title' => "Royal Mail 1st Class", 'price' => 6])
Unsupported expression PhpParser\Node\Stmt\Nop

Any ideas?

owebia commented 5 years ago

Hi,

Just avoid comments before closing brackets "}". This will be fixed in next release.

Best regards, A.L.

owebia commented 5 years ago

Fixed in version 2.6.4