Skip to content

Commit 56ac37d

Browse files
Sander van der Vlugtsvandervlugt
authored andcommitted
Remove php7 specific code and update readme
1 parent 24312c3 commit 56ac37d

3 files changed

Lines changed: 2 additions & 98 deletions

File tree

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ functions.
1313
## Limitations
1414

1515
- Imports through grouped `use` statements is not supported. (https://wiki.php.net/rfc/group_use_declarations)
16-
- Scalar typehints is not being added (https://wiki.php.net/rfc/scalar_type_hints_v5)
1716

1817
## Installation
1918

@@ -46,9 +45,8 @@ class Period
4645
* @ORM\Column(name="id", type="integer")
4746
* @AG\Generate // Here you ask methods to be generated
4847
*
49-
* @var int
5048
*/
51-
private $id;
49+
private int $id;
5250

5351
// ...
5452
}
@@ -321,7 +319,7 @@ All methods are strictly typed based on their prefix in the enum class.
321319
Have a look at the [ParamNameEnum](test/Generator/fixtures/expected/ParamNameEnum.php) class to
322320
see an example of the generated code.
323321

324-
> **WARNING**: The default visiblity of accessor methods (get/is/set/add/remove) will be set to
322+
> **WARNING**: The default visibility of accessor methods (get/is/set/add/remove) will be set to
325323
> `none` if enumerators are used. If you still need these methods to be generated, you'll have to
326324
> specify them explicitly.
327325

src/Reflection/ReflectionClass.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,6 @@ class ReflectionClass
8888
*/
8989
public function __construct($filename)
9090
{
91-
// PHP 8.0 forward compatibility @see https://www.php.net/manual/en/migration80.incompatible.php
92-
if (!defined('T_NAME_QUALIFIED')) {
93-
define('T_NAME_QUALIFIED', T_NS_SEPARATOR);
94-
}
95-
if (!defined('T_NAME_FULLY_QUALIFIED')) {
96-
define('T_NAME_FULLY_QUALIFIED', T_NS_SEPARATOR);
97-
}
9891
$this->filename = $filename;
9992

10093
// Check if file exists

test/Reflection/TokenStreamTest.php

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
class TokenStreamTest extends TestCase
1515
{
1616
private const SOURCE = 'tokens.php';
17-
private const PHP_7_SIZE = 116;
1817
private const PHP_8_SIZE = 105;
1918

2019
/**
@@ -29,7 +28,6 @@ protected function setUp(): void
2928

3029
public function typeProvider(): array
3130
{
32-
if (version_compare(PHP_VERSION, '8.0.0') >= 0) {
3331
return [
3432
[0, T_OPEN_TAG],
3533
[1, T_NAMESPACE],
@@ -38,17 +36,6 @@ public function typeProvider(): array
3836
[self::PHP_8_SIZE, null, \OutOfBoundsException::class],
3937
[32, T_PRIVATE],
4038
];
41-
}
42-
43-
// before php7
44-
return [
45-
[0, T_OPEN_TAG],
46-
[1, T_NAMESPACE],
47-
[10, ';'],
48-
[-1, null, \OutOfBoundsException::class],
49-
[self::PHP_7_SIZE, null, \OutOfBoundsException::class],
50-
[42, T_PRIVATE],
51-
];
5239
}
5340

5441
/**
@@ -78,7 +65,6 @@ public function testType($loc, $type, $exception = null): void
7865

7966
public function valueProvider(): array
8067
{
81-
if (version_compare(PHP_VERSION, '8.0.0') >= 0) {
8268
return [
8369
[0, "<?php\n"],
8470
[1, 'namespace'],
@@ -88,17 +74,6 @@ public function valueProvider(): array
8874
[self::PHP_8_SIZE, null, \OutOfBoundsException::class],
8975
[32, 'private'],
9076
];
91-
}
92-
// before php7
93-
return [
94-
[0, "<?php\n"],
95-
[1, 'namespace'],
96-
[7, 'AccessorGenerator'],
97-
[10, ';'],
98-
[-1, null, \OutOfBoundsException::class],
99-
[self::PHP_7_SIZE, null, \OutOfBoundsException::class],
100-
[42, 'private'],
101-
];
10277
}
10378

10479
/**
@@ -115,7 +90,6 @@ public function testValue($loc, $value, $exception = null): void
11590

11691
public function scanProvider(): array
11792
{
118-
if (version_compare(PHP_VERSION, '8.0.0') >= 0) {
11993
return [
12094
// Boundary Checks
12195
[[], -2, null, \OutOfBoundsException::class],
@@ -134,26 +108,6 @@ public function scanProvider(): array
134108
// Test a token that is there to find
135109
[[T_PRIVATE], 0, 32],
136110
];
137-
}
138-
// before php8
139-
return [
140-
// Boundary Checks
141-
[[], -2, null, \OutOfBoundsException::class],
142-
[[], -1, null],
143-
[[], 0, null],
144-
[[], self::PHP_7_SIZE, null, \OutOfBoundsException::class],
145-
[[], self::PHP_7_SIZE - 1, null],
146-
147-
// Scan does not probe current value.
148-
[[T_OPEN_TAG], -1, 0],
149-
[[T_OPEN_TAG], 0, null],
150-
151-
// Able to find last item
152-
[[T_WHITESPACE], self::PHP_7_SIZE - 2, self::PHP_7_SIZE - 1],
153-
154-
// Test a token that is there to find
155-
[[T_PRIVATE], 0, 42],
156-
];
157111
}
158112

159113
/**
@@ -171,7 +125,6 @@ public function testScan(array $tokens, $input_loc, $output_loc, $exception = nu
171125

172126
public function nextProvider(): array
173127
{
174-
if (version_compare(PHP_VERSION, '8.0.0') >= 0) {
175128
return [
176129
// Boundary checks
177130
[-2, null, [], \OutOfBoundsException::class],
@@ -188,25 +141,6 @@ public function nextProvider(): array
188141
// Scan when no available maches can be found
189142
[self::PHP_8_SIZE - 2, null],
190143
];
191-
}
192-
193-
// Before php8
194-
return [
195-
// Boundary checks
196-
[-2, null, [], \OutOfBoundsException::class],
197-
[-1, 0, []],
198-
[0, 1, []],
199-
[self::PHP_7_SIZE, null, [], \OutOfBoundsException::class],
200-
[self::PHP_7_SIZE - 1, null, []],
201-
[self::PHP_7_SIZE - 2, self::PHP_7_SIZE - 1, []],
202-
203-
// Scan from private keyword on line 9
204-
[42, 44],
205-
[42, 46, [T_WHITESPACE, T_CONST]],
206-
207-
// Scan when no available maches can be found
208-
[self::PHP_7_SIZE - 2, null],
209-
];
210144
}
211145

212146
/**
@@ -228,7 +162,6 @@ public function testNext($input_loc, $output_loc, array $tokens = null, $excepti
228162

229163
public function previousProvider(): array
230164
{
231-
if (version_compare(PHP_VERSION, '8.0.0') >= 0) {
232165
return [
233166
// Boundary checks
234167
[-1, null, [], \OutOfBoundsException::class],
@@ -246,26 +179,6 @@ public function previousProvider(): array
246179
[3, null, [T_NAMESPACE, T_NS_SEPARATOR, T_WHITESPACE, T_STRING, T_OPEN_TAG]],
247180

248181
];
249-
}
250-
251-
// before php8
252-
return [
253-
// Boundary checks
254-
[-1, null, [], \OutOfBoundsException::class],
255-
[0, null, []],
256-
[1, 0, []],
257-
[self::PHP_7_SIZE + 1, null, [], \OutOfBoundsException::class],
258-
[self::PHP_7_SIZE, self::PHP_7_SIZE - 1, []],
259-
[self::PHP_7_SIZE - 1, self::PHP_7_SIZE - 2, []],
260-
261-
// Scan from private keyword on line 9
262-
[44, 42], // Skip white space
263-
[46, 42, [T_WHITESPACE, T_CONST]],
264-
[41, 40, [T_PUBLIC, T_PRIVATE]],
265-
266-
// Scan when no available maches can be found
267-
[5, null, [T_NAMESPACE, T_NS_SEPARATOR, T_WHITESPACE, T_STRING, T_OPEN_TAG]],
268-
];
269182
}
270183

271184
/**

0 commit comments

Comments
 (0)