Refactor parseDate function signature in AbstractSearch

Removed unnecessary comments and added type hinting to the function parseDate in the AbstractSearch class. Any string passed to this function will now explicitly be expected as a string data type, increasing code robustness and easing debugging process.
This commit is contained in:
Julien Fastré 2023-12-14 23:05:05 +01:00
parent 2dd1b7c943
commit 312eb5ec7c
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -24,13 +24,11 @@ abstract class AbstractSearch implements SearchInterface
/**
* parse string expected to be a date and transform to a DateTime object.
*
* @param type $string
*
* @return \DateTime
*
* @throws ParsingException if the date is not parseable
*/
public function parseDate($string)
public function parseDate(string $string)
{
try {
return new \DateTime($string);