syntax error, unexpected token “:”, expecting “]”

Description

Colons are used with the ternary operators, labels and named parameters. They may also be involved in a typo with a double colon, that lost one half of its elements.

Example

<?php

#[A\Bc: 'D')]

?>

Solutions

  • Add the missing parenthesis between the B attribute name and the c named parameter.