Skip to content

Commit

Permalink
Add PHP 8.3 to GitHub actions (#454)
Browse files Browse the repository at this point in the history
* Add PHP 8.3 to GitHub actions
* Remove unused code
  • Loading branch information
msmakouz authored Jan 4, 2024
1 parent ea9b0b1 commit 1cf556d
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 40 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ci-mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ jobs:
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'
- php: '8.1'
extensions: pdo, pdo_sqlsrv-5.11.1
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'
- php: '8.2'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'
- php: '8.3'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'

services:
Expand Down Expand Up @@ -67,11 +73,11 @@ jobs:
run: composer self-update

- name: Install dependencies with composer
if: matrix.php != '8.2'
if: matrix.php != '8.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.2
if: matrix.php == '8.2'
- name: Install dependencies with composer php 8.4
if: matrix.php == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run tests with phpunit without coverage
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"

mysql-version:
- "5.7"
Expand Down Expand Up @@ -81,11 +82,11 @@ jobs:
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: Install dependencies with composer
if: matrix.php-version != '8.2'
if: matrix.php-version != '8.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.2
if: matrix.php-version == '8.2'
- name: Install dependencies with composer php 8.4
if: matrix.php-version == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run mysql tests with phpunit
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"

pgsql-version:
- "10"
Expand Down Expand Up @@ -82,11 +83,11 @@ jobs:
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: Install dependencies with composer
if: matrix.php-version != '8.2'
if: matrix.php-version != '8.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.2
if: matrix.php-version == '8.2'
- name: Install dependencies with composer php 8.4
if: matrix.php-version == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run pgsql tests with phpunit
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -46,10 +47,10 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies with composer
if: matrix.php-version != '8.2'
if: matrix.php-version != '8.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Install dependencies with composer php 8.2
if: matrix.php-version == '8.2'
- name: Install dependencies with composer php 8.4
if: matrix.php-version == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Execute Tests
run: |
Expand Down Expand Up @@ -79,6 +80,7 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -100,11 +102,11 @@ jobs:
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies with composer
if: matrix.php-version != '8.2'
if: matrix.php-version != '8.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.2
if: matrix.php-version == '8.2'
- name: Install dependencies with composer php 8.4
if: matrix.php-version == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Execute Tests
Expand Down
2 changes: 1 addition & 1 deletion src/Mapper/DatabaseMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function cast(array $data): array

public function uncast(array $data): array
{
if (! $this->typecast instanceof UncastableInterface) {
if (!$this->typecast instanceof UncastableInterface) {
return $data;
}

Expand Down
6 changes: 1 addition & 5 deletions src/Relation/BelongsTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,7 @@ private function shouldPull(Tuple $tuple, Tuple $rTuple): bool
if ($rTuple->status < $minStatus) {
return false;
}
$faitFields = \array_intersect($this->outerKeys, $rTuple->state->getWaitingFields());
// Skip waited fields they are not required hard
if ($faitFields !== [] && \array_sum($faitFields) > 0) {
return false;
}

// Check bidirected relation: when related entity has been removed from HasSome relation
$oldData = $tuple->node->getData();
$newData = $rTuple->state->getTransactionData();
Expand Down
2 changes: 1 addition & 1 deletion src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ private function compareManyToMany(array $relation, array $targetRelation): bool
return false;
}
// Optional fields
return ! (($schema[Relation::WHERE] ?? []) !== ($targetSchema[Relation::WHERE] ?? [])
return !(($schema[Relation::WHERE] ?? []) !== ($targetSchema[Relation::WHERE] ?? [])
|| ($schema[Relation::THROUGH_WHERE] ?? []) !== ($targetSchema[Relation::THROUGH_WHERE] ?? []));
}

Expand Down
20 changes: 10 additions & 10 deletions src/Transaction/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private function walkPool(): void
* @var Tuple $tuple
*/
foreach ($this->pool->openIterator() as $tuple) {
if ($tuple->task === Tuple::TASK_FORCE_DELETE && ! $tuple->cascade) {
if ($tuple->task === Tuple::TASK_FORCE_DELETE && !$tuple->cascade) {
// currently we rely on db to delete all nested records (or soft deletes)
$command = $this->commandGenerator->generateDeleteCommand($this->orm, $tuple);
$this->runCommand($command);
Expand All @@ -222,7 +222,7 @@ private function walkPool(): void

private function resolveMasterRelations(Tuple $tuple, RelationMap $map): int
{
if (! $map->hasDependencies()) {
if (!$map->hasDependencies()) {
return self::RELATIONS_RESOLVED;
}

Expand Down Expand Up @@ -262,7 +262,7 @@ private function resolveMasterRelations(Tuple $tuple, RelationMap $map): int

private function resolveSlaveRelations(Tuple $tuple, RelationMap $map): int
{
if (! $map->hasSlaves()) {
if (!$map->hasSlaves()) {
return self::RELATIONS_RESOLVED;
}
$changedFields = array_keys($tuple->state->getChanges());
Expand Down Expand Up @@ -296,8 +296,8 @@ private function resolveSlaveRelations(Tuple $tuple, RelationMap $map): int

if ($relationStatus !== RelationInterface::STATUS_PREPARE
&& $relationStatus !== RelationInterface::STATUS_RESOLVED
&& ! $isWaitingKeys
&& ! $hasChangedKeys
&& !$isWaitingKeys
&& !$hasChangedKeys
&& \count(array_intersect($innerKeys, array_keys($transactData))) === \count($innerKeys)
) {
$child ??= $tuple->state->getRelation($name);
Expand All @@ -313,16 +313,16 @@ private function resolveSlaveRelations(Tuple $tuple, RelationMap $map): int

private function resolveSelfWithEmbedded(Tuple $tuple, RelationMap $map, bool $hasDeferredRelations): void
{
if (! $map->hasEmbedded() && ! $tuple->state->hasChanges()) {
$tuple->status = ! $hasDeferredRelations
if (!$map->hasEmbedded() && !$tuple->state->hasChanges()) {
$tuple->status = !$hasDeferredRelations
? Tuple::STATUS_PROCESSED
: max(Tuple::STATUS_DEFERRED, $tuple->status);

return;
}
$command = $this->commandGenerator->generateStoreCommand($this->orm, $tuple);

if (! $map->hasEmbedded()) {
if (!$map->hasEmbedded()) {
// Not embedded but has changes
$this->runCommand($command);

Expand All @@ -349,7 +349,7 @@ private function resolveSelfWithEmbedded(Tuple $tuple, RelationMap $map, bool $h
}
$this->runCommand($command);

$tuple->status = $tuple->status === Tuple::STATUS_PREPROCESSED || ! $hasDeferredRelations
$tuple->status = $tuple->status === Tuple::STATUS_PREPROCESSED || !$hasDeferredRelations
? Tuple::STATUS_PROCESSED
: max(Tuple::STATUS_DEFERRED, $tuple->status);
}
Expand Down Expand Up @@ -389,7 +389,7 @@ private function resolveRelations(Tuple $tuple): void
: $this->resolveMasterRelations($tuple, $map);
}

if (! $isDependenciesResolved && $tuple->status === Tuple::STATUS_PREPROCESSED) {
if (!$isDependenciesResolved && $tuple->status === Tuple::STATUS_PREPROCESSED) {
$tuple->status = Tuple::STATUS_UNPROCESSED;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ORM/Unit/Command/DeleteCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testNoScope(): void
{
$this->expectException(CommandException::class);

$this->mapper = \Mockery::mock(MapperInterface::class);
$this->mapper = m::mock(MapperInterface::class);
$state = new State(Node::SCHEDULED_DELETE, []);
$cmd = new Delete(
m::mock(DatabaseInterface::class),
Expand Down
2 changes: 1 addition & 1 deletion tests/ORM/Unit/Command/InsertCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function setUp(): void
{
parent::setUp();

$this->mapper = \Mockery::mock(MapperInterface::class);
$this->mapper = m::mock(MapperInterface::class);

$this->cmd = new Insert(
$this->db = m::mock(DatabaseInterface::class),
Expand Down
4 changes: 2 additions & 2 deletions tests/ORM/Unit/Command/UpdateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function setUp(): void
{
parent::setUp();

$this->mapper = \Mockery::mock(MapperInterface::class);
$this->mapper = m::mock(MapperInterface::class);
$this->state = new State(Node::SCHEDULED_UPDATE, ['foo' => 'bar']);

$this->cmd = new Update(
Expand Down Expand Up @@ -106,7 +106,7 @@ public function testExecuteWithAppendix()
$this->db->shouldReceive('update')
->once()
->with('table', ['column' => 'value'], ['key' => 'scope'])
->andReturn($query = \Mockery::mock(UpdateQuery::class));
->andReturn($query = m::mock(UpdateQuery::class));

$query->shouldReceive('run')->once()->andReturn(5);

Expand Down
6 changes: 3 additions & 3 deletions tests/ORM/Unit/Parser/CompositeTypecastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function testSetRules(array $casters): void
}

$typecast = new CompositeTypecast(
... array_map(static fn (array $data) => $data[self::OPT_TYPECAST], $casters)
...array_map(static fn (array $data) => $data[self::OPT_TYPECAST], $casters)
);

$this->assertSame(self::RULES_RESULT, $typecast->setRules(self::RULES_INITIAL));
Expand All @@ -135,7 +135,7 @@ public function testCast(array $casters): void
}

$typecast = new CompositeTypecast(
... array_map(static fn (array $data) => $data[self::OPT_TYPECAST], $casters)
...array_map(static fn (array $data) => $data[self::OPT_TYPECAST], $casters)
);

$this->assertSame(self::CAST_RESULT, $typecast->cast(self::CAST_INITIAL));
Expand Down Expand Up @@ -163,7 +163,7 @@ public function testUncast(array $casters): void
}

$typecast = new CompositeTypecast(
... array_map(static fn (array $data) => $data[self::OPT_TYPECAST], $casters)
...array_map(static fn (array $data) => $data[self::OPT_TYPECAST], $casters)
);

$this->assertSame(self::UNCAST_RESULT, $typecast->uncast(self::UNCAST_INITIAL));
Expand Down

0 comments on commit 1cf556d

Please sign in to comment.