Skip to content

Commit

Permalink
Merge tag v2.3.19 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Jul 12, 2024
1 parent 91b0854 commit 35cd34c
Show file tree
Hide file tree
Showing 107 changed files with 347 additions and 713 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ jobs:
run: vendor/bin/phpcs -p ./src
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon
- name: Run PHP Unit
run: vendor/bin/phpunit -v
3 changes: 0 additions & 3 deletions Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
"RZ\\Roadiz\\CoreBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"RZ\\Roadiz\\CoreBundle\\Tests\\": "tests/"
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
Expand Down
12 changes: 10 additions & 2 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ services:
- '../src/Traits/'
- '../src/Kernel.php'
- '../src/Tests/'
- '../src/DataCollector/'
- '../src/Event/'
- '../src/Model/'
- '../src/ListManager/'
Expand All @@ -73,6 +74,13 @@ services:
shared: false
public: true

RZ\Roadiz\CoreBundle\Xlsx\:
resource: '../src/Xlsx/'
deprecated:
message: 'The "%service_id%" service is deprecated and will be removed in Roadiz 2.4. Use CSV serialization instead.'
package: roadiz/core-bundle
version: '2.3.19'

RZ\Roadiz\CoreBundle\Document\MediaFinder\YoutubeEmbedFinder:
tags: [ { name: 'roadiz_core.media_finder', platform: 'youtube' } ]
RZ\Roadiz\CoreBundle\Document\MediaFinder\VimeoEmbedFinder:
Expand Down Expand Up @@ -342,15 +350,15 @@ services:
# Recreate manager for each usage
shared: false
deprecated:
message: 'The "%service_id%" service is deprecated and will be removed in Roadiz 3.0. Use RZ\Roadiz\CoreBundle\Mailer\EmailManagerFactory instead.'
message: 'The "%service_id%" service is deprecated and will be removed in Roadiz 2.4. Use RZ\Roadiz\CoreBundle\Mailer\EmailManagerFactory instead.'
package: roadiz/core-bundle
version: '2.3.18'

RZ\Roadiz\CoreBundle\Mailer\ContactFormManager:
# Recreate manager for each usage
shared: false
deprecated:
message: 'The "%service_id%" service is deprecated and will be removed in Roadiz 3.0. Use RZ\Roadiz\CoreBundle\Mailer\ContactFormManagerFactory instead.'
message: 'The "%service_id%" service is deprecated and will be removed in Roadiz 2.4. Use RZ\Roadiz\CoreBundle\Mailer\ContactFormManagerFactory instead.'
package: roadiz/core-bundle
version: '2.3.18'

Expand Down
6 changes: 4 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
<env name="KERNEL_CLASS" value="App\Kernel" />
<env name="TRUSTED_PROXIES" value="REMOTE_ADDR" />
<!-- ###+ sentry/sentry-symfony ### -->
<env name="SENTRY_DSN" value=""/>
<!-- ###- sentry/sentry-symfony ### -->
Expand All @@ -40,8 +42,8 @@
</php>

<testsuites>
<testsuite name="Roadiz Monorepo Test Suite">
<directory>src/Test</directory>
<testsuite name="RoadizCoreBundle Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

Expand Down
17 changes: 6 additions & 11 deletions src/Api/Breadcrumbs/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@
final class Breadcrumbs implements BreadcrumbsInterface
{
/**
* @var array<PersistableInterface>
* @param PersistableInterface[] $items
*/
#[Serializer\Groups(["breadcrumbs", "web_response"])]
#[Serializer\MaxDepth(1)]
private array $items;

/**
* @param array<PersistableInterface> $items
*/
public function __construct(array $items)
{
$this->items = $items;
public function __construct(
#[Serializer\Groups(["breadcrumbs", "web_response"])]
#[Serializer\MaxDepth(1)]
private readonly array $items
) {
}

/**
Expand Down
5 changes: 2 additions & 3 deletions src/Api/Breadcrumbs/NodesSourcesBreadcrumbsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ public function create(?PersistableInterface $entity): ?BreadcrumbsInterface
return null;
}

if (
!$entity->isReachable()
) {
if (!$entity->isReachable()) {
return null;
}

$parents = [];

while (null !== $entity = $entity->getParent()) {
Expand Down
9 changes: 2 additions & 7 deletions src/Api/Extension/ArchiveExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@
*/
final class ArchiveExtension implements QueryResultCollectionExtensionInterface
{
private RequestStack $requestStack;
private string $defaultPublicationFieldName;

public function __construct(
RequestStack $requestStack,
string $defaultPublicationFieldName = 'publishedAt'
private readonly RequestStack $requestStack,
private readonly string $defaultPublicationFieldName = 'publishedAt'
) {
$this->requestStack = $requestStack;
$this->defaultPublicationFieldName = $defaultPublicationFieldName;
}

public function applyToCollection(
Expand Down
5 changes: 1 addition & 4 deletions src/Api/Extension/AttributeValueQueryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@

final class AttributeValueQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface
{
private PreviewResolverInterface $previewResolver;

public function __construct(
PreviewResolverInterface $previewResolver
private readonly PreviewResolverInterface $previewResolver
) {
$this->previewResolver = $previewResolver;
}

public function applyToItem(
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Extension/AttributeValueRealmExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
final class AttributeValueRealmExtension implements QueryCollectionExtensionInterface, QueryItemExtensionInterface
{
public function __construct(
private Security $security,
private RealmResolverInterface $realmResolver
private readonly Security $security,
private readonly RealmResolverInterface $realmResolver
) {
}

Expand Down
5 changes: 1 addition & 4 deletions src/Api/Extension/NodeQueryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@

final class NodeQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface
{
private PreviewResolverInterface $previewResolver;

public function __construct(
PreviewResolverInterface $previewResolver
private readonly PreviewResolverInterface $previewResolver
) {
$this->previewResolver = $previewResolver;
}

public function applyToItem(
Expand Down
9 changes: 2 additions & 7 deletions src/Api/Extension/NodesSourcesQueryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@

final class NodesSourcesQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface
{
private PreviewResolverInterface $previewResolver;
private string $generatedEntityNamespacePattern;

public function __construct(
PreviewResolverInterface $previewResolver,
string $generatedEntityNamespacePattern = '#^App\\\GeneratedEntity\\\NS(?:[a-zA-Z]+)$#'
private readonly PreviewResolverInterface $previewResolver,
private readonly string $generatedEntityNamespacePattern = '#^App\\\GeneratedEntity\\\NS(?:[a-zA-Z]+)$#'
) {
$this->previewResolver = $previewResolver;
$this->generatedEntityNamespacePattern = $generatedEntityNamespacePattern;
}

public function applyToItem(
Expand Down
5 changes: 1 addition & 4 deletions src/Api/Extension/NodesTagsQueryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@

final class NodesTagsQueryExtension implements QueryItemExtensionInterface, QueryCollectionExtensionInterface
{
private PreviewResolverInterface $previewResolver;

public function __construct(
PreviewResolverInterface $previewResolver
private readonly PreviewResolverInterface $previewResolver
) {
$this->previewResolver = $previewResolver;
}

public function applyToItem(
Expand Down
5 changes: 1 addition & 4 deletions src/Api/Filter/LocaleFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ final class LocaleFilter extends GeneratedEntityFilter
{
public const PROPERTY = '_locale';

private PreviewResolverInterface $previewResolver;

public function __construct(
PreviewResolverInterface $previewResolver,
private readonly PreviewResolverInterface $previewResolver,
ManagerRegistry $managerRegistry,
LoggerInterface $logger = null,
array $properties = null,
NameConverterInterface $nameConverter = null,
string $generatedEntityNamespacePattern = '#^App\\\GeneratedEntity\\\NS(?:[a-zA-Z]+)$#'
) {
parent::__construct($managerRegistry, $logger, $properties, $nameConverter, $generatedEntityNamespacePattern);
$this->previewResolver = $previewResolver;
}

protected function filterProperty(
Expand Down
7 changes: 3 additions & 4 deletions src/Api/ListManager/SolrPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
namespace RZ\Roadiz\CoreBundle\Api\ListManager;

use ApiPlatform\State\Pagination\PaginatorInterface;
use Symfony\Component\DependencyInjection\Attribute\Exclude;

#[Exclude]
final class SolrPaginator implements PaginatorInterface, \IteratorAggregate
{
private bool $handled = false;
Expand Down Expand Up @@ -57,9 +59,6 @@ public function getIterator(): \Traversable
{
$this->handleOnce();
$entities = $this->listManager->getEntities();
if (\is_array($entities)) {
return new \ArrayIterator($entities);
}
return $entities->getIterator();
return new \ArrayIterator($entities);
}
}
4 changes: 3 additions & 1 deletion src/Api/ListManager/SolrSearchListManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
use RZ\Roadiz\CoreBundle\ListManager\AbstractEntityListManager;
use RZ\Roadiz\CoreBundle\SearchEngine\SearchHandlerInterface;
use RZ\Roadiz\CoreBundle\SearchEngine\SearchResultsInterface;
use Symfony\Component\DependencyInjection\Attribute\Exclude;
use Symfony\Component\HttpFoundation\Request;

#[Exclude]
final class SolrSearchListManager extends AbstractEntityListManager
{
protected ?SearchResultsInterface $searchResults;
private ?SearchResultsInterface $searchResults;
private ?string $query = null;

public function __construct(
Expand Down
5 changes: 1 addition & 4 deletions src/Api/OpenApi/JwtDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@

final class JwtDecorator implements OpenApiFactoryInterface
{
private OpenApiFactoryInterface $decorated;

public function __construct(
OpenApiFactoryInterface $decorated
private readonly OpenApiFactoryInterface $decorated
) {
$this->decorated = $decorated;
}

public function __invoke(array $context = []): OpenApi
Expand Down
5 changes: 1 addition & 4 deletions src/Api/OpenApi/PreviewDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@

final class PreviewDecorator implements OpenApiFactoryInterface
{
private OpenApiFactoryInterface $decorated;

public function __construct(
OpenApiFactoryInterface $decorated
private readonly OpenApiFactoryInterface $decorated
) {
$this->decorated = $decorated;
}

public function __invoke(array $context = []): OpenApi
Expand Down
5 changes: 1 addition & 4 deletions src/Api/OpenApi/WebResponseDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@

final class WebResponseDecorator implements OpenApiFactoryInterface
{
private OpenApiFactoryInterface $decorated;

public function __construct(
OpenApiFactoryInterface $decorated
private readonly OpenApiFactoryInterface $decorated
) {
$this->decorated = $decorated;
}

public function __invoke(array $context = []): OpenApi
Expand Down
17 changes: 5 additions & 12 deletions src/Api/TreeWalker/Definition/DefinitionFactoryConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,15 @@

final class DefinitionFactoryConfiguration
{
/**
* @var class-string
*/
public string $classname;
public bool $onlyVisible;
public DefinitionFactoryInterface $definitionFactory;

/**
* @param class-string $classname
* @param DefinitionFactoryInterface $definitionFactory
* @param bool $onlyVisible
*/
public function __construct(string $classname, DefinitionFactoryInterface $definitionFactory, bool $onlyVisible)
{
$this->classname = $classname;
$this->onlyVisible = $onlyVisible;
$this->definitionFactory = $definitionFactory;
public function __construct(
public readonly string $classname,
public readonly DefinitionFactoryInterface $definitionFactory,
public readonly bool $onlyVisible
) {
}
}
4 changes: 2 additions & 2 deletions src/Api/TreeWalker/Definition/MultiTypeChildrenDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ final class MultiTypeChildrenDefinition
* @param bool $onlyVisible
*/
public function __construct(
WalkerContextInterface $context,
private readonly WalkerContextInterface $context,
private readonly array $types,
private readonly bool $onlyVisible = true
) {
$this->context = $context;
}

/**
Expand Down Expand Up @@ -63,6 +62,7 @@ public function __invoke(NodesSources $source): array
->findBy($criteria, [
'node.position' => 'ASC',
]);

$this->context->getStopwatch()->stop(self::class);

return $children;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
use RZ\Roadiz\CoreBundle\Api\TreeWalker\NodeSourceWalkerContext;
use RZ\Roadiz\CoreBundle\Entity\NodesSources;
use RZ\TreeWalker\Definition\ContextualDefinitionTrait;
use RZ\TreeWalker\WalkerContextInterface;

final class NonReachableNodeSourceBlockDefinition
{
use ContextualDefinitionTrait;

private bool $onlyVisible;

public function __construct(bool $onlyVisible = true)
{
$this->onlyVisible = $onlyVisible;
public function __construct(
private readonly WalkerContextInterface $context,
private readonly bool $onlyVisible = true
) {
}

/**
Expand Down
Loading

0 comments on commit 35cd34c

Please sign in to comment.