Skip to content

Commit

Permalink
whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
jfoulquie-tnw committed Mar 30, 2022
1 parent aef740f commit ba48d3a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
8 changes: 4 additions & 4 deletions generator/tests/MethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,23 @@ public function testGetTypeHintFromRessource()
$this->assertEquals('', $params[0]->getSignatureType());
$this->assertEquals('int', $params[1]->getDocBlockType());
$this->assertEquals('int', $params[1]->getSignatureType());

$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/hash/functions/hash-update.xml');
$xmlObject = $docPage->getMethodSynopsis();
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader(), Method::FALSY_TYPE);
$params = $method->getParams();
$this->assertEquals('\HashContext', $params[0]->getDocBlockType());
$this->assertEquals('\HashContext', $params[0]->getSignatureType());
}

public function testImapOpen5Parameter()
{
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/imap/functions/imap-open.xml');
$xmlObject = $docPage->getMethodSynopsis();
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader(), Method::FALSY_TYPE);
$params = $method->getParams();
$this->assertEquals('\array', $params[5]->getDocBlockType());
$this->assertEquals('array', $params[5]->getSignatureType());
$this->assertEquals('array', $params[5]->getSignatureType());
}

public function testGetInitializer()
Expand All @@ -94,7 +94,7 @@ public function testGetInitializer()
$this->assertEquals('', $params[0]->getDefaultValue());
$this->assertEquals('false', $params[1]->getDefaultValue());
}

public function testGetReturnDocBlock(): void
{
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/array/functions/array-replace.xml');
Expand Down
34 changes: 16 additions & 18 deletions generator/tests/PhpStanFunctions/PhpStanTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

namespace Safe\PhpStanFunctions;


use PHPUnit\Framework\TestCase;
use Safe\Method;

class PhpStanTypeTest extends TestCase
{
public function testMixedTypes(): void
public function testMixedTypes(): void
{
$param = new PhpStanType('array|string|int');
$this->assertEquals('\array|string|int', $param->getDocBlockType());
Expand Down Expand Up @@ -53,8 +52,8 @@ public function testGenerics(): void
$this->assertEquals('array{0:float,1:float,2:float,3:float,4:float,5:float}', $param->getDocBlockType());
$this->assertEquals('array', $param->getSignatureType());
}
public function testNullable(): void

public function testNullable(): void
{
$param = new PhpStanType('array|null');
$this->assertEquals(true, $param->isNullable());
Expand All @@ -76,8 +75,8 @@ public function testNullable(): void
$this->assertEquals('\HashContext|null', $param->getDocBlockType());
$this->assertEquals('?\HashContext', $param->getSignatureType());
}
public function testParenthesisOutsideOfCallable(): void

public function testParenthesisOutsideOfCallable(): void
{
$param = new PhpStanType('(?int)|(?string)');
$this->assertEquals(true, $param->isNullable());
Expand All @@ -92,8 +91,8 @@ public function testFalsable(): void
$this->assertEquals('string|false', $param->getDocBlockType());
$this->assertEquals('string', $param->getSignatureType());
}
public function testResource(): void

public function testResource(): void
{
$param = new PhpStanType('resource');
$this->assertEquals('resource', $param->getDocBlockType());
Expand All @@ -106,8 +105,8 @@ public function testNamespace(): void
$this->assertEquals('\GMP', $param->getDocBlockType());
$this->assertEquals('\GMP', $param->getSignatureType());
}
public function testVoid(): void

public function testVoid(): void
{
$param = new PhpStanType('');
$this->assertEquals('', $param->getDocBlockType());
Expand All @@ -117,8 +116,8 @@ public function testVoid(): void
$this->assertEquals('void', $param->getDocBlockType());
$this->assertEquals('void', $param->getSignatureType());
}
public function testOciSpecialCases(): void

public function testOciSpecialCases(): void
{
$param = new PhpStanType('OCI-Collection');
$this->assertEquals('\OCI-Collection', $param->getDocBlockType());
Expand All @@ -128,14 +127,14 @@ public function testOciSpecialCases(): void
$this->assertEquals('\OCI-Lob', $param->getDocBlockType());
$this->assertEquals('', $param->getSignatureType());
}
public function testErrorTypeInteraction(): void

public function testErrorTypeInteraction(): void
{
//bool => void if the method is falsy
$param = new PhpStanType('bool');
$this->assertEquals('void', $param->getDocBlockType(Method::FALSY_TYPE));
$this->assertEquals('void', $param->getSignatureType(Method::FALSY_TYPE));

//int|false => int if the method is falsy
$param = new PhpStanType('int|false');
$this->assertEquals('int', $param->getDocBlockType(Method::FALSY_TYPE));
Expand All @@ -146,8 +145,8 @@ public function testErrorTypeInteraction(): void
$this->assertEquals('int', $param->getDocBlockType(Method::NULLSY_TYPE));
$this->assertEquals('int', $param->getSignatureType(Method::NULLSY_TYPE));
}
public function testDuplicateType(): void

public function testDuplicateType(): void
{
$param = new PhpStanType('array<string,string>|array<string,false>|array<string,array<int,mixed>>');
$this->assertEquals('array<string,string>|array<string,false>|array<string,array<int,mixed>>', $param->getDocBlockType());
Expand Down Expand Up @@ -188,5 +187,4 @@ public function testNumbersAreRemoved(): void
$this->assertEquals('int', $param->getDocBlockType());
$this->assertEquals('int', $param->getSignatureType());
}

}

0 comments on commit ba48d3a

Please # to comment.