Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow php 7 #121

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
phpunit.xml
vendor/

composer.lock
34 changes: 26 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
language: php

sudo: false

cache:
directories:
- "$HOME/.composer/cache"

php:
- 5.5
- 5.6
- 5.5
- 5.6
- 7.0
- hhvm
- 7

before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev
matrix:
include:
- php: 5.6
env: SYMFONY_VERSION="2.3.*"
- php: 5.6
env: SYMFONY_VERSION="2.7.*"
- php: 5.6
env: SYMFONY_VERSION="2.8.*"
- php: 5.6
env: SYMFONY_VERSION="3.0.*"

script: phpunit --coverage-clover clover
before_install: if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony:${SYMFONY_VERSION}; fi

after_success:
- curl -sL https://bit.ly/artifact-uploader | php
install: composer update

script: phpunit --coverage-clover clover

after_success: curl -sL https://bit.ly/artifact-uploader | php
2 changes: 1 addition & 1 deletion Command/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ private function getCommandProcessBuilder()
}

$pb
->add('php')
->add($this->getContainer()->getParameter('jms_job_queue.php_binary'))
->add($this->getContainer()->getParameter('kernel.root_dir').'/console')
->add('--env='.$this->env)
;
Expand Down
5 changes: 3 additions & 2 deletions Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
use Symfony\Component\HttpKernel\KernelInterface;

/**
Expand Down Expand Up @@ -89,7 +90,7 @@ private function saveDebugInformation(\Exception $ex = null)
'id' => $jobId,
'memoryUsage' => memory_get_peak_usage(),
'memoryUsageReal' => memory_get_peak_usage(true),
'trace' => serialize($ex ? FlattenException::create($ex) : null),
'trace' => serialize($ex ? (class_exists(FlattenException::class) ? FlattenException::create($ex) : LegacyFlattenException::create($ex)) : null),
),
array(
'id' => \PDO::PARAM_INT,
Expand Down
2 changes: 1 addition & 1 deletion Controller/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class JobController
private $statisticsEnabled;

/**
* @Route("/", name = "jms_jobs_overview")
* @Route("/overview", name = "jms_jobs_overview")
* @Template("JMSJobQueueBundle:Job:overview.html.twig")
*/
public function overviewAction()
Expand Down
3 changes: 2 additions & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public function getConfigTreeBuilder()

$rootNode
->children()
->booleanNode('statistics')->defaultTrue()->end();
->booleanNode('statistics')->defaultTrue()->end()
->scalarNode('php_binary')->defaultValue('php')->end();

$defaultOptionsNode = $rootNode
->children()
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/JMSJobQueueExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('statistics.xml');
}

$container->setParameter('jms_job_queue.php_binary', $config['php_binary']);
$container->setParameter('jms_job_queue.queue_options_defaults', $config['queue_options_defaults']);
$container->setParameter('jms_job_queue.queue_options', $config['queue_options']);
}
Expand Down
8 changes: 6 additions & 2 deletions Entity/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
use Doctrine\ORM\Mapping as ORM;
use JMS\JobQueueBundle\Exception\InvalidStateTransitionException;
use JMS\JobQueueBundle\Exception\LogicException;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;

/**
* @ORM\Entity(repositoryClass = "JMS\JobQueueBundle\Entity\Repository\JobRepository")
Expand Down Expand Up @@ -569,8 +570,11 @@ public function getCheckedAt()
return $this->checkedAt;
}

public function setStackTrace(FlattenException $ex)
public function setStackTrace($ex)
{
if(!$ex instanceof FlattenException && !$ex instanceof LegacyFlattenException) {
throw new \InvalidArgumentException(sprintf('Parameter of %s must be an instance of %s or %s.', __METHOD__, FlattenException::class, LegacyFlattenException::class));
}
$this->stackTrace = $ex;
}

Expand Down
12 changes: 0 additions & 12 deletions Tests/bootstrap.php

This file was deleted.

4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@
"sensio/framework-extra-bundle": "Required when using the webinterface.",
"symfony/twig-bundle": "Required when using the webinterface."
},
"minimum-stability": "dev",
"autoload": {
"psr-0": { "JMS\\JobQueueBundle": "" }
"psr-4": { "JMS\\JobQueueBundle\\": "" }
},
"target-dir": "JMS/JobQueueBundle",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./Tests/bootstrap.php"
bootstrap="vendor/autoload.php"
>

<testsuites>
Expand Down