syntax error, unexpected token “>”

Description

This syntax error is characteristic of the pipe operator |> being used in version older than PHP 8.5.

Example

<?php

'abc' |> strtoupper(...);

?>

Solutions

  • Upgrade to PHP 8.5.

  • Nest the calls, instead of using the pipe operator.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.

Static Analysis

This error may be tracked down with the following static analysis rules: Php/PipeOperator.