Skip to content

Commit f653e65

Browse files
authored
Merge pull request #1 from emulgeator/travis-ci
Travis ci added
2 parents 906ed87 + 405a7ea commit f653e65

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: php
2+
php:
3+
- '7.4'
4+
before_install:
5+
- composer install --dev
6+
script: vendor/bin/phpunit test

src/DocBlock/DocBlockParser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
namespace Emul\ArrayToClassMapper\DocBlock;
55

6-
use Emul\ArrayToClassMapper\DocBlock\Entity\DocblockType;
6+
use Emul\ArrayToClassMapper\DocBlock\Entity\DocBlockType;
77

88
class DocBlockParser
99
{
10-
public function getType(string $docblock): ?DocblockType
10+
public function getType(string $docblock): ?DocBlockType
1111
{
1212
$matches = [];
1313
preg_match('#@var\s*([^\s]*)#i', $docblock, $matches);
@@ -34,7 +34,7 @@ public function getType(string $docblock): ?DocblockType
3434
$chosenType = reset($types);
3535
$isBuiltIn = $this->isBuiltInType($chosenType);
3636

37-
return new DocblockType($chosenType, $isSingle, $isBuiltIn, $isNullable);
37+
return new DocBlockType($chosenType, $isSingle, $isBuiltIn, $isNullable);
3838
}
3939

4040
private function isBuiltInType(string $type): bool

src/DocBlock/Entity/DocBlockType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Emul\ArrayToClassMapper\DocBlock\Entity;
55

6-
class DocblockType
6+
class DocBlockType
77
{
88
private string $name;
99

src/Mapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use Closure;
77
use Emul\ArrayToClassMapper\DocBlock\DocBlockParser;
8-
use Emul\ArrayToClassMapper\DocBlock\Entity\DocblockType;
8+
use Emul\ArrayToClassMapper\DocBlock\Entity\DocBlockType;
99
use ReflectionClass;
1010

1111
class Mapper
@@ -90,7 +90,7 @@ public function map(array $input, string $className)
9090
return $object;
9191
}
9292

93-
private function castArray(array $array, DocblockType $docblockType): array
93+
private function castArray(array $array, DocBlockType $docblockType): array
9494
{
9595
$castedArray = [];
9696
if ($docblockType->isBuiltIn()) {

test/Unit/MapperTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Carbon\Carbon;
77
use Emul\ArrayToClassMapper\Mapper;
88
use Emul\ArrayToClassMapper\DocBlock\DocBlockParser;
9-
use Emul\ArrayToClassMapper\DocBlock\Entity\DocblockType;
9+
use Emul\ArrayToClassMapper\DocBlock\Entity\DocBlockType;
1010
use Emul\ArrayToClassMapper\Test\Unit\Stub\CustomDocBlockTypeArrayStub;
1111
use Emul\ArrayToClassMapper\Test\Unit\Stub\CustomDocBlockTypedStub;
1212
use Emul\ArrayToClassMapper\Test\Unit\Stub\CustomTypedStub;
@@ -61,7 +61,7 @@ public function testMapWhenArrayTypedPropertyGivenWithBuiltInDockBlockType_shoul
6161
{
6262
$mapper = $this->getMapper();
6363

64-
$this->expectTypeRetrievedFromDocBlock('/** @var int[] */', new DocblockType('int', false, true, false));
64+
$this->expectTypeRetrievedFromDocBlock('/** @var int[] */', new DocBlockType('int', false, true, false));
6565

6666
$input = [
6767
'scalarTypedArray' => ['1', '2'],
@@ -80,7 +80,7 @@ public function testMapWhenArrayTypedPropertyGivenWithCustomDockBlockType_should
8080
$this->expectTypeRetrievedFromDocBlock('', null);
8181
$this->expectTypeRetrievedFromDocBlock(
8282
'/** @var \Emul\ArrayToClassMapper\Test\Unit\Stub\ScalarTypedStub[] */',
83-
new DocblockType('\Emul\ArrayToClassMapper\Test\Unit\Stub\ScalarTypedStub', false, false, false)
83+
new DocBlockType('\Emul\ArrayToClassMapper\Test\Unit\Stub\ScalarTypedStub', false, false, false)
8484
);
8585

8686
$input = [
@@ -137,7 +137,7 @@ public function testMapWhenScalarDocBlockTypePropertyGiven_shouldCastToDocumente
137137
{
138138
$mapper = $this->getMapper();
139139

140-
$this->expectTypeRetrievedFromDocBlock('/** @var int|null */', new DocblockType('int', true, true, true));
140+
$this->expectTypeRetrievedFromDocBlock('/** @var int|null */', new DocBlockType('int', true, true, true));
141141

142142
$input = ['int' => '1'];
143143

@@ -151,7 +151,7 @@ public function testMapWhenCustomDocBlockTypedPropertyGiven_shouldMapWithGivenMa
151151
{
152152
$currentTime = '2020-01-01 01:01:01';
153153

154-
$this->expectTypeRetrievedFromDocBlock('/** @var \Carbon\Carbon */', new DocblockType('\Carbon\Carbon', true, false, false));
154+
$this->expectTypeRetrievedFromDocBlock('/** @var \Carbon\Carbon */', new DocBlockType('\Carbon\Carbon', true, false, false));
155155

156156
$input = ['currentTime' => $currentTime];
157157
$customMapper = \Closure::fromCallable(function (string $timeString) {
@@ -167,7 +167,7 @@ public function testMapWhenCustomDocBlockTypedPropertyGiven_shouldMapWithGivenMa
167167
$this->assertSame($currentTime, $result->getCurrentTime()->toDateTimeString());
168168
}
169169

170-
private function expectTypeRetrievedFromDocBlock(string $docBlock, ?DocblockType $expectedResult)
170+
private function expectTypeRetrievedFromDocBlock(string $docBlock, ?DocBlockType $expectedResult)
171171
{
172172
$this->docBlockParser->shouldReceive('getType')->with($docBlock)->andReturn($expectedResult);
173173
}

0 commit comments

Comments
 (0)