mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
Updating Symfony lib and dependencies: forgot a few files + composer.lock
This commit is contained in:
21
lib/symfony/console/Tests/Fixtures/FooHiddenCommand.php
Normal file
21
lib/symfony/console/Tests/Fixtures/FooHiddenCommand.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class FooHiddenCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('foo:hidden')
|
||||
->setAliases(['afoohidden'])
|
||||
->setHidden(true)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
}
|
||||
}
|
||||
82
lib/symfony/framework-bundle/Test/ForwardCompatTestTrait.php
Normal file
82
lib/symfony/framework-bundle/Test/ForwardCompatTestTrait.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Test;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods
|
||||
|
||||
if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
|
||||
eval('
|
||||
namespace Symfony\Bundle\FrameworkBundle\Test;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
trait ForwardCompatTestTrait
|
||||
{
|
||||
private function doSetUp(): void
|
||||
{
|
||||
}
|
||||
|
||||
private function doTearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->doSetUp();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->doTearDown();
|
||||
}
|
||||
}
|
||||
');
|
||||
} else {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
trait ForwardCompatTestTrait
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function doSetUp()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function doTearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->doSetUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->doTearDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest: ~
|
||||
@@ -0,0 +1 @@
|
||||
AClassThatDoesNotExist_FWB_CacheWarmer_ValidatorCacheWarmerTest: ~
|
||||
BIN
lib/symfony/http-foundation/Tests/File/Fixtures/-test
Normal file
BIN
lib/symfony/http-foundation/Tests/File/Fixtures/-test
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 B |
19
lib/symfony/polyfill-php56/LICENSE
Normal file
19
lib/symfony/polyfill-php56/LICENSE
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
138
lib/symfony/polyfill-php56/Php56.php
Normal file
138
lib/symfony/polyfill-php56/Php56.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Php56;
|
||||
|
||||
use Symfony\Polyfill\Util\Binary;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Php56
|
||||
{
|
||||
const LDAP_ESCAPE_FILTER = 1;
|
||||
const LDAP_ESCAPE_DN = 2;
|
||||
|
||||
public static function hash_equals($knownString, $userInput)
|
||||
{
|
||||
if (!\is_string($knownString)) {
|
||||
trigger_error('Expected known_string to be a string, '.\gettype($knownString).' given', E_USER_WARNING);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!\is_string($userInput)) {
|
||||
trigger_error('Expected user_input to be a string, '.\gettype($userInput).' given', E_USER_WARNING);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$knownLen = Binary::strlen($knownString);
|
||||
$userLen = Binary::strlen($userInput);
|
||||
|
||||
if ($knownLen !== $userLen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = 0;
|
||||
|
||||
for ($i = 0; $i < $knownLen; ++$i) {
|
||||
$result |= \ord($knownString[$i]) ^ \ord($userInput[$i]);
|
||||
}
|
||||
|
||||
return 0 === $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stub implementation of the {@link ldap_escape()} function of the ldap
|
||||
* extension.
|
||||
*
|
||||
* Escape strings for safe use in LDAP filters and DNs.
|
||||
*
|
||||
* @author Chris Wright <ldapi@daverandom.com>
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string $ignore
|
||||
* @param int $flags
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @see http://stackoverflow.com/a/8561604
|
||||
*/
|
||||
public static function ldap_escape($subject, $ignore = '', $flags = 0)
|
||||
{
|
||||
static $charMaps = null;
|
||||
|
||||
if (null === $charMaps) {
|
||||
$charMaps = array(
|
||||
self::LDAP_ESCAPE_FILTER => array('\\', '*', '(', ')', "\x00"),
|
||||
self::LDAP_ESCAPE_DN => array('\\', ',', '=', '+', '<', '>', ';', '"', '#', "\r"),
|
||||
);
|
||||
|
||||
$charMaps[0] = array();
|
||||
|
||||
for ($i = 0; $i < 256; ++$i) {
|
||||
$charMaps[0][\chr($i)] = sprintf('\\%02x', $i);
|
||||
}
|
||||
|
||||
for ($i = 0, $l = \count($charMaps[self::LDAP_ESCAPE_FILTER]); $i < $l; ++$i) {
|
||||
$chr = $charMaps[self::LDAP_ESCAPE_FILTER][$i];
|
||||
unset($charMaps[self::LDAP_ESCAPE_FILTER][$i]);
|
||||
$charMaps[self::LDAP_ESCAPE_FILTER][$chr] = $charMaps[0][$chr];
|
||||
}
|
||||
|
||||
for ($i = 0, $l = \count($charMaps[self::LDAP_ESCAPE_DN]); $i < $l; ++$i) {
|
||||
$chr = $charMaps[self::LDAP_ESCAPE_DN][$i];
|
||||
unset($charMaps[self::LDAP_ESCAPE_DN][$i]);
|
||||
$charMaps[self::LDAP_ESCAPE_DN][$chr] = $charMaps[0][$chr];
|
||||
}
|
||||
}
|
||||
|
||||
// Create the base char map to escape
|
||||
$flags = (int) $flags;
|
||||
$charMap = array();
|
||||
|
||||
if ($flags & self::LDAP_ESCAPE_FILTER) {
|
||||
$charMap += $charMaps[self::LDAP_ESCAPE_FILTER];
|
||||
}
|
||||
|
||||
if ($flags & self::LDAP_ESCAPE_DN) {
|
||||
$charMap += $charMaps[self::LDAP_ESCAPE_DN];
|
||||
}
|
||||
|
||||
if (!$charMap) {
|
||||
$charMap = $charMaps[0];
|
||||
}
|
||||
|
||||
// Remove any chars to ignore from the list
|
||||
$ignore = (string) $ignore;
|
||||
|
||||
for ($i = 0, $l = \strlen($ignore); $i < $l; ++$i) {
|
||||
unset($charMap[$ignore[$i]]);
|
||||
}
|
||||
|
||||
// Do the main replacement
|
||||
$result = strtr($subject, $charMap);
|
||||
|
||||
// Encode leading/trailing spaces if self::LDAP_ESCAPE_DN is passed
|
||||
if ($flags & self::LDAP_ESCAPE_DN) {
|
||||
if (' ' === $result[0]) {
|
||||
$result = '\\20'.substr($result, 1);
|
||||
}
|
||||
|
||||
if (' ' === $result[\strlen($result) - 1]) {
|
||||
$result = substr($result, 0, -1).'\\20';
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
15
lib/symfony/polyfill-php56/README.md
Normal file
15
lib/symfony/polyfill-php56/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
Symfony Polyfill / Php56
|
||||
========================
|
||||
|
||||
This component provides functions unavailable in releases prior to PHP 5.6:
|
||||
|
||||
- [`hash_equals`](http://php.net/hash_equals) (part of [hash](http://php.net/hash) extension)
|
||||
- [`ldap_escape`](http://php.net/ldap_escape) (part of [ldap](http://php.net/ldap) extension)
|
||||
|
||||
More information can be found in the
|
||||
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This library is released under the [MIT license](LICENSE).
|
||||
38
lib/symfony/polyfill-php56/bootstrap.php
Normal file
38
lib/symfony/polyfill-php56/bootstrap.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Polyfill\Php56 as p;
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
if (!function_exists('hash_equals')) {
|
||||
function hash_equals($knownString, $userInput) { return p\Php56::hash_equals($knownString, $userInput); }
|
||||
}
|
||||
if (extension_loaded('ldap') && !function_exists('ldap_escape')) {
|
||||
define('LDAP_ESCAPE_FILTER', 1);
|
||||
define('LDAP_ESCAPE_DN', 2);
|
||||
|
||||
function ldap_escape($subject, $ignore = '', $flags = 0) { return p\Php56::ldap_escape($subject, $ignore, $flags); }
|
||||
}
|
||||
|
||||
if (50509 === PHP_VERSION_ID && 4 === PHP_INT_SIZE) {
|
||||
// Missing functions in PHP 5.5.9 - affects 32 bit builds of Ubuntu 14.04LTS
|
||||
// See https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1315888
|
||||
if (!function_exists('gzopen') && function_exists('gzopen64')) {
|
||||
function gzopen($filename, $mode, $use_include_path = 0) { return gzopen64($filename, $mode, $use_include_path); }
|
||||
}
|
||||
if (!function_exists('gzseek') && function_exists('gzseek64')) {
|
||||
function gzseek($zp, $offset, $whence = SEEK_SET) { return gzseek64($zp, $offset, $whence); }
|
||||
}
|
||||
if (!function_exists('gztell') && function_exists('gztell64')) {
|
||||
function gztell($zp) { return gztell64($zp); }
|
||||
}
|
||||
}
|
||||
}
|
||||
32
lib/symfony/polyfill-php56/composer.json
Normal file
32
lib/symfony/polyfill-php56/composer.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "symfony/polyfill-php56",
|
||||
"type": "library",
|
||||
"description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions",
|
||||
"keywords": ["polyfill", "shim", "compatibility", "portable"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/polyfill-util": "~1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Polyfill\\Php56\\": "" },
|
||||
"files": [ "bootstrap.php" ]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.12-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
22
lib/symfony/polyfill-util/Binary.php
Normal file
22
lib/symfony/polyfill-util/Binary.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Util;
|
||||
|
||||
if (\extension_loaded('mbstring')) {
|
||||
class Binary extends BinaryOnFuncOverload
|
||||
{
|
||||
}
|
||||
} else {
|
||||
class Binary extends BinaryNoFuncOverload
|
||||
{
|
||||
}
|
||||
}
|
||||
65
lib/symfony/polyfill-util/BinaryNoFuncOverload.php
Normal file
65
lib/symfony/polyfill-util/BinaryNoFuncOverload.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Util;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class BinaryNoFuncOverload
|
||||
{
|
||||
public static function strlen($s)
|
||||
{
|
||||
return \strlen($s);
|
||||
}
|
||||
|
||||
public static function strpos($haystack, $needle, $offset = 0)
|
||||
{
|
||||
return strpos($haystack, $needle, $offset);
|
||||
}
|
||||
|
||||
public static function strrpos($haystack, $needle, $offset = 0)
|
||||
{
|
||||
return strrpos($haystack, $needle, $offset);
|
||||
}
|
||||
|
||||
public static function substr($string, $start, $length = PHP_INT_MAX)
|
||||
{
|
||||
return substr($string, $start, $length);
|
||||
}
|
||||
|
||||
public static function stripos($s, $needle, $offset = 0)
|
||||
{
|
||||
return stripos($s, $needle, $offset);
|
||||
}
|
||||
|
||||
public static function stristr($s, $needle, $part = false)
|
||||
{
|
||||
return stristr($s, $needle, $part);
|
||||
}
|
||||
|
||||
public static function strrchr($s, $needle, $part = false)
|
||||
{
|
||||
return strrchr($s, $needle, $part);
|
||||
}
|
||||
|
||||
public static function strripos($s, $needle, $offset = 0)
|
||||
{
|
||||
return strripos($s, $needle, $offset);
|
||||
}
|
||||
|
||||
public static function strstr($s, $needle, $part = false)
|
||||
{
|
||||
return strstr($s, $needle, $part);
|
||||
}
|
||||
}
|
||||
67
lib/symfony/polyfill-util/BinaryOnFuncOverload.php
Normal file
67
lib/symfony/polyfill-util/BinaryOnFuncOverload.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Util;
|
||||
|
||||
/**
|
||||
* Binary safe version of string functions overloaded when MB_OVERLOAD_STRING is enabled.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class BinaryOnFuncOverload
|
||||
{
|
||||
public static function strlen($s)
|
||||
{
|
||||
return mb_strlen($s, '8bit');
|
||||
}
|
||||
|
||||
public static function strpos($haystack, $needle, $offset = 0)
|
||||
{
|
||||
return mb_strpos($haystack, $needle, $offset, '8bit');
|
||||
}
|
||||
|
||||
public static function strrpos($haystack, $needle, $offset = 0)
|
||||
{
|
||||
return mb_strrpos($haystack, $needle, $offset, '8bit');
|
||||
}
|
||||
|
||||
public static function substr($string, $start, $length = 2147483647)
|
||||
{
|
||||
return mb_substr($string, $start, $length, '8bit');
|
||||
}
|
||||
|
||||
public static function stripos($s, $needle, $offset = 0)
|
||||
{
|
||||
return mb_stripos($s, $needle, $offset, '8bit');
|
||||
}
|
||||
|
||||
public static function stristr($s, $needle, $part = false)
|
||||
{
|
||||
return mb_stristr($s, $needle, $part, '8bit');
|
||||
}
|
||||
|
||||
public static function strrchr($s, $needle, $part = false)
|
||||
{
|
||||
return mb_strrchr($s, $needle, $part, '8bit');
|
||||
}
|
||||
|
||||
public static function strripos($s, $needle, $offset = 0)
|
||||
{
|
||||
return mb_strripos($s, $needle, $offset, '8bit');
|
||||
}
|
||||
|
||||
public static function strstr($s, $needle, $part = false)
|
||||
{
|
||||
return mb_strstr($s, $needle, $part, '8bit');
|
||||
}
|
||||
}
|
||||
19
lib/symfony/polyfill-util/LICENSE
Normal file
19
lib/symfony/polyfill-util/LICENSE
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015-2019 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
13
lib/symfony/polyfill-util/README.md
Normal file
13
lib/symfony/polyfill-util/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
Symfony Polyfill / Util
|
||||
=======================
|
||||
|
||||
This component provides binary-safe string functions, using the
|
||||
[mbstring](https://php.net/mbstring) extension when available.
|
||||
|
||||
More information can be found in the
|
||||
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This library is released under the [MIT license](LICENSE).
|
||||
28
lib/symfony/polyfill-util/TestListener.php
Normal file
28
lib/symfony/polyfill-util/TestListener.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Util;
|
||||
|
||||
if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
|
||||
class_alias('Symfony\Polyfill\Util\TestListenerForV5', 'Symfony\Polyfill\Util\TestListener');
|
||||
// Using an early return instead of a else does not work when using the PHPUnit phar due to some weird PHP behavior (the class
|
||||
// gets defined without executing the code before it and so the definition is not properly conditional)
|
||||
} elseif (version_compare(\PHPUnit\Runner\Version::id(), '7.0.0', '<')) {
|
||||
class_alias('Symfony\Polyfill\Util\TestListenerForV6', 'Symfony\Polyfill\Util\TestListener');
|
||||
} else {
|
||||
class_alias('Symfony\Polyfill\Util\TestListenerForV7', 'Symfony\Polyfill\Util\TestListener');
|
||||
}
|
||||
|
||||
if (false) {
|
||||
class TestListener
|
||||
{
|
||||
}
|
||||
}
|
||||
89
lib/symfony/polyfill-util/TestListenerForV5.php
Normal file
89
lib/symfony/polyfill-util/TestListenerForV5.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Util;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class TestListenerForV5 extends \PHPUnit_Framework_TestSuite implements \PHPUnit_Framework_TestListener
|
||||
{
|
||||
private $suite;
|
||||
private $trait;
|
||||
|
||||
public function __construct(\PHPUnit_Framework_TestSuite $suite = null)
|
||||
{
|
||||
if ($suite) {
|
||||
$this->suite = $suite;
|
||||
$this->setName($suite->getName().' with polyfills enabled');
|
||||
$this->addTest($suite);
|
||||
}
|
||||
$this->trait = new TestListenerTrait();
|
||||
}
|
||||
|
||||
public function startTestSuite(\PHPUnit_Framework_TestSuite $suite)
|
||||
{
|
||||
$this->trait->startTestSuite($suite);
|
||||
}
|
||||
|
||||
public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time)
|
||||
{
|
||||
$this->trait->addError($test, $e, $time);
|
||||
}
|
||||
|
||||
public function addWarning(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_Warning $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
|
||||
{
|
||||
$this->trait->addError($test, $e, $time);
|
||||
}
|
||||
|
||||
public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRiskyTest(\PHPUnit_Framework_Test $test, \Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function endTestSuite(\PHPUnit_Framework_TestSuite $suite)
|
||||
{
|
||||
}
|
||||
|
||||
public function startTest(\PHPUnit_Framework_Test $test)
|
||||
{
|
||||
}
|
||||
|
||||
public function endTest(\PHPUnit_Framework_Test $test, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public static function warning($message)
|
||||
{
|
||||
return parent::warning($message);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
TestListenerTrait::$enabledPolyfills = $this->suite->getName();
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
TestListenerTrait::$enabledPolyfills = false;
|
||||
}
|
||||
}
|
||||
95
lib/symfony/polyfill-util/TestListenerForV6.php
Normal file
95
lib/symfony/polyfill-util/TestListenerForV6.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Util;
|
||||
|
||||
use PHPUnit\Framework\AssertionFailedError;
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Framework\TestListener as TestListenerInterface;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use PHPUnit\Framework\Warning;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class TestListenerForV6 extends TestSuite implements TestListenerInterface
|
||||
{
|
||||
private $suite;
|
||||
private $trait;
|
||||
|
||||
public function __construct(TestSuite $suite = null)
|
||||
{
|
||||
if ($suite) {
|
||||
$this->suite = $suite;
|
||||
$this->setName($suite->getName().' with polyfills enabled');
|
||||
$this->addTest($suite);
|
||||
}
|
||||
$this->trait = new TestListenerTrait();
|
||||
}
|
||||
|
||||
public function startTestSuite(TestSuite $suite)
|
||||
{
|
||||
$this->trait->startTestSuite($suite);
|
||||
}
|
||||
|
||||
public function addError(Test $test, \Exception $e, $time)
|
||||
{
|
||||
$this->trait->addError($test, $e, $time);
|
||||
}
|
||||
|
||||
public function addWarning(Test $test, Warning $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addFailure(Test $test, AssertionFailedError $e, $time)
|
||||
{
|
||||
$this->trait->addError($test, $e, $time);
|
||||
}
|
||||
|
||||
public function addIncompleteTest(Test $test, \Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addRiskyTest(Test $test, \Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function addSkippedTest(Test $test, \Exception $e, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public function endTestSuite(TestSuite $suite)
|
||||
{
|
||||
}
|
||||
|
||||
public function startTest(Test $test)
|
||||
{
|
||||
}
|
||||
|
||||
public function endTest(Test $test, $time)
|
||||
{
|
||||
}
|
||||
|
||||
public static function warning($message)
|
||||
{
|
||||
return parent::warning($message);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
TestListenerTrait::$enabledPolyfills = $this->suite->getName();
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
TestListenerTrait::$enabledPolyfills = false;
|
||||
}
|
||||
}
|
||||
96
lib/symfony/polyfill-util/TestListenerForV7.php
Normal file
96
lib/symfony/polyfill-util/TestListenerForV7.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Util;
|
||||
|
||||
use PHPUnit\Framework\AssertionFailedError;
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Framework\TestListener as TestListenerInterface;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use PHPUnit\Framework\Warning;
|
||||
use PHPUnit\Framework\WarningTestCase;
|
||||
|
||||
/**
|
||||
* @author Ion Bazan <ion.bazan@gmail.com>
|
||||
*/
|
||||
class TestListenerForV7 extends TestSuite implements TestListenerInterface
|
||||
{
|
||||
private $suite;
|
||||
private $trait;
|
||||
|
||||
public function __construct(TestSuite $suite = null)
|
||||
{
|
||||
if ($suite) {
|
||||
$this->suite = $suite;
|
||||
$this->setName($suite->getName().' with polyfills enabled');
|
||||
$this->addTest($suite);
|
||||
}
|
||||
$this->trait = new TestListenerTrait();
|
||||
}
|
||||
|
||||
public function startTestSuite(TestSuite $suite): void
|
||||
{
|
||||
$this->trait->startTestSuite($suite);
|
||||
}
|
||||
|
||||
public function addError(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->trait->addError($test, $t, $time);
|
||||
}
|
||||
|
||||
public function addWarning(Test $test, Warning $e, float $time): void
|
||||
{
|
||||
}
|
||||
|
||||
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
|
||||
{
|
||||
$this->trait->addError($test, $e, $time);
|
||||
}
|
||||
|
||||
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
}
|
||||
|
||||
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
}
|
||||
|
||||
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
}
|
||||
|
||||
public function endTestSuite(TestSuite $suite): void
|
||||
{
|
||||
}
|
||||
|
||||
public function startTest(Test $test): void
|
||||
{
|
||||
}
|
||||
|
||||
public function endTest(Test $test, float $time): void
|
||||
{
|
||||
}
|
||||
|
||||
public static function warning($message): WarningTestCase
|
||||
{
|
||||
return parent::warning($message);
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
TestListenerTrait::$enabledPolyfills = $this->suite->getName();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
TestListenerTrait::$enabledPolyfills = false;
|
||||
}
|
||||
}
|
||||
125
lib/symfony/polyfill-util/TestListenerTrait.php
Normal file
125
lib/symfony/polyfill-util/TestListenerTrait.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Polyfill\Util;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class TestListenerTrait
|
||||
{
|
||||
public static $enabledPolyfills;
|
||||
|
||||
public function startTestSuite($mainSuite)
|
||||
{
|
||||
if (null !== self::$enabledPolyfills) {
|
||||
return;
|
||||
}
|
||||
self::$enabledPolyfills = false;
|
||||
$SkippedTestError = class_exists('PHPUnit\Framework\SkippedTestError') ? 'PHPUnit\Framework\SkippedTestError' : 'PHPUnit_Framework_SkippedTestError';
|
||||
|
||||
foreach ($mainSuite->tests() as $suite) {
|
||||
$testClass = $suite->getName();
|
||||
if (!$tests = $suite->tests()) {
|
||||
continue;
|
||||
}
|
||||
if (!preg_match('/^(.+)\\\\Tests(\\\\.*)Test$/', $testClass, $m)) {
|
||||
$mainSuite->addTest(TestListener::warning('Unknown naming convention for '.$testClass));
|
||||
continue;
|
||||
}
|
||||
if (!class_exists($m[1].$m[2])) {
|
||||
continue;
|
||||
}
|
||||
$testedClass = new \ReflectionClass($m[1].$m[2]);
|
||||
$bootstrap = new \SplFileObject(\dirname($testedClass->getFileName()).'/bootstrap.php');
|
||||
$warnings = array();
|
||||
$defLine = null;
|
||||
|
||||
foreach (new \RegexIterator($bootstrap, '/define\(\'/') as $defLine) {
|
||||
preg_match('/define\(\'(?P<name>.+)\'/', $defLine, $matches);
|
||||
if (\defined($matches['name'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
eval($defLine);
|
||||
} catch (\PHPUnit_Framework_Exception $ex){
|
||||
$warnings[] = TestListener::warning($ex->getMessage());
|
||||
} catch (\PHPUnit\Framework\Exception $ex) {
|
||||
$warnings[] = TestListener::warning($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$bootstrap->rewind();
|
||||
|
||||
foreach (new \RegexIterator($bootstrap, '/return p\\\\'.$testedClass->getShortName().'::/') as $defLine) {
|
||||
if (!preg_match('/^\s*function (?P<name>[^\(]++)(?P<signature>\(.*\)) \{ (?<return>return p\\\\'.$testedClass->getShortName().'::[^\(]++)(?P<args>\([^\)]*+\)); \}$/', $defLine, $f)) {
|
||||
$warnings[] = TestListener::warning('Invalid line in bootstrap.php: '.trim($defLine));
|
||||
continue;
|
||||
}
|
||||
$testNamespace = substr($testClass, 0, strrpos($testClass, '\\'));
|
||||
if (\function_exists($testNamespace.'\\'.$f['name'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$r = new \ReflectionFunction($f['name']);
|
||||
if ($r->isUserDefined()) {
|
||||
throw new \ReflectionException();
|
||||
}
|
||||
if ('idn_to_ascii' === $f['name'] || 'idn_to_utf8' === $f['name']) {
|
||||
$defLine = sprintf('return INTL_IDNA_VARIANT_2003 === $variant ? \\%s($domain, $options, $variant) : \\%1$s%s', $f['name'], $f['args']);
|
||||
} elseif (false !== strpos($f['signature'], '&') && 'idn_to_ascii' !== $f['name'] && 'idn_to_utf8' !== $f['name']) {
|
||||
$defLine = sprintf('return \\%s%s', $f['name'], $f['args']);
|
||||
} else {
|
||||
$defLine = sprintf("return \\call_user_func_array('%s', \\func_get_args())", $f['name']);
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
$defLine = sprintf("throw new \\{$SkippedTestError}('Internal function not found: %s')", $f['name']);
|
||||
}
|
||||
|
||||
eval(<<<EOPHP
|
||||
namespace {$testNamespace};
|
||||
|
||||
use Symfony\Polyfill\Util\TestListenerTrait;
|
||||
use {$testedClass->getNamespaceName()} as p;
|
||||
|
||||
function {$f['name']}{$f['signature']}
|
||||
{
|
||||
if ('{$testClass}' === TestListenerTrait::\$enabledPolyfills) {
|
||||
{$f['return']}{$f['args']};
|
||||
}
|
||||
|
||||
{$defLine};
|
||||
}
|
||||
EOPHP
|
||||
);
|
||||
}
|
||||
if (!$warnings && null === $defLine) {
|
||||
$warnings[] = new $SkippedTestError('No Polyfills found in bootstrap.php for '.$testClass);
|
||||
} else {
|
||||
$mainSuite->addTest(new TestListener($suite));
|
||||
}
|
||||
}
|
||||
foreach ($warnings as $w) {
|
||||
$mainSuite->addTest($w);
|
||||
}
|
||||
}
|
||||
|
||||
public function addError($test, \Exception $e, $time)
|
||||
{
|
||||
if (false !== self::$enabledPolyfills) {
|
||||
$r = new \ReflectionProperty('Exception', 'message');
|
||||
$r->setAccessible(true);
|
||||
$r->setValue($e, 'Polyfills enabled, '.$r->getValue($e));
|
||||
}
|
||||
}
|
||||
}
|
||||
30
lib/symfony/polyfill-util/composer.json
Normal file
30
lib/symfony/polyfill-util/composer.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "symfony/polyfill-util",
|
||||
"type": "library",
|
||||
"description": "Symfony utilities for portability of PHP codes",
|
||||
"keywords": ["polyfill", "shim", "compat", "compatibility"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Polyfill\\Util\\": "" }
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.12-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user