From 790954df7b3959af479a71bae0905c1c11a56fb7 Mon Sep 17 00:00:00 2001 From: knut <> Date: Thu, 23 Feb 2006 18:49:14 +0000 Subject: Created an XmlLintTask to validate configuration against XML Schema Definitions and a new target lint-demos to check both syntax of demo configuration and PHP source files --- buildscripts/phing/tasks/PhpLintTask.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'buildscripts/phing/tasks/PhpLintTask.php') diff --git a/buildscripts/phing/tasks/PhpLintTask.php b/buildscripts/phing/tasks/PhpLintTask.php index 63ae6dde..2fd89fc3 100644 --- a/buildscripts/phing/tasks/PhpLintTask.php +++ b/buildscripts/phing/tasks/PhpLintTask.php @@ -34,6 +34,10 @@ class PhpLintTask extends Task { * Execute lint check against PhingFile or a FileSet */ public function main() { + if(!isset($this->file) and count($this->filesets) == 0) { + throw new BuildException("Missing either a nested fileset or attribute 'file' set"); + } + if($this->file instanceof PhingFile) { $this->lint($this->file->getPath()); } else { // process filesets @@ -47,7 +51,6 @@ class PhpLintTask extends Task { } } } - $this->log('No syntax errors detected'); } /** @@ -63,7 +66,9 @@ class PhpLintTask extends Task { $message = array(); exec($command.$file, $message); if(!preg_match('/^No syntax errors detected/', $message[0])) { - throw new BuildException($message[1]); + $this->log($message[1], PROJECT_MSG_ERR); + } else { + $this->log($file.': No syntax errors detected', PROJECT_MSG_INFO); } } else { throw new BuildException('Permission denied: '.$file); -- cgit v1.2.3