Skip to content

Commit

Permalink
chore: Bumped
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Jun 17, 2024
1 parent b6c24b7 commit f0dee6f
Show file tree
Hide file tree
Showing 13 changed files with 194 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Install Dependencies
run: composer install --no-scripts --no-ansi --no-interaction --no-progress
- name: Run PHPUnit tests
run: vendor/bin/phpunit -v --whitelist ./src --coverage-clover ./build/logs/clover.xml src/Test
run: vendor/bin/phpunit -v --bootstrap=tests/bootstrap.php --whitelist ./src --coverage-clover ./build/logs/clover.xml tests/
- name: Run PHP Code Sniffer
run: vendor/bin/phpcs -p ./src
- name: Run PHPStan
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#
# Roadiz
#
/pimple.json

# Ignore Google webmaster tool verification
/google*.html
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright © 2024 Ambroise Maupate
Copyright © 2023 Ambroise Maupate

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test:
vendor/bin/phpunit -v --whitelist ./src --coverage-clover ./build/logs/clover.xml src/Test
vendor/bin/phpunit -v --bootstrap=tests/bootstrap.php --whitelist ./src --coverage-clover ./build/logs/clover.xml tests/
vendor/bin/phpcbf -p ./src
vendor/bin/phpstan analyse -c phpstan.neon

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
],
"require": {
"php": ">=8.1",
"doctrine/orm": "~2.19.0",
"doctrine/orm": "~2.17.0",
"jms/serializer": "^3.9.0",
"symfony/string": "6.4.*",
"symfony/translation-contracts": "^3.0",
"symfony/http-foundation": "6.4.*",
"symfony/serializer": "6.4.*",
"symfony/validator": "6.4.*"
"symfony/string": "5.4.*",
"symfony/translation-contracts": "^2.3",
"symfony/http-foundation": "5.4.*",
"symfony/serializer": "5.4.*",
"symfony/validator": "5.4.*"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand All @@ -46,8 +46,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev",
"dev-develop": "2.4.x-dev"
"dev-master": "2.2.x-dev",
"dev-develop": "2.3.x-dev"
}
}
}
6 changes: 3 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
parameters:
level: 7
level: max
paths:
- src
excludePaths:
- */node_modules/*
- */bower_components/*
- */static/*
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
- '#unknown class Parsedown(Extra)?#'
- '#Instantiated class Memcached not found#'
- '#Instantiated class Redis not found#'
reportUnmatchedIgnoredErrors: false
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
12 changes: 6 additions & 6 deletions src/Bag/LazyParameterBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
* @param mixed|null $default
* @return mixed|null
*/
public function get(string $key, $default = null): mixed
public function get(string $key, $default = null)
{
if (!$this->ready) {
$this->populateParameters();
Expand All @@ -50,7 +50,7 @@ public function all(string $key = null): array
*
* @return bool
*/
public function has(string $key): bool
public function has(string $key)
{
if (!$this->ready) {
$this->populateParameters();
Expand All @@ -62,7 +62,7 @@ public function has(string $key): bool
/**
* @return array
*/
public function keys(): array
public function keys()
{
if (!$this->ready) {
$this->populateParameters();
Expand All @@ -75,7 +75,7 @@ public function keys(): array
* @return \ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator(): \ArrayIterator
public function getIterator()
{
if (!$this->ready) {
$this->populateParameters();
Expand All @@ -88,7 +88,7 @@ public function getIterator(): \ArrayIterator
* @return int
*/
#[\ReturnTypeWillChange]
public function count(): int
public function count()
{
if (!$this->ready) {
$this->populateParameters();
Expand All @@ -105,7 +105,7 @@ public function count(): int
*
* @return mixed
*/
public function filter(string $key, $default = null, int $filter = \FILTER_DEFAULT, $options = []): mixed
public function filter(string $key, $default = null, int $filter = \FILTER_DEFAULT, $options = [])
{
if (!$this->ready) {
$this->populateParameters();
Expand Down
39 changes: 39 additions & 0 deletions src/Core/AbstractEntities/AbstractDateTimedPositioned.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace RZ\Roadiz\Core\AbstractEntities;

use ApiPlatform\Doctrine\Orm\Filter\NumericFilter;
use ApiPlatform\Metadata\ApiFilter;
use Doctrine\Common\Comparable;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
use ApiPlatform\Doctrine\Orm\Filter\RangeFilter;

/**
* Combined AbstractDateTimed and PositionedTrait.
*/
#[
ORM\MappedSuperclass,
ORM\HasLifecycleCallbacks,
ORM\Table,
ORM\Index(columns: ["position"]),
ORM\Index(columns: ["created_at"]),
ORM\Index(columns: ["updated_at"])
]
abstract class AbstractDateTimedPositioned extends AbstractDateTimed implements PositionedInterface, Comparable
{
use PositionedTrait;

#[
ORM\Column(type: "float"),
Serializer\Groups(["position"]),
Serializer\Type("float"),
SymfonySerializer\Groups(["position"]),
ApiFilter(RangeFilter::class),

Check failure on line 35 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.1)

Attribute class ApiPlatform\Metadata\ApiFilter does not exist.

Check failure on line 35 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.1)

Class ApiPlatform\Doctrine\Orm\Filter\RangeFilter not found.

Check failure on line 35 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.2)

Attribute class ApiPlatform\Metadata\ApiFilter does not exist.

Check failure on line 35 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.2)

Class ApiPlatform\Doctrine\Orm\Filter\RangeFilter not found.

Check failure on line 35 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.3)

Attribute class ApiPlatform\Metadata\ApiFilter does not exist.

Check failure on line 35 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.3)

Class ApiPlatform\Doctrine\Orm\Filter\RangeFilter not found.
ApiFilter(NumericFilter::class)

Check failure on line 36 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.1)

Attribute class ApiPlatform\Metadata\ApiFilter does not exist.

Check failure on line 36 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.1)

Class ApiPlatform\Doctrine\Orm\Filter\NumericFilter not found.

Check failure on line 36 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.2)

Attribute class ApiPlatform\Metadata\ApiFilter does not exist.

Check failure on line 36 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.2)

Class ApiPlatform\Doctrine\Orm\Filter\NumericFilter not found.

Check failure on line 36 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.3)

Attribute class ApiPlatform\Metadata\ApiFilter does not exist.

Check failure on line 36 in src/Core/AbstractEntities/AbstractDateTimedPositioned.php

View workflow job for this annotation

GitHub Actions / run-tests (8.3)

Class ApiPlatform\Doctrine\Orm\Filter\NumericFilter not found.
]
protected float $position = 0.0;
}
3 changes: 0 additions & 3 deletions src/Core/AbstractEntities/LeafTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ trait LeafTrait
{
use PositionedTrait;

/**
* @return Collection<int, LeafInterface>
*/
public function getChildren(): Collection
{
return $this->children;
Expand Down
21 changes: 18 additions & 3 deletions src/Core/Handlers/AbstractHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

abstract class AbstractHandler
{
protected ObjectManager $objectManager;

/**
* @return ObjectManager
*/
Expand All @@ -16,9 +18,22 @@ public function getObjectManager(): ObjectManager
return $this->objectManager;
}

public function __construct(
protected readonly ObjectManager $objectManager
) {
/**
* @param ObjectManager $objectManager
* @return static
*/
public function setObjectManager(ObjectManager $objectManager)
{
$this->objectManager = $objectManager;
return $this;
}

/**
* @param ObjectManager $objectManager
*/
public function __construct(ObjectManager $objectManager)
{
$this->objectManager = $objectManager;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Core/Handlers/HandlerFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@

interface HandlerFactoryInterface
{
/**
* @param AbstractEntity $entity
* @return AbstractHandler
*/
public function getHandler(AbstractEntity $entity): AbstractHandler;
}
Loading

0 comments on commit f0dee6f

Please sign in to comment.