-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #930 from ergebnis/feature/php73
Enhancement: Add support for PHP 7.3
- Loading branch information
Showing
26 changed files
with
350 additions
and
20 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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 {} | ||
} |
Oops, something went wrong.