Skip to content

inline-config

Check that inline config is only used in block comments. Also check that the inline config is valid JSON.

Examples

  • Examples of correct code for this rule using default options

Correct syntax of inline config

php
<?php
class A {
	// This comment will be ignored by this rule because it is not starting with taqwim
	private $b;
	public $c;
	
	/**
	 * Constructor.
	 *
	 * @param string $b
	 * @param string $c
	 */
	/* taqwim "taqwim/cyclomatic-complexity" : {max: 20} */
	public function __construct($b, $c) {
		$this->b = $b;
		$this->c = $c;
	}
}
  • Examples of incorrect code for this rule using default options

Code with trailing whitespace

php
<?php
class A {
	// taqwim-disable-nextline
	private $b;
	public $c;
	
	/**
	 * Constructor.
	 *
	 * @param string $b
	 * @param string $c
	 */

	/* taqwim "taqwim/cyclomatic-complexity:  max: 0} */
	public function __construct($b, $c) {
		$this->b = $b;
		$this->c = $c;
	}
}

Released under the MIT License.