Skip to content

Commit

Permalink
Make the name more explicit (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Oct 31, 2022
1 parent 93f5b47 commit 6bbcaa0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion e2e/scenario11/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing bamarni/composer-bin-plugin (dev-hash): Symlinking from ../..
Generating autoload files
[bamarni-bin] The setting "bamarni-bin.bin-links" will be set to "false" from 2.x onwards. If you wish to keep it to "true", you need to set it explicitly.
[bamarni-bin] The setting "extra.bamarni-bin.bin-links" will be set to "false" from 2.x onwards. If you wish to keep it to "true", you need to set it explicitly.
[bamarni-bin] The command is being forwarded.
[bamarni-bin] Checking namespace vendor-bin/ns1
Loading composer repositories with package information
Expand Down
10 changes: 5 additions & 5 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct(array $extra)
if (!is_bool($binLinks)) {
throw new InvalidBamarniComposerExtraConfig(
sprintf(
'Expected setting "%s.%s" to be a boolean value. Got "%s".',
'Expected setting "extra.%s.%s" to be a boolean value. Got "%s".',
self::EXTRA_CONFIG_KEY,
self::BIN_LINKS_ENABLED,
$getType($binLinks)
Expand All @@ -84,7 +84,7 @@ public function __construct(array $extra)

if ($binLinks && !$binLinksSetExplicitly) {
$this->deprecations[] = sprintf(
'The setting "%s.%s" will be set to "false" from 2.x onwards. If you wish to keep it to "true", you need to set it explicitly.',
'The setting "extra.%s.%s" will be set to "false" from 2.x onwards. If you wish to keep it to "true", you need to set it explicitly.',
self::EXTRA_CONFIG_KEY,
self::BIN_LINKS_ENABLED
);
Expand All @@ -95,7 +95,7 @@ public function __construct(array $extra)
if (!is_string($targetDirectory)) {
throw new InvalidBamarniComposerExtraConfig(
sprintf(
'Expected setting "%s.%s" to be a string. Got "%s".',
'Expected setting "extra.%s.%s" to be a string. Got "%s".',
self::EXTRA_CONFIG_KEY,
self::TARGET_DIRECTORY,
$getType($targetDirectory)
Expand All @@ -108,7 +108,7 @@ public function __construct(array $extra)
if (!is_bool($forwardCommand)) {
throw new InvalidBamarniComposerExtraConfig(
sprintf(
'Expected setting "%s.%s" to be a boolean value. Got "%s".',
'Expected setting "extra.%s.%s" to be a boolean value. Got "%s".',
self::EXTRA_CONFIG_KEY,
self::FORWARD_COMMAND,
gettype($forwardCommand)
Expand All @@ -120,7 +120,7 @@ public function __construct(array $extra)

if (!$forwardCommand && !$forwardCommandSetExplicitly) {
$this->deprecations[] = sprintf(
'The setting "%s.%s" will be set to "true" from 2.x onwards. If you wish to keep it to "false", you need to set it explicitly.',
'The setting "extra.%s.%s" will be set to "true" from 2.x onwards. If you wish to keep it to "false", you need to set it explicitly.',
self::EXTRA_CONFIG_KEY,
self::FORWARD_COMMAND
);
Expand Down
12 changes: 6 additions & 6 deletions tests/Config/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function test_it_can_be_instantiated(

public static function provideExtraConfig(): iterable
{
$binLinksEnabledDeprecationMessage = 'The setting "bamarni-bin.bin-links" will be set to "false" from 2.x onwards. If you wish to keep it to "true", you need to set it explicitly.';
$forwardCommandDeprecationMessage = 'The setting "bamarni-bin.forward-command" will be set to "true" from 2.x onwards. If you wish to keep it to "false", you need to set it explicitly.';
$binLinksEnabledDeprecationMessage = 'The setting "extra.bamarni-bin.bin-links" will be set to "false" from 2.x onwards. If you wish to keep it to "true", you need to set it explicitly.';
$forwardCommandDeprecationMessage = 'The setting "extra.bamarni-bin.forward-command" will be set to "true" from 2.x onwards. If you wish to keep it to "false", you need to set it explicitly.';

yield 'default values' => [
[],
Expand Down Expand Up @@ -110,7 +110,7 @@ public static function provideInvalidExtraConfig(): iterable
Config::BIN_LINKS_ENABLED => 'foo',
],
],
'Expected setting "bamarni-bin.bin-links" to be a boolean value. Got "string".',
'Expected setting "extra.bamarni-bin.bin-links" to be a boolean value. Got "string".',
];

yield 'non string target directory' => [
Expand All @@ -120,8 +120,8 @@ public static function provideInvalidExtraConfig(): iterable
],
],
function_exists('get_debug_type')
? 'Expected setting "bamarni-bin.target-directory" to be a string. Got "bool".'
: 'Expected setting "bamarni-bin.target-directory" to be a string. Got "boolean".',
? 'Expected setting "extra.bamarni-bin.target-directory" to be a string. Got "bool".'
: 'Expected setting "extra.bamarni-bin.target-directory" to be a string. Got "boolean".',
];

yield 'non bool forward command' => [
Expand All @@ -130,7 +130,7 @@ function_exists('get_debug_type')
Config::FORWARD_COMMAND => 'foo',
],
],
'Expected setting "bamarni-bin.forward-command" to be a boolean value. Got "string".',
'Expected setting "extra.bamarni-bin.forward-command" to be a boolean value. Got "string".',
];
}
}

0 comments on commit 6bbcaa0

Please sign in to comment.