Skip to content

Commit 3cac399

Browse files
committed
Update package configuration
- explicit import of functions and constants - update Unit test to use self:: instead of $this - add PHP7.3 tests in travis configuration - update PHP Code Fixer settings to be more inline with PSR-12
1 parent d2d45d7 commit 3cac399

22 files changed

+379
-246
lines changed

.php_cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ return PhpCsFixer\Config::create()
3434
'no_leading_import_slash' => true,
3535
'no_trailing_comma_in_singleline_array' => true,
3636
'no_unused_imports' => true,
37-
'ordered_imports' => ['imports_order' => null, 'sort_algorithm' => 'alpha'],
37+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
3838
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
3939
'phpdoc_align' => true,
4040
'phpdoc_no_empty_return' => true,

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ matrix:
1010
env: VALIDATE_CODING_STYLE=false RUN_PHPSTAN=false IGNORE_PLATFORMS=false
1111
- php: 7.2
1212
env: VALIDATE_CODING_STYLE=true RUN_PHPSTAN=true IGNORE_PLATFORMS=false
13+
- php: 7.3
14+
env: VALIDATE_CODING_STYLE=false RUN_PHPSTAN=false IGNORE_PLATFORMS=true
1315
- php: nightly
1416
env: VALIDATE_CODING_STYLE=false RUN_PHPSTAN=false IGNORE_PLATFORMS=true
1517
allow_failures:

src/Cache.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,27 @@
2020
use Generator;
2121
use Psr\SimpleCache\CacheInterface;
2222
use Traversable;
23+
use function chmod;
24+
use function dirname;
25+
use function file_exists;
26+
use function file_get_contents;
27+
use function filemtime;
28+
use function get_class;
29+
use function gettype;
30+
use function is_array;
31+
use function is_int;
32+
use function is_object;
33+
use function is_writable;
34+
use function mkdir;
35+
use function realpath;
36+
use function rename;
37+
use function sprintf;
38+
use function time;
39+
use function touch;
40+
use function uniqid;
41+
use function unlink;
42+
use function unserialize;
43+
use const DIRECTORY_SEPARATOR;
2344

2445
/**
2546
* A simple file-based PSR-16 cache implementation.

src/Converter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
use Pdp\Exception\CouldNotLoadRules;
1919
use SplTempFileObject;
20+
use function array_pop;
21+
use function explode;
22+
use function preg_match;
23+
use function strpos;
24+
use function substr;
2025

2126
/**
2227
* Public Suffix List Parser.

src/CurlHttpClient.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515

1616
namespace Pdp;
1717

18+
use function curl_close;
19+
use function curl_errno;
20+
use function curl_error;
21+
use function curl_exec;
22+
use function curl_init;
23+
use function curl_setopt_array;
24+
use const CURLE_OK;
25+
use const CURLOPT_FAILONERROR;
26+
use const CURLOPT_FOLLOWLOCATION;
27+
use const CURLOPT_HTTPGET;
28+
use const CURLOPT_RETURNTRANSFER;
29+
use const CURLOPT_SSL_VERIFYHOST;
30+
use const CURLOPT_SSL_VERIFYPEER;
31+
1832
final class CurlHttpClient implements HttpClient
1933
{
2034
/**

src/Domain.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
use Pdp\Exception\InvalidLabel;
2222
use Pdp\Exception\InvalidLabelKey;
2323
use TypeError;
24+
use function array_count_values;
25+
use function array_keys;
26+
use function array_reverse;
27+
use function array_slice;
28+
use function array_unshift;
29+
use function count;
30+
use function explode;
31+
use function gettype;
32+
use function implode;
33+
use function in_array;
34+
use function ksort;
35+
use function preg_match;
36+
use function sprintf;
37+
use function strlen;
38+
use function strpos;
39+
use function substr;
2440

2541
/**
2642
* Domain Value Object.

src/IDNAConverterTrait.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,36 @@
1717

1818
use Pdp\Exception\InvalidDomain;
1919
use TypeError;
20+
use function array_reverse;
21+
use function explode;
22+
use function gettype;
23+
use function idn_to_ascii;
24+
use function idn_to_utf8;
25+
use function implode;
26+
use function is_scalar;
27+
use function iterator_to_array;
28+
use function method_exists;
29+
use function preg_match;
30+
use function rawurldecode;
31+
use function sprintf;
32+
use function strpos;
33+
use function strtolower;
34+
use const FILTER_FLAG_IPV4;
35+
use const FILTER_VALIDATE_IP;
36+
use const IDNA_ERROR_BIDI;
37+
use const IDNA_ERROR_CONTEXTJ;
38+
use const IDNA_ERROR_DISALLOWED;
39+
use const IDNA_ERROR_DOMAIN_NAME_TOO_LONG;
40+
use const IDNA_ERROR_EMPTY_LABEL;
41+
use const IDNA_ERROR_HYPHEN_3_4;
42+
use const IDNA_ERROR_INVALID_ACE_LABEL;
43+
use const IDNA_ERROR_LABEL_HAS_DOT;
44+
use const IDNA_ERROR_LABEL_TOO_LONG;
45+
use const IDNA_ERROR_LEADING_COMBINING_MARK;
46+
use const IDNA_ERROR_LEADING_HYPHEN;
47+
use const IDNA_ERROR_PUNYCODE;
48+
use const IDNA_ERROR_TRAILING_HYPHEN;
49+
use const INTL_IDNA_VARIANT_UTS46;
2050

2151
/**
2252
* @internal Domain name validator

src/Installer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717

1818
use Composer\Script\Event;
1919
use Throwable;
20+
use function dirname;
21+
use function extension_loaded;
22+
use function fwrite;
23+
use function implode;
24+
use function is_dir;
25+
use const PHP_EOL;
26+
use const STDERR;
27+
use const STDOUT;
2028

2129
/**
2230
* A class to manage PSL ICANN Section rules updates.

src/Manager.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@
2222
use Pdp\Exception\CouldNotLoadTLDs;
2323
use Psr\SimpleCache\CacheInterface;
2424
use TypeError;
25+
use function filter_var;
26+
use function gettype;
27+
use function is_object;
28+
use function is_string;
29+
use function json_decode;
30+
use function json_encode;
31+
use function json_last_error;
32+
use function json_last_error_msg;
33+
use function md5;
34+
use function sprintf;
35+
use function strtolower;
36+
use const DATE_ATOM;
37+
use const FILTER_VALIDATE_INT;
38+
use const JSON_ERROR_NONE;
2539

2640
/**
2741
* Public Suffix List Manager.

src/PublicSuffix.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
use JsonSerializable;
1919
use Pdp\Exception\CouldNotResolvePublicSuffix;
2020
use Pdp\Exception\InvalidDomain;
21+
use function array_keys;
22+
use function array_reverse;
23+
use function count;
24+
use function explode;
25+
use function implode;
26+
use function in_array;
27+
use function reset;
28+
use function sprintf;
2129

2230
/**
2331
* Public Suffix Value Object.
@@ -105,7 +113,7 @@ public function __construct($publicSuffix = null, string $section = '')
105113
*/
106114
private function setPublicSuffix()
107115
{
108-
if (empty($this->labels)) {
116+
if ([] === $this->labels) {
109117
return null;
110118
}
111119

0 commit comments

Comments
 (0)