Skip to content

Commit

Permalink
Merge pull request #892 from alcaeus/drop-old-stuff
Browse files Browse the repository at this point in the history
Drop support for PHP < 7.1 and Symfony < 3.4
  • Loading branch information
alcaeus committed Dec 23, 2018
2 parents 4725c6d + 2279d8a commit ad278ef
Show file tree
Hide file tree
Showing 23 changed files with 143 additions and 409 deletions.
36 changes: 21 additions & 15 deletions .travis.yml
Expand Up @@ -7,11 +7,9 @@ cache:
- $HOME/.composer/cache

php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- nightly

env:
Expand All @@ -31,45 +29,53 @@ script:

jobs:
include:
- php: 5.5
env: deps=low SYMFONY_DEPRECATIONS_HELPER=weak
# Tests the lowest set of dependencies
- php: 7.1
env: deps=low SYMFONY_DEPRECATIONS_HELPER=999999
install:
- COMPOSER_MEMORY_LIMIT=-1 travis_retry composer update -n --prefer-lowest --prefer-stable --prefer-dist

- php: 5.6
env: SYMFONY_VERSION="2.8.*"

- php: 7.0
env: SYMFONY_VERSION="3.2.*"
# Test against latest Symfony 3.4 stable
- php: 7.1
env: SYMFONY_VERSION="3.4.*" SYMFONY_DEPRECATIONS_HELPER=999999

# Test against latest Symfony 3.4 dev version
- php: 7.1
env: stability=RC SYMFONY_DEPRECATIONS_HELPER=weak SYMFONY_VERSION="3.4.*"
env: stability=dev SYMFONY_DEPRECATIONS_HELPER=999999 SYMFONY_VERSION="3.4.*"
install:
- travis_retry composer update -n --prefer-dist

# Test against latest Symfony 4.1 dev version
- php: 7.1
env: stability=dev SYMFONY_DEPRECATIONS_HELPER=weak SYMFONY_VERSION="4.1.*"
env: stability=dev SYMFONY_DEPRECATIONS_HELPER=999999 SYMFONY_VERSION="4.1.*"
install:
- composer require --dev "symfony/messenger:4.1.*" --no-update
- travis_retry composer update -n --prefer-dist

# Test against latest Symfony 4.2 dev version
- php: 7.1
env: stability=dev SYMFONY_DEPRECATIONS_HELPER=weak SYMFONY_VERSION="4.2.*"
env: stability=dev SYMFONY_VERSION="4.2.*"
install:
- composer require --dev "symfony/messenger:4.2.*" --no-update
- travis_retry composer update -n --prefer-dist

# Test alpha packages
- php: 7.2
env: stability=alpha
install:
- composer config minimum-stability alpha
- travis_retry composer update -n --prefer-dist

# Test dev level software
- php: nightly
env: stability=dev
install:
- composer config minimum-stability dev
- travis_retry composer update -n --prefer-dist

- stage: Code Quality
env: CODING_STANDARDS
php: 7.1
install:
- travis_retry composer require -n --prefer-dist --dev doctrine/coding-standard:^5.0
script:
- ./vendor/bin/phpcs

Expand Down
24 changes: 10 additions & 14 deletions Command/Proxy/CollectionRegionDoctrineCommand.php
Expand Up @@ -3,11 +3,14 @@
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;

use Doctrine\ORM\Tools\Console\Command\ClearCache\CollectionRegionCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Command to clear a collection cache region.
*/
class CollectionRegionDoctrineCommand extends DelegateCommand
class CollectionRegionDoctrineCommand extends CollectionRegionCommand
{
/**
* {@inheritDoc}
Expand All @@ -16,22 +19,15 @@ protected function configure()
{
parent::configure();

$this->setName('doctrine:cache:clear-collection-region');
$this
->setName('doctrine:cache:clear-collection-region')
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
}

/**
* {@inheritDoc}
*/
protected function createCommand()
protected function execute(InputInterface $input, OutputInterface $output)
{
return new CollectionRegionCommand();
}
DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));

/**
* {@inheritDoc}
*/
protected function getMinimalVersion()
{
return '2.5.0-DEV';
return parent::execute($input, $output);
}
}
24 changes: 10 additions & 14 deletions Command/Proxy/EntityRegionCacheDoctrineCommand.php
Expand Up @@ -3,11 +3,14 @@
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;

use Doctrine\ORM\Tools\Console\Command\ClearCache\EntityRegionCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Command to clear a entity cache region.
*/
class EntityRegionCacheDoctrineCommand extends DelegateCommand
class EntityRegionCacheDoctrineCommand extends EntityRegionCommand
{
/**
* {@inheritDoc}
Expand All @@ -16,22 +19,15 @@ protected function configure()
{
parent::configure();

$this->setName('doctrine:cache:clear-entity-region');
$this
->setName('doctrine:cache:clear-entity-region')
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
}

/**
* {@inheritDoc}
*/
protected function createCommand()
protected function execute(InputInterface $input, OutputInterface $output)
{
return new EntityRegionCommand();
}
DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));

/**
* {@inheritDoc}
*/
protected function getMinimalVersion()
{
return '2.5.0-DEV';
return parent::execute($input, $output);
}
}
24 changes: 10 additions & 14 deletions Command/Proxy/QueryRegionCacheDoctrineCommand.php
Expand Up @@ -3,11 +3,14 @@
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;

use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryRegionCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Command to clear a query cache region.
*/
class QueryRegionCacheDoctrineCommand extends DelegateCommand
class QueryRegionCacheDoctrineCommand extends QueryRegionCommand
{
/**
* {@inheritDoc}
Expand All @@ -16,22 +19,15 @@ protected function configure()
{
parent::configure();

$this->setName('doctrine:cache:clear-query-region');
$this
->setName('doctrine:cache:clear-query-region')
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
}

/**
* {@inheritDoc}
*/
protected function createCommand()
protected function execute(InputInterface $input, OutputInterface $output)
{
return new QueryRegionCommand();
}
DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));

/**
* {@inheritDoc}
*/
protected function getMinimalVersion()
{
return '2.5.0-DEV';
return parent::execute($input, $output);
}
}
18 changes: 5 additions & 13 deletions DataCollector/DoctrineDataCollector.php
Expand Up @@ -10,7 +10,6 @@
use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Tools\SchemaValidator;
use Doctrine\ORM\Version;
use Exception;
use Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector as BaseCollector;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -84,10 +83,6 @@ public function collect(Request $request, Response $response, Exception $excepti
$errors[$name][$class->getName()] = $classErrors;
}

if (version_compare(Version::VERSION, '2.5.0-DEV') < 0) {
continue;
}

/** @var Configuration $emConfig */
$emConfig = $em->getConfiguration();
$slcEnabled = $emConfig->isSecondLevelCacheEnabled();
Expand Down Expand Up @@ -140,14 +135,11 @@ public function collect(Request $request, Response $response, Exception $excepti
}
}

// HttpKernel < 3.2 compatibility layer
if (method_exists($this, 'cloneVar')) {
// Might be good idea to replicate this block in doctrine bridge so we can drop this from here after some time.
// This code is compatible with such change, because cloneVar is supposed to check if input is already cloned.
foreach ($this->data['queries'] as &$queries) {
foreach ($queries as &$query) {
$query['params'] = $this->cloneVar($query['params']);
}
// Might be good idea to replicate this block in doctrine bridge so we can drop this from here after some time.
// This code is compatible with such change, because cloneVar is supposed to check if input is already cloned.
foreach ($this->data['queries'] as &$queries) {
foreach ($queries as &$query) {
$query['params'] = $this->cloneVar($query['params']);
}
}

Expand Down
10 changes: 0 additions & 10 deletions DependencyInjection/Compiler/ServiceRepositoryCompilerPass.php
Expand Up @@ -5,7 +5,6 @@
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Reference;

final class ServiceRepositoryCompilerPass implements CompilerPassInterface
Expand All @@ -23,15 +22,6 @@ public function process(ContainerBuilder $container)

$repoServiceIds = array_keys($container->findTaggedServiceIds(self::REPOSITORY_SERVICE_TAG));

// Symfony 3.2 and lower sanity check
if (! class_exists(ServiceLocatorTagPass::class)) {
if (! empty($repoServiceIds)) {
throw new RuntimeException(sprintf('The "%s" tag can only be used with Symfony 3.3 or higher. Remove the tag from the following services (%s) or upgrade to Symfony 3.3 or higher.', self::REPOSITORY_SERVICE_TAG, implode(', ', $repoServiceIds)));
}

return;
}

$repoReferences = array_map(static function ($id) {
return new Reference($id);
}, $repoServiceIds);
Expand Down

0 comments on commit ad278ef

Please sign in to comment.