Skip to content

Commit

Permalink
Merge 4.x into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI authored Dec 14, 2023
2 parents 15e65cc + e7c1db9 commit 1b2dbe1
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/ArgumentResolver/CompatibleValueResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;

// TODO: Remove this interface when dropping support of Symfony < 6.2 and replace its usage with ValueResolverInterface
if (interface_exists(ArgumentValueResolverInterface::class)) {
if (interface_exists(ValueResolverInterface::class)) {
/** @internal */
interface CompatibleValueResolverInterface extends ArgumentValueResolverInterface
interface CompatibleValueResolverInterface extends ValueResolverInterface
{
}
} else {
} elseif (interface_exists(ArgumentValueResolverInterface::class)) {
/** @internal */
interface CompatibleValueResolverInterface extends ValueResolverInterface
interface CompatibleValueResolverInterface extends ArgumentValueResolverInterface
{
}
}
4 changes: 2 additions & 2 deletions src/Twig/Extension/TemplateRegistryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getFunctions(): array
* @throws ServiceNotFoundException
* @throws ServiceCircularReferenceException
*/
public function getAdminTemplate(string $name, string $adminCode): ?string
public function getAdminTemplate(string $name, string $adminCode): string
{
@trigger_error(sprintf(
'The method "%s()" is deprecated since sonata-project/admin-bundle 4.7 and will be removed in 5.0.'
Expand All @@ -68,7 +68,7 @@ public function getAdminTemplate(string $name, string $adminCode): ?string
*
* @deprecated since sonata-project/admin-bundle version 4.7 use TemplateRegistryRuntime::getGlobalTemplate() instead
*/
public function getGlobalTemplate(string $name): ?string
public function getGlobalTemplate(string $name): string
{
@trigger_error(sprintf(
'The method "%s()" is deprecated since sonata-project/admin-bundle 4.7 and will be removed in 5.0.'
Expand Down
4 changes: 2 additions & 2 deletions src/Twig/TemplateRegistryRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public function __construct(
* @throws ServiceNotFoundException
* @throws ServiceCircularReferenceException
*/
public function getAdminTemplate(string $name, string $adminCode): ?string
public function getAdminTemplate(string $name, string $adminCode): string
{
return $this->getTemplateRegistry($adminCode)->getTemplate($name);
}

public function getGlobalTemplate(string $name): ?string
public function getGlobalTemplate(string $name): string
{
return $this->globalTemplateRegistry->getTemplate($name);
}
Expand Down
5 changes: 4 additions & 1 deletion tests/App/Datagrid/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ public function isLastPage(): bool
return false;
}

public function getQuery(): ?ProxyQueryInterface
/**
* @phpstan-return ProxyQueryInterface<object>
*/
public function getQuery(): ProxyQueryInterface
{
return new ProxyQuery();
}
Expand Down
6 changes: 3 additions & 3 deletions tests/App/Datagrid/ProxyQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setSortBy(array $parentAssociationMappings, array $fieldMapping)
throw new \BadMethodCallException('Not implemented.');
}

public function getSortBy(): ?string
public function getSortBy(): string
{
return 'e.id';
}
Expand All @@ -41,7 +41,7 @@ public function setSortOrder(string $sortOrder): ProxyQueryInterface
throw new \BadMethodCallException('Not implemented.');
}

public function getSortOrder(): ?string
public function getSortOrder(): string
{
return 'ASC';
}
Expand Down Expand Up @@ -69,7 +69,7 @@ public function setMaxResults(?int $maxResults): ProxyQueryInterface
throw new \BadMethodCallException('Not implemented.');
}

public function getMaxResults(): ?int
public function getMaxResults(): int
{
return 1;
}
Expand Down
5 changes: 4 additions & 1 deletion tests/App/FieldDescription/FieldDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public function setAssociationMapping($associationMapping): void
{
}

public function getTargetEntity(): ?string
/**
* @return null
*/
public function getTargetEntity()
{
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/Model/AuditReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class AuditReader implements AuditReaderInterface
{
public function find(string $className, $id, $revisionId): ?object
public function find(string $className, $id, $revisionId): object
{
return new $className();
}
Expand All @@ -33,7 +33,7 @@ public function findRevisionHistory(string $className, int $limit = 20, int $off
];
}

public function findRevision(string $className, $revisionId): ?Revision
public function findRevision(string $className, $revisionId): Revision
{
return new Revision(1, new \DateTime(), 'Jack');
}
Expand Down

0 comments on commit 1b2dbe1

Please sign in to comment.