Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend pipeline for newer versions php #746

Merged
merged 20 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b41bb84
ci: Add PHP 8.0 and greater to build matrix
DannyvdSluijs Jul 30, 2024
2d265b8
ci: Remove PHP 5.3 - 7.1 from workflows
DannyvdSluijs Jul 30, 2024
1aeadd7
build: Require minimum PHP 7.2
DannyvdSluijs Jul 30, 2024
58b2b76
build: Upgrade to PHPUnit 8.5
DannyvdSluijs Jul 30, 2024
2a431f2
refactor: Add now required void return types for setup() methods
DannyvdSluijs Jul 30, 2024
1c4f517
build: Include phpspec/prophecy dependency
DannyvdSluijs Aug 2, 2024
e6eac18
refactor: Replace setExpectedException with expectException/expectExc…
DannyvdSluijs Aug 2, 2024
eb41326
refactor: Replace @expectedException annotation for expectException m…
DannyvdSluijs Aug 2, 2024
0753efb
refactor: Replace assertInternalType for assertIsArray
DannyvdSluijs Aug 2, 2024
524853a
refactor: Replace getMock for createMock
DannyvdSluijs Aug 2, 2024
97a5203
test: Improve test assertions
DannyvdSluijs Aug 2, 2024
4e77e27
fix: Solve return type issues with Objectiterator (port of #682)
DannyvdSluijs Aug 2, 2024
db8111b
build: Update icecave/parity to ^3.0 as 1.0 uses deprecated each() me…
DannyvdSluijs Aug 2, 2024
6448d43
style: Correct code style issues
DannyvdSluijs Aug 2, 2024
ac94ea5
fix: Fix deprecation notices found from GHA workflow run
DannyvdSluijs Aug 2, 2024
5224ee9
fix: Add fallback to empty string when null value is passed in UriRes…
DannyvdSluijs Aug 2, 2024
bd4d321
fix: Port #717: Fixes for implicit nullability deprecation
DannyvdSluijs Aug 9, 2024
7f8d75a
ci: Avoid GHA run on each push and pull request; Include PHP 8.4 in m…
DannyvdSluijs Aug 9, 2024
b611aeb
ci(Drop-PHP-8.4-from-matrix): This PR adds phpspec/prophecy as an exp…
DannyvdSluijs Aug 9, 2024
b554f78
refactor: Replace ternary variable with explicit cast to string
DannyvdSluijs Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: "Continuous Integration"

on:
- push
- pull_request
push:
branches:
- master
pull_request:
branches:
- master

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
Expand All @@ -17,23 +21,20 @@ jobs:
strategy:
matrix:
php-version:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
# - "8.0"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
dependencies: [highest]
experimental: [false]
include:
- php-version: "5.3"
- php-version: "7.2"
dependencies: highest
experimental: false
- php-version: "5.3"
- php-version: "7.2"
dependencies: lowest
experimental: false
# - php-version: "8.0"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
php-version:
- "5.3"
- "7.2"
- "latest"

steps:
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
}
],
"require": {
"php": ">=5.3.3",
"php": "^7.2 || ^8.0",
"marc-mabe/php-enum":"^2.0 || ^3.0 || ^4.0",
"icecave/parity": "1.0.0"
"icecave/parity": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.2.20 || ~2.19.0",
"json-schema/json-schema-test-suite": "1.2.0",
"phpunit/phpunit": "^4.8.35"
"phpunit/phpunit": "^8.5",
"phpspec/prophecy": "^1.19"
},
"extra": {
"branch-alias": {
Expand Down
5 changes: 3 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
verbose="true"
>
Expand Down
4 changes: 2 additions & 2 deletions src/JsonSchema/Constraints/BaseConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class BaseConstraint
/**
* @param Factory $factory
*/
public function __construct(Factory $factory = null)
public function __construct(?Factory $factory = null)
{
$this->factory = $factory ?: new Factory();
}

public function addError(ConstraintError $constraint, JsonPointer $path = null, array $more = array())
public function addError(ConstraintError $constraint, ?JsonPointer $path = null, array $more = array())
{
$message = $constraint ? $constraint->getMessage() : '';
$name = $constraint ? $constraint->getValue() : '';
Expand Down
4 changes: 2 additions & 2 deletions src/JsonSchema/Constraints/CollectionConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CollectionConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null)
{
// Verify minItems
if (isset($schema->minItems) && count($value) < $schema->minItems) {
Expand Down Expand Up @@ -62,7 +62,7 @@ public function check(&$value, $schema = null, JsonPointer $path = null, $i = nu
* @param JsonPointer|null $path
* @param string $i
*/
protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
protected function validateItems(&$value, $schema = null, ?JsonPointer $path = null, $i = null)
{
if (is_object($schema->items)) {
// just one type definition for the whole array
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/ConstConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ConstConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
{
// Only validate const if the attribute exists
if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
Expand Down
28 changes: 14 additions & 14 deletions src/JsonSchema/Constraints/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ abstract class Constraint extends BaseConstraint implements ConstraintInterface
*
* @return JsonPointer;
*/
protected function incrementPath(JsonPointer $path = null, $i)
protected function incrementPath(?JsonPointer $path = null, $i)
{
$path = $path ?: new JsonPointer('');

Expand All @@ -66,7 +66,7 @@ protected function incrementPath(JsonPointer $path = null, $i)
* @param JsonPointer|null $path
* @param mixed $i
*/
protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
protected function checkArray(&$value, $schema = null, ?JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('collection');
$validator->check($value, $schema, $path, $i);
Expand All @@ -84,7 +84,7 @@ protected function checkArray(&$value, $schema = null, JsonPointer $path = null,
* @param mixed $additionalProperties
* @param mixed $patternProperties
*/
protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
protected function checkObject(&$value, $schema = null, ?JsonPointer $path = null, $properties = null,
$additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
{
/** @var ObjectConstraint $validator */
Expand All @@ -102,7 +102,7 @@ protected function checkObject(&$value, $schema = null, JsonPointer $path = null
* @param JsonPointer|null $path
* @param mixed $i
*/
protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
protected function checkType(&$value, $schema = null, ?JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('type');
$validator->check($value, $schema, $path, $i);
Expand All @@ -118,7 +118,7 @@ protected function checkType(&$value, $schema = null, JsonPointer $path = null,
* @param JsonPointer|null $path
* @param mixed $i
*/
protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
protected function checkUndefined(&$value, $schema = null, ?JsonPointer $path = null, $i = null, $fromDefault = false)
{
/** @var UndefinedConstraint $validator */
$validator = $this->factory->createInstanceFor('undefined');
Expand All @@ -136,7 +136,7 @@ protected function checkUndefined(&$value, $schema = null, JsonPointer $path = n
* @param JsonPointer|null $path
* @param mixed $i
*/
protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
protected function checkString($value, $schema = null, ?JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('string');
$validator->check($value, $schema, $path, $i);
Expand All @@ -147,12 +147,12 @@ protected function checkString($value, $schema = null, JsonPointer $path = null,
/**
* Checks a number element
*
* @param mixed $value
* @param mixed $schema
* @param JsonPointer $path
* @param mixed $i
* @param mixed $value
* @param mixed $schema
* @param JsonPointer|null $path
* @param mixed $i
*/
protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
protected function checkNumber($value, $schema = null, ?JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('number');
$validator->check($value, $schema, $path, $i);
Expand All @@ -168,7 +168,7 @@ protected function checkNumber($value, $schema = null, JsonPointer $path = null,
* @param JsonPointer|null $path
* @param mixed $i
*/
protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
protected function checkEnum($value, $schema = null, ?JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('enum');
$validator->check($value, $schema, $path, $i);
Expand All @@ -184,7 +184,7 @@ protected function checkEnum($value, $schema = null, JsonPointer $path = null, $
* @param JsonPointer|null $path
* @param mixed $i
*/
protected function checkConst($value, $schema = null, JsonPointer $path = null, $i = null)
protected function checkConst($value, $schema = null, ?JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('const');
$validator->check($value, $schema, $path, $i);
Expand All @@ -200,7 +200,7 @@ protected function checkConst($value, $schema = null, JsonPointer $path = null,
* @param JsonPointer|null $path
* @param mixed $i
*/
protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
protected function checkFormat($value, $schema = null, ?JsonPointer $path = null, $i = null)
{
$validator = $this->factory->createInstanceFor('format');
$validator->check($value, $schema, $path, $i);
Expand Down
4 changes: 2 additions & 2 deletions src/JsonSchema/Constraints/ConstraintInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function addErrors(array $errors);
* @param JsonPointer|null $path
* @param array $more more array elements to add to the error
*/
public function addError(ConstraintError $constraint, JsonPointer $path = null, array $more = array());
public function addError(ConstraintError $constraint, ?JsonPointer $path = null, array $more = array());

/**
* checks if the validator has not raised errors
Expand All @@ -61,5 +61,5 @@ public function isValid();
*
* @throws \JsonSchema\Exception\ExceptionInterface
*/
public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null);
}
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/EnumConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EnumConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
{
// Only validate enum if the attribute exists
if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
Expand Down
10 changes: 5 additions & 5 deletions src/JsonSchema/Constraints/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ class Factory
private $instanceCache = array();

/**
* @param SchemaStorage $schemaStorage
* @param UriRetrieverInterface $uriRetriever
* @param int $checkMode
* @param ?SchemaStorage $schemaStorage
* @param ?UriRetrieverInterface $uriRetriever
* @param int $checkMode
*/
public function __construct(
SchemaStorageInterface $schemaStorage = null,
UriRetrieverInterface $uriRetriever = null,
?SchemaStorageInterface $schemaStorage = null,
?UriRetrieverInterface $uriRetriever = null,
$checkMode = Constraint::CHECK_MODE_NORMAL
) {
// set provided config options
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/FormatConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FormatConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
{
if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/NumberConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class NumberConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
{
// Verify minimum
if (isset($schema->exclusiveMinimum)) {
Expand Down
10 changes: 5 additions & 5 deletions src/JsonSchema/Constraints/ObjectConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ObjectConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
public function check(&$element, $schema = null, ?JsonPointer $path = null, $properties = null,
$additionalProp = null, $patternProperties = null, $appliedDefaults = array())
{
if ($element instanceof UndefinedConstraint) {
Expand All @@ -52,7 +52,7 @@ public function check(&$element, $schema = null, JsonPointer $path = null, $prop
$this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
}

public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
public function validatePatternProperties($element, ?JsonPointer $path = null, $patternProperties)
{
$matches = array();
foreach ($patternProperties as $pregex => $schema) {
Expand Down Expand Up @@ -84,7 +84,7 @@ public function validatePatternProperties($element, JsonPointer $path = null, $p
* @param \StdClass $properties Properties
* @param mixed $additionalProp Additional properties
*/
public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
public function validateElement($element, $matches, $schema = null, ?JsonPointer $path = null,
$properties = null, $additionalProp = null)
{
$this->validateMinMaxConstraint($element, $schema, $path);
Expand Down Expand Up @@ -129,7 +129,7 @@ public function validateElement($element, $matches, $schema = null, JsonPointer
* @param \stdClass $properties Property definitions
* @param JsonPointer|null $path Path?
*/
public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
public function validateProperties(&$element, $properties = null, ?JsonPointer $path = null)
{
$undefinedConstraint = $this->factory->createInstanceFor('undefined');

Expand Down Expand Up @@ -171,7 +171,7 @@ protected function &getProperty(&$element, $property, $fallback = null)
* @param \stdClass $objectDefinition ObjectConstraint definition
* @param JsonPointer|null $path Path to test?
*/
protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
protected function validateMinMaxConstraint($element, $objectDefinition, ?JsonPointer $path = null)
{
// Verify minimum number of properties
if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/SchemaConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SchemaConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
{
if ($schema !== null) {
// passed schema
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/StringConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class StringConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
{
// Verify maxLength
if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/TypeConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TypeConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
public function check(&$value = null, $schema = null, ?JsonPointer $path = null, $i = null)
{
$type = isset($schema->type) ? $schema->type : null;
$isValid = false;
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/UndefinedConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class UndefinedConstraint extends Constraint
/**
* {@inheritdoc}
*/
public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null, $fromDefault = false)
{
if (is_null($schema) || !is_object($schema)) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Exception/JsonDecodingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class JsonDecodingException extends RuntimeException
{
public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
public function __construct($code = JSON_ERROR_NONE, ?\Exception $previous = null)
{
switch ($code) {
case JSON_ERROR_DEPTH:
Expand Down
Loading