Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2abda82

Browse files
Replace Drush annotations with attributes (#633)
1 parent 0cfaf5b commit 2abda82

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎drush/Commands/PolicyCommands.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
namespace Drush\Commands;
44

55
use Consolidation\AnnotatedCommand\CommandData;
6+
use Consolidation\AnnotatedCommand\Hooks\HookManager;
7+
use Drush\Attributes\Hook;
8+
use Drush\Commands\core\RsyncCommands;
9+
use Drush\Commands\sql\SqlSyncCommands;
610

711
/**
812
* Edit this file to reflect your organization's needs.
@@ -13,10 +17,9 @@ class PolicyCommands extends DrushCommands {
1317
* Prevent catastrophic braino. Note that this file has to be local to the
1418
* machine that initiates the sql:sync command.
1519
*
16-
* @hook validate sql:sync
17-
*
1820
* @throws \Exception
1921
*/
22+
#[Hook(type: HookManager::ARGUMENT_VALIDATOR, target: SqlSyncCommands::SYNC)]
2023
public function sqlSyncValidate(CommandData $commandData) {
2124
if ($commandData->input()->getArgument('target') == '@prod') {
2225
throw new \Exception(dt('Per !file, you may never overwrite the production database.', ['!file' => __FILE__]));
@@ -26,10 +29,9 @@ public function sqlSyncValidate(CommandData $commandData) {
2629
/**
2730
* Limit rsync operations to production site.
2831
*
29-
* @hook validate core:rsync
30-
*
3132
* @throws \Exception
3233
*/
34+
#[Hook(type: HookManager::ARGUMENT_VALIDATOR, target: RsyncCommands::RSYNC)]
3335
public function rsyncValidate(CommandData $commandData) {
3436
if (preg_match("/^@prod/", $commandData->input()->getArgument('target'))) {
3537
throw new \Exception(dt('Per !file, you may never rsync to the production site.', ['!file' => __FILE__]));

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /