-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #198 Add support for PHP 8 (pamil)
This PR was merged into the 1.0-dev branch. Discussion ---------- Related to Sylius/Sylius#12298. Commits ------- 5748c0c Add support for PHP 8
- Loading branch information
Showing
23 changed files
with
555 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,24 +13,33 @@ jobs: | |
tests: | ||
runs-on: ubuntu-latest | ||
|
||
name: "PHP ${{ matrix.php }}, MySQL ${{ matrix.mysql }}, Sylius ${{ matrix.sylius }}" | ||
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, Sylius ${{ matrix.sylius }}, MySQL ${{ matrix.mysql }}" | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [7.4, 7.3] | ||
node: [10.x] | ||
mysql: [5.7, 8.0] | ||
symfony: [^4.4, ^5.2] | ||
sylius: [~1.8.0, ~1.9.0] | ||
php: ["8.0", "7.4", "7.3"] | ||
node: ["10.x"] | ||
mysql: ["5.7", "8.0"] | ||
symfony: ["^4.4", "^5.2"] | ||
sylius: ["~1.8.0", "~1.9.0", "~1.10@dev"] | ||
|
||
exclude: | ||
- | ||
php: 7.3 | ||
mysql: 8.0 | ||
php: "7.3" | ||
mysql: "8.0" | ||
- | ||
sylius: ~1.8.0 | ||
symfony: ^5.2 | ||
sylius: "~1.8.0" | ||
symfony: "^5.2" | ||
- | ||
php: "7.3" | ||
sylius: "~1.10@dev" | ||
- | ||
php: "8.0" | ||
sylius: "~1.8.0" | ||
- | ||
php: "8.0" | ||
sylius: "~1.9.0" | ||
env: | ||
APP_ENV: test | ||
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}" | ||
|
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 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer; | ||
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Symplify\EasyCodingStandard\ValueObject\Option; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php'); | ||
|
||
$containerConfigurator->parameters()->set(Option::SKIP, [ | ||
VisibilityRequiredFixer::class => ['*Spec.php'], | ||
InlineDocCommentDeclarationSniff::class . '.MissingVariable', | ||
]); | ||
}; |
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
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,84 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\PayPalPlugin; | ||
|
||
/** | ||
* Code copied from https://github.com/Nyholm/append_query_string. | ||
*/ | ||
final class UrlUtils | ||
{ | ||
public const APPEND_QUERY_STRING_IGNORE_DUPLICATE = 0; | ||
|
||
public const APPEND_QUERY_STRING_REPLACE_DUPLICATE = 1; | ||
|
||
public const APPEND_QUERY_STRING_SKIP_DUPLICATE = 2; | ||
|
||
private function __construct() | ||
{ | ||
} | ||
|
||
/** | ||
* Add a query string to an existing URL. | ||
* | ||
* @param string $url The base URL. Example "https://nyholm.tech?biz=1" | ||
* @param string $queryString A string like "foo=bar&baz=2" | ||
* @param int $mode How to handle duplicate keys. See predefined constants above. | ||
* | ||
* @return string the resulting string | ||
*/ | ||
public static function appendQueryString(string $url, string $queryString, int $mode = APPEND_QUERY_STRING_IGNORE_DUPLICATE): string | ||
{ | ||
if ('' === $queryString) { | ||
return $url; | ||
} | ||
|
||
$existing = parse_url($url, \PHP_URL_QUERY); | ||
$fragment = parse_url($url, \PHP_URL_FRAGMENT); | ||
$fragment = $fragment ? '#' . $fragment : ''; | ||
|
||
// Remove fragment | ||
if (false !== strrpos($url, '#')) { | ||
$url = substr($url, 0, strrpos($url, '#')); | ||
} | ||
|
||
// If no existing query string | ||
if (empty($existing)) { | ||
// Check for "?" at the last character in $url | ||
$questionMark = '?'; | ||
if ('?' === $url[strlen($url) - 1]) { | ||
$questionMark = ''; | ||
} | ||
|
||
return $url . $questionMark . $queryString . $fragment; | ||
} | ||
|
||
// Remove query string from URL | ||
$result = substr($url, 0, strrpos($url, $existing) ?: 0); | ||
|
||
if (self::APPEND_QUERY_STRING_IGNORE_DUPLICATE === $mode) { | ||
$result .= $existing . '&' . $queryString; | ||
} else { | ||
preg_match_all('#([^&=]+)(=[^&]+)?#si', $existing, $existingArray); | ||
preg_match_all('#([^&=]+)(=[^&]+)?#si', $queryString, $queryStringArray); | ||
if (self::APPEND_QUERY_STRING_REPLACE_DUPLICATE === $mode) { | ||
$intersect = array_intersect($existingArray[1], $queryStringArray[1]); | ||
$keyMap = array_flip($queryStringArray[1]); | ||
foreach ($intersect as $key => $paramName) { | ||
$existing = str_replace($existingArray[0][$key], $queryStringArray[0][$keyMap[$paramName]], $existing); | ||
$queryString = str_replace($queryStringArray[0][$keyMap[$paramName]], '', $queryString); | ||
} | ||
} elseif (self::APPEND_QUERY_STRING_SKIP_DUPLICATE === $mode) { | ||
$intersect = array_intersect($queryStringArray[1], $existingArray[1]); | ||
foreach ($intersect as $key => $paramName) { | ||
$queryString = str_replace($queryStringArray[0][$key], '', $queryString); | ||
} | ||
} | ||
$result .= trim((string) preg_replace('#&&+#i', '&', $existing . '&' . $queryString), '&'); | ||
} | ||
|
||
// add fragment | ||
return $result . $fragment; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
return [ | ||
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true], | ||
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true], | ||
]; |
Oops, something went wrong.