update v1.0.4
This commit is contained in:
18
vendor/symfony/polyfill-util/Binary.php
vendored
Normal file
18
vendor/symfony/polyfill-util/Binary.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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
vendor/symfony/polyfill-util/BinaryNoFuncOverload.php
vendored
Normal file
65
vendor/symfony/polyfill-util/BinaryNoFuncOverload.php
vendored
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
vendor/symfony/polyfill-util/BinaryOnFuncOverload.php
vendored
Normal file
67
vendor/symfony/polyfill-util/BinaryOnFuncOverload.php
vendored
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
vendor/symfony/polyfill-util/LICENSE
vendored
Normal file
19
vendor/symfony/polyfill-util/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2014-2015 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
vendor/symfony/polyfill-util/README.md
vendored
Normal file
13
vendor/symfony/polyfill-util/README.md
vendored
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).
|
151
vendor/symfony/polyfill-util/TestListener.php
vendored
Normal file
151
vendor/symfony/polyfill-util/TestListener.php
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
<?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 TestListener extends \PHPUnit_Framework_TestSuite implements \PHPUnit_Framework_TestListener
|
||||
{
|
||||
public static $enabledPolyfills;
|
||||
private $suite;
|
||||
|
||||
public function __construct(\PHPUnit_Framework_TestSuite $suite = null)
|
||||
{
|
||||
if ($suite) {
|
||||
$this->suite = $suite;
|
||||
$this->setName($suite->getName().' with polyfills enabled');
|
||||
$this->addTest($suite);
|
||||
}
|
||||
}
|
||||
|
||||
public function startTestSuite(\PHPUnit_Framework_TestSuite $mainSuite)
|
||||
{
|
||||
if (null !== self::$enabledPolyfills) {
|
||||
return;
|
||||
}
|
||||
self::$enabledPolyfills = false;
|
||||
|
||||
foreach ($mainSuite->tests() as $suite) {
|
||||
$testClass = $suite->getName();
|
||||
if (!$tests = $suite->tests()) {
|
||||
continue;
|
||||
}
|
||||
if (!preg_match('/^(.+)\\\\Tests(\\\\.*)Test$/', $testClass, $m)) {
|
||||
$mainSuite->addTest(self::warning('Unknown naming convention for '.$testClass));
|
||||
continue;
|
||||
}
|
||||
$testedClass = new \ReflectionClass($m[1].$m[2]);
|
||||
$bootstrap = new \SplFileObject(dirname($testedClass->getFileName()).'/bootstrap.php');
|
||||
$warnings = array();
|
||||
$defLine = null;
|
||||
|
||||
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[] = self::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 (false !== strpos($f['signature'], '&')) {
|
||||
$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 \PHPUnit_Framework_SkippedTestError('Internal function not found: %s')", $f['name']);
|
||||
}
|
||||
|
||||
eval(<<<EOPHP
|
||||
namespace {$testNamespace};
|
||||
|
||||
use Symfony\Polyfill\Util\TestListener;
|
||||
use {$testedClass->getNamespaceName()} as p;
|
||||
|
||||
function {$f['name']}{$f['signature']}
|
||||
{
|
||||
if ('{$testClass}' === TestListener::\$enabledPolyfills) {
|
||||
{$f['return']}{$f['args']};
|
||||
}
|
||||
|
||||
{$defLine};
|
||||
}
|
||||
EOPHP
|
||||
);
|
||||
}
|
||||
if (!$warnings && null === $defLine) {
|
||||
$warnings[] = new \PHPUnit_Framework_SkippedTestCase('No Polyfills found in bootstrap.php for '.$testClass);
|
||||
} else {
|
||||
$mainSuite->addTest(new static($suite));
|
||||
}
|
||||
}
|
||||
foreach ($warnings as $w) {
|
||||
$mainSuite->addTest($w);
|
||||
}
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
self::$enabledPolyfills = $this->suite->getName();
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
self::$enabledPolyfills = false;
|
||||
}
|
||||
|
||||
public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time)
|
||||
{
|
||||
if (false !== self::$enabledPolyfills) {
|
||||
$r = new \ReflectionProperty('Exception', 'message');
|
||||
$r->setAccessible(true);
|
||||
$r->setValue($e, 'Polyfills enabled, '.$r->getValue($e));
|
||||
}
|
||||
}
|
||||
|
||||
public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
|
||||
{
|
||||
$this->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)
|
||||
{
|
||||
}
|
||||
}
|
30
vendor/symfony/polyfill-util/composer.json
vendored
Normal file
30
vendor/symfony/polyfill-util/composer.json
vendored
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.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user