Skip to content
Open
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
21 changes: 15 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
on: [push, pull_request]

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:

php-intl:
runs-on: ubuntu-18.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
fetch-depth: 1

- run: php${{ matrix.php-version }} -v
- run: php${{ matrix.php-version }} -m
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: curl, mbstring, json, intl

- run: php -v
- run: php -m
- run: composer -V
- run: composer install
- run: php${{ matrix.php-version }} vendor/bin/phpunit --bootstrap tests/bootstrap.php tests
- run: vendor/bin/phpunit --bootstrap tests/bootstrap.php tests
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"symfony/polyfill-intl-idn": "^1.27"
},
"require-dev" : {
"phpunit/phpunit": "^8.0"
"phpunit/phpunit": "^8.0 || ^9.0 || ^10.0 || ^11.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Iodev/Whois/Exceptions/ConnectionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ConnectionException extends Exception
{
public function __construct($message = "", $code = 0, Throwable $previous = null)
public function __construct($message = "", $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Iodev/Whois/Exceptions/ServerMismatchException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ServerMismatchException extends \Exception
{
public function __construct($message = "", $code = 0, Throwable $previous = null)
public function __construct($message = "", $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Iodev/Whois/Exceptions/WhoisException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class WhoisException extends \Exception
{
public function __construct($message = "", $code = 0, Throwable $previous = null)
public function __construct($message = "", $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Iodev/Whois/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function createPunycode(): IPunycode
* @param ILoader|null $loader
* @return Whois
*/
public function createWhois(ILoader $loader = null): Whois
public function createWhois(?ILoader $loader = null): Whois
{
$whois = new Whois($loader ?: $this->createLoader());
$whois->setFactory($this);
Expand Down Expand Up @@ -84,7 +84,7 @@ public function createTldModule(Whois $ehois): TldModule
* @param TldParser|null $defaultParser
* @return TldServer[]
*/
public function createTldSevers($configs = null, TldParser $defaultParser = null): array
public function createTldSevers($configs = null, ?TldParser $defaultParser = null): array
{
$configs = is_array($configs) ? $configs : Config::load("module.tld.servers");
$defaultParser = $defaultParser ?: $this->createTldParser();
Expand All @@ -100,7 +100,7 @@ public function createTldSevers($configs = null, TldParser $defaultParser = null
* @param TldParser|null $defaultParser
* @return TldServer
*/
public function createTldSever(array $config, TldParser $defaultParser = null): TldServer
public function createTldSever(array $config, ?TldParser $defaultParser = null): TldServer
{
return new TldServer(
$config['zone'] ?? '',
Expand All @@ -116,7 +116,7 @@ public function createTldSever(array $config, TldParser $defaultParser = null):
* @param TldParser|null $defaultParser
* @return TldParser
*/
public function createTldSeverParser(array $config, TldParser $defaultParser = null): TldParser
public function createTldSeverParser(array $config, ?TldParser $defaultParser = null): TldParser
{
$options = $config['parserOptions'] ?? [];
if (isset($config['parserClass'])) {
Expand Down Expand Up @@ -204,7 +204,7 @@ public function getTldParserConfigByType($type)
* @param AsnParser $defaultParser
* @return AsnServer[]
*/
public function createAsnSevers($configs = null, AsnParser $defaultParser = null): array
public function createAsnSevers($configs = null, ?AsnParser $defaultParser = null): array
{
$configs = is_array($configs) ? $configs : Config::load("module.asn.servers");
$defaultParser = $defaultParser ?: $this->createAsnParser();
Expand All @@ -220,7 +220,7 @@ public function createAsnSevers($configs = null, AsnParser $defaultParser = null
* @param AsnParser $defaultParser
* @return AsnServer
*/
public function createAsnSever($config, AsnParser $defaultParser = null)
public function createAsnSever($config, ?AsnParser $defaultParser = null)
{
return new AsnServer(
$config['host'] ?? '',
Expand All @@ -234,7 +234,7 @@ public function createAsnSever($config, AsnParser $defaultParser = null)
* @param AsnParser|null $defaultParser
* @return AsnParser
*/
public function createAsnSeverParser(array $config, AsnParser $defaultParser = null): AsnParser
public function createAsnSeverParser(array $config, ?AsnParser $defaultParser = null): AsnParser
{
if (isset($config['parserClass'])) {
return $this->createAsnParserByClass($config['parserClass']);
Expand Down
2 changes: 1 addition & 1 deletion src/Iodev/Whois/Helpers/TextHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TextHelper
*/
public static function toUtf8($text)
{
$srcEncoding = mb_detect_encoding($text);
$srcEncoding = mb_detect_encoding($text, ['UTF-8', 'ISO-8859-1', 'Windows-1251', 'Windows-1252'], true);
if (!empty($srcEncoding) && strtolower($srcEncoding) !== 'utf-8') {
return mb_convert_encoding($text, 'utf-8', strtolower($srcEncoding));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Iodev/Whois/Modules/Asn/AsnModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function setServers($servers)
* @throws ConnectionException
* @throws WhoisException
*/
public function lookupAsn($asn, AsnServer $server = null)
public function lookupAsn($asn, ?AsnServer $server = null)
{
if ($server) {
return $this->loadResponse($asn, $server);
Expand All @@ -73,7 +73,7 @@ public function lookupAsn($asn, AsnServer $server = null)
* @throws ConnectionException
* @throws WhoisException
*/
public function loadAsnInfo($asn, AsnServer $server = null)
public function loadAsnInfo($asn, ?AsnServer $server = null)
{
if ($server) {
$resp = $this->loadResponse($asn, $server);
Expand Down
4 changes: 2 additions & 2 deletions src/Iodev/Whois/Modules/Tld/TldModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function isDomainAvailable($domain)
* @throws ConnectionException
* @throws WhoisException
*/
public function lookupDomain($domain, TldServer $server = null)
public function lookupDomain($domain, ?TldServer $server = null)
{
$servers = $server ? [$server] : $this->matchServers($domain);
list ($response) = $this->loadDomainData($domain, $servers);
Expand All @@ -131,7 +131,7 @@ public function lookupDomain($domain, TldServer $server = null)
* @throws ConnectionException
* @throws WhoisException
*/
public function loadDomainInfo($domain, TldServer $server = null)
public function loadDomainInfo($domain, ?TldServer $server = null)
{
$servers = $server ? [$server] : $this->matchServers($domain);
list (, $info) = $this->loadDomainData($domain, $servers);
Expand Down
1 change: 1 addition & 0 deletions src/Iodev/Whois/Modules/Tld/TldParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Iodev\Whois\Modules\Tld;

#[\AllowDynamicProperties]
abstract class TldParser
{
use TldParserDeprecated;
Expand Down
4 changes: 2 additions & 2 deletions src/Iodev/Whois/Modules/Tld/TldServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TldServer
* @param TldParser $defaultParser
* @return TldServer
*/
public static function fromData($data, TldParser $defaultParser = null)
public static function fromData($data, ?TldParser $defaultParser = null)
{
return Factory::get()->createTldSever($data, $defaultParser);
}
Expand All @@ -30,7 +30,7 @@ public static function fromData($data, TldParser $defaultParser = null)
* @param TldParser $defaultParser
* @return TldServer[]
*/
public static function fromDataList($dataList, TldParser $defaultParser = null)
public static function fromDataList($dataList, ?TldParser $defaultParser = null)
{
return Factory::get()->createTldSevers($dataList, $defaultParser);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Iodev/Whois/WhoisDeprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait WhoisDeprecated
* @param ILoader $loader
* @return Whois
*/
public static function create(ILoader $loader = null)
public static function create(?ILoader $loader = null)
{
return Factory::get()->createWhois($loader);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Iodev/Whois/Modules/Tld/TldParsingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function testResponseParsing($domain, $srcTextFilename, $expectedJsonFile
);
}

public function getTestData()
public static function getTestData()
{
$resolveKeys = function($list) {
$result = [];
Expand Down