Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3d2b01d

Browse files
Added symfony/abstractions: a set of domain specific abstractions
1 parent 3ccbec3 commit 3d2b01d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+219
-39
lines changed

.github/build-packages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
$packages[$package->name][$package->version] = $package;
5151

52-
$versions = file_get_contents('https://packagist.org/p/'.$package->name.'.json');
52+
$versions = @file_get_contents('https://packagist.org/p/'.$package->name.'.json') ?: sprintf('{"packages":{"%s":{"dev-master":%s}}}', $package->name, file_get_contents($dir.'/composer.json'));
5353
$versions = json_decode($versions)->packages->{$package->name};
5454

5555
if ($package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) {

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ before_install:
124124
deps=skip
125125
skip=1
126126
else
127-
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
127+
COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
128128
fi
129129
130130
- |
@@ -180,7 +180,7 @@ install:
180180
SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
181181
git fetch origin $SYMFONY_VERSION &&
182182
git checkout -m FETCH_HEAD &&
183-
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
183+
COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
184184
elif [[ ! $skip ]]; then
185185
SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
186186
fi

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"symfony/polyfill-php72": "~1.5"
3333
},
3434
"replace": {
35+
"symfony/abstractions": "self.version",
3536
"symfony/asset": "self.version",
3637
"symfony/browser-kit": "self.version",
3738
"symfony/cache": "self.version",
@@ -113,6 +114,7 @@
113114
},
114115
"autoload": {
115116
"psr-4": {
117+
"Symfony\\Abstraction\\": "src/Symfony/Abstraction/",
116118
"Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/",
117119
"Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/",
118120
"Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/",

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
<testsuites>
2525
<testsuite name="Symfony Test Suite">
26+
<directory>./src/Symfony/Abstractions/*/Tests/</directory>
2627
<directory>./src/Symfony/Bridge/*/Tests/</directory>
2728
<directory>./src/Symfony/Component/*/Tests/</directory>
2829
<directory>./src/Symfony/Component/*/*/Tests/</directory>
@@ -41,13 +42,15 @@
4142
<whitelist>
4243
<directory>./src/Symfony/</directory>
4344
<exclude>
45+
<directory>./src/Symfony/Abstractions/*/Tests</directory>
4446
<directory>./src/Symfony/Bridge/*/Tests</directory>
4547
<directory>./src/Symfony/Component/*/Tests</directory>
4648
<directory>./src/Symfony/Component/*/*/Tests</directory>
4749
<directory>./src/Symfony/Bundle/*/Tests</directory>
4850
<directory>./src/Symfony/Bundle/*/Resources</directory>
4951
<directory>./src/Symfony/Component/*/Resources</directory>
5052
<directory>./src/Symfony/Component/*/*/Resources</directory>
53+
<directory>./src/Symfony/Abstractions/*/vendor</directory>
5154
<directory>./src/Symfony/Bridge/*/vendor</directory>
5255
<directory>./src/Symfony/Bundle/*/vendor</directory>
5356
<directory>./src/Symfony/Component/*/vendor</directory>

src/Symfony/Abstraction/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
composer.lock
2+
phpunit.xml
3+
vendor/

src/Symfony/Abstraction/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
4.2.0
5+
-----
6+
7+
* added `ResettableInterface`

src/Symfony/Abstraction/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2018 Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

src/Symfony/Abstraction/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Symfony Abstractions
2+
====================
3+
4+
A set of domain specific abstractions maintained by the Symfony community.
5+
6+
Resources
7+
---------
8+
9+
* [Documentation](https://symfony.com/doc/current/components/abstractions.html)
10+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
11+
* [Report issues](https://github.com/symfony/symfony/issues) and
12+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
13+
in the [main Symfony repository](https://github.com/symfony/symfony)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Abstraction;
13+
14+
/**
15+
* Provides a way for objects to be resetted to their initial state.
16+
*/
17+
interface ResettableInterface
18+
{
19+
public function reset();
20+
}

src/Symfony/Abstraction/composer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "symfony/abstractions",
3+
"type": "library",
4+
"description": "A set of domain specific abstractions maintained by the Symfony community",
5+
"keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability"],
6+
"homepage": "https://symfony.com",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "Nicolas Grekas",
11+
"email": "[email protected]"
12+
},
13+
{
14+
"name": "Symfony Community",
15+
"homepage": "https://symfony.com/contributors"
16+
}
17+
],
18+
"require": {
19+
"php": "^7.1.3"
20+
},
21+
"require-dev": {
22+
"cache/integration-tests": "dev-master"
23+
},
24+
"autoload": {
25+
"psr-4": { "Symfony\\Abstraction\\": "" },
26+
"exclude-from-classmap": [
27+
"**/Tests/"
28+
]
29+
},
30+
"minimum-stability": "dev",
31+
"extra": {
32+
"branch-alias": {
33+
"dev-master": "4.2-dev"
34+
}
35+
}
36+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
5+
backupGlobals="false"
6+
colors="true"
7+
bootstrap="vendor/autoload.php"
8+
failOnRisky="true"
9+
failOnWarning="true"
10+
>
11+
<php>
12+
<ini name="error_reporting" value="-1" />
13+
</php>
14+
15+
<testsuites>
16+
<testsuite name="Symfony Abstractions Test Suite">
17+
<directory>./Tests/</directory>
18+
</testsuite>
19+
</testsuites>
20+
21+
<filter>
22+
<whitelist>
23+
<directory>./</directory>
24+
<exclude>
25+
<directory>./Tests</directory>
26+
<directory>./vendor</directory>
27+
</exclude>
28+
</whitelist>
29+
</filter>
30+
31+
</phpunit>

src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Common\Persistence\ManagerRegistry;
1515
use Doctrine\Common\Persistence\ObjectManager;
16+
use Symfony\Abstraction\ResettableInterface;
1617
use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
1718
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
1819
use Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader;
@@ -25,7 +26,7 @@
2526
use Symfony\Component\OptionsResolver\Options;
2627
use Symfony\Component\OptionsResolver\OptionsResolver;
2728

28-
abstract class DoctrineType extends AbstractType
29+
abstract class DoctrineType extends AbstractType implements ResettableInterface
2930
{
3031
/**
3132
* @var ManagerRegistry

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require": {
1919
"php": "^7.1.3",
2020
"doctrine/common": "~2.4",
21+
"symfony/abstractions": "~4.2",
2122
"symfony/polyfill-ctype": "~1.8",
2223
"symfony/polyfill-mbstring": "~1.0"
2324
},

src/Symfony/Bridge/Monolog/Logger.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Monolog;
1313

1414
use Monolog\Logger as BaseLogger;
15+
use Symfony\Abstraction\ResettableInterface;
1516
use Symfony\Component\HttpFoundation\Request;
1617
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
1718

@@ -20,7 +21,7 @@
2021
*
2122
* @author Fabien Potencier <[email protected]>
2223
*/
23-
class Logger extends BaseLogger implements DebugLoggerInterface
24+
class Logger extends BaseLogger implements DebugLoggerInterface, ResettableInterface
2425
{
2526
/**
2627
* {@inheritdoc}
@@ -56,6 +57,14 @@ public function clear()
5657
}
5758
}
5859

60+
/**
61+
* {@inheritdoc}
62+
*/
63+
public function reset()
64+
{
65+
$this->clear();
66+
}
67+
5968
/**
6069
* Returns a DebugLoggerInterface instance if one is registered with this logger.
6170
*

src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
namespace Symfony\Bridge\Monolog\Processor;
1313

1414
use Monolog\Logger;
15+
use Symfony\Abstraction\ResettableInterface;
1516
use Symfony\Component\HttpFoundation\Request;
1617
use Symfony\Component\HttpFoundation\RequestStack;
1718
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
1819

19-
class DebugProcessor implements DebugLoggerInterface
20+
class DebugProcessor implements DebugLoggerInterface, ResettableInterface
2021
{
2122
private $records = array();
2223
private $errorCount = array();
@@ -91,4 +92,12 @@ public function clear()
9192
$this->records = array();
9293
$this->errorCount = array();
9394
}
95+
96+
/**
97+
* {@inheritdoc}
98+
*/
99+
public function reset()
100+
{
101+
$this->clear();
102+
}
94103
}

src/Symfony/Bridge/Monolog/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require": {
1919
"php": "^7.1.3",
2020
"monolog/monolog": "~1.19",
21+
"symfony/abstractions": "~4.2",
2122
"symfony/http-kernel": "~3.4|~4.0"
2223
},
2324
"require-dev": {

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
2020
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
2121
use Symfony\Bundle\FullStack;
22+
use Symfony\Abstraction\ResettableInterface;
2223
use Symfony\Component\Cache\Adapter\AbstractAdapter;
2324
use Symfony\Component\Cache\Adapter\AdapterInterface;
2425
use Symfony\Component\Cache\Adapter\ArrayAdapter;
2526
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
26-
use Symfony\Component\Cache\ResettableInterface;
2727
use Symfony\Component\Config\FileLocator;
2828
use Symfony\Component\Config\Loader\LoaderInterface;
2929
use Symfony\Component\Config\Resource\DirectoryResource;

src/Symfony/Component/Cache/Adapter/ChainAdapter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Psr\Cache\CacheItemInterface;
1515
use Psr\Cache\CacheItemPoolInterface;
16+
use Symfony\Abstraction\ResettableInterface as AbstractionResettableInterface;
1617
use Symfony\Component\Cache\CacheInterface;
1718
use Symfony\Component\Cache\CacheItem;
1819
use Symfony\Component\Cache\Exception\InvalidArgumentException;
@@ -301,7 +302,7 @@ public function prune()
301302
public function reset()
302303
{
303304
foreach ($this->adapters as $adapter) {
304-
if ($adapter instanceof ResettableInterface) {
305+
if ($adapter instanceof AbstractionResettableInterface) {
305306
$adapter->reset();
306307
}
307308
}

src/Symfony/Component/Cache/Adapter/TraceableAdapter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Cache\Adapter;
1313

1414
use Psr\Cache\CacheItemInterface;
15+
use Symfony\Abstraction\ResettableInterface as AbstractionResettableInterface;
1516
use Symfony\Component\Cache\CacheInterface;
1617
use Symfony\Component\Cache\CacheItem;
1718
use Symfony\Component\Cache\PruneableInterface;
@@ -225,7 +226,7 @@ public function prune()
225226
*/
226227
public function reset()
227228
{
228-
if (!$this->pool instanceof ResettableInterface) {
229+
if (!$this->pool instanceof AbstractionResettableInterface) {
229230
return;
230231
}
231232
$event = $this->start(__FUNCTION__);

src/Symfony/Component/Cache/DoctrineProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Common\Cache\CacheProvider;
1515
use Psr\Cache\CacheItemPoolInterface;
16+
use Symfony\Abstraction\ResettableInterface as AbstractionResettableInterface;
1617

1718
/**
1819
* @author Nicolas Grekas <[email protected]>
@@ -39,7 +40,7 @@ public function prune()
3940
*/
4041
public function reset()
4142
{
42-
if ($this->pool instanceof ResettableInterface) {
43+
if ($this->pool instanceof AbstractionResettableInterface) {
4344
$this->pool->reset();
4445
}
4546
$this->setNamespace($this->getNamespace());

src/Symfony/Component/Cache/ResettableInterface.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212
namespace Symfony\Component\Cache;
1313

14+
use Symfony\Abstraction\ResettableInterface as AbstractionResettableInterface;
15+
1416
/**
1517
* Resets a pool's local state.
1618
*/
17-
interface ResettableInterface
19+
interface ResettableInterface extends AbstractionResettableInterface
1820
{
19-
public function reset();
2021
}

src/Symfony/Component/Cache/Simple/ChainCache.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Cache\Simple;
1313

1414
use Psr\SimpleCache\CacheInterface;
15+
use Symfony\Abstraction\ResettableInterface as AbstractionResettableInterface;
1516
use Symfony\Component\Cache\Exception\InvalidArgumentException;
1617
use Symfony\Component\Cache\PruneableInterface;
1718
use Symfony\Component\Cache\ResettableInterface;
@@ -244,7 +245,7 @@ public function prune()
244245
public function reset()
245246
{
246247
foreach ($this->caches as $cache) {
247-
if ($cache instanceof ResettableInterface) {
248+
if ($cache instanceof AbstractionResettableInterface) {
248249
$cache->reset();
249250
}
250251
}

0 commit comments

Comments
 (0)