Skip to content

Commit

Permalink
Deprecate option setters and getters in Hostname
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Jun 30, 2024
1 parent 66ab091 commit 2c43627
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
21 changes: 21 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,18 @@
</PropertyNotSetInConstructor>
</file>
<file src="src/Hostname.php">
<DeprecatedMethod>
<code><![CDATA[getAllow]]></code>
<code><![CDATA[getAllow]]></code>
<code><![CDATA[getAllow]]></code>
<code><![CDATA[getAllow]]></code>
<code><![CDATA[getAllow]]></code>
<code><![CDATA[getAllow]]></code>
<code><![CDATA[getIdnCheck]]></code>
<code><![CDATA[getIpValidator]]></code>
<code><![CDATA[getIpValidator]]></code>
<code><![CDATA[getTldCheck]]></code>
</DeprecatedMethod>
<DocblockTypeContradiction>
<code><![CDATA[is_array($options)]]></code>
<code><![CDATA[is_string($value)]]></code>
Expand Down Expand Up @@ -2473,6 +2485,10 @@
</PossiblyUnusedMethod>
</file>
<file src="test/EmailAddressTest.php">
<DeprecatedMethod>
<code><![CDATA[useIdnCheck]]></code>
<code><![CDATA[useTldCheck]]></code>
</DeprecatedMethod>
<InvalidArgument>
<code><![CDATA[Hostname::ALLOW_ALL]]></code>
<code><![CDATA[Hostname::ALLOW_ALL]]></code>
Expand Down Expand Up @@ -2839,6 +2855,11 @@
</PossiblyUnusedMethod>
</file>
<file src="test/HostnameTest.php">
<DeprecatedMethod>
<code><![CDATA[getAllow]]></code>
<code><![CDATA[useIdnCheck]]></code>
<code><![CDATA[useTldCheck]]></code>
</DeprecatedMethod>
<InvalidArgument>
<code><![CDATA[$option]]></code>
<code><![CDATA[$option]]></code>
Expand Down
22 changes: 19 additions & 3 deletions src/Hostname.php
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,8 @@ public function __construct($options = [])
/**
* Returns the set ip validator
*
* @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0
*
* @return Ip
*/
public function getIpValidator()
Expand All @@ -1841,6 +1843,8 @@ public function getIpValidator()
}

/**
* @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0
*
* @param Ip $ipValidator OPTIONAL
* @return self
*/
Expand All @@ -1857,6 +1861,8 @@ public function setIpValidator(?Ip $ipValidator = null)
/**
* Returns the allow option
*
* @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0
*
* @return int
*/
public function getAllow()
Expand All @@ -1867,7 +1873,9 @@ public function getAllow()
/**
* Sets the allow option
*
* @param int $allow
* @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0
*
* @param int $allow
* @return $this Provides a fluent interface
*/
public function setAllow($allow)
Expand All @@ -1879,6 +1887,8 @@ public function setAllow($allow)
/**
* Returns the set idn option
*
* @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0
*
* @return bool
*/
public function getIdnCheck()
Expand All @@ -1891,7 +1901,9 @@ public function getIdnCheck()
*
* This only applies when DNS hostnames are validated
*
* @param bool $useIdnCheck Set to true to validate IDN domains
* @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0
*
* @param bool $useIdnCheck Set to true to validate IDN domains
* @return $this
*/
public function useIdnCheck($useIdnCheck)
Expand All @@ -1903,6 +1915,8 @@ public function useIdnCheck($useIdnCheck)
/**
* Returns the set tld option
*
* @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0
*
* @return bool
*/
public function getTldCheck()
Expand All @@ -1915,7 +1929,9 @@ public function getTldCheck()
*
* This only applies when DNS hostnames are validated
*
* @param bool $useTldCheck Set to true to validate TLD elements
* @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0
*
* @param bool $useTldCheck Set to true to validate TLD elements
* @return $this
*/
public function useTldCheck($useTldCheck)
Expand Down

0 comments on commit 2c43627

Please sign in to comment.