Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit b17e072

Browse files
committed
Merge pull request #2 in develop
2 parents 66419fd + a9ad73e commit b17e072

File tree

10 files changed

+6
-144
lines changed

10 files changed

+6
-144
lines changed

src/Scanner/TokenArrayScanner.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,6 @@ protected function scan()
298298
throw new Exception\RuntimeException('No tokens were provided');
299299
}
300300

301-
/**
302-
* Define PHP 5.4 'trait' token constant.
303-
*/
304-
if (!defined('T_TRAIT')) {
305-
define('T_TRAIT', 42001);
306-
}
307-
308301
/**
309302
* Variables & Setup
310303
*/

test/Generator/ClassGeneratorTest.php

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -711,32 +711,20 @@ public function someFunction()
711711

712712
public function testCanAddTraitWithString()
713713
{
714-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
715-
$this->markTestSkipped('This test requires PHP version 5.4+');
716-
}
717-
718714
$classGenerator = new ClassGenerator();
719715
$classGenerator->addTrait('myTrait');
720716
$this->assertTrue($classGenerator->hasTrait('myTrait'));
721717
}
722718

723719
public function testCanAddTraitWithArray()
724720
{
725-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
726-
$this->markTestSkipped('This test requires PHP version 5.4+');
727-
}
728-
729721
$classGenerator = new ClassGenerator();
730722
$classGenerator->addTrait(['traitName' => 'myTrait']);
731723
$this->assertTrue($classGenerator->hasTrait('myTrait'));
732724
}
733725

734726
public function testCanRemoveTrait()
735727
{
736-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
737-
$this->markTestSkipped('This test requires PHP version 5.4+');
738-
}
739-
740728
$classGenerator = new ClassGenerator();
741729
$classGenerator->addTrait(['traitName' => 'myTrait']);
742730
$this->assertTrue($classGenerator->hasTrait('myTrait'));
@@ -746,10 +734,6 @@ public function testCanRemoveTrait()
746734

747735
public function testCanGetTraitsMethod()
748736
{
749-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
750-
$this->markTestSkipped('This test requires PHP version 5.4+');
751-
}
752-
753737
$classGenerator = new ClassGenerator();
754738
$classGenerator->addTraits(['myTrait', 'hisTrait']);
755739

@@ -760,10 +744,6 @@ public function testCanGetTraitsMethod()
760744

761745
public function testCanAddTraitAliasWithString()
762746
{
763-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
764-
$this->markTestSkipped('This test requires PHP version 5.4+');
765-
}
766-
767747
$classGenerator = new ClassGenerator();
768748

769749
$classGenerator->addTrait('myTrait');
@@ -777,10 +757,6 @@ public function testCanAddTraitAliasWithString()
777757

778758
public function testCanAddTraitAliasWithArray()
779759
{
780-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
781-
$this->markTestSkipped('This test requires PHP version 5.4+');
782-
}
783-
784760
$classGenerator = new ClassGenerator();
785761

786762
$classGenerator->addTrait('myTrait');
@@ -797,10 +773,6 @@ public function testCanAddTraitAliasWithArray()
797773

798774
public function testAddTraitAliasExceptionInvalidMethodFormat()
799775
{
800-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
801-
$this->markTestSkipped('This test requires PHP version 5.4+');
802-
}
803-
804776
$classGenerator = new ClassGenerator();
805777

806778
$this->setExpectedException(
@@ -814,10 +786,6 @@ public function testAddTraitAliasExceptionInvalidMethodFormat()
814786

815787
public function testAddTraitAliasExceptionInvalidMethodTraitDoesNotExist()
816788
{
817-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
818-
$this->markTestSkipped('This test requires PHP version 5.4+');
819-
}
820-
821789
$classGenerator = new ClassGenerator();
822790

823791
$this->setExpectedException(
@@ -831,10 +799,6 @@ public function testAddTraitAliasExceptionInvalidMethodTraitDoesNotExist()
831799

832800
public function testAddTraitAliasExceptionMethodAlreadyExists()
833801
{
834-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
835-
$this->markTestSkipped('This test requires PHP version 5.4+');
836-
}
837-
838802
$classGenerator = new ClassGenerator();
839803

840804
$this->setExpectedException(
@@ -849,10 +813,6 @@ public function testAddTraitAliasExceptionMethodAlreadyExists()
849813

850814
public function testAddTraitAliasExceptionInvalidVisibilityValue()
851815
{
852-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
853-
$this->markTestSkipped('This test requires PHP version 5.4+');
854-
}
855-
856816
$classGenerator = new ClassGenerator();
857817

858818
$this->setExpectedException(
@@ -867,10 +827,6 @@ public function testAddTraitAliasExceptionInvalidVisibilityValue()
867827

868828
public function testAddTraitAliasExceptionInvalidAliasArgument()
869829
{
870-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
871-
$this->markTestSkipped('This test requires PHP version 5.4+');
872-
}
873-
874830
$classGenerator = new ClassGenerator();
875831

876832
$this->setExpectedException(
@@ -884,10 +840,6 @@ public function testAddTraitAliasExceptionInvalidAliasArgument()
884840

885841
public function testCanAddTraitOverride()
886842
{
887-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
888-
$this->markTestSkipped('This test requires PHP version 5.4+');
889-
}
890-
891843
$classGenerator = new ClassGenerator();
892844
$classGenerator->addTraits(['myTrait', 'histTrait']);
893845
$classGenerator->addTraitOverride('myTrait::foo', 'hisTrait');
@@ -900,10 +852,6 @@ public function testCanAddTraitOverride()
900852

901853
public function testCanAddMultipleTraitOverrides()
902854
{
903-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
904-
$this->markTestSkipped('This test requires PHP version 5.4+');
905-
}
906-
907855
$classGenerator = new ClassGenerator();
908856
$classGenerator->addTraits(['myTrait', 'histTrait', 'thatTrait']);
909857
$classGenerator->addTraitOverride('myTrait::foo', ['hisTrait', 'thatTrait']);
@@ -915,10 +863,6 @@ public function testCanAddMultipleTraitOverrides()
915863

916864
public function testAddTraitOverrideExceptionInvalidMethodFormat()
917865
{
918-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
919-
$this->markTestSkipped('This test requires PHP version 5.4+');
920-
}
921-
922866
$classGenerator = new ClassGenerator();
923867

924868
$this->setExpectedException(
@@ -932,10 +876,6 @@ public function testAddTraitOverrideExceptionInvalidMethodFormat()
932876

933877
public function testAddTraitOverrideExceptionInvalidMethodTraitDoesNotExist()
934878
{
935-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
936-
$this->markTestSkipped('This test requires PHP version 5.4+');
937-
}
938-
939879
$classGenerator = new ClassGenerator();
940880

941881
$this->setExpectedException(
@@ -949,10 +889,6 @@ public function testAddTraitOverrideExceptionInvalidMethodTraitDoesNotExist()
949889

950890
public function testAddTraitOverrideExceptionInvalidTraitName()
951891
{
952-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
953-
$this->markTestSkipped('This test requires PHP version 5.4+');
954-
}
955-
956892
$classGenerator = new ClassGenerator();
957893

958894
$this->setExpectedException(
@@ -966,10 +902,6 @@ public function testAddTraitOverrideExceptionInvalidTraitName()
966902

967903
public function testAddTraitOverrideExceptionInvalidTraitToReplaceArgument()
968904
{
969-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
970-
$this->markTestSkipped('This test requires PHP version 5.4+');
971-
}
972-
973905
$classGenerator = new ClassGenerator();
974906

975907
$this->setExpectedException(
@@ -983,10 +915,6 @@ public function testAddTraitOverrideExceptionInvalidTraitToReplaceArgument()
983915

984916
public function testAddTraitOverrideExceptionInvalidMethodArgInArray()
985917
{
986-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
987-
$this->markTestSkipped('This test requires PHP version 5.4+');
988-
}
989-
990918
$classGenerator = new ClassGenerator();
991919

992920
$this->setExpectedException(
@@ -1000,10 +928,6 @@ public function testAddTraitOverrideExceptionInvalidMethodArgInArray()
1000928

1001929
public function testCanRemoveTraitOverride()
1002930
{
1003-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
1004-
$this->markTestSkipped('This test requires PHP version 5.4+');
1005-
}
1006-
1007931
$classGenerator = new ClassGenerator();
1008932
$classGenerator->addTraits(['myTrait', 'histTrait', 'thatTrait']);
1009933
$classGenerator->addTraitOverride('myTrait::foo', ['hisTrait', 'thatTrait']);
@@ -1020,10 +944,6 @@ public function testCanRemoveTraitOverride()
1020944

1021945
public function testCanRemoveAllTraitOverrides()
1022946
{
1023-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
1024-
$this->markTestSkipped('This test requires PHP version 5.4+');
1025-
}
1026-
1027947
$classGenerator = new ClassGenerator();
1028948
$classGenerator->addTraits(['myTrait', 'histTrait', 'thatTrait']);
1029949
$classGenerator->addTraitOverride('myTrait::foo', ['hisTrait', 'thatTrait']);
@@ -1042,10 +962,6 @@ public function testCanRemoveAllTraitOverrides()
1042962
*/
1043963
public function testUseTraitGeneration()
1044964
{
1045-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
1046-
$this->markTestSkipped('This test requires PHP version 5.4+');
1047-
}
1048-
1049965
$classGenerator = new ClassGenerator();
1050966
$classGenerator->setName('myClass');
1051967
$classGenerator->addTrait('myTrait');
@@ -1070,10 +986,6 @@ class myClass
1070986
*/
1071987
public function testTraitGenerationWithAliasesAndOverrides()
1072988
{
1073-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
1074-
$this->markTestSkipped('This test requires PHP version 5.4+');
1075-
}
1076-
1077989
$classGenerator = new ClassGenerator();
1078990
$classGenerator->setName('myClass');
1079991
$classGenerator->addTrait('myTrait');

test/Generator/ParameterGeneratorTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ public function testFromReflectionGetWithNativeType()
113113

114114
public function testCallableTypeHint()
115115
{
116-
if (PHP_VERSION_ID < 50400) {
117-
$this->markTestSkipped('`callable` is only supported in PHP >=5.4.0');
118-
}
119-
120116
$parameter = ParameterGenerator::fromReflection(
121117
new ParameterReflection(['ZendTest\Code\Generator\TestAsset\CallableTypeHintClass', 'foo'], 'bar')
122118
);

test/Generator/TraitGeneratorTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class TraitGeneratorTest extends \PHPUnit_Framework_TestCase
2323
{
2424
public function setUp()
2525
{
26-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
27-
$this->markTestSkipped('This test requires PHP version 5.4+');
28-
}
2926
}
3027

3128
public function testConstruction()

test/Reflection/ClassReflectionTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,6 @@ public function testGetContentsReturnsEmptyContentsOnInternalCode()
189189

190190
public function testGetTraits()
191191
{
192-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
193-
$this->markTestSkipped('This test requires PHP version 5.4+');
194-
}
195-
196192
// PHP documentations mentions that getTraits() return NULL in case of error. I don't know how to cause such
197193
// error so I test just normal behaviour.
198194

test/Reflection/MethodReflectionTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testGetBodyReturnsCorrectBody()
103103
);
104104
$body = $reflectionMethod->getBody();
105105
$this->assertEquals(trim($body), "");
106-
106+
107107
$reflectionMethod = new MethodReflection('ZendTest\Code\Reflection\TestAsset\TestSampleClass11', 'visibility');
108108
$body = $reflectionMethod->getBody();
109109
$this->assertEquals(trim($body), "return 'visibility';");
@@ -162,7 +162,7 @@ public function doSomethingAgain()
162162
$contents = ' public function inline3() { return \'inline3\'; }';
163163
$reflectionMethod = new MethodReflection('ZendTest\Code\Reflection\TestAsset\TestSampleClass11', 'inline3');
164164
$this->assertEquals($contents, $reflectionMethod->getContents(false));
165-
165+
166166
$contents = <<<'CONTENTS'
167167
public function visibility()
168168
{
@@ -358,9 +358,9 @@ public function testCodeGetContentsDoesNotThrowExceptionOnDocBlock()
358358
$contents = <<<'CONTENTS'
359359
function getCacheKey() {
360360
$args = func_get_args();
361-
361+
362362
$cacheKey = '';
363-
363+
364364
foreach($args as $arg) {
365365
if (is_array($arg)) {
366366
foreach ($arg as $argElement) {
@@ -396,10 +396,6 @@ public function testCodeGetBodyReturnsEmptyWithCommentedFunction()
396396
*/
397397
public function testCanParseClassBodyWhenUsingTrait()
398398
{
399-
if (version_compare(PHP_VERSION, '5.4', 'lt')) {
400-
$this->markTestSkipped('This test requires PHP version 5.4+');
401-
}
402-
403399
require_once __DIR__ .'/TestAsset/TestTraitClass1.php';
404400
require_once __DIR__. '/TestAsset/TestTraitClass2.php';
405401
// $method = new \Zend\Code\Reflection\ClassReflection('\FooClass');

test/Reflection/ParameterReflectionTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ public function testTypeReturn($param, $type)
4646

4747
public function testCallableTypeHint()
4848
{
49-
if (PHP_VERSION_ID < 50400) {
50-
$this->markTestSkipped('`callable` is only supported in PHP >=5.4.0');
51-
}
52-
5349
$parameter = new Reflection\ParameterReflection(['ZendTest\Code\Reflection\TestAsset\CallableTypeHintClass', 'foo'], 'bar');
54-
5550
$this->assertEquals('callable', $parameter->getType());
5651
}
5752

test/Reflection/TestAsset/TestSampleClass11.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function visibility()
5252

5353
function getCacheKey() {
5454
$args = func_get_args();
55-
55+
5656
$cacheKey = '';
57-
57+
5858
foreach($args as $arg) {
5959
if (is_array($arg)) {
6060
foreach ($arg as $argElement) {

0 commit comments

Comments
 (0)