Skip to content

Commit

Permalink
Merge branch feature/symfony6.4 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Jan 18, 2024
1 parent 61ca78e commit ee11588
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 70 deletions.
83 changes: 42 additions & 41 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"inlinestyle/inlinestyle": "~1.2.7",
"james-heinrich/getid3": "^1.9",
"jms/serializer": "^3.9.0",
"jms/serializer-bundle": "^3.10.0",
"jms/serializer-bundle": "^4.2.0",
"league/flysystem": "^3.0",
"league/flysystem-bundle": "^3.0",
"lexik/jwt-authentication-bundle": "^2.19",
Expand All @@ -43,52 +43,53 @@
"rezozero/intervention-request-bundle": "~3.0.0",
"rezozero/liform-bundle": "^0.19",
"rezozero/tree-walker": "^1.3.0",
"roadiz/doc-generator": "2.2.*",
"roadiz/documents": "2.2.*",
"roadiz/dts-generator": "2.2.*",
"roadiz/entity-generator": "2.2.*",
"roadiz/jwt": "2.2.*",
"roadiz/markdown": "2.2.*",
"roadiz/models": "2.2.*",
"roadiz/doc-generator": "2.3.x-dev",
"roadiz/documents": "2.3.x-dev",
"roadiz/dts-generator": "2.3.x-dev",
"roadiz/entity-generator": "2.3.x-dev",
"roadiz/jwt": "2.3.x-dev",
"roadiz/markdown": "2.3.x-dev",
"roadiz/models": "2.3.x-dev",
"roadiz/nodetype-contracts": "~1.1.2",
"roadiz/random": "2.2.*",
"roadiz/random": "2.3.x-dev",
"rollerworks/password-common-list": "^0.2.0",
"rollerworks/password-strength-bundle": "^2.2",
"scienta/doctrine-json-functions": "^4.2",
"sensio/framework-extra-bundle": "^6.1",
"solarium/solarium": "^6.0.4",
"symfony-cmf/routing": "^2.3.3",
"symfony-cmf/routing-bundle": "^2.5",
"symfony/asset": "5.4.*",
"symfony/cache": "5.4.*",
"symfony/console": "5.4.*",
"symfony/dotenv": "5.4.*",
"symfony/expression-language": "5.4.*",
"symfony-cmf/routing-bundle": "^3.0.2",
"symfony/asset": "6.4.*",
"symfony/cache": "6.4.*",
"symfony/console": "6.4.*",
"symfony/dotenv": "6.4.*",
"symfony/expression-language": "6.4.*",
"symfony/flex": "^2.2.3",
"symfony/form": "5.4.*",
"symfony/framework-bundle": "5.4.*",
"symfony/http-client": "5.4.*",
"symfony/intl": "5.4.*",
"symfony/mailer": "5.4.*",
"symfony/messenger": "5.4.*",
"symfony/mime": "5.4.*",
"symfony/form": "6.4.*",
"symfony/framework-bundle": "6.4.*",
"symfony/http-client": "6.4.*",
"symfony/intl": "6.4.*",
"symfony/lock": "6.4.*",
"symfony/mailer": "6.4.*",
"symfony/messenger": "6.4.*",
"symfony/mime": "6.4.*",
"symfony/monolog-bundle": "^3.1",
"symfony/notifier": "5.4.*",
"symfony/process": "5.4.*",
"symfony/property-access": "5.4.*",
"symfony/property-info": "5.4.*",
"symfony/proxy-manager-bridge": "5.4.*",
"symfony/rate-limiter": "5.4.*",
"symfony/runtime": "5.4.*",
"symfony/security-core": "5.4.*",
"symfony/serializer": "5.4.*",
"symfony/string": "5.4.*",
"symfony/translation": "5.4.*",
"symfony/twig-bundle": "5.4.*",
"symfony/validator": "5.4.*",
"symfony/web-link": "5.4.*",
"symfony/workflow": "5.4.*",
"symfony/yaml": "5.4.*",
"symfony/notifier": "6.4.*",
"symfony/process": "6.4.*",
"symfony/property-access": "6.4.*",
"symfony/property-info": "6.4.*",
"symfony/proxy-manager-bridge": "6.4.*",
"symfony/rate-limiter": "6.4.*",
"symfony/runtime": "6.4.*",
"symfony/security-core": "6.4.*",
"symfony/serializer": "6.4.*",
"symfony/string": "6.4.*",
"symfony/translation": "6.4.*",
"symfony/twig-bundle": "6.4.*",
"symfony/validator": "6.4.*",
"symfony/web-link": "6.4.*",
"symfony/workflow": "6.4.*",
"symfony/yaml": "6.4.*",
"twig/extra-bundle": "^3.0",
"twig/intl-extra": "*",
"twig/string-extra": "*",
Expand All @@ -103,9 +104,9 @@
"phpstan/phpstan-doctrine": "^1.3",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.5",
"symfony/browser-kit": "5.4.*",
"symfony/phpunit-bridge": "5.4.*",
"symfony/stopwatch": "5.4.*"
"symfony/browser-kit": "6.4.*",
"symfony/phpunit-bridge": "^7.0",
"symfony/stopwatch": "6.4.*"
},
"config": {
"optimize-autoloader": true,
Expand Down
1 change: 0 additions & 1 deletion config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ security:
# https://symfony.com/bundles/LexikJWTAuthenticationBundle/current/index.html#configure-application-routing
api_login:
pattern: ^/api/token
stateless: true
provider: all_users
login_throttling:
max_attempts: 3
Expand Down
6 changes: 3 additions & 3 deletions src/Bag/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ protected function populateParameters(): void
/**
* @param string $key
* @param mixed $default
* @return bool|mixed
* @return mixed
*/
public function get($key, $default = false)
public function get(string $key, $default = false): mixed
{
return parent::get($key, $default);
}
Expand All @@ -68,7 +68,7 @@ public function get($key, $default = false)
* @param string $key
* @return Document|null
*/
public function getDocument($key): ?Document
public function getDocument(string $key): ?Document
{
try {
$id = $this->getInt($key);
Expand Down
16 changes: 5 additions & 11 deletions src/Doctrine/ORM/SimpleQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function buildExpressionWithBinding($value, string $prefix, string $key):
*
* @return Comparison|Func|string
*/
public function buildExpressionWithoutBinding($value, string $prefix, string $key, string $baseKey = null)
public function buildExpressionWithoutBinding(mixed $value, string $prefix, string $key, string $baseKey = null)
{
if (\mb_strlen($prefix) > 0 && \mb_substr($prefix, -\mb_strlen('.')) !== '.') {
$prefix .= '.';
Expand Down Expand Up @@ -127,14 +127,11 @@ public function buildExpressionWithoutBinding($value, string $prefix, string $ke
if ($value instanceof PersistableInterface) {
return $this->queryBuilder->expr()->eq($prefix . $key, ':' . $baseKey);
}
if (isset($value)) {
return $this->queryBuilder->expr()->eq($prefix . $key, ':' . $baseKey);
}
if (null === $value) {
return $this->queryBuilder->expr()->isNull($prefix . $key);
}
// @phpstan-ignore-next-line
throw new \InvalidArgumentException('Value is not supported for expression.');

return $this->queryBuilder->expr()->eq($prefix . $key, ':' . $baseKey);
}

/**
Expand Down Expand Up @@ -181,14 +178,11 @@ public function bindValue(string $key, $value): QueryBuilder
if ($value instanceof PersistableInterface) {
return $this->queryBuilder->setParameter($key, $value->getId());
}
if (isset($value)) {
return $this->queryBuilder->setParameter($key, $value);
}
if (null === $value) {
return $this->queryBuilder;
}
// @phpstan-ignore-next-line
throw new \InvalidArgumentException('Value is not supported for binding.');

return $this->queryBuilder->setParameter($key, $value);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/EntityHandler/NodeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Symfony\Component\Workflow\Registry;
use Symfony\Component\Workflow\Workflow;
use RZ\Roadiz\Core\Handlers\AbstractHandler;
use Symfony\Component\Workflow\WorkflowInterface;

/**
* Handle operations with nodes entities.
Expand Down Expand Up @@ -307,9 +308,9 @@ public function removeWithChildrenAndAssociations()
}

/**
* @return Workflow
* @return WorkflowInterface
*/
private function getWorkflow(): Workflow
private function getWorkflow(): WorkflowInterface
{
return $this->registry->get($this->getNode());
}
Expand Down
2 changes: 1 addition & 1 deletion src/EventSubscriber/UserLocaleSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function onUserUpdated(FilterUserEvent $event): void
if (
null !== $this->tokenStorage->getToken() &&
$this->tokenStorage->getToken()->getUser() instanceof User &&
$this->tokenStorage->getToken()->getUsername() === $user->getUsername()
$this->tokenStorage->getToken()->getUserIdentifier() === $user->getUserIdentifier()
) {
if (null === $user->getLocale()) {
$this->requestStack->getSession()->remove('_locale');
Expand Down
4 changes: 2 additions & 2 deletions src/Logger/DoctrineHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ public function write(array $record): void
]
);
} else {
$log->setUsername($user->getUsername());
$log->setUsername($user->getUserIdentifier());
}
} else {
$log->setUsername($token->getUsername());
$log->setUsername($token->getUserIdentifier());
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/Preview/EventSubscriber/PreviewModeSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ public function onKernelRequest(RequestEvent $event): void
public function onControllerMatched(ControllerEvent $event): void
{
if ($this->supports() && $event->isMainRequest()) {
/** @var TokenInterface|null $token */
$token = $this->tokenStorage->getToken();
if (null === $token || !$token->isAuthenticated()) {
throw new PreviewNotAllowedException('You are not authenticated to use preview mode.');
}
if (!$this->security->isGranted($this->previewResolver->getRequiredRole())) {
throw new PreviewNotAllowedException('You are not granted to use preview mode.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Preview/Exception/PreviewNotAllowedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class PreviewNotAllowedException extends AccessDeniedHttpException
{
public function __construct($message = "You are not allowed to use preview mode.")
public function __construct(string $message = "You are not allowed to use preview mode.")
{
parent::__construct($message);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Repository/NodeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ public function findBy(
$this->applyFilterByTag($criteria, $qb);
$this->applyFilterByCriteria($criteria, $qb);
$this->applyTranslationByTag($qb, $translation);
// @phpstan-ignore-next-line
$query = $qb->getQuery();
$this->dispatchQueryEvent($query);

Expand Down Expand Up @@ -453,6 +454,7 @@ public function findOneBy(
$this->applyFilterByTag($criteria, $qb);
$this->applyFilterByCriteria($criteria, $qb);
$this->applyTranslationByTag($qb, $translation);
// @phpstan-ignore-next-line
$query = $qb->getQuery();
$this->dispatchQueryEvent($query);

Expand Down
2 changes: 2 additions & 0 deletions src/Repository/TagRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public function findBy(
$this->applyFilterByNodes($criteria, $qb);
$this->applyFilterByCriteria($criteria, $qb);
$this->applyTranslationByTag($qb, $translation);
// @phpstan-ignore-next-line
$query = $qb->getQuery();
$this->dispatchQueryEvent($query);

Expand Down Expand Up @@ -298,6 +299,7 @@ public function findOneBy(
$this->applyFilterByNodes($criteria, $qb);
$this->applyFilterByCriteria($criteria, $qb);
$this->applyTranslationByTag($qb, $translation);
// @phpstan-ignore-next-line
$query = $qb->getQuery();
$this->dispatchQueryEvent($query);

Expand Down
2 changes: 1 addition & 1 deletion src/Routing/NodeRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getGenerator(): UrlGeneratorInterface
/**
* @inheritDoc
*/
public function supports($name): bool
public function supports(mixed $name): bool
{
return ($name instanceof NodesSources || $name === RouteObjectInterface::OBJECT_BASED_ROUTE_NAME);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Routing/RedirectionRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public function getGenerator(): UrlGeneratorInterface
throw new \BadMethodCallException(get_class($this) . ' does not support path generation.');
}

public function supports($name): bool
public function supports(mixed $name): bool
{
return false;
}

public function getRouteDebugMessage($name, array $parameters = []): string
public function getRouteDebugMessage(mixed $name, array $parameters = []): string
{
return 'RedirectionRouter does not support path generation.';
}
Expand Down

0 comments on commit ee11588

Please sign in to comment.