@@ -40,23 +40,21 @@ class Validator
4040 /**
4141 * Provides fluent method chaining.
4242 *
43- * @param Configuration $config A Twitter Text Configuration
44- *
43+ * @param Configuration|null $config A Twitter Text Configuration
44+ * @return self
4545 * @see __construct()
46- *
47- * @return Validator
4846 */
49- public static function create (Configuration $ config = null )
47+ public static function create (? Configuration $ config = null )
5048 {
5149 return new self ($ config );
5250 }
5351
5452 /**
5553 * Reads in a tweet to be parsed and validates it.
5654 *
57- * @param Configuration $config A Twitter Text Configuration
55+ * @param Configuration|null $config A Twitter Text Configuration
5856 */
59- public function __construct (Configuration $ config = null )
57+ public function __construct (? Configuration $ config = null )
6058 {
6159 $ this ->setConfiguration ($ config );
6260 $ this ->extractor = Extractor::create ();
@@ -71,7 +69,7 @@ public function __construct(Configuration $config = null)
7169 * @return Validator
7270 * @throws \InvalidArgumentException
7371 */
74- public function setConfiguration (Configuration $ config = null )
72+ public function setConfiguration (? Configuration $ config = null )
7573 {
7674 if ($ config === null ) {
7775 // default use v2 config
@@ -98,12 +96,12 @@ public function getConfiguration()
9896 /**
9997 * Check whether a tweet is valid.
10098 *
101- * @param string $tweet The tweet to validate.
102- * @param Configuration $config using configuration
99+ * @param string $tweet The tweet to validate.
100+ * @param Configuration|null $config using configuration
103101 * @return boolean Whether the tweet is valid.
104102 * @deprecated instead use \Twitter\Text\Parser::parseText()
105103 */
106- public function isValidTweetText ($ tweet , Configuration $ config = null )
104+ public function isValidTweetText ($ tweet , ? Configuration $ config = null )
107105 {
108106
109107 return $ this ->parseTweet ($ tweet , $ config )->valid ;
@@ -212,11 +210,11 @@ public function isValidURL($url, $unicode_domains = true, $require_protocol = tr
212210 * Determines the length of a tweet. Takes shortening of URLs into account.
213211 *
214212 * @param string $tweet The tweet to validate.
215- * @param Configuration $config using configuration
213+ * @param Configuration|null $config using configuration
216214 * @return int the length of a tweet.
217215 * @deprecated instead use \Twitter\Text\Parser::parseTweet()
218216 */
219- public function getTweetLength ($ tweet , Configuration $ config = null )
217+ public function getTweetLength ($ tweet , ? Configuration $ config = null )
220218 {
221219 return $ this ->parseTweet ($ tweet , $ config )->weightedLength ;
222220 }
@@ -247,7 +245,7 @@ protected static function isValidMatch($string, $pattern, $optional = false)
247245 * @param Configuration|null $config using configuration
248246 * @return ParseResults
249247 */
250- private function parseTweet ($ tweet , Configuration $ config = null )
248+ private function parseTweet ($ tweet , ? Configuration $ config = null )
251249 {
252250 if ($ config === null ) {
253251 $ config = $ this ->config ;
0 commit comments