Skip to content

Commit

Permalink
[BC] Remove deprecated code for Symfony 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme Poskin committed Sep 25, 2015
1 parent f2824cf commit d5a9664
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Tests/Twig/Extension/DateExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testGetName()
public function testGetFilters()
{
$filters = $this->extension->getFilters();
$this->assertInstanceOf('\Twig_Filter_Method', $filters['time_ago']);
$this->assertInstanceOf('\Twig_SimpleFilter', $filters['time_ago']);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Tests/Twig/Extension/TextExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testGetName()
public function testGetFilters()
{
$filters = $this->extension->getFilters();
$this->assertInstanceOf('\Twig_Filter_Method', $filters['safe_truncate']);
$this->assertInstanceOf('\Twig_SimpleFilter', $filters['safe_truncate']);
}

/**
Expand Down Expand Up @@ -100,7 +100,7 @@ private function assertSafeTruncate()
{
$separator = '...';

$env = $this->getMock('\Twig_Environment');
$env = $this->getMock('\Twig_Environment', [], [], '', false);
$env->expects($this->any())->method('getCharset')->will($this->returnValue('utf8'));

// Simple text
Expand Down
2 changes: 1 addition & 1 deletion Tests/Validator/PasswordStrengthValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PasswordStrengthValidatorTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false);
$this->context = $this->getMock('Symfony\Component\Validator\Context\ExecutionContext', array(), array(), '', false);
$this->validator = new PasswordStrengthValidator();
$this->validator->initialize($this->context);
}
Expand Down
8 changes: 4 additions & 4 deletions Twig/Extension/DateExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
class DateExtension extends \Twig_Extension
{
/**
* @var Translator
* @var TranslatorInterface
*/
private $translator;

/**
* Date extension constructor
*
* @param Translator $translator
* @param TranslatorInterface $translator
*/
public function __construct(TranslatorInterface $translator)
{
Expand All @@ -29,7 +29,7 @@ public function __construct(TranslatorInterface $translator)
public function getFilters()
{
return array(
'time_ago' => new \Twig_Filter_Method($this, 'timeAgo'),
'time_ago' => new \Twig_SimpleFilter($this, 'timeAgo'),
);
}

Expand Down Expand Up @@ -81,7 +81,7 @@ public function timeAgo($datetime, $locale = null)
/**
* Helper used to get a date interval between a date and now
*
* @param string|DateTime $datetime
* @param string|\DateTime $datetime
*
* @return \DateInterval
*/
Expand Down
2 changes: 1 addition & 1 deletion Twig/Extension/FacebookExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function initRuntime(\Twig_Environment $environment)
public function getFunctions()
{
return array(
'faceboook_sdk_code' => new \Twig_Function_Method($this, 'getFacebookSdkCode', array('is_safe' => array('html'))),
'faceboook_sdk_code' => new \Twig_SimpleFunction($this, 'getFacebookSdkCode', array('is_safe' => array('html'))),
);
}

Expand Down
6 changes: 3 additions & 3 deletions Twig/Extension/GoogleExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public function initRuntime(\Twig_Environment $environment)
public function getFunctions()
{
return array(
'analytics_tracking_code' => new \Twig_Function_Method($this, 'getAnalyticsTrackingCode', array('is_safe' => array('html'))),
'analytics_tracking_commerce' => new \Twig_Function_Method($this, 'getAnalyticsCommerce', array('is_safe' => array('html'))),
'tags_manager_code' => new \Twig_Function_Method($this, 'getTagsManagerCode', array('is_safe' => array('html'))),
'analytics_tracking_code' => new \Twig_SimpleFunction($this, 'getAnalyticsTrackingCode', array('is_safe' => array('html'))),
'analytics_tracking_commerce' => new \Twig_SimpleFunction($this, 'getAnalyticsCommerce', array('is_safe' => array('html'))),
'tags_manager_code' => new \Twig_SimpleFunction($this, 'getTagsManagerCode', array('is_safe' => array('html'))),
);
}

Expand Down
12 changes: 6 additions & 6 deletions Twig/Extension/NavigationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public function __construct(NavigationRegistry $registry)
public function getFunctions()
{
return array(
'set_active_paths' => new \Twig_Function_Method($this, 'setActivePaths'),
'add_active_path' => new \Twig_Function_Method($this, 'addActivePath'),
'set_active_paths' => new \Twig_SimpleFunction($this, 'setActivePaths'),
'add_active_path' => new \Twig_SimpleFunction($this, 'addActivePath'),
'get_active_paths' => new \Twig_Function_Method($this, 'getActivePaths'),
'is_active_path' => new \Twig_Function_Method($this, 'isActivePath'),
'append_breadcrumb' => new \Twig_Function_Method($this, 'appendBreadcrumb'),
'prepend_breadcrumb' => new \Twig_Function_Method($this, 'prependBreadcrumb'),
'get_breadcrumbs' => new \Twig_Function_Method($this, 'getBreadCrumbs'),
'is_active_path' => new \Twig_SimpleFunction($this, 'isActivePath'),
'append_breadcrumb' => new \Twig_SimpleFunction($this, 'appendBreadcrumb'),
'prepend_breadcrumb' => new \Twig_SimpleFunction($this, 'prependBreadcrumb'),
'get_breadcrumbs' => new \Twig_SimpleFunction($this, 'getBreadCrumbs'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion Twig/Extension/PaginatorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function initRuntime(\Twig_Environment $environment)
public function getFunctions()
{
return array(
'paginator_widget' => new \Twig_Function_Method($this, 'renderPaginatorWidget', array('is_safe' => array('html'))),
'paginator_widget' => new \Twig_SimpleFunction($this, 'renderPaginatorWidget', array('is_safe' => array('html'))),
);
}

Expand Down
14 changes: 7 additions & 7 deletions Twig/Extension/SiteExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class SiteExtension extends \Twig_Extension
public function getFunctions()
{
return array(
'prepend_page_title' => new \Twig_Function_Method($this, 'prependPageTitle'),
'append_page_title' => new \Twig_Function_Method($this, 'appendPageTitle'),
'page_title' => new \Twig_Function_Method($this, 'getPageTitle'),
'meta_description' => new \Twig_Function_Method($this, 'getMetaDescription'),
'set_meta_description' => new \Twig_Function_Method($this, 'setMetaDescription'),
'meta_keywords' => new \Twig_Function_Method($this, 'getMetaKeywords'),
'add_meta_keywords' => new \Twig_Function_Method($this, 'addMetaKeywords'),
'prepend_page_title' => new \Twig_SimpleFunction($this, 'prependPageTitle'),
'append_page_title' => new \Twig_SimpleFunction($this, 'appendPageTitle'),
'page_title' => new \Twig_SimpleFunction($this, 'getPageTitle'),
'meta_description' => new \Twig_SimpleFunction($this, 'getMetaDescription'),
'set_meta_description' => new \Twig_SimpleFunction($this, 'setMetaDescription'),
'meta_keywords' => new \Twig_SimpleFunction($this, 'getMetaKeywords'),
'add_meta_keywords' => new \Twig_SimpleFunction($this, 'addMetaKeywords'),
);
}

Expand Down
4 changes: 2 additions & 2 deletions Twig/Extension/TextExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public function getName()
public function getFilters()
{
return array(
'camelize' => new \Twig_Filter_Method($this, 'camelize', array('is_safe' => array('html'))),
'safe_truncate' => new \Twig_Filter_Method($this, 'safeTruncate', array('needs_environment' => true, 'is_safe' => array('html'))),
'camelize' => new \Twig_SimpleFilter($this, 'camelize', array('is_safe' => array('html'))),
'safe_truncate' => new \Twig_SimpleFilter($this, 'safeTruncate', array('needs_environment' => true, 'is_safe' => array('html'))),
);
}

Expand Down
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@
"homepage": "http://www.snowcap.be"
}
],
"minimum-stability": "dev",
"minimum-stability": "stable",
"require": {
"php": ">=5.3.3",
"symfony/framework-bundle": ">=2.7"
},
"require-dev": {
"symfony/symfony": ">=2.7",
"fzaninotto/faker": "1.1.*@dev",
"doctrine/orm": ">=2.2.3",
"doctrine/doctrine-bundle": "1.2.*",
"doctrine/data-fixtures": "1.0.*@dev"
"fzaninotto/faker": "^1.5",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.5",
"doctrine/data-fixtures": "^1.1",
"phpunit/phpunit": "^4.8",
"symfony/phpunit-bridge": "^2.7"
},
"autoload": {
"psr-0": { "Snowcap\\CoreBundle": "" }
Expand Down

0 comments on commit d5a9664

Please sign in to comment.