Skip to content

Commit

Permalink
fix: php 8.4 deprecations (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptmkenny authored Dec 3, 2024
1 parent 7d73018 commit 78e5142
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/DataAdaptor/DataAdaptorTransformerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trait DataAdaptorTransformerTrait {
/**
* {@inheritdoc}
*/
public function transform($data, Context $context = NULL) {
public function transform($data, ?Context $context = NULL) {
if (!isset($context)) {
$context = new Context();
}
Expand Down Expand Up @@ -40,7 +40,7 @@ public function transform($data, Context $context = NULL) {
/**
* {@inheritdoc}
*/
public function undoTransform($data, Context $context = NULL) {
public function undoTransform($data, ?Context $context = NULL) {
if (!isset($context)) {
$context = new Context();
}
Expand Down
2 changes: 1 addition & 1 deletion src/DataAdaptor/DataAdaptorValidatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait DataAdaptorValidatorTrait {
/**
* {@inheritdoc}
*/
public function conformsToInternalShape($data, Context $context = NULL) {
public function conformsToInternalShape($data, ?Context $context = NULL) {
return $this->getInternalValidator()->isValid($data);
}

Expand Down
2 changes: 1 addition & 1 deletion src/DataAdaptor/ReversibleTransformationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ interface ReversibleTransformationInterface {
* @throws \TypeError
* When the transformation cannot be applied.
*/
public function undoTransform($data, Context $context = NULL);
public function undoTransform($data, ?Context $context = NULL);

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface ReversibleTransformationValidationInterface extends TransformationVali
* @return bool
* TRUE if the format is valid.
*/
public function conformsToInternalShape($data, Context $context = NULL);
public function conformsToInternalShape($data, ?Context $context = NULL);

/**
* The validator for the internal data.
Expand Down
2 changes: 1 addition & 1 deletion src/Transformation/TransformationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ interface TransformationInterface {
* @throws \TypeError
* When the transformation cannot be applied.
*/
public function transform($data, Context $context = NULL);
public function transform($data, ?Context $context = NULL);

}
2 changes: 1 addition & 1 deletion src/Transformation/TransformationTransformerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trait TransformationTransformerTrait {
/**
* {@inheritdoc}
*/
public function transform($data, Context $context = NULL) {
public function transform($data, ?Context $context = NULL) {
if (!isset($context)) {
$context = new Context();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Transformation/TransformationValidationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface TransformationValidationInterface {
* @return bool
* TRUE if the transformation can be used with the supplied data.
*/
public function conformsToExpectedInputShape($data, Context $context = NULL);
public function conformsToExpectedInputShape($data, ?Context $context = NULL);

/**
* Checks if the transformed data conforms to the expected shape.
Expand All @@ -30,7 +30,7 @@ public function conformsToExpectedInputShape($data, Context $context = NULL);
* @return bool
* TRUE if the transformed data conforms to the expected shape.
*/
public function conformsToOutputShape($data, Context $context = NULL);
public function conformsToOutputShape($data, ?Context $context = NULL);

/**
* The validator for the input data.
Expand Down
4 changes: 2 additions & 2 deletions src/Transformation/TransformationValidationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ trait TransformationValidationTrait {
/**
* {@inheritdoc}
*/
public function conformsToExpectedInputShape($data, Context $context = NULL) {
public function conformsToExpectedInputShape($data, ?Context $context = NULL) {
return $this->getInputValidator()->isValid($data);
}

/**
* {@inheritdoc}
*/
public function conformsToOutputShape($data, Context $context = NULL) {
public function conformsToOutputShape($data, ?Context $context = NULL) {
return $this->getOutputValidator()->isValid($data);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Transformation/TransformationsQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TransformationsQueue extends \SplQueue implements TransformationInterface,
/**
* {@inheritdoc}
*/
public function transform($data, Context $context = NULL) {
public function transform($data, ?Context $context = NULL) {
if (!isset($context)) {
$context = new Context();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/JsonSchemaValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class JsonSchemaValidator extends ValidateableBase {
* @param \JsonSchema\Validator $validator
* The validator.
*/
public function __construct(array $schema = NULL, Validator $validator = NULL, $mode = NULL) {
public function __construct(?array $schema = NULL, ?Validator $validator = NULL, $mode = NULL) {
$this->schema = $schema;
$this->validator = $validator;
$this->checkMode = $mode;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/DataAdaptor/DataAdaptorFake2.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Shaper\Validator\AcceptValidator;

class DataAdaptorFake2 extends DataAdaptorFake {
public function conformsToExpectedInputShape($data, Context $context = NULL) {
public function conformsToExpectedInputShape($data, ?Context $context = NULL) {
return FALSE;
}
}
2 changes: 1 addition & 1 deletion tests/src/DataAdaptor/DataAdaptorFake3.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Shaper\Validator\AcceptValidator;

class DataAdaptorFake3 extends DataAdaptorFake {
public function conformsToInternalShape($data, Context $context = NULL) {
public function conformsToInternalShape($data, ?Context $context = NULL) {
return FALSE;
}
}
2 changes: 1 addition & 1 deletion tests/src/DataAdaptor/DataAdaptorFake4.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Shaper\Validator\AcceptValidator;

class DataAdaptorFake4 extends DataAdaptorFake {
public function conformsToOutputShape($data, Context $context = NULL) {
public function conformsToOutputShape($data, ?Context $context = NULL) {
return FALSE;
}
}

0 comments on commit 78e5142

Please sign in to comment.