forked from serbanghita/Mobile-Detect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging Fix: Method annotations are in the wrong place serbanghita#913
- Loading branch information
Showing
2 changed files
with
28 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,14 @@ | |
* @author: Victor Stanciu <[email protected]> (original author) | ||
* | ||
* @version 3.74.0 | ||
* | ||
*/ | ||
namespace Detection; | ||
|
||
use BadMethodCallException; | ||
|
||
/** | ||
* Auto-generated isXXXX() magic methods. | ||
* php -a export/dump_magic_methods.php | ||
* php export/dump_magic_methods.php | ||
* | ||
* @method bool isiPhone() | ||
* @method bool isBlackBerry() | ||
|
@@ -212,12 +217,7 @@ | |
* @method bool isWebKit() | ||
* @method bool isConsole() | ||
* @method bool isWatch() | ||
*/ | ||
namespace Detection; | ||
|
||
use BadMethodCallException; | ||
|
||
class MobileDetect | ||
{ | ||
/** | ||
|
@@ -829,19 +829,19 @@ class MobileDetect | |
* Construct an instance of this class. | ||
* | ||
* @param array|null $headers Specify the headers as injection. Should be PHP _SERVER flavored. | ||
* If left empty, will use the global _SERVER['HTTP_*'] vars instead. | ||
* If left empty, will use the global _SERVER['HTTP_*'] vars instead. | ||
* @param string|null $userAgent Inject the User-Agent header. If null, will use HTTP_USER_AGENT | ||
* from the $headers array instead. | ||
* from the $headers array instead. | ||
*/ | ||
public function __construct(array $headers = null, string $userAgent = null) | ||
public function __construct(array $headers = null, $userAgent = null) | ||
{ | ||
$this->setHttpHeaders($headers); | ||
$this->setUserAgent($userAgent); | ||
} | ||
|
||
/** | ||
* Get the current script version. | ||
* This is useful for the demo file, | ||
* This is useful for the demo.php file, | ||
* so people can check on what version they are testing | ||
* for mobile devices. | ||
* | ||
|
@@ -944,7 +944,7 @@ public function getUaHttpHeaders(): array | |
* | ||
* @param array|null $cfHeaders List of HTTP headers | ||
* | ||
* @return boolean If there were CloudFront headers to be set | ||
* @return bool If there were CloudFront headers to be set | ||
*/ | ||
public function setCfHeaders(array $cfHeaders = null): bool | ||
{ | ||
|
@@ -1038,7 +1038,7 @@ public function getMatchingRegex(): ?string | |
return $this->matchingRegex; | ||
} | ||
|
||
public function getMatchesArray(): ?string | ||
public function getMatchesArray(): ?array | ||
{ | ||
return $this->matchesArray; | ||
} | ||
|
@@ -1168,10 +1168,10 @@ public function __call(string $name, array $arguments) | |
/** | ||
* Find a detection rule that matches the current User-agent. | ||
* | ||
* @param null $userAgent deprecated | ||
* @return boolean | ||
* @param string|null $userAgent deprecated | ||
* @return bool | ||
*/ | ||
protected function matchDetectionRulesAgainstUA($userAgent = null): bool | ||
protected function matchDetectionRulesAgainstUA(string $userAgent = null): bool | ||
{ | ||
// Begin general search. | ||
foreach ($this->getRules() as $_regex) { | ||
|
@@ -1194,7 +1194,7 @@ protected function matchDetectionRulesAgainstUA($userAgent = null): bool | |
* | ||
* @param string $key | ||
* | ||
* @return boolean | ||
* @return bool | ||
*/ | ||
protected function matchUAAgainstKey(string $key): bool | ||
{ | ||
|
@@ -1219,11 +1219,11 @@ protected function matchUAAgainstKey(string $key): bool | |
/** | ||
* Check if the device is mobile. | ||
* Returns true if any type of mobile device detected, including special ones | ||
* @param null $userAgent deprecated | ||
* @param null $httpHeaders deprecated | ||
* @param string|null $userAgent deprecated | ||
* @param array|null $httpHeaders deprecated | ||
* @return bool | ||
*/ | ||
public function isMobile($userAgent = null, $httpHeaders = null): bool | ||
public function isMobile(string $userAgent = null, array $httpHeaders = null): bool | ||
{ | ||
|
||
if ($httpHeaders) { | ||
|
@@ -1287,8 +1287,8 @@ public function isTablet(string $userAgent = null, array $httpHeaders = null): b | |
* @param string|null $userAgent deprecated | ||
* @param array|null $httpHeaders deprecated | ||
* @return bool | ||
*@todo: The httpHeaders part is not yet used. | ||
* | ||
* @todo: The httpHeaders part is not yet used. | ||
*/ | ||
public function is(string $key, string $userAgent = null, array $httpHeaders = null): bool | ||
{ | ||
|
@@ -1313,13 +1313,13 @@ public function is(string $key, string $userAgent = null, array $httpHeaders = n | |
* This method will be used to check custom regexes against | ||
* the User-Agent string. | ||
* | ||
* @param $regex | ||
* @param string $regex | ||
* @param string|null $userAgent | ||
* @return bool | ||
* | ||
* @todo: search in the HTTP headers too. | ||
*/ | ||
public function match($regex, string $userAgent = null): bool | ||
public function match(string $regex, string $userAgent = null): bool | ||
{ | ||
if (!\is_string($userAgent) && !\is_string($this->userAgent)) { | ||
return false; | ||
|
@@ -1355,8 +1355,8 @@ public static function getProperties(): array | |
* @param string $ver The string version, like "2.6.21.2152"; | ||
* | ||
* @return float | ||
*@todo Remove the error suppression from str_replace() call. | ||
* | ||
* @todo Remove the error suppression from str_replace() call. | ||
*/ | ||
public function prepareVersionNo(string $ver): float | ||
{ | ||
|