Changeset 124

Show
Ignore:
Timestamp:
09/19/06 20:15:00 (2 years ago)
Author:
mrook
Message:

Add 'haltonfailure' option (contributed by Stefan Priebsch)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/phing/tasks/ext/PhpLintTask.php

    r114 r124  
    66 * 
    77 * @author   Knut Urdalen <knut.urdalen@telio.no> 
     8 * @author   Stefan Priebsch <stefan.priebsch@e-novative.de> 
    89 * @package  phing.tasks.ext 
    910 */ 
     
    1213  protected $file;  // the source file (from xml attribute) 
    1314  protected $filesets = array(); // all fileset objects assigned to this task 
     15 
     16  protected $haltOnFailure = false; 
     17  protected $hasErrors = false; 
     18 
     19  /** 
     20   * The haltonfailure property 
     21   * @param boolean $aValue 
     22   */ 
     23  public function setHaltOnFailure($aValue) { 
     24    $this->haltOnFailure = $aValue; 
     25  } 
    1426 
    1527  /** 
     
    4456      $project = $this->getProject(); 
    4557      foreach($this->filesets as $fs) { 
    46         $ds = $fs->getDirectoryScanner($project); 
    47         $files = $ds->getIncludedFiles(); 
    48         $dir = $fs->getDir($this->project)->getPath(); 
    49         foreach($files as $file) { 
    50           $this->lint($dir.DIRECTORY_SEPARATOR.$file); 
    51        
     58              $ds = $fs->getDirectoryScanner($project); 
     59              $files = $ds->getIncludedFiles(); 
     60              $dir = $fs->getDir($this->project)->getPath(); 
     61              foreach($files as $file) { 
     62                $this->lint($dir.DIRECTORY_SEPARATOR.$file); 
     63             
    5264      } 
    5365    } 
     66 
     67    if ($this->haltOnFailure && $this->hasErrors) throw new BuildException('Syntax error(s) in PHP files'); 
    5468  } 
    5569 
     
    6882        if(!preg_match('/^No syntax errors detected/', $message[0])) { 
    6983          $this->log($message[1], PROJECT_MSG_ERR); 
     84    $this->hasErrors = true; 
    7085        } else { 
    7186          $this->log($file.': No syntax errors detected', PROJECT_MSG_INFO);