diff --git a/.drone.jsonnet b/.drone.jsonnet index ab2b93f7..3a3f2b35 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -25,7 +25,6 @@ local composer(phpversion, params) = { local phpunit(phpversion) = { name: "PHPUnit", image: "joomlaprojects/docker-images:php" + phpversion, - [if phpversion == "8.0" then "failure"]: "ignore", commands: ["vendor/bin/phpunit"] }; @@ -110,5 +109,6 @@ local pipeline(name, phpversion, params) = { pipeline("7.2", "7.2", "--prefer-stable"), pipeline("7.3", "7.3", "--prefer-stable"), pipeline("7.4", "7.4", "--prefer-stable"), - pipeline("8.0", "8.0", "--ignore-platform-reqs --prefer-stable") + pipeline("8.0", "8.0", "--prefer-stable"), + pipeline("8.1", "8.1", "--prefer-stable") ] diff --git a/.drone.yml b/.drone.yml index 28826dd5..683bb815 100644 --- a/.drone.yml +++ b/.drone.yml @@ -181,7 +181,7 @@ steps: image: joomlaprojects/docker-images:php8.0 commands: - php -v - - composer update --ignore-platform-reqs --prefer-stable + - composer update --prefer-stable volumes: - name: composer-cache path: /tmp/composer-cache @@ -190,7 +190,34 @@ steps: image: joomlaprojects/docker-images:php8.0 commands: - vendor/bin/phpunit - failure: ignore + +volumes: +- name: composer-cache + host: + path: /tmp/composer-cache + +--- +kind: pipeline +name: PHP 8.1 + +platform: + os: linux + arch: amd64 + +steps: +- name: composer + image: joomlaprojects/docker-images:php8.1 + commands: + - php -v + - composer update --prefer-stable + volumes: + - name: composer-cache + path: /tmp/composer-cache + +- name: PHPUnit + image: joomlaprojects/docker-images:php8.1 + commands: + - vendor/bin/phpunit volumes: - name: composer-cache @@ -199,6 +226,6 @@ volumes: --- kind: signature -hmac: 8382dbf5577f074439bfa6182a30ce231e341f6430dbb23b9b814ea3e552c9c7 +hmac: ef7eaaa4dab03be15f5ca91154f6a0bd0fb572b615feb5de5ab8c800cfe03b0e ... diff --git a/.editorconfig b/.editorconfig index c8bb3e7b..8ba04731 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ # Unix-style newlines with a newline ending every file [*] -indent_style = tab +indent_style = space end_of_line = lf charset = utf-8 trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore index f756138d..9301320f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ composer.phar composer.lock phpunit.xml .phpunit.result.cache +/build/ diff --git a/src/AbstractUri.php b/src/AbstractUri.php index 104cffd1..f43b8896 100644 --- a/src/AbstractUri.php +++ b/src/AbstractUri.php @@ -133,7 +133,7 @@ public function __toString() * * @since 1.0 */ - public function toString(array $parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']) + public function toString($parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']) { $bitmask = 0; @@ -342,7 +342,7 @@ public function isSsl() * @see parse_str() * @since 1.0 */ - protected static function buildQuery(array $params) + protected static function buildQuery($params) { return urldecode(http_build_query($params, '', '&')); } @@ -376,7 +376,7 @@ protected function parse($uri) $retval = ($parts) ? true : false; // We need to replace & with & for parse_str to work right... - if (isset($parts['query']) && strpos($parts['query'], '&')) + if (isset($parts['query']) && strpos($parts['query'], '&') !== false) { $parts['query'] = str_replace('&', '&', $parts['query']); } diff --git a/src/UriHelper.php b/src/UriHelper.php index a33ef839..31adb7df 100644 --- a/src/UriHelper.php +++ b/src/UriHelper.php @@ -30,6 +30,8 @@ class UriHelper */ public static function parse_url($url, $component = -1) { + $result = []; + // If no UTF-8 chars in the url just parse it using php native parse_url which is faster. if (utf8_decode($url) === $url) { diff --git a/src/UriInterface.php b/src/UriInterface.php index 20400ffa..27df41af 100644 --- a/src/UriInterface.php +++ b/src/UriInterface.php @@ -23,7 +23,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const SCHEME = 1; + public const SCHEME = 1; /** * Include the user @@ -31,7 +31,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const USER = 2; + public const USER = 2; /** * Include the password @@ -39,7 +39,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const PASS = 4; + public const PASS = 4; /** * Include the host @@ -47,7 +47,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const HOST = 8; + public const HOST = 8; /** * Include the port @@ -55,7 +55,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const PORT = 16; + public const PORT = 16; /** * Include the path @@ -63,7 +63,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const PATH = 32; + public const PATH = 32; /** * Include the query string @@ -71,7 +71,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const QUERY = 64; + public const QUERY = 64; /** * Include the fragment @@ -79,7 +79,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const FRAGMENT = 128; + public const FRAGMENT = 128; /** * Include all available url parts (scheme, user, pass, host, port, path, query, fragment) @@ -87,7 +87,7 @@ interface UriInterface * @var integer * @since 1.2.0 */ - const ALL = 255; + public const ALL = 255; /** * Magic method to get the string representation of the URI object. @@ -107,7 +107,7 @@ public function __toString(); * * @since 1.0 */ - public function toString(array $parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']); + public function toString($parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']); /** * Checks if variable exists.