Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Latest
------

## Changes
* [#156](https://github.com/cleverage/ui-process-bundle/issues/156) `LogRecord::contextIsEmpty()` (deprecated since v3.1, use `hasContextInfo()`) triggers a deprecation at runtime with `trigger_deprecation()` (`symfony/deprecation-contracts`, now required). Add tests.
* [#154](https://github.com/cleverage/ui-process-bundle/issues/154) Add a `.gitattributes`: the development files (`.docker/`, `.github/`, `tests/`, quality tools and PHPUnit configurations, `Makefile`) are no longer part of the archive installed by Composer (`dist`), remove the unused `package.json` (Webpack Encore leftover of the Symfony skeleton: no `webpack.config.js`, no `assets/`).
* [#149](https://github.com/cleverage/ui-process-bundle/issues/149) Clean up composer.json: remove the unused `symfony/dotenv`, `symfony/runtime`, `ext-ctype` and `ext-iconv` requirements (applications relying on the bundle to install `symfony/dotenv` / `symfony/runtime` must require them, as the Symfony skeleton does); replace `doctrine/common` by `doctrine/collections` (only `ArrayCollection` is used); require `twig/twig`, `symfony/twig-bundle`, `psr/log`, `doctrine/persistence`, `doctrine/migrations` and `symfony/event-dispatcher-contracts`, used directly but only installed transitively; add `twig/extra-bundle` and `symfony/property-access` (used by the tests) to the dev requirements.
* [#150](https://github.com/cleverage/ui-process-bundle/issues/150) Require `symfony/monolog-bundle` and `monolog/monolog`, used directly by the bundle (log handlers, `monolog` configuration prepended, `monolog.logger` tags) but only installed through `cleverage/process-bundle`, which may stop requiring MonologBundle (cleverage/process-bundle#269).
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"symfony/config": "^6.4 || ^7.4 || ^8",
"symfony/console": "^6.4 || ^7.4 || ^8",
"symfony/dependency-injection": "^6.4 || ^7.4 || ^8",
"symfony/deprecation-contracts": "^2.5 || ^3",
"symfony/doctrine-messenger": "^6.4 || ^7.4 || ^8",
"symfony/event-dispatcher": "^6.4 || ^7.4 || ^8",
"symfony/event-dispatcher-contracts": "^3",
Expand Down
2 changes: 2 additions & 0 deletions src/Entity/LogRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public function hasContextInfo(): bool
*/
public function contextIsEmpty(): bool
{
trigger_deprecation('cleverage/ui-process-bundle', '3.1', 'The "%s()" method is deprecated, use "hasContextInfo()" instead.', __METHOD__);

return $this->hasContextInfo();
}

Expand Down
19 changes: 16 additions & 3 deletions tests/Entity/LogRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,22 @@ public function testContextIsReadableByThePropertyAccessor(): void

public function testDeprecatedContextIsEmptyIsUnchanged(): void
{
// Misnamed: returns true when the context is NOT empty
self::assertTrue($this->createLogRecord(['file' => 'a.txt'])->contextIsEmpty());
self::assertFalse($this->createLogRecord([])->contextIsEmpty());
$deprecations = [];
set_error_handler(static function (int $errno, string $errstr) use (&$deprecations): bool {
$deprecations[] = $errstr;

return true;
}, \E_USER_DEPRECATED);
try {
// Misnamed: returns true when the context is NOT empty
self::assertTrue($this->createLogRecord(['file' => 'a.txt'])->contextIsEmpty());
self::assertFalse($this->createLogRecord([])->contextIsEmpty());
} finally {
restore_error_handler();
}

$expected = 'Since cleverage/ui-process-bundle 3.1: The "CleverAge\\UiProcessBundle\\Entity\\LogRecord::contextIsEmpty()" method is deprecated, use "hasContextInfo()" instead.';
self::assertSame([$expected, $expected], $deprecations);
}

public function testAccessors(): void
Expand Down
Loading