Skip to content

Commit b5c8c9e

Browse files
refactor: add declare strict_types to all classes in ./src (#758)
* refactor: add declare strict_types to all classes in ./src * fix: correct regression from adding declare strict_types * refactor: enforce string at datetime casting * docs: add changelog entry
1 parent 63d6369 commit b5c8c9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+96
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions

src/JsonSchema/ConstraintError.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace JsonSchema;
46

57
use JsonSchema\Exception\InvalidArgumentException;

src/JsonSchema/Constraints/BaseConstraint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the JsonSchema package.
57
*

src/JsonSchema/Constraints/CollectionConstraint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the JsonSchema package.
57
*

src/JsonSchema/Constraints/ConstConstraint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the JsonSchema package.
57
*

src/JsonSchema/Constraints/Constraint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the JsonSchema package.
57
*

src/JsonSchema/Constraints/ConstraintInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the JsonSchema package.
57
*

src/JsonSchema/Constraints/EnumConstraint.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the JsonSchema package.
57
*

src/JsonSchema/Constraints/Factory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the JsonSchema package.
57
*

src/JsonSchema/Constraints/FormatConstraint.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/*
46
* This file is part of the JsonSchema package.
57
*
@@ -174,7 +176,7 @@ public function check(&$element, $schema = null, ?JsonPointer $path = null, $i =
174176

175177
protected function validateDateTime($datetime, $format)
176178
{
177-
$dt = \DateTime::createFromFormat($format, $datetime);
179+
$dt = \DateTime::createFromFormat($format, (string) $datetime);
178180

179181
if (!$dt) {
180182
return false;

0 commit comments

Comments
 (0)