Flitch\Rule\Naming\Classes::setFormat PHP Method

setFormat() public method

Set format.
public setFormat ( string $format ) : Classes
$format string
return Classes
    public function setFormat($format)
    {
        $this->format = $format;
        return $this;
    }

Usage Example

Example #1
0
 public function testClassNaming()
 {
     $tokenizer = new Tokenizer();
     $file = $tokenizer->tokenize('foo.php', "<?php class foo {} class bar {}");
     $file->rewind();
     $file->seekTokenType(T_CLASS);
     $rule = new Classes();
     $rule->setFormat('bar');
     $rule->visitToken($file);
     $this->assertRuleViolations($file, array(array('line' => 1, 'column' => 13, 'message' => 'Class name does not match format "bar"', 'source' => 'Flitch\\Naming\\Classes')));
 }