diff --git a/classes/phing/filters/TranslateGettext.php b/classes/phing/filters/TranslateGettext.php index 953fabbb40..764bfb2383 100644 --- a/classes/phing/filters/TranslateGettext.php +++ b/classes/phing/filters/TranslateGettext.php @@ -234,12 +234,12 @@ public function read($len = null) // also match gettext() -- same as above $buffer = preg_replace_callback( - '/([^\w]|^)_\("((\\\"|[^"])*)"\)/', + '/(\W|^)_\("((\\\"|[^"])*)"\)/', [$this, 'xlateStringCallback'], $buffer ); $buffer = preg_replace_callback( - '/([^\w]|^)gettext\("((\\\"|[^"])*)"\)/', + '/(\W|^)gettext\("((\\\"|[^"])*)"\)/', [$this, 'xlateStringCallback'], $buffer ); @@ -249,7 +249,7 @@ public function read($len = null) // Check to see if there are any unmatched gettext() calls -- and flag an error $matches = []; - if (preg_match('/([^\w]|^)(gettext\([^\)]+\))/', $buffer, $matches)) { + if (preg_match('/(\W|^)(gettext\([^\)]+\))/', $buffer, $matches)) { $this->log("Unable to perform translation on: " . $matches[2], Project::MSG_WARN); } diff --git a/classes/phing/listener/NoBannerLogger.php b/classes/phing/listener/NoBannerLogger.php index 36918bca21..006651df06 100644 --- a/classes/phing/listener/NoBannerLogger.php +++ b/classes/phing/listener/NoBannerLogger.php @@ -55,9 +55,8 @@ public function targetFinished(BuildEvent $event) */ public function messageLogged(BuildEvent $event) { - if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() || trim( - $event->getMessage() === "" - ) + if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() || + trim($event->getMessage()) === '' ) { return; } diff --git a/classes/phing/tasks/ext/ComposerTask.php b/classes/phing/tasks/ext/ComposerTask.php index be79ded318..5cf548efe5 100644 --- a/classes/phing/tasks/ext/ComposerTask.php +++ b/classes/phing/tasks/ext/ComposerTask.php @@ -149,7 +149,7 @@ private function prepareCommandLine() //We are un-shifting arguments to the beginning of the command line because arguments should be at the end $this->commandLine->createArgument(true)->setValue($this->getCommand()); $this->commandLine->createArgument(true)->setValue($this->getComposer()); - $commandLine = strval($this->commandLine); + $commandLine = (string)$this->commandLine; //Creating new Commandline instance. It allows to handle subsequent calls correctly $this->commandLine = new Commandline(); diff --git a/classes/phing/tasks/ext/coverage/CoverageSetupTask.php b/classes/phing/tasks/ext/coverage/CoverageSetupTask.php index 692107e880..6a3f3f9075 100644 --- a/classes/phing/tasks/ext/coverage/CoverageSetupTask.php +++ b/classes/phing/tasks/ext/coverage/CoverageSetupTask.php @@ -113,7 +113,7 @@ private function getFilenames() try { $list = $fl->getFiles($this->project); foreach ($list as $file) { - $fs = new PhingFile(strval($fl->getDir($this->project)), $file); + $fs = new PhingFile((string)$fl->getDir($this->project), $file); $files[] = ['key' => strtolower($fs->getAbsolutePath()), 'fullname' => $fs->getAbsolutePath()]; } } catch (BuildException $be) { diff --git a/classes/phing/tasks/ext/dbdeploy/DbDeployTask.php b/classes/phing/tasks/ext/dbdeploy/DbDeployTask.php index 5dab17e250..146e7cf8c2 100644 --- a/classes/phing/tasks/ext/dbdeploy/DbDeployTask.php +++ b/classes/phing/tasks/ext/dbdeploy/DbDeployTask.php @@ -310,7 +310,7 @@ protected function getDeltasFilesArray() $fileChangeNumberPrefix = ''; while (($file = readdir($dh)) !== false) { if (preg_match('[\d+]', $file, $fileChangeNumberPrefix)) { - $files[intval($fileChangeNumberPrefix[0])] = $file; + $files[(int)$fileChangeNumberPrefix[0]] = $file; } } diff --git a/classes/phing/tasks/ext/inifile/IniFileTask.php b/classes/phing/tasks/ext/inifile/IniFileTask.php index d8b6c3df53..10a66eef45 100644 --- a/classes/phing/tasks/ext/inifile/IniFileTask.php +++ b/classes/phing/tasks/ext/inifile/IniFileTask.php @@ -26,7 +26,7 @@ * @license LGPL (see http://www.gnu.org/licenses/lgpl.html) * @link InifileTask.php */ -class InifileTask extends Task +class IniFileTask extends Task { /** * Source file diff --git a/classes/phing/tasks/ext/liquibase/LiquibaseRollbackTask.php b/classes/phing/tasks/ext/liquibase/LiquibaseRollbackTask.php index 1915fb3b50..46ee8138bc 100644 --- a/classes/phing/tasks/ext/liquibase/LiquibaseRollbackTask.php +++ b/classes/phing/tasks/ext/liquibase/LiquibaseRollbackTask.php @@ -48,12 +48,7 @@ protected function checkParams() parent::checkParams(); if (null === $this->rollbackTag) { - throw new BuildException( - sprintf( - 'Please specify the tag to rollback to!', - $this->rollbackTag - ) - ); + throw new BuildException('Please specify the tag to rollback to!'); } } diff --git a/classes/phing/tasks/ext/liquibase/LiquibaseTagTask.php b/classes/phing/tasks/ext/liquibase/LiquibaseTagTask.php index 1a967314c7..32fb7db587 100644 --- a/classes/phing/tasks/ext/liquibase/LiquibaseTagTask.php +++ b/classes/phing/tasks/ext/liquibase/LiquibaseTagTask.php @@ -51,12 +51,7 @@ protected function checkParams() parent::checkParams(); if (null === $this->tag) { - throw new BuildException( - sprintf( - 'Please specify the tag!', - $this->tag - ) - ); + throw new BuildException('Please specify the tag!'); } } diff --git a/classes/phing/tasks/ext/property/PropertySelector.php b/classes/phing/tasks/ext/property/PropertySelector.php index 34fa776431..47823c1b87 100644 --- a/classes/phing/tasks/ext/property/PropertySelector.php +++ b/classes/phing/tasks/ext/property/PropertySelector.php @@ -88,7 +88,6 @@ public function main() for ($i = 0; $i < $sz; $i++) { $s = $groups[$i]; - $result = null; $result = new RegularExpression(); $result->setPattern("\\\\" . $i); $sregex = $result->getRegexp($this->project); diff --git a/classes/phing/tasks/system/ApplyTask.php b/classes/phing/tasks/system/ApplyTask.php index 76596f6878..feca365973 100644 --- a/classes/phing/tasks/system/ApplyTask.php +++ b/classes/phing/tasks/system/ApplyTask.php @@ -829,10 +829,6 @@ private function cleanup() */ public function getFilePath($filename, $basedir, $relative) { - - // Var(s) - $files = []; - // Validating the 'file' information $files = (is_array($filename)) ? $filename : [$filename]; diff --git a/classes/phing/tasks/system/AttribTask.php b/classes/phing/tasks/system/AttribTask.php index bbfb4d2b58..01615d7e36 100644 --- a/classes/phing/tasks/system/AttribTask.php +++ b/classes/phing/tasks/system/AttribTask.php @@ -195,9 +195,7 @@ public function setParallel($parallel) protected function validateOS() { - return $this->os === null && $this->osvariant === null - ? $this->os === null && $this->osvariant === null - : parent::validateOS(); + return $this->os === null && $this->osvariant === null ?: parent::validateOS(); } private static function getSignString($attr) diff --git a/classes/phing/types/AbstractFileSet.php b/classes/phing/types/AbstractFileSet.php index 805af79948..a21569369e 100644 --- a/classes/phing/types/AbstractFileSet.php +++ b/classes/phing/types/AbstractFileSet.php @@ -104,7 +104,6 @@ public function __construct($fileset = null) { if ($fileset !== null && ($fileset instanceof FileSet)) { $this->dir = $fileset->dir; - $this->defaultPatterns = $fileset->defaultPatterns; $this->additionalPatterns = $fileset->additionalPatterns; $this->useDefaultExcludes = $fileset->useDefaultExcludes; $this->isCaseSensitive = $fileset->isCaseSensitive; diff --git a/classes/phing/util/DirectoryScanner.php b/classes/phing/util/DirectoryScanner.php index 4f7d36d4b3..d24902b9be 100644 --- a/classes/phing/util/DirectoryScanner.php +++ b/classes/phing/util/DirectoryScanner.php @@ -333,7 +333,6 @@ public function setIncludes($_includes = []) $this->includes = null; } else { for ($i = 0; $i < count($_includes); $i++) { - $pattern = null; $pattern = str_replace('\\', DIRECTORY_SEPARATOR, $_includes[$i]); $pattern = str_replace('/', DIRECTORY_SEPARATOR, $pattern); if (StringHelper::endsWith(DIRECTORY_SEPARATOR, $pattern)) { @@ -359,7 +358,6 @@ public function setExcludes($_excludes = []) $this->excludes = null; } else { for ($i = 0; $i < count($_excludes); $i++) { - $pattern = null; $pattern = str_replace('\\', DIRECTORY_SEPARATOR, $_excludes[$i]); $pattern = str_replace('/', DIRECTORY_SEPARATOR, $pattern); if (StringHelper::endsWith(DIRECTORY_SEPARATOR, $pattern)) { diff --git a/classes/phing/util/SourceFileScanner.php b/classes/phing/util/SourceFileScanner.php index 244712d8f2..7d622fee1e 100644 --- a/classes/phing/util/SourceFileScanner.php +++ b/classes/phing/util/SourceFileScanner.php @@ -120,7 +120,7 @@ public function restrict(&$files, $srcDir, $destDir, $mapper, $force = false) if (!$dest->exists()) { $this->task->log( - ($files[$i] ? $files[$i] : ".") . " added as " . $dest->__toString() . " doesn't exist.", + ($files[$i] ?: ".") . " added as " . $dest->__toString() . " doesn't exist.", Project::MSG_VERBOSE ); $v[] = $files[$i]; @@ -156,10 +156,8 @@ public function restrict(&$files, $srcDir, $destDir, $mapper, $force = false) ); } } - $result = []; - $result = $v; - return $result; + return $v; } /**