Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make compatible with PHP8 (#14)
* feat: make compatible with PHP8
- Loading branch information
Showing
15 changed files
with
129 additions
and
107 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/vendor/ | ||
/composer.lock | ||
/build | ||
.phpunit.result.cache |
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,29 @@ | ||
<?php | ||
|
||
namespace Shaper\Tests\DataAdaptor; | ||
|
||
use Shaper\DataAdaptor\DataAdaptorBase; | ||
use Shaper\Util\Context; | ||
use Shaper\Validator\AcceptValidator; | ||
|
||
class DataAdaptorFake extends DataAdaptorBase { | ||
protected function doTransform($data, Context $context) { | ||
$key = $context->offsetExists('key') ? $context['key'] : 'lorem'; | ||
return $data->{$key}; | ||
} | ||
protected function doUndoTransform($data, Context $context) { | ||
$key = $context->offsetExists('key') ? $context['key'] : 'lorem'; | ||
return (object) [$key => $data, 'bar' => 'default']; | ||
} | ||
public function getInputValidator() { | ||
return new AcceptValidator(); | ||
} | ||
|
||
public function getInternalValidator() { | ||
return new AcceptValidator(); | ||
} | ||
|
||
public function getOutputValidator() { | ||
return new AcceptValidator(); | ||
} | ||
} |
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 | ||
|
||
namespace Shaper\Tests\DataAdaptor; | ||
|
||
use Shaper\DataAdaptor\DataAdaptorBase; | ||
use Shaper\Util\Context; | ||
use Shaper\Validator\AcceptValidator; | ||
|
||
class DataAdaptorFake2 extends DataAdaptorFake { | ||
public function conformsToExpectedInputShape($data, Context $context = NULL) { | ||
return 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Shaper\Tests\DataAdaptor; | ||
|
||
use Shaper\DataAdaptor\DataAdaptorBase; | ||
use Shaper\Util\Context; | ||
use Shaper\Validator\AcceptValidator; | ||
|
||
class DataAdaptorFake3 extends DataAdaptorFake { | ||
public function conformsToInternalShape($data, Context $context = NULL) { | ||
return 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Shaper\Tests\DataAdaptor; | ||
|
||
use Shaper\DataAdaptor\DataAdaptorBase; | ||
use Shaper\Util\Context; | ||
use Shaper\Validator\AcceptValidator; | ||
|
||
class DataAdaptorFake4 extends DataAdaptorFake { | ||
public function conformsToOutputShape($data, Context $context = NULL) { | ||
return 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
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 | ||
|
||
namespace Shaper\Tests\Transformation; | ||
|
||
use Shaper\Util\Context; | ||
|
||
class TransformationFail extends TransformationFake { | ||
protected function doTransform($data, Context $context) { | ||
return '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Shaper\Tests\Transformation; | ||
|
||
use JsonSchema\Validator; | ||
use Shaper\Transformation\TransformationBase; | ||
use Shaper\Util\Context; | ||
use Shaper\Validator\JsonSchemaValidator; | ||
|
||
class TransformationFake extends TransformationBase { | ||
public function getInputValidator() { | ||
return new JsonSchemaValidator(['type' => 'string'], new Validator()); | ||
} | ||
public function getOutputValidator() { | ||
return new JsonSchemaValidator(['type' => 'number'], new Validator()); | ||
} | ||
protected function doTransform($data, Context $context) { | ||
return 42; | ||
} | ||
|
||
} |
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
Oops, something went wrong.