-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR was merged into the 2.0-dev branch. labels: bc-break Discussion ---------- | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT Remove support for old PHP versions and modernize the code base. This will be a 2.0 release. Commits ------- 011995f Remove deprecated code 33cf832 Add a Code-of-conduct 6a155be Modernize the code base f98977c Update branch-alias
- Loading branch information
Showing
16 changed files
with
102 additions
and
292 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/phpunit.xml | ||
/composer.lock | ||
*.phar | ||
/vendor/ | ||
.php_cs.cache |
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 |
---|---|---|
@@ -1,19 +1,48 @@ | ||
<?php | ||
|
||
return Symfony\CS\Config\Config::create() | ||
->setUsingLinter(false) | ||
// use SYMFONY_LEVEL: | ||
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) | ||
// and extra fixers: | ||
->fixers(array( | ||
'ordered_use', | ||
//'strict', | ||
'strict_param', | ||
'-psr0' | ||
)) | ||
->finder( | ||
Symfony\CS\Finder\DefaultFinder::create() | ||
->exclude(array('bin', 'spec')) | ||
->in(__DIR__) | ||
$header = <<<EOF | ||
This file is part of the Rollerworks UriEncoder package. | ||
(c) Sebastiaan Stok <[email protected]> | ||
This source file is subject to the MIT license that is bundled | ||
with this source code in the file LICENSE. | ||
EOF; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'@PHP70Migration' => true, | ||
'@PHP71Migration' => true, | ||
'array_syntax' => array('syntax' => 'short'), | ||
'combine_consecutive_unsets' => true, | ||
'declare_strict_types' => true, | ||
'header_comment' => ['header' => $header], | ||
'heredoc_to_nowdoc' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'no_extra_consecutive_blank_lines' => ['continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'], | ||
'no_short_echo_tag' => true, | ||
'no_unreachable_default_argument_value' => false, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'ordered_class_elements' => false, | ||
'ordered_imports' => true, | ||
'phpdoc_add_missing_param_annotation' => false, | ||
'phpdoc_annotation_without_dot' => true, | ||
'phpdoc_no_empty_return' => false, // PHP 7 compatibility | ||
'phpdoc_order' => true, | ||
// This breaks for variable @var blocks | ||
'phpdoc_to_comment' => false, | ||
'phpdoc_var_without_name' => false, | ||
'semicolon_after_instruction' => true, | ||
'single_import_per_statement' => false, | ||
'strict_comparison' => false, | ||
'strict_param' => true, | ||
]) | ||
->setRiskyAllowed(true) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in([__DIR__.'/src', __DIR__.'/spec']) | ||
) | ||
; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
This project's code-of-conduct can be found at https://github.com/rollerworks/contributing/blob/master/CODE_OF_CONDUCT.md |
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
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Rollerworks UriEncoder Component package. | ||
* This file is part of the Rollerworks UriEncoder package. | ||
* | ||
* (c) Sebastiaan Stok <[email protected]> | ||
* | ||
|
@@ -13,7 +15,7 @@ | |
|
||
use PhpSpec\ObjectBehavior; | ||
|
||
class Base64UriEncoderSpec extends ObjectBehavior | ||
final class Base64UriEncoderSpec extends ObjectBehavior | ||
{ | ||
public function it_is_initializable() | ||
{ | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Rollerworks UriEncoder Component package. | ||
* This file is part of the Rollerworks UriEncoder package. | ||
* | ||
* (c) Sebastiaan Stok <[email protected]> | ||
* | ||
|
@@ -15,7 +17,7 @@ | |
use Prophecy\Argument; | ||
use Rollerworks\Component\UriEncoder\UriEncoderInterface; | ||
|
||
class GZipCompressionDecoratorSpec extends ObjectBehavior | ||
final class GZipCompressionDecoratorSpec extends ObjectBehavior | ||
{ | ||
public function let(UriEncoderInterface $encoder) | ||
{ | ||
|
@@ -25,7 +27,7 @@ public function let(UriEncoderInterface $encoder) | |
}); | ||
|
||
$encoder->decodeUri(Argument::any())->will(function ($data) { | ||
return base64_decode($data[0]); | ||
return base64_decode($data[0], true); | ||
}); | ||
|
||
$this->beConstructedWith($encoder); | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Rollerworks UriEncoder Component package. | ||
* This file is part of the Rollerworks UriEncoder package. | ||
* | ||
* (c) Sebastiaan Stok <[email protected]> | ||
* | ||
|
@@ -20,26 +22,25 @@ | |
* | ||
* @author Sebastiaan Stok <[email protected]> | ||
*/ | ||
class Base64UriEncoder implements UriEncoderInterface | ||
final class Base64UriEncoder implements UriEncoderInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function encodeUri($data) | ||
public function encodeUri(string $data): string | ||
{ | ||
return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function decodeUri($data) | ||
public function decodeUri(string $data): ?string | ||
{ | ||
$result = @base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT), true); | ||
if (false !== $result) { | ||
return $result; | ||
try { | ||
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT), true) ?? null; | ||
} catch (\Throwable $e) { | ||
return null; | ||
} | ||
|
||
return; | ||
} | ||
} |
Oops, something went wrong.