Skip to content

Conversation

@borkweb
Copy link
Contributor

@borkweb borkweb commented Jul 12, 2025

I made some assumptions in this PR that may be inaccurate.

  1. I'm assuming we'll be using PHPStan. I'll PR a suggested phpstan.neon.dist in a follow-up PR.
  2. Is WordPress\AI the correct namespace? Updated to WordPress\AiClient

The main bits:

  • Configures package as wordpress/php-ai-client library
  • Requires PHP 7.4 or higher
  • Adds PHPUnit and PHPStan as dev dependencies and sets up initial configuration
  • Sets up PSR-4 autoloading with WordPress\AI namespace
  • Includes convenient scripts for testing and analysis
  • Adds keywords for package discovery
  • Add a dummy source file so phpstan and phpcs can be run

borkweb added 2 commits July 12, 2025 17:18
I made some assumptions in this PR that may be inaccurate.

1. I'm assuming we'll be using PHPStan. I'll PR a suggested `phpstan.neon.dist` in a follow-up PR.
2. Is `WordPress\AI` the correct namespace?

The main bits:

- Configures package as wordpress/php-ai-client library
- Requires PHP 7.4 or higher
- Adds PHPUnit and PHPStan as dev dependencies
- Sets up PSR-4 autoloading with WordPress\AI namespace
- Includes convenient scripts for testing and analysis
- Adds keywords for package discovery
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@borkweb Thanks for adding this, you beat me to it :D

Since the main purpose of this PR is to add composer.json, let's limit it to just that. The specific dependencies and their config should only be added together with their proper setup in other PRs (e.g. #17 that you already opened).

@felixarntz felixarntz added the [Tool] Issues related to development tooling, such as linting, testing, or CI label Jul 12, 2025
borkweb added 3 commits July 12, 2025 19:05
- Add phpstan.neon.dist with max level analysis
- Add phpcs.xml.dist with PSR-12 coding standards
- Configure both tools to scan src/ and tests/ directories
- Set up parallel processing and colored output for phpcs
@borkweb borkweb changed the title Add composer.json with PHP 7.4+ support Add composer.json with PHP 7.4+ support, phpcs, and phpstan Jul 12, 2025
borkweb and others added 2 commits July 12, 2025 19:23
Co-authored-by: Felix Arntz <flixos90@gmail.com>
Co-authored-by: Felix Arntz <flixos90@gmail.com>
@borkweb borkweb changed the title Add composer.json with PHP 7.4+ support, phpcs, and phpstan Add composer.json with PHP 7.4+ support, phpcs, phpstan, and phpunit Jul 12, 2025
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

Looks great! Just two minor comments, but I'm preemptively approving.

Other than this, it would be great to add a GitHub workflow that runs these tools on every commit and for pull requests. Feel free to add it here, or we could do it in a follow up PR.

Comment on lines +11 to +12
<!-- Use PSR-12 standard -->
<rule ref="PSR12"/>
Copy link
Member

Choose a reason for hiding this comment

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

As a note, here, we can encourage folks to use PER-3.0 in the CONTRIBUTING doc, as that extends PSR-12, but unfortunately PHPCS doesn't support PER.

@borkweb
Copy link
Contributor Author

borkweb commented Jul 13, 2025

Let's do the workflows in another PR 🕺

Copy link
Member

@JasonTheAdams JasonTheAdams left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together, @borkweb!

@JasonTheAdams JasonTheAdams merged commit d9e41b1 into WordPress:trunk Jul 13, 2025
@felixarntz felixarntz added this to the Finish the foundation milestone Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Tool] Issues related to development tooling, such as linting, testing, or CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants