Skip to content

Commit

Permalink
Apply some coding standard fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Jan 7, 2021
1 parent f3f6b00 commit e097f6f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
20 changes: 20 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3150,11 +3150,26 @@ parameters:
count: 1
path: tests/Parser/DocBlockParserTest.php

-
message: "#^Parameter \\#2 \\$context of method Doctum\\\\Parser\\\\DocBlockParser\\:\\:parse\\(\\) expects Doctum\\\\Parser\\\\ParserContext, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject given\\.$#"
count: 4
path: tests/Parser/DocBlockParserTest.php

-
message: "#^Method Doctum\\\\Tests\\\\Parser\\\\DocBlockParserTest\\:\\:testParse7dot1plus\\(\\) has parameter \\$expected with no value type specified in iterable type array\\.$#"
count: 1
path: tests/Parser/DocBlockParserTest.php

-
message: "#^Method Doctum\\\\Tests\\\\Parser\\\\DocBlockParserTest\\:\\:testParseWithNamespace\\(\\) has parameter \\$expected with no value type specified in iterable type array\\.$#"
count: 1
path: tests/Parser/DocBlockParserTest.php

-
message: "#^Method Doctum\\\\Tests\\\\Parser\\\\DocBlockParserTest\\:\\:testParseWithAliases\\(\\) has parameter \\$expected with no value type specified in iterable type array\\.$#"
count: 1
path: tests/Parser/DocBlockParserTest.php

-
message: "#^Method Doctum\\\\Tests\\\\Parser\\\\DocBlockParserTest\\:\\:getParseTests\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -3170,6 +3185,11 @@ parameters:
count: 1
path: tests/Parser/DocBlockParserTest.php

-
message: "#^Method Doctum\\\\Tests\\\\Parser\\\\DocBlockParserTest\\:\\:getContextMock\\(\\) has parameter \\$aliases with no value type specified in iterable type array\\.$#"
count: 1
path: tests/Parser/DocBlockParserTest.php

-
message: "#^Method Doctum\\\\Tests\\\\Parser\\\\NodeVisitorTest\\:\\:testMethodTypehints\\(\\) has parameter \\$expectedHints with no value type specified in iterable type array\\.$#"
count: 1
Expand Down
12 changes: 8 additions & 4 deletions tests/Parser/DocBlockParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
namespace Doctum\Tests\Parser;

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
use Doctum\Parser\ParserContext;
use Doctum\Parser\DocBlockParser;
use Doctum\Parser\Node\DocBlockNode;

Expand Down Expand Up @@ -47,7 +49,8 @@ public function testParse7dot1plus(string $comment, array $expected): void
/**
* @dataProvider getParseTests
*/
public function testParseWithNamespace(string $comment, array $expected): void {
public function testParseWithNamespace(string $comment, array $expected): void
{
$parser = new DocBlockParser();
$expected = isset($expected['namespace']) ? $expected['namespace'] : $expected[0];
$this->assertEquals($this->createDocblock($expected), $parser->parse($comment, $this->getContextMock(self::NAMESPACE)));
Expand All @@ -56,7 +59,8 @@ public function testParseWithNamespace(string $comment, array $expected): void {
/**
* @dataProvider getParseTests
*/
public function testParseWithAliases(string $comment, array $expected): void {
public function testParseWithAliases(string $comment, array $expected): void
{
$parser = new DocBlockParser();
$expected = isset($expected['namespaceAndAlias']) ? $expected['namespaceAndAlias'] : $expected[0];
$this->assertEquals(
Expand Down Expand Up @@ -650,9 +654,9 @@ private function createDocblock(array $elements): DocBlockNode
return $docblock;
}

private function getContextMock($namespace = '', $aliases = [])
private function getContextMock(string $namespace = '', array $aliases = []): MockObject
{
$contextMock = $this->getMockBuilder('Doctum\Parser\ParserContext')->disableOriginalConstructor()->getMock();
$contextMock = $this->getMockBuilder(ParserContext::class)->disableOriginalConstructor()->getMock();
$contextMock->expects($this->once())->method('getNamespace')->will($this->returnValue($namespace));
$contextMock->expects($this->once())->method('getAliases')->will($this->returnValue($aliases));

Expand Down

0 comments on commit e097f6f

Please sign in to comment.