Skip to content

Commit

Permalink
fix: Deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
seebeen committed Jun 19, 2024
1 parent 3df2a23 commit bfb65ab
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 40 deletions.
12 changes: 5 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
}
],
"require": {
"php": "^8.1",
"automattic/jetpack-constants": "^2.0",
"php": ">=8.1",
"automattic/jetpack-constants": "^2",
"x-wp/hook-invoker": "^1"
},
"require-dev": {
"oblak/wordpress-coding-standard": "^1.1.1"
"oblak/wordpress-coding-standard": "^1"
},
"suggest": {
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package.",
"oblak/composer-wp-di-finder-plugin": "Automatically find Hookable classes"
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
},
"minimum-stability": "beta",
"prefer-stable": true,
Expand All @@ -34,8 +33,7 @@
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"ergebnis/composer-normalize": true
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
28 changes: 14 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/Annotation_Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

/**
* Annotation parser for legacy code.
*
* @deprecated 1.0.0
*/
final class Annotation_Parser {
/**
Expand Down
15 changes: 12 additions & 3 deletions src/Decorators/Hookable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,23 @@ class Hookable extends Handler {
* @param string $hook Hook name.
* @param int $priority Hook priority.
* @param callable $conditional Conditional callback function.
* @param string $tag Tag name. Optional, if not provided, hook name will be used.
* @param mixed ...$args Arguments to pass to the hookable class constructor.
*
* @throws \InvalidArgumentException If hook or tag is not provided.
*/
public function __construct(
string $hook,
?string $hook = null,
int $priority = 10,
$conditional = '__return_true',
$conditional = null,
?string $tag = null,
mixed ...$args,
) {
parent::__construct( tag: $hook, priority: $priority, conditional: $conditional );
$tgt = $tag ?? $hook ?? false;

if ( ! $tgt ) {
throw new \InvalidArgumentException( 'Hook name or tag must be provided.' );
}
parent::__construct( tag: $tgt, priority: $priority, conditional: $conditional );
}
}
14 changes: 0 additions & 14 deletions src/Utils/wp-hook-di-fn-loader.php

This file was deleted.

0 comments on commit bfb65ab

Please sign in to comment.