Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -1,8 +0,0 @@
.idea
composer.lock
composer.phar
vendor/
cache.properties
build/LICENSE
build/README.md
build/*.tgz

View File

@@ -1,67 +0,0 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->files()
->in('src')
->in('tests')
->name('*.php');
return Symfony\CS\Config\Config::create()
->level(\Symfony\CS\FixerInterface::NONE_LEVEL)
->fixers(
array(
'align_double_arrow',
'align_equals',
'braces',
'concat_with_spaces',
'duplicate_semicolon',
'elseif',
'empty_return',
'encoding',
'eof_ending',
'extra_empty_lines',
'function_call_space',
'function_declaration',
'indentation',
'join_function',
'line_after_namespace',
'linefeed',
'list_commas',
'lowercase_constants',
'lowercase_keywords',
'method_argument_space',
'multiple_use',
'namespace_no_leading_whitespace',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'parenthesis',
'php_closing_tag',
'phpdoc_indent',
'phpdoc_no_access',
'phpdoc_no_empty_return',
'phpdoc_no_package',
'phpdoc_params',
'phpdoc_scalar',
'phpdoc_separation',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_types',
'phpdoc_var_without_name',
'remove_lines_between_uses',
'return',
'self_accessor',
'short_array_syntax',
'short_tag',
'single_line_after_imports',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'ternary_spaces',
'trailing_spaces',
'trim_array_spaces',
'unused_use',
'visibility',
'whitespacy_lines'
)
)
->finder($finder);

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.0.1@b1e2e30026936ef8d5bf6a354d1c3959b6231f44">
<file src="src/Enumerator.php">
<DocblockTypeContradiction occurrences="2">
<code>!is_array($variable) &amp;&amp; !is_object($variable)</code>
<code>is_object($variable)</code>
</DocblockTypeContradiction>
</file>
</files>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
resolveFromConfigFile="false"
totallyTyped="false"
errorBaseline=".psalm/baseline.xml"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>

View File

@@ -1,23 +0,0 @@
language: php
php:
- 5.6
- 7.0
- 7.1
- nightly
sudo: false
before_install:
- composer self-update
- composer clear-cache
install:
- travis_retry composer update --no-interaction --no-ansi --no-progress --no-suggest --optimize-autoloader --prefer-stable
script:
- ./vendor/bin/phpunit
notifications:
email: false

View File

@@ -2,6 +2,60 @@
All notable changes to `sebastianbergmann/object-enumerator` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [4.0.4] - 2020-10-26
### Fixed
* `SebastianBergmann\ObjectEnumerator\Exception` now correctly extends `\Throwable`
## [4.0.3] - 2020-09-28
### Changed
* Changed PHP version constraint in `composer.json` from `^7.3 || ^8.0` to `>=7.3`
## [4.0.2] - 2020-06-26
### Added
* This component is now supported on PHP 8
## [4.0.1] - 2020-06-15
### Changed
* Tests etc. are now ignored for archive exports
## [4.0.0] - 2020-02-07
### Removed
* This component is no longer supported on PHP 7.0, PHP 7.1, and PHP 7.2
## [3.0.3] - 2017-08-03
### Changed
* Bumped required version of `sebastian/object-reflector`
## [3.0.2] - 2017-03-12
### Changed
* `sebastian/object-reflector` is now a dependency
## [3.0.1] - 2017-03-12
### Fixed
* Objects aggregated in inherited attributes are not enumerated
## [3.0.0] - 2017-03-03
### Removed
* This component is no longer supported on PHP 5.6
## [2.0.1] - 2017-02-18
### Fixed
@@ -20,6 +74,15 @@ All notable changes to `sebastianbergmann/object-enumerator` are documented in t
* Initial release
[4.0.4]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.3...4.0.4
[4.0.3]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.2...4.0.3
[4.0.2]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.1...4.0.2
[4.0.1]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.0...4.0.1
[4.0.0]: https://github.com/sebastianbergmann/object-enumerator/compare/3.0.3...4.0.0
[3.0.3]: https://github.com/sebastianbergmann/object-enumerator/compare/3.0.2...3.0.3
[3.0.2]: https://github.com/sebastianbergmann/object-enumerator/compare/3.0.1...3.0.2
[3.0.1]: https://github.com/sebastianbergmann/object-enumerator/compare/3.0.0...3.0.1
[3.0.0]: https://github.com/sebastianbergmann/object-enumerator/compare/2.0...3.0.0
[2.0.1]: https://github.com/sebastianbergmann/object-enumerator/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/sebastianbergmann/object-enumerator/compare/1.0...2.0.0

View File

@@ -1,6 +1,6 @@
Object Enumerator
Copyright (c) 2016, Sebastian Bergmann <sebastian@phpunit.de>.
Copyright (c) 2016-2020, Sebastian Bergmann <sebastian@phpunit.de>.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -1,4 +1,7 @@
# Object Enumerator
# sebastian/object-enumerator
[![CI Status](https://github.com/sebastianbergmann/object-enumerator/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/object-enumerator/actions)
[![Type Coverage](https://shepherd.dev/github/sebastianbergmann/object-enumerator/coverage.svg)](https://shepherd.dev/github/sebastianbergmann/object-enumerator)
Traverses array structures and object graphs to enumerate all referenced objects.
@@ -6,9 +9,12 @@ Traverses array structures and object graphs to enumerate all referenced objects
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
composer require sebastian/object-enumerator
```
composer require sebastian/object-enumerator
```
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
composer require --dev sebastian/object-enumerator
```
composer require --dev sebastian/object-enumerator
```

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="object-enumerator" default="setup">
<target name="setup" depends="clean,composer"/>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/composer.lock"/>
</target>
<target name="composer" depends="clean" description="Install dependencies with Composer">
<exec executable="composer" taskname="composer">
<env key="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
<arg value="update"/>
<arg value="--no-interaction"/>
<arg value="--no-progress"/>
<arg value="--no-ansi"/>
<arg value="--no-suggest"/>
<arg value="--optimize-autoloader"/>
<arg value="--prefer-stable"/>
</exec>
</target>
</project>

View File

@@ -9,12 +9,21 @@
"email": "sebastian@phpunit.de"
}
],
"prefer-stable": true,
"config": {
"platform": {
"php": "7.3.0"
},
"optimize-autoloader": true,
"sort-packages": true
},
"require": {
"php": ">=5.6",
"sebastian/recursion-context": "~2.0"
"php": ">=7.3",
"sebastian/object-reflector": "^2.0",
"sebastian/recursion-context": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "~5"
"phpunit/phpunit": "^9.3"
},
"autoload": {
"classmap": [
@@ -23,12 +32,12 @@
},
"autoload-dev": {
"classmap": [
"tests/"
"tests/_fixture/"
]
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "4.0-dev"
}
}
}

View File

@@ -1,20 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
backupGlobals="false"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
<testsuite>
<directory suffix="Test.php">tests</directory>
</testsuite>
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</include>
</coverage>
</phpunit>

View File

@@ -1,15 +1,19 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of Object Enumerator.
* This file is part of sebastian/object-enumerator.
*
* (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\ObjectEnumerator;
use function array_merge;
use function func_get_args;
use function is_array;
use function is_object;
use SebastianBergmann\ObjectReflector\ObjectReflector;
use SebastianBergmann\RecursionContext\Context;
/**
@@ -64,19 +68,10 @@ class Enumerator
}
} else {
$objects[] = $variable;
$reflector = new \ReflectionObject($variable);
foreach ($reflector->getProperties() as $attribute) {
$attribute->setAccessible(true);
try {
$value = $attribute->getValue($variable);
} catch (\Throwable $e) {
continue;
} catch (\Exception $e) {
continue;
}
$reflector = new ObjectReflector;
foreach ($reflector->getAttributes($variable) as $value) {
if (!is_array($value) && !is_object($value)) {
continue;
}

View File

@@ -1,15 +1,16 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of Object Enumerator.
* This file is part of sebastian/object-enumerator.
*
* (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\ObjectEnumerator;
interface Exception
use Throwable;
interface Exception extends Throwable
{
}

View File

@@ -1,13 +1,12 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of Object Enumerator.
* This file is part of sebastian/object-enumerator.
*
* (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\ObjectEnumerator;
class InvalidArgumentException extends \InvalidArgumentException implements Exception

View File

@@ -1,138 +0,0 @@
<?php
/*
* This file is part of Object Enumerator.
*
* (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\ObjectEnumerator;
use SebastianBergmann\ObjectEnumerator\Fixtures\ExceptionThrower;
/**
* @covers SebastianBergmann\ObjectEnumerator\Enumerator
*/
class EnumeratorTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Enumerator
*/
private $enumerator;
protected function setUp()
{
$this->enumerator = new Enumerator;
}
public function testEnumeratesSingleObject()
{
$a = new \stdClass;
$objects = $this->enumerator->enumerate($a);
$this->assertCount(1, $objects);
$this->assertSame($a, $objects[0]);
}
public function testEnumeratesArrayWithSingleObject()
{
$a = new \stdClass;
$objects = $this->enumerator->enumerate([$a]);
$this->assertCount(1, $objects);
$this->assertSame($a, $objects[0]);
}
public function testEnumeratesArrayWithTwoReferencesToTheSameObject()
{
$a = new \stdClass;
$objects = $this->enumerator->enumerate([$a, $a]);
$this->assertCount(1, $objects);
$this->assertSame($a, $objects[0]);
}
public function testEnumeratesArrayOfObjects()
{
$a = new \stdClass;
$b = new \stdClass;
$objects = $this->enumerator->enumerate([$a, $b, null]);
$this->assertCount(2, $objects);
$this->assertSame($a, $objects[0]);
$this->assertSame($b, $objects[1]);
}
public function testEnumeratesObjectWithAggregatedObject()
{
$a = new \stdClass;
$b = new \stdClass;
$a->b = $b;
$a->c = null;
$objects = $this->enumerator->enumerate($a);
$this->assertCount(2, $objects);
$this->assertSame($a, $objects[0]);
$this->assertSame($b, $objects[1]);
}
public function testEnumeratesObjectWithAggregatedObjectsInArray()
{
$a = new \stdClass;
$b = new \stdClass;
$a->b = [$b];
$objects = $this->enumerator->enumerate($a);
$this->assertCount(2, $objects);
$this->assertSame($a, $objects[0]);
$this->assertSame($b, $objects[1]);
}
public function testEnumeratesObjectsWithCyclicReferences()
{
$a = new \stdClass;
$b = new \stdClass;
$a->b = $b;
$b->a = $a;
$objects = $this->enumerator->enumerate([$a, $b]);
$this->assertCount(2, $objects);
$this->assertSame($a, $objects[0]);
$this->assertSame($b, $objects[1]);
}
public function testEnumeratesClassThatThrowsException()
{
$thrower = new ExceptionThrower();
$objects = $this->enumerator->enumerate($thrower);
$this->assertSame($thrower, $objects[0]);
}
public function testExceptionIsRaisedForInvalidArgument()
{
$this->setExpectedException(InvalidArgumentException::class);
$this->enumerator->enumerate(null);
}
public function testExceptionIsRaisedForInvalidArgument2()
{
$this->setExpectedException(InvalidArgumentException::class);
$this->enumerator->enumerate([], '');
}
}

View File

@@ -1,28 +0,0 @@
<?php
/*
* This file is part of Object Enumerator.
*
* (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\ObjectEnumerator\Fixtures;
use RuntimeException;
class ExceptionThrower
{
private $property;
public function __construct()
{
unset($this->property);
}
public function __get($property)
{
throw new RuntimeException;
}
}