diff --git a/.gitignore b/.gitignore index 2868aca..288434d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ composer.lock /bin/php-doc-check.phar.asc /.travis/php-doc-check-phar-private.pem /.travis/secrets.tar -.vscode/ \ No newline at end of file +.vscode/ +.phpunit.cache \ No newline at end of file diff --git a/composer.json b/composer.json index 0abfb00..4cbcded 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "require": { "nikic/php-parser": "^4.2", "wp-cli/php-cli-tools": "^0.11.11", - "ulrichsg/getopt-php": "^3.2", + "ulrichsg/getopt-php": "^4.0", "phpdocumentor/reflection-docblock": "^4.3|^5.0" }, "bin": [ @@ -22,10 +22,10 @@ "scripts":{ "test": [ "composer validate", - "vendor/bin/phpunit", - "vendor/bin/phpcs", - "vendor/bin/phpmd ./ text cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor/", - "vendor/bin/phpstan analyse src --level 7", + "phpunit", + "phpcs", + "phpmd ./ text cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor/", + "phpstan analyse src --level 7", "./bin/php-doc-check --exclude vendor/ ./" ] }, @@ -36,9 +36,9 @@ }, "require-dev": { "squizlabs/php_codesniffer": "^3.4", - "humbug/box": "^3.4", + "humbug/box": "^4.6", "phpmd/phpmd": "^2.6", - "phpstan/phpstan": "^0.11.1", - "phpunit/phpunit": "^7.5" + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5" } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..1c30da9 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,436 @@ +parameters: + ignoreErrors: + - + message: "#^Method NdB\\\\PhpDocCheck\\\\AnalysableFile\\:\\:__construct\\(\\) has parameter \\$arguments with no value type specified in iterable type GetOpt\\\\GetOpt\\.$#" + count: 1 + path: src/AnalysableFile.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\AnalysableFile\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/AnalysableFile.php + + - + message: "#^Parameter \\#3 \\$metric of class NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\MetricChecker constructor expects NdB\\\\PhpDocCheck\\\\Metrics\\\\Metric, object given\\.$#" + count: 1 + path: src/AnalysableFile.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysableFile\\:\\:\\$arguments has no type specified\\.$#" + count: 1 + path: src/AnalysableFile.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysableFile\\:\\:\\$file has no type specified\\.$#" + count: 1 + path: src/AnalysableFile.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysableFile\\:\\:\\$groupManager has no type specified\\.$#" + count: 1 + path: src/AnalysableFile.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysableFile\\:\\:\\$metrics has no type specified\\.$#" + count: 1 + path: src/AnalysableFile.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysableFile\\:\\:\\$parser has no type specified\\.$#" + count: 1 + path: src/AnalysableFile.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\AnalysisResult\\:\\:addProgress\\(\\) has no return type specified\\.$#" + count: 1 + path: src/AnalysisResult.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\AnalysisResult\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/AnalysisResult.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysisResult\\:\\:\\$findings has no type specified\\.$#" + count: 1 + path: src/AnalysisResult.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysisResult\\:\\:\\$hasErrors has no type specified\\.$#" + count: 1 + path: src/AnalysisResult.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysisResult\\:\\:\\$hasWarnings has no type specified\\.$#" + count: 1 + path: src/AnalysisResult.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\AnalysisResult\\:\\:\\$sourceFile has no type specified\\.$#" + count: 1 + path: src/AnalysisResult.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\ApplicationArgumentsProvider\\:\\:getArguments\\(\\) has parameter \\$arguments with no type specified\\.$#" + count: 1 + path: src/ApplicationArgumentsProvider.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\ApplicationArgumentsProvider\\:\\:getArguments\\(\\) return type has no value type specified in iterable type GetOpt\\\\GetOpt\\.$#" + count: 1 + path: src/ApplicationArgumentsProvider.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\ApplicationArgumentsProvider\\:\\:\\$getOpt has no type specified\\.$#" + count: 1 + path: src/ApplicationArgumentsProvider.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\FileFinder\\:\\:getFiles\\(\\) has parameter \\$arguments with no value type specified in iterable type GetOpt\\\\GetOpt\\.$#" + count: 1 + path: src/FileFinder.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Findings\\\\Finding\\:\\:getSortValue\\(\\) has parameter \\$sortMethod with no type specified\\.$#" + count: 1 + path: src/Findings/Finding.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Findings\\\\Finding\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Findings/Finding.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Findings\\\\Finding\\:\\:\\$metric has no type specified\\.$#" + count: 1 + path: src/Findings/Finding.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Findings\\\\Finding\\:\\:\\$node has no type specified\\.$#" + count: 1 + path: src/Findings/Finding.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Findings\\\\Finding\\:\\:\\$sourceFile has no type specified\\.$#" + count: 1 + path: src/Findings/Finding.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Findings\\\\Finding\\:\\:\\$value has no type specified\\.$#" + count: 1 + path: src/Findings/Finding.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\GroupContainer\\:\\:addFinding\\(\\) has no return type specified\\.$#" + count: 1 + path: src/GroupContainer.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\GroupContainer\\:\\:getGroups\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/GroupContainer.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\GroupManager\\:\\:addFinding\\(\\) has no return type specified\\.$#" + count: 1 + path: src/GroupManager.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\GroupManager\\:\\:getGroups\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/GroupManager.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\GroupManager\\:\\:\\$groupingMethod has no type specified\\.$#" + count: 1 + path: src/GroupManager.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\GroupManager\\:\\:\\$groups has no type specified\\.$#" + count: 1 + path: src/GroupManager.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\GroupManager\\:\\:\\$sortingMethod has no type specified\\.$#" + count: 1 + path: src/GroupManager.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\InvalidFileNode\\:\\:getAttributes\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/InvalidFileNode.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\InvalidFileNode\\:\\:getSubNodeNames\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/InvalidFileNode.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\InvalidFileNode\\:\\:setAttribute\\(\\) has no return type specified\\.$#" + count: 1 + path: src/InvalidFileNode.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\InvalidFileNode\\:\\:setAttributes\\(\\) has no return type specified\\.$#" + count: 1 + path: src/InvalidFileNode.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\InvalidFileNode\\:\\:setAttributes\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" + count: 1 + path: src/InvalidFileNode.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\InvalidFileNode\\:\\:setDocComment\\(\\) has no return type specified\\.$#" + count: 1 + path: src/InvalidFileNode.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Metrics\\\\CategoryDeprecated\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Metrics/CategoryDeprecated.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Metrics\\\\CategoryDeprecated\\:\\:\\$value has no type specified\\.$#" + count: 1 + path: src/Metrics/CategoryDeprecated.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Metrics\\\\CognitiveComplexity\\:\\:calculateNodeValue\\(\\) has parameter \\$depth with no type specified\\.$#" + count: 1 + path: src/Metrics/CognitiveComplexity.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Metrics\\\\CognitiveComplexity\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Metrics/CognitiveComplexity.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Metrics\\\\CognitiveComplexity\\:\\:\\$complexNodes has no type specified\\.$#" + count: 1 + path: src/Metrics/CognitiveComplexity.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Metrics\\\\CyclomaticComplexity\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Metrics/CyclomaticComplexity.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Metrics\\\\CyclomaticComplexity\\:\\:\\$complexNodes has no type specified\\.$#" + count: 1 + path: src/Metrics/CyclomaticComplexity.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Metrics\\\\FunctionLength\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Metrics/FunctionLength.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Metrics\\\\FunctionLength\\:\\:\\$value has no type specified\\.$#" + count: 1 + path: src/Metrics/FunctionLength.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Metrics\\\\InvalidFile\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Metrics/InvalidFile.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Metrics\\\\InvalidFile\\:\\:\\$value has no type specified\\.$#" + count: 1 + path: src/Metrics/InvalidFile.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Metrics\\\\SubpackageDeprecated\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Metrics/SubpackageDeprecated.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Metrics\\\\SubpackageDeprecated\\:\\:\\$value has no type specified\\.$#" + count: 1 + path: src/Metrics/SubpackageDeprecated.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\DocParser\\:\\:leaveNode\\(\\) should return array\\<PhpParser\\\\Node\\>\\|int\\|PhpParser\\\\Node\\|null but return statement is missing\\.$#" + count: 1 + path: src/NodeVisitors/DocParser.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\MetricChecker\\:\\:leaveNode\\(\\) should return array\\<PhpParser\\\\Node\\>\\|int\\|PhpParser\\\\Node\\|null but empty return statement found\\.$#" + count: 1 + path: src/NodeVisitors/MetricChecker.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\MetricChecker\\:\\:leaveNode\\(\\) should return array\\<PhpParser\\\\Node\\>\\|int\\|PhpParser\\\\Node\\|null but return statement is missing\\.$#" + count: 1 + path: src/NodeVisitors/MetricChecker.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\MetricChecker\\:\\:\\$analysisResult has no type specified\\.$#" + count: 1 + path: src/NodeVisitors/MetricChecker.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\MetricChecker\\:\\:\\$arguments has no type specified\\.$#" + count: 1 + path: src/NodeVisitors/MetricChecker.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\MetricChecker\\:\\:\\$groupManager has no type specified\\.$#" + count: 1 + path: src/NodeVisitors/MetricChecker.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\MetricChecker\\:\\:\\$metric has no type specified\\.$#" + count: 1 + path: src/NodeVisitors/MetricChecker.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\MetricChecker\\:\\:\\$sourceFile has no type specified\\.$#" + count: 1 + path: src/NodeVisitors/MetricChecker.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\ParentConnector\\:\\:beforeTraverse\\(\\) should return array\\<PhpParser\\\\Node\\>\\|null but return statement is missing\\.$#" + count: 1 + path: src/NodeVisitors/ParentConnector.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\ParentConnector\\:\\:enterNode\\(\\) should return int\\|PhpParser\\\\Node\\|null but return statement is missing\\.$#" + count: 1 + path: src/NodeVisitors/ParentConnector.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\ParentConnector\\:\\:leaveNode\\(\\) should return array\\<PhpParser\\\\Node\\>\\|int\\|PhpParser\\\\Node\\|null but return statement is missing\\.$#" + count: 1 + path: src/NodeVisitors/ParentConnector.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\NodeVisitors\\\\ParentConnector\\:\\:\\$stack has no type specified\\.$#" + count: 1 + path: src/NodeVisitors/ParentConnector.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Channels\\\\Channel\\:\\:out\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Channels/Channel.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Output\\\\Channels\\\\Channel\\:\\:\\$stream has no type specified\\.$#" + count: 1 + path: src/Output/Channels/Channel.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Channels\\\\Quiet\\:\\:out\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Channels/Quiet.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Channels\\\\Regular\\:\\:out\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Channels/Regular.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Format\\:\\:getExitCode\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Format.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Format\\:\\:out\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Format.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Format\\:\\:progress\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Format.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Format\\:\\:result\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Format.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Format\\:\\:\\$channels has no type specified\\.$#" + count: 1 + path: src/Output/Formats/Format.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Json\\:\\:out\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Json.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Json\\:\\:progress\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Json.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Json\\:\\:result\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Json.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Text\\:\\:formatRow\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/Output/Formats/Text.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Text\\:\\:getFileOutput\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Text.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Text\\:\\:out\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Text.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Text\\:\\:progress\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Text.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Output\\\\Formats\\\\Text\\:\\:result\\(\\) has no return type specified\\.$#" + count: 1 + path: src/Output/Formats/Text.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\ResultGroup\\:\\:addFinding\\(\\) has no return type specified\\.$#" + count: 1 + path: src/ResultGroup.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\ResultGroup\\:\\:getFindings\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/ResultGroup.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\ResultGroup\\:\\:getSortValue\\(\\) has parameter \\$sortMethod with no type specified\\.$#" + count: 1 + path: src/ResultGroup.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\ResultGroup\\:\\:jsonSerialize\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/ResultGroup.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\ResultGroup\\:\\:\\$findings has no type specified\\.$#" + count: 1 + path: src/ResultGroup.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\ResultGroup\\:\\:\\$name has no type specified\\.$#" + count: 1 + path: src/ResultGroup.php + + - + message: "#^Property NdB\\\\PhpDocCheck\\\\ResultGroup\\:\\:\\$sortingMethod has no type specified\\.$#" + count: 1 + path: src/ResultGroup.php + + - + message: "#^Method NdB\\\\PhpDocCheck\\\\Sortable\\:\\:getSortValue\\(\\) has parameter \\$sortMethod with no type specified\\.$#" + count: 1 + path: src/Sortable.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6f627b4..71293b8 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,23 +1,25 @@ -<phpunit - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"> - <testsuites> - <testsuite name="My Test Suite"> - <directory>./tests</directory> - </testsuite> - </testsuites> - <filter> - <whitelist processUncoveredFilesFromWhitelist="true"> - <directory suffix=".php">./src</directory> - </whitelist> - </filter> - <logging> - <log type="coverage-html" target="./artifacts/report" lowUpperBound="35" - highLowerBound="70"/> - <log type="coverage-clover" target="./artifacts/coverage.xml"/> - <log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/> - <log type="junit" target="./artifacts/logfile.xml"/> - <log type="testdox-html" target="./artifacts/testdox.html"/> - <log type="testdox-text" target="./artifacts/testdox.txt"/> - </logging> -</phpunit> \ No newline at end of file +<?xml version="1.0"?> +<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache"> + <coverage> + <report> + <clover outputFile="./artifacts/coverage.xml"/> + <html outputDirectory="./artifacts/report" lowUpperBound="35" highLowerBound="70"/> + <text outputFile="php://stdout" showUncoveredFiles="false"/> + </report> + </coverage> + <testsuites> + <testsuite name="My Test Suite"> + <directory>./tests</directory> + </testsuite> + </testsuites> + <logging> + <junit outputFile="./artifacts/logfile.xml"/> + <testdoxHtml outputFile="./artifacts/testdox.html"/> + <testdoxText outputFile="./artifacts/testdox.txt"/> + </logging> + <source> + <include> + <directory suffix=".php">./src</directory> + </include> + </source> +</phpunit> diff --git a/tests/AnalysisResultTest.php b/tests/AnalysisResultTest.php index a10e916..803fb54 100644 --- a/tests/AnalysisResultTest.php +++ b/tests/AnalysisResultTest.php @@ -4,7 +4,12 @@ final class AnalysisResultTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + + protected $metric; + protected $analysableFile; + protected $node; + + protected function setUp(): void { $this->metric = $this->createMock('\NdB\PhpDocCheck\Metrics\Metric'); $this->analysableFile = $this->createMock('\NdB\PhpDocCheck\AnalysableFile'); diff --git a/tests/Output/Formats/TextTest.php b/tests/Output/Formats/TextTest.php index 33ac06b..a061d77 100644 --- a/tests/Output/Formats/TextTest.php +++ b/tests/Output/Formats/TextTest.php @@ -29,9 +29,9 @@ public function testCanOutputSimpleResults() $results->method('getFindings')->willReturn(array( new \NdB\PhpDocCheck\Findings\Warning($node, $analysableFile, $metric, 0) )); - $results->sourceFile = $this->createMock(\NdB\PhpDocCheck\AnalysableFile::class); - $results->sourceFile->file = $this->createMock(\SplFileInfo::class); - $results->sourceFile->file->method('getRealPath')->willReturn('/tmp/test'); + $sourceFile = $this->createMock(\NdB\PhpDocCheck\AnalysableFile::class); + $sourceFile->file = $this->createMock(\SplFileInfo::class); + $sourceFile->file->method('getRealPath')->willReturn('/tmp/test'); $formatter->result(array($results)); }