Skip to content

Conversation

@davebarnwell
Copy link
Owner

Summary\n- Raise minimum PHP to 8.3 and upgrade PHPUnit\n- Add PostgreSQL support in ORM + tests\n- Add CI matrix (PHP + MySQL/Postgres), PHPStan, php-cs-fixer\n- Refresh docs and contributor guidance\n\n## Testing\n- vendor/bin/phpunit -c phpunit.xml.dist\n- MODEL_ORM_TEST_DSN=pgsql:host=127.0.0.1;port=5432;dbname=categorytest MODEL_ORM_TEST_USER=postgres MODEL_ORM_TEST_PASS=postgres vendor/bin/phpunit -c phpunit.xml.dist\n- vendor/bin/phpstan analyse --debug -c phpstan.neon\n- vendor/bin/php-cs-fixer fix --dry-run --diff

Copilot AI review requested due to automatic review settings January 30, 2026 22:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the library for PHP 8.3+, adds PostgreSQL support to the ORM, and wires in a contemporary tooling/CI setup (PHPUnit 10, PHPStan, php-cs-fixer, and a PHP/DB matrix in GitHub Actions).

Changes:

  • Raise the minimum PHP version to 8.3, upgrade PHPUnit to 10.x, and add PHPStan/php-cs-fixer configs and CI workflow.
  • Extend the Model ORM to support PostgreSQL (identifier quoting, schema discovery, insert/delete/update semantics) and update tests and example model to work against both MySQL/MariaDB and PostgreSQL.
  • Refresh documentation, contributor guidelines, and Docker compose to cover dual‑database development and local setup.

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Model/Model.php Refactors the core ORM for PHP 8.3 (type hints, safer PDO access), adds driver-aware identifier quoting and field discovery, introduces PostgreSQL-specific insert logic and LIMIT handling for UPDATE/DELETE, and tightens helpers like datetimeToMysqldatetime().
tests/Model/CategoryTest.php Updates the test suite to PHPUnit 10 style, parameterizes DB connection via env vars, and adds setup/teardown DDL for both MySQL/MariaDB and PostgreSQL.
test-src/Model/Category.php Namespaces the example model (App\Model), updates docblocks, and normalizes the table-name property visibility for use in tests.
phpunit.xml.dist Migrates the PHPUnit configuration to the 10.5 schema, enabling Composer autoload and on-disk cache, with the existing tests suite preserved.
phpstan.neon Introduces PHPStan level 9 analysis, covering src and tests, and configures Freshsauce\Model\Model as a universal object crate to handle dynamic properties.
docker-compose.yml Simplifies the compose file and defines local MariaDB and PostgreSQL services suitable for running the test suite.
.github/workflows/ci.yml Adds a GitHub Actions workflow to run PHP 8.3/8.4 against both MySQL and PostgreSQL, plus PHPStan and php-cs-fixer checks.
composer.json Normalizes the package name, raises the PHP requirement to >=8.3, and adds dev tools (phpunit/phpunit 10.x, phpstan/phpstan, friendsofphp/php-cs-fixer) plus PDO driver suggestions.
composer.lock Updates the dev dependency graph to match the new tooling stack (PHPUnit 10, PHPStan 1.12, php-cs-fixer 3.93, and related libraries).
README.md Updates usage docs for PHP 8.3, switches examples to Freshsauce\Model\Model, and documents basic PostgreSQL schema/connection and test invocation.
CONTRIBUTING.md Adds contributor guidance for setup, running tests, static analysis, formatting, and PR expectations.
CHANGELOG.md Starts a changelog describing the PHP 8.3 requirement, PostgreSQL support, and CI/tooling updates.
AGENTS.md Documents repository structure, tooling commands, coding conventions, and testing/CI norms for automated and human contributors.
.php-cs-fixer.dist.php Introduces a PSR‑12-based php-cs-fixer configuration targeting src, tests, and test-src.
.gitignore Ignores PHPUnit and php-cs-fixer caches in addition to vendor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@davebarnwell davebarnwell merged commit 57725fc into master Jan 30, 2026
4 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e70c8dfa59

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +909 to +913
if (!$hasData || !property_exists($this->data, $field) || !$this->isFieldDirty($field)) {
continue;
}
$columns[] = static::_quote_identifier($field);
if ($this->$field === null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid inserting NULL for unspecified columns

In setString, using property_exists($this->data, $field) means fields that were auto-hydrated to null are now treated as set and dirty. Because hydrate() assigns null to every column not in the input array, inserts will explicitly include those columns as NULL, overriding database defaults and potentially violating NOT NULL constraints. This is a behavioral regression versus the prior isset($this->$field) check (which skipped nulls), and it will surface whenever a model is created with only a subset of columns but the table relies on defaults or NOT NULL columns.

Useful? React with 👍 / 👎.

@davebarnwell davebarnwell deleted the chore-modernize-php83-postgres branch January 30, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants