Skip to content

Commit

Permalink
Improve Package
Browse files Browse the repository at this point in the history
- Update package dependencies
- Update package settings
- Bug fix Query::build see https://github.com/thephpleague/uri/issues/94
  • Loading branch information
nyamsprod committed Dec 9, 2016
1 parent da9fa4c commit 45b8620
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 25 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

All Notable changes to `League\Uri\Components` will be documented in this file

## Next
## 0.5.0 - 2016-12-09

### Added

Expand All @@ -14,6 +14,10 @@ All Notable changes to `League\Uri\Components` will be documented in this file
- `League\Uri\Components\Host`
- `League\Uri\Components\HierarchicalPath`

- Bug fix `League\Uri\Components\Query::build`

- Update dependencies on `League\Uri\Interfaces`

### Deprecated

- None
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ext-intl" : "*",
"ext-fileinfo": "*",
"jeremykendall/php-domain-parser": "^3.0",
"league/uri-interfaces": "~0.3"
"league/uri-interfaces": "~0.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^1.0",
Expand Down
6 changes: 1 addition & 5 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,18 @@
stopOnFailure="false">

<testsuites>
<testsuite name="Uri Test Suite">
<testsuite name="Uri Components Test Suite">
<directory>test</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">src</directory>
<exclude>
<directory suffix="include.php">src</directory>
</exclude>
</whitelist>
</filter>

<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
Expand Down
18 changes: 7 additions & 11 deletions src/DataPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
*/
namespace League\Uri\Components;

use InvalidArgumentException;
use League\Uri\Components\Traits\PathInfo;
use League\Uri\Interfaces\PathComponent;
use RuntimeException;
use League\Uri\Interfaces\Path as PathInterface;
use SplFileObject;

/**
Expand All @@ -32,7 +30,7 @@
* @since 1.0.0
* @see https://tools.ietf.org/html/rfc3986#section-3.3
*/
class DataPath extends Component implements PathComponent
class DataPath extends Component implements PathInterface
{
use PathInfo;

Expand Down Expand Up @@ -85,7 +83,7 @@ public static function __set_state(array $properties)
*
* @param string $path
*
* @throws RuntimeException If the File is not readable
* @throws Exception If the File is not readable
*
* @return static
*/
Expand Down Expand Up @@ -166,7 +164,7 @@ protected function validate($path)
*
* @param string|null $mimetype
*
* @throws InvalidArgumentException If the mimetype is invalid
* @throws Exception If the mimetype is invalid
*
* @return string
*/
Expand All @@ -188,7 +186,7 @@ protected function filterMimeType($mimetype)
*
* @param string $parameters
*
* @throws InvalidArgumentException If the mediatype parameters contain invalid data
* @throws Exception If the mediatype parameters contain invalid data
*
* @return string[]
*/
Expand Down Expand Up @@ -230,7 +228,7 @@ protected function validateParameter($parameter)
/**
* Validate the path document string representation
*
* @throws InvalidArgumentException If the data is invalid
* @throws Exception If the data is invalid
*/
protected function validateDocument()
{
Expand Down Expand Up @@ -338,8 +336,6 @@ public function getMediaType()
* @param string $path The path to the file where to save the data
* @param string $mode The mode parameter specifies the type of access you require to the stream.
*
* @throws RuntimeException if the path is not reachable
*
* @return SplFileObject
*/
public function save($path, $mode = 'w')
Expand Down Expand Up @@ -407,7 +403,7 @@ public function toAscii()
*
* @param string $parameters The mediatype parameters to use with the new instance.
*
* @throws InvalidArgumentException for invalid query strings.
* @throws Exception for invalid query strings.
*
* @return static A new instance with the specified mediatype parameters.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/HierarchicalPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Countable;
use IteratorAggregate;
use League\Uri\Components\Traits\PathInfo;
use League\Uri\Interfaces\PathComponent;
use League\Uri\Interfaces\Path as PathInterface;
use Traversable;

/**
Expand All @@ -26,7 +26,7 @@
* @author Ignace Nyamagana Butera <[email protected]>
* @since 1.0.0
*/
class HierarchicalPath extends HierarchicalComponent implements PathComponent, Countable, IteratorAggregate
class HierarchicalPath extends HierarchicalComponent implements PathInterface, Countable, IteratorAggregate
{
use PathInfo;

Expand Down
4 changes: 2 additions & 2 deletions src/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace League\Uri\Components;

use League\Uri\Components\Traits\PathInfo;
use League\Uri\Interfaces\PathComponent;
use League\Uri\Interfaces\Path as PathInterface;

/**
* Value object representing a URI path component.
Expand All @@ -23,7 +23,7 @@
* @author Ignace Nyamagana Butera <[email protected]>
* @since 1.0.0
*/
class Path extends Component implements PathComponent
class Path extends Component implements PathInterface
{
use PathInfo;

Expand Down
4 changes: 2 additions & 2 deletions src/Traits/ImmutableCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function without(array $offsets)
*
* @param array $data
*
* @return static
* @return $this
*/
abstract protected function newCollectionInstance(array $data);

Expand Down Expand Up @@ -141,7 +141,7 @@ public function filter(callable $callable, $flag = 0)
/**
* Validate an Iterator or an array
*
* @param iterable $data
* @param Traversable|array $data
*
* @throws InvalidArgumentException if the value can not be converted
*
Expand Down
5 changes: 4 additions & 1 deletion src/Traits/ImmutableComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ protected static function encode($str, $regexp)
};

$res = preg_replace_callback($regexp, $encoder, $str);
if (null !== $res) {
return $res;
}

return $res;
return rawurlencode($str);
}

/**
Expand Down
8 changes: 8 additions & 0 deletions test/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,14 @@ public function buildProvider()
];
}

public function testBuildWithMalformedUtf8Chars()
{
$this->assertSame(
'badutf8=%A0TM1TMS061114IP1',
Query::build(['badutf8' => rawurldecode('%A0TM1TMS061114IP1')])
);
}

public function testThrowsExceptionOnInvalidEncodingType()
{
$this->expectException(Exception::class);
Expand Down

0 comments on commit 45b8620

Please sign in to comment.