diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 3e70a87..6539dde 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['8.1', '8.2', '8.3'] + php-version: ['8.0', '8.1'] steps: - uses: shivammathur/setup-php@v2 with: diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..56b6cd5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: php +sudo: required +php: + - 7.4 + - 8.0 + - 8.1 + - nightly +install: + - curl -s http://getcomposer.org/installer | php + - php composer.phar install --dev --no-interaction +script: + - vendor/bin/phpunit -v --bootstrap=tests/bootstrap.php --whitelist ./src --coverage-clover ./build/logs/clover.xml tests/ + - vendor/bin/phpcs --report=full --report-file=./report.txt -p ./src + - vendor/bin/phpstan analyse -c phpstan.neon +jobs: + allow_failures: + - php: nightly diff --git a/composer.json b/composer.json index 780e31a..963454f 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,8 @@ } ], "require": { - "php": ">=8.1", - "doctrine/orm": "~2.17.0", + "php": ">=8.0", + "doctrine/orm": "<2.17", "jms/serializer": "^3.9.0", "symfony/string": "5.4.*", "symfony/translation-contracts": "^2.3", @@ -35,7 +35,7 @@ }, "autoload": { "psr-4": { - "RZ\\Roadiz\\": "src/" + "RZ\\": "src/" } }, "config": { @@ -46,8 +46,8 @@ }, "extra": { "branch-alias": { - "dev-master": "2.2.x-dev", - "dev-develop": "2.3.x-dev" + "dev-master": "2.1.x-dev", + "dev-develop": "2.2.x-dev" } } } diff --git a/src/Bag/LazyParameterBag.php b/src/Roadiz/Bag/LazyParameterBag.php similarity index 100% rename from src/Bag/LazyParameterBag.php rename to src/Roadiz/Bag/LazyParameterBag.php diff --git a/src/Core/AbstractEntities/AbstractDateTimed.php b/src/Roadiz/Core/AbstractEntities/AbstractDateTimed.php similarity index 100% rename from src/Core/AbstractEntities/AbstractDateTimed.php rename to src/Roadiz/Core/AbstractEntities/AbstractDateTimed.php diff --git a/src/Core/AbstractEntities/AbstractDateTimedPositioned.php b/src/Roadiz/Core/AbstractEntities/AbstractDateTimedPositioned.php similarity index 75% rename from src/Core/AbstractEntities/AbstractDateTimedPositioned.php rename to src/Roadiz/Core/AbstractEntities/AbstractDateTimedPositioned.php index afb2623..bcee85e 100644 --- a/src/Core/AbstractEntities/AbstractDateTimedPositioned.php +++ b/src/Roadiz/Core/AbstractEntities/AbstractDateTimedPositioned.php @@ -4,13 +4,10 @@ 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. @@ -31,9 +28,7 @@ abstract class AbstractDateTimedPositioned extends AbstractDateTimed implements ORM\Column(type: "float"), Serializer\Groups(["position"]), Serializer\Type("float"), - SymfonySerializer\Groups(["position"]), - ApiFilter(RangeFilter::class), - ApiFilter(NumericFilter::class) + SymfonySerializer\Groups(["position"]) ] protected float $position = 0.0; } diff --git a/src/Core/AbstractEntities/AbstractEntity.php b/src/Roadiz/Core/AbstractEntities/AbstractEntity.php similarity index 100% rename from src/Core/AbstractEntities/AbstractEntity.php rename to src/Roadiz/Core/AbstractEntities/AbstractEntity.php diff --git a/src/Core/AbstractEntities/AbstractField.php b/src/Roadiz/Core/AbstractEntities/AbstractField.php similarity index 98% rename from src/Core/AbstractEntities/AbstractField.php rename to src/Roadiz/Core/AbstractEntities/AbstractField.php index ba5c48b..737baf3 100644 --- a/src/Core/AbstractEntities/AbstractField.php +++ b/src/Roadiz/Core/AbstractEntities/AbstractField.php @@ -255,7 +255,7 @@ abstract class AbstractField extends AbstractPositioned ]; #[ - ORM\Column(name: "group_name", type: "string", length: 250, nullable: true), + ORM\Column(name: "group_name", type: "string", nullable: true), Assert\Length(max: 250), SymfonySerializer\Groups(["node_type", "setting"]), Serializer\Groups(["node_type", "setting"]), @@ -265,7 +265,7 @@ abstract class AbstractField extends AbstractPositioned protected ?string $groupName = null; #[ - ORM\Column(name: "group_name_canonical", type: "string", length: 250, nullable: true), + ORM\Column(name: "group_name_canonical", type: "string", nullable: true), Serializer\Groups(["node_type", "setting"]), SymfonySerializer\Groups(["node_type", "setting"]), Assert\Length(max: 250), @@ -275,7 +275,7 @@ abstract class AbstractField extends AbstractPositioned protected ?string $groupNameCanonical = null; #[ - ORM\Column(type: "string", length: 250), + ORM\Column(type: "string"), Serializer\Expose, Serializer\Groups(["node_type", "setting"]), SymfonySerializer\Groups(["node_type", "setting"]), @@ -287,7 +287,7 @@ abstract class AbstractField extends AbstractPositioned protected string $name; #[ - ORM\Column(type: "string", length: 250), + ORM\Column(type: "string"), Serializer\Expose, Serializer\Groups(["node_type", "setting"]), Serializer\Type("string"), @@ -299,7 +299,7 @@ abstract class AbstractField extends AbstractPositioned protected ?string $label; #[ - ORM\Column(type: "string", length: 250, nullable: true), + ORM\Column(type: "string", nullable: true), Serializer\Expose, Serializer\Groups(["node_type", "setting"]), SymfonySerializer\Groups(["node_type", "setting"]), diff --git a/src/Core/AbstractEntities/AbstractHuman.php b/src/Roadiz/Core/AbstractEntities/AbstractHuman.php similarity index 90% rename from src/Core/AbstractEntities/AbstractHuman.php rename to src/Roadiz/Core/AbstractEntities/AbstractHuman.php index 72725d7..9e8fd69 100644 --- a/src/Core/AbstractEntities/AbstractHuman.php +++ b/src/Roadiz/Core/AbstractEntities/AbstractHuman.php @@ -23,7 +23,7 @@ abstract class AbstractHuman extends AbstractDateTimed { #[ - ORM\Column(type: "string", length: 200, unique: true), + ORM\Column(type: "string", unique: true), Serializer\Groups(["user_personal", "human"]), SymfonySerializer\Groups(["user_personal", "human"]), Assert\NotNull(), @@ -37,7 +37,7 @@ abstract class AbstractHuman extends AbstractDateTimed * Public name (pseudonyme) that can be displayed to a public audience. */ #[ - ORM\Column(name: "publicName", type: "string", length: 250, nullable: true), + ORM\Column(name: "publicName", type: "string", nullable: true), Serializer\Groups(["user_public", "human"]), SymfonySerializer\Groups(["user_public", "human"]), Assert\Length(max: 250) @@ -45,7 +45,7 @@ abstract class AbstractHuman extends AbstractDateTimed protected ?string $publicName = null; #[ - ORM\Column(name: "firstName", type: "string", length: 250, nullable: true), + ORM\Column(name: "firstName", type: "string", nullable: true), Serializer\Groups(["user_personal", "human"]), SymfonySerializer\Groups(["user_personal", "human"]), Assert\Length(max: 250) @@ -53,7 +53,7 @@ abstract class AbstractHuman extends AbstractDateTimed protected ?string $firstName = null; #[ - ORM\Column(name: "lastName", type: "string", length: 250, nullable: true), + ORM\Column(name: "lastName", type: "string", nullable: true), Serializer\Groups(["user_personal", "human"]), SymfonySerializer\Groups(["user_personal", "human"]), Assert\Length(max: 250) @@ -61,15 +61,15 @@ abstract class AbstractHuman extends AbstractDateTimed protected ?string $lastName = null; #[ - ORM\Column(type: "string", length: 50, nullable: true), + ORM\Column(type: "string", nullable: true), Serializer\Groups(["user_personal", "human"]), SymfonySerializer\Groups(["user_personal", "human"]), - Assert\Length(max: 50) + Assert\Length(max: 20) ] protected ?string $phone = null; #[ - ORM\Column(type: "string", length: 250, nullable: true), + ORM\Column(type: "string", nullable: true), Serializer\Groups(["user_personal", "human"]), SymfonySerializer\Groups(["user_personal", "human"]), Assert\Length(max: 250) @@ -77,7 +77,7 @@ abstract class AbstractHuman extends AbstractDateTimed protected ?string $company = null; #[ - ORM\Column(type: "string", length: 250, nullable: true), + ORM\Column(type: "string", nullable: true), Serializer\Groups(["user_personal", "human"]), SymfonySerializer\Groups(["user_personal", "human"]), Assert\Length(max: 250) diff --git a/src/Core/AbstractEntities/AbstractPositioned.php b/src/Roadiz/Core/AbstractEntities/AbstractPositioned.php similarity index 100% rename from src/Core/AbstractEntities/AbstractPositioned.php rename to src/Roadiz/Core/AbstractEntities/AbstractPositioned.php diff --git a/src/Core/AbstractEntities/LeafInterface.php b/src/Roadiz/Core/AbstractEntities/LeafInterface.php similarity index 100% rename from src/Core/AbstractEntities/LeafInterface.php rename to src/Roadiz/Core/AbstractEntities/LeafInterface.php diff --git a/src/Core/AbstractEntities/LeafTrait.php b/src/Roadiz/Core/AbstractEntities/LeafTrait.php similarity index 100% rename from src/Core/AbstractEntities/LeafTrait.php rename to src/Roadiz/Core/AbstractEntities/LeafTrait.php diff --git a/src/Core/AbstractEntities/PersistableInterface.php b/src/Roadiz/Core/AbstractEntities/PersistableInterface.php similarity index 100% rename from src/Core/AbstractEntities/PersistableInterface.php rename to src/Roadiz/Core/AbstractEntities/PersistableInterface.php diff --git a/src/Core/AbstractEntities/PositionedInterface.php b/src/Roadiz/Core/AbstractEntities/PositionedInterface.php similarity index 100% rename from src/Core/AbstractEntities/PositionedInterface.php rename to src/Roadiz/Core/AbstractEntities/PositionedInterface.php diff --git a/src/Core/AbstractEntities/PositionedTrait.php b/src/Roadiz/Core/AbstractEntities/PositionedTrait.php similarity index 100% rename from src/Core/AbstractEntities/PositionedTrait.php rename to src/Roadiz/Core/AbstractEntities/PositionedTrait.php diff --git a/src/Core/AbstractEntities/TranslationInterface.php b/src/Roadiz/Core/AbstractEntities/TranslationInterface.php similarity index 100% rename from src/Core/AbstractEntities/TranslationInterface.php rename to src/Roadiz/Core/AbstractEntities/TranslationInterface.php diff --git a/src/Core/Events/LeafEntityLifeCycleSubscriber.php b/src/Roadiz/Core/Events/LeafEntityLifeCycleSubscriber.php similarity index 100% rename from src/Core/Events/LeafEntityLifeCycleSubscriber.php rename to src/Roadiz/Core/Events/LeafEntityLifeCycleSubscriber.php diff --git a/src/Core/Handlers/AbstractHandler.php b/src/Roadiz/Core/Handlers/AbstractHandler.php similarity index 100% rename from src/Core/Handlers/AbstractHandler.php rename to src/Roadiz/Core/Handlers/AbstractHandler.php diff --git a/src/Core/Handlers/HandlerFactoryInterface.php b/src/Roadiz/Core/Handlers/HandlerFactoryInterface.php similarity index 100% rename from src/Core/Handlers/HandlerFactoryInterface.php rename to src/Roadiz/Core/Handlers/HandlerFactoryInterface.php diff --git a/src/Utils/StringHandler.php b/src/Roadiz/Utils/StringHandler.php similarity index 100% rename from src/Utils/StringHandler.php rename to src/Roadiz/Utils/StringHandler.php