Skip to content

Commit

Permalink
Deprecate getters and setters in Callback filter
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Jun 29, 2024
1 parent 7465175 commit a1f539c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="src/Callback.php">
<DeprecatedMethod>
<code><![CDATA[setCallback]]></code>
<code><![CDATA[setCallbackParams]]></code>
</DeprecatedMethod>
<MixedFunctionCall>
<code><![CDATA[call_user_func_array($this->options['callback'], $params)]]></code>
</MixedFunctionCall>
Expand Down Expand Up @@ -1528,6 +1532,11 @@
</PossiblyUnusedMethod>
</file>
<file src="test/CallbackTest.php">
<DeprecatedMethod>
<code><![CDATA[getCallbackParams]]></code>
<code><![CDATA[getCallbackParams]]></code>
<code><![CDATA[setCallbackParams]]></code>
</DeprecatedMethod>
<InvalidArgument>
<code><![CDATA['param']]></code>
<code><![CDATA['param']]></code>
Expand Down
10 changes: 9 additions & 1 deletion src/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ public function __construct($callbackOrOptions = [], $callbackParams = [])
/**
* Sets a new callback for this filter
*
* @deprecated since 2.37.0 - All option setters and getters will be removed in 3.0
*
* @param callable $callback
* @throws Exception\InvalidArgumentException
* @return self
* @throws Exception\InvalidArgumentException
*/
public function setCallback($callback)
{
Expand All @@ -69,6 +71,8 @@ public function setCallback($callback)
/**
* Returns the set callback
*
* @deprecated since 2.37.0 - All option setters and getters will be removed in 3.0
*
* @return callable
*/
public function getCallback()
Expand All @@ -79,6 +83,8 @@ public function getCallback()
/**
* Sets parameters for the callback
*
* @deprecated since 2.37.0 - All option setters and getters will be removed in 3.0
*
* @param array $params
* @return self
*/
Expand All @@ -91,6 +97,8 @@ public function setCallbackParams($params)
/**
* Get parameters for the callback
*
* @deprecated since 2.37.0 - All option setters and getters will be removed in 3.0
*
* @return array
*/
public function getCallbackParams()
Expand Down

0 comments on commit a1f539c

Please sign in to comment.