PHP Classes
elePHPant
Icontem

File: phpcf-src/styles/example/context-rules.php

Recommend this page to a friend!
  Classes of Alex Krash  >  PHP Code formatter  >  phpcf-src/styles/example/context-rules.php  >  Download  
File: phpcf-src/styles/example/context-rules.php
Role: Configuration script
Content type: text/plain
Description: Configuration script
Class: PHP Code formatter
Reformat PHP code according to standard options
Author: By
Last change:
Date: 5 years ago
Size: 565 bytes
 

 

Contents

Class file image Download
<?php
// you need to modify $fsm_context_rules that is presented as array( CTX_NAME => array( TOKEN_NAME => RULE ) )
// we will add context "CTX_NAMESPACE_D" for namespace definition

// add CTX_NAMESPACE_D to stack when see token T_NAMESPACE in CTX_PHP (default PHP code context)
$fsm_context_rules['CTX_PHP']['T_NAMESPACE'] = ['CTX_NAMESPACE_D'];

// define context switch rules for our context 'namespace definition' (rules are very simple):
$fsm_context_rules['CTX_NAMESPACE_D'] = [
   
';' => -1, // when see ";", pop current context and return to CTX_PHP
];