Skip to content

Commit

Permalink
feat: Deprecate the metadata setting
Browse files Browse the repository at this point in the history
Closes #1152.
  • Loading branch information
theofidry committed Nov 7, 2023
1 parent 4cfda8d commit 7b0b786
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ This setting will be ignored if no [key][key] has been provided.

## Metadata (`metadata`)

!!! warning

The metadata setting has been deprecated as of Box 4.6.0. See [#1152].

The metadata (`any` default none) setting can be any value. This value will be stored as metadata that can be retrieved
from the built PHAR ([Phar::getMetadata()][phar.getmetadata]).

Expand Down Expand Up @@ -1070,3 +1074,4 @@ The short commit hash will only be used if no tag is available.
[stub]: #stub
[symfony-finder]: https://symfony.com/doc/current//components/finder.html
[zlib-extension]: https://secure.php.net/manual/en/book.zlib.php
[#1152]: https://github.com/box-project/box/issues/1152
2 changes: 2 additions & 0 deletions src/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -1892,6 +1892,8 @@ private static function retrieveMetadata(stdClass $raw, ConfigurationLogger $log
return null;
}

$logger->addWarning('Using the "metadata" setting is deprecated and will be removed in 5.0.0.');

$metadata = $raw->{self::METADATA_KEY};

return is_object($metadata) ? (array) $metadata : $metadata;
Expand Down
7 changes: 6 additions & 1 deletion tests/Configuration/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,12 @@ public function test_can_configure_metadata(): void
self::assertSame(123, $this->config->getMetadata());

self::assertSame([], $this->config->getRecommendations());
self::assertSame([], $this->config->getWarnings());
self::assertSame(
[
'Using the "metadata" setting is deprecated and will be removed in 5.0.0.'
],
$this->config->getWarnings(),
);
}

public function test_a_recommendation_is_given_if_the_default_metadata_is_provided(): void
Expand Down
3 changes: 3 additions & 0 deletions tests/Console/Command/CompileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ public function test_it_can_build_a_phar_file(): void
No recommendation found.
⚠️ <warning>1 warning found:</warning>
- Using the "metadata" setting is deprecated and will be removed in 5.0.0.
- Using an OpenSSL signature is deprecated and will be removed in 5.0.0. Please check https://github.com/box-project/box/blob/main/doc/phar-signing.md for alternatives.
// PHAR: {$numberOfFiles} files (100B)
Expand Down Expand Up @@ -899,6 +900,7 @@ public function test_it_can_build_a_phar_file_in_verbose_mode(): void
No recommendation found.
⚠️ <warning>1 warning found:</warning>
- Using the "metadata" setting is deprecated and will be removed in 5.0.0.
- Using an OpenSSL signature is deprecated and will be removed in 5.0.0. Please check https://github.com/box-project/box/blob/main/doc/phar-signing.md for alternatives.
// PHAR: {$expectedNumberOfFiles} files (100B)
Expand Down Expand Up @@ -1029,6 +1031,7 @@ public function test_it_can_build_a_phar_file_in_very_verbose_mode(): void
No recommendation found.
⚠️ <warning>1 warning found:</warning>
- Using the "metadata" setting is deprecated and will be removed in 5.0.0.
- Using an OpenSSL signature is deprecated and will be removed in 5.0.0. Please check https://github.com/box-project/box/blob/main/doc/phar-signing.md for alternatives.
// PHAR: {$expectedNumberOfFiles} files (100B)
Expand Down

0 comments on commit 7b0b786

Please sign in to comment.