-
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 #21 from dbalabka/fix-for-abstract-classes
Throw an exception on non-final enum class and public constructor. Fix abstract classes initialisation.
- Loading branch information
Showing
20 changed files
with
179 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
* @author Dmitry Balabka <[email protected]> | ||
* @template T | ||
*/ | ||
class Option extends Enumeration | ||
abstract class Option extends Enumeration | ||
{ | ||
/** | ||
* @psalm-var Option<mixed> | ||
|
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,22 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Dbalabka\Enumeration\Tests\Fixtures; | ||
|
||
use Dbalabka\Enumeration\Enumeration; | ||
use function version_compare; | ||
use const PHP_VERSION; | ||
|
||
if (version_compare(PHP_VERSION, '7.4.0', '<')) { | ||
require_once __DIR__ . '/ActionProperties.php'; | ||
} else { | ||
require_once __DIR__ . '/ActionTypedProperties.php'; | ||
} | ||
|
||
/** | ||
* Final is omitted for testing purposes | ||
*/ | ||
abstract class AbstractAction extends Enumeration | ||
{ | ||
use ActionProperties; | ||
} |
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,14 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Dbalabka\Enumeration\Tests\Fixtures; | ||
|
||
use Dbalabka\Enumeration\Enumeration; | ||
|
||
final class EmptyEnum extends Enumeration | ||
{ | ||
protected function __construct() | ||
{ | ||
$this->ordinal(); | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Dbalabka\Enumeration\Tests\Fixtures; | ||
|
||
use Dbalabka\Enumeration\Enumeration; | ||
|
||
class NotFinalEnum extends Enumeration | ||
{ | ||
public static $testValue; | ||
} |
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 | ||
declare(strict_types=1); | ||
|
||
namespace Dbalabka\Enumeration\Tests\Fixtures; | ||
|
||
use Dbalabka\Enumeration\Enumeration; | ||
|
||
final class PublicConstructorEnum extends Enumeration | ||
{ | ||
public static $testValue; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/StaticConstructorLoader/Fixtures/AbstractEnumeration.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 Dbalabka\StaticConstructorLoader\Tests\Fixtures; | ||
|
||
use Dbalabka\Enumeration\Enumeration; | ||
|
||
abstract class AbstractEnumeration extends Enumeration | ||
{ | ||
|
||
} |
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
8 changes: 8 additions & 0 deletions
8
tests/StaticConstructorLoader/Fixtures/ChildOfAbstractEnumeration.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,8 @@ | ||
<?php | ||
|
||
namespace Dbalabka\StaticConstructorLoader\Tests\Fixtures; | ||
|
||
final class ChildOfAbstractEnumeration extends AbstractEnumeration | ||
{ | ||
public static $instance; | ||
} |
Oops, something went wrong.