Skip to content

Commit 4a0d14e

Browse files
committed
Merge branch 'develop'
2 parents 6d0a29b + 4f4f9bf commit 4a0d14e

15 files changed

+289
-33
lines changed

src/LeanMapper/Reflection/PropertyFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static function createFromAnnotation($annotationType, $annotation, Entity
112112

113113
foreach ($flagMatches as $match) {
114114
if ($match[1] === 'belongsToOne' || $match[1] === 'belongsToMany') {
115-
$isWritable = FALSE;
115+
$isWritable = false;
116116
break;
117117
}
118118
}

src/LeanMapper/Reflection/PropertyMethods.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class PropertyMethods
2424
/** @var string */
2525
private $getter;
2626

27-
/** @var string|NULL */
27+
/** @var string|null */
2828
private $setter;
2929

3030

3131

3232
/**
3333
* @param string
34-
* @param string|NULL
34+
* @param string|null
3535
*/
3636
public function __construct($getter, $setter)
3737
{
@@ -76,7 +76,7 @@ public static function createFromDefinition($propertyName, $isWritable, $definit
7676
{
7777
$ucName = ucfirst($propertyName);
7878
$getter = 'get' . $ucName;
79-
$setter = NULL;
79+
$setter = null;
8080
if ($isWritable) {
8181
$setter = 'set' . $ucName;
8282
}

src/LeanMapper/Repository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ protected function createEntities(array $rows, $entityClass = null, $table = nul
353353
}
354354
$entities = [];
355355
$collection = Result::createInstance($rows, $table, $this->connection, $this->mapper);
356-
$primaryKey = $this->mapper->getPrimaryKey($this->getTable());
356+
$primaryKey = $this->mapper->getPrimaryKey($table);
357357
if ($entityClass !== null) {
358358
foreach ($rows as $dibiRow) {
359359
$entity = $this->entityFactory->createEntity(
@@ -366,7 +366,7 @@ protected function createEntities(array $rows, $entityClass = null, $table = nul
366366
} else {
367367
foreach ($rows as $dibiRow) {
368368
$row = $collection->getRow($dibiRow->$primaryKey);
369-
$entityClass = $this->mapper->getEntityClass($this->getTable(), $row);
369+
$entityClass = $this->mapper->getEntityClass($table, $row);
370370
$entity = $this->entityFactory->createEntity($entityClass, $row);
371371
$entity->makeAlive($this->entityFactory);
372372
$entities[$dibiRow->$primaryKey] = $entity;

tests/LeanMapper/DI.extension.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $mapper = $container->getService('LeanMapper.mapper');
4949
/// debug mode + FileLogger
5050
$configurator = new Configurator;
5151
$configurator->setTempDirectory(TEMP_DIR);
52-
$configurator->setDebugMode(TRUE);
52+
$configurator->setDebugMode(true);
5353
$configurator->addParameters([
5454
'container' => ['class' => 'SystemContainer_' . Random::generate()],
5555
]);

tests/LeanMapper/Entity.enum.3.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ $author = new Author;
3131
$author->state = Author::STATE_ACTIVE;
3232
Assert::equal(Author::STATE_ACTIVE, $author->state);
3333

34-
$author->state = NULL;
35-
Assert::equal(NULL, $author->state);
34+
$author->state = null;
35+
Assert::equal(null, $author->state);
3636

3737
$author->finalState = Author::STATE_DELETED;
3838
Assert::equal(Author::STATE_DELETED, $author->finalState);
3939

4040
Assert::exception(function () use ($author) {
4141

42-
$author->finalState = NULL;
42+
$author->finalState = null;
4343

4444
}, 'LeanMapper\Exception\InvalidValueException', "Property 'finalState' in entity Author cannot be null.");

tests/LeanMapper/Entity.passThru.implicit.datetime.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Book extends LeanMapper\Entity
1515
{
1616
protected function decodeRowValue($value, Property $property)
1717
{
18-
if (is_a($property->getType(), 'DateTime', TRUE)) {
18+
if (is_a($property->getType(), 'DateTime', true)) {
1919
if ($value instanceof DateTime) {
2020
return clone $value;
2121
}
@@ -28,7 +28,7 @@ class Book extends LeanMapper\Entity
2828

2929
protected function encodeRowValue($value, Property $property)
3030
{
31-
if (is_a($property->getType(), 'DateTime', TRUE)) {
31+
if (is_a($property->getType(), 'DateTime', true)) {
3232
if ($value instanceof DateTime) {
3333
return $value->format('Y-m-d');
3434
}

tests/LeanMapper/Entity.passThru.implicit.json.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Book extends LeanMapper\Entity
3636
protected function convertJson($value)
3737
{
3838
if (is_string($value)) {
39-
return (array) json_decode($value, TRUE);
39+
return (array) json_decode($value, true);
4040
}
4141

4242
return json_encode((array) $value);

tests/LeanMapper/Entity.passThru.implicit.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ class Book extends LeanMapper\Entity
2525
return $this->convertJson($value);
2626
}
2727

28-
if (is_a($type, 'DateTime', TRUE)) {
28+
if (is_a($type, 'DateTime', true)) {
2929
if ($value instanceof DateTime) {
3030
return clone $value;
3131
}
3232
return new DateTime($value);
3333
}
3434

35-
if (is_a($type, 'Uuid', TRUE)) {
35+
if (is_a($type, 'Uuid', true)) {
3636
return ($value instanceof Uuid) ? $value : new Uuid($value);
3737
}
3838

39-
if (is_a($type, 'Time', TRUE)) {
39+
if (is_a($type, 'Time', true)) {
4040
return ($value instanceof Time) ? $value->getTime() : new Time($value);
4141
}
4242

43-
if (!$property->isBasicType() && is_a($type, 'Integer', TRUE)) { // is_a() accepts 'integer' as class name
43+
if (!$property->isBasicType() && is_a($type, 'Integer', true)) { // is_a() accepts 'integer' as class name
4444
return $this->convertToInteger($value);
4545
}
4646

@@ -56,22 +56,22 @@ class Book extends LeanMapper\Entity
5656
return $this->convertJson($value);
5757
}
5858

59-
if (is_a($type, 'DateTime', TRUE)) {
59+
if (is_a($type, 'DateTime', true)) {
6060
if ($value instanceof DateTime) {
6161
return $value->format('Y-m-d');
6262
}
6363
return $value;
6464
}
6565

66-
if (is_a($type, 'Uuid', TRUE)) {
66+
if (is_a($type, 'Uuid', true)) {
6767
return ($value instanceof Uuid) ? $value : new Uuid($value);
6868
}
6969

70-
if (is_a($type, 'Time', TRUE)) {
70+
if (is_a($type, 'Time', true)) {
7171
return ($value instanceof Time) ? $value->getTime() : new Time($value);
7272
}
7373

74-
if (!$property->isBasicType() && is_a($type, 'Integer', TRUE)) { // is_a() accepts 'integer' as class name
74+
if (!$property->isBasicType() && is_a($type, 'Integer', true)) { // is_a() accepts 'integer' as class name
7575
return $this->convertToInteger($value);
7676
}
7777

tests/LeanMapper/Entity.passThru.type-change.2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class Foo extends LeanMapper\Entity
1515
{
1616
protected function jsonEncodeData($data)
1717
{
18-
return !empty($data) ? json_encode($data) : NULL;
18+
return !empty($data) ? json_encode($data) : null;
1919
}
2020

2121

2222
protected function jsonDecodeData($data)
2323
{
24-
return !empty($data) ? json_decode($data, TRUE) : [];
24+
return !empty($data) ? json_decode($data, true) : [];
2525
}
2626
}
2727

tests/LeanMapper/Property.custom-factory.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require_once __DIR__ . '/../bootstrap.php';
1313

1414
class CustomReflectionProvider extends LeanMapper\DefaultEntityReflectionProvider
1515
{
16-
/** @var PropertyFilters|NULL */
16+
/** @var PropertyFilters|null */
1717
public static $customFilters;
1818

1919

@@ -50,7 +50,7 @@ class CustomReflectionProvider extends LeanMapper\DefaultEntityReflectionProvide
5050
$customFlags
5151
)
5252
{
53-
if ($propertyFilters !== NULL) {
53+
if ($propertyFilters !== null) {
5454
$propertyFilters = self::$customFilters;
5555
}
5656
return new Property(

0 commit comments

Comments
 (0)