Skip to content

Commit 80a3d7e

Browse files
committed
PHP 8.5 Support
1 parent 07ad3de commit 80a3d7e

File tree

9 files changed

+26
-18
lines changed

9 files changed

+26
-18
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
$config = include 'vendor/phpfui/phpunit-syntax-coverage/PhpCsFixer.php';
10+
$config->setUnsupportedPhpVersionAllowed(true);
1011

1112
return $config->setFinder(PhpCsFixer\Finder::create()
1213
->exclude('vendor')

Tests/Fixtures/Record/Definition/Order.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ public function initFieldDefinitions() : static
4848
if (! \count(static::$fields))
4949
{
5050
static::$fields = [
51-
'customer_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
52-
'employee_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
51+
'customer_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
52+
'employee_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
5353
'notes' => new \PHPFUI\ORM\FieldDefinition('longtext', 'string', 4294967295, true, null, ),
5454
'order_date' => new \PHPFUI\ORM\FieldDefinition('datetime', 'string', 20, false, 'CURRENT_TIMESTAMP', ),
5555
'order_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
5656
'order_status_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, 0, ),
57-
'order_tax_status_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
57+
'order_tax_status_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
5858
'paid_date' => new \PHPFUI\ORM\FieldDefinition('datetime', 'string', 20, true, null, ),
5959
'payment_type' => new \PHPFUI\ORM\FieldDefinition('varchar(50)', 'string', 50, true, null, ),
6060
'ship_address' => new \PHPFUI\ORM\FieldDefinition('longtext', 'string', 4294967295, true, null, ),
@@ -64,7 +64,7 @@ public function initFieldDefinitions() : static
6464
'ship_state_province' => new \PHPFUI\ORM\FieldDefinition('varchar(50)', 'string', 50, true, null, ),
6565
'ship_zip_postal_code' => new \PHPFUI\ORM\FieldDefinition('varchar(50)', 'string', 50, true, null, ),
6666
'shipped_date' => new \PHPFUI\ORM\FieldDefinition('datetime', 'string', 20, true, null, ),
67-
'shipper_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
67+
'shipper_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
6868
'shipping_fee' => new \PHPFUI\ORM\FieldDefinition('decimal(19,4)', 'float', 20, true, 0.0000, ),
6969
'tax_rate' => new \PHPFUI\ORM\FieldDefinition('double', 'float', 0, true, 0, ),
7070
'taxes' => new \PHPFUI\ORM\FieldDefinition('decimal(19,4)', 'float', 20, true, 0.0000, ),

Tests/Fixtures/Record/Definition/OrderDetail.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public function initFieldDefinitions() : static
4040
static::$fields = [
4141
'date_allocated' => new \PHPFUI\ORM\FieldDefinition('datetime', 'string', 20, true, null, ),
4242
'discount' => new \PHPFUI\ORM\FieldDefinition('double', 'float', 0, false, 0, ),
43-
'inventory_transaction_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
43+
'inventory_transaction_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
4444
'order_detail_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
45-
'order_detail_status_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
45+
'order_detail_status_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
4646
'order_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
47-
'product_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
48-
'purchase_order_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
47+
'product_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
48+
'purchase_order_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
4949
'quantity' => new \PHPFUI\ORM\FieldDefinition('decimal(18,4)', 'float', 19, false, 0.0000, ),
5050
'unit_price' => new \PHPFUI\ORM\FieldDefinition('decimal(19,4)', 'float', 20, true, 0.0000, ),
5151
];

Tests/Fixtures/Record/Definition/Product.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public function initFieldDefinitions() : static
4141
'description' => new \PHPFUI\ORM\FieldDefinition('longtext', 'string', 4294967295, true, null, ),
4242
'discontinued' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, 0, ),
4343
'list_price' => new \PHPFUI\ORM\FieldDefinition('decimal(19,4)', 'float', 20, false, 0.0000, ),
44-
'minimum_reorder_quantity' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
44+
'minimum_reorder_quantity' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
4545
'product_code' => new \PHPFUI\ORM\FieldDefinition('varchar(25)', 'string', 25, true, null, ),
4646
'product_id' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, false, ),
4747
'product_name' => new \PHPFUI\ORM\FieldDefinition('varchar(50)', 'string', 50, true, null, ),
4848
'quantity_per_unit' => new \PHPFUI\ORM\FieldDefinition('varchar(50)', 'string', 50, true, null, ),
49-
'reorder_level' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
49+
'reorder_level' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
5050
'standard_cost' => new \PHPFUI\ORM\FieldDefinition('decimal(19,4)', 'float', 20, true, 0.0000, ),
51-
'target_level' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, NULL, ),
51+
'target_level' => new \PHPFUI\ORM\FieldDefinition('integer', 'int', 0, true, null, ),
5252
];
5353
}
5454

Tests/bootstrap.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,16 @@ function loadFile(string $file) : void
8282
}
8383

8484
$pdo = new \PHPFUI\ORM\PDOInstance($dsn, $config['name'], $config['key']);
85+
8586
if ('mysql' == $driver)
8687
{
8788
$pdo->execute('set autocommit=0');
8889
}
8990

9091
\PHPFUI\ORM::addConnection($pdo);
92+
93+
$transaction = new \PHPFUI\ORM\Transaction();
94+
9195
\PHPFUI\ORM::$namespaceRoot = __DIR__ . '/..';
9296
\PHPFUI\ORM::$recordNamespace = 'Tests\\App\\Record';
9397
\PHPFUI\ORM::$tableNamespace = 'Tests\\App\\Table';
@@ -120,3 +124,5 @@ function loadFile(string $file) : void
120124
$modelGenerator->generate($table);
121125
$validatorGenerator->generate($table);
122126
}
127+
128+
$transaction->commit();

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=8.1 <8.5",
15+
"php": ">=8.1 <8.6",
1616
"phpfui/translation": "^1.0",
1717
"psr/log": "^3.0"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^10.0 | ^11.0 | ^12.0",
20+
"phpunit/phpunit": "<13.0",
2121
"phpfui/phpunit-syntax-coverage": "^1.0",
2222
"roave/security-advisories": "dev-latest",
2323
"friendsofphp/php-cs-fixer": "*",

src/PHPFUI/ORM/PDOInstance.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ public function describeTable(string $table) : array
6161

6262
foreach ($rows as $index => $row)
6363
{
64-
if ($row['Type'] == 'character varying' && $row['character_maximum_length'] != null)
64+
if ('character varying' == $row['Type'] && null != $row['character_maximum_length'])
6565
{
6666
$row['Type'] = 'varchar(' . $row['character_maximum_length'] . ')';
6767
}
68-
else if ($row['Type'] == 'text')
68+
elseif ('text' == $row['Type'])
6969
{
7070
$row['Type'] = 'longtext';
7171
}
@@ -80,6 +80,7 @@ public function describeTable(string $table) : array
8080
}
8181

8282
$fields = [];
83+
8384
foreach ($rows as $row)
8485
{
8586
$field = new \PHPFUI\ORM\Schema\Field($this, $row, $autoIncrement);

src/PHPFUI/ORM/Schema/Field.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(\PHPFUI\ORM\PDOInstance $pdo, array $fields, bool $a
2929
$this->type = \strtolower($fields['Type']);
3030
$this->nullable = 'YES' == $fields['Null'];
3131
$this->defaultValue = $fields['Default'];
32-
$this->primaryKey = $fields['Key'] == 'PRI';
32+
$this->primaryKey = 'PRI' == $fields['Key'];
3333
$this->autoIncrement = \str_contains($fields['Extra'], 'auto_increment');
3434
$this->extra = \str_replace('auto_increment', '', $fields['Extra']);
3535

testConfig.php

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

3-
//return ['dsn' => 'sqlite::memory:', 'name' => '', 'key' => ''];
3+
return ['dsn' => 'sqlite::memory:', 'name' => '', 'key' => ''];
44
//return ['dsn' => 'sqlite:' . __DIR__ . '/testdata.sqlite', 'name' => '', 'key' => '']; // *.sqlite is in .gitignore
5-
return ['dsn' => 'mysql:host=localhost;dbname=phpfui;port=3306;charset=utf8mb4;collation=utf8mb4_general_ci', 'name' => 'root', 'key' => ''];
5+
//return ['dsn' => 'mysql:host=localhost;dbname=phpfui;port=3306;charset=utf8mb4;collation=utf8mb4_general_ci', 'name' => 'root', 'key' => ''];
66

77

0 commit comments

Comments
 (0)