Skip to content

Introduce PHPStan and PHPUnit infrastructure#4

Merged
dieselxxx merged 5 commits into
developfrom
chore/phpstan-phpunit-setup
Jun 23, 2026
Merged

Introduce PHPStan and PHPUnit infrastructure#4
dieselxxx merged 5 commits into
developfrom
chore/phpstan-phpunit-setup

Conversation

@danijelgalic

@danijelgalic danijelgalic commented Jun 19, 2026

Copy link
Copy Markdown

🪛 Generic / Task Pull Request

Related Issue

Description

This PR introduces foundational development tooling into the FireHub Core repository by integrating PHPStan for static analysis and PHPUnit for automated testing.

The goal is to establish a strict quality assurance baseline that ensures type safety, architectural consistency, and regression protection across the Core layer.

What this introduces

  • PHPStan configuration for static type analysis
  • PHPUnit setup for unit testing support
    Base directory structure for tests
  • Composer scripts for analysis and test execution (if applicable)
  • Initial foundation for future CI quality gates

Purpose

This change introduces and formalizes the development-time quality infrastructure for the Core Standard repository using PHPStan.

It ensures that all Core components are validated before merge through a centralized static analysis setup, enforcing strict architectural and type-safety guarantees across the FireHub ecosystem.

This establishes a clear separation between:

  • Core runtime logic (framework behavior)
  • Development-time validation layer (static analysis via PHPStan)

Changes

Implementation

  • Added phpstan.neon configuration file for project-level static analysis setup
  • Introduced GitHub Actions workflow PHPStan.yml
    • Runs PHPStan on every pull_request
    • Enforces static analysis before merge
  • Updated .gitattributes
    • Added /phpstan.neon export-ignore to exclude configuration from distribution artifacts
  • Updated composer.json:
    • Added development dependencies:
      • phpstan/phpstan
      • the-firehub-project/phpstan-rules: dev-develop
    • Integrated FireHub shared PHPStan ruleset into Core Standard

Dependencies

  • Added:

    • phpstan/phpstan:^2.0
    • the-firehub-project/phpstan-rules:dev-develop
  • Updated:

    • Development tooling stack for Core Standard validation layer

Compatibility

  • Backward compatibility:
    • Yes
    • No (explain below)

No runtime changes introduced. All changes are strictly development-time tooling and CI validation.

Testing

Verification

  • Manual testing performed
  • Changes verified locally
  • No unintended side effects are observed

Automated Tests

  • Unit / integration tests are added (if applicable)
  • All CI checks pass

Documentation

  • Documentation updated (if relevant)
  • Changelog updated (if applicable)

Checklist

  • Issue linked
  • Task clearly described
  • No unrelated changes are included
  • Code follows FireHub standards

Risks / Impact

  • Risk level:
    • None
    • Low
    • Medium
    • High

Potential Impact

  • Existing codebase may surface hidden type-safety or architectural violations under PHPStan analysis
  • CI may fail on previously untyped or loosely typed code paths
  • Developers may need minor adjustments to satisfy strict analysis rules

Areas Requiring Attention

  • Alignment between phpstan.neon and shared FireHub ruleset
  • Stability of dev-develop branch dependency for phpstan-rules
  • CI consistency across all Core repositories

Notes

Technical Notes

  • PHPStan is now an enforced architectural validation layer, not just a development tool
  • Configuration is intentionally separated from runtime logic
  • .gitattributes ensures tooling config does not leak into distribution artifacts

Reviewer Notes

Focus on:

  • correctness of CI enforcement model (PR-only execution)
  • proper separation between runtime and development-time concerns
  • stability of dependency on phpstan-rules (dev-develop)
  • long-term maintainability of shared static analysis architecture

Integrated foundational development tooling into the Core repository by configuring PHPStan for static analysis and bootstrapping PHPUnit for testing. Updated the README to reflect these changes and outline branch-specific details. This setup establishes a baseline for static guarantees, type safety, and deterministic testing, supporting future CI/CD integration and long-term architectural goals.
@danijelgalic danijelgalic moved this from Backlog to Draft in 📌 Core Development: v0 → v1 Jun 19, 2026
@danijelgalic danijelgalic added the type: Chore Minor housekeeping tasks that don’t affect functionality (cleanup, formatting, tooling). label Jun 19, 2026
@danijelgalic danijelgalic self-assigned this Jun 19, 2026
@danijelgalic danijelgalic linked an issue Jun 19, 2026 that may be closed by this pull request
1 task
Revised the `packagist` URL in the CITATION.cff file to reflect the correct namespace (`the-firehub-project/core-standard`). This ensures proper attribution and accurate package reference for external tools and repositories.
Configured PHPStan by introducing a `phpstan.neon` file and adding `phpstan/phpstan` and `the-firehub-project/phpstan-rules` as development dependencies in `composer.json`. Updated `.gitattributes` to exclude the configuration file from export. This enhances the repository with static analysis capabilities to ensure code quality and type safety.
Introduced a new GitHub Actions workflow (`PHPStan.yml`) to run static analysis on pull requests using PHPStan. The workflow leverages a reusable workflow for matrix execution across supported PHP versions, extensions, and tool configurations. This integration automates analysis for code quality and type safety, aligning with Core-Standard’s development practices.
@dieselxxx dieselxxx marked this pull request as ready for review June 23, 2026 08:54
@dieselxxx dieselxxx requested review from a team as code owners June 23, 2026 08:54
Introduced a new GitHub Actions workflow (`PHPStan.yml`) to run static analysis on pull requests using PHPStan. The workflow leverages a reusable workflow for matrix execution across supported PHP versions, extensions, and tool configurations. This integration automates analysis for code quality and type safety, aligning with Core-Standard’s development practices.
@dieselxxx dieselxxx merged commit 83ab232 into develop Jun 23, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in 🚩 Triage Jun 23, 2026
@dieselxxx dieselxxx deleted the chore/phpstan-phpunit-setup branch June 23, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: Chore Minor housekeeping tasks that don’t affect functionality (cleanup, formatting, tooling).

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

PHPStan and PHPUnit infrastructure

2 participants