diff --git a/classes/phing/IntrospectionHelper.php b/classes/phing/IntrospectionHelper.php index 3642c345af..dd0b200d1c 100644 --- a/classes/phing/IntrospectionHelper.php +++ b/classes/phing/IntrospectionHelper.php @@ -137,8 +137,12 @@ public function __construct($class) // but should actually just be skipped. (Note: this means you can't ever // have an attribute named "location" or "tasktype" or a nested element container // named "task" [TaskContainer::addTask(Task)].) - if ($name === "setlocation" || $name === "settasktype" - || ('addtask' === $name && $this->isContainer() && count($method->getParameters()) === 1 + if ( + $name === "setlocation" + || $name === "settasktype" + || ('addtask' === $name + && $this->isContainer() + && count($method->getParameters()) === 1 && Task::class === $method->getParameters()[0]) ) { continue; diff --git a/classes/phing/Phing.php b/classes/phing/Phing.php index 450b799cde..255442b93e 100644 --- a/classes/phing/Phing.php +++ b/classes/phing/Phing.php @@ -414,17 +414,20 @@ public function execute($args) // 2) Next pull out stand-alone args. // Note: The order in which these are executed is important (if multiple of these options are specified) - if (false !== ($key = array_search('-quiet', $args, true)) || false !== ($key = array_search( - '-q', - $args, - true - )) + if ( + false !== ($key = array_search('-quiet', $args, true)) || + false !== ($key = array_search( + '-q', + $args, + true + )) ) { self::$msgOutputLevel = Project::MSG_WARN; unset($args[$key]); } - if (false !== ($key = array_search('-emacs', $args, true)) + if ( + false !== ($key = array_search('-emacs', $args, true)) || false !== ($key = array_search('-e', $args, true)) ) { $this->emacsMode = true; @@ -441,7 +444,8 @@ public function execute($args) unset($args[$key]); } - if (false !== ($key = array_search('-silent', $args, true)) + if ( + false !== ($key = array_search('-silent', $args, true)) || false !== ($key = array_search('-S', $args, true)) ) { $this->silent = true; diff --git a/classes/phing/listener/DefaultLogger.php b/classes/phing/listener/DefaultLogger.php index d332ecf63a..d3552eb89d 100644 --- a/classes/phing/listener/DefaultLogger.php +++ b/classes/phing/listener/DefaultLogger.php @@ -224,7 +224,8 @@ protected function getBuildSuccessfulMessage() */ public function targetStarted(BuildEvent $event) { - if (Project::MSG_INFO <= $this->msgOutputLevel + if ( + Project::MSG_INFO <= $this->msgOutputLevel && $event->getTarget()->getName() != '' ) { $showLongTargets = $event->getProject()->getProperty("phing.showlongtargets"); diff --git a/classes/phing/listener/NoBannerLogger.php b/classes/phing/listener/NoBannerLogger.php index 9510d5ac62..f6ef457681 100644 --- a/classes/phing/listener/NoBannerLogger.php +++ b/classes/phing/listener/NoBannerLogger.php @@ -50,7 +50,9 @@ public function targetFinished(BuildEvent $event) */ public function messageLogged(BuildEvent $event) { - if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() + if ( + $event->getPriority() > $this->msgOutputLevel + || null === $event->getMessage() || trim($event->getMessage()) === '' ) { return; diff --git a/classes/phing/mappers/GlobMapper.php b/classes/phing/mappers/GlobMapper.php index 62e617d3b4..d5e7fb9fa7 100644 --- a/classes/phing/mappers/GlobMapper.php +++ b/classes/phing/mappers/GlobMapper.php @@ -112,9 +112,11 @@ public function setCaseSensitive($caseSensitive) public function main($sourceFileName) { $modName = $this->modifyName($sourceFileName); - if ($this->fromPrefix === null + if ( + $this->fromPrefix === null || (strlen($sourceFileName) < ($this->prefixLength + $this->postfixLength) - || (!$this->fromContainsStar && !$modName === $this->modifyName($this->fromPrefix))) + || (!$this->fromContainsStar + && !$modName === $this->modifyName($this->fromPrefix))) || ($this->fromContainsStar && (!StringHelper::startsWith($this->modifyName($this->fromPrefix), $modName) || !StringHelper::endsWith($this->modifyName($this->fromPostfix), $modName))) diff --git a/classes/phing/parser/PhingXMLContext.php b/classes/phing/parser/PhingXMLContext.php index d0c175049e..1c44ef3493 100644 --- a/classes/phing/parser/PhingXMLContext.php +++ b/classes/phing/parser/PhingXMLContext.php @@ -171,4 +171,4 @@ public function setCurrentTargets(array $currentTargets) { $this->currentTargets = $currentTargets; } -} //end PhingXMLContext +} diff --git a/classes/phing/parser/TargetHandler.php b/classes/phing/parser/TargetHandler.php index d2dfb9ed6e..48a015d188 100644 --- a/classes/phing/parser/TargetHandler.php +++ b/classes/phing/parser/TargetHandler.php @@ -166,7 +166,8 @@ public function init($tag, $attrs) // check to see if target with same name is already defined $projectTargets = $project->getTargets(); if (isset($projectTargets[$name])) { - if ($this->configurator->isIgnoringProjectTag() + if ( + $this->configurator->isIgnoringProjectTag() && $this->configurator->getCurrentProjectName() != null && strlen($this->configurator->getCurrentProjectName()) != 0 ) { diff --git a/classes/phing/system/io/WindowsFileSystem.php b/classes/phing/system/io/WindowsFileSystem.php index a7c14382d4..64d19d2c14 100644 --- a/classes/phing/system/io/WindowsFileSystem.php +++ b/classes/phing/system/io/WindowsFileSystem.php @@ -113,7 +113,8 @@ public function normalizePrefix($strPath, $len, &$sb) $src++; } $c = ""; - if (($len - $src >= 2) + if ( + ($len - $src >= 2) && $this->isLetter($c = $strPath[$src]) && $strPath[$src + 1] === ':' ) { @@ -126,7 +127,8 @@ public function normalizePrefix($strPath, $len, &$sb) $src += 2; } else { $src = 0; - if (($len >= 2) + if ( + ($len >= 2) && $this->isSlash($strPath[0]) && $this->isSlash($strPath[1]) ) { diff --git a/classes/phing/tasks/ext/ExtractBaseTask.php b/classes/phing/tasks/ext/ExtractBaseTask.php index 98c536004e..d10ee74045 100644 --- a/classes/phing/tasks/ext/ExtractBaseTask.php +++ b/classes/phing/tasks/ext/ExtractBaseTask.php @@ -171,7 +171,8 @@ protected function isDestinationUpToDate(PhingFile $compressedArchiveFile) } $compressArchivePath = new PhingFile($this->todir, $compressArchiveFilename); - if (!$compressArchivePath->exists() + if ( + !$compressArchivePath->exists() || $fileSystem->compareMTimes( $compressedArchiveFile->getCanonicalPath(), $compressArchivePath->getCanonicalPath() diff --git a/classes/phing/tasks/ext/FileHashTask.php b/classes/phing/tasks/ext/FileHashTask.php index edfade1a67..790d89e75e 100644 --- a/classes/phing/tasks/ext/FileHashTask.php +++ b/classes/phing/tasks/ext/FileHashTask.php @@ -142,7 +142,8 @@ public function main() private function checkFile() { // check File - if ($this->file === null + if ( + $this->file === null || strlen($this->file) == 0 ) { throw new BuildException('[FileHash] You must specify an input file.', $this->file); @@ -166,7 +167,8 @@ private function checkFile() */ private function checkPropertyName() { - if (null === $this->propertyName + if ( + null === $this->propertyName || strlen($this->propertyName) === 0 ) { throw new BuildException('Property name for publishing hashvalue is not set'); diff --git a/classes/phing/tasks/ext/FileSizeTask.php b/classes/phing/tasks/ext/FileSizeTask.php index c284962d5d..0ba4645e54 100644 --- a/classes/phing/tasks/ext/FileSizeTask.php +++ b/classes/phing/tasks/ext/FileSizeTask.php @@ -93,7 +93,8 @@ public function main() private function checkFile() { // check File - if ($this->file === null + if ( + $this->file === null || strlen($this->file) == 0 ) { throw new BuildException('[FileSize] You must specify an input file.', $this->file); @@ -117,7 +118,8 @@ private function checkFile() */ private function checkPropertyName() { - if (null === $this->propertyName + if ( + null === $this->propertyName || strlen($this->propertyName) === 0 ) { throw new BuildException('[FileSize] Property name for publishing file size is not set'); diff --git a/classes/phing/tasks/ext/HttpGetTask.php b/classes/phing/tasks/ext/HttpGetTask.php index 820b17010e..cb21318db6 100644 --- a/classes/phing/tasks/ext/HttpGetTask.php +++ b/classes/phing/tasks/ext/HttpGetTask.php @@ -115,7 +115,9 @@ protected function processResponse(HTTP_Request2_Response $response) if ($this->filename) { $filename = $this->filename; - } elseif ($disposition && 0 == strpos($disposition, 'attachment') + } elseif ( + $disposition + && 0 == strpos($disposition, 'attachment') && preg_match('/filename="([^"]+)"/', $disposition, $m) ) { $filename = basename($m[1]); diff --git a/classes/phing/tasks/ext/PhpCodeSnifferTask.php b/classes/phing/tasks/ext/PhpCodeSnifferTask.php index 99f02d3efc..aa385cff6a 100644 --- a/classes/phing/tasks/ext/PhpCodeSnifferTask.php +++ b/classes/phing/tasks/ext/PhpCodeSnifferTask.php @@ -17,7 +17,6 @@ * . */ - /** * A PHP code sniffer task. Checking the style of one or more PHP source files. * @@ -33,7 +32,7 @@ class PhpCodeSnifferTask extends Task * * @var PhingFile */ - protected $file; // the source file (from xml attribute) + protected $file; // parameters for php code sniffer protected $standards = ['Generic']; @@ -724,4 +723,4 @@ protected function outputCustomFormatMessages($messages, $type) } } } -} //end phpCodeSnifferTask //end FormatterElement +} diff --git a/classes/phing/tasks/ext/PhpLintTask.php b/classes/phing/tasks/ext/PhpLintTask.php index 9a788e22c7..6cc9aa5c5e 100644 --- a/classes/phing/tasks/ext/PhpLintTask.php +++ b/classes/phing/tasks/ext/PhpLintTask.php @@ -235,10 +235,10 @@ protected function lint($file) continue; } - if ((!preg_match('/^(.*)Deprecated:/', $message) || $this->deprecatedAsError) && !preg_match( - '/^No syntax errors detected/', - $message - ) + if ( + (!preg_match('/^(.*)Deprecated:/', $message) || + $this->deprecatedAsError) && + !preg_match('/^No syntax errors detected/', $message) ) { $this->log($message, Project::MSG_ERR); diff --git a/classes/phing/tasks/ext/RSTTask.php b/classes/phing/tasks/ext/RSTTask.php index 6ae5160da6..cfaa573b46 100644 --- a/classes/phing/tasks/ext/RSTTask.php +++ b/classes/phing/tasks/ext/RSTTask.php @@ -236,7 +236,9 @@ protected function render($tool, $source, $targetFile) */ protected function renderFile($tool, $source, $targetFile) { - if ($this->uptodate && file_exists($targetFile) + if ( + $this->uptodate + && file_exists($targetFile) && filemtime($source) <= filemtime($targetFile) ) { //target is up to date @@ -307,7 +309,8 @@ protected function getToolPath($format) */ public function getTargetFile($file, $destination = null) { - if ($destination != '' + if ( + $destination != '' && substr($destination, -1) !== '/' && substr($destination, -1) !== '\\' ) { diff --git a/classes/phing/tasks/ext/coverage/CoverageThresholdTask.php b/classes/phing/tasks/ext/coverage/CoverageThresholdTask.php index 63bb0ef4d3..1d80a53dda 100644 --- a/classes/phing/tasks/ext/coverage/CoverageThresholdTask.php +++ b/classes/phing/tasks/ext/coverage/CoverageThresholdTask.php @@ -196,7 +196,8 @@ protected function calculateCoverageThreshold($filename, $coverageInformation) // Strange PHP5 reflection bug, classes without parent class // or implemented interfaces seem to start one line off - if ($reflection->getParentClass() === null + if ( + $reflection->getParentClass() === null && count($reflection->getInterfaces()) === 0 ) { unset($coverageInformation[$classStartLine + 1]); @@ -220,7 +221,8 @@ protected function calculateCoverageThreshold($filename, $coverageInformation) $excludedMethods = $this->excludes->getExcludedMethods(); if (isset($excludedMethods[$className])) { - if (in_array($method->getName(), $excludedMethods[$className]) + if ( + in_array($method->getName(), $excludedMethods[$className]) || in_array($method->getName() . '()', $excludedMethods[$className]) ) { continue; @@ -284,7 +286,8 @@ protected function calculateCoverageThreshold($filename, $coverageInformation) ); } - if ($methodCoverage < $this->perMethod + if ( + $methodCoverage < $this->perMethod && $method->isAbstract() && $this->verbose === true ) { @@ -328,7 +331,8 @@ protected function calculateCoverageThreshold($filename, $coverageInformation) ); } - if ($classCoverage < $this->perClass + if ( + $classCoverage < $this->perClass && $reflection->isAbstract() && $this->verbose === true ) { diff --git a/classes/phing/tasks/ext/hg/HgAddTask.php b/classes/phing/tasks/ext/hg/HgAddTask.php index 7a643e6307..f5a23b53c2 100644 --- a/classes/phing/tasks/ext/hg/HgAddTask.php +++ b/classes/phing/tasks/ext/hg/HgAddTask.php @@ -143,7 +143,8 @@ public function fileIsIgnored($file) $line = $this->ignoreFile[0]; $mode = 'regexp'; $ignored = false; - if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches) + if ( + preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches) || $matches[1] === 'glob' ) { $mode = 'glob'; diff --git a/classes/phing/tasks/ext/inifile/IniFileConfig.php b/classes/phing/tasks/ext/inifile/IniFileConfig.php index 50fdad5dea..4e12cac7c1 100644 --- a/classes/phing/tasks/ext/inifile/IniFileConfig.php +++ b/classes/phing/tasks/ext/inifile/IniFileConfig.php @@ -156,7 +156,8 @@ public function remove($section, $key) } } else { foreach ($this->lines as $linenum => $line) { - if (($line['section'] == $section) + if ( + ($line['section'] == $section) && (isset($line['key'])) && ($line['key'] == $key) ) { diff --git a/classes/phing/tasks/ext/pdo/DefaultPDOQuerySplitter.php b/classes/phing/tasks/ext/pdo/DefaultPDOQuerySplitter.php index 1382888fb1..019a16f88b 100644 --- a/classes/phing/tasks/ext/pdo/DefaultPDOQuerySplitter.php +++ b/classes/phing/tasks/ext/pdo/DefaultPDOQuerySplitter.php @@ -76,14 +76,17 @@ public function nextQuery() $project = $this->parent->getOwningTarget()->getProject(); $line = $project->replaceProperties(trim($line)); - if (($line != $delimiter) && (StringHelper::startsWith("//", $line) + if ( + ($line != $delimiter) + && (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line)) ) { continue; } - if (strlen($line) > 4 + if ( + strlen($line) > 4 && strtoupper(substr($line, 0, 4)) == "REM " ) { continue; diff --git a/classes/phing/tasks/ext/pdo/DummyPDOQuerySplitter.php b/classes/phing/tasks/ext/pdo/DummyPDOQuerySplitter.php index b9148d08ef..eeffaa48d4 100644 --- a/classes/phing/tasks/ext/pdo/DummyPDOQuerySplitter.php +++ b/classes/phing/tasks/ext/pdo/DummyPDOQuerySplitter.php @@ -42,7 +42,9 @@ public function nextQuery() $project = $this->parent->getOwningTarget()->getProject(); $line = $project->replaceProperties(trim($line)); - if (($line != $delimiter) && (StringHelper::startsWith("//", $line) + if ( + ($line != $delimiter) + && (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line)) ) { diff --git a/classes/phing/tasks/ext/pdo/PDOSQLExecTask.php b/classes/phing/tasks/ext/pdo/PDOSQLExecTask.php index f04680cbb1..6bf49649c5 100644 --- a/classes/phing/tasks/ext/pdo/PDOSQLExecTask.php +++ b/classes/phing/tasks/ext/pdo/PDOSQLExecTask.php @@ -335,8 +335,11 @@ public function main() $this->sqlCommand = trim($this->sqlCommand); try { - if ($this->srcFile === null && $this->sqlCommand === "" - && empty($this->filesets) && empty($this->filelists) + if ( + $this->srcFile === null + && $this->sqlCommand === "" + && empty($this->filesets) + && empty($this->filelists) && count($this->transactions) === 0 ) { throw new BuildException( diff --git a/classes/phing/tasks/ext/phpcpd/PHPCPDTask.php b/classes/phing/tasks/ext/phpcpd/PHPCPDTask.php index 44951525fc..818b2aa270 100644 --- a/classes/phing/tasks/ext/phpcpd/PHPCPDTask.php +++ b/classes/phing/tasks/ext/phpcpd/PHPCPDTask.php @@ -1,4 +1,8 @@ getListenerConfiguration() as $listener) { - if (!class_exists($listener['class'], false) + if ( + !class_exists($listener['class'], false) && $listener['file'] !== '' ) { include_once $listener['file']; @@ -370,7 +371,8 @@ protected function handlePHPUnitConfiguration(PhingFile $configuration) if (method_exists($config, 'getSeleniumBrowserConfiguration')) { $browsers = $config->getSeleniumBrowserConfiguration(); - if (!empty($browsers) + if ( + !empty($browsers) && class_exists('PHPUnit_Extensions_SeleniumTestCase') ) { PHPUnit_Extensions_SeleniumTestCase::$browsers = $browsers; @@ -450,11 +452,10 @@ public function main() */ protected function execute($suite) { - if (class_exists('\PHPUnit\Runner\Version', false) && version_compare( - \PHPUnit\Runner\Version::id(), - '8.0.0', - '<' - )) { + if ( + class_exists('\PHPUnit\Runner\Version', false) && + version_compare(\PHPUnit\Runner\Version::id(), '8.0.0', '<') + ) { $runner = new PHPUnitTestRunner7( $this->project, $this->groups, diff --git a/classes/phing/tasks/ext/sass/SassTask.php b/classes/phing/tasks/ext/sass/SassTask.php index 0db8233931..f19272985c 100644 --- a/classes/phing/tasks/ext/sass/SassTask.php +++ b/classes/phing/tasks/ext/sass/SassTask.php @@ -996,7 +996,8 @@ public function processFilesets(SassTaskCompiler $compiler): void $run = false; } - if ($run + if ( + $run && ($this->extfilter === '' || $this->extfilter === $this->pathInfo['extension']) ) { diff --git a/classes/phing/tasks/ext/visualizer/VisualizerTask.php b/classes/phing/tasks/ext/visualizer/VisualizerTask.php index c1fbdc2932..5e2e6a5ad1 100644 --- a/classes/phing/tasks/ext/visualizer/VisualizerTask.php +++ b/classes/phing/tasks/ext/visualizer/VisualizerTask.php @@ -1,4 +1,6 @@ -to !== null + if ( + $this->to !== null && !$this->overwrite && $this->to->exists() && $f->lastModified() > $this->to->lastModified() diff --git a/classes/phing/tasks/system/ApplyTask.php b/classes/phing/tasks/system/ApplyTask.php index d06bfa9d8b..c08bc34727 100644 --- a/classes/phing/tasks/system/ApplyTask.php +++ b/classes/phing/tasks/system/ApplyTask.php @@ -717,7 +717,9 @@ private function process($srcFiles, $basedir) if ($this->forwardslash && PhingFile::$separator !== '/') { $src = str_replace(PhingFile::$separator, '/', $src); } - if ($this->srcFilePos !== null && ($this->srcFilePos->getPrefix() !== '' + if ( + $this->srcFilePos !== null + && ($this->srcFilePos->getPrefix() !== '' || $this->srcFilePos->getSuffix() !== '') ) { $src = $this->srcFilePos->getPrefix() . $src . $this->srcFilePos->getSuffix(); diff --git a/classes/phing/tasks/system/CopyTask.php b/classes/phing/tasks/system/CopyTask.php index f449fcb89d..8720631336 100644 --- a/classes/phing/tasks/system/CopyTask.php +++ b/classes/phing/tasks/system/CopyTask.php @@ -337,7 +337,10 @@ public function main() $srcFiles[] = $srcDir; } - if (!$this->flatten && $this->mapperElement === null && $ds->isEverythingIncluded() + if ( + !$this->flatten && + $this->mapperElement === null && + $ds->isEverythingIncluded() ) { $this->completeDirMap[$fromDir->getAbsolutePath()] = $this->destDir->getAbsolutePath(); } @@ -360,7 +363,9 @@ public function main() $srcFiles = $ds->getIncludedFiles(); $srcDirs = $ds->getIncludedDirectories(); - if (!$this->flatten && $this->mapperElement === null + if ( + !$this->flatten + && $this->mapperElement === null && $ds->isEverythingIncluded() ) { $this->completeDirMap[$fromDir->getAbsolutePath()] = $this->destDir->getAbsolutePath(); diff --git a/classes/phing/tasks/system/DeleteTask.php b/classes/phing/tasks/system/DeleteTask.php index 0ad8021bc7..5c54f02bd6 100644 --- a/classes/phing/tasks/system/DeleteTask.php +++ b/classes/phing/tasks/system/DeleteTask.php @@ -116,8 +116,12 @@ public function setIncludeEmptyDirs($includeEmpty) */ public function main() { - if ($this->file === null && $this->dir === null && count($this->dirsets) === 0 - && count($this->filesets) === 0 && count($this->filelists) === 0 + if ( + $this->file === null + && $this->dir === null + && count($this->dirsets) === 0 + && count($this->filesets) === 0 + && count($this->filelists) === 0 ) { throw new BuildException( "At least one of the file or dir attributes, or a fileset, filelist or dirset element must be set." diff --git a/classes/phing/tasks/system/DependSet.php b/classes/phing/tasks/system/DependSet.php index e647d25271..4641a181da 100644 --- a/classes/phing/tasks/system/DependSet.php +++ b/classes/phing/tasks/system/DependSet.php @@ -160,7 +160,8 @@ public function main() Project::MSG_WARN ); } - if ($oldestTarget === null + if ( + $oldestTarget === null || $dest->lastModified() < $oldestTargetTime ) { $oldestTargetTime = $dest->lastModified(); @@ -188,7 +189,8 @@ public function main() Project::MSG_WARN ); } - if ($oldestTarget === null + if ( + $oldestTarget === null || $dest->lastModified() < $oldestTargetTime ) { $oldestTargetTime = $dest->lastModified(); diff --git a/classes/phing/tasks/system/ImportTask.php b/classes/phing/tasks/system/ImportTask.php index 011d084aa9..9cfa4f2b0d 100644 --- a/classes/phing/tasks/system/ImportTask.php +++ b/classes/phing/tasks/system/ImportTask.php @@ -65,7 +65,7 @@ class ImportTask extends Task public function init() { $this->fs = FileSystem::getFileSystem(); - } //end init + } /** * Set the file to import. @@ -163,7 +163,7 @@ public function main() $this->importFile(new PhingFile($fromDir, $srcDirs[$j])); } } - } //end main + } /** * Parse a Phing build file and copy the properties, tasks, data types and @@ -186,5 +186,5 @@ protected function importFile(PhingFile $file) Project::MSG_VERBOSE ); ProjectConfigurator::configureProject($this->project, $file); - } //end importFile -} //end ImportTask + } +} diff --git a/classes/phing/tasks/system/MoveTask.php b/classes/phing/tasks/system/MoveTask.php index 3a886ca923..79091f6355 100644 --- a/classes/phing/tasks/system/MoveTask.php +++ b/classes/phing/tasks/system/MoveTask.php @@ -43,8 +43,11 @@ class MoveTask extends CopyTask protected function validateAttributes() { if ($this->file !== null && $this->file->isDirectory()) { - if (($this->destFile !== null && $this->destDir !== null) - || ($this->destFile === null && $this->destDir === null) + if ( + ($this->destFile !== null + && $this->destDir !== null) + || ($this->destFile === null + && $this->destDir === null) ) { throw new BuildException("One and only one of tofile and todir must be set."); } diff --git a/classes/phing/tasks/system/PhingTask.php b/classes/phing/tasks/system/PhingTask.php index 8620d3872c..9970102e27 100644 --- a/classes/phing/tasks/system/PhingTask.php +++ b/classes/phing/tasks/system/PhingTask.php @@ -284,7 +284,8 @@ private function processFile() } // Are we trying to call the target in which we are defined? - if ($this->newProject->getBaseDir() == $this->project->getBaseDir() + if ( + $this->newProject->getBaseDir() == $this->project->getBaseDir() && $this->newProject->getProperty("phing.file") == $this->project->getProperty("phing.file") && $this->getOwningTarget() !== null && $this->newTarget == $this->getOwningTarget()->getName() diff --git a/classes/phing/tasks/system/TaskdefTask.php b/classes/phing/tasks/system/TaskdefTask.php index 41d4766b1d..5390e7dfc9 100644 --- a/classes/phing/tasks/system/TaskdefTask.php +++ b/classes/phing/tasks/system/TaskdefTask.php @@ -99,8 +99,10 @@ public function setFile($file) */ public function main() { - if ($this->typeFile === null - && ($this->name === null || $this->classname === null) + if ( + $this->typeFile === null + && ($this->name === null + || $this->classname === null) ) { throw new BuildException("You must specify name and class attributes for ."); } diff --git a/classes/phing/types/Commandline.php b/classes/phing/types/Commandline.php index 728b40fb60..5adf9d62ba 100644 --- a/classes/phing/types/Commandline.php +++ b/classes/phing/types/Commandline.php @@ -212,10 +212,12 @@ public static function quoteArgument($argument, $escape = false) return '\'' . $argument . '\''; } - if (strpos($argument, "'") !== false + if ( + strpos($argument, "'") !== false || strpos($argument, ' ') !== false // WIN9x uses a bat file for executing commands - || (OsCondition::isFamily('win32') && strpos($argument, ';') !== false) + || (OsCondition::isFamily('win32') + && strpos($argument, ';') !== false) ) { return '"' . $argument . '"'; } diff --git a/classes/phing/types/selectors/SelectorUtils.php b/classes/phing/types/selectors/SelectorUtils.php index eef718245e..65bc36e139 100644 --- a/classes/phing/types/selectors/SelectorUtils.php +++ b/classes/phing/types/selectors/SelectorUtils.php @@ -76,10 +76,11 @@ public static function matchPatternStart($pattern, $str, $isCaseSensitive = true // DIRECTORY_SEPARATOR. // When pattern starts with a DIRECTORY_SEPARATOR, str has to start with a // DIRECTORY_SEPARATOR. - if (StringHelper::startsWith(DIRECTORY_SEPARATOR, $str) !== StringHelper::startsWith( - DIRECTORY_SEPARATOR, - $pattern - ) + if ( + StringHelper::startsWith(DIRECTORY_SEPARATOR, $str) !== StringHelper::startsWith( + DIRECTORY_SEPARATOR, + $pattern + ) ) { return false; } diff --git a/classes/phing/util/FileUtils.php b/classes/phing/util/FileUtils.php index 8cfed310d9..3af3710990 100644 --- a/classes/phing/util/FileUtils.php +++ b/classes/phing/util/FileUtils.php @@ -210,8 +210,11 @@ public function resolveFile($file, $filename) $filename = str_replace(array('\\', '/'), $fs->getSeparator(), $filename); // deal with absolute files - if (StringHelper::startsWith($fs->getSeparator(), $filename) - || (strlen($filename) >= 2 && Character::isLetter($filename[0]) && $filename[1] === ':') + if ( + StringHelper::startsWith($fs->getSeparator(), $filename) + || (strlen($filename) >= 2 + && Character::isLetter($filename[0]) + && $filename[1] === ':') ) { return new PhingFile($this->normalize($filename)); } @@ -269,8 +272,11 @@ public function normalize($path) $path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path); // make sure we are dealing with an absolute path - if (!StringHelper::startsWith(DIRECTORY_SEPARATOR, $path) - && !(strlen($path) >= 2 && Character::isLetter($path[0]) && $path[1] === ':') + if ( + !StringHelper::startsWith(DIRECTORY_SEPARATOR, $path) + && !(strlen($path) >= 2 + && Character::isLetter($path[0]) + && $path[1] === ':') ) { throw new IOException("$path is not an absolute path"); } @@ -288,8 +294,10 @@ public function normalize($path) $path = strtoupper($ca[0]) . ':'; for ($i = 2, $_i = strlen($ca); $i < $_i; $i++) { - if (($ca[$i] !== '\\') - || ($ca[$i] === '\\' && $ca[$i - 1] !== '\\') + if ( + ($ca[$i] !== '\\') + || ($ca[$i] === '\\' + && $ca[$i - 1] !== '\\') ) { $path .= $ca[$i]; } diff --git a/classes/phing/util/PathTokenizer.php b/classes/phing/util/PathTokenizer.php index 4a342e509f..4c02ba010a 100644 --- a/classes/phing/util/PathTokenizer.php +++ b/classes/phing/util/PathTokenizer.php @@ -107,7 +107,9 @@ public function nextToken() } - if (strlen($token) === 1 && Character::isLetter($token[0]) + if ( + strlen($token) === 1 + && Character::isLetter($token[0]) && $this->dosStyleFilesystem && !empty($this->tokens) ) { diff --git a/composer.json b/composer.json index aae99f04f5..439ddf76f0 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "scssphp/scssphp": "~1.0", "sebastian/phpcpd": "^4.1", "siad007/versioncontrol_hg": "^1.0", - "squizlabs/php_codesniffer": "^2.9 || ^3.4", + "squizlabs/php_codesniffer": "^2.9 || ^3.5", "symfony/stopwatch": "~2.8 || ^3.1 || ^4.0", "tedivm/jshrink": "^1.3" }, diff --git a/composer.lock b/composer.lock index e972bdfcf5..e325a11b2e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b353c6ad182801f2cb8615d6bc44c856", + "content-hash": "6ac3d21d6f842c7a5482ede79f21d181", "packages": [ { "name": "mehr-als-nix/parallel", @@ -368,16 +368,16 @@ "packages-dev": [ { "name": "aws/aws-sdk-php", - "version": "3.112.11", + "version": "3.112.15", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "ec29fd7cf36504fada118afe9c17025ce4c4ad89" + "reference": "ccbfadde0ea60c5396e0408711a927200cb1898c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ec29fd7cf36504fada118afe9c17025ce4c4ad89", - "reference": "ec29fd7cf36504fada118afe9c17025ce4c4ad89", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ccbfadde0ea60c5396e0408711a927200cb1898c", + "reference": "ccbfadde0ea60c5396e0408711a927200cb1898c", "shasum": "" }, "require": { @@ -447,7 +447,7 @@ "s3", "sdk" ], - "time": "2019-09-30T18:45:33+00:00" + "time": "2019-10-04T18:08:52+00:00" }, { "name": "cilex/cilex", @@ -600,16 +600,16 @@ }, { "name": "doctrine/annotations", - "version": "v1.7.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "fa4c4e861e809d6a1103bd620cce63ed91aedfeb" + "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/fa4c4e861e809d6a1103bd620cce63ed91aedfeb", - "reference": "fa4c4e861e809d6a1103bd620cce63ed91aedfeb", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/904dca4eb10715b92569fbcd79e201d5c349b6bc", + "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc", "shasum": "" }, "require": { @@ -618,7 +618,7 @@ }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^7.5@dev" + "phpunit/phpunit": "^7.5" }, "type": "library", "extra": { @@ -664,7 +664,7 @@ "docblock", "parser" ], - "time": "2019-08-08T18:11:40+00:00" + "time": "2019-10-01T18:55:10+00:00" }, { "name": "doctrine/instantiator", @@ -2241,13 +2241,13 @@ "authors": [ { "name": "Michiel Rook", - "email": "mrook@php.net", - "role": "Lead" + "role": "Lead", + "email": "mrook@php.net" }, { "name": "Clay Loveless", - "email": "clay@loveless.net", - "role": "Lead" + "role": "Lead", + "email": "clay@loveless.net" } ], "description": "More info available on: http://pear.php.net/package/VersionControl_SVN", @@ -2848,22 +2848,22 @@ }, { "name": "phpspec/prophecy", - "version": "1.8.1", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, @@ -2907,7 +2907,7 @@ "spy", "stub" ], - "time": "2019-06-13T12:50:23+00:00" + "time": "2019-10-03T11:07:50+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3526,16 +3526,16 @@ }, { "name": "scssphp/scssphp", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/scssphp/scssphp.git", - "reference": "7c292c66db52ede3afbfd6566c8872f3c5b32267" + "reference": "98e10149058102817b493c5a147fa582cb62d46e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scssphp/scssphp/zipball/7c292c66db52ede3afbfd6566c8872f3c5b32267", - "reference": "7c292c66db52ede3afbfd6566c8872f3c5b32267", + "url": "https://api.github.com/repos/scssphp/scssphp/zipball/98e10149058102817b493c5a147fa582cb62d46e", + "reference": "98e10149058102817b493c5a147fa582cb62d46e", "shasum": "" }, "require": { @@ -3544,7 +3544,7 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": ">=4.8.36", + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3", "squizlabs/php_codesniffer": "~2.5", "twbs/bootstrap": "~4.3", "zurb/foundation": "~6.5" @@ -3583,7 +3583,7 @@ "scss", "stylesheet" ], - "time": "2019-09-06T16:48:49+00:00" + "time": "2019-10-03T17:09:15+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4297,16 +4297,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.4.2", + "version": "3.5.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" + "reference": "0afebf16a2e7f1e434920fa976253576151effe9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", - "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/0afebf16a2e7f1e434920fa976253576151effe9", + "reference": "0afebf16a2e7f1e434920fa976253576151effe9", "shasum": "" }, "require": { @@ -4344,7 +4344,7 @@ "phpcs", "standards" ], - "time": "2019-04-10T23:49:02+00:00" + "time": "2019-09-26T23:12:26+00:00" }, { "name": "symfony/config", @@ -5428,16 +5428,16 @@ }, { "name": "zendframework/zend-i18n", - "version": "2.9.0", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "6d69af5a04e1a4de7250043cb1322f077a0cdb7f" + "reference": "e17a54b3aee333ab156958f570cde630acee8b07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/6d69af5a04e1a4de7250043cb1322f077a0cdb7f", - "reference": "6d69af5a04e1a4de7250043cb1322f077a0cdb7f", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/e17a54b3aee333ab156958f570cde630acee8b07", + "reference": "e17a54b3aee333ab156958f570cde630acee8b07", "shasum": "" }, "require": { @@ -5445,7 +5445,7 @@ "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.16", "zendframework/zend-cache": "^2.6.1", "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-config": "^2.6", @@ -5492,7 +5492,7 @@ "i18n", "zf" ], - "time": "2018-05-16T16:39:13+00:00" + "time": "2019-09-30T12:04:37+00:00" }, { "name": "zendframework/zend-json", diff --git a/ruleset.xml b/ruleset.xml index baf7c3101a..7f100959a1 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -13,6 +13,7 @@ +