Skip to content

Commit

Permalink
Optimized phpdoc for @deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia committed Oct 24, 2024
1 parent b29154f commit 9e860cd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ConstEventsNames.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace FriendsOfHyperf\Trigger;

/**
* @deprecated since v3.1, will removed in 3.2, use \MySQLReplication\Definitions\ConstEventsNames instead
* @deprecated since v3.1, use \MySQLReplication\Definitions\ConstEventsNames instead, will be removed in v3.2
*/
enum ConstEventsNames: string
{
Expand Down
12 changes: 6 additions & 6 deletions src/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,31 +112,31 @@ public function start(): void
}

/**
* @deprecated use `$this->binLogCurrentSnapshot` instead, will remove in v3.2.
* @deprecated since v3.1, use `$this->binLogCurrentSnapshot` instead, will be removed in v3.2.
*/
public function getBinLogCurrentSnapshot(): BinLogCurrentSnapshotInterface
{
return $this->binLogCurrentSnapshot;
}

/**
* @deprecated use `$this->healthMonitor` instead, will remove in v3.2.
* @deprecated since v3.1, use `$this->healthMonitor` instead, will be removed in v3.2.
*/
public function getHealthMonitor(): ?HealthMonitor
{
return $this->healthMonitor;
}

/**
* @deprecated use `$this->name` instead, will remove in v3.2.
* @deprecated since v3.1, use `$this->name` instead, will be removed in v3.2.
*/
public function getName(): string
{
return $this->name;
}

/**
* @deprecated use `$this->config->get($key, $default)` instead, will remove in v3.2.
* @deprecated since v3.1, use `$this->config->get($key, $default)` instead, will be removed in v3.2.
*/
public function getOption(?string $key = null, mixed $default = null): mixed
{
Expand All @@ -148,15 +148,15 @@ public function getOption(?string $key = null, mixed $default = null): mixed
}

/**
* @deprecated use `$this->connection` instead, will remove in v3.2.
* @deprecated since v3.1, use `$this->connection` instead, will be removed in v3.2.
*/
public function getConnection(): string
{
return $this->connection;
}

/**
* @deprecated use `$this->identifier` instead, will remove in v3.2.
* @deprecated since v3.1, use `$this->identifier` instead, will be removed in v3.2.
*/
public function getIdentifier(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/ConsumerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function register(): void
}

/**
* @deprecated since v3.1, will removed in v3.2
* @deprecated since v3.1, will be removed in v3.2
*/
public function run(): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Subscriber/SnapshotSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function allEvents(EventDTO $event): void

$eventInfo = $event->getEventInfo();
$binLogCurrent = match (true) {
method_exists($eventInfo, 'getBinLogCurrent') => $eventInfo->getBinLogCurrent(), // v7.x, @deprecated, will removed in v3.2
method_exists($eventInfo, 'getBinLogCurrent') => $eventInfo->getBinLogCurrent(), // v7.x, @deprecated since v3.1, will be removed in v3.2
property_exists($eventInfo, 'binLogCurrent') => $eventInfo->binLogCurrent, // @phpstan-ignore property.private
default => null,
};
Expand Down
6 changes: 3 additions & 3 deletions src/Subscriber/TriggerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ protected function allEvents(EventDTO $event): void
$this->loop();

$database = match (true) {
method_exists($event, 'getTableMap') => $event->getTableMap()->getDatabase(), // v7.x, @deprecated, will removed in v3.2
method_exists($event, 'getTableMap') => $event->getTableMap()->getDatabase(), // v7.x, @deprecated, will be removed in v3.2
property_exists($event, 'tableMap') => $event->tableMap->database, // @phpstan-ignore property.private
default => null,
};

$table = match (true) {
method_exists($event, 'getTableMap') => $event->getTableMap()->getTable(), // v7.x, @deprecated, will removed in v3.2
method_exists($event, 'getTableMap') => $event->getTableMap()->getTable(), // v7.x, @deprecated, will be removed in v3.2
property_exists($event, 'tableMap') => $event->tableMap->table, // @phpstan-ignore property.private
default => null,
};
Expand All @@ -139,7 +139,7 @@ protected function allEvents(EventDTO $event): void

foreach ($this->triggerManager->get($key) as $callable) {
$values = match (true) {
method_exists($event, 'getValues') => $event->getValues(), // v7.x, @deprecated, will removed in v3.2
method_exists($event, 'getValues') => $event->getValues(), // v7.x, @deprecated since v3.1, will be removed in v3.2
property_exists($event, 'values') => $event->values, // @phpstan-ignore property.private
default => [],
};
Expand Down

0 comments on commit 9e860cd

Please sign in to comment.