diff --git a/src/Approvals.php b/src/Approvals.php index cf61fed..d15b041 100644 --- a/src/Approvals.php +++ b/src/Approvals.php @@ -10,12 +10,12 @@ class Approvals { - public static function verifyString($received, Reporter $reporter = null) + public static function verifyString($received, ?Reporter $reporter = null) { self::verifyStringWithFileExtension($received, 'txt', $reporter); } - public static function verifyStringWithFileExtension($received, $extensionWithoutDot, Reporter $reporter = null) + public static function verifyStringWithFileExtension($received, $extensionWithoutDot, ?Reporter $reporter = null) { self::verify(new TextWriter($received, $extensionWithoutDot), new PHPUnitNamer(), $reporter); } @@ -28,7 +28,7 @@ public static function getReporter() /** * Perform the approval test by comparing the contents of one file to another */ - public static function verify(Writer $writer, Namer $namer, Reporter $reporter = null) + public static function verify(Writer $writer, Namer $namer, ?Reporter $reporter = null) { self::satisfyPHPUnitRequirementForAssert(); if ($reporter == null) { diff --git a/src/CombinationApprovals.php b/src/CombinationApprovals.php index 12b2ae7..b705e3e 100644 --- a/src/CombinationApprovals.php +++ b/src/CombinationApprovals.php @@ -11,47 +11,47 @@ class CombinationApprovals { static $empty = ["CombinationApprovalsEmpty"]; - public static function verifyAllCombinations1($param, array $values, Reporter $reporter = null) + public static function verifyAllCombinations1($param, array $values, ?Reporter $reporter = null) { self::verifyAllCombinations9($param, $values, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, $reporter); } - public static function verifyAllCombinations2($param, array $values1, array $values2, Reporter $reporter = null) + public static function verifyAllCombinations2($param, array $values1, array $values2, ?Reporter $reporter = null) { self::verifyAllCombinations9($param, $values1, $values2, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, $reporter); } - public static function verifyAllCombinations3($param, array $values1, array $values2, array $values3, Reporter $reporter = null) + public static function verifyAllCombinations3($param, array $values1, array $values2, array $values3, ?Reporter $reporter = null) { self::verifyAllCombinations9($param, $values1, $values2, $values3, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, $reporter); } - public static function verifyAllCombinations4($param, array $values1, array $values2, array $values3, array $values4, Reporter $reporter = null) + public static function verifyAllCombinations4($param, array $values1, array $values2, array $values3, array $values4, ?Reporter $reporter = null) { self::verifyAllCombinations9($param, $values1, $values2, $values3, $values4, self::$empty, self::$empty, self::$empty, self::$empty, self::$empty, $reporter); } - public static function verifyAllCombinations5($param, array $values1, array $values2, array $values3, array $values4, array $values5, Reporter $reporter = null) + public static function verifyAllCombinations5($param, array $values1, array $values2, array $values3, array $values4, array $values5, ?Reporter $reporter = null) { self::verifyAllCombinations9($param, $values1, $values2, $values3, $values4, $values5, self::$empty, self::$empty, self::$empty, self::$empty, $reporter); } - public static function verifyAllCombinations6($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, Reporter $reporter = null) + public static function verifyAllCombinations6($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, ?Reporter $reporter = null) { self::verifyAllCombinations9($param, $values1, $values2, $values3, $values4, $values5, $values6, self::$empty, self::$empty, self::$empty, $reporter); } - public static function verifyAllCombinations7($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, Reporter $reporter = null) + public static function verifyAllCombinations7($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, ?Reporter $reporter = null) { self::verifyAllCombinations9($param, $values1, $values2, $values3, $values4, $values5, $values6, $values7, self::$empty, self::$empty, $reporter); } - public static function verifyAllCombinations8($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, array $values8, Reporter $reporter = null) + public static function verifyAllCombinations8($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, array $values8, ?Reporter $reporter = null) { self::verifyAllCombinations9($param, $values1, $values2, $values3, $values4, $values5, $values6, $values7, $values8, self::$empty, $reporter); } - public static function verifyAllCombinations9($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, array $values8, array $values9, Reporter $reporter = null) + public static function verifyAllCombinations9($param, array $values1, array $values2, array $values3, array $values4, array $values5, array $values6, array $values7, array $values8, array $values9, ?Reporter $reporter = null) { $output = ''; foreach ($values1 as $i1) { diff --git a/src/Reporters/DiffInfo.php b/src/Reporters/DiffInfo.php index d6c9364..188f7e4 100644 --- a/src/Reporters/DiffInfo.php +++ b/src/Reporters/DiffInfo.php @@ -8,7 +8,7 @@ class DiffInfo public $parameters; public $fileExtensions; - public function __construct(string $diffProgram, array $fileExtensions, string $parameters = null) + public function __construct(string $diffProgram, array $fileExtensions, ?string $parameters = null) { $this->diffProgram = self::resolveWindowsPath($diffProgram); $this->parameters = $parameters ?? GenericDiffReporter::$STANDARD_ARGUMENTS; @@ -18,7 +18,7 @@ public function __construct(string $diffProgram, array $fileExtensions, string $ private static function resolveWindowsPath(string $diffProgram): string { $tag = "{ProgramFiles}"; - + $startsWith = substr($diffProgram, 0, strlen($tag)) === $tag; if ($startsWith) { $diffProgram = self::getPathInProgramFilesX86(substr($diffProgram, strlen($tag)));