Skip to content

Commit 8982036

Browse files
Added symfony/contracts: a set of abstractions extracted out of the components
1 parent f20eaf2 commit 8982036

Some content is hidden

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

45 files changed

+288
-45
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
- |
@@ -181,7 +181,7 @@ install:
181181
SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
182182
git fetch origin $SYMFONY_VERSION &&
183183
git checkout -m FETCH_HEAD &&
184-
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
184+
COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
185185
elif [[ ! $skip ]]; then
186186
SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
187187
fi

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"symfony/cache": "self.version",
3838
"symfony/config": "self.version",
3939
"symfony/console": "self.version",
40+
"symfony/contracts": "1.0.0",
4041
"symfony/css-selector": "self.version",
4142
"symfony/dependency-injection": "self.version",
4243
"symfony/debug": "self.version",
@@ -118,7 +119,8 @@
118119
"Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/",
119120
"Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/",
120121
"Symfony\\Bundle\\": "src/Symfony/Bundle/",
121-
"Symfony\\Component\\": "src/Symfony/Component/"
122+
"Symfony\\Component\\": "src/Symfony/Component/",
123+
"Symfony\\Contract\\": "src/Symfony/Contract/"
122124
},
123125
"classmap": [
124126
"src/Symfony/Component/Intl/Resources/stubs"

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<directory>./src/Symfony/Bridge/*/Tests/</directory>
2727
<directory>./src/Symfony/Component/*/Tests/</directory>
2828
<directory>./src/Symfony/Component/*/*/Tests/</directory>
29+
<directory>./src/Symfony/Contract/*/Tests/</directory>
2930
<directory>./src/Symfony/Bundle/*/Tests/</directory>
3031
</testsuite>
3132
</testsuites>
@@ -44,6 +45,7 @@
4445
<directory>./src/Symfony/Bridge/*/Tests</directory>
4546
<directory>./src/Symfony/Component/*/Tests</directory>
4647
<directory>./src/Symfony/Component/*/*/Tests</directory>
48+
<directory>./src/Symfony/Contract/*/Tests</directory>
4749
<directory>./src/Symfony/Bundle/*/Tests</directory>
4850
<directory>./src/Symfony/Bundle/*/Resources</directory>
4951
<directory>./src/Symfony/Component/*/Resources</directory>
@@ -52,6 +54,7 @@
5254
<directory>./src/Symfony/Bundle/*/vendor</directory>
5355
<directory>./src/Symfony/Component/*/vendor</directory>
5456
<directory>./src/Symfony/Component/*/*/vendor</directory>
57+
<directory>./src/Symfony/Contract/*/vendor</directory>
5558
</exclude>
5659
</whitelist>
5760
</filter>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
use Symfony\Component\Form\FormBuilderInterface;
2525
use Symfony\Component\OptionsResolver\Options;
2626
use Symfony\Component\OptionsResolver\OptionsResolver;
27+
use Symfony\Contract\Service\ResetInterface;
2728

28-
abstract class DoctrineType extends AbstractType
29+
abstract class DoctrineType extends AbstractType implements ResetInterface
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@stable",
21+
"symfony/contracts": "^1.0",
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
@@ -14,13 +14,14 @@
1414
use Monolog\Logger as BaseLogger;
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
17+
use Symfony\Contract\Service\ResetInterface;
1718

1819
/**
1920
* Logger.
2021
*
2122
* @author Fabien Potencier <[email protected]>
2223
*/
23-
class Logger extends BaseLogger implements DebugLoggerInterface
24+
class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface
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
@@ -15,8 +15,9 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\RequestStack;
1717
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
18+
use Symfony\Contract\Service\ResetInterface;
1819

19-
class DebugProcessor implements DebugLoggerInterface
20+
class DebugProcessor implements DebugLoggerInterface, ResetInterface
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/contracts": "^1.0",
2122
"symfony/http-kernel": "~3.4|~4.0"
2223
},
2324
"require-dev": {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Symfony\Component\Cache\Adapter\ArrayAdapter;
2626
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
2727
use Symfony\Component\Cache\Marshaller\DefaultMarshaller;
28-
use Symfony\Component\Cache\ResettableInterface;
2928
use Symfony\Component\Config\FileLocator;
3029
use Symfony\Component\Config\Loader\LoaderInterface;
3130
use Symfony\Component\Config\Resource\DirectoryResource;
@@ -95,6 +94,7 @@
9594
use Symfony\Component\Workflow;
9695
use Symfony\Component\Yaml\Command\LintCommand as BaseYamlLintCommand;
9796
use Symfony\Component\Yaml\Yaml;
97+
use Symfony\Contract\Service\ResetInterface;
9898

9999
/**
100100
* FrameworkExtension.
@@ -324,7 +324,7 @@ public function load(array $configs, ContainerBuilder $container)
324324
->addTag('kernel.cache_warmer');
325325
$container->registerForAutoconfiguration(EventSubscriberInterface::class)
326326
->addTag('kernel.event_subscriber');
327-
$container->registerForAutoconfiguration(ResettableInterface::class)
327+
$container->registerForAutoconfiguration(ResetInterface::class)
328328
->addTag('kernel.reset', array('method' => 'reset'));
329329
$container->registerForAutoconfiguration(ProcessorInterface::class)
330330
->addTag('monolog.processor');

0 commit comments

Comments
 (0)