From 5d64054166a50160ec038460133c43c6ac65e60a Mon Sep 17 00:00:00 2001 From: George Steel Date: Tue, 7 Jan 2025 23:39:25 +0000 Subject: [PATCH] Inflector Filter Deprecations See #220 Signed-off-by: George Steel --- psalm-baseline.xml | 85 ++++++++++++++++++++++++++++++++++++++++++++++ src/Inflector.php | 63 +++++++++++++++++++++++++++++----- 2 files changed, 140 insertions(+), 8 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index c0261ab3..d1864aa2 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1291,6 +1291,21 @@ + + + + + + + + + + + + + + + @@ -2172,6 +2187,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Inflector.php b/src/Inflector.php index 27c83c5d..59c336d5 100644 --- a/src/Inflector.php +++ b/src/Inflector.php @@ -91,6 +91,8 @@ public function __construct($options = null) /** * Retrieve plugin manager * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement + * * @return FilterPluginManager */ public function getPluginManager() @@ -105,6 +107,8 @@ public function getPluginManager() /** * Set plugin manager * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement + * * @return self */ public function setPluginManager(FilterPluginManager $manager) @@ -116,7 +120,10 @@ public function setPluginManager(FilterPluginManager $manager) /** * Set options * - * @param array|Options|iterable $options + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * + * @param array|Options|iterable $options * @return self */ public function setOptions($options) @@ -156,7 +163,10 @@ public function setOptions($options) * Set Whether or not the inflector should throw an exception when a replacement * identifier is still found within an inflected target. * - * @param bool $throwTargetExceptionsOn + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * + * @param bool $throwTargetExceptionsOn * @return self */ public function setThrowTargetExceptionsOn($throwTargetExceptionsOn) @@ -168,6 +178,8 @@ public function setThrowTargetExceptionsOn($throwTargetExceptionsOn) /** * Will exceptions be thrown? * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. + * * @return bool */ public function isThrowTargetExceptionsOn() @@ -178,7 +190,10 @@ public function isThrowTargetExceptionsOn() /** * Set the Target Replacement Identifier, by default ':' * - * @param string $targetReplacementIdentifier + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * + * @param string $targetReplacementIdentifier * @return self */ public function setTargetReplacementIdentifier($targetReplacementIdentifier) @@ -193,6 +208,8 @@ public function setTargetReplacementIdentifier($targetReplacementIdentifier) /** * Get Target Replacement Identifier * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. + * * @return string */ public function getTargetReplacementIdentifier() @@ -204,7 +221,10 @@ public function getTargetReplacementIdentifier() * Set a Target * ex: 'scripts/:controller/:action.:suffix' * - * @param string $target + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * + * @param string $target * @return self */ public function setTarget($target) @@ -216,6 +236,8 @@ public function setTarget($target) /** * Retrieve target * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. + * * @return string */ public function getTarget() @@ -226,7 +248,9 @@ public function getTarget() /** * Set Target Reference * - * @param string $target + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. + * + * @param string $target * @return self */ public function setTargetReference(&$target) @@ -239,6 +263,9 @@ public function setTargetReference(&$target) * Is the same as calling addRules() with the exception that it * clears the rules before adding them. * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * * @return self */ public function setRules(array $rules) @@ -261,6 +288,9 @@ public function setRules(array $rules) * 'suffix' => 'phtml' * ); * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * * @return self */ public function addRules(array $rules) @@ -283,7 +313,9 @@ public function addRules(array $rules) * By default, returns all rules. If a $spec is provided, will return those * rules if found, false otherwise. * - * @param string $spec + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. + * + * @param string $spec * @return array|false */ public function getRules($spec = null) @@ -302,8 +334,10 @@ public function getRules($spec = null) /** * Returns a rule set by setFilterRule(), a numeric index must be provided * - * @param string $spec - * @param int $index + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. + * + * @param string $spec + * @param int $index * @return FilterInterface|false */ public function getRule($spec, $index) @@ -320,6 +354,8 @@ public function getRule($spec, $index) /** * Clears the rules currently in the inflector * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. + * * @return self */ public function clearRules() @@ -332,6 +368,9 @@ public function clearRules() * Set a filtering rule for a spec. $ruleSet can be a string, Filter object * or an array of strings or filter objects. * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * * @param string $spec * @param array|string|FilterInterface $ruleSet * @return self @@ -346,6 +385,9 @@ public function setFilterRule($spec, $ruleSet) /** * Add a filter rule for a spec * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * * @return self */ public function addFilterRule(mixed $spec, mixed $ruleSet) @@ -375,6 +417,9 @@ public function addFilterRule(mixed $spec, mixed $ruleSet) /** * Set a static rule for a spec. This is a single string value * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. Options should be + * passed to the constructor. + * * @param string $name * @param string $value * @return self @@ -393,6 +438,8 @@ public function setStaticRule($name, $value) * in to be referenced when its time to build the output string from the * target. * + * @deprecated Since 2.41.0 This method will be removed in version 3.0 without replacement. + * * @param string $name * @return self */