Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

?? operator leads to Internal formatter error #21

Closed
alexeyrybak opened this issue Oct 14, 2019 · 2 comments
Closed

?? operator leads to Internal formatter error #21

alexeyrybak opened this issue Oct 14, 2019 · 2 comments

Comments

@alexeyrybak
Copy link
Contributor

alexeyrybak commented Oct 14, 2019

PHP7 null coalescing operator (??) - stuck in "CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN" state:

cat ternary.php
<?php

$a = $b ?? $c;
$a = 0;

?>

phpcf check -d ternary.php
         1                         T_OPEN_TAG     <?php                              CTX_PHP
         3                       T_WHITESPACE     \n\n                               CTX_PHP
         3                         T_VARIABLE     $a                                 CTX_PHP
         3                       T_WHITESPACE                                        CTX_PHP
         3                                  =     =                                  CTX_PHP
         3                       T_WHITESPACE                                        CTX_PHP
         3                         T_VARIABLE     $b                                 CTX_PHP
         3                       T_WHITESPACE                                        CTX_PHP
         3                                  ?     ?                                  CTX_PHP / CTX_TERNARY_BEGIN
         3                                  ?     ?                                  CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         3                       T_WHITESPACE                                        CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         3                         T_VARIABLE     $c                                 CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         3                                  ;     ;                                  CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         4                       T_WHITESPACE     \n                                 CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         4                         T_VARIABLE     $a                                 CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         4                       T_WHITESPACE                                        CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         4                                  =     =                                  CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         4                       T_WHITESPACE                                        CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         4                          T_LNUMBER     0                                  CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         4                                  ;     ;                                  CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
         6                       T_WHITESPACE     \n\n                               CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN
ternary.php:Internal formatter error: final state must be CTX_PHP or CTX_DEFAULT, got 'CTX_PHP / CTX_TERNARY_BEGIN / CTX_TERNARY_BEGIN'
@Sannis
Copy link
Member

Sannis commented Dec 10, 2019

@alexeyrybak it looks like you use phpcf for PHP7 code with PHP5 interpreter.
Such option is not supported and I think will not be supported from our side :-/

@alexeyrybak
Copy link
Contributor Author

F.M.L.! closing, thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants