diff --git a/src/Phing/ComponentHelper.php b/src/Phing/ComponentHelper.php
index e5b8329c5f..d0a59e1d5b 100644
--- a/src/Phing/ComponentHelper.php
+++ b/src/Phing/ComponentHelper.php
@@ -137,7 +137,7 @@ public function addDataTypeDefinition($typeName, $typeClass, $classpath = null):
}
}
- public static function getElementName(Project $p = null, $o = null, $brief = false)
+ public static function getElementName(?Project $p = null, $o = null, $brief = false)
{
return null === $p
? self::getUnmappedElementName($o, $brief)
diff --git a/src/Phing/Exception/ExitStatusException.php b/src/Phing/Exception/ExitStatusException.php
index 51d4c2691d..a9f73985f2 100644
--- a/src/Phing/Exception/ExitStatusException.php
+++ b/src/Phing/Exception/ExitStatusException.php
@@ -39,9 +39,9 @@ class ExitStatusException extends BuildException
*
* @param null|int|string $arg1
* @param int $arg2
- * @param Location $arg3
+ * @param Location|null $arg3
*/
- public function __construct($arg1 = null, $arg2 = 0, Location $arg3 = null)
+ public function __construct($arg1 = null, $arg2 = 0, ?Location $arg3 = null)
{
$methodArgsNum = func_num_args();
if (1 === $methodArgsNum) {
diff --git a/src/Phing/Filter/ConcatFilter.php b/src/Phing/Filter/ConcatFilter.php
index 6ac03895b3..02c6a71cd9 100644
--- a/src/Phing/Filter/ConcatFilter.php
+++ b/src/Phing/Filter/ConcatFilter.php
@@ -78,9 +78,9 @@ class ConcatFilter extends BaseParamFilterReader implements ChainableReader
private $appendReader;
/**
- * @param Reader $in
+ * @param Reader|null $in
*/
- public function __construct(Reader $in = null)
+ public function __construct(?Reader $in = null)
{
parent::__construct($in);
}
diff --git a/src/Phing/Filter/SortFilter.php b/src/Phing/Filter/SortFilter.php
index 3bde785da7..41cf529fd9 100644
--- a/src/Phing/Filter/SortFilter.php
+++ b/src/Phing/Filter/SortFilter.php
@@ -92,11 +92,11 @@ class SortFilter extends BaseParamFilterReader implements ChainableReader
/**
* Creates a new filtered reader.
*
- * @param Reader $in
+ * @param Reader|null $in
* A Reader object providing the underlying stream. Must not be
* null
.
*/
- public function __construct(Reader $in = null)
+ public function __construct(?Reader $in = null)
{
parent::__construct($in);
}
diff --git a/src/Phing/Io/FilterReader.php b/src/Phing/Io/FilterReader.php
index d8fb50f16d..0475517422 100644
--- a/src/Phing/Io/FilterReader.php
+++ b/src/Phing/Io/FilterReader.php
@@ -31,9 +31,9 @@ class FilterReader extends Reader
protected $in;
/**
- * @param Reader $in
+ * @param Reader|null $in
*/
- public function __construct(Reader $in = null)
+ public function __construct(?Reader $in = null)
{
$this->in = $in;
}
diff --git a/src/Phing/Listener/DefaultLogger.php b/src/Phing/Listener/DefaultLogger.php
index 0d2fc5e223..47d0d3a7b7 100644
--- a/src/Phing/Listener/DefaultLogger.php
+++ b/src/Phing/Listener/DefaultLogger.php
@@ -108,7 +108,7 @@ class DefaultLogger implements StreamRequiredBuildLogger
/**
* Construct a new default logger.
*/
- public function __construct(Clock $clock = null)
+ public function __construct(?Clock $clock = null)
{
$this->projectTimerMap = new ProjectTimerMap();
if (null === $clock) {
diff --git a/src/Phing/Listener/StatisticsListener.php b/src/Phing/Listener/StatisticsListener.php
index 98f09d28aa..5527cd4618 100644
--- a/src/Phing/Listener/StatisticsListener.php
+++ b/src/Phing/Listener/StatisticsListener.php
@@ -48,7 +48,7 @@ class StatisticsListener implements SubBuildListener
*/
private $statisticsReport;
- public function __construct(Clock $clock = null)
+ public function __construct(?Clock $clock = null)
{
$this->projectTimerMap = new ProjectTimerMap();
$this->statisticsReport = new StatisticsReport();
diff --git a/src/Phing/Listener/XmlLogger.php b/src/Phing/Listener/XmlLogger.php
index bd98336797..50bce181f7 100644
--- a/src/Phing/Listener/XmlLogger.php
+++ b/src/Phing/Listener/XmlLogger.php
@@ -139,7 +139,7 @@ class XmlLogger implements BuildLogger
/**
* Constructs a new BuildListener that logs build events to an XML file.
*/
- public function __construct(Clock $clock = null)
+ public function __construct(?Clock $clock = null)
{
if (null === $clock) {
$this->clock = new DefaultClock();
diff --git a/src/Phing/Phing.php b/src/Phing/Phing.php
index 042fe05403..a546149204 100644
--- a/src/Phing/Phing.php
+++ b/src/Phing/Phing.php
@@ -87,11 +87,11 @@ class Phing
-
+
-
+
-
+
XML;
public const PHING_HOME = 'phing.home';
@@ -248,17 +248,17 @@ public static function fire($args): void
*
* This method encapsulates the complete build lifecycle.
*
- * @param array $args the commandline args passed to phing shell script
- * @param array $additionalUserProperties Any additional properties to be passed to Phing (alternative front-end might implement this).
- * These additional properties will be available using the getDefinedProperty() method and will
- * be added to the project's "user" properties
+ * @param array $args the commandline args passed to phing shell script
+ * @param array|null $additionalUserProperties Any additional properties to be passed to Phing (alternative front-end might implement this).
+ * These additional properties will be available using the getDefinedProperty() method and will
+ * be added to the project's "user" properties
*
* @throws Exception - if there is an error during build
*
* @see runBuild()
* @see execute()
*/
- public static function start($args, array $additionalUserProperties = null)
+ public static function start($args, ?array $additionalUserProperties = null)
{
try {
$m = new self();
diff --git a/src/Phing/Project.php b/src/Phing/Project.php
index b5a5af7f03..0f428f9974 100644
--- a/src/Phing/Project.php
+++ b/src/Phing/Project.php
@@ -838,11 +838,11 @@ public function executeTarget($targetName)
/**
* Helper function.
*
- * @param File $rootDir
+ * @param File|null $rootDir
*
* @throws IOException
*/
- public function resolveFile(string $fileName, File $rootDir = null): File
+ public function resolveFile(string $fileName, ?File $rootDir = null): File
{
if (null === $rootDir) {
return $this->fileUtils->resolveFile($this->basedir, $fileName);
@@ -999,7 +999,7 @@ public function log($msg, $level = Project::MSG_INFO)
* @param int $level
* @param mixed $obj
*/
- public function logObject($obj, $msg, $level, Exception $t = null)
+ public function logObject($obj, $msg, $level, ?Exception $t = null)
{
$this->fireMessageLogged($obj, $msg, $level, $t);
@@ -1128,14 +1128,14 @@ public function fireMessageLoggedEvent(BuildEvent $event, $message, $priority)
}
/**
- * @param string $message
- * @param int $priority
- * @param Exception $t
- * @param mixed $object
+ * @param string $message
+ * @param int $priority
+ * @param Exception|null $t
+ * @param mixed $object
*
* @throws Exception
*/
- public function fireMessageLogged($object, $message, $priority, Exception $t = null)
+ public function fireMessageLogged($object, $message, $priority, ?Exception $t = null)
{
$event = new BuildEvent($object);
if (null !== $t) {
diff --git a/src/Phing/Target.php b/src/Phing/Target.php
index 23343e5fb9..1ba0e6b88a 100644
--- a/src/Phing/Target.php
+++ b/src/Phing/Target.php
@@ -100,7 +100,7 @@ class Target implements TaskContainer
private $project;
private $location;
- public function __construct(Target $other = null)
+ public function __construct(?Target $other = null)
{
if (null !== $other) {
$this->name = $other->name;
diff --git a/src/Phing/Task.php b/src/Phing/Task.php
index 5cd03bc7dd..baafebe44c 100644
--- a/src/Phing/Task.php
+++ b/src/Phing/Task.php
@@ -93,7 +93,7 @@ public function getWrapper()
* @see BuildEvent
* @see BuildListener
*/
- public function log($msg, $level = Project::MSG_INFO, Exception $t = null)
+ public function log($msg, $level = Project::MSG_INFO, ?Exception $t = null)
{
if (null !== $this->getProject()) {
$this->getProject()->logObject($this, $msg, $level, $t);
diff --git a/src/Phing/Task/Ext/GrowlNotifyTask.php b/src/Phing/Task/Ext/GrowlNotifyTask.php
index 4da7474f7f..7aa42c4a94 100644
--- a/src/Phing/Task/Ext/GrowlNotifyTask.php
+++ b/src/Phing/Task/Ext/GrowlNotifyTask.php
@@ -79,9 +79,9 @@ class GrowlNotifyTask extends Task
/**
* Initializes task with default options.
*
- * @param Net_Growl $growl (optional) mock instance
+ * @param Net_Growl|null $growl (optional) mock instance
*/
- public function __construct(Net_Growl $growl = null)
+ public function __construct(?Net_Growl $growl = null)
{
parent::__construct();
$this->growl = $growl;
diff --git a/src/Phing/Task/Ext/Http/HttpGetTask.php b/src/Phing/Task/Ext/Http/HttpGetTask.php
index ed706069ea..fe35ca7b54 100644
--- a/src/Phing/Task/Ext/Http/HttpGetTask.php
+++ b/src/Phing/Task/Ext/Http/HttpGetTask.php
@@ -203,7 +203,7 @@ public function setQuiet($v): void
* @param int $msgLevel
* @param Exception|null $t
*/
- public function log($msg, $msgLevel = Project::MSG_INFO, Exception $t = null)
+ public function log($msg, $msgLevel = Project::MSG_INFO, ?Exception $t = null)
{
if (!$this->quiet || $msgLevel <= Project::MSG_ERR) {
parent::log($msg, $msgLevel, $t);
diff --git a/src/Phing/Task/Ext/PhpUnit/Formatter/PlainPHPUnitResultFormatter.php b/src/Phing/Task/Ext/PhpUnit/Formatter/PlainPHPUnitResultFormatter.php
index 996de7266b..31a52e864a 100644
--- a/src/Phing/Task/Ext/PhpUnit/Formatter/PlainPHPUnitResultFormatter.php
+++ b/src/Phing/Task/Ext/PhpUnit/Formatter/PlainPHPUnitResultFormatter.php
@@ -166,9 +166,9 @@ public function addSkippedTest(Test $test, Throwable $e, float $time): void
/**
* @param $type
* @param Test $test
- * @param Exception $e
+ * @param Exception|null $e
*/
- private function formatError($type, Test $test, Exception $e = null)
+ private function formatError($type, Test $test, ?Exception $e = null)
{
if ($test != null) {
$this->endTest($test, time());
diff --git a/src/Phing/Task/System/AppendTask.php b/src/Phing/Task/System/AppendTask.php
index 2fa6b0c7bd..cef565070c 100644
--- a/src/Phing/Task/System/AppendTask.php
+++ b/src/Phing/Task/System/AppendTask.php
@@ -371,11 +371,11 @@ private function getFilteredReader(Reader $r)
/**
* Append an array of files in a directory.
*
- * @param Writer $writer the FileWriter that is appending to target file
- * @param array $files array of files to delete; can be of zero length
- * @param File $dir directory to work from
+ * @param Writer $writer the FileWriter that is appending to target file
+ * @param array $files array of files to delete; can be of zero length
+ * @param File|null $dir directory to work from
*/
- private function appendFiles(Writer $writer, $files, File $dir = null): void
+ private function appendFiles(Writer $writer, $files, ?File $dir = null): void
{
if (!empty($files)) {
$this->log(
diff --git a/src/Phing/Task/System/EchoProperties.php b/src/Phing/Task/System/EchoProperties.php
index 0cffcbd6ee..50a75f197e 100644
--- a/src/Phing/Task/System/EchoProperties.php
+++ b/src/Phing/Task/System/EchoProperties.php
@@ -381,13 +381,13 @@ protected function textSaveProperties(Properties $props, OutputStream $os, $head
}
/**
- * @param Exception $exception
- * @param string $message
- * @param int $level
+ * @param Exception|null $exception
+ * @param string $message
+ * @param int $level
*
* @throws BuildException
*/
- private function failOnErrorAction(Exception $exception = null, $message = '', $level = Project::MSG_INFO)
+ private function failOnErrorAction(?Exception $exception = null, $message = '', $level = Project::MSG_INFO)
{
if ($this->failonerror) {
throw new BuildException(
diff --git a/src/Phing/Task/System/PhingTask.php b/src/Phing/Task/System/PhingTask.php
index 1584af1ae0..eafe7e9b9e 100644
--- a/src/Phing/Task/System/PhingTask.php
+++ b/src/Phing/Task/System/PhingTask.php
@@ -130,7 +130,7 @@ class PhingTask extends Task
*/
private $locals;
- public function __construct(Task $owner = null)
+ public function __construct(?Task $owner = null)
{
if (null !== $owner) {
$this->bindToOwner($owner);
diff --git a/src/Phing/Task/System/PropertyTask.php b/src/Phing/Task/System/PropertyTask.php
index 86564e7c78..97574c1afd 100644
--- a/src/Phing/Task/System/PropertyTask.php
+++ b/src/Phing/Task/System/PropertyTask.php
@@ -113,9 +113,9 @@ class PropertyTask extends Task
private $required = false;
/**
- * @param FileParserFactoryInterface $fileParserFactory
+ * @param FileParserFactoryInterface|null $fileParserFactory
*/
- public function __construct(FileParserFactoryInterface $fileParserFactory = null)
+ public function __construct(?FileParserFactoryInterface $fileParserFactory = null)
{
parent::__construct();
$this->fileParserFactory = $fileParserFactory ?? new FileParserFactory();
diff --git a/src/Phing/Type/AbstractFileSet.php b/src/Phing/Type/AbstractFileSet.php
index c64eed0665..22473ba9c0 100644
--- a/src/Phing/Type/AbstractFileSet.php
+++ b/src/Phing/Type/AbstractFileSet.php
@@ -175,11 +175,11 @@ public function setDir($dir)
}
/**
- * @param Project $p
+ * @param Project|null $p
*
* @throws BuildException
*/
- public function getDir(Project $p = null)
+ public function getDir(?Project $p = null)
{
if (null === $p) {
$p = $this->getProject();
@@ -368,13 +368,13 @@ public function setErrorOnMissingDir(bool $errorOnMissingDir)
/**
* returns a reference to the dirscanner object belonging to this fileset.
*
- * @param Project $p
+ * @param Project|null $p
*
* @throws BuildException
*
* @return DirectoryScanner
*/
- public function getDirectoryScanner(Project $p = null)
+ public function getDirectoryScanner(?Project $p = null)
{
if (null === $p) {
$p = $this->getProject();
@@ -406,7 +406,7 @@ public function getDirectoryScanner(Project $p = null)
return $ds;
}
- public function dieOnCircularReference(&$stk, Project $p = null)
+ public function dieOnCircularReference(&$stk, ?Project $p = null)
{
if ($this->checked) {
return;
@@ -572,11 +572,11 @@ public function getIterator(...$options): ArrayIterator
/**
* feed dirscanner with infos defined by this fileset.
*
- * @param Project $p
+ * @param Project|null $p
*
* @throws BuildException
*/
- protected function setupDirectoryScanner(DirectoryScanner $ds, Project $p = null)
+ protected function setupDirectoryScanner(DirectoryScanner $ds, ?Project $p = null)
{
if (null === $p) {
$p = $this->getProject();
diff --git a/src/Phing/Type/Commandline.php b/src/Phing/Type/Commandline.php
index b846e39833..c40ec68f72 100644
--- a/src/Phing/Type/Commandline.php
+++ b/src/Phing/Type/Commandline.php
@@ -241,14 +241,14 @@ public static function quoteArgument($argument, $escape = false)
/**
* Crack a command line.
*
- * @param string $toProcess the command line to process
+ * @param string|null $toProcess the command line to process
*
* @throws BuildException
*
* @return string[] the command line broken into strings.
* An empty or null toProcess parameter results in a zero sized array.
*/
- public static function translateCommandline(string $toProcess = null): array
+ public static function translateCommandline(?string $toProcess = null): array
{
if (null === $toProcess || '' === $toProcess) {
return [];
@@ -382,12 +382,12 @@ public function describeCommand($args = null)
* verbose output before a call to
* Runtime.exec(String[])
.
*
- * @param array $args arguments to use (default is to use current class args)
- * @param int $offset ignore entries before this index
+ * @param array|null $args arguments to use (default is to use current class args)
+ * @param int $offset ignore entries before this index
*
* @return string
*/
- public function describeArguments(array $args = null, $offset = 0)
+ public function describeArguments(?array $args = null, $offset = 0)
{
if (null === $args) {
$args = $this->getArguments();
diff --git a/src/Phing/Type/DataType.php b/src/Phing/Type/DataType.php
index 2e32756d09..513f83eede 100644
--- a/src/Phing/Type/DataType.php
+++ b/src/Phing/Type/DataType.php
@@ -120,12 +120,12 @@ public function setChecked($checked)
* The general contract of this method is that it shouldn't do
* anything if checked is true and set it to true on exit.
*
- * @param array $stk
- * @param Project $p
+ * @param array $stk
+ * @param Project|null $p
*
* @throws BuildException
*/
- public function dieOnCircularReference(&$stk, Project $p = null)
+ public function dieOnCircularReference(&$stk, ?Project $p = null)
{
if ($this->checked || !$this->isReference()) {
return;
diff --git a/src/Phing/Type/Path.php b/src/Phing/Type/Path.php
index d7f4d64238..a3eb5ef2ae 100644
--- a/src/Phing/Type/Path.php
+++ b/src/Phing/Type/Path.php
@@ -438,12 +438,12 @@ public function size()
* Overrides the version of DataType to recurse on all DataType
* child elements that may have been added.
*
- * @param array $stk
- * @param Project $p
+ * @param array $stk
+ * @param Project|null $p
*
* @throws BuildException
*/
- public function dieOnCircularReference(&$stk, Project $p = null)
+ public function dieOnCircularReference(&$stk, ?Project $p = null)
{
if ($this->checked) {
return;
diff --git a/src/Phing/Type/Reference.php b/src/Phing/Type/Reference.php
index b4e4db32ec..2ac27a1afa 100644
--- a/src/Phing/Type/Reference.php
+++ b/src/Phing/Type/Reference.php
@@ -89,7 +89,7 @@ public function getProject(): Phing\Project
*
* @return object
*/
- public function getReferencedObject(Project $fallback = null)
+ public function getReferencedObject(?Project $fallback = null)
{
$project = $fallback ?? $this->project;
diff --git a/src/Phing/Type/Selector/AbstractSelectorContainer.php b/src/Phing/Type/Selector/AbstractSelectorContainer.php
index 30d5a092ce..e2b84a1371 100644
--- a/src/Phing/Type/Selector/AbstractSelectorContainer.php
+++ b/src/Phing/Type/Selector/AbstractSelectorContainer.php
@@ -179,7 +179,7 @@ public function appendSelector(FileSelector $selector)
$this->selectorsList[] = $selector;
}
- public function dieOnCircularReference(&$stk, Project $p = null)
+ public function dieOnCircularReference(&$stk, ?Project $p = null)
{
if ($this->checked) {
return;
diff --git a/src/Phing/Type/Selector/BaseSelector.php b/src/Phing/Type/Selector/BaseSelector.php
index 0944708602..2ed32236d8 100644
--- a/src/Phing/Type/Selector/BaseSelector.php
+++ b/src/Phing/Type/Selector/BaseSelector.php
@@ -50,10 +50,10 @@ abstract class BaseSelector extends DataType implements FileSelector
* Allows all selectors to indicate a setup error. Note that only
* the first error message is recorded.
*
- * @param string $msg the error message any BuildException should throw
- * @param Exception $cause
+ * @param string $msg the error message any BuildException should throw
+ * @param Exception|null $cause
*/
- public function setError($msg, Exception $cause = null)
+ public function setError($msg, ?Exception $cause = null)
{
if (null === $this->errmsg) {
$this->errmsg = $msg;
diff --git a/src/Phing/Type/Selector/Modified/PropertiesCache.php b/src/Phing/Type/Selector/Modified/PropertiesCache.php
index 2776d4ee63..9b8653b16a 100644
--- a/src/Phing/Type/Selector/Modified/PropertiesCache.php
+++ b/src/Phing/Type/Selector/Modified/PropertiesCache.php
@@ -50,9 +50,9 @@ class PropertiesCache implements Cache
/**
* Constructor.
*
- * @param File $cachefile set the cachefile
+ * @param File|null $cachefile set the cachefile
*/
- public function __construct(File $cachefile = null)
+ public function __construct(?File $cachefile = null)
{
$this->cache = new Properties();
$this->cachefile = $cachefile;
diff --git a/src/Phing/Util/Properties.php b/src/Phing/Util/Properties.php
index d3d031b8db..1fb753c4d6 100644
--- a/src/Phing/Util/Properties.php
+++ b/src/Phing/Util/Properties.php
@@ -52,10 +52,10 @@ class Properties
/**
* Constructor.
*
- * @param array $properties
- * @param FileParserInterface $fileParser
+ * @param array $properties
+ * @param FileParserInterface|null $fileParser
*/
- public function __construct($properties = null, FileParserInterface $fileParser = null)
+ public function __construct($properties = null, ?FileParserInterface $fileParser = null)
{
$this->fileParser = null == $fileParser ? new IniFileParser() : $fileParser;
@@ -103,12 +103,12 @@ public function load(File $file)
/**
* Stores current properties to specified file.
*
- * @param File $file file to create/overwrite with properties
- * @param string $header header text that will be placed (within comments) at the top of properties file
+ * @param File|null $file file to create/overwrite with properties
+ * @param string $header header text that will be placed (within comments) at the top of properties file
*
* @throws IOException - on error writing properties file
*/
- public function store(File $file = null, $header = null)
+ public function store(?File $file = null, $header = null)
{
if (null == $file) {
$file = $this->file;
diff --git a/src/Phing/Util/StatisticsReport.php b/src/Phing/Util/StatisticsReport.php
index 8eb599132a..0e28bb51ce 100644
--- a/src/Phing/Util/StatisticsReport.php
+++ b/src/Phing/Util/StatisticsReport.php
@@ -86,7 +86,7 @@ public function push(ProjectTimer $projectTimer)
$this->stack->push($projectTimer);
}
- public function write(ProjectTimer $projectTimer = null)
+ public function write(?ProjectTimer $projectTimer = null)
{
if (null !== $projectTimer) {
$this->create('Target Statistics', $projectTimer->toTargetSeriesMap());
diff --git a/tests/Phing/Test/Task/System/ApplyTaskTest.php b/tests/Phing/Test/Task/System/ApplyTaskTest.php
index 496490e9bf..0d41e07d59 100644
--- a/tests/Phing/Test/Task/System/ApplyTaskTest.php
+++ b/tests/Phing/Test/Task/System/ApplyTaskTest.php
@@ -457,7 +457,7 @@ public function testMapperSupport(): void
*
* @throws ReflectionException
*/
- protected function assertAttributeIsSetTo(string $property, $value, string $propertyName = null): void
+ protected function assertAttributeIsSetTo(string $property, $value, ?string $propertyName = null): void
{
$task = $this->getConfiguredTask('testPropertySet' . ucfirst($property), ApplyTask::class);