updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -1,7 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
*.png binary
tests/ export-ignore
phpunit.xml.dist export-ignore

View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: "packagist/myclabs/deep-copy"
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -0,0 +1,101 @@
name: "Continuous Integration"
on:
- pull_request
- push
env:
COMPOSER_ROOT_VERSION: 1.99
jobs:
composer-json-lint:
name: "Lint composer.json"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: composer-normalize
- name: "Get composer cache directory"
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies"
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
- name: "Install dependencies"
run: "composer update --no-interaction --no-progress"
- name: "Validate composer.json"
run: "composer validate --strict"
- name: "Normalize composer.json"
run: "composer-normalize --dry-run"
tests:
name: "Tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
dependencies:
- "lowest"
- "highest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: zend.assertions=1
- name: "Get composer cache directory"
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies"
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --no-interaction --no-progress --prefer-lowest"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"
- name: "Run tests"
timeout-minutes: 3
run: "vendor/bin/phpunit"

View File

@@ -1,3 +0,0 @@
/composer.phar
/composer.lock
/vendor/*

View File

@@ -1,4 +0,0 @@
build:
environment:
variables:
COMPOSER_ROOT_VERSION: '1.8.0'

View File

@@ -1,40 +0,0 @@
language: php
sudo: false
env:
global:
- COMPOSER_ROOT_VERSION=1.8.0
php:
- '7.1'
- '7.2'
- nightly
matrix:
fast_finish: true
include:
- php: '7.1'
env: COMPOSER_FLAGS="--prefer-lowest"
allow_failures:
- php: nightly
cache:
directories:
- $HOME/.composer/cache/files
install:
- composer update --no-interaction --no-progress --no-suggest --prefer-dist $COMPOSER_FLAGS
- wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.0/coveralls.phar
before_script:
- mkdir -p build/logs
script:
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
after_script:
- php coveralls.phar -v
notifications:
email: false

View File

@@ -2,22 +2,15 @@
DeepCopy helps you create deep copies (clones) of your objects. It is designed to handle cycles in the association graph.
[![Build Status](https://travis-ci.org/myclabs/DeepCopy.png?branch=1.x)](https://travis-ci.org/myclabs/DeepCopy)
[![Coverage Status](https://coveralls.io/repos/myclabs/DeepCopy/badge.png?branch=1.x)](https://coveralls.io/r/myclabs/DeepCopy?branch=1.x)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/myclabs/DeepCopy/badges/quality-score.png?s=2747100c19b275f93a777e3297c6c12d1b68b934)](https://scrutinizer-ci.com/g/myclabs/DeepCopy/)
[![Total Downloads](https://poser.pugx.org/myclabs/deep-copy/downloads.svg)](https://packagist.org/packages/myclabs/deep-copy)
**You are browsing the 1.x version, this version is in maintenance mode only. Please check the new
[2.x](https://github.com/myclabs/DeepCopy/tree/2.x) version.**
[![Integrate](https://github.com/myclabs/DeepCopy/workflows/ci/badge.svg?branch=1.x)](https://github.com/myclabs/DeepCopy/actions)
## Table of Contents
1. [How](#how)
1. [Why](#why)
1. [Using simply `clone`](#using-simply-clone)
1. [Overridding `__clone()`](#overridding-__clone)
1. [Overriding `__clone()`](#overriding-__clone)
1. [With `DeepCopy`](#with-deepcopy)
1. [How it works](#how-it-works)
1. [Going further](#going-further)
@@ -42,11 +35,11 @@ DeepCopy helps you create deep copies (clones) of your objects. It is designed t
Install with Composer:
```json
```
composer require myclabs/deep-copy
```
Use simply:
Use it:
```php
use DeepCopy\DeepCopy;
@@ -81,9 +74,9 @@ Now you're in for a big mess :(
![Using clone](doc/clone.png)
### Overridding `__clone()`
### Overriding `__clone()`
![Overridding __clone](doc/deep-clone.png)
![Overriding __clone](doc/deep-clone.png)
### With `DeepCopy`
@@ -374,3 +367,7 @@ Running the tests is simple:
```php
vendor/bin/phpunit
```
### Support
Get professional support via [the Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-myclabs-deep-copy?utm_source=packagist-myclabs-deep-copy&utm_medium=referral&utm_campaign=readme).

View File

@@ -1,10 +1,27 @@
{
"name": "myclabs/deep-copy",
"type": "library",
"description": "Create deep copies (clones) of your objects",
"keywords": ["clone", "copy", "duplicate", "object", "object graph"],
"license": "MIT",
"type": "library",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
},
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
@@ -19,19 +36,6 @@
"DeepCopyTest\\": "tests/DeepCopyTest/"
}
},
"require": {
"php": "^7.1"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^7.1"
},
"replace": {
"myclabs/deep-copy": "self.version"
},
"config": {
"sort-packages": true
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -1,20 +0,0 @@
<?php
namespace DeepCopy\f001;
class A
{
private $aProp;
public function getAProp()
{
return $this->aProp;
}
public function setAProp($prop)
{
$this->aProp = $prop;
return $this;
}
}

View File

@@ -1,20 +0,0 @@
<?php
namespace DeepCopy\f001;
class B extends A
{
private $bProp;
public function getBProp()
{
return $this->bProp;
}
public function setBProp($prop)
{
$this->bProp = $prop;
return $this;
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace DeepCopy\f002;
class A
{
private $prop1;
private $prop2;
public function getProp1()
{
return $this->prop1;
}
public function setProp1($prop)
{
$this->prop1 = $prop;
return $this;
}
public function getProp2()
{
return $this->prop2;
}
public function setProp2($prop)
{
$this->prop2 = $prop;
return $this;
}
}

View File

@@ -1,26 +0,0 @@
<?php
namespace DeepCopy\f003;
class Foo
{
private $name;
private $prop;
public function __construct($name)
{
$this->name = $name;
}
public function getProp()
{
return $this->prop;
}
public function setProp($prop)
{
$this->prop = $prop;
return $this;
}
}

View File

@@ -1,13 +0,0 @@
<?php
namespace DeepCopy\f004;
use BadMethodCallException;
class UnclonableItem
{
private function __clone()
{
throw new BadMethodCallException('Unsupported call.');
}
}

View File

@@ -1,13 +0,0 @@
<?php
namespace DeepCopy\f005;
class Foo
{
public $cloned = false;
public function __clone()
{
$this->cloned = true;
}
}

View File

@@ -1,26 +0,0 @@
<?php
namespace DeepCopy\f006;
class A
{
public $cloned = false;
private $aProp;
public function getAProp()
{
return $this->aProp;
}
public function setAProp($prop)
{
$this->aProp = $prop;
return $this;
}
public function __clone()
{
$this->cloned = true;
}
}

View File

@@ -1,26 +0,0 @@
<?php
namespace DeepCopy\f006;
class B
{
public $cloned = false;
private $bProp;
public function getBProp()
{
return $this->bProp;
}
public function setBProp($prop)
{
$this->bProp = $prop;
return $this;
}
public function __clone()
{
$this->cloned = true;
}
}

View File

@@ -1,15 +0,0 @@
<?php
namespace DeepCopy\f007;
use DateInterval;
class FooDateInterval extends DateInterval
{
public $cloned = false;
public function __clone()
{
$this->cloned = true;
}
}

View File

@@ -1,15 +0,0 @@
<?php
namespace DeepCopy\f007;
use DateTimeZone;
class FooDateTimeZone extends DateTimeZone
{
public $cloned = false;
public function __clone()
{
$this->cloned = true;
}
}

View File

@@ -1,18 +0,0 @@
<?php
namespace DeepCopy\f008;
class A
{
private $foo;
public function __construct($foo)
{
$this->foo = $foo;
}
public function getFoo()
{
return $this->foo;
}
}

View File

@@ -1,7 +0,0 @@
<?php
namespace DeepCopy\f008;
class B extends A
{
}

View File

@@ -2,19 +2,21 @@
namespace DeepCopy;
use ArrayObject;
use DateInterval;
use DateTimeInterface;
use DateTimeZone;
use DeepCopy\Exception\CloneException;
use DeepCopy\Filter\Filter;
use DeepCopy\Matcher\Matcher;
use DeepCopy\Reflection\ReflectionHelper;
use DeepCopy\TypeFilter\Date\DateIntervalFilter;
use DeepCopy\TypeFilter\Spl\ArrayObjectFilter;
use DeepCopy\TypeFilter\Spl\SplDoublyLinkedListFilter;
use DeepCopy\TypeFilter\TypeFilter;
use DeepCopy\TypeMatcher\TypeMatcher;
use ReflectionObject;
use ReflectionProperty;
use DeepCopy\Reflection\ReflectionHelper;
use SplDoublyLinkedList;
/**
@@ -59,6 +61,7 @@ class DeepCopy
{
$this->useCloneMethod = $useCloneMethod;
$this->addTypeFilter(new ArrayObjectFilter($this), new TypeMatcher(ArrayObject::class));
$this->addTypeFilter(new DateIntervalFilter(), new TypeMatcher(DateInterval::class));
$this->addTypeFilter(new SplDoublyLinkedListFilter($this), new TypeMatcher(SplDoublyLinkedList::class));
}
@@ -99,6 +102,14 @@ class DeepCopy
];
}
public function prependFilter(Filter $filter, Matcher $matcher)
{
array_unshift($this->filters, [
'matcher' => $matcher,
'filter' => $filter,
]);
}
public function addTypeFilter(TypeFilter $filter, TypeMatcher $matcher)
{
$this->typeFilters[] = [
@@ -129,6 +140,11 @@ class DeepCopy
return $var;
}
// Enum
if (PHP_VERSION_ID >= 80100 && enum_exists(get_class($var))) {
return $var;
}
// Object
return $this->copyObject($var);
}
@@ -229,6 +245,12 @@ class DeepCopy
}
$property->setAccessible(true);
// Ignore uninitialized properties (for PHP >7.4)
if (method_exists($property, 'isInitialized') && !$property->isInitialized($object)) {
return;
}
$propertyValue = $property->getValue($object);
// Copy the property

View File

@@ -3,7 +3,7 @@
namespace DeepCopy\Matcher\Doctrine;
use DeepCopy\Matcher\Matcher;
use Doctrine\Common\Persistence\Proxy;
use Doctrine\Persistence\Proxy;
/**
* @final

View File

@@ -41,6 +41,12 @@ class PropertyTypeMatcher implements Matcher
$reflectionProperty->setAccessible(true);
// Uninitialized properties (for PHP >7.4)
if (method_exists($reflectionProperty, 'isInitialized') && !$reflectionProperty->isInitialized($object)) {
// null instanceof $this->propertyType
return false;
}
return $reflectionProperty->getValue($object) instanceof $this->propertyType;
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace DeepCopy\TypeFilter\Spl;
use DeepCopy\DeepCopy;
use DeepCopy\TypeFilter\TypeFilter;
/**
* In PHP 7.4 the storage of an ArrayObject isn't returned as
* ReflectionProperty. So we deep copy its array copy.
*/
final class ArrayObjectFilter implements TypeFilter
{
/**
* @var DeepCopy
*/
private $copier;
public function __construct(DeepCopy $copier)
{
$this->copier = $copier;
}
/**
* {@inheritdoc}
*/
public function apply($arrayObject)
{
$clone = clone $arrayObject;
foreach ($arrayObject->getArrayCopy() as $k => $v) {
$clone->offsetSet($k, $this->copier->copy($v));
}
return $clone;
}
}