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 19, 2024
1 parent 0598caf commit cfda0ed
Show file tree
Hide file tree
Showing 390 changed files with 6,703 additions and 6,876 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/dev.php
/install.php
/clear_cache.php
/pimple.json
/assets
project_env.sh

Expand Down
75 changes: 75 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
node_js:
- "14"
php:
- 8.0
- 8.1
- nightly
dist: bionic
stages:
- "PHP lint tests"
- "Backoffice assets tests"
branches:
except:
- l10n_develop

jobs:
allow_failures:
- php: nightly

include:
- stage: "Backoffice assets tests"
language: node_js
node_js: "14"
script: sh .travis/backoffice_assets.sh

- stage: "PHP lint tests"
language: php
sudo: required
services:
- mysql
env:
- DB=mysql
- MYSQL_VERSION=5.7
- MYSQL_PASSWORD=
php: 7.4
install: sh .travis/composer_install.sh
script: sh .travis/php_lint.sh
- stage: "PHP lint tests"
language: php
sudo: required
services:
- mysql
env:
- DB=mysql
- MYSQL_VERSION=5.7
- MYSQL_PASSWORD=
php: 8.0
install: sh .travis/composer_install.sh
script: sh .travis/php_lint.sh
- stage: "PHP lint tests"
language: php
sudo: required
services:
- mysql
env:
- DB=mysql
- MYSQL_VERSION=5.7
- MYSQL_PASSWORD=
php: 8.1
install: sh .travis/composer_install.sh
script: sh .travis/php_lint.sh
- stage: "PHP lint tests"
language: php
sudo: required
services:
- mysql
env:
- DB=mysql
- MYSQL_VERSION=5.7
- MYSQL_PASSWORD=
php: nightly
install: sh .travis/composer_install.sh
script: sh .travis/php_lint.sh



5 changes: 5 additions & 0 deletions .travis/backoffice_assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh -x
cd src || exit 1;
yarn install --pure-lockfile
yarn run install
yarn run build
4 changes: 4 additions & 0 deletions .travis/composer_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh -x
phpenv config-rm xdebug.ini;
curl -s http://getcomposer.org/installer | php;
php composer.phar install --dev --no-interaction;
5 changes: 5 additions & 0 deletions .travis/php_lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh -x
vendor/bin/phpcs --report=full --report-file=./report.txt -p ./ || exit 1;
vendor/bin/phpstan analyse -c phpstan.neon || exit 1;
#vendor/bin/console lint:twig || exit 1;
#vendor/bin/console lint:twig src/Resources/views || exit 1;
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, Julien Blanchet
Copyright © 2023 Ambroise Maupate, Julien Blanchet

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
61 changes: 30 additions & 31 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,47 @@
"role": "Frontend developer"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"php": ">=8.0",
"ext-zip": "*",
"doctrine/orm": "~2.19.0",
"doctrine/orm": "<2.17",
"guzzlehttp/guzzle": "^7.2.0",
"jms/serializer": "^3.9.0",
"league/flysystem": "^3.0",
"pimple/pimple": "^3.3.1",
"ramsey/uuid": "^4.7",
"roadiz/compat-bundle": "2.3.*",
"roadiz/core-bundle": "2.3.*",
"roadiz/doc-generator": "2.3.*",
"roadiz/documents": "2.3.*",
"roadiz/dts-generator": "2.3.*",
"roadiz/markdown": "2.3.*",
"roadiz/models": "2.3.*",
"roadiz/compat-bundle": "2.1.*",
"roadiz/core-bundle": "2.1.*",
"roadiz/doc-generator": "2.1.*",
"roadiz/documents": "2.1.*",
"roadiz/dts-generator": "2.1.*",
"roadiz/markdown": "2.1.*",
"roadiz/models": "2.1.*",
"roadiz/nodetype-contracts": "~1.1.2",
"roadiz/openid": "2.3.*",
"roadiz/rozier-bundle": "2.3.*",
"symfony/asset": "6.4.*",
"symfony/filesystem": "6.4.*",
"symfony/form": "6.4.*",
"symfony/http-foundation": "6.4.*",
"symfony/http-kernel": "6.4.*",
"symfony/routing": "6.4.*",
"symfony/security-core": "6.4.*",
"symfony/security-csrf": "6.4.*",
"symfony/security-http": "6.4.*",
"symfony/translation": "6.4.*",
"symfony/validator": "6.4.*",
"symfony/workflow": "6.4.*",
"symfony/yaml": "6.4.*",
"roadiz/openid": "2.1.*",
"roadiz/rozier-bundle": "2.1.*",
"symfony/asset": "5.4.*",
"symfony/filesystem": "5.4.*",
"symfony/form": "5.4.*",
"symfony/http-foundation": "5.4.*",
"symfony/http-kernel": "5.4.*",
"symfony/routing": "5.4.*",
"symfony/security-core": "5.4.*",
"symfony/security-csrf": "5.4.*",
"symfony/security-http": "5.4.*",
"symfony/translation": "5.4.*",
"symfony/validator": "5.4.*",
"symfony/workflow": "5.4.*",
"symfony/yaml": "5.4.*",
"twig/twig": "^3.1"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.4",
"phpstan/phpstan": "^1.5.3",
"phpstan/phpstan-doctrine": "^1.3",
"roadiz/entity-generator": "2.3.*",
"roadiz/random": "2.3.*",
"roadiz/jwt": "2.3.*",
"roadiz/entity-generator": "2.1.*",
"roadiz/random": "2.1.*",
"roadiz/jwt": "2.1.*",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
Expand All @@ -95,8 +94,8 @@
},
"extra": {
"branch-alias": {
"dev-main": "2.3.x-dev",
"dev-develop": "2.4.x-dev"
"dev-main": "2.1.x-dev",
"dev-develop": "2.2.x-dev"
}
}
}
9 changes: 3 additions & 6 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 7
level: 6
paths:
- src
excludePaths:
Expand All @@ -9,8 +9,6 @@ parameters:
doctrine:
repositoryClass: RZ\Roadiz\Core\Repositories\EntityRepository
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
- '#Call to an undefined method RZ\\Roadiz\\CoreBundle\\Repository#'
- '#Call to an undefined method RZ\\Roadiz\\UserBundle\\Repository#'
- '#Call to an undefined method Doctrine\\Persistence\\ObjectRepository#'
Expand All @@ -30,11 +28,10 @@ parameters:
- '#Doctrine\\ORM\\Mapping\\GeneratedValue constructor expects#'
- '#type mapping mismatch: property can contain Doctrine\\Common\\Collections\\Collection<int, [^\>]+> but database expects Doctrine\\Common\\Collections\\Collection&iterable<[^\>]+>#'
- '#should return Doctrine\\Common\\Collections\\Collection<int, [^\>]+Interface> but returns Doctrine\\Common\\Collections\\Collection<int, [^\>]+>#'
- '#but returns Doctrine\\Common\\Collections\\ReadableCollection<int, [^\>]+>#'
- '#does not accept Doctrine\\Common\\Collections\\ReadableCollection<int, [^\>]+>#'

reportUnmatchedIgnoredErrors: false
treatPhpDocTypesAsCertain: false
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false

includes:
- vendor/phpstan/phpstan-doctrine/extension.neon
Expand Down
2 changes: 1 addition & 1 deletion src/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": ["env", "stage-0"],
"presets": ["es2015", "stage-0"],
"plugins": ["transform-runtime", "lodash"]
}
1 change: 1 addition & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# TheatreTheme editor config for contributors
# Root is false as your theme is inside Roadiz filetree
# http://editorconfig.org/
root = false

[*]
indent_style = space
Expand Down
2 changes: 1 addition & 1 deletion src/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
},
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
//extends: 'standard',
extends: ['prettier', 'plugin:prettier/recommended', 'plugin:vue/base'],
extends: ['prettier', 'plugin:prettier/recommended', 'plugin:vue/essential'],
// required to lint *.vue files
plugins: ['html', 'prettier'],
// add your custom rules here
Expand Down
2 changes: 1 addition & 1 deletion src/AjaxControllers/AbstractAjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function getTranslation(Request $request): ?TranslationInterface
* @param string $method
* @param bool $requestCsrfToken
*
* @return bool Return true if request is valid, else throw exception
* @return boolean Return true if request is valid, else throw exception
*/
protected function validateRequest(Request $request, string $method = 'POST', bool $requestCsrfToken = true): bool
{
Expand Down
61 changes: 22 additions & 39 deletions src/AjaxControllers/AjaxAbstractFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

/**
* @package Themes\Rozier\AjaxControllers
*/
abstract class AjaxAbstractFieldsController extends AbstractAjaxController
{
public function __construct(protected readonly HandlerFactoryInterface $handlerFactory)
{
}
private HandlerFactoryInterface $handlerFactory;

protected function findEntity(int|string $entityId): ?AbstractField
/**
* @param HandlerFactoryInterface $handlerFactory
*/
public function __construct(HandlerFactoryInterface $handlerFactory)
{
return $this->em()->find($this->getEntityClass(), (int) $entityId);
$this->handlerFactory = $handlerFactory;
}

/**
Expand All @@ -30,7 +33,7 @@ protected function findEntity(int|string $entityId): ?AbstractField
*
* @return null|Response
*/
protected function handleFieldActions(Request $request, AbstractField $field = null): ?Response
protected function handleFieldActions(Request $request, AbstractField $field = null)
{
/*
* Validate
Expand Down Expand Up @@ -76,31 +79,11 @@ protected function handleFieldActions(Request $request, AbstractField $field = n
*/
protected function updatePosition(array $parameters, AbstractField $field = null): array
{
if (!empty($parameters['afterFieldId']) && is_numeric($parameters['afterFieldId'])) {
$afterField = $this->findEntity((int) $parameters['afterFieldId']);
if (null === $afterField) {
throw new BadRequestHttpException('afterFieldId does not exist');
}
$field->setPosition($afterField->getPosition() + 0.5);
// Apply position update before cleaning
$this->em()->flush();
$handler = $this->handlerFactory->getHandler($field);
$handler->cleanPositions();
$this->em()->flush();
return [
'statusCode' => '200',
'status' => 'success',
'responseText' => $this->getTranslator()->trans('field.%name%.updated', [
'%name%' => $field->getName(),
]),
];
}
if (!empty($parameters['beforeFieldId']) && is_numeric($parameters['beforeFieldId'])) {
$beforeField = $this->findEntity((int) $parameters['beforeFieldId']);
if (null === $beforeField) {
throw new BadRequestHttpException('beforeFieldId does not exist');
}
$field->setPosition($beforeField->getPosition() - 0.5);
/*
* First, we set the new parent
*/
if (!empty($parameters['newPosition']) && null !== $field) {
$field->setPosition((float) $parameters['newPosition']);
// Apply position update before cleaning
$this->em()->flush();
$handler = $this->handlerFactory->getHandler($field);
Expand All @@ -114,12 +97,12 @@ protected function updatePosition(array $parameters, AbstractField $field = null
]),
];
}

throw new BadRequestHttpException('Cannot update position for Field. Missing parameters.');
return [
'statusCode' => '400',
'status' => 'error',
'responseText' => $this->getTranslator()->trans('field.%name%.updated', [
'%name%' => $field->getName(),
]),
];
}

/**
* @return class-string<AbstractField>
*/
abstract protected function getEntityClass(): string;
}
Loading

0 comments on commit cfda0ed

Please sign in to comment.