Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inflector Filter Deprecations #221

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,21 @@
<DeprecatedClass>
<code><![CDATA[AbstractFilter]]></code>
</DeprecatedClass>
<DeprecatedMethod>
<code><![CDATA[addFilterRule]]></code>
<code><![CDATA[addFilterRule]]></code>
<code><![CDATA[addRules]]></code>
<code><![CDATA[addRules]]></code>
<code><![CDATA[clearRules]]></code>
<code><![CDATA[getPluginManager]]></code>
<code><![CDATA[setOptions]]></code>
<code><![CDATA[setPluginManager]]></code>
<code><![CDATA[setPluginManager]]></code>
<code><![CDATA[setStaticRule]]></code>
<code><![CDATA[setTarget]]></code>
<code><![CDATA[setTargetReplacementIdentifier]]></code>
<code><![CDATA[setThrowTargetExceptionsOn]]></code>
</DeprecatedMethod>
<InvalidArgument>
<code><![CDATA[array_values($processedParts)]]></code>
</InvalidArgument>
Expand Down Expand Up @@ -2172,6 +2187,76 @@
</PossiblyUnusedMethod>
</file>
<file src="test/InflectorTest.php">
<DeprecatedMethod>
<code><![CDATA[addFilterRule]]></code>
<code><![CDATA[addFilterRule]]></code>
<code><![CDATA[addRules]]></code>
<code><![CDATA[addRules]]></code>
<code><![CDATA[addRules]]></code>
<code><![CDATA[getPluginManager]]></code>
<code><![CDATA[getPluginManager]]></code>
<code><![CDATA[getPluginManager]]></code>
<code><![CDATA[getRule]]></code>
<code><![CDATA[getRule]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getRules]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTarget]]></code>
<code><![CDATA[getTargetReplacementIdentifier]]></code>
<code><![CDATA[getTargetReplacementIdentifier]]></code>
<code><![CDATA[getTargetReplacementIdentifier]]></code>
<code><![CDATA[getTargetReplacementIdentifier]]></code>
<code><![CDATA[getTargetReplacementIdentifier]]></code>
<code><![CDATA[isThrowTargetExceptionsOn]]></code>
<code><![CDATA[isThrowTargetExceptionsOn]]></code>
<code><![CDATA[isThrowTargetExceptionsOn]]></code>
<code><![CDATA[setFilterRule]]></code>
<code><![CDATA[setFilterRule]]></code>
<code><![CDATA[setFilterRule]]></code>
<code><![CDATA[setFilterRule]]></code>
<code><![CDATA[setFilterRule]]></code>
<code><![CDATA[setOptions]]></code>
<code><![CDATA[setOptions]]></code>
<code><![CDATA[setOptions]]></code>
<code><![CDATA[setPluginManager]]></code>
<code><![CDATA[setRules]]></code>
<code><![CDATA[setStaticRule]]></code>
<code><![CDATA[setStaticRule]]></code>
<code><![CDATA[setStaticRule]]></code>
<code><![CDATA[setStaticRule]]></code>
<code><![CDATA[setStaticRule]]></code>
<code><![CDATA[setStaticRuleReference]]></code>
<code><![CDATA[setStaticRuleReference]]></code>
<code><![CDATA[setTarget]]></code>
<code><![CDATA[setTarget]]></code>
<code><![CDATA[setTargetReference]]></code>
<code><![CDATA[setTargetReplacementIdentifier]]></code>
<code><![CDATA[setTargetReplacementIdentifier]]></code>
<code><![CDATA[setThrowTargetExceptionsOn]]></code>
</DeprecatedMethod>
<DocblockTypeContradiction>
<code><![CDATA[assertNull]]></code>
<code><![CDATA[assertSame]]></code>
Expand Down
63 changes: 55 additions & 8 deletions src/Inflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
*/
Expand Down
Loading