From 2acbaaf33dea7bb3b6ff857faefec0f6aa7f0869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Youn=C3=A8s=20El=20Biache?= Date: Sat, 5 Dec 2015 10:51:02 +0100 Subject: [PATCH 1/3] renamed Type classes for php7 support --- src/Ladybug/Resources/container/types.xml | 12 ++++++------ src/Ladybug/Type/{Bool.php => BoolType.php} | 2 +- src/Ladybug/Type/{Float.php => FloatType.php} | 2 +- src/Ladybug/Type/{Int.php => IntType.php} | 2 +- src/Ladybug/Type/{Null.php => NullType.php} | 2 +- src/Ladybug/Type/{Resource.php => ResourceType.php} | 2 +- src/Ladybug/Type/{String.php => StringType.php} | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) rename src/Ladybug/Type/{Bool.php => BoolType.php} (96%) rename src/Ladybug/Type/{Float.php => FloatType.php} (98%) rename src/Ladybug/Type/{Int.php => IntType.php} (95%) rename src/Ladybug/Type/{Null.php => NullType.php} (96%) rename src/Ladybug/Type/{Resource.php => ResourceType.php} (99%) rename src/Ladybug/Type/{String.php => StringType.php} (98%) diff --git a/src/Ladybug/Resources/container/types.xml b/src/Ladybug/Resources/container/types.xml index 40ffd1c..719c57b 100644 --- a/src/Ladybug/Resources/container/types.xml +++ b/src/Ladybug/Resources/container/types.xml @@ -6,23 +6,23 @@ - + - + - + - + - + @@ -41,7 +41,7 @@ - + diff --git a/src/Ladybug/Type/Bool.php b/src/Ladybug/Type/BoolType.php similarity index 96% rename from src/Ladybug/Type/Bool.php rename to src/Ladybug/Type/BoolType.php index 427d968..5da17be 100644 --- a/src/Ladybug/Type/Bool.php +++ b/src/Ladybug/Type/BoolType.php @@ -16,7 +16,7 @@ /** * Bool is an abstraction of a primitive variable of type 'bool' */ -class Bool extends AbstractType +class BoolType extends AbstractType { const TYPE_ID = 'bool'; diff --git a/src/Ladybug/Type/Float.php b/src/Ladybug/Type/FloatType.php similarity index 98% rename from src/Ladybug/Type/Float.php rename to src/Ladybug/Type/FloatType.php index 4349a79..ccda285 100644 --- a/src/Ladybug/Type/Float.php +++ b/src/Ladybug/Type/FloatType.php @@ -16,7 +16,7 @@ /** * Float is an abstraction of a primitive variable of type 'float' */ -class Float extends AbstractType +class FloatType extends AbstractType { const TYPE_ID = 'float'; diff --git a/src/Ladybug/Type/Int.php b/src/Ladybug/Type/IntType.php similarity index 95% rename from src/Ladybug/Type/Int.php rename to src/Ladybug/Type/IntType.php index 33098e3..b0cbb25 100644 --- a/src/Ladybug/Type/Int.php +++ b/src/Ladybug/Type/IntType.php @@ -16,7 +16,7 @@ /** * Int is an abstraction of a primitive variable of type 'int' */ -class Int extends AbstractType +class IntType extends AbstractType { const TYPE_ID = 'int'; diff --git a/src/Ladybug/Type/Null.php b/src/Ladybug/Type/NullType.php similarity index 96% rename from src/Ladybug/Type/Null.php rename to src/Ladybug/Type/NullType.php index 41e82fd..009a7fd 100644 --- a/src/Ladybug/Type/Null.php +++ b/src/Ladybug/Type/NullType.php @@ -16,7 +16,7 @@ /** * Null is an abstraction of a primitive variable of type 'null' */ -class Null extends AbstractType +class NullType extends AbstractType { const TYPE_ID = 'null'; diff --git a/src/Ladybug/Type/Resource.php b/src/Ladybug/Type/ResourceType.php similarity index 99% rename from src/Ladybug/Type/Resource.php rename to src/Ladybug/Type/ResourceType.php index 3e3a967..e654bcb 100644 --- a/src/Ladybug/Type/Resource.php +++ b/src/Ladybug/Type/ResourceType.php @@ -18,7 +18,7 @@ use Ladybug\Inspector\InspectorManager; use Ladybug\Model\VariableWrapper; -class Resource extends AbstractType +class ResourceType extends AbstractType { const TYPE_ID = 'resource'; diff --git a/src/Ladybug/Type/String.php b/src/Ladybug/Type/StringType.php similarity index 98% rename from src/Ladybug/Type/String.php rename to src/Ladybug/Type/StringType.php index 6e18f9d..ddb248e 100644 --- a/src/Ladybug/Type/String.php +++ b/src/Ladybug/Type/StringType.php @@ -16,7 +16,7 @@ /** * String is an abstraction of a primitive variable of type 'string' */ -class String extends AbstractType +class StringType extends AbstractType { const TYPE_ID = 'string'; From 995e33767241d0c2436c6efb17227c714d89ccc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Youn=C3=A8s=20El=20Biache?= Date: Tue, 8 Dec 2015 20:22:09 +0100 Subject: [PATCH 2/3] fix tests for previous commit --- .travis.yml | 1 + .../Tests/Model/VariableWrapperTest.php | 2 +- .../Type/{BoolTest.php => BoolTypeTest.php} | 4 +-- tests/Ladybug/Tests/Type/FactoryTypeTest.php | 28 +++++++++---------- .../Type/{FloatTest.php => FloatTypeTest.php} | 4 +-- .../Type/{IntTest.php => IntTypeTest.php} | 4 +-- .../Type/{NullTest.php => NullTypeTest.php} | 4 +-- .../BadTypeHintedParameterContainerTest.php | 4 +-- .../Tests/Type/Object/ContainerTest.php | 12 ++++---- ...{ResourceTest.php => ResourceTypeTest.php} | 6 ++-- .../{StringTest.php => StringTypeTest.php} | 4 +-- .../Tests/Type/Vector/ContainerTest.php | 4 +-- 12 files changed, 39 insertions(+), 38 deletions(-) rename tests/Ladybug/Tests/Type/{BoolTest.php => BoolTypeTest.php} (90%) rename tests/Ladybug/Tests/Type/{FloatTest.php => FloatTypeTest.php} (92%) rename tests/Ladybug/Tests/Type/{IntTest.php => IntTypeTest.php} (86%) rename tests/Ladybug/Tests/Type/{NullTest.php => NullTypeTest.php} (87%) rename tests/Ladybug/Tests/Type/{ResourceTest.php => ResourceTypeTest.php} (84%) rename tests/Ladybug/Tests/Type/{StringTest.php => StringTypeTest.php} (88%) diff --git a/.travis.yml b/.travis.yml index afea587..b864c2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm-nightly matrix: diff --git a/tests/Ladybug/Tests/Model/VariableWrapperTest.php b/tests/Ladybug/Tests/Model/VariableWrapperTest.php index 37e8baf..603c5e2 100644 --- a/tests/Ladybug/Tests/Model/VariableWrapperTest.php +++ b/tests/Ladybug/Tests/Model/VariableWrapperTest.php @@ -10,7 +10,7 @@ class VariableWrapperTest extends \PHPUnit_Framework_TestCase public function testObjectCreation() { - $var = new \Ladybug\Type\Int(); + $var = new \Ladybug\Type\IntType(); $var->load(1); $variableWrapper = new VariableWrapper(1, $var, VariableWrapper::TYPE_CLASS); diff --git a/tests/Ladybug/Tests/Type/BoolTest.php b/tests/Ladybug/Tests/Type/BoolTypeTest.php similarity index 90% rename from tests/Ladybug/Tests/Type/BoolTest.php rename to tests/Ladybug/Tests/Type/BoolTypeTest.php index f473c4c..750a743 100644 --- a/tests/Ladybug/Tests/Type/BoolTest.php +++ b/tests/Ladybug/Tests/Type/BoolTypeTest.php @@ -4,7 +4,7 @@ use Ladybug\Type; -class BoolTest extends \PHPUnit_Framework_TestCase +class BoolTypeTest extends \PHPUnit_Framework_TestCase { /** @var Type\Bool $type */ @@ -12,7 +12,7 @@ class BoolTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->type = new Type\Bool(); + $this->type = new Type\BoolType(); } public function testLoaderForValidValues() diff --git a/tests/Ladybug/Tests/Type/FactoryTypeTest.php b/tests/Ladybug/Tests/Type/FactoryTypeTest.php index cb234ff..8a42175 100644 --- a/tests/Ladybug/Tests/Type/FactoryTypeTest.php +++ b/tests/Ladybug/Tests/Type/FactoryTypeTest.php @@ -16,7 +16,7 @@ public function setUp() /*$maxlevel = 8; $factoryTypeMock = m::mock('Ladybug\Type\FactoryType'); - $factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturn(new Type\Int()); + $factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturn(new Type\IntType()); */ $managerInspectorMock = m::mock('Ladybug\Inspector\InspectorManager'); @@ -26,14 +26,14 @@ public function setUp() $metadataResolverMock->shouldReceive('has')->andReturn(false); $this->factory = new Type\FactoryType(); - $this->factory->add(new Type\Int(), 'type_int'); - $this->factory->add(new Type\Bool(), 'type_bool'); - $this->factory->add(new Type\Null(), 'type_null'); - $this->factory->add(new Type\Float(), 'type_float'); - $this->factory->add(new Type\String(), 'type_string'); + $this->factory->add(new Type\IntType(), 'type_int'); + $this->factory->add(new Type\BoolType(), 'type_bool'); + $this->factory->add(new Type\NullType(), 'type_null'); + $this->factory->add(new Type\FloatType(), 'type_float'); + $this->factory->add(new Type\StringType(), 'type_string'); $this->factory->add(new Type\Vector\Container(8, $this->factory), 'type_array'); $this->factory->add(new Type\Object\Container(8, $this->factory, $managerInspectorMock, $metadataResolverMock), 'type_object'); - $this->factory->add(new Type\Resource($this->factory, $managerInspectorMock, $metadataResolverMock), 'type_resource'); + $this->factory->add(new Type\ResourceType($this->factory, $managerInspectorMock, $metadataResolverMock), 'type_resource'); } public function tearDown() @@ -45,35 +45,35 @@ public function testFactoryForIntValues() { $var = 1; $type = $this->factory->factory($var); - $this->assertEquals('Ladybug\\Type\\Int', get_class($type)); + $this->assertEquals('Ladybug\\Type\\IntType', get_class($type)); } public function testFactoryForBoolValues() { $var = true; $type = $this->factory->factory($var); - $this->assertEquals('Ladybug\\Type\\Bool', get_class($type)); + $this->assertEquals('Ladybug\\Type\\BoolType', get_class($type)); } public function testFactoryForFloatValues() { $var = 1.2; $type = $this->factory->factory($var); - $this->assertEquals('Ladybug\\Type\\Float', get_class($type)); + $this->assertEquals('Ladybug\\Type\\FloatType', get_class($type)); } public function testFactoryForNullValues() { $var = null; $type = $this->factory->factory($var); - $this->assertEquals('Ladybug\\Type\\Null', get_class($type)); + $this->assertEquals('Ladybug\\Type\\NullType', get_class($type)); } public function testFactoryForStringValues() { $var = 'test'; $type = $this->factory->factory($var); - $this->assertEquals('Ladybug\\Type\\String', get_class($type)); + $this->assertEquals('Ladybug\\Type\\StringType', get_class($type)); } public function testFactoryForArrayValues() @@ -94,7 +94,7 @@ public function testFactoryForResourceValues() { $var = fopen(__DIR__ . '/../../../files/test.txt', 'rb'); $type = $this->factory->factory($var); - $this->assertInstanceOf('Ladybug\\Type\\Resource', $type); + $this->assertInstanceOf('Ladybug\\Type\\ResourceType', $type); } public function testFactoryForUnknownResourceValues() @@ -102,7 +102,7 @@ public function testFactoryForUnknownResourceValues() $var = fopen(__DIR__ . '/../../../files/test.txt', 'rb'); fclose($var); // Turns resource into type "Unknown" $type = $this->factory->factory($var); - $this->assertInstanceOf('Ladybug\\Type\\Resource', $type); + $this->assertInstanceOf('Ladybug\\Type\\ResourceType', $type); } /*public function testLoaderForOtherType() diff --git a/tests/Ladybug/Tests/Type/FloatTest.php b/tests/Ladybug/Tests/Type/FloatTypeTest.php similarity index 92% rename from tests/Ladybug/Tests/Type/FloatTest.php rename to tests/Ladybug/Tests/Type/FloatTypeTest.php index 3745cb8..a7052aa 100644 --- a/tests/Ladybug/Tests/Type/FloatTest.php +++ b/tests/Ladybug/Tests/Type/FloatTypeTest.php @@ -4,7 +4,7 @@ use Ladybug\Type; -class FloatTest extends \PHPUnit_Framework_TestCase +class FloatTypeTest extends \PHPUnit_Framework_TestCase { /** @var Type\Float $type */ @@ -12,7 +12,7 @@ class FloatTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->type = new Type\Float(); + $this->type = new Type\FloatType(); } public function testLoaderForValidValues() diff --git a/tests/Ladybug/Tests/Type/IntTest.php b/tests/Ladybug/Tests/Type/IntTypeTest.php similarity index 86% rename from tests/Ladybug/Tests/Type/IntTest.php rename to tests/Ladybug/Tests/Type/IntTypeTest.php index c0e1cf9..6490821 100644 --- a/tests/Ladybug/Tests/Type/IntTest.php +++ b/tests/Ladybug/Tests/Type/IntTypeTest.php @@ -4,7 +4,7 @@ use Ladybug\Type; -class IntTest extends \PHPUnit_Framework_TestCase +class IntTypeTest extends \PHPUnit_Framework_TestCase { /** @var Type\Int $type */ @@ -12,7 +12,7 @@ class IntTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->type = new Type\Int(); + $this->type = new Type\IntType(); } public function testLoaderForValidValues() diff --git a/tests/Ladybug/Tests/Type/NullTest.php b/tests/Ladybug/Tests/Type/NullTypeTest.php similarity index 87% rename from tests/Ladybug/Tests/Type/NullTest.php rename to tests/Ladybug/Tests/Type/NullTypeTest.php index 89a027b..c949f35 100644 --- a/tests/Ladybug/Tests/Type/NullTest.php +++ b/tests/Ladybug/Tests/Type/NullTypeTest.php @@ -4,7 +4,7 @@ use Ladybug\Type; -class NullTest extends \PHPUnit_Framework_TestCase +class NullTypeTest extends \PHPUnit_Framework_TestCase { /** @var Type\Null $type */ @@ -12,7 +12,7 @@ class NullTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->type = new Type\Null(); + $this->type = new Type\NullType(); } public function testLoaderForValidValues() diff --git a/tests/Ladybug/Tests/Type/Object/BadTypeHintedParameterContainerTest.php b/tests/Ladybug/Tests/Type/Object/BadTypeHintedParameterContainerTest.php index df8f6f1..8074050 100644 --- a/tests/Ladybug/Tests/Type/Object/BadTypeHintedParameterContainerTest.php +++ b/tests/Ladybug/Tests/Type/Object/BadTypeHintedParameterContainerTest.php @@ -16,7 +16,7 @@ class BadTypeHintedParameterContainerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $factory = new Type\FactoryType(); - $factory->add(new Type\Null(), 'type_null'); + $factory->add(new Type\NullType(), 'type_null'); $managerInspectorMock = m::mock('Ladybug\Inspector\InspectorManager'); $managerInspectorMock->shouldReceive('get')->andReturn(null); @@ -53,7 +53,7 @@ public function testDumperDoesNotCrashOnWrongTypeHints() $badTypeHinted = $privateMethod->getParameterByName('baz'); $this->assertEquals('[Undefined Type Hint]', $badTypeHinted->getType()); $this->assertFalse($badTypeHinted->isReference()); - $this->assertInstanceOf('Ladybug\Type\Null', $badTypeHinted->getDefaultValue()); + $this->assertInstanceOf('Ladybug\Type\NullType', $badTypeHinted->getDefaultValue()); } } diff --git a/tests/Ladybug/Tests/Type/Object/ContainerTest.php b/tests/Ladybug/Tests/Type/Object/ContainerTest.php index 8e5d543..0b908b3 100644 --- a/tests/Ladybug/Tests/Type/Object/ContainerTest.php +++ b/tests/Ladybug/Tests/Type/Object/ContainerTest.php @@ -17,7 +17,7 @@ public function setUp() $maxlevel = 8; $factoryTypeMock = m::mock('Ladybug\Type\FactoryType'); $factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3, 4), m::any())->andReturnUsing(function($var, $level) { - $intType = new Type\Int(); + $intType = new Type\IntType(); $intType->load($var, $level); return $intType; @@ -61,21 +61,21 @@ public function testLoaderForValidValues() $this->assertInstanceOf('Ladybug\Type\Object\Property', $privateProperty); $this->assertEquals('privateProperty', $privateProperty->getName()); $this->assertEquals(VisibilityInterface::VISIBILITY_PRIVATE, $privateProperty->getVisibility()); - $this->assertInstanceOf('Ladybug\Type\Int', $privateProperty->getValue()); + $this->assertInstanceOf('Ladybug\Type\IntType', $privateProperty->getValue()); $this->assertEquals(2, $privateProperty->getLevel()); $this->assertEquals('Ladybug\Tests\Type\Object\Bar', $privateProperty->getOwner()); $this->assertInstanceOf('Ladybug\Type\Object\Property', $protectedProperty); $this->assertEquals('protectedProperty', $protectedProperty->getName()); $this->assertEquals(VisibilityInterface::VISIBILITY_PROTECTED, $protectedProperty->getVisibility()); - $this->assertInstanceOf('Ladybug\Type\Int', $protectedProperty->getValue()); + $this->assertInstanceOf('Ladybug\Type\IntType', $protectedProperty->getValue()); $this->assertEquals(2, $protectedProperty->getLevel()); $this->assertEquals('Ladybug\Tests\Type\Object\Bar', $protectedProperty->getOwner()); $this->assertInstanceOf('Ladybug\Type\Object\Property', $publicProperty); $this->assertEquals('publicProperty', $publicProperty->getName()); $this->assertEquals(VisibilityInterface::VISIBILITY_PUBLIC, $publicProperty->getVisibility()); - $this->assertInstanceOf('Ladybug\Type\Int', $publicProperty->getValue()); + $this->assertInstanceOf('Ladybug\Type\IntType', $publicProperty->getValue()); $this->assertEquals(2, $publicProperty->getLevel()); $this->assertEquals('Ladybug\Tests\Type\Object\Bar', $publicProperty->getOwner()); @@ -83,7 +83,7 @@ public function testLoaderForValidValues() $this->assertEquals(1, count($this->type->getClassConstants())); $constant = $this->type->getConstantByName('CONSTANT'); $this->assertEquals('CONSTANT', $constant->getName()); - $this->assertInstanceOf('Ladybug\Type\Int', $constant->getValue()); + $this->assertInstanceOf('Ladybug\Type\IntType', $constant->getValue()); $this->assertEquals(2, $constant->getLevel()); // methods @@ -138,7 +138,7 @@ public function testLoaderForValidValues() $this->assertEquals('p5', $parameter5->getName()); $this->assertFalse($parameter5->isReference()); - $this->assertInstanceOf('Ladybug\Type\Int', $parameter5->getDefaultValue()); + $this->assertInstanceOf('Ladybug\Type\IntType', $parameter5->getDefaultValue()); $this->assertNull($parameter5->getType()); // method info diff --git a/tests/Ladybug/Tests/Type/ResourceTest.php b/tests/Ladybug/Tests/Type/ResourceTypeTest.php similarity index 84% rename from tests/Ladybug/Tests/Type/ResourceTest.php rename to tests/Ladybug/Tests/Type/ResourceTypeTest.php index 4a2a196..c23fc7b 100644 --- a/tests/Ladybug/Tests/Type/ResourceTest.php +++ b/tests/Ladybug/Tests/Type/ResourceTypeTest.php @@ -6,7 +6,7 @@ use Ladybug\Type\ObjectType\VisibilityInterface; use \Mockery as m; -class ResourceTest extends \PHPUnit_Framework_TestCase +class ResourceTypeTest extends \PHPUnit_Framework_TestCase { /** @var Type\Resource $type */ @@ -15,7 +15,7 @@ class ResourceTest extends \PHPUnit_Framework_TestCase public function setUp() { $factoryTypeMock = m::mock('Ladybug\Type\FactoryType'); - $factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturn(new Type\Int()); + $factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturn(new Type\IntType()); $managerInspectorMock = m::mock('Ladybug\Inspector\InspectorManager'); $managerInspectorMock->shouldReceive('get')->andReturn(null); @@ -23,7 +23,7 @@ public function setUp() $metadataResolverMock = m::mock('Ladybug\Metadata\MetadataResolver'); $metadataResolverMock->shouldReceive('has')->andReturn(false); - $this->type = new Type\Resource($factoryTypeMock, $managerInspectorMock, $metadataResolverMock); + $this->type = new Type\ResourceType($factoryTypeMock, $managerInspectorMock, $metadataResolverMock); } public function tearDown() diff --git a/tests/Ladybug/Tests/Type/StringTest.php b/tests/Ladybug/Tests/Type/StringTypeTest.php similarity index 88% rename from tests/Ladybug/Tests/Type/StringTest.php rename to tests/Ladybug/Tests/Type/StringTypeTest.php index 79aac51..c1c0001 100644 --- a/tests/Ladybug/Tests/Type/StringTest.php +++ b/tests/Ladybug/Tests/Type/StringTypeTest.php @@ -4,7 +4,7 @@ use Ladybug\Type; -class StringTest extends \PHPUnit_Framework_TestCase +class StringTypeTest extends \PHPUnit_Framework_TestCase { /** @var Type\String $type */ @@ -12,7 +12,7 @@ class StringTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->type = new Type\String(); + $this->type = new Type\StringType(); } public function testLoaderForValidValues() diff --git a/tests/Ladybug/Tests/Type/Vector/ContainerTest.php b/tests/Ladybug/Tests/Type/Vector/ContainerTest.php index 3f4cf72..35ccd30 100644 --- a/tests/Ladybug/Tests/Type/Vector/ContainerTest.php +++ b/tests/Ladybug/Tests/Type/Vector/ContainerTest.php @@ -17,7 +17,7 @@ public function setUp() $factoryTypeMock = m::mock('Ladybug\Type\FactoryType'); $factoryTypeMock->shouldReceive('factory')->with(m::anyOf(1, 2, 3), m::any())->andReturnUsing(function($var, $level) { - $intType = new Type\Int(); + $intType = new Type\IntType(); $intType->load($var, $level); return $intType; @@ -46,7 +46,7 @@ public function testLoaderForValidValues() foreach ($this->type->getValue() as $item) { $this->assertEquals($i, $item->getKey()); $this->assertEquals(2, $item->getLevel()); - $this->assertInstanceOf('Ladybug\Type\Int', $item->getValue()); + $this->assertInstanceOf('Ladybug\Type\IntType', $item->getValue()); $i++; } From c6d86d7f2081e5fc730887818aabab1d8e175acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Youn=C3=A8s=20El=20Biache?= Date: Tue, 8 Dec 2015 20:35:42 +0100 Subject: [PATCH 3/3] replace deprecated twig methods but errors in test to fix --- .../Renderer/Twig/Extension/BaseExtension.php | 18 +++++------------- .../Twig/Extension/ConsoleExtension.php | 6 +----- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/Ladybug/Renderer/Twig/Extension/BaseExtension.php b/src/Ladybug/Renderer/Twig/Extension/BaseExtension.php index 9a739ba..d10b0c8 100644 --- a/src/Ladybug/Renderer/Twig/Extension/BaseExtension.php +++ b/src/Ladybug/Renderer/Twig/Extension/BaseExtension.php @@ -40,9 +40,9 @@ public function getName() public function getFunctions() { return array( - 'render_type' => new \Twig_Function_Method( - $this, - 'renderTypeFunction', + 'render_type' => new \Twig_SimpleFunction( + 'renderTypeFunction', + array($this, 'renderTypeFunction'), array('needs_environment' => true, 'is_safe' => array('html')) ) ); @@ -56,16 +56,8 @@ public function getFunctions() public function getFilters() { return array( - 'repeat' => new \Twig_Filter_Method( - $this, - 'getRepeat', - array('is_safe' => array('html')) - ), - 'pad' => new \Twig_Filter_Method( - $this, - 'getPad', - array() - ) + 'repeat' => new \Twig_SimpleFilter('getRepeat', array($this, 'getRepeat'), array('is_safe' => array('html'))), + 'pad' => new \Twig_SimpleFilter('getPad', array($this, 'getPad')), ); } diff --git a/src/Ladybug/Renderer/Twig/Extension/ConsoleExtension.php b/src/Ladybug/Renderer/Twig/Extension/ConsoleExtension.php index 9a6500d..328c2ae 100644 --- a/src/Ladybug/Renderer/Twig/Extension/ConsoleExtension.php +++ b/src/Ladybug/Renderer/Twig/Extension/ConsoleExtension.php @@ -32,11 +32,7 @@ public function getName() public function getFilters() { return array_merge(parent::getFilters(), array( - 'tags' => new \Twig_Filter_Method( - $this, - 'getTags', - array('is_safe' => array('html')) - ) + 'tags' => new \Twig_SimpleFilter('getTags', array($this, 'getTags'), array('is_safe' => array('html'))), )); }