Skip to content

Commit

Permalink
Merged branch '1.3' of ezsystems/ezplatform-kernel into 4.5 (#306)
Browse files Browse the repository at this point in the history
This is a cross-merge of ezsystems/ezplatform#386. See also #306 for more details.
  • Loading branch information
alongosz authored Dec 11, 2023
2 parents 65fb6d5 + 488c86d commit 31b544d
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 10 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"symfony/phpunit-bridge": "^5.1",
"symfony/proxy-manager-bridge": "^5.3",
"symfony/runtime": "^5.3.0",
"phpstan/phpstan": "^1.2",
"phpstan/phpstan-symfony": "^1.3",
"phpstan/phpstan-phpunit": "^1.3"
Expand Down
10 changes: 5 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15625,6 +15625,11 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php

-
message: "#^Cannot call method addAttribute\\(\\) on SimpleXMLElement\\|null\\.$#"
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php

-
message: "#^Cannot call method getAttribute\\(\\) on DOMElement\\|null\\.$#"
count: 6
Expand Down Expand Up @@ -20215,11 +20220,6 @@ parameters:
count: 1
path: src/lib/Repository/ContentService.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/lib/Repository/ContentService.php

-
message: "#^Method Ibexa\\\\Core\\\\Repository\\\\ContentTypeService\\:\\:__construct\\(\\) has parameter \\$settings with no value type specified in iterable type array\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/IO/Command/MigrateFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

$output->writeln([
"Migrating from '$fromHandlers[0],$fromHandlers[1]' to '$toHandlers[0],$toHandlers[1]'",
"Migrating from '{$fromHandlers[0]},{$fromHandlers[1]}' to '{$toHandlers[0]},{$toHandlers[1]}'",
'',
]);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Contracts\Core\MVC\Symfony\ErrorHandler;

use const PHP_VERSION_ID;
use Symfony\Component\Runtime\Internal\BasicErrorHandler;

final class Php82HideDeprecationsErrorHandler
{
public static function register(bool $debug): void
{
BasicErrorHandler::register($debug);

if (PHP_VERSION_ID > 80200) {
error_reporting(E_ALL & ~E_DEPRECATED);
}
}
}
2 changes: 1 addition & 1 deletion src/lib/FieldType/GatewayBasedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function getGateway(array $context)
);

if (!isset($this->gateways[$context['identifier']])) {
throw new \OutOfBoundsException("No gateway for $context[identifier] available.");
throw new \OutOfBoundsException("No gateway for {$context['identifier']} available.");
}

$gateway = $this->gateways[$context['identifier']];
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Persistence/Cache/AbstractHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function __construct(
/**
* Helper for getting multiple cache items in one call and do the id extraction for you.
*
* Cache items must be stored with a key in the following format "${keyPrefix}${id}", like "ez-content-info-${id}",
* Cache items must be stored with a key in the following format "{$keyPrefix}{$id}", like "ez-content-info-{$id}",
* in order for this method to be able to prefix key on id's and also extract key prefix afterwards.
*
* It also optionally supports a key suffixs, for use on a variable argument that affects all lookups,
* like translations, i.e. "ez-content-${id}-${translationKey}" where $keySuffixes = [$id => "-${translationKey}"].
* like translations, i.e. "ez-content-{$id}-{$translationKey}" where $keySuffixes = [$id => "-{$translationKey}"].
*
* @param array $ids
* @param string $keyPrefix E.g "ez-content-"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Persistence/Cache/AbstractInMemoryHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ final protected function getListCacheValue(
* Load items from in-memory cache, symfony cache pool or backend in that order.
* If not cached the returned objects will be placed in cache.
*
* Cache items must be stored with a key in the following format "${keyPrefix}${id}", like "ez-content-info-${id}",
* Cache items must be stored with a key in the following format "{$keyPrefix}{$id}", like "ez-content-info-{$id}",
* in order for this method to be able to prefix key on id's and also extract key prefix afterwards.
*
* @param array $ids
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Tests\Core\MVC\Symfony\ErrorHandler;

use Ibexa\Contracts\Core\MVC\Symfony\ErrorHandler\Php82HideDeprecationsErrorHandler;
use PHPUnit\Framework\TestCase;

/**
* @requires PHP >= 8.2.0
*/
final class Php82HideDeprecationsErrorHandlerTest extends TestCase
{
private int $originalErrorReporting;

protected function setUp(): void
{
$this->originalErrorReporting = error_reporting();
}

protected function tearDown(): void
{
error_reporting($this->originalErrorReporting);
restore_error_handler();
}

public function testRegisterDebug(): void
{
Php82HideDeprecationsErrorHandler::register(true);
$errorReporting = error_reporting();

$this->assertSame(E_ALL & ~E_DEPRECATED, $errorReporting);
}

public function testRegisterNoDebug(): void
{
Php82HideDeprecationsErrorHandler::register(false);
$errorReporting = error_reporting();

$this->assertSame(E_ALL & ~E_DEPRECATED, $errorReporting);
}
}

0 comments on commit 31b544d

Please sign in to comment.