composer update
This commit is contained in:
1
vendor/sebastian/environment/.github/FUNDING.yml
vendored
Normal file
1
vendor/sebastian/environment/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github: sebastianbergmann
|
||||
40
vendor/sebastian/environment/.github/stale.yml
vendored
40
vendor/sebastian/environment/.github/stale.yml
vendored
@@ -1,40 +0,0 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 60
|
||||
|
||||
# Number of days of inactivity before a stale Issue or Pull Request is closed.
|
||||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||
daysUntilClose: 7
|
||||
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- enhancement
|
||||
|
||||
# Set to true to ignore issues in a project (defaults to false)
|
||||
exemptProjects: false
|
||||
|
||||
# Set to true to ignore issues in a milestone (defaults to false)
|
||||
exemptMilestones: false
|
||||
|
||||
# Label to use when marking as stale
|
||||
staleLabel: stale
|
||||
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.
|
||||
|
||||
# Comment to post when removing the stale label.
|
||||
# unmarkComment: >
|
||||
# Your comment here.
|
||||
|
||||
# Comment to post when closing a stale Issue or Pull Request.
|
||||
closeComment: >
|
||||
This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.
|
||||
|
||||
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||
limitPerRun: 30
|
||||
|
||||
# Limit to only `issues` or `pulls`
|
||||
only: issues
|
||||
|
||||
1
vendor/sebastian/environment/.gitignore
vendored
1
vendor/sebastian/environment/.gitignore
vendored
@@ -3,3 +3,4 @@
|
||||
/composer.lock
|
||||
/composer.phar
|
||||
/.php_cs.cache
|
||||
/.phpunit.result.cache
|
||||
|
||||
11
vendor/sebastian/environment/ChangeLog.md
vendored
11
vendor/sebastian/environment/ChangeLog.md
vendored
@@ -2,6 +2,16 @@
|
||||
|
||||
All notable changes in `sebastianbergmann/environment` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [4.2.3] - 2019-11-20
|
||||
|
||||
### Changed
|
||||
|
||||
* Implemented [#50](https://github.com/sebastianbergmann/environment/pull/50): Windows improvements to console capabilities
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#49](https://github.com/sebastianbergmann/environment/issues/49): Detection how OpCache handles docblocks does not work correctly when PHPDBG is used
|
||||
|
||||
## [4.2.2] - 2019-05-05
|
||||
|
||||
### Fixed
|
||||
@@ -93,6 +103,7 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
|
||||
|
||||
* This component is no longer supported on PHP 5.6
|
||||
|
||||
[4.2.3]: https://github.com/sebastianbergmann/phpunit/compare/4.2.2...4.2.3
|
||||
[4.2.2]: https://github.com/sebastianbergmann/phpunit/compare/4.2.1...4.2.2
|
||||
[4.2.1]: https://github.com/sebastianbergmann/phpunit/compare/4.2.0...4.2.1
|
||||
[4.2.0]: https://github.com/sebastianbergmann/phpunit/compare/4.1.0...4.2.0
|
||||
|
||||
32
vendor/sebastian/environment/src/Console.php
vendored
32
vendor/sebastian/environment/src/Console.php
vendored
@@ -40,7 +40,7 @@ final class Console
|
||||
|
||||
if ($this->isWindows()) {
|
||||
// @codeCoverageIgnoreStart
|
||||
return (\defined('STDOUT') && \function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(\STDOUT))
|
||||
return (\defined('STDOUT') && \function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support(\STDOUT))
|
||||
|| false !== \getenv('ANSICON')
|
||||
|| 'ON' === \getenv('ConEmuANSI')
|
||||
|| 'xterm' === \getenv('TERM');
|
||||
@@ -53,13 +53,7 @@ final class Console
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
if ($this->isInteractive(\STDOUT)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$stat = @\fstat(\STDOUT);
|
||||
// Check if formatted mode is S_IFCHR
|
||||
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
|
||||
return $this->isInteractive(\STDOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,14 +63,14 @@ final class Console
|
||||
*/
|
||||
public function getNumberOfColumns(): int
|
||||
{
|
||||
if ($this->isWindows()) {
|
||||
return $this->getNumberOfColumnsWindows();
|
||||
}
|
||||
|
||||
if (!$this->isInteractive(\defined('STDIN') ? \STDIN : self::STDIN)) {
|
||||
return 80;
|
||||
}
|
||||
|
||||
if ($this->isWindows()) {
|
||||
return $this->getNumberOfColumnsWindows();
|
||||
}
|
||||
|
||||
return $this->getNumberOfColumnsInteractive();
|
||||
}
|
||||
|
||||
@@ -90,8 +84,18 @@ final class Console
|
||||
*/
|
||||
public function isInteractive($fileDescriptor = self::STDOUT): bool
|
||||
{
|
||||
return (\is_resource($fileDescriptor) && \function_exists('stream_isatty') && @\stream_isatty($fileDescriptor)) // stream_isatty requires that descriptor is a real resource, not numeric ID of it
|
||||
|| (\function_exists('posix_isatty') && @\posix_isatty($fileDescriptor));
|
||||
if (\is_resource($fileDescriptor)) {
|
||||
// These functions require a descriptor that is a real resource, not a numeric ID of it
|
||||
if (\function_exists('stream_isatty') && @\stream_isatty($fileDescriptor)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$stat = @\fstat(\STDOUT);
|
||||
// Check if formatted mode is S_IFCHR
|
||||
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
|
||||
}
|
||||
|
||||
return \function_exists('posix_isatty') && @\posix_isatty($fileDescriptor);
|
||||
}
|
||||
|
||||
private function isWindows(): bool
|
||||
|
||||
4
vendor/sebastian/environment/src/Runtime.php
vendored
4
vendor/sebastian/environment/src/Runtime.php
vendored
@@ -41,11 +41,11 @@ final class Runtime
|
||||
return false;
|
||||
}
|
||||
|
||||
if (\PHP_SAPI === 'cli' && \ini_get('opcache.enable_cli') === '1') {
|
||||
if ((\PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg') && \ini_get('opcache.enable_cli') === '1') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (\PHP_SAPI !== 'cli' && \ini_get('opcache.enable') === '1') {
|
||||
if (\PHP_SAPI !== 'cli' && \PHP_SAPI !== 'phpdbg' && \ini_get('opcache.enable') === '1') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,14 @@ final class OperatingSystemTest extends TestCase
|
||||
$this->assertEquals('Linux', $this->os->getFamily());
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires OS Darwin
|
||||
*/
|
||||
public function testFamilyReturnsDarwinWhenRunningOnDarwin(): void
|
||||
{
|
||||
$this->assertEquals('Darwin', $this->os->getFamily());
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires OS Windows
|
||||
*/
|
||||
|
||||
1
vendor/sebastian/exporter/.github/FUNDING.yml
vendored
Normal file
1
vendor/sebastian/exporter/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
patreon: s_bergmann
|
||||
1
vendor/sebastian/exporter/.gitignore
vendored
1
vendor/sebastian/exporter/.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
/.idea
|
||||
/composer.lock
|
||||
/vendor
|
||||
/.php_cs
|
||||
/.php_cs.cache
|
||||
|
||||
77
vendor/sebastian/exporter/.php_cs
vendored
77
vendor/sebastian/exporter/.php_cs
vendored
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
$header = <<<'EOF'
|
||||
This file is part of the exporter package.
|
||||
|
||||
(c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
EOF;
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules(
|
||||
[
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'binary_operator_spaces' => [
|
||||
'align_double_arrow' => true,
|
||||
'align_equals' => true
|
||||
],
|
||||
'blank_line_after_namespace' => true,
|
||||
'blank_line_before_return' => true,
|
||||
'braces' => true,
|
||||
'cast_spaces' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'elseif' => true,
|
||||
'encoding' => true,
|
||||
'full_opening_tag' => true,
|
||||
'function_declaration' => true,
|
||||
'header_comment' => ['header' => $header, 'separate' => 'none'],
|
||||
'indentation_type' => true,
|
||||
'line_ending' => true,
|
||||
'lowercase_constants' => true,
|
||||
'lowercase_keywords' => true,
|
||||
'method_argument_space' => true,
|
||||
'no_alias_functions' => true,
|
||||
'no_blank_lines_after_class_opening' => true,
|
||||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_closing_tag' => true,
|
||||
'no_empty_phpdoc' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_extra_consecutive_blank_lines' => true,
|
||||
'no_leading_namespace_whitespace' => true,
|
||||
'no_singleline_whitespace_before_semicolons' => true,
|
||||
'no_spaces_after_function_name' => true,
|
||||
'no_spaces_inside_parenthesis' => true,
|
||||
'no_trailing_comma_in_list_call' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'phpdoc_align' => true,
|
||||
'phpdoc_indent' => true,
|
||||
'phpdoc_no_access' => true,
|
||||
'phpdoc_no_empty_return' => true,
|
||||
'phpdoc_no_package' => true,
|
||||
'phpdoc_scalar' => true,
|
||||
'phpdoc_separation' => true,
|
||||
'phpdoc_to_comment' => true,
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_types' => true,
|
||||
'phpdoc_var_without_name' => true,
|
||||
'self_accessor' => true,
|
||||
'simplified_null_return' => true,
|
||||
'single_blank_line_at_eof' => true,
|
||||
'single_import_per_statement' => true,
|
||||
'single_line_after_imports' => true,
|
||||
'single_quote' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'visibility_required' => true,
|
||||
]
|
||||
)
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->files()
|
||||
->in(__DIR__ . '/src')
|
||||
->name('*.php')
|
||||
);
|
||||
190
vendor/sebastian/exporter/.php_cs.dist
vendored
Normal file
190
vendor/sebastian/exporter/.php_cs.dist
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
<?php declare(strict_types=1);
|
||||
$header = <<<'EOF'
|
||||
This file is part of exporter package.
|
||||
|
||||
(c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
EOF;
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules(
|
||||
[
|
||||
'align_multiline_comment' => true,
|
||||
'array_indentation' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'binary_operator_spaces' => [
|
||||
'operators' => [
|
||||
'=' => 'align',
|
||||
'=>' => 'align',
|
||||
],
|
||||
],
|
||||
'blank_line_after_namespace' => true,
|
||||
'blank_line_before_statement' => [
|
||||
'statements' => [
|
||||
'break',
|
||||
'continue',
|
||||
'declare',
|
||||
'do',
|
||||
'for',
|
||||
'foreach',
|
||||
'if',
|
||||
'include',
|
||||
'include_once',
|
||||
'require',
|
||||
'require_once',
|
||||
'return',
|
||||
'switch',
|
||||
'throw',
|
||||
'try',
|
||||
'while',
|
||||
'yield',
|
||||
],
|
||||
],
|
||||
'braces' => true,
|
||||
'cast_spaces' => true,
|
||||
'class_attributes_separation' => ['elements' => ['const', 'method', 'property']],
|
||||
'combine_consecutive_issets' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'compact_nullable_typehint' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'declare_equal_normalize' => ['space' => 'none'],
|
||||
'declare_strict_types' => true,
|
||||
'dir_constant' => true,
|
||||
'elseif' => true,
|
||||
'encoding' => true,
|
||||
'full_opening_tag' => true,
|
||||
'function_declaration' => true,
|
||||
'header_comment' => ['header' => $header, 'separate' => 'none'],
|
||||
'indentation_type' => true,
|
||||
'is_null' => true,
|
||||
'line_ending' => true,
|
||||
'list_syntax' => ['syntax' => 'short'],
|
||||
'logical_operators' => true,
|
||||
'lowercase_cast' => true,
|
||||
'lowercase_constants' => true,
|
||||
'lowercase_keywords' => true,
|
||||
'lowercase_static_reference' => true,
|
||||
'magic_constant_casing' => true,
|
||||
'method_argument_space' => ['ensure_fully_multiline' => true],
|
||||
'modernize_types_casting' => true,
|
||||
'multiline_comment_opening_closing' => true,
|
||||
'multiline_whitespace_before_semicolons' => true,
|
||||
'native_constant_invocation' => true,
|
||||
'native_function_casing' => true,
|
||||
'native_function_invocation' => true,
|
||||
'new_with_braces' => false,
|
||||
'no_alias_functions' => true,
|
||||
'no_alternative_syntax' => true,
|
||||
'no_blank_lines_after_class_opening' => true,
|
||||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_blank_lines_before_namespace' => true,
|
||||
'no_closing_tag' => true,
|
||||
'no_empty_comment' => true,
|
||||
'no_empty_phpdoc' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_extra_blank_lines' => true,
|
||||
'no_homoglyph_names' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_leading_namespace_whitespace' => true,
|
||||
'no_mixed_echo_print' => ['use' => 'print'],
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_null_property_initialization' => true,
|
||||
'no_php4_constructor' => true,
|
||||
'no_short_bool_cast' => true,
|
||||
'no_short_echo_tag' => true,
|
||||
'no_singleline_whitespace_before_semicolons' => true,
|
||||
'no_spaces_after_function_name' => true,
|
||||
'no_spaces_inside_parenthesis' => true,
|
||||
'no_superfluous_elseif' => true,
|
||||
'no_superfluous_phpdoc_tags' => true,
|
||||
'no_trailing_comma_in_list_call' => true,
|
||||
'no_trailing_comma_in_singleline_array' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unneeded_curly_braces' => true,
|
||||
'no_unneeded_final_method' => true,
|
||||
'no_unreachable_default_argument_value' => true,
|
||||
'no_unset_on_property' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_useless_return' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'non_printable_character' => true,
|
||||
'normalize_index_brace' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'ordered_class_elements' => [
|
||||
'order' => [
|
||||
'use_trait',
|
||||
'constant_public',
|
||||
'constant_protected',
|
||||
'constant_private',
|
||||
'property_public_static',
|
||||
'property_protected_static',
|
||||
'property_private_static',
|
||||
'property_public',
|
||||
'property_protected',
|
||||
'property_private',
|
||||
'method_public_static',
|
||||
'construct',
|
||||
'destruct',
|
||||
'magic',
|
||||
'phpunit',
|
||||
'method_public',
|
||||
'method_protected',
|
||||
'method_private',
|
||||
'method_protected_static',
|
||||
'method_private_static',
|
||||
],
|
||||
],
|
||||
'ordered_imports' => true,
|
||||
'phpdoc_add_missing_param_annotation' => true,
|
||||
'phpdoc_align' => true,
|
||||
'phpdoc_annotation_without_dot' => true,
|
||||
'phpdoc_indent' => true,
|
||||
'phpdoc_no_access' => true,
|
||||
'phpdoc_no_empty_return' => true,
|
||||
'phpdoc_no_package' => true,
|
||||
'phpdoc_order' => true,
|
||||
'phpdoc_return_self_reference' => true,
|
||||
'phpdoc_scalar' => true,
|
||||
'phpdoc_separation' => true,
|
||||
'phpdoc_single_line_var_spacing' => true,
|
||||
'phpdoc_to_comment' => true,
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_trim_consecutive_blank_line_separation' => true,
|
||||
'phpdoc_types' => true,
|
||||
'phpdoc_types_order' => true,
|
||||
'phpdoc_var_without_name' => true,
|
||||
'pow_to_exponentiation' => true,
|
||||
'protected_to_private' => true,
|
||||
'return_assignment' => true,
|
||||
'return_type_declaration' => ['space_before' => 'none'],
|
||||
'self_accessor' => true,
|
||||
'semicolon_after_instruction' => true,
|
||||
'set_type_to_cast' => true,
|
||||
'short_scalar_cast' => true,
|
||||
'simplified_null_return' => true,
|
||||
'single_blank_line_at_eof' => true,
|
||||
'single_import_per_statement' => true,
|
||||
'single_line_after_imports' => true,
|
||||
'single_quote' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'ternary_to_null_coalescing' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'visibility_required' => true,
|
||||
//'void_return' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
]
|
||||
)
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->files()
|
||||
->in(__DIR__ . '/src')
|
||||
->in(__DIR__ . '/tests')
|
||||
);
|
||||
8
vendor/sebastian/exporter/.travis.yml
vendored
8
vendor/sebastian/exporter/.travis.yml
vendored
@@ -2,12 +2,10 @@ language: php
|
||||
|
||||
php:
|
||||
- 7.0
|
||||
- 7.0snapshot
|
||||
- 7.1
|
||||
- 7.1snapshot
|
||||
- master
|
||||
|
||||
sudo: false
|
||||
- 7.2
|
||||
- 7.3
|
||||
- 7.4snapshot
|
||||
|
||||
before_install:
|
||||
- composer self-update
|
||||
|
||||
15
vendor/sebastian/exporter/ChangeLog.md
vendored
Normal file
15
vendor/sebastian/exporter/ChangeLog.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# ChangeLog
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [3.1.2] - 2019-09-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#29](https://github.com/sebastianbergmann/exporter/pull/29): Second parameter for `str_repeat()` must be an integer
|
||||
|
||||
### Removed
|
||||
|
||||
* Remove HHVM-specific code that is no longer needed
|
||||
|
||||
[3.1.2]: https://github.com/sebastianbergmann/exporter/compare/3.1.1...3.1.2
|
||||
2
vendor/sebastian/exporter/LICENSE
vendored
2
vendor/sebastian/exporter/LICENSE
vendored
@@ -1,6 +1,6 @@
|
||||
Exporter
|
||||
|
||||
Copyright (c) 2002-2017, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
Copyright (c) 2002-2019, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
1
vendor/sebastian/exporter/README.md
vendored
1
vendor/sebastian/exporter/README.md
vendored
@@ -22,7 +22,6 @@ Exception Object &0000000078de0f0d000000002003a261 (
|
||||
'code' => 0
|
||||
'file' => '/home/sebastianbergmann/test.php'
|
||||
'line' => 34
|
||||
'trace' => Array &0 ()
|
||||
'previous' => null
|
||||
)
|
||||
*/
|
||||
|
||||
2
vendor/sebastian/exporter/build.xml
vendored
2
vendor/sebastian/exporter/build.xml
vendored
@@ -14,8 +14,6 @@
|
||||
<arg value="--no-progress"/>
|
||||
<arg value="--no-ansi"/>
|
||||
<arg value="--no-suggest"/>
|
||||
<arg value="--optimize-autoloader"/>
|
||||
<arg value="--prefer-stable"/>
|
||||
</exec>
|
||||
</target>
|
||||
</project>
|
||||
|
||||
7
vendor/sebastian/exporter/composer.json
vendored
7
vendor/sebastian/exporter/composer.json
vendored
@@ -23,9 +23,14 @@
|
||||
},
|
||||
{
|
||||
"name": "Bernhard Schussek",
|
||||
"email": "bschussek@2bepublished.at"
|
||||
"email": "bschussek@gmail.com"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": "^7.0",
|
||||
"sebastian/recursion-context": "^3.0"
|
||||
|
||||
119
vendor/sebastian/exporter/src/Exporter.php
vendored
119
vendor/sebastian/exporter/src/Exporter.php
vendored
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the exporter package.
|
||||
* This file is part of exporter package.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace SebastianBergmann\Exporter;
|
||||
|
||||
use SebastianBergmann\RecursionContext\Context;
|
||||
@@ -38,8 +37,7 @@ class Exporter
|
||||
* - Carriage returns and newlines are normalized to \n
|
||||
* - Recursion and repeated rendering is treated properly
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param int $indentation The indentation level of the 2nd+ line
|
||||
* @param int $indentation The indentation level of the 2nd+ line
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -49,8 +47,8 @@ class Exporter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param Context $context
|
||||
* @param array<mixed> $data
|
||||
* @param Context $context
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -67,11 +65,11 @@ class Exporter
|
||||
$context->add($data);
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
if ($context->contains($data[$key]) !== false) {
|
||||
$result[] = '*RECURSION*';
|
||||
} else {
|
||||
$result[] = sprintf(
|
||||
$result[] = \sprintf(
|
||||
'array(%s)',
|
||||
$this->shortenedRecursiveExport($data[$key], $context)
|
||||
);
|
||||
@@ -81,7 +79,7 @@ class Exporter
|
||||
}
|
||||
}
|
||||
|
||||
return implode(', ', $result);
|
||||
return \implode(', ', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,42 +91,40 @@ class Exporter
|
||||
* Newlines are replaced by the visible string '\n'.
|
||||
* Contents of arrays and objects (if any) are replaced by '...'.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @see SebastianBergmann\Exporter\Exporter::export
|
||||
*/
|
||||
public function shortenedExport($value)
|
||||
{
|
||||
if (is_string($value)) {
|
||||
$string = str_replace("\n", '', $this->export($value));
|
||||
if (\is_string($value)) {
|
||||
$string = \str_replace("\n", '', $this->export($value));
|
||||
|
||||
if (function_exists('mb_strlen')) {
|
||||
if (mb_strlen($string) > 40) {
|
||||
$string = mb_substr($string, 0, 30) . '...' . mb_substr($string, -7);
|
||||
if (\function_exists('mb_strlen')) {
|
||||
if (\mb_strlen($string) > 40) {
|
||||
$string = \mb_substr($string, 0, 30) . '...' . \mb_substr($string, -7);
|
||||
}
|
||||
} else {
|
||||
if (strlen($string) > 40) {
|
||||
$string = substr($string, 0, 30) . '...' . substr($string, -7);
|
||||
if (\strlen($string) > 40) {
|
||||
$string = \substr($string, 0, 30) . '...' . \substr($string, -7);
|
||||
}
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
if (is_object($value)) {
|
||||
return sprintf(
|
||||
if (\is_object($value)) {
|
||||
return \sprintf(
|
||||
'%s Object (%s)',
|
||||
get_class($value),
|
||||
count($this->toArray($value)) > 0 ? '...' : ''
|
||||
\get_class($value),
|
||||
\count($this->toArray($value)) > 0 ? '...' : ''
|
||||
);
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
return sprintf(
|
||||
if (\is_array($value)) {
|
||||
return \sprintf(
|
||||
'Array (%s)',
|
||||
count($value) > 0 ? '...' : ''
|
||||
\count($value) > 0 ? '...' : ''
|
||||
);
|
||||
}
|
||||
|
||||
@@ -139,24 +135,29 @@ class Exporter
|
||||
* Converts an object to an array containing all of its private, protected
|
||||
* and public properties.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($value)
|
||||
{
|
||||
if (!is_object($value)) {
|
||||
if (!\is_object($value)) {
|
||||
return (array) $value;
|
||||
}
|
||||
|
||||
$array = [];
|
||||
|
||||
foreach ((array) $value as $key => $val) {
|
||||
// Exception traces commonly reference hundreds to thousands of
|
||||
// objects currently loaded in memory. Including them in the result
|
||||
// has a severe negative performance impact.
|
||||
if ("\0Error\0trace" === $key || "\0Exception\0trace" === $key) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// properties are transformed to keys in the following way:
|
||||
// private $property => "\0Classname\0property"
|
||||
// protected $property => "\0*\0property"
|
||||
// public $property => "property"
|
||||
if (preg_match('/^\0.+\0(.+)$/', $key, $matches)) {
|
||||
if (\preg_match('/^\0.+\0(.+)$/', (string) $key, $matches)) {
|
||||
$key = $matches[1];
|
||||
}
|
||||
|
||||
@@ -172,20 +173,8 @@ class Exporter
|
||||
// above (fast) mechanism nor with reflection in Zend.
|
||||
// Format the output similarly to print_r() in this case
|
||||
if ($value instanceof \SplObjectStorage) {
|
||||
// However, the fast method does work in HHVM, and exposes the
|
||||
// internal implementation. Hide it again.
|
||||
if (property_exists('\SplObjectStorage', '__storage')) {
|
||||
unset($array['__storage']);
|
||||
} elseif (property_exists('\SplObjectStorage', 'storage')) {
|
||||
unset($array['storage']);
|
||||
}
|
||||
|
||||
if (property_exists('\SplObjectStorage', '__key')) {
|
||||
unset($array['__key']);
|
||||
}
|
||||
|
||||
foreach ($value as $key => $val) {
|
||||
$array[spl_object_hash($val)] = [
|
||||
$array[\spl_object_hash($val)] = [
|
||||
'obj' => $val,
|
||||
'inf' => $value->getInfo(),
|
||||
];
|
||||
@@ -220,27 +209,29 @@ class Exporter
|
||||
return 'false';
|
||||
}
|
||||
|
||||
if (is_float($value) && floatval(intval($value)) === $value) {
|
||||
if (\is_float($value) && (float) ((int) $value) === $value) {
|
||||
return "$value.0";
|
||||
}
|
||||
|
||||
if (is_resource($value)) {
|
||||
return sprintf(
|
||||
if (\is_resource($value)) {
|
||||
return \sprintf(
|
||||
'resource(%d) of type (%s)',
|
||||
$value,
|
||||
get_resource_type($value)
|
||||
\get_resource_type($value)
|
||||
);
|
||||
}
|
||||
|
||||
if (is_string($value)) {
|
||||
if (\is_string($value)) {
|
||||
// Match for most non printable chars somewhat taking multibyte chars into account
|
||||
if (preg_match('/[^\x09-\x0d\x1b\x20-\xff]/', $value)) {
|
||||
return 'Binary String: 0x' . bin2hex($value);
|
||||
if (\preg_match('/[^\x09-\x0d\x1b\x20-\xff]/', $value)) {
|
||||
return 'Binary String: 0x' . \bin2hex($value);
|
||||
}
|
||||
|
||||
return "'" .
|
||||
str_replace('<lf>', "\n",
|
||||
str_replace(
|
||||
\str_replace(
|
||||
'<lf>',
|
||||
"\n",
|
||||
\str_replace(
|
||||
["\r\n", "\n\r", "\r", "\n"],
|
||||
['\r\n<lf>', '\n\r<lf>', '\r<lf>', '\n<lf>'],
|
||||
$value
|
||||
@@ -249,13 +240,13 @@ class Exporter
|
||||
"'";
|
||||
}
|
||||
|
||||
$whitespace = str_repeat(' ', 4 * $indentation);
|
||||
$whitespace = \str_repeat(' ', (int)(4 * $indentation));
|
||||
|
||||
if (!$processed) {
|
||||
$processed = new Context;
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
if (($key = $processed->contains($value)) !== false) {
|
||||
return 'Array &' . $key;
|
||||
}
|
||||
@@ -264,9 +255,9 @@ class Exporter
|
||||
$key = $processed->add($value);
|
||||
$values = '';
|
||||
|
||||
if (count($array) > 0) {
|
||||
if (\count($array) > 0) {
|
||||
foreach ($array as $k => $v) {
|
||||
$values .= sprintf(
|
||||
$values .= \sprintf(
|
||||
'%s %s => %s' . "\n",
|
||||
$whitespace,
|
||||
$this->recursiveExport($k, $indentation),
|
||||
@@ -277,23 +268,23 @@ class Exporter
|
||||
$values = "\n" . $values . $whitespace;
|
||||
}
|
||||
|
||||
return sprintf('Array &%s (%s)', $key, $values);
|
||||
return \sprintf('Array &%s (%s)', $key, $values);
|
||||
}
|
||||
|
||||
if (is_object($value)) {
|
||||
$class = get_class($value);
|
||||
if (\is_object($value)) {
|
||||
$class = \get_class($value);
|
||||
|
||||
if ($hash = $processed->contains($value)) {
|
||||
return sprintf('%s Object &%s', $class, $hash);
|
||||
return \sprintf('%s Object &%s', $class, $hash);
|
||||
}
|
||||
|
||||
$hash = $processed->add($value);
|
||||
$values = '';
|
||||
$array = $this->toArray($value);
|
||||
|
||||
if (count($array) > 0) {
|
||||
if (\count($array) > 0) {
|
||||
foreach ($array as $k => $v) {
|
||||
$values .= sprintf(
|
||||
$values .= \sprintf(
|
||||
'%s %s => %s' . "\n",
|
||||
$whitespace,
|
||||
$this->recursiveExport($k, $indentation),
|
||||
@@ -304,9 +295,9 @@ class Exporter
|
||||
$values = "\n" . $values . $whitespace;
|
||||
}
|
||||
|
||||
return sprintf('%s Object &%s (%s)', $class, $hash, $values);
|
||||
return \sprintf('%s Object &%s (%s)', $class, $hash, $values);
|
||||
}
|
||||
|
||||
return var_export($value, true);
|
||||
return \var_export($value, true);
|
||||
}
|
||||
}
|
||||
|
||||
263
vendor/sebastian/exporter/tests/ExporterTest.php
vendored
263
vendor/sebastian/exporter/tests/ExporterTest.php
vendored
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the Exporter package.
|
||||
* This file is part of exporter package.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace SebastianBergmann\Exporter;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use SebastianBergmann\RecursionContext\Context;
|
||||
|
||||
/**
|
||||
* @covers SebastianBergmann\Exporter\Exporter
|
||||
@@ -29,40 +29,40 @@ class ExporterTest extends TestCase
|
||||
|
||||
public function exportProvider()
|
||||
{
|
||||
$obj2 = new \stdClass;
|
||||
$obj2 = new \stdClass;
|
||||
$obj2->foo = 'bar';
|
||||
|
||||
$obj3 = (object)array(1,2,"Test\r\n",4,5,6,7,8);
|
||||
$obj3 = (object) [1, 2, "Test\r\n", 4, 5, 6, 7, 8];
|
||||
|
||||
$obj = new \stdClass;
|
||||
//@codingStandardsIgnoreStart
|
||||
$obj->null = null;
|
||||
//@codingStandardsIgnoreEnd
|
||||
$obj->boolean = true;
|
||||
$obj->integer = 1;
|
||||
$obj->double = 1.2;
|
||||
$obj->string = '1';
|
||||
$obj->text = "this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext";
|
||||
$obj->object = $obj2;
|
||||
$obj->boolean = true;
|
||||
$obj->integer = 1;
|
||||
$obj->double = 1.2;
|
||||
$obj->string = '1';
|
||||
$obj->text = "this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext";
|
||||
$obj->object = $obj2;
|
||||
$obj->objectagain = $obj2;
|
||||
$obj->array = array('foo' => 'bar');
|
||||
$obj->self = $obj;
|
||||
$obj->array = ['foo' => 'bar'];
|
||||
$obj->self = $obj;
|
||||
|
||||
$storage = new \SplObjectStorage;
|
||||
$storage->attach($obj2);
|
||||
$storage->foo = $obj2;
|
||||
|
||||
return array(
|
||||
'export null' => array(null, 'null'),
|
||||
'export boolean true' => array(true, 'true'),
|
||||
'export boolean false' => array(false, 'false'),
|
||||
'export int 1' => array(1, '1'),
|
||||
'export float 1.0' => array(1.0, '1.0'),
|
||||
'export float 1.2' => array(1.2, '1.2'),
|
||||
'export stream' => array(fopen('php://memory', 'r'), 'resource(%d) of type (stream)'),
|
||||
'export numeric string' => array('1', "'1'"),
|
||||
'export multidimentional array' => array(array(array(1,2,3), array(3,4,5)),
|
||||
<<<EOF
|
||||
return [
|
||||
'export null' => [null, 'null'],
|
||||
'export boolean true' => [true, 'true'],
|
||||
'export boolean false' => [false, 'false'],
|
||||
'export int 1' => [1, '1'],
|
||||
'export float 1.0' => [1.0, '1.0'],
|
||||
'export float 1.2' => [1.2, '1.2'],
|
||||
'export stream' => [\fopen('php://memory', 'r'), 'resource(%d) of type (stream)'],
|
||||
'export numeric string' => ['1', "'1'"],
|
||||
'export multidimentional array' => [[[1, 2, 3], [3, 4, 5]],
|
||||
<<<EOF
|
||||
Array &0 (
|
||||
0 => Array &1 (
|
||||
0 => 1
|
||||
@@ -76,10 +76,10 @@ Array &0 (
|
||||
)
|
||||
)
|
||||
EOF
|
||||
),
|
||||
],
|
||||
// \n\r and \r is converted to \n
|
||||
'export multiline text' => array("this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext",
|
||||
<<<EOF
|
||||
'export multiline text' => ["this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext",
|
||||
<<<EOF
|
||||
'this\\n
|
||||
is\\n
|
||||
a\\n
|
||||
@@ -92,10 +92,10 @@ very\\r
|
||||
long\\n\\r
|
||||
text'
|
||||
EOF
|
||||
),
|
||||
'export empty stdclass' => array(new \stdClass, 'stdClass Object &%x ()'),
|
||||
'export non empty stdclass' => array($obj,
|
||||
<<<EOF
|
||||
],
|
||||
'export empty stdclass' => [new \stdClass, 'stdClass Object &%x ()'],
|
||||
'export non empty stdclass' => [$obj,
|
||||
<<<EOF
|
||||
stdClass Object &%x (
|
||||
'null' => null
|
||||
'boolean' => true
|
||||
@@ -123,10 +123,10 @@ text'
|
||||
'self' => stdClass Object &%x
|
||||
)
|
||||
EOF
|
||||
),
|
||||
'export empty array' => array(array(), 'Array &%d ()'),
|
||||
'export splObjectStorage' => array($storage,
|
||||
<<<EOF
|
||||
],
|
||||
'export empty array' => [[], 'Array &%d ()'],
|
||||
'export splObjectStorage' => [$storage,
|
||||
<<<EOF
|
||||
SplObjectStorage Object &%x (
|
||||
'foo' => stdClass Object &%x (
|
||||
'foo' => 'bar'
|
||||
@@ -137,9 +137,9 @@ SplObjectStorage Object &%x (
|
||||
)
|
||||
)
|
||||
EOF
|
||||
),
|
||||
'export stdClass with numeric properties' => array($obj3,
|
||||
<<<EOF
|
||||
],
|
||||
'export stdClass with numeric properties' => [$obj3,
|
||||
<<<EOF
|
||||
stdClass Object &%x (
|
||||
0 => 1
|
||||
1 => 2
|
||||
@@ -152,24 +152,50 @@ stdClass Object &%x (
|
||||
7 => 8
|
||||
)
|
||||
EOF
|
||||
),
|
||||
array(
|
||||
chr(0) . chr(1) . chr(2) . chr(3) . chr(4) . chr(5),
|
||||
],
|
||||
[
|
||||
\chr(0) . \chr(1) . \chr(2) . \chr(3) . \chr(4) . \chr(5),
|
||||
'Binary String: 0x000102030405'
|
||||
),
|
||||
array(
|
||||
implode('', array_map('chr', range(0x0e, 0x1f))),
|
||||
],
|
||||
[
|
||||
\implode('', \array_map('chr', \range(0x0e, 0x1f))),
|
||||
'Binary String: 0x0e0f101112131415161718191a1b1c1d1e1f'
|
||||
),
|
||||
array(
|
||||
chr(0x00) . chr(0x09),
|
||||
],
|
||||
[
|
||||
\chr(0x00) . \chr(0x09),
|
||||
'Binary String: 0x0009'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'',
|
||||
"''"
|
||||
),
|
||||
);
|
||||
],
|
||||
'export Exception without trace' => [
|
||||
new \Exception('The exception message', 42),
|
||||
<<<EOF
|
||||
Exception Object &%x (
|
||||
'message' => 'The exception message'
|
||||
'string' => ''
|
||||
'code' => 42
|
||||
'file' => '%s/tests/ExporterTest.php'
|
||||
'line' => %d
|
||||
'previous' => null
|
||||
)
|
||||
EOF
|
||||
],
|
||||
'export Error without trace' => [
|
||||
new \Error('The exception message', 42),
|
||||
<<<EOF
|
||||
Error Object &%x (
|
||||
'message' => 'The exception message'
|
||||
'string' => ''
|
||||
'code' => 42
|
||||
'file' => '%s/tests/ExporterTest.php'
|
||||
'line' => %d
|
||||
'previous' => null
|
||||
)
|
||||
EOF
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,25 +211,25 @@ EOF
|
||||
|
||||
public function testExport2()
|
||||
{
|
||||
if (PHP_VERSION === '5.3.3') {
|
||||
if (\PHP_VERSION === '5.3.3') {
|
||||
$this->markTestSkipped('Skipped due to "Nesting level too deep - recursive dependency?" fatal error');
|
||||
}
|
||||
|
||||
$obj = new \stdClass;
|
||||
$obj = new \stdClass;
|
||||
$obj->foo = 'bar';
|
||||
|
||||
$array = array(
|
||||
0 => 0,
|
||||
'null' => null,
|
||||
'boolean' => true,
|
||||
'integer' => 1,
|
||||
'double' => 1.2,
|
||||
'string' => '1',
|
||||
'text' => "this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext",
|
||||
'object' => $obj,
|
||||
$array = [
|
||||
0 => 0,
|
||||
'null' => null,
|
||||
'boolean' => true,
|
||||
'integer' => 1,
|
||||
'double' => 1.2,
|
||||
'string' => '1',
|
||||
'text' => "this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext",
|
||||
'object' => $obj,
|
||||
'objectagain' => $obj,
|
||||
'array' => array('foo' => 'bar'),
|
||||
);
|
||||
'array' => ['foo' => 'bar'],
|
||||
];
|
||||
|
||||
$array['self'] = &$array;
|
||||
|
||||
@@ -269,27 +295,27 @@ EOF;
|
||||
|
||||
public function shortenedExportProvider()
|
||||
{
|
||||
$obj = new \stdClass;
|
||||
$obj = new \stdClass;
|
||||
$obj->foo = 'bar';
|
||||
|
||||
$array = array(
|
||||
$array = [
|
||||
'foo' => 'bar',
|
||||
);
|
||||
];
|
||||
|
||||
return array(
|
||||
'shortened export null' => array(null, 'null'),
|
||||
'shortened export boolean true' => array(true, 'true'),
|
||||
'shortened export integer 1' => array(1, '1'),
|
||||
'shortened export float 1.0' => array(1.0, '1.0'),
|
||||
'shortened export float 1.2' => array(1.2, '1.2'),
|
||||
'shortened export numeric string' => array('1', "'1'"),
|
||||
return [
|
||||
'shortened export null' => [null, 'null'],
|
||||
'shortened export boolean true' => [true, 'true'],
|
||||
'shortened export integer 1' => [1, '1'],
|
||||
'shortened export float 1.0' => [1.0, '1.0'],
|
||||
'shortened export float 1.2' => [1.2, '1.2'],
|
||||
'shortened export numeric string' => ['1', "'1'"],
|
||||
// \n\r and \r is converted to \n
|
||||
'shortened export multilinestring' => array("this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext", "'this\\nis\\na\\nvery\\nvery\\nvery...\\rtext'"),
|
||||
'shortened export empty stdClass' => array(new \stdClass, 'stdClass Object ()'),
|
||||
'shortened export not empty stdClass' => array($obj, 'stdClass Object (...)'),
|
||||
'shortened export empty array' => array(array(), 'Array ()'),
|
||||
'shortened export not empty array' => array($array, 'Array (...)'),
|
||||
);
|
||||
'shortened export multilinestring' => ["this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext", "'this\\nis\\na\\nvery\\nvery\\nvery...\\rtext'"],
|
||||
'shortened export empty stdClass' => [new \stdClass, 'stdClass Object ()'],
|
||||
'shortened export not empty stdClass' => [$obj, 'stdClass Object (...)'],
|
||||
'shortened export empty array' => [[], 'Array ()'],
|
||||
'shortened export not empty array' => [$array, 'Array (...)'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,10 +334,10 @@ EOF;
|
||||
*/
|
||||
public function testShortenedExportForMultibyteCharacters()
|
||||
{
|
||||
$oldMbLanguage = mb_language();
|
||||
mb_language('Japanese');
|
||||
$oldMbInternalEncoding = mb_internal_encoding();
|
||||
mb_internal_encoding('UTF-8');
|
||||
$oldMbLanguage = \mb_language();
|
||||
\mb_language('Japanese');
|
||||
$oldMbInternalEncoding = \mb_internal_encoding();
|
||||
\mb_internal_encoding('UTF-8');
|
||||
|
||||
try {
|
||||
$this->assertSame(
|
||||
@@ -319,25 +345,25 @@ EOF;
|
||||
$this->trimNewline($this->exporter->shortenedExport('いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす'))
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
mb_internal_encoding($oldMbInternalEncoding);
|
||||
mb_language($oldMbLanguage);
|
||||
\mb_internal_encoding($oldMbInternalEncoding);
|
||||
\mb_language($oldMbLanguage);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
mb_internal_encoding($oldMbInternalEncoding);
|
||||
mb_language($oldMbLanguage);
|
||||
\mb_internal_encoding($oldMbInternalEncoding);
|
||||
\mb_language($oldMbLanguage);
|
||||
}
|
||||
|
||||
public function provideNonBinaryMultibyteStrings()
|
||||
{
|
||||
return array(
|
||||
array(implode('', array_map('chr', range(0x09, 0x0d))), 9),
|
||||
array(implode('', array_map('chr', range(0x20, 0x7f))), 96),
|
||||
array(implode('', array_map('chr', range(0x80, 0xff))), 128),
|
||||
);
|
||||
return [
|
||||
[\implode('', \array_map('chr', \range(0x09, 0x0d))), 9],
|
||||
[\implode('', \array_map('chr', \range(0x20, 0x7f))), 96],
|
||||
[\implode('', \array_map('chr', \range(0x80, 0xff))), 128],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @dataProvider provideNonBinaryMultibyteStrings
|
||||
*/
|
||||
@@ -351,11 +377,56 @@ EOF;
|
||||
|
||||
public function testNonObjectCanBeReturnedAsArray()
|
||||
{
|
||||
$this->assertEquals(array(true), $this->exporter->toArray(true));
|
||||
$this->assertEquals([true], $this->exporter->toArray(true));
|
||||
}
|
||||
|
||||
public function testIgnoreKeysInValue()
|
||||
{
|
||||
// Find out what the actual use case was with the PHP bug
|
||||
$array = [];
|
||||
$array["\0gcdata"] = '';
|
||||
|
||||
$this->assertEquals([], $this->exporter->toArray((object) $array));
|
||||
}
|
||||
|
||||
private function trimNewline($string)
|
||||
{
|
||||
return preg_replace('/[ ]*\n/', "\n", $string);
|
||||
return \preg_replace('/[ ]*\n/', "\n", $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider shortenedRecursiveExportProvider
|
||||
*/
|
||||
public function testShortenedRecursiveExport(array $value, string $expected)
|
||||
{
|
||||
$this->assertEquals($expected, $this->exporter->shortenedRecursiveExport($value));
|
||||
}
|
||||
|
||||
public function shortenedRecursiveExportProvider()
|
||||
{
|
||||
return [
|
||||
'export null' => [[null], 'null'],
|
||||
'export boolean true' => [[true], 'true'],
|
||||
'export boolean false' => [[false], 'false'],
|
||||
'export int 1' => [[1], '1'],
|
||||
'export float 1.0' => [[1.0], '1.0'],
|
||||
'export float 1.2' => [[1.2], '1.2'],
|
||||
'export numeric string' => [['1'], "'1'"],
|
||||
'export with numeric array key' => [[2 => 1], '1'],
|
||||
'export with assoc array key' => [['foo' => 'bar'], '\'bar\''],
|
||||
'export multidimentional array' => [[[1, 2, 3], [3, 4, 5]], 'array(1, 2, 3), array(3, 4, 5)'],
|
||||
'export object' => [[new \stdClass], 'stdClass Object ()'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testShortenedRecursiveOccurredRecursion()
|
||||
{
|
||||
$recursiveValue = [1];
|
||||
$context = new Context();
|
||||
$context->add($recursiveValue);
|
||||
|
||||
$value = [$recursiveValue];
|
||||
|
||||
$this->assertEquals('*RECURSION*', $this->exporter->shortenedRecursiveExport($value, $context));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user