Skip to content

Commit ab607eb

Browse files
authored
Merge pull request #9 from inceptphp/0.1
cleaner php9 update
2 parents 908760c + e58f469 commit ab607eb

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
],
88
"license": "LGPL-2.1-or-later",
99
"require-dev": {
10+
"php-coveralls/php-coveralls": "2.5.2",
1011
"phpunit/phpunit": "9.5.21",
11-
"squizlabs/php_codesniffer": "3.7.1",
12-
"php-coveralls/php-coveralls": "2.5.2"
12+
"squizlabs/php_codesniffer": "3.7.1"
1313
},
1414
"require": {
15-
"phpugph/components": "1.0.5",
16-
"phpugph/handlebars": "1.0.3"
15+
"phpugph/components": "1.0.6",
16+
"phpugph/handlebars": "1.0.4"
1717
},
1818
"autoload": {
1919
"psr-4": {

src/Field/Input.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function render(
9898
$input->setAttribute('class', 'form-control system-form-control');
9999

100100
foreach ($this->attributes as $key => $attribute) {
101-
$input->setAttribute($key, $attribute);
101+
$input->setAttribute($key, (string) $attribute);
102102
}
103103

104104
if (static::INPUT_TYPE) {

src/Field/Updated.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class Updated extends Created
5050
*/
5151
public function prepare($value = null, string $name = null, array $row = [])
5252
{
53-
if (strtotime($value) !== false) {
54-
return date('Y-m-d H:i:s', strtotime($value));
53+
if (strtotime($value ?? '') !== false) {
54+
return date('Y-m-d H:i:s', strtotime($value ?? ''));
5555
}
5656

5757
return date('Y-m-d H:i:s');

src/Package/Config/ConfigPackage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct()
5252
*/
5353
public function exists(string $file, ...$path): bool
5454
{
55-
if (!is_dir((string) $this->path)) {
55+
if (!is_dir($this->path)) {
5656
throw ConfigException::forFolderNotSet();
5757
}
5858

@@ -80,7 +80,7 @@ public function exists(string $file, ...$path): bool
8080
*/
8181
public function get(string $file, ...$path)
8282
{
83-
if (!is_dir((string) $this->path)) {
83+
if (!is_dir($this->path)) {
8484
throw ConfigException::forFolderNotSet();
8585
}
8686

@@ -139,7 +139,7 @@ public function purge()
139139
*/
140140
public function set(string $file, ...$path): ConfigPackage
141141
{
142-
if (!is_dir((string) $this->path)) {
142+
if (!is_dir($this->path)) {
143143
throw ConfigException::forFolderNotSet();
144144
}
145145

src/Package/System/SystemPackage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function deflateRow(Schema $schema, array $row): array
184184
continue;
185185
}
186186

187-
$row[$key] = json_decode($row[$key], true);
187+
$row[$key] = json_decode($row[$key] ?? '', true);
188188
}
189189

190190
return $row;

test/Fieldset.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ public function testGetFolder()
149149
public function testGetForm()
150150
{
151151
$form = $this->object->getForm();
152-
$this->assertTrue(!!trim((string) $form['foo_title']));
153-
$this->assertTrue(!trim((string) $form['foo_formula']));
154-
$this->assertTrue(!trim((string) $form['foo_active']));
155-
$this->assertTrue(!trim((string) $form['foo_created']));
156-
$this->assertTrue(!trim((string) $form['foo_updated']));
152+
$this->assertTrue(!!trim($form['foo_title']));
153+
$this->assertTrue(!trim($form['foo_formula']));
154+
$this->assertTrue(!trim($form['foo_active']));
155+
$this->assertTrue(!trim($form['foo_created']));
156+
$this->assertTrue(!trim($form['foo_updated']));
157157
}
158158

159159
/**

0 commit comments

Comments
 (0)