Skip to content

Commit 1cab261

Browse files
committed
chore: configure linters and fixers
1 parent 6b27be5 commit 1cab261

8 files changed

Lines changed: 17 additions & 21 deletions

File tree

compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
services:
22
constructo:
3-
platform: linux/amd64
43
container_name: constructo-app
5-
image: devitools/hyperf:8.3-dev
4+
image: devitools/hyperf:8.3-arm-dev
65
working_dir: /opt/www
76
volumes:
87
- ./:/opt/www

examples/builder/basic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
use Constructo\Core\Serialize\Builder;
88
use Constructo\Support\Set;
9-
use Constructo\Type\Timestamp;
9+
use DateTime;
1010

1111
// Defina sua entidade informando os valores das propriedades no construtor
1212
readonly class User
1313
{
1414
public function __construct(
1515
public int $id,
1616
public string $name,
17-
public Timestamp $birthDate,
17+
public DateTime $birthDate,
1818
public bool $isActive = true,
1919
public array $tags = [],
2020
) {}

examples/demolisher/basic.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
require_once __DIR__ . '/../../vendor/autoload.php';
66

77
use Constructo\Core\Deserialize\Demolisher;
8-
use Constructo\Support\Set;
9-
use Constructo\Type\Timestamp;
8+
use DateTime;
109

1110
// Defina sua entidade informando os valores das propriedades no construtor
1211
readonly class User
1312
{
1413
public function __construct(
1514
public int $id,
1615
public string $name,
17-
public Timestamp $birthDate,
16+
public DateTime $birthDate,
1817
public bool $isActive = true,
1918
public array $tags = [],
2019
) {}
@@ -24,18 +23,17 @@ public function __construct(
2423
$user = new User(
2524
id: 1,
2625
name: 'João Silva',
27-
birthDate: new Timestamp('1981-08-13'),
26+
birthDate: new DateTime('1981-08-13'),
2827
isActive: true,
2928
tags: ['nice', 'welcome'],
3029
);
3130

3231
// Crie um novo demolisher e use-o para destruir o objeto
3332
$object = (new Demolisher())->demolish($user);
3433

35-
$set = Set::createFrom((array) $object);
3634
echo "# Usuário: \n";
37-
echo sprintf("# ID: %s\n", $set->get('id'));
38-
echo sprintf("# Nome: %s\n", $set->get('name'));
39-
echo sprintf("# Ativo: %s\n", $set->get('is_active') ? 'Sim' : 'Não');
40-
echo sprintf("# Tags: %s\n", implode(', ', $set->get('tags')));
41-
echo sprintf("# Data de Nascimento: %s\n", $set->get('birth_date'));
35+
echo sprintf("# ID: %s\n", $object->id);
36+
echo sprintf("# Nome: %s\n", $object->name);
37+
echo sprintf("# Ativo: %s\n", $object->is_active ? 'Sim' : 'Não');
38+
echo sprintf("# Tags: %s\n", implode(', ', $object->tags));
39+
echo sprintf("# Data de Nascimento: %s\n", $object->birth_date);

examples/reflector/basic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
require_once __DIR__ . '/../../vendor/autoload.php';
66

77
use Constructo\Factory\ReflectorFactory;
8-
use Constructo\Type\Timestamp;
8+
use DateTime;
99

1010
use function array_export;
1111

@@ -15,7 +15,7 @@
1515
public function __construct(
1616
public int $id,
1717
public string $name,
18-
public Timestamp $birthDate,
18+
public DateTime $birthDate,
1919
public bool $isActive = true,
2020
public array $tags = [],
2121
) {

src/Factory/ReflectorFactory.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
use Constructo\Support\Reflective\Notation;
1313
use Constructo\Testing\MakeExtension;
1414

15-
use function Constructo\Cast\arrayify;
16-
1715
use const CONSTRUCTO_SCHEMATA;
1816

1917
readonly class ReflectorFactory

src/Support/Metadata/Schema/Field.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
* @method self exists(string $table, string $column = null)
9191
*
9292
* # Behaviors
93-
* @method self in(array|string $items)
93+
* @method self in(array $items)
9494
* @method self notIn(array $items)
9595
* @method self regex(string $pattern, Closure|array $parameters = null)
9696
* @method self notRegex(string $pattern)

tests/Support/Metadata/Schema/Field/FieldsetTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Constructo\Support\Metadata\Schema\Registry\Specs;
1111
use PHPUnit\Framework\TestCase;
1212

13-
final class FieldsetTest extends TestCase
13+
class FieldsetTest extends TestCase
1414
{
1515
private Fieldset $fieldset;
1616
private Field $field1;
@@ -118,5 +118,6 @@ public function testFilterReturnsAllFieldsWhenAllMatch(): void
118118
$this->assertCount(2, $filtered);
119119
$this->assertContains($this->field1, $filtered);
120120
$this->assertContains($this->field2, $filtered);
121+
$this->assertSame($filtered, $this->fieldset->all());
121122
}
122123
}

tests/Support/Metadata/Schema/FieldTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function testCanSetFieldAsAvailable(): void
175175
{
176176
$field = new Field($this->specs, new Rules(), 'test_field');
177177

178-
// First make it unavailable
178+
// First, make it unavailable
179179
$field->unavailable();
180180
$this->assertFalse($field->isAvailable());
181181

0 commit comments

Comments
 (0)