diff --git a/src/CombinationApprovals.php b/src/CombinationApprovals.php index 12b2ae7..df605ce 100644 --- a/src/CombinationApprovals.php +++ b/src/CombinationApprovals.php @@ -84,8 +84,8 @@ public static function verifyAllCombinations9($param, array $values1, array $val Approvals::verifyString($output, $reporter); } - public static function displayArguments(...$args): string + public static function displayArguments(...$args) { return '[' . implode(', ', array_filter($args, function($i) { return $i !== self::$empty[0]; })) . "] => "; } -} \ No newline at end of file +} diff --git a/src/FileApprover.php b/src/FileApprover.php index 65e3251..2b0ad6d 100644 --- a/src/FileApprover.php +++ b/src/FileApprover.php @@ -4,7 +4,7 @@ class FileApprover { - public static function checkFiles(string $approvedFilename, string $receivedFilename): bool + public static function checkFiles($approvedFilename, $receivedFilename) { $approvedContents = FileApprover::clean(file_get_contents($approvedFilename)); $receivedContents = FileApprover::clean(file_get_contents($receivedFilename)); @@ -12,8 +12,8 @@ public static function checkFiles(string $approvedFilename, string $receivedFile return $approvedContents === $receivedContents; } - private static function clean(string $contents): string + private static function clean($contents) { return str_replace("\r\n", "\n", $contents); } -} \ No newline at end of file +} diff --git a/src/Namers/PHPUnitNamer.php b/src/Namers/PHPUnitNamer.php index b9904e2..3289e04 100644 --- a/src/Namers/PHPUnitNamer.php +++ b/src/Namers/PHPUnitNamer.php @@ -68,7 +68,7 @@ private static function endsWith($haystack, $needle) return substr($haystack, -$length) === $needle; } - public function __toString(): string { + public function __toString() { return "[PHPUnit,class,method,reflection,testDirectory]=" ."[{$this->isPHPUnitTest},{$this->class},{$this->function},{$this->isReflection},{$this->testDirectory}]"; } diff --git a/src/Reporters/DiffInfo.php b/src/Reporters/DiffInfo.php index d6c9364..82e2fdd 100644 --- a/src/Reporters/DiffInfo.php +++ b/src/Reporters/DiffInfo.php @@ -8,14 +8,14 @@ class DiffInfo public $parameters; public $fileExtensions; - public function __construct(string $diffProgram, array $fileExtensions, string $parameters = null) + public function __construct($diffProgram, array $fileExtensions, $parameters = null) { $this->diffProgram = self::resolveWindowsPath($diffProgram); - $this->parameters = $parameters ?? GenericDiffReporter::$STANDARD_ARGUMENTS; + $this->parameters = $parameters ?: GenericDiffReporter::$STANDARD_ARGUMENTS; $this->fileExtensions = $fileExtensions; } - private static function resolveWindowsPath(string $diffProgram): string + private static function resolveWindowsPath($diffProgram) { $tag = "{ProgramFiles}"; @@ -26,13 +26,13 @@ private static function resolveWindowsPath(string $diffProgram): string return $diffProgram; } - private static function getPathInProgramFilesX86(string $path): string + private static function getPathInProgramFilesX86($path) { $paths = self::getProgramFilesPaths(); return self::getFirstWorking($path, $paths, "C:\\Program Files\\"); } - public static function getFirstWorking(string $path, array $paths, string $ifNotFoundDefault): string + public static function getFirstWorking($path, array $paths, $ifNotFoundDefault) { $fullPath = $ifNotFoundDefault . $path; foreach ($paths as $p) { @@ -44,7 +44,7 @@ public static function getFirstWorking(string $path, array $paths, string $ifNot return $fullPath; } - public static function getProgramFilesPaths(): array + public static function getProgramFilesPaths() { $paths = [ getenv("ProgramFiles(x86)"), @@ -56,4 +56,4 @@ public static function getProgramFilesPaths(): array ]; return array_unique(array_filter($paths)); } -} \ No newline at end of file +} diff --git a/src/Reporters/DiffPrograms.php b/src/Reporters/DiffPrograms.php index 0a4306f..a4810ec 100644 --- a/src/Reporters/DiffPrograms.php +++ b/src/Reporters/DiffPrograms.php @@ -6,7 +6,7 @@ class DiffPrograms { private static $instance = null; - public static function getInstance(): DiffPrograms { + public static function getInstance() { if (!self::$instance) { self::$instance = new DiffPrograms(); } diff --git a/src/Reporters/GenericDiffReporter.php b/src/Reporters/GenericDiffReporter.php index e461734..cd61292 100644 --- a/src/Reporters/GenericDiffReporter.php +++ b/src/Reporters/GenericDiffReporter.php @@ -16,7 +16,7 @@ class GenericDiffReporter implements Reporter private $fileExtensions; private $parameters; - public function __construct(string $diffProgram, array $fileExtensions, string $parameters) { + public function __construct($diffProgram, array $fileExtensions, $parameters) { $this->diffProgram = $diffProgram; $this->fileExtensions = $fileExtensions; $this->parameters = $parameters; @@ -31,4 +31,4 @@ public function isWorkingInThisEnvironment($receivedFilename) { return is_executable($this->diffProgram); } -} \ No newline at end of file +} diff --git a/src/Reporters/Mac/MacDiffInfoReporter.php b/src/Reporters/Mac/MacDiffInfoReporter.php index 7208443..9aec628 100644 --- a/src/Reporters/Mac/MacDiffInfoReporter.php +++ b/src/Reporters/Mac/MacDiffInfoReporter.php @@ -7,9 +7,9 @@ class MacDiffInfoReporter extends GenericDiffReporter { - public function __construct(string $diffInfoName) + public function __construct($diffInfoName) { $diffInfo = DiffPrograms::getInstance()->MacDiffPrograms[$diffInfoName]; parent::__construct($diffInfo->diffProgram, $diffInfo->fileExtensions, $diffInfo->parameters); } -} \ No newline at end of file +} diff --git a/src/Reporters/Windows/WindowsDiffInfoReporter.php b/src/Reporters/Windows/WindowsDiffInfoReporter.php index 7f266ea..20bf518 100644 --- a/src/Reporters/Windows/WindowsDiffInfoReporter.php +++ b/src/Reporters/Windows/WindowsDiffInfoReporter.php @@ -7,9 +7,9 @@ class WindowsDiffInfoReporter extends GenericDiffReporter { - public function __construct(string $diffInfoName) + public function __construct($diffInfoName) { $diffInfo = DiffPrograms::getInstance()->WindowsDiffPrograms[$diffInfoName]; parent::__construct($diffInfo->diffProgram, $diffInfo->fileExtensions, $diffInfo->parameters); } -} \ No newline at end of file +} diff --git a/src/SystemUtil.php b/src/SystemUtil.php index 969683e..6328222 100644 --- a/src/SystemUtil.php +++ b/src/SystemUtil.php @@ -4,7 +4,7 @@ class SystemUtil { - public static function isWindows(): bool + public static function isWindows() { // Based on http://php.net/manual/en/function.php-uname.php return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; diff --git a/src/Writers/TextWriter.php b/src/Writers/TextWriter.php index 7c1c4ea..704bdd4 100644 --- a/src/Writers/TextWriter.php +++ b/src/Writers/TextWriter.php @@ -21,21 +21,21 @@ public function getExtensionWithoutDot() /** * Write the file to disk */ - public function write(string $fileNameAndPath, string $approvalsFolder) + public function write($fileNameAndPath, $approvalsFolder) { FileUtil::createFolderIfNotExists($approvalsFolder); file_put_contents($fileNameAndPath, $this->received); return $fileNameAndPath; } - public function writeEmpty(string $fileNameAndPath, string $approvalsFolder) + public function writeEmpty($fileNameAndPath, $approvalsFolder) { FileUtil::createFolderIfNotExists($approvalsFolder); file_put_contents($fileNameAndPath, " "); return $fileNameAndPath; } - public function delete(string $fileNameAndPath) + public function delete($fileNameAndPath) { return unlink($fileNameAndPath); } diff --git a/src/Writers/Writer.php b/src/Writers/Writer.php index ff1711a..3efe2c2 100644 --- a/src/Writers/Writer.php +++ b/src/Writers/Writer.php @@ -6,8 +6,8 @@ interface Writer { public function getExtensionWithoutDot(); - public function write(string $fileNameAndPath, string $approvalsFolder); - public function writeEmpty(string $fileNameAndPath, string $approvalsFolder); + public function write($fileNameAndPath, $approvalsFolder); + public function writeEmpty($fileNameAndPath, $approvalsFolder); - public function delete(string $fileNameAndPath); + public function delete($fileNameAndPath); }