-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Add support for PHP 7.3
- Loading branch information
1 parent
b928c57
commit 4cb0825
Showing
17 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -417,6 +417,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "7.3" | ||
- "7.4" | ||
- "8.0" | ||
- "8.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright (c) 2017-2024 Andreas Möller | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE.md file that was distributed with this source code. | ||
* | ||
* @see https://github.com/ergebnis/classy | ||
*/ | ||
|
||
namespace Ergebnis\Classy\Test\DataProvider; | ||
|
||
use Ergebnis\Classy\Construct; | ||
use Ergebnis\Classy\Test; | ||
|
||
final class Php73 | ||
{ | ||
/** | ||
* @return \Generator<string, array{0: Test\Util\Scenario}> | ||
*/ | ||
public static function classyConstructs(): \Generator | ||
{ | ||
$scenarios = [ | ||
Test\Util\Scenario::create( | ||
'php73-within-namespace', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithinNamespace/source.php', | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinNamespace\Bar::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinNamespace\Baz::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinNamespace\Foo::class), | ||
), | ||
Test\Util\Scenario::create( | ||
'php73-within-namespace-with-braces', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithinNamespaceWithBraces/source.php', | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinNamespaceWithBraces\Bar::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinNamespaceWithBraces\Baz::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinNamespaceWithBraces\Foo::class), | ||
), | ||
Test\Util\Scenario::create( | ||
'php73-within-multiple-namespaces-with-braces', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithinMultipleNamespaces/source.php', | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinMultipleNamespaces\Bar\Bar::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinMultipleNamespaces\Bar\Baz::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinMultipleNamespaces\Bar\Foo::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinMultipleNamespaces\Foo\Bar::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinMultipleNamespaces\Foo\Baz::class), | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithinMultipleNamespaces\Foo\Foo::class), | ||
), | ||
Test\Util\Scenario::create( | ||
'php73-within-namespace-with-single-segment', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithinNamespaceWithSingleSegment/source.php', | ||
Construct::fromName('Ergebnis\\Bar'), | ||
Construct::fromName('Ergebnis\\Baz'), | ||
Construct::fromName('Ergebnis\\Foo'), | ||
), | ||
Test\Util\Scenario::create( | ||
'php73-with-methods-named-after-keywords', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithMethodsNamedAfterKeywords/source.php', | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithMethodsNamedAfterKeywords\Foo::class), | ||
), | ||
/** | ||
* @see https://github.com/zendframework/zend-file/pull/41 | ||
*/ | ||
Test\Util\Scenario::create( | ||
'php73-with-methods-named-after-keywords-and-return-type', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithMethodsNamedAfterKeywordsAndReturnType/source.php', | ||
Construct::fromName(Test\Fixture\Classy\Php73\WithMethodsNamedAfterKeywordsAndReturnType\Foo::class), | ||
), | ||
Test\Util\Scenario::create( | ||
'php73-without-namespace', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithoutNamespace/source.php', | ||
Construct::fromName('Bar'), | ||
Construct::fromName('Baz'), | ||
Construct::fromName('Foo'), | ||
), | ||
Test\Util\Scenario::create( | ||
'php73-without-namespace-and-multi-line-comments', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithoutNamespaceAndMultiLineComments/source.php', | ||
Construct::fromName('Bar'), | ||
Construct::fromName('Baz'), | ||
Construct::fromName('Foo'), | ||
), | ||
Test\Util\Scenario::create( | ||
'php73-without-namespace-and-shell-line-comments', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithoutNamespaceAndShellStyleComments/source.php', | ||
Construct::fromName('Bar'), | ||
Construct::fromName('Baz'), | ||
Construct::fromName('Foo'), | ||
), | ||
Test\Util\Scenario::create( | ||
'php73-without-namespace-and-single-line-comments', | ||
__DIR__ . '/../Fixture/Classy/Php73/WithoutNamespaceAndSingleLineComments/source.php', | ||
Construct::fromName('Bar'), | ||
Construct::fromName('Baz'), | ||
Construct::fromName('Foo'), | ||
), | ||
]; | ||
|
||
foreach ($scenarios as $scenario) { | ||
yield $scenario->description() => [ | ||
$scenario, | ||
]; | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
test/Fixture/Classy/Php73/WithMethodsNamedAfterKeywords/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithMethodsNamedAfterKeywords; | ||
|
||
class Foo | ||
{ | ||
public function class() | ||
{ | ||
} | ||
|
||
public function interface() | ||
{ | ||
} | ||
|
||
public function trait() | ||
{ | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
test/Fixture/Classy/Php73/WithMethodsNamedAfterKeywordsAndReturnType/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithMethodsNamedAfterKeywordsAndReturnType; | ||
|
||
|
||
class Foo | ||
{ | ||
public function class(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function interface(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function trait(): string | ||
{ | ||
return ''; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
test/Fixture/Classy/Php73/WithinMultipleNamespaces/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithinMultipleNamespaces\Foo; | ||
{ | ||
class Foo {} | ||
|
||
interface Bar {} | ||
|
||
trait Baz {} | ||
} | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithinMultipleNamespaces\Bar; | ||
{ | ||
class Foo {} | ||
|
||
interface Bar {} | ||
|
||
trait Baz {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithinNamespace; | ||
|
||
class Foo {} | ||
|
||
interface Bar {} | ||
|
||
trait Baz {} |
9 changes: 9 additions & 0 deletions
9
test/Fixture/Classy/Php73/WithinNamespaceAndMultiLineComments/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithinNamespaceAndMultiLineComments; | ||
|
||
/* foo */ class /* bar */ Foo /* baz */ {} | ||
|
||
/* foo */ interface /* bar */ Bar /* baz */ {} | ||
|
||
/* foo */ trait /* bar */ Baz /* baz */ {} |
15 changes: 15 additions & 0 deletions
15
test/Fixture/Classy/Php73/WithinNamespaceAndShellStyleComments/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithinNamespaceAndShellStyleComments; | ||
|
||
class # foo | ||
Foo # bar | ||
{} | ||
|
||
interface # foo | ||
Bar # bar | ||
{} | ||
|
||
trait # foo | ||
Baz // bar | ||
{} |
15 changes: 15 additions & 0 deletions
15
test/Fixture/Classy/Php73/WithinNamespaceAndSingleLineComments/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithinNamespaceAndSingleLineComments; | ||
|
||
class // foo | ||
Foo // bar | ||
{} | ||
|
||
interface // foo | ||
Bar // bar | ||
{} | ||
|
||
trait // foo | ||
Baz // bar | ||
{} |
10 changes: 10 additions & 0 deletions
10
test/Fixture/Classy/Php73/WithinNamespaceWithBraces/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Ergebnis\Classy\Test\Fixture\Classy\Php73\WithinNamespaceWithBraces | ||
{ | ||
class Foo {} | ||
|
||
interface Bar {} | ||
|
||
trait Baz {} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/Fixture/Classy/Php73/WithinNamespaceWithSingleSegment/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Ergebnis; | ||
|
||
class Foo {} | ||
|
||
interface Bar {} | ||
|
||
trait Baz {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
class Foo {} | ||
|
||
interface Bar {} | ||
|
||
trait Baz {} |
7 changes: 7 additions & 0 deletions
7
test/Fixture/Classy/Php73/WithoutNamespaceAndMultiLineComments/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
/* foo */ class /* bar */ Foo /* baz */ {} | ||
|
||
/* foo */ interface /* bar */ Bar /* baz */ {} | ||
|
||
/* foo */ trait /* bar */ Baz /* baz */ {} |
13 changes: 13 additions & 0 deletions
13
test/Fixture/Classy/Php73/WithoutNamespaceAndShellStyleComments/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
class # foo | ||
Foo # bar | ||
{} | ||
|
||
interface # foo | ||
Bar # bar | ||
{} | ||
|
||
trait # foo | ||
Baz // bar | ||
{} |
13 changes: 13 additions & 0 deletions
13
test/Fixture/Classy/Php73/WithoutNamespaceAndSingleLineComments/source.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
class // foo | ||
Foo // bar | ||
{} | ||
|
||
interface // foo | ||
Bar // bar | ||
{} | ||
|
||
trait // foo | ||
Baz // bar | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters