Skip to content

Commit 04f4309

Browse files
committed
[minor] deprecate ConfigureWithDocblocks
1 parent edc10ea commit 04f4309

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ class CreateUserCommand extends Command
267267

268268
### `ConfigureWithDocblocks`
269269

270+
> **Note**
271+
> This trait is deprecated when using with PHP 8+ and will be removed in 2.0.
272+
> Use [`ConfigureWithAttributes`](#configurewithattributes) instead.
273+
270274
Use this trait to allow your command to be configured by your command class' docblock.
271275
`phpdocumentor/reflection-docblock` is required for this feature
272276
(`composer install phpdocumentor/reflection-docblock`).

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"require": {
1515
"php": ">=7.4",
1616
"symfony/console": "^4.4|^5.0|^6.0",
17+
"symfony/deprecation-contracts": "^2.2|^3.0",
1718
"symfony/polyfill-php80": "^1.15",
1819
"symfony/string": "^5.0|^6.0",
1920
"zenstruck/callback": "^1.4.2"

src/Configuration/DocblockConfiguration.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use Symfony\Component\Console\Command\Command;
88
use Symfony\Component\Console\Input\InputArgument;
99
use Symfony\Component\Console\Input\InputOption;
10+
use Zenstruck\Console\ConfigureWithAttributes;
11+
use Zenstruck\Console\ConfigureWithDocblocks;
1012

1113
use function Symfony\Component\String\u;
1214

@@ -38,6 +40,10 @@ private function __construct(string $class)
3840
{
3941
$this->class = new \ReflectionClass($class);
4042
$this->docblock = self::factory()->create($this->class->getDocComment() ?: ' '); // hack to allow empty docblock
43+
44+
if (\PHP_VERSION_ID >= 80000) {
45+
trigger_deprecation('zenstruck/console-extra', '1.1', 'The %s trait is deprecated and will be removed in 2.0. Use %s instead.', ConfigureWithDocblocks::class, ConfigureWithAttributes::class);
46+
}
4147
}
4248

4349
/**

tests/Unit/ConfigureWithDocblocksTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
/**
1111
* @author Kevin Bond <kevinbond@gmail.com>
12+
*
13+
* @group legacy
1214
*/
1315
final class ConfigureWithDocblocksTest extends TestCase
1416
{

0 commit comments

Comments
 (0)