-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Adds segregation for immutability with an Immutable interface.
- Loading branch information
1 parent
af5a37e
commit 684212f
Showing
25 changed files
with
262 additions
and
434 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/tests export-ignore | ||
/vendor export-ignore | ||
|
||
/LICENSE export-ignore | ||
/Makefile export-ignore | ||
/README.md export-ignore | ||
/phpmd.xml export-ignore | ||
/phpunit.xml export-ignore | ||
/phpstan.neon.dist export-ignore | ||
/infection.json.dist export-ignore | ||
|
||
/.github export-ignore | ||
/.gitignore export-ignore | ||
/.gitattributes export-ignore |
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 |
---|---|---|
@@ -1,23 +1,21 @@ | ||
{ | ||
"timeout": 10, | ||
"testFramework": "phpunit", | ||
"tmpDir": "report/", | ||
"tmpDir": "report/infection/", | ||
"source": { | ||
"directories": [ | ||
"src" | ||
] | ||
}, | ||
"logs": { | ||
"text": "report/logs/infection-text.log", | ||
"summary": "report/logs/infection-summary.log" | ||
"text": "report/infection/logs/infection-text.log", | ||
"summary": "report/infection/logs/infection-summary.log" | ||
}, | ||
"mutators": { | ||
"@default": true, | ||
"PublicVisibility": false, | ||
"ProtectedVisibility": false | ||
"@default": true | ||
}, | ||
"phpUnit": { | ||
"configDir": "", | ||
"customPath": "./vendor/bin/phpunit" | ||
} | ||
} | ||
} |
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 @@ | ||
parameters: | ||
paths: | ||
- src | ||
level: 9 | ||
tmpDir: report/phpstan | ||
ignoreErrors: | ||
- '#return type has no value type specified in iterable type array#' | ||
reportUnmatchedIgnoredErrors: false |
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 |
---|---|---|
@@ -1,25 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
bootstrap="vendor/autoload.php" | ||
cacheResultFile="report/.phpunit.result.cache" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
bootstrap="vendor/autoload.php" | ||
failOnRisky="true" | ||
failOnWarning="true" | ||
cacheDirectory=".phpunit.cache" | ||
beStrictAboutOutputDuringTests="true"> | ||
|
||
<source> | ||
<include> | ||
<directory>src</directory> | ||
</include> | ||
</source> | ||
|
||
<testsuites> | ||
<testsuite name="default"> | ||
<directory suffix="Test.php">tests</directory> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<coverage> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
<report> | ||
<text outputFile="report/coverage.txt"/> | ||
<html outputDirectory="report/html/"/> | ||
<clover outputFile="report/coverage-clover.xml"/> | ||
</report> | ||
</coverage> | ||
|
||
<logging> | ||
<junit outputFile="report/execution-result.xml"/> | ||
</logging> | ||
|
||
</phpunit> |
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,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TinyBlocks\Vo; | ||
|
||
use TinyBlocks\Vo\Internal\Exceptions\InvalidProperty; | ||
use TinyBlocks\Vo\Internal\Exceptions\PropertyCannotBeChanged; | ||
use TinyBlocks\Vo\Internal\Exceptions\PropertyCannotBeDeactivated; | ||
|
||
/** | ||
* Defines immutability by restricting property modification. | ||
*/ | ||
interface Immutable | ||
{ | ||
/** | ||
* Does not allow to get unknown property. | ||
* @param mixed $key | ||
* @return void | ||
* @throws InvalidProperty Get unknown property. | ||
*/ | ||
public function __get(mixed $key): void; | ||
|
||
/** | ||
* Does not allow injection of unknown property. | ||
* @param mixed $key | ||
* @param mixed $value | ||
* @return void | ||
* @throws PropertyCannotBeChanged If set property. | ||
*/ | ||
public function __set(mixed $key, mixed $value): void; | ||
|
||
/** | ||
* Does not allow properties to be disabled. | ||
* @param mixed $key | ||
* @return void | ||
* @throws PropertyCannotBeDeactivated If disable property. | ||
*/ | ||
public function __unset(mixed $key): void; | ||
} |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TinyBlocks\Vo\Internal\Exceptions; | ||
|
||
use RuntimeException; | ||
|
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TinyBlocks\Vo\Internal\Exceptions; | ||
|
||
use RuntimeException; | ||
|
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TinyBlocks\Vo\Internal\Exceptions; | ||
|
||
use RuntimeException; | ||
|
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TinyBlocks\Vo; | ||
|
||
use TinyBlocks\Vo\Internal\Exceptions\InvalidProperty; | ||
|
Oops, something went wrong.